diff options
author | saturneric <[email protected]> | 2024-01-05 12:55:15 +0000 |
---|---|---|
committer | saturneric <[email protected]> | 2024-01-05 12:55:15 +0000 |
commit | 644aa4397b03dbef73f8bfedc13925b51cad836b (patch) | |
tree | 7788d1cd2f0687dd8e576b111d9990c580092e7a /src/ui/dialog | |
parent | fix: slove some known issues (diff) | |
download | GpgFrontend-644aa4397b03dbef73f8bfedc13925b51cad836b.tar.gz GpgFrontend-644aa4397b03dbef73f8bfedc13925b51cad836b.zip |
feat: integrate logging api to core
Diffstat (limited to 'src/ui/dialog')
19 files changed, 126 insertions, 122 deletions
diff --git a/src/ui/dialog/GeneralDialog.cpp b/src/ui/dialog/GeneralDialog.cpp index 3556c403..d48e878d 100644 --- a/src/ui/dialog/GeneralDialog.cpp +++ b/src/ui/dialog/GeneralDialog.cpp @@ -49,21 +49,22 @@ void GpgFrontend::UI::GeneralDialog::slot_restore_settings() noexcept { if (window_save) { int x = general_windows_state.Check("window_pos").Check("x", 0), y = general_windows_state.Check("window_pos").Check("y", 0); - SPDLOG_DEBUG("stored dialog pos, x: {}, y: {}", x, y); + GF_UI_LOG_DEBUG("stored dialog pos, x: {}, y: {}", x, y); QPoint relative_pos = {x, y}; QPoint pos = parent_rect_.topLeft() + relative_pos; - SPDLOG_DEBUG("relative dialog pos, x: {}, y: {}", relative_pos.x(), - relative_pos.y()); + GF_UI_LOG_DEBUG("relative dialog pos, x: {}, y: {}", relative_pos.x(), + relative_pos.y()); int width = general_windows_state.Check("window_size").Check("width", 0), height = general_windows_state.Check("window_size").Check("height", 0); - SPDLOG_DEBUG("stored dialog size, width: {}, height: {}", width, height); + GF_UI_LOG_DEBUG("stored dialog size, width: {}, height: {}", width, + height); QRect target_rect_ = {pos.x(), pos.y(), width, height}; - SPDLOG_DEBUG("dialog stored target rect, width: {}, height: {}", width, - height); + GF_UI_LOG_DEBUG("dialog stored target rect, width: {}, height: {}", width, + height); // check for valid if (width > 0 && height > 0 && screen_rect_.contains(target_rect_)) { @@ -73,7 +74,7 @@ void GpgFrontend::UI::GeneralDialog::slot_restore_settings() noexcept { } } catch (...) { - SPDLOG_ERROR("error at restoring settings"); + GF_UI_LOG_ERROR("error at restoring settings"); } } @@ -83,14 +84,14 @@ void GpgFrontend::UI::GeneralDialog::slot_save_settings() noexcept { update_rect_cache(); - SPDLOG_DEBUG("dialog pos, x: {}, y: {}", rect_.x(), rect_.y()); - SPDLOG_DEBUG("dialog size, width: {}, height: {}", rect_.width(), - rect_.height()); + GF_UI_LOG_DEBUG("dialog pos, x: {}, y: {}", rect_.x(), rect_.y()); + GF_UI_LOG_DEBUG("dialog size, width: {}, height: {}", rect_.width(), + rect_.height()); // window position relative to parent auto relative_pos = rect_.topLeft() - parent_rect_.topLeft(); - SPDLOG_DEBUG("store dialog pos, x: {}, y: {}", relative_pos.x(), - relative_pos.y()); + GF_UI_LOG_DEBUG("store dialog pos, x: {}, y: {}", relative_pos.x(), + relative_pos.y()); general_windows_state["window_pos"]["x"] = relative_pos.x(); general_windows_state["window_pos"]["y"] = relative_pos.y(); @@ -100,7 +101,7 @@ void GpgFrontend::UI::GeneralDialog::slot_save_settings() noexcept { general_windows_state["window_save"] = true; } catch (...) { - SPDLOG_ERROR(name_, "error"); + GF_UI_LOG_ERROR(name_, "error"); } } @@ -109,8 +110,8 @@ void GpgFrontend::UI::GeneralDialog::setPosCenterOfScreen() { int screen_width = screen_rect_.width(); int screen_height = screen_rect_.height(); - SPDLOG_DEBUG("dialog current screen available geometry", screen_width, - screen_height); + GF_UI_LOG_DEBUG("dialog current screen available geometry", screen_width, + screen_height); // update rect of current dialog rect_ = this->geometry(); @@ -127,14 +128,14 @@ void GpgFrontend::UI::GeneralDialog::movePosition2CenterOfParent() { update_rect_cache(); // log for debug - SPDLOG_DEBUG("parent pos x: {} y: {}", parent_rect_.x(), parent_rect_.y()); - SPDLOG_DEBUG("parent size width: {}, height: {}", parent_rect_.width(), - parent_rect_.height()); - SPDLOG_DEBUG("parent center pos x: {}, y: {}", parent_rect_.center().x(), - parent_rect_.center().y()); - SPDLOG_DEBUG("dialog pos x: {} y: {}", rect_.x(), rect_.y()); - SPDLOG_DEBUG("dialog size width: {} height: {}", rect_.width(), - rect_.height()); + GF_UI_LOG_DEBUG("parent pos x: {} y: {}", parent_rect_.x(), parent_rect_.y()); + GF_UI_LOG_DEBUG("parent size width: {}, height: {}", parent_rect_.width(), + parent_rect_.height()); + GF_UI_LOG_DEBUG("parent center pos x: {}, y: {}", parent_rect_.center().x(), + parent_rect_.center().y()); + GF_UI_LOG_DEBUG("dialog pos x: {} y: {}", rect_.x(), rect_.y()); + GF_UI_LOG_DEBUG("dialog size width: {} height: {}", rect_.width(), + rect_.height()); if (parent_rect_.topLeft() != QPoint{0, 0} && parent_rect_.size() != QSize{0, 0}) { @@ -144,8 +145,9 @@ void GpgFrontend::UI::GeneralDialog::movePosition2CenterOfParent() { QPoint target_position = parent_rect_.center() - QPoint(rect_.width() / 2, rect_.height() / 2); - SPDLOG_DEBUG("update position to parent's center, target pos, x:{}, y: {}", - target_position.x(), target_position.y()); + GF_UI_LOG_DEBUG( + "update position to parent's center, target pos, x:{}, y: {}", + target_position.x(), target_position.y()); this->move(target_position); } else { @@ -199,8 +201,8 @@ bool GpgFrontend::UI::GeneralDialog::isRectRestored() { return rect_restored_; } * */ void GpgFrontend::UI::GeneralDialog::showEvent(QShowEvent *event) { - SPDLOG_DEBUG("General Dialog named {} is about to show, caught show event", - name_); + GF_UI_LOG_DEBUG("General Dialog named {} is about to show, caught show event", + name_); // default position strategy if (!isRectRestored()) movePosition2CenterOfParent(); diff --git a/src/ui/dialog/Wizard.cpp b/src/ui/dialog/Wizard.cpp index f379ffb0..bdb7a669 100644 --- a/src/ui/dialog/Wizard.cpp +++ b/src/ui/dialog/Wizard.cpp @@ -70,7 +70,7 @@ void Wizard::slot_wizard_accepted() { } GlobalSettingStation::GetInstance().SyncSettings(); } catch (...) { - SPDLOG_ERROR("setting operation error"); + GF_UI_LOG_ERROR("setting operation error"); } if (field("openHelp").toBool()) { emit SignalOpenHelp("docu.html#content"); diff --git a/src/ui/dialog/gnupg/GnuPGControllerDialog.cpp b/src/ui/dialog/gnupg/GnuPGControllerDialog.cpp index 57e972cd..d2bbf07b 100644 --- a/src/ui/dialog/gnupg/GnuPGControllerDialog.cpp +++ b/src/ui/dialog/gnupg/GnuPGControllerDialog.cpp @@ -95,8 +95,8 @@ GnuPGControllerDialog::GnuPGControllerDialog(QWidget* parent) this, _("Open Directory"), {}, QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); - SPDLOG_DEBUG("key databse path selected: {}", - selected_custom_key_database_path.toStdString()); + GF_UI_LOG_DEBUG("key databse path selected: {}", + selected_custom_key_database_path.toStdString()); if (!check_custom_gnupg_key_database_path( selected_custom_key_database_path.toStdString())) { @@ -131,8 +131,8 @@ GnuPGControllerDialog::GnuPGControllerDialog(QWidget* parent) this, _("Open Directory"), {}, QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); - SPDLOG_DEBUG("gnupg install path selected: {}", - selected_custom_gnupg_install_path.toStdString()); + GF_UI_LOG_DEBUG("gnupg install path selected: {}", + selected_custom_gnupg_install_path.toStdString()); // notify the user and precheck if (!check_custom_gnupg_path( @@ -189,12 +189,12 @@ GnuPGControllerDialog::GnuPGControllerDialog(QWidget* parent) void GnuPGControllerDialog::SlotAccept() { apply_settings(); - SPDLOG_DEBUG("gnupg controller apply done"); + GF_UI_LOG_DEBUG("gnupg controller apply done"); // write settings to filesystem GlobalSettingStation::GetInstance().SyncSettings(); - SPDLOG_DEBUG("restart needed: {}", get_restart_needed()); + GF_UI_LOG_DEBUG("restart needed: {}", get_restart_needed()); if (get_restart_needed()) { emit SignalRestartNeeded(get_restart_needed()); } @@ -208,7 +208,7 @@ void GnuPGControllerDialog::slot_update_custom_key_database_path_label( const auto database_path = Module::RetrieveRTValueTypedOrDefault<>( "core", "gpgme.ctx.database_path", std::string{}); - SPDLOG_DEBUG("got gpgme.ctx.database_path from rt: {}", database_path); + GF_UI_LOG_DEBUG("got gpgme.ctx.database_path from rt: {}", database_path); if (state != Qt::CheckState::Checked) { ui_->currentKeyDatabasePathLabel->setText( @@ -222,8 +222,8 @@ void GnuPGControllerDialog::slot_update_custom_key_database_path_label( GlobalSettingStation::GetInstance().LookupSettings( "general.custom_key_database_path", std::string{}); - SPDLOG_DEBUG("selected_custom_key_database_path from settings: {}", - custom_key_database_path); + GF_UI_LOG_DEBUG("selected_custom_key_database_path from settings: {}", + custom_key_database_path); // notify the user check_custom_gnupg_key_database_path(custom_key_database_path); @@ -247,7 +247,7 @@ void GnuPGControllerDialog::slot_update_custom_gnupg_install_path_label( const auto home_path = Module::RetrieveRTValueTypedOrDefault<>( "com.bktus.gpgfrontend.module.integrated.gnupg-info-gathering", "gnupg.home_path", std::string{}); - SPDLOG_DEBUG("got gnupg home path from rt: {}", home_path); + GF_UI_LOG_DEBUG("got gnupg home path from rt: {}", home_path); if (state != Qt::CheckState::Checked) { ui_->currentCustomGnuPGInstallPathLabel->setText( @@ -261,8 +261,8 @@ void GnuPGControllerDialog::slot_update_custom_gnupg_install_path_label( GlobalSettingStation::GetInstance().LookupSettings( "general.custom_gnupg_install_path", std::string{}); - SPDLOG_DEBUG("custom_gnupg_install_path from settings: {}", - custom_gnupg_install_path); + GF_UI_LOG_DEBUG("custom_gnupg_install_path from settings: {}", + custom_gnupg_install_path); // notify the user check_custom_gnupg_path(custom_gnupg_install_path); @@ -284,11 +284,11 @@ void GnuPGControllerDialog::set_settings() { try { bool non_ascii_when_export = settings.lookup("general.non_ascii_when_export"); - SPDLOG_DEBUG("non_ascii_when_export: {}", non_ascii_when_export); + GF_UI_LOG_DEBUG("non_ascii_when_export: {}", non_ascii_when_export); if (non_ascii_when_export) ui_->asciiModeCheckBox->setCheckState(Qt::Checked); } catch (...) { - SPDLOG_ERROR("setting operation error: non_ascii_when_export"); + GF_UI_LOG_ERROR("setting operation error: non_ascii_when_export"); } try { @@ -297,7 +297,7 @@ void GnuPGControllerDialog::set_settings() { if (use_custom_key_database_path) ui_->keyDatabseUseCustomCheckBox->setCheckState(Qt::Checked); } catch (...) { - SPDLOG_ERROR("setting operation error: use_custom_key_database_path"); + GF_UI_LOG_ERROR("setting operation error: use_custom_key_database_path"); } this->slot_update_custom_key_database_path_label( @@ -309,7 +309,7 @@ void GnuPGControllerDialog::set_settings() { if (use_custom_gnupg_install_path) ui_->useCustomGnuPGInstallPathCheckBox->setCheckState(Qt::Checked); } catch (...) { - SPDLOG_ERROR("setting operation error: use_custom_gnupg_install_path"); + GF_UI_LOG_ERROR("setting operation error: use_custom_gnupg_install_path"); } try { @@ -318,7 +318,7 @@ void GnuPGControllerDialog::set_settings() { if (use_pinentry_as_password_input_dialog) ui_->usePinentryAsPasswordInputDialogCheckBox->setCheckState(Qt::Checked); } catch (...) { - SPDLOG_ERROR( + GF_UI_LOG_ERROR( "setting operation error: use_pinentry_as_password_input_dialog"); } diff --git a/src/ui/dialog/help/AboutDialog.cpp b/src/ui/dialog/help/AboutDialog.cpp index 8d5ad896..7c534cbf 100644 --- a/src/ui/dialog/help/AboutDialog.cpp +++ b/src/ui/dialog/help/AboutDialog.cpp @@ -57,7 +57,7 @@ AboutDialog::AboutDialog(int defaultIndex, QWidget* parent) tab_widget->addTab(update_tab_, _("Update")); connect(tab_widget, &QTabWidget::currentChanged, this, - [&](int index) { SPDLOG_DEBUG("current index: {}", index); }); + [&](int index) { GF_UI_LOG_DEBUG("current index: {}", index); }); if (defaultIndex < tab_widget->count() && defaultIndex >= 0) { tab_widget->setCurrentIndex(defaultIndex); @@ -81,7 +81,7 @@ void AboutDialog::showEvent(QShowEvent* ev) { QDialog::showEvent(ev); } InfoTab::InfoTab(QWidget* parent) : QWidget(parent) { const auto gpgme_version = Module::RetrieveRTValueTypedOrDefault<>( "core", "gpgme.version", std::string{"2.0.0"}); - SPDLOG_DEBUG("got gpgme version from rt: {}", gpgme_version); + GF_UI_LOG_DEBUG("got gpgme version from rt: {}", gpgme_version); auto* pixmap = new QPixmap(":gpgfrontend-logo.png"); auto* text = new QString( @@ -205,7 +205,7 @@ UpdateTab::UpdateTab(QWidget* parent) : QWidget(parent) { void UpdateTab::showEvent(QShowEvent* event) { QWidget::showEvent(event); - SPDLOG_DEBUG("loading version loading info from rt"); + GF_UI_LOG_DEBUG("loading version loading info from rt"); auto is_loading_done = Module::RetrieveRTValueTypedOrDefault<>( "com.bktus.gpgfrontend.module.integrated.version-checking", @@ -216,7 +216,7 @@ void UpdateTab::showEvent(QShowEvent* event) { this, "com.bktus.gpgfrontend.module.integrated.version-checking", "version.loading_done", [=](Module::Namespace, Module::Key, int, std::any) { - SPDLOG_DEBUG( + GF_UI_LOG_DEBUG( "versionchecking version.loading_done changed, calling slot " "version upgrade"); this->slot_show_version_status(); @@ -228,7 +228,7 @@ void UpdateTab::showEvent(QShowEvent* event) { } void UpdateTab::slot_show_version_status() { - SPDLOG_DEBUG("loading version info from rt"); + GF_UI_LOG_DEBUG("loading version info from rt"); this->pb_->setHidden(true); auto is_loading_done = Module::RetrieveRTValueTypedOrDefault<>( @@ -236,7 +236,7 @@ void UpdateTab::slot_show_version_status() { "version.loading_done", false); if (!is_loading_done) { - SPDLOG_DEBUG("version info loading havn't been done yet."); + GF_UI_LOG_DEBUG("version info loading havn't been done yet."); return; } diff --git a/src/ui/dialog/help/GnupgTab.cpp b/src/ui/dialog/help/GnupgTab.cpp index cd48d2a8..ba5e464a 100644 --- a/src/ui/dialog/help/GnupgTab.cpp +++ b/src/ui/dialog/help/GnupgTab.cpp @@ -88,7 +88,7 @@ GpgFrontend::UI::GnupgTab::GnupgTab(QWidget* parent) void GpgFrontend::UI::GnupgTab::process_software_info() { const auto gnupg_version = Module::RetrieveRTValueTypedOrDefault<>( "core", "gpgme.ctx.gnupg_version", std::string{"2.0.0"}); - SPDLOG_DEBUG("got gnupg version from rt: {}", gnupg_version); + GF_UI_LOG_DEBUG("got gnupg version from rt: {}", gnupg_version); ui_->gnupgVersionLabel->setText( QString::fromStdString(fmt::format("Version: {}", gnupg_version))); @@ -96,7 +96,7 @@ void GpgFrontend::UI::GnupgTab::process_software_info() { auto components = Module::ListRTChildKeys( "com.bktus.gpgfrontend.module.integrated.gnupg-info-gathering", "gnupg.components"); - SPDLOG_DEBUG("got gnupg components from rt, size: {}", components.size()); + GF_UI_LOG_DEBUG("got gnupg components from rt, size: {}", components.size()); ui_->componentDetailsTable->setRowCount(components.size()); @@ -106,14 +106,14 @@ void GpgFrontend::UI::GnupgTab::process_software_info() { "com.bktus.gpgfrontend.module.integrated.gnupg-info-gathering", (boost::format("gnupg.components.%1%") % component).str(), std::string{}); - SPDLOG_DEBUG("got gnupg component {} info from rt, info: {}", component, - component_info_json); + GF_UI_LOG_DEBUG("got gnupg component {} info from rt, info: {}", component, + component_info_json); auto component_info = nlohmann::json::parse(component_info_json); if (!component_info.contains("name")) { - SPDLOG_WARN("illegal gnupg component info, json: {}", - component_info_json); + GF_UI_LOG_WARN("illegal gnupg component info, json: {}", + component_info_json); continue; } @@ -184,14 +184,14 @@ void GpgFrontend::UI::GnupgTab::process_software_info() { option) .str(), std::string{}); - SPDLOG_DEBUG("got gnupg component's option {} info from rt, info: {}", - component, option_info_json); + GF_UI_LOG_DEBUG("got gnupg component's option {} info from rt, info: {}", + component, option_info_json); auto option_info = nlohmann::json::parse(option_info_json); if (!option_info.contains("name")) { - SPDLOG_WARN("illegal gnupg configuation info, json: {}", - option_info_json); + GF_UI_LOG_WARN("illegal gnupg configuation info, json: {}", + option_info_json); continue; } diff --git a/src/ui/dialog/import_export/KeyServerImportDialog.cpp b/src/ui/dialog/import_export/KeyServerImportDialog.cpp index e8b9eb95..3a23b0df 100644 --- a/src/ui/dialog/import_export/KeyServerImportDialog.cpp +++ b/src/ui/dialog/import_export/KeyServerImportDialog.cpp @@ -191,7 +191,7 @@ auto KeyServerImportDialog::create_comboBox() -> QComboBox* { combo_box->setCurrentText(default_key_server.c_str()); } catch (...) { - SPDLOG_ERROR("setting operation error", "server_list", "default_server"); + GF_UI_LOG_ERROR("setting operation error", "server_list", "default_server"); } return combo_box; @@ -270,7 +270,7 @@ void KeyServerImportDialog::slot_search() { void KeyServerImportDialog::slot_search_finished( QNetworkReply::NetworkError error, QByteArray buffer) { - SPDLOG_DEBUG("search result {} {}", error, buffer.size()); + GF_UI_LOG_DEBUG("search result {} {}", error, buffer.size()); keys_table_->clearContents(); keys_table_->setRowCount(0); @@ -278,7 +278,7 @@ void KeyServerImportDialog::slot_search_finished( auto stream = QTextStream(buffer); if (error != QNetworkReply::NoError) { - SPDLOG_DEBUG("error from reply: {}", error); + GF_UI_LOG_DEBUG("error from reply: {}", error); switch (error) { case QNetworkReply::ContentNotFoundError: @@ -463,7 +463,8 @@ void KeyServerImportDialog::SlotImport(const KeyIdArgsListPtr& keys) { target_keyserver = default_key_server; } catch (...) { - SPDLOG_ERROR("setting operation error", "server_list", "default_server"); + GF_UI_LOG_ERROR("setting operation error", "server_list", + "default_server"); QMessageBox::critical( nullptr, _("Default Keyserver Not Found"), _("Cannot read default keyserver from your settings, " @@ -494,7 +495,7 @@ void KeyServerImportDialog::SlotImport(std::vector<std::string> key_ids, void KeyServerImportDialog::slot_import_finished( QNetworkReply::NetworkError error, QByteArray buffer) { if (error != QNetworkReply::NoError) { - SPDLOG_ERROR("Error From Reply", buffer.toStdString()); + GF_UI_LOG_ERROR("Error From Reply", buffer.toStdString()); if (!m_automatic_) { switch (error) { case QNetworkReply::ContentNotFoundError: diff --git a/src/ui/dialog/import_export/KeyUploadDialog.cpp b/src/ui/dialog/import_export/KeyUploadDialog.cpp index cc438364..f12149d8 100644 --- a/src/ui/dialog/import_export/KeyUploadDialog.cpp +++ b/src/ui/dialog/import_export/KeyUploadDialog.cpp @@ -89,11 +89,11 @@ void KeyUploadDialog::slot_upload_key_to_server( target_keyserver = key_server_list[default_key_server_index].get<std::string>(); - SPDLOG_DEBUG("set target key server to default key server: {}", - target_keyserver); + GF_UI_LOG_DEBUG("set target key server to default key server: {}", + target_keyserver); } catch (...) { - SPDLOG_ERROR(_("Cannot read default_keyserver From Settings")); + GF_UI_LOG_ERROR(_("Cannot read default_keyserver From Settings")); QMessageBox::critical(nullptr, _("Default Keyserver Not Found"), _("Cannot read default keyserver from your settings, " "please set a default keyserver first")); @@ -140,11 +140,11 @@ void KeyUploadDialog::slot_upload_finished() { auto* reply = qobject_cast<QNetworkReply*>(sender()); QByteArray response = reply->readAll(); - SPDLOG_DEBUG("response: {}", response.toStdString()); + GF_UI_LOG_DEBUG("response: {}", response.toStdString()); auto error = reply->error(); if (error != QNetworkReply::NoError) { - SPDLOG_DEBUG("error from reply: {}", reply->errorString().toStdString()); + GF_UI_LOG_DEBUG("error from reply: {}", reply->errorString().toStdString()); QString message; switch (error) { case QNetworkReply::ContentNotFoundError: @@ -164,7 +164,7 @@ void KeyUploadDialog::slot_upload_finished() { } else { QMessageBox::information(this, _("Upload Success"), _("Upload Public Key Successfully")); - SPDLOG_DEBUG("success while contacting keyserver!"); + GF_UI_LOG_DEBUG("success while contacting keyserver!"); } reply->deleteLater(); } diff --git a/src/ui/dialog/key_generate/KeygenDialog.cpp b/src/ui/dialog/key_generate/KeygenDialog.cpp index 61d07189..94cedc7f 100644 --- a/src/ui/dialog/key_generate/KeygenDialog.cpp +++ b/src/ui/dialog/key_generate/KeygenDialog.cpp @@ -151,7 +151,7 @@ void KeyGenDialog::slot_key_gen_accept() { }); }); - SPDLOG_DEBUG("key generation done"); + GF_UI_LOG_DEBUG("key generation done"); this->done(0); } else { @@ -242,7 +242,7 @@ void KeyGenDialog::slot_authentication_box_changed(int state) { } void KeyGenDialog::slot_activated_key_type(int index) { - SPDLOG_DEBUG("key type index changed: {}", index); + GF_UI_LOG_DEBUG("key type index changed: {}", index); // check assert(gen_key_info_->GetSupportedKeyAlgo().size() > diff --git a/src/ui/dialog/key_generate/SubkeyGenerateDialog.cpp b/src/ui/dialog/key_generate/SubkeyGenerateDialog.cpp index c0e8b240..4724344c 100644 --- a/src/ui/dialog/key_generate/SubkeyGenerateDialog.cpp +++ b/src/ui/dialog/key_generate/SubkeyGenerateDialog.cpp @@ -344,7 +344,7 @@ void SubkeyGenerateDialog::slot_authentication_box_changed(int state) { } void SubkeyGenerateDialog::slot_activated_key_type(int index) { - SPDLOG_DEBUG("key type index changed: {}", index); + GF_UI_LOG_DEBUG("key type index changed: {}", index); // check assert(gen_key_info_->GetSupportedSubkeyAlgo().size() > diff --git a/src/ui/dialog/keypair_details/KeyPairDetailTab.cpp b/src/ui/dialog/keypair_details/KeyPairDetailTab.cpp index 286192f2..673ff889 100644 --- a/src/ui/dialog/keypair_details/KeyPairDetailTab.cpp +++ b/src/ui/dialog/keypair_details/KeyPairDetailTab.cpp @@ -39,8 +39,8 @@ namespace GpgFrontend::UI { KeyPairDetailTab::KeyPairDetailTab(const std::string& key_id, QWidget* parent) : QWidget(parent), key_(GpgKeyGetter::GetInstance().GetKey(key_id)) { - SPDLOG_DEBUG(key_.GetEmail(), key_.IsPrivateKey(), key_.IsHasMasterKey(), - key_.GetSubKeys()->front().IsPrivateKey()); + GF_UI_LOG_DEBUG(key_.GetEmail(), key_.IsPrivateKey(), key_.IsHasMasterKey(), + key_.GetSubKeys()->front().IsPrivateKey()); owner_box_ = new QGroupBox(_("Owner")); key_box_ = new QGroupBox(_("Primary Key")); diff --git a/src/ui/dialog/keypair_details/KeyPairOperaTab.cpp b/src/ui/dialog/keypair_details/KeyPairOperaTab.cpp index 8fa7eb9c..9513c3c4 100644 --- a/src/ui/dialog/keypair_details/KeyPairOperaTab.cpp +++ b/src/ui/dialog/keypair_details/KeyPairOperaTab.cpp @@ -89,7 +89,7 @@ KeyPairOperaTab::KeyPairOperaTab(const std::string& key_id, QWidget* parent) forbid_all_gnupg_connection = settings.lookup("network.forbid_all_gnupg_connection"); } catch (...) { - SPDLOG_ERROR("setting operation error: forbid_all_gnupg_connection"); + GF_UI_LOG_ERROR("setting operation error: forbid_all_gnupg_connection"); } auto* key_server_opera_button = @@ -369,7 +369,7 @@ void KeyPairOperaTab::slot_modify_tofu_policy() { this, _("Modify TOFU Policy(Default is Auto)"), _("Policy for the Key Pair:"), items, 0, false, &ok); if (ok && !item.isEmpty()) { - SPDLOG_DEBUG("selected policy: {}", item.toStdString()); + GF_UI_LOG_DEBUG("selected policy: {}", item.toStdString()); gpgme_tofu_policy_t tofu_policy = GPGME_TOFU_POLICY_AUTO; if (item == _("Policy Auto")) { tofu_policy = GPGME_TOFU_POLICY_AUTO; diff --git a/src/ui/dialog/keypair_details/KeyPairSubkeyTab.cpp b/src/ui/dialog/keypair_details/KeyPairSubkeyTab.cpp index d7b4e47b..f6a5410e 100644 --- a/src/ui/dialog/keypair_details/KeyPairSubkeyTab.cpp +++ b/src/ui/dialog/keypair_details/KeyPairSubkeyTab.cpp @@ -37,8 +37,8 @@ namespace GpgFrontend::UI { KeyPairSubkeyTab::KeyPairSubkeyTab(const std::string& key_id, QWidget* parent) : QWidget(parent), key_(GpgKeyGetter::GetInstance().GetKey(key_id)) { - SPDLOG_DEBUG(key_.GetEmail(), key_.IsPrivateKey(), key_.IsHasMasterKey(), - key_.GetSubKeys()->front().IsPrivateKey()); + GF_UI_LOG_DEBUG(key_.GetEmail(), key_.IsPrivateKey(), key_.IsHasMasterKey(), + key_.GetSubKeys()->front().IsPrivateKey()); create_subkey_list(); create_subkey_opera_menu(); @@ -178,8 +178,8 @@ void KeyPairSubkeyTab::slot_refresh_subkey_list() { this->buffered_subkeys_.push_back(std::move(sub_key)); } - SPDLOG_DEBUG("buffered_subkeys_ refreshed size", - this->buffered_subkeys_.size()); + GF_UI_LOG_DEBUG("buffered_subkeys_ refreshed size", + this->buffered_subkeys_.size()); subkey_list_->setRowCount(buffered_subkeys_.size()); @@ -216,12 +216,12 @@ void KeyPairSubkeyTab::slot_refresh_subkey_list() { } } - SPDLOG_DEBUG("subkey_list_ item {} refreshed", row); + GF_UI_LOG_DEBUG("subkey_list_ item {} refreshed", row); row++; } - SPDLOG_DEBUG("subkey_list_ refreshed"); + GF_UI_LOG_DEBUG("subkey_list_ refreshed"); if (subkey_list_->rowCount() > 0) { subkey_list_->selectRow(0); @@ -327,7 +327,7 @@ void KeyPairSubkeyTab::create_subkey_opera_menu() { } void KeyPairSubkeyTab::slot_edit_subkey() { - SPDLOG_DEBUG("fpr {}", get_selected_subkey().GetFingerprint()); + GF_UI_LOG_DEBUG("fpr {}", get_selected_subkey().GetFingerprint()); auto dialog = new KeySetExpireDateDialog( key_.GetId(), get_selected_subkey().GetFingerprint(), this); diff --git a/src/ui/dialog/keypair_details/KeyPairUIDTab.cpp b/src/ui/dialog/keypair_details/KeyPairUIDTab.cpp index 1738be7a..20d47137 100644 --- a/src/ui/dialog/keypair_details/KeyPairUIDTab.cpp +++ b/src/ui/dialog/keypair_details/KeyPairUIDTab.cpp @@ -228,7 +228,7 @@ void KeyPairUIDTab::slot_refresh_tofu_info() { continue; } auto tofu_infos = uid.GetTofuInfos(); - SPDLOG_DEBUG("tofu info size: {}", tofu_infos->size()); + GF_UI_LOG_DEBUG("tofu info size: {}", tofu_infos->size()); if (tofu_infos->empty()) { tofu_tabs_->hide(); } else { @@ -400,7 +400,7 @@ void KeyPairUIDTab::slot_del_uid() { if (ret == QMessageBox::Yes) { for (const auto& uid : *selected_uids) { - SPDLOG_DEBUG("uid: {}", uid); + GF_UI_LOG_DEBUG("uid: {}", uid); if (!GpgUIDOperator::GetInstance().RevUID(m_key_, uid)) { QMessageBox::critical( nullptr, _("Operation Failed"), diff --git a/src/ui/dialog/keypair_details/KeySetExpireDateDialog.cpp b/src/ui/dialog/keypair_details/KeySetExpireDateDialog.cpp index 7730b25b..f81b85e9 100644 --- a/src/ui/dialog/keypair_details/KeySetExpireDateDialog.cpp +++ b/src/ui/dialog/keypair_details/KeySetExpireDateDialog.cpp @@ -60,8 +60,9 @@ KeySetExpireDateDialog::KeySetExpireDateDialog(const KeyId& key_id, } void KeySetExpireDateDialog::slot_confirm() { - SPDLOG_DEBUG("called: {} {}", ui_->dateEdit->date().toString().toStdString(), - ui_->timeEdit->time().toString().toStdString()); + GF_UI_LOG_DEBUG("called: {} {}", + ui_->dateEdit->date().toString().toStdString(), + ui_->timeEdit->time().toString().toStdString()); auto datetime = QDateTime(ui_->dateEdit->date(), ui_->timeEdit->time()); std::unique_ptr<boost::posix_time::ptime> expires = nullptr; if (ui_->noExpirationCheckBox->checkState() == Qt::Unchecked) { @@ -73,10 +74,10 @@ void KeySetExpireDateDialog::slot_confirm() { expires = std::make_unique<boost::posix_time::ptime>( boost::posix_time::from_time_t(datetime.toLocalTime().toTime_t())); #endif - SPDLOG_DEBUG("keyid: {}", m_key_.GetId(), m_subkey_, - to_iso_string(*expires)); + GF_UI_LOG_DEBUG("keyid: {}", m_key_.GetId(), m_subkey_, + to_iso_string(*expires)); } else { - SPDLOG_DEBUG("keyid: {}", m_key_.GetId(), m_subkey_, "Non Expired"); + GF_UI_LOG_DEBUG("keyid: {}", m_key_.GetId(), m_subkey_, "Non Expired"); } auto err = GpgKeyOpera::GetInstance().SetExpire(m_key_, m_subkey_, expires); @@ -108,10 +109,10 @@ void KeySetExpireDateDialog::init() { bool longer_expiration_date = false; try { longer_expiration_date = settings.lookup("general.longer_expiration_date"); - SPDLOG_DEBUG("longer_expiration_date: {}", longer_expiration_date); + GF_UI_LOG_DEBUG("longer_expiration_date: {}", longer_expiration_date); } catch (...) { - SPDLOG_ERROR("setting operation error: longer_expiration_date"); + GF_UI_LOG_ERROR("setting operation error: longer_expiration_date"); } auto max_date_time = diff --git a/src/ui/dialog/keypair_details/KeyUIDSignDialog.cpp b/src/ui/dialog/keypair_details/KeyUIDSignDialog.cpp index 54b6298a..97f20289 100644 --- a/src/ui/dialog/keypair_details/KeyUIDSignDialog.cpp +++ b/src/ui/dialog/keypair_details/KeyUIDSignDialog.cpp @@ -108,7 +108,7 @@ void KeyUIDSignDialog::slot_sign_key(bool clicked) { auto key_ids = m_key_list_->GetChecked(); auto keys = GpgKeyGetter::GetInstance().GetKeys(key_ids); - SPDLOG_DEBUG("key info got"); + GF_UI_LOG_DEBUG("key info got"); #ifdef GPGFRONTEND_GUI_QT6 auto expires = std::make_unique<boost::posix_time::ptime>(boost::posix_time::from_time_t( @@ -118,9 +118,9 @@ void KeyUIDSignDialog::slot_sign_key(bool clicked) { boost::posix_time::from_time_t(expires_edit_->dateTime().toTime_t())); #endif - SPDLOG_DEBUG("sign start"); + GF_UI_LOG_DEBUG("sign start"); for (const auto& uid : *m_uids_) { - SPDLOG_DEBUG("sign uid: {}", uid); + GF_UI_LOG_DEBUG("sign uid: {}", uid); // Sign For mKey if (!GpgKeyManager::GetInstance().SignKey(m_key_, *keys, uid, expires)) { QMessageBox::critical( diff --git a/src/ui/dialog/settings/SettingsDialog.cpp b/src/ui/dialog/settings/SettingsDialog.cpp index 5f083408..9815ba76 100644 --- a/src/ui/dialog/settings/SettingsDialog.cpp +++ b/src/ui/dialog/settings/SettingsDialog.cpp @@ -114,12 +114,12 @@ void SettingsDialog::SlotAccept() { key_server_tab_->ApplySettings(); network_tab_->ApplySettings(); - SPDLOG_DEBUG("apply done"); + GF_UI_LOG_DEBUG("apply done"); // write settings to filesystem GlobalSettingStation::GetInstance().SyncSettings(); - SPDLOG_DEBUG("restart needed: {}", get_restart_needed()); + GF_UI_LOG_DEBUG("restart needed: {}", get_restart_needed()); if (get_restart_needed()) { emit SignalRestartNeeded(get_restart_needed()); } @@ -138,7 +138,7 @@ QHash<QString, QString> SettingsDialog::ListLanguages() { for (int i = 0; i < file_names.size(); ++i) { QString locale = file_names[i]; - SPDLOG_DEBUG("locale: {}", locale.toStdString()); + GF_UI_LOG_DEBUG("locale: {}", locale.toStdString()); if (locale == "." || locale == "..") continue; // this works in qt 4.8 diff --git a/src/ui/dialog/settings/SettingsGeneral.cpp b/src/ui/dialog/settings/SettingsGeneral.cpp index eb698468..da5b4d05 100644 --- a/src/ui/dialog/settings/SettingsGeneral.cpp +++ b/src/ui/dialog/settings/SettingsGeneral.cpp @@ -127,7 +127,7 @@ void GeneralTab::SetSettings() { if (save_key_checked) ui_->saveCheckedKeysCheckBox->setCheckState(Qt::Checked); } catch (...) { - SPDLOG_ERROR("setting operation error: save_key_checked"); + GF_UI_LOG_ERROR("setting operation error: save_key_checked"); } try { @@ -136,7 +136,7 @@ void GeneralTab::SetSettings() { if (clear_gpg_password_cache) ui_->clearGpgPasswordCacheCheckBox->setCheckState(Qt::Checked); } catch (...) { - SPDLOG_ERROR("setting operation error: clear_gpg_password_cache"); + GF_UI_LOG_ERROR("setting operation error: clear_gpg_password_cache"); } try { @@ -145,24 +145,24 @@ void GeneralTab::SetSettings() { if (restore_text_editor_page) ui_->restoreTextEditorPageCheckBox->setCheckState(Qt::Checked); } catch (...) { - SPDLOG_ERROR("setting operation error: restore_text_editor_page"); + GF_UI_LOG_ERROR("setting operation error: restore_text_editor_page"); } try { bool longer_expiration_date = settings.lookup("general.longer_expiration_date"); - SPDLOG_DEBUG("longer_expiration_date: {}", longer_expiration_date); + GF_UI_LOG_DEBUG("longer_expiration_date: {}", longer_expiration_date); if (longer_expiration_date) ui_->longerKeyExpirationDateCheckBox->setCheckState(Qt::Checked); } catch (...) { - SPDLOG_ERROR("setting operation error: longer_expiration_date"); + GF_UI_LOG_ERROR("setting operation error: longer_expiration_date"); } #ifdef SUPPORT_MULTI_LANG try { std::string lang_key = settings.lookup("general.lang"); QString lang_value = lang_.value(lang_key.c_str()); - SPDLOG_DEBUG("lang settings current: {}", lang_value.toStdString()); + GF_UI_LOG_DEBUG("lang settings current: {}", lang_value.toStdString()); if (!lang_.empty()) { ui_->langSelectBox->setCurrentIndex( ui_->langSelectBox->findText(lang_value)); @@ -170,17 +170,17 @@ void GeneralTab::SetSettings() { ui_->langSelectBox->setCurrentIndex(0); } } catch (...) { - SPDLOG_ERROR("setting operation error: lang"); + GF_UI_LOG_ERROR("setting operation error: lang"); } #endif try { bool confirm_import_keys = settings.lookup("general.confirm_import_keys"); - SPDLOG_DEBUG("confirm_import_keys: {}", confirm_import_keys); + GF_UI_LOG_DEBUG("confirm_import_keys: {}", confirm_import_keys); if (confirm_import_keys) ui_->importConfirmationCheckBox->setCheckState(Qt::Checked); } catch (...) { - SPDLOG_ERROR("setting operation error: confirm_import_keys"); + GF_UI_LOG_ERROR("setting operation error: confirm_import_keys"); } } diff --git a/src/ui/dialog/settings/SettingsKeyServer.cpp b/src/ui/dialog/settings/SettingsKeyServer.cpp index 784721bf..617955f7 100644 --- a/src/ui/dialog/settings/SettingsKeyServer.cpp +++ b/src/ui/dialog/settings/SettingsKeyServer.cpp @@ -77,7 +77,7 @@ KeyserverTab::KeyserverTab(QWidget* parent) connect(ui_->keyServerListTable, &QTableWidget::itemChanged, [=](QTableWidgetItem* item) { - SPDLOG_DEBUG("item edited: {}", item->column()); + GF_UI_LOG_DEBUG("item edited: {}", item->column()); if (item->column() != 1) return; const auto row_size = ui_->keyServerListTable->rowCount(); // Update Actions @@ -141,7 +141,7 @@ void KeyserverTab::SetSettings() { key_server_str_list_.append(default_key_server.c_str()); default_key_server_ = QString::fromStdString(default_key_server); } catch (const std::exception& e) { - SPDLOG_ERROR("Error reading key-server settings: ", e.what()); + GF_UI_LOG_ERROR("Error reading key-server settings: ", e.what()); } } @@ -192,7 +192,7 @@ void KeyserverTab::ApplySettings() { } void KeyserverTab::slot_refresh_table() { - SPDLOG_INFO("start refreshing key server table"); + GF_UI_LOG_INFO("start refreshing key server table"); ui_->keyServerListTable->blockSignals(true); ui_->keyServerListTable->setRowCount(key_server_str_list_.size()); diff --git a/src/ui/dialog/settings/SettingsNetwork.cpp b/src/ui/dialog/settings/SettingsNetwork.cpp index 46941062..f6b96300 100644 --- a/src/ui/dialog/settings/SettingsNetwork.cpp +++ b/src/ui/dialog/settings/SettingsNetwork.cpp @@ -104,28 +104,28 @@ void GpgFrontend::UI::NetworkTab::SetSettings() { std::string proxy_host = settings.lookup("proxy.proxy_host"); ui_->proxyServerAddressEdit->setText(proxy_host.c_str()); } catch (...) { - SPDLOG_ERROR("setting operation error: proxy_host"); + GF_UI_LOG_ERROR("setting operation error: proxy_host"); } try { std::string std_username = settings.lookup("proxy.username"); ui_->usernameEdit->setText(std_username.c_str()); } catch (...) { - SPDLOG_ERROR("setting operation error: username"); + GF_UI_LOG_ERROR("setting operation error: username"); } try { std::string std_password = settings.lookup("proxy.password"); ui_->passwordEdit->setText(std_password.c_str()); } catch (...) { - SPDLOG_ERROR("setting operation error: password"); + GF_UI_LOG_ERROR("setting operation error: password"); } try { int port = settings.lookup("proxy.port"); ui_->portSpin->setValue(port); } catch (...) { - SPDLOG_ERROR("setting operation error: port"); + GF_UI_LOG_ERROR("setting operation error: port"); } ui_->proxyTypeComboBox->setCurrentText("HTTP"); @@ -133,7 +133,7 @@ void GpgFrontend::UI::NetworkTab::SetSettings() { std::string proxy_type = settings.lookup("proxy.proxy_type"); ui_->proxyTypeComboBox->setCurrentText(proxy_type.c_str()); } catch (...) { - SPDLOG_ERROR("setting operation error: proxy_type"); + GF_UI_LOG_ERROR("setting operation error: proxy_type"); } switch_ui_proxy_type(ui_->proxyTypeComboBox->currentText()); @@ -145,7 +145,7 @@ void GpgFrontend::UI::NetworkTab::SetSettings() { else ui_->enableProxyCheckBox->setCheckState(Qt::Unchecked); } catch (...) { - SPDLOG_ERROR("setting operation error: proxy_enable"); + GF_UI_LOG_ERROR("setting operation error: proxy_enable"); } ui_->forbidALLGnuPGNetworkConnectionCheckBox->setCheckState(Qt::Unchecked); @@ -158,7 +158,7 @@ void GpgFrontend::UI::NetworkTab::SetSettings() { ui_->forbidALLGnuPGNetworkConnectionCheckBox->setCheckState( Qt::Unchecked); } catch (...) { - SPDLOG_ERROR("setting operation error: forbid_all_gnupg_connection"); + GF_UI_LOG_ERROR("setting operation error: forbid_all_gnupg_connection"); } ui_->prohibitUpdateCheck->setCheckState(Qt::Unchecked); @@ -170,7 +170,7 @@ void GpgFrontend::UI::NetworkTab::SetSettings() { else ui_->prohibitUpdateCheck->setCheckState(Qt::Unchecked); } catch (...) { - SPDLOG_ERROR("setting operation error: prohibit_update_checking"); + GF_UI_LOG_ERROR("setting operation error: prohibit_update_checking"); } ui_->autoImportMissingKeyCheckBox->setCheckState(Qt::Unchecked); @@ -182,7 +182,7 @@ void GpgFrontend::UI::NetworkTab::SetSettings() { else ui_->autoImportMissingKeyCheckBox->setCheckState(Qt::Unchecked); } catch (...) { - SPDLOG_ERROR("setting operation error: auto_import_missing_key"); + GF_UI_LOG_ERROR("setting operation error: auto_import_missing_key"); } switch_ui_enabled(ui_->enableProxyCheckBox->isChecked()); |