feat: distinguish between develop, unstable and release versions

This commit is contained in:
saturneric 2024-11-21 22:51:22 +01:00
parent a50e82ffc4
commit 8d7f0577e2
4 changed files with 59 additions and 37 deletions

View File

@ -34,11 +34,12 @@
#include <qthread.h>
#include "core/utils/MemoryUtils.h"
#include "ui/GpgFrontendApplication.h"
namespace GpgFrontend {
void GpgFrontendContext::InitApplication() {
app_ = SecureCreateObject<QApplication>(argc, argv);
app_ = SecureCreateObject<UI::GpgFrontendApplication>(argc, argv);
}
auto GpgFrontendContext::GetApp() -> QApplication* { return app_; }

View File

@ -39,13 +39,22 @@ GpgFrontendApplication::GpgFrontendApplication(int &argc, char *argv[])
QIcon(":/icons/gpgfrontend.png"));
#endif
QString application_display_name = GetProjectName();
if (GetProjectBuildGitBranchName().contains("develop")) {
application_display_name +=
" " +
QString("Unstable (%1)").arg(GetProjectBuildGitCommitHash().last(6));
} else if (GetProjectBuildGitBranchName().contains("dev/")) {
application_display_name +=
" " + QString("Dev (%1)").arg(GetProjectBuildGitCommitHash().last(6));
}
LOG_I() << "Application Display Name: " << application_display_name;
// set the extra information of the build
GpgFrontendApplication::setApplicationVersion(GetProjectVersion());
GpgFrontendApplication::setApplicationName(QString::fromUtf8((PROJECT_NAME)));
GpgFrontendApplication::setApplicationDisplayName(
QString::fromUtf8((PROJECT_NAME)));
GpgFrontendApplication::setOrganizationName(
QString::fromUtf8((PROJECT_NAME)));
GpgFrontendApplication::setApplicationName(GetProjectName());
GpgFrontendApplication::setApplicationDisplayName(application_display_name);
// GpgFrontendApplication::setOrganizationName(GetProjectName());
GpgFrontendApplication::setQuitOnLastWindowClosed(true);
// don't show icons in menus

View File

@ -90,41 +90,54 @@ InfoTab::InfoTab(QWidget* parent) : QWidget(parent) {
"core", "gpgme.version", QString{"2.0.0"});
auto pixmap = QPixmap(":/icons/gpgfrontend_logo.png");
pixmap = pixmap.scaled(128, 128);
pixmap =
pixmap.scaled(128, 128, Qt::KeepAspectRatio, Qt::SmoothTransformation);
auto text =
"<center><h2>" + qApp->applicationName() + "</h2></center>" +
"<center><b>" + GetProjectVersion() + "</b></center>" + "<center>" +
GetProjectBuildGitVersion() + "</center>" + "<br><center>" +
tr("GpgFrontend is an easy-to-use, compact, cross-platform, "
"and installation-free GnuPG Frontend."
"It visualizes most of the common operations of GnuPG."
"GpgFrontend is licensed under the GPLv3") +
"<br><br>"
"<b>" +
tr("Developer:") + "</b><br>" + "Saturneric" + "<br><br>" +
QString app_info = "<h2 style='text-align:center;'>" +
qApp->applicationDisplayName() + "</h2>" + "<center><b>" +
GetProjectVersion() + "</b></center>" + "<center>" +
GetProjectBuildGitVersion() + "</center>";
QString developer_info =
"<b>" + tr("Developer:") + "</b> Saturneric" + "<br /><br />" +
tr("If you have any questions or suggestions, raise an issue at") +
"<br/>"
" <a href=\"https://github.com/saturneric/GpgFrontend\">GitHub</a> " +
tr("or send a mail to my mailing list at") + " <a " +
"href=\"mailto:eric@bktus.com\">eric@bktus.com</a>." + "<br><br> " +
tr("Built with Qt") + " " + qVersion() + ", " + OPENSSL_VERSION_TEXT +
" " + tr("and") + " " + "GPGME" + " " + gpgme_version + "<br>" +
tr("Built at") + " " + QLocale().toString(GetProjectBuildTimestamp()) +
"</center>";
tr("or send a mail to my mailing list at") +
" <a href=\"mailto:eric@bktus.com\">eric@bktus.com</a>.";
QString build_info = tr("Built with Qt") + " " + qVersion() + ", " +
OPENSSL_VERSION_TEXT + " " + tr("and") + " GPGME " +
gpgme_version + "<br>" + tr("Built at") + " " +
QLocale().toString(GetProjectBuildTimestamp());
auto* layout = new QVBoxLayout();
auto* layout = new QGridLayout();
auto* pixmap_label = new QLabel();
pixmap_label->setPixmap(pixmap);
layout->addWidget(pixmap_label, 0, 0, 1, -1, Qt::AlignCenter);
auto* about_label = new QLabel();
about_label->setText(text);
about_label->setWordWrap(true);
about_label->setOpenExternalLinks(true);
layout->addWidget(about_label, 1, 0, 1, -1);
layout->addItem(
new QSpacerItem(20, 10, QSizePolicy::Minimum, QSizePolicy::Fixed), 2, 1,
1, 1);
pixmap_label->setAlignment(Qt::AlignCenter);
layout->addWidget(pixmap_label);
auto* app_info_label = new QLabel(app_info);
app_info_label->setWordWrap(true);
app_info_label->setAlignment(Qt::AlignCenter);
layout->addWidget(app_info_label);
auto* dev_info_group = new QGroupBox(tr("Developer Information"));
auto* dev_layout = new QVBoxLayout();
auto* dev_info_label = new QLabel(developer_info);
dev_info_label->setWordWrap(true);
dev_info_label->setOpenExternalLinks(true);
dev_layout->addWidget(dev_info_label);
dev_info_group->setLayout(dev_layout);
layout->addWidget(dev_info_group);
auto* build_info_group = new QGroupBox(tr("Build Information"));
auto* build_layout = new QVBoxLayout();
auto* build_info_label = new QLabel(build_info);
build_info_label->setWordWrap(true);
build_layout->addWidget(build_info_label);
build_info_group->setLayout(build_layout);
layout->addWidget(build_info_group);
setLayout(layout);
}

View File

@ -43,8 +43,7 @@
namespace GpgFrontend::UI {
MainWindow::MainWindow() : GeneralMainWindow("main_window") {
// this->setMinimumSize(1200, 870);
this->setWindowTitle(qApp->applicationName());
this->setWindowTitle(qApp->applicationDisplayName());
}
void MainWindow::Init() noexcept {