72 lines
2.3 KiB
C++
72 lines
2.3 KiB
C++
#include "version_window.hpp"
|
|
#include "app_config.h"
|
|
#include "config.h"
|
|
#include "git_version.h"
|
|
#include <string>
|
|
|
|
namespace mc {
|
|
namespace {
|
|
const constexpr char g_gpl_text[] =
|
|
APP_SHORT_DESC "\n"
|
|
"Copyright (C) " COPYRIGHT_YEAR " Michele Santullo\n"
|
|
"\n"
|
|
"This program is free software: you can redistribute it and/or modify\n"
|
|
"it under the terms of the GNU General Public License as published by\n"
|
|
"the Free Software Foundation, either version 3 of the License, or\n"
|
|
"(at your option) any later version.\n"
|
|
"\n"
|
|
"This program is distributed in the hope that it will be useful,\n"
|
|
"but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
|
|
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
|
|
"GNU General Public License for more details.\n"
|
|
"\n"
|
|
"You should have received a copy of the GNU General Public License\n"
|
|
"along with this program. If not, see <https://www.gnu.org/licenses/>.\n"
|
|
;
|
|
} //unnamed namespace
|
|
|
|
VersionWindow::VersionWindow(nana::window owner) :
|
|
nana::form(owner, nana::size{615, 505}),
|
|
m_top_label(*this),
|
|
m_short_desc(*this),
|
|
m_git_revision(*this),
|
|
m_repo_link_1(*this),
|
|
m_repo_link_2(*this),
|
|
m_main_text(*this),
|
|
m_close(*this)
|
|
{
|
|
using std::string;
|
|
|
|
m_top_label.format(true);
|
|
m_top_label.caption("<size=14 center><bold>" APP_NAME "</></>");
|
|
|
|
m_short_desc.format(true);
|
|
m_short_desc.caption(std::string("is part of <bold>" PROJECT_NAME "</> v") + project_ver());
|
|
|
|
if constexpr (sizeof(PROJECT_GIT_SHA1) > 1) {
|
|
m_git_revision.caption("git revision " PROJECT_GIT_SHA1);
|
|
}
|
|
|
|
m_repo_link_1.format(true);
|
|
m_repo_link_1.caption("Official source code repository is available here:");
|
|
m_repo_link_2.format(true);
|
|
m_repo_link_2.caption(string("<url=\"") + PROJECT_REPO_URL + "\">" + PROJECT_REPO_URL + "</>");
|
|
|
|
m_main_text.editable(false);
|
|
m_main_text.caption(g_gpl_text);
|
|
|
|
m_close.caption("&Close");
|
|
m_close.events().click([this]() { this->close(); });
|
|
|
|
this->div("< vert margin=10 <vert top_label fit> <max=15> <main_text min=300> <max=15> <max=35 min=25 <><close><>> >");
|
|
(*this)["top_label"] << m_top_label << m_short_desc;
|
|
if constexpr (sizeof(PROJECT_GIT_SHA1) > 1) {
|
|
(*this)["top_label"] << m_git_revision;
|
|
}
|
|
(*this)["top_label"] << m_repo_link_1 << m_repo_link_2;
|
|
(*this)["main_text"] << m_main_text;
|
|
(*this)["close"] << m_close;
|
|
this->collocate();
|
|
}
|
|
|
|
} //namespace mc
|