diff options
Diffstat (limited to 'src/ui')
-rw-r--r-- | src/ui/dialog/controller/ModuleControllerDialog.cpp | 22 | ||||
-rw-r--r-- | src/ui/dialog/controller/ModuleControllerDialog.h | 2 | ||||
-rw-r--r-- | src/ui/dialog/help/AboutDialog.cpp | 31 | ||||
-rw-r--r-- | src/ui/dialog/help/AboutDialog.h | 3 | ||||
-rw-r--r-- | src/ui/dialog/help/GnupgTab.cpp | 16 | ||||
-rw-r--r-- | src/ui/main_window/MainWindow.cpp | 2 | ||||
-rw-r--r-- | src/ui/main_window/MainWindowSlotFunction.cpp | 10 |
7 files changed, 46 insertions, 40 deletions
diff --git a/src/ui/dialog/controller/ModuleControllerDialog.cpp b/src/ui/dialog/controller/ModuleControllerDialog.cpp index 309ad8e1..ad2bf918 100644 --- a/src/ui/dialog/controller/ModuleControllerDialog.cpp +++ b/src/ui/dialog/controller/ModuleControllerDialog.cpp @@ -40,10 +40,10 @@ ModuleControllerDialog::ModuleControllerDialog(QWidget* parent) : QDialog(parent), ui_(std::make_shared<Ui_ModuleControllerDialog>()), model_list_view_(new ModuleListView(this)), - module_mamager_(&Module::ModuleManager::GetInstance()) { + module_manager_(&Module::ModuleManager::GetInstance()) { ui_->setupUi(this); - model_list_view_->setMinimumWidth(250); + model_list_view_->setFixedWidth(250); model_list_view_->setViewMode(QListView::ListMode); model_list_view_->setMovement(QListView::Static); @@ -55,10 +55,10 @@ ModuleControllerDialog::ModuleControllerDialog(QWidget* parent) auto module_id = model_list_view_->GetCurrentModuleID(); if (module_id.isEmpty()) return; - if (!module_mamager_->IsModuleActivated(module_id)) { - module_mamager_->ActiveModule(module_id); + if (!module_manager_->IsModuleActivated(module_id)) { + module_manager_->ActiveModule(module_id); } else { - module_mamager_->DeactiveModule(module_id); + module_manager_->DeactiveModule(module_id); } QTimer::singleShot(1000, [=]() { slot_load_module_details(module_id); }); @@ -73,17 +73,17 @@ ModuleControllerDialog::ModuleControllerDialog(QWidget* parent) void ModuleControllerDialog::slot_load_module_details( Module::ModuleIdentifier module_id) { - GF_UI_LOG_DEBUG("loading module detailes, module id: {}", module_id); + GF_UI_LOG_DEBUG("loading module details, module id: {}", module_id); - auto module = module_mamager_->SearchModule(module_id); - - ui_->moduleIDLabel->setText(module->GetModuleIdentifier()); + auto module = module_manager_->SearchModule(module_id); QString buffer; QTextStream info(&buffer); + info << "# BASIC INFO" << Qt::endl << Qt::endl; + info << tr("ID") << ": " << module->GetModuleIdentifier() << Qt::endl; info << tr("Version") << ": " << module->GetModuleVersion() << Qt::endl; info << tr("SDK Version") << ": " << module->GetModuleSDKVersion() << Qt::endl; @@ -92,7 +92,7 @@ void ModuleControllerDialog::slot_load_module_details( info << tr("Hash") << ": " << module->GetModuleHash() << Qt::endl; info << tr("Path") << ": " << module->GetModulePath() << Qt::endl; - bool if_activated = module_mamager_->IsModuleActivated(module_id); + bool if_activated = module_manager_->IsModuleActivated(module_id); info << tr("Active") << ": " << (if_activated ? tr("True") : tr("False")) << Qt::endl; @@ -109,7 +109,7 @@ void ModuleControllerDialog::slot_load_module_details( info << "# Listening Event" << Qt::endl << Qt::endl; - auto listening_event_ids = module_mamager_->GetModuleListening(module_id); + auto listening_event_ids = module_manager_->GetModuleListening(module_id); for (const auto& event_id : listening_event_ids) { info << " - " << event_id << "\n"; } diff --git a/src/ui/dialog/controller/ModuleControllerDialog.h b/src/ui/dialog/controller/ModuleControllerDialog.h index 57444aea..001e4614 100644 --- a/src/ui/dialog/controller/ModuleControllerDialog.h +++ b/src/ui/dialog/controller/ModuleControllerDialog.h @@ -56,7 +56,7 @@ class ModuleControllerDialog : public QDialog { private: std::shared_ptr<Ui_ModuleControllerDialog> ui_; ///< ModuleListView* model_list_view_; - Module::ModuleManager* module_mamager_; + Module::ModuleManager* module_manager_; }; } // namespace GpgFrontend::UI diff --git a/src/ui/dialog/help/AboutDialog.cpp b/src/ui/dialog/help/AboutDialog.cpp index e1fa3535..cd577f89 100644 --- a/src/ui/dialog/help/AboutDialog.cpp +++ b/src/ui/dialog/help/AboutDialog.cpp @@ -42,14 +42,23 @@ AboutDialog::AboutDialog(int defaultIndex, QWidget* parent) 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::IsModuleAcivate("com.bktus.gpgfrontend.module." + "integrated.gnupg_info_gathering")) { + 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::IsModuleAcivate("com.bktus.gpgfrontend.module." + "integrated.version_checking")) { + 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); }); @@ -189,12 +198,12 @@ 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", + "com.bktus.gpgfrontend.module.integrated.version_checking", "version.loading_done", false); if (!is_loading_done) { Module::ListenRTPublishEvent( - this, "com.bktus.gpgfrontend.module.integrated.version-checking", + this, "com.bktus.gpgfrontend.module.integrated.version_checking", "version.loading_done", [=](Module::Namespace, Module::Key, int, std::any) { GF_UI_LOG_DEBUG( @@ -213,7 +222,7 @@ void UpdateTab::slot_show_version_status() { this->pb_->setHidden(true); auto is_loading_done = Module::RetrieveRTValueTypedOrDefault<>( - "com.bktus.gpgfrontend.module.integrated.version-checking", + "com.bktus.gpgfrontend.module.integrated.version_checking", "version.loading_done", false); if (!is_loading_done) { @@ -222,19 +231,19 @@ void UpdateTab::slot_show_version_status() { } auto is_need_upgrade = Module::RetrieveRTValueTypedOrDefault<>( - "com.bktus.gpgfrontend.module.integrated.version-checking", + "com.bktus.gpgfrontend.module.integrated.version_checking", "version.need_upgrade", false); auto is_current_a_withdrawn_version = Module::RetrieveRTValueTypedOrDefault<>( - "com.bktus.gpgfrontend.module.integrated.version-checking", + "com.bktus.gpgfrontend.module.integrated.version_checking", "version.current_a_withdrawn_version", false); auto is_current_version_released = Module::RetrieveRTValueTypedOrDefault<>( - "com.bktus.gpgfrontend.module.integrated.version-checking", + "com.bktus.gpgfrontend.module.integrated.version_checking", "version.current_version_released", false); auto latest_version = Module::RetrieveRTValueTypedOrDefault<>( - "com.bktus.gpgfrontend.module.integrated.version-checking", + "com.bktus.gpgfrontend.module.integrated.version_checking", "version.latest_version", QString{}); latest_version_label_->setText("<center><b>" + diff --git a/src/ui/dialog/help/AboutDialog.h b/src/ui/dialog/help/AboutDialog.h index b7871a29..86576123 100644 --- a/src/ui/dialog/help/AboutDialog.h +++ b/src/ui/dialog/help/AboutDialog.h @@ -129,9 +129,6 @@ class AboutDialog : public GeneralDialog { * @param ev */ void showEvent(QShowEvent* ev) override; - - private: - UpdateTab* update_tab_; ///< }; } // namespace GpgFrontend::UI diff --git a/src/ui/dialog/help/GnupgTab.cpp b/src/ui/dialog/help/GnupgTab.cpp index 1aceed1a..5d3f21aa 100644 --- a/src/ui/dialog/help/GnupgTab.cpp +++ b/src/ui/dialog/help/GnupgTab.cpp @@ -115,7 +115,7 @@ void GpgFrontend::UI::GnupgTab::process_software_info() { QString::fromStdString(fmt::format("Version: {}", gnupg_version))); auto components = Module::ListRTChildKeys( - "com.bktus.gpgfrontend.module.integrated.gnupg-info-gathering", + "com.bktus.gpgfrontend.module.integrated.gnupg_info_gathering", "gnupg.components"); GF_UI_LOG_DEBUG("got gnupg components from rt, size: {}", components.size()); @@ -124,7 +124,7 @@ void GpgFrontend::UI::GnupgTab::process_software_info() { int row = 0; for (auto& component : components) { auto component_info_json_bytes = Module::RetrieveRTValueTypedOrDefault( - "com.bktus.gpgfrontend.module.integrated.gnupg-info-gathering", + "com.bktus.gpgfrontend.module.integrated.gnupg_info_gathering", QString("gnupg.components.%1").arg(component), QByteArray{}); GF_UI_LOG_DEBUG("got gnupg component {} info from rt", component); @@ -171,7 +171,7 @@ void GpgFrontend::UI::GnupgTab::process_software_info() { ui_->componentDetailsTable->resizeColumnsToContents(); auto directories = Module::ListRTChildKeys( - "com.bktus.gpgfrontend.module.integrated.gnupg-info-gathering", + "com.bktus.gpgfrontend.module.integrated.gnupg_info_gathering", QString("gnupg.dirs")); ui_->directoriesDetailsTable->setRowCount(directories.size()); @@ -179,7 +179,7 @@ void GpgFrontend::UI::GnupgTab::process_software_info() { row = 0; for (auto& dir : directories) { const auto dir_path = Module::RetrieveRTValueTypedOrDefault( - "com.bktus.gpgfrontend.module.integrated.gnupg-info-gathering", + "com.bktus.gpgfrontend.module.integrated.gnupg_info_gathering", QString("gnupg.dirs.%1").arg(dir), QString{}); if (dir_path.isEmpty()) continue; @@ -201,12 +201,12 @@ void GpgFrontend::UI::GnupgTab::process_software_info() { row = 0; for (auto& component : components) { auto options = Module::ListRTChildKeys( - "com.bktus.gpgfrontend.module.integrated.gnupg-info-gathering", + "com.bktus.gpgfrontend.module.integrated.gnupg_info_gathering", QString("gnupg.components.%1.options").arg(component)); for (auto& option : options) { const auto option_info_json = QJsonDocument::fromJson(Module::RetrieveRTValueTypedOrDefault( - "com.bktus.gpgfrontend.module.integrated.gnupg-info-gathering", + "com.bktus.gpgfrontend.module.integrated.gnupg_info_gathering", QString("gnupg.components.%1.options.%2") .arg(component) .arg(option), @@ -228,12 +228,12 @@ void GpgFrontend::UI::GnupgTab::process_software_info() { QString configuration_group; for (auto& component : components) { auto options = Module::ListRTChildKeys( - "com.bktus.gpgfrontend.module.integrated.gnupg-info-gathering", + "com.bktus.gpgfrontend.module.integrated.gnupg_info_gathering", QString("gnupg.components.%1.options").arg(component)); for (auto& option : options) { auto option_info_json_bytes = Module::RetrieveRTValueTypedOrDefault( - "com.bktus.gpgfrontend.module.integrated.gnupg-info-gathering", + "com.bktus.gpgfrontend.module.integrated.gnupg_info_gathering", QString("gnupg.components.%1.options.%2").arg(component).arg(option), QByteArray{}); GF_UI_LOG_DEBUG("got gnupg component's option {} info from rt, info: {}", diff --git a/src/ui/main_window/MainWindow.cpp b/src/ui/main_window/MainWindow.cpp index a7bd63d8..c7acb5bc 100644 --- a/src/ui/main_window/MainWindow.cpp +++ b/src/ui/main_window/MainWindow.cpp @@ -131,7 +131,7 @@ void MainWindow::Init() noexcept { edit_->CurTextPage()->setFocus(); Module::ListenRTPublishEvent( - this, "com.bktus.gpgfrontend.module.integrated.version-checking", + this, "com.bktus.gpgfrontend.module.integrated.version_checking", "version.loading_done", [=](Module::Namespace, Module::Key, int, std::any) { GF_UI_LOG_DEBUG( diff --git a/src/ui/main_window/MainWindowSlotFunction.cpp b/src/ui/main_window/MainWindowSlotFunction.cpp index 61c5de56..8483b578 100644 --- a/src/ui/main_window/MainWindowSlotFunction.cpp +++ b/src/ui/main_window/MainWindowSlotFunction.cpp @@ -266,7 +266,7 @@ void MainWindow::slot_version_upgrade_nofity() { GF_UI_LOG_DEBUG( "slot version upgrade notify called, checking version info from rt..."); auto is_loading_done = Module::RetrieveRTValueTypedOrDefault<>( - "com.bktus.gpgfrontend.module.integrated.version-checking", + "com.bktus.gpgfrontend.module.integrated.version_checking", "version.loading_done", false); GF_UI_LOG_DEBUG("checking version info from rt, is loading done state: {}", @@ -277,19 +277,19 @@ void MainWindow::slot_version_upgrade_nofity() { } auto is_need_upgrade = Module::RetrieveRTValueTypedOrDefault<>( - "com.bktus.gpgfrontend.module.integrated.version-checking", + "com.bktus.gpgfrontend.module.integrated.version_checking", "version.need_upgrade", false); auto is_current_a_withdrawn_version = Module::RetrieveRTValueTypedOrDefault<>( - "com.bktus.gpgfrontend.module.integrated.version-checking", + "com.bktus.gpgfrontend.module.integrated.version_checking", "version.current_a_withdrawn_version", false); auto is_current_version_released = Module::RetrieveRTValueTypedOrDefault<>( - "com.bktus.gpgfrontend.module.integrated.version-checking", + "com.bktus.gpgfrontend.module.integrated.version_checking", "version.current_version_released", false); auto latest_version = Module::RetrieveRTValueTypedOrDefault<>( - "com.bktus.gpgfrontend.module.integrated.version-checking", + "com.bktus.gpgfrontend.module.integrated.version_checking", "version.latest_version", QString{}); GF_UI_LOG_DEBUG( |