aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui/dialog/help/AboutDialog.cpp
diff options
context:
space:
mode:
authorSaturn&Eric <[email protected]>2024-05-11 17:18:36 +0000
committerGitHub <[email protected]>2024-05-11 17:18:36 +0000
commitf909f2c4c35b187eb165ec5545e35d54c6d92bf3 (patch)
tree428fe9e63ecae6bb93be6f20cd2b1ee9b29ffd8d /src/ui/dialog/help/AboutDialog.cpp
parentMerge pull request #145 from jermanuts/jermanuts-wizard-links-update (diff)
parentfix: remove qt5compat and redirect dll output path of modules (diff)
downloadGpgFrontend-f909f2c4c35b187eb165ec5545e35d54c6d92bf3.tar.gz
GpgFrontend-f909f2c4c35b187eb165ec5545e35d54c6d92bf3.zip
Merge pull request #148 from saturneric/develop
Develop 2.1.3.1
Diffstat (limited to 'src/ui/dialog/help/AboutDialog.cpp')
-rw-r--r--src/ui/dialog/help/AboutDialog.cpp86
1 files changed, 44 insertions, 42 deletions
diff --git a/src/ui/dialog/help/AboutDialog.cpp b/src/ui/dialog/help/AboutDialog.cpp
index e4a189a3..0735ddba 100644
--- a/src/ui/dialog/help/AboutDialog.cpp
+++ b/src/ui/dialog/help/AboutDialog.cpp
@@ -30,35 +30,46 @@
#include <openssl/opensslv.h>
-#include <any>
-
-#include "GpgFrontendBuildInfo.h"
-#include "core/function/GlobalSettingStation.h"
#include "core/module/ModuleManager.h"
+#include "core/utils/BuildInfoUtils.h"
#include "ui/dialog/help/GnupgTab.h"
namespace GpgFrontend::UI {
-AboutDialog::AboutDialog(int defaultIndex, QWidget* parent)
+AboutDialog::AboutDialog(const QString& default_tab_name, QWidget* parent)
: GeneralDialog(typeid(AboutDialog).name(), parent) {
this->setWindowTitle(tr("About") + " " + qApp->applicationName());
auto* tab_widget = new QTabWidget;
auto* info_tab = new InfoTab();
- auto* gnupg_tab = new GnupgTab();
auto* translators_tab = new TranslatorsTab();
- update_tab_ = new UpdateTab();
tab_widget->addTab(info_tab, tr("About GpgFrontend"));
- tab_widget->addTab(gnupg_tab, tr("GnuPG"));
+
+ if (Module::IsModuleActivate(kGnuPGInfoGatheringModuleID)) {
+ auto* gnupg_tab = new GnupgTab();
+ tab_widget->addTab(gnupg_tab, tr("GnuPG"));
+ }
+
tab_widget->addTab(translators_tab, tr("Translators"));
- tab_widget->addTab(update_tab_, tr("Update"));
+
+ if (Module::IsModuleActivate(kVersionCheckingModuleID)) {
+ auto* update_tab = new UpdateTab();
+ tab_widget->addTab(update_tab, tr("Update"));
+ }
connect(tab_widget, &QTabWidget::currentChanged, this,
[&](int index) { GF_UI_LOG_DEBUG("current index: {}", index); });
- if (defaultIndex < tab_widget->count() && defaultIndex >= 0) {
- tab_widget->setCurrentIndex(defaultIndex);
+ int default_index = 0;
+ for (int i = 0; i < tab_widget->count(); i++) {
+ if (tab_widget->tabText(i) == default_tab_name) {
+ default_index = i;
+ }
+ }
+
+ if (default_index < tab_widget->count() && default_index >= 0) {
+ tab_widget->setCurrentIndex(default_index);
}
auto* button_box = new QDialogButtonBox(QDialogButtonBox::Ok);
@@ -69,7 +80,7 @@ AboutDialog::AboutDialog(int defaultIndex, QWidget* parent)
main_layout->addWidget(button_box);
setLayout(main_layout);
- this->resize(550, 650);
+ this->resize(520, 620);
this->setMinimumWidth(450);
this->show();
}
@@ -81,11 +92,13 @@ InfoTab::InfoTab(QWidget* parent) : QWidget(parent) {
"core", "gpgme.version", QString{"2.0.0"});
GF_UI_LOG_DEBUG("got gpgme version from rt: {}", gpgme_version);
- auto* pixmap = new QPixmap(":/icons/gpgfrontend-logo.png");
- auto* text = new QString(
+ auto pixmap = QPixmap(":/icons/gpgfrontend_logo.png");
+ pixmap = pixmap.scaled(128, 128);
+
+ auto text =
"<center><h2>" + qApp->applicationName() + "</h2></center>" +
- "<center><b>" + qApp->applicationVersion() + "</b></center>" +
- "<center>" + GIT_VERSION + "</center>" + "<br><center>" +
+ "<center><b>" + "v" + qApp->applicationVersion() + "</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."
@@ -100,14 +113,15 @@ InfoTab::InfoTab(QWidget* parent) : QWidget(parent) {
"href=\"mailto:[email protected]\">[email protected]</a>." + "<br><br> " +
tr("Built with Qt") + " " + qVersion() + ", " + OPENSSL_VERSION_TEXT +
" " + tr("and") + " " + "GPGME" + " " + gpgme_version + "<br>" +
- tr("Built at") + " " + BUILD_TIMESTAMP + "</center>");
+ tr("Built at") + " " + QLocale().toString(GetProjectBuildTimestamp()) +
+ "</center>";
auto* layout = new QGridLayout();
auto* pixmap_label = new QLabel();
- pixmap_label->setPixmap(*pixmap);
+ 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->setText(text);
about_label->setWordWrap(true);
about_label->setOpenExternalLinks(true);
layout->addWidget(about_label, 1, 0, 1, -1);
@@ -139,14 +153,9 @@ TranslatorsTab::TranslatorsTab(QWidget* parent) : QWidget(parent) {
}
UpdateTab::UpdateTab(QWidget* parent) : QWidget(parent) {
- auto* pixmap = new QPixmap(":/icons/gpgfrontend-logo.png");
auto* layout = new QGridLayout();
- auto* pixmap_label = new QLabel();
- pixmap_label->setPixmap(*pixmap);
- layout->addWidget(pixmap_label, 0, 0, 1, -1, Qt::AlignCenter);
- current_version_ =
- QString("v") + VERSION_MAJOR + "." + VERSION_MINOR + "." + VERSION_PATCH;
+ current_version_ = GetProjectVersion();
auto* tips_label = new QLabel();
tips_label->setText(
@@ -194,17 +203,15 @@ void UpdateTab::showEvent(QShowEvent* event) {
GF_UI_LOG_DEBUG("loading version loading info from rt");
auto is_loading_done = Module::RetrieveRTValueTypedOrDefault<>(
- "com.bktus.gpgfrontend.module.integrated.version-checking",
- "version.loading_done", false);
+ kVersionCheckingModuleID, "version.loading_done", false);
if (!is_loading_done) {
Module::ListenRTPublishEvent(
- this, "com.bktus.gpgfrontend.module.integrated.version-checking",
- "version.loading_done",
+ this, kVersionCheckingModuleID, "version.loading_done",
[=](Module::Namespace, Module::Key, int, std::any) {
GF_UI_LOG_DEBUG(
- "versionchecking version.loading_done changed, calling slot "
- "version upgrade");
+ "version_checking module version.loading_done changed, calling "
+ "slot version upgrade");
this->slot_show_version_status();
});
Module::TriggerEvent("CHECK_APPLICATION_VERSION");
@@ -218,29 +225,24 @@ void UpdateTab::slot_show_version_status() {
this->pb_->setHidden(true);
auto is_loading_done = Module::RetrieveRTValueTypedOrDefault<>(
- "com.bktus.gpgfrontend.module.integrated.version-checking",
- "version.loading_done", false);
+ kVersionCheckingModuleID, "version.loading_done", false);
if (!is_loading_done) {
- GF_UI_LOG_DEBUG("version info loading havn't been done yet.");
+ GF_UI_LOG_DEBUG("version info loading haven't been done yet.");
return;
}
auto is_need_upgrade = Module::RetrieveRTValueTypedOrDefault<>(
- "com.bktus.gpgfrontend.module.integrated.version-checking",
- "version.need_upgrade", false);
+ kVersionCheckingModuleID, "version.need_upgrade", false);
auto is_current_a_withdrawn_version = Module::RetrieveRTValueTypedOrDefault<>(
- "com.bktus.gpgfrontend.module.integrated.version-checking",
- "version.current_a_withdrawn_version", false);
+ kVersionCheckingModuleID, "version.current_a_withdrawn_version", false);
auto is_current_version_released = Module::RetrieveRTValueTypedOrDefault<>(
- "com.bktus.gpgfrontend.module.integrated.version-checking",
- "version.current_version_released", false);
+ kVersionCheckingModuleID, "version.current_version_released", false);
auto latest_version = Module::RetrieveRTValueTypedOrDefault<>(
- "com.bktus.gpgfrontend.module.integrated.version-checking",
- "version.latest_version", QString{});
+ kVersionCheckingModuleID, "version.latest_version", QString{});
latest_version_label_->setText("<center><b>" +
tr("Latest Version From Github") + ": " +