From 63dbe4a917d89c30b0bf5c45d65c2a2e9ccb907b Mon Sep 17 00:00:00 2001 From: saturneric Date: Fri, 17 May 2024 18:33:21 +0200 Subject: fix: cannot show version in about tab --- src/ui/dialog/help/AboutDialog.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/ui/dialog/help/AboutDialog.cpp') diff --git a/src/ui/dialog/help/AboutDialog.cpp b/src/ui/dialog/help/AboutDialog.cpp index 0735ddba..6fe56d76 100644 --- a/src/ui/dialog/help/AboutDialog.cpp +++ b/src/ui/dialog/help/AboutDialog.cpp @@ -97,8 +97,8 @@ InfoTab::InfoTab(QWidget* parent) : QWidget(parent) { auto text = "

" + qApp->applicationName() + "

" + - "
" + "v" + qApp->applicationVersion() + "
" + - "
" + GetProjectBuildGitVersion() + "
" + "
" + + "
" + GetProjectVersion() + "
" + "
" + + GetProjectBuildGitVersion() + "
" + "
" + tr("GpgFrontend is an easy-to-use, compact, cross-platform, " "and installation-free GnuPG Frontend." "It visualizes most of the common operations of GnuPG." -- cgit v1.2.3 From d1d6859e2a50a78f57388ebf0a06f0636d4d0910 Mon Sep 17 00:00:00 2001 From: saturneric Date: Fri, 12 Jul 2024 20:38:16 +0200 Subject: feat: add some ui apis to sdk --- src/ui/dialog/help/AboutDialog.cpp | 146 +++---------------------------------- 1 file changed, 10 insertions(+), 136 deletions(-) (limited to 'src/ui/dialog/help/AboutDialog.cpp') diff --git a/src/ui/dialog/help/AboutDialog.cpp b/src/ui/dialog/help/AboutDialog.cpp index 6fe56d76..307dfca6 100644 --- a/src/ui/dialog/help/AboutDialog.cpp +++ b/src/ui/dialog/help/AboutDialog.cpp @@ -32,6 +32,7 @@ #include "core/module/ModuleManager.h" #include "core/utils/BuildInfoUtils.h" +#include "ui/UIModuleManager.h" #include "ui/dialog/help/GnupgTab.h" namespace GpgFrontend::UI { @@ -53,9 +54,15 @@ AboutDialog::AboutDialog(const QString& default_tab_name, QWidget* parent) tab_widget->addTab(translators_tab, tr("Translators")); - if (Module::IsModuleActivate(kVersionCheckingModuleID)) { - auto* update_tab = new UpdateTab(); - tab_widget->addTab(update_tab, tr("Update")); + auto entries = + UIModuleManager::GetInstance().QueryMountedEntries("AboutDialogTabs"); + + for (const auto& entry : entries) { + auto* widget = entry.GetWidget(); + if (widget != nullptr) { + tab_widget->addTab(widget, + entry.GetMetaDataByDefault("TabTitle", tr("Unnamed"))); + } } connect(tab_widget, &QTabWidget::currentChanged, this, @@ -152,137 +159,4 @@ TranslatorsTab::TranslatorsTab(QWidget* parent) : QWidget(parent) { setLayout(main_layout); } -UpdateTab::UpdateTab(QWidget* parent) : QWidget(parent) { - auto* layout = new QGridLayout(); - - current_version_ = GetProjectVersion(); - - auto* tips_label = new QLabel(); - tips_label->setText( - "
" + - tr("It is recommended that you always check the version " - "of GpgFrontend and upgrade to the latest version.") + - "
" + - tr("New versions not only represent new features, but " - "also often represent functional and security fixes.") + - "
"); - tips_label->setWordWrap(true); - - current_version_label_ = new QLabel(); - current_version_label_->setText("
" + tr("Current Version") + - tr(": ") + "" + current_version_ + - "
"); - current_version_label_->setWordWrap(true); - - latest_version_label_ = new QLabel(); - latest_version_label_->setWordWrap(true); - - upgrade_label_ = new QLabel(); - upgrade_label_->setWordWrap(true); - upgrade_label_->setOpenExternalLinks(true); - upgrade_label_->setHidden(true); - - pb_ = new QProgressBar(); - pb_->setRange(0, 0); - pb_->setTextVisible(false); - - layout->addWidget(tips_label, 1, 0, 1, -1); - layout->addWidget(current_version_label_, 2, 0, 1, -1); - layout->addWidget(latest_version_label_, 3, 0, 1, -1); - layout->addWidget(upgrade_label_, 4, 0, 1, -1); - layout->addWidget(pb_, 5, 0, 1, -1); - layout->addItem( - new QSpacerItem(20, 10, QSizePolicy::Minimum, QSizePolicy::Fixed), 2, 1, - 1, 1); - - setLayout(layout); -} - -void UpdateTab::showEvent(QShowEvent* event) { - QWidget::showEvent(event); - GF_UI_LOG_DEBUG("loading version loading info from rt"); - - auto is_loading_done = Module::RetrieveRTValueTypedOrDefault<>( - kVersionCheckingModuleID, "version.loading_done", false); - - if (!is_loading_done) { - Module::ListenRTPublishEvent( - this, kVersionCheckingModuleID, "version.loading_done", - [=](Module::Namespace, Module::Key, int, std::any) { - GF_UI_LOG_DEBUG( - "version_checking module version.loading_done changed, calling " - "slot version upgrade"); - this->slot_show_version_status(); - }); - Module::TriggerEvent("CHECK_APPLICATION_VERSION"); - } else { - slot_show_version_status(); - } -} - -void UpdateTab::slot_show_version_status() { - GF_UI_LOG_DEBUG("loading version info from rt"); - this->pb_->setHidden(true); - - auto is_loading_done = Module::RetrieveRTValueTypedOrDefault<>( - kVersionCheckingModuleID, "version.loading_done", false); - - if (!is_loading_done) { - GF_UI_LOG_DEBUG("version info loading haven't been done yet."); - return; - } - - auto is_need_upgrade = Module::RetrieveRTValueTypedOrDefault<>( - kVersionCheckingModuleID, "version.need_upgrade", false); - - auto is_current_a_withdrawn_version = Module::RetrieveRTValueTypedOrDefault<>( - kVersionCheckingModuleID, "version.current_a_withdrawn_version", false); - - auto is_current_version_released = Module::RetrieveRTValueTypedOrDefault<>( - kVersionCheckingModuleID, "version.current_version_released", false); - - auto latest_version = Module::RetrieveRTValueTypedOrDefault<>( - kVersionCheckingModuleID, "version.latest_version", QString{}); - - latest_version_label_->setText("
" + - tr("Latest Version From Github") + ": " + - latest_version + "
"); - - if (is_need_upgrade) { - upgrade_label_->setText( - "
" + - tr("The current version is less than the latest version on " - "github.") + - "
" + tr("Please click") + - " " + - tr("Here") + " " + tr("to download the latest stable version.") + - "
"); - upgrade_label_->show(); - } else if (is_current_a_withdrawn_version) { - upgrade_label_->setText( - "
" + - tr("This version has serious problems and has been withdrawn. " - "Please stop using it immediately.") + - "
" + tr("Please click") + - " " + - tr("Here") + " " + tr("to download the latest stable version.") + - "
"); - upgrade_label_->show(); - } else if (!is_current_version_released) { - upgrade_label_->setText( - "
" + - tr("This version has not been released yet, it may be a beta " - "version. If you are not a tester and care about version " - "stability, please do not use this version.") + - "
" + tr("Please click") + - " " + - tr("Here") + " " + tr("to download the latest stable version.") + - "
"); - upgrade_label_->show(); - } -} - } // namespace GpgFrontend::UI -- cgit v1.2.3 From 71ca9724b8cc8b6041641121776177b088935919 Mon Sep 17 00:00:00 2001 From: saturneric Date: Wed, 24 Jul 2024 16:00:36 +0200 Subject: feat: move out GnuPGTab --- src/ui/dialog/help/AboutDialog.cpp | 6 ------ 1 file changed, 6 deletions(-) (limited to 'src/ui/dialog/help/AboutDialog.cpp') diff --git a/src/ui/dialog/help/AboutDialog.cpp b/src/ui/dialog/help/AboutDialog.cpp index 307dfca6..b4410942 100644 --- a/src/ui/dialog/help/AboutDialog.cpp +++ b/src/ui/dialog/help/AboutDialog.cpp @@ -33,7 +33,6 @@ #include "core/module/ModuleManager.h" #include "core/utils/BuildInfoUtils.h" #include "ui/UIModuleManager.h" -#include "ui/dialog/help/GnupgTab.h" namespace GpgFrontend::UI { @@ -47,11 +46,6 @@ AboutDialog::AboutDialog(const QString& default_tab_name, QWidget* parent) tab_widget->addTab(info_tab, tr("About GpgFrontend")); - if (Module::IsModuleActivate(kGnuPGInfoGatheringModuleID)) { - auto* gnupg_tab = new GnupgTab(); - tab_widget->addTab(gnupg_tab, tr("GnuPG")); - } - tab_widget->addTab(translators_tab, tr("Translators")); auto entries = -- cgit v1.2.3 From 37a62a8d0b590710b902376ca3320cc05e954b63 Mon Sep 17 00:00:00 2001 From: saturneric Date: Fri, 26 Jul 2024 18:24:34 +0200 Subject: feat: remove spdlog and clean up log --- src/ui/dialog/help/AboutDialog.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src/ui/dialog/help/AboutDialog.cpp') diff --git a/src/ui/dialog/help/AboutDialog.cpp b/src/ui/dialog/help/AboutDialog.cpp index b4410942..14cb76ad 100644 --- a/src/ui/dialog/help/AboutDialog.cpp +++ b/src/ui/dialog/help/AboutDialog.cpp @@ -59,9 +59,6 @@ AboutDialog::AboutDialog(const QString& default_tab_name, QWidget* parent) } } - connect(tab_widget, &QTabWidget::currentChanged, this, - [&](int index) { GF_UI_LOG_DEBUG("current index: {}", index); }); - int default_index = 0; for (int i = 0; i < tab_widget->count(); i++) { if (tab_widget->tabText(i) == default_tab_name) { @@ -91,7 +88,6 @@ void AboutDialog::showEvent(QShowEvent* ev) { QDialog::showEvent(ev); } InfoTab::InfoTab(QWidget* parent) : QWidget(parent) { const auto gpgme_version = Module::RetrieveRTValueTypedOrDefault<>( "core", "gpgme.version", QString{"2.0.0"}); - GF_UI_LOG_DEBUG("got gpgme version from rt: {}", gpgme_version); auto pixmap = QPixmap(":/icons/gpgfrontend_logo.png"); pixmap = pixmap.scaled(128, 128); -- cgit v1.2.3