aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui
diff options
context:
space:
mode:
authorsaturneric <[email protected]>2024-01-05 12:55:15 +0000
committersaturneric <[email protected]>2024-01-05 12:55:15 +0000
commit644aa4397b03dbef73f8bfedc13925b51cad836b (patch)
tree7788d1cd2f0687dd8e576b111d9990c580092e7a /src/ui
parentfix: slove some known issues (diff)
downloadGpgFrontend-644aa4397b03dbef73f8bfedc13925b51cad836b.tar.gz
GpgFrontend-644aa4397b03dbef73f8bfedc13925b51cad836b.zip
feat: integrate logging api to core
Diffstat (limited to '')
-rw-r--r--src/ui/GpgFrontendApplication.cpp14
-rw-r--r--src/ui/GpgFrontendUI.h13
-rw-r--r--src/ui/GpgFrontendUIInit.cpp104
-rw-r--r--src/ui/GpgFrontendUIInit.h12
-rw-r--r--src/ui/UserInterfaceUtils.cpp30
-rw-r--r--src/ui/dialog/GeneralDialog.cpp56
-rw-r--r--src/ui/dialog/Wizard.cpp2
-rw-r--r--src/ui/dialog/gnupg/GnuPGControllerDialog.cpp34
-rw-r--r--src/ui/dialog/help/AboutDialog.cpp12
-rw-r--r--src/ui/dialog/help/GnupgTab.cpp20
-rw-r--r--src/ui/dialog/import_export/KeyServerImportDialog.cpp11
-rw-r--r--src/ui/dialog/import_export/KeyUploadDialog.cpp12
-rw-r--r--src/ui/dialog/key_generate/KeygenDialog.cpp4
-rw-r--r--src/ui/dialog/key_generate/SubkeyGenerateDialog.cpp2
-rw-r--r--src/ui/dialog/keypair_details/KeyPairDetailTab.cpp4
-rw-r--r--src/ui/dialog/keypair_details/KeyPairOperaTab.cpp4
-rw-r--r--src/ui/dialog/keypair_details/KeyPairSubkeyTab.cpp14
-rw-r--r--src/ui/dialog/keypair_details/KeyPairUIDTab.cpp4
-rw-r--r--src/ui/dialog/keypair_details/KeySetExpireDateDialog.cpp15
-rw-r--r--src/ui/dialog/keypair_details/KeyUIDSignDialog.cpp6
-rw-r--r--src/ui/dialog/settings/SettingsDialog.cpp6
-rw-r--r--src/ui/dialog/settings/SettingsGeneral.cpp18
-rw-r--r--src/ui/dialog/settings/SettingsKeyServer.cpp6
-rw-r--r--src/ui/dialog/settings/SettingsNetwork.cpp18
-rw-r--r--src/ui/function/ArchiveDirectory.cpp6
-rw-r--r--src/ui/function/GenerateRevokeCertification.cpp6
-rw-r--r--src/ui/function/RaisePinentry.cpp10
-rw-r--r--src/ui/function/SetOwnerTrustLevel.cpp2
-rw-r--r--src/ui/main_window/GeneralMainWindow.cpp23
-rw-r--r--src/ui/main_window/KeyMgmt.cpp5
-rw-r--r--src/ui/main_window/MainWindow.cpp32
-rw-r--r--src/ui/main_window/MainWindowFileSlotFunction.cpp6
-rw-r--r--src/ui/main_window/MainWindowGpgOperaFunction.cpp4
-rw-r--r--src/ui/main_window/MainWindowSlotFunction.cpp16
-rw-r--r--src/ui/main_window/MainWindowSlotUI.cpp6
-rw-r--r--src/ui/struct/SettingsObject.cpp20
-rw-r--r--src/ui/thread/ListedKeyServerTestTask.cpp8
-rw-r--r--src/ui/thread/ProxyConnectionTestTask.cpp10
-rw-r--r--src/ui/widgets/FilePage.cpp2
-rw-r--r--src/ui/widgets/FileTreeView.cpp21
-rw-r--r--src/ui/widgets/InfoBoardWidget.cpp4
-rw-r--r--src/ui/widgets/KeyList.cpp20
-rw-r--r--src/ui/widgets/PlainTextEditorPage.cpp4
-rw-r--r--src/ui/widgets/TextEdit.cpp18
44 files changed, 299 insertions, 345 deletions
diff --git a/src/ui/GpgFrontendApplication.cpp b/src/ui/GpgFrontendApplication.cpp
index a9e4efd2..a4c4e2db 100644
--- a/src/ui/GpgFrontendApplication.cpp
+++ b/src/ui/GpgFrontendApplication.cpp
@@ -58,9 +58,10 @@ bool GpgFrontendApplication::notify(QObject *receiver, QEvent *event) {
try {
return QApplication::notify(receiver, event);
} catch (const std::exception &ex) {
- SPDLOG_ERROR("exception was caught in notify: {}", ex.what());
- SPDLOG_ERROR("stacktrace of the exception: {}",
- boost::stacktrace::to_string(boost::stacktrace::stacktrace()));
+ GF_UI_LOG_ERROR("exception was caught in notify: {}", ex.what());
+ GF_UI_LOG_ERROR(
+ "stacktrace of the exception: {}",
+ boost::stacktrace::to_string(boost::stacktrace::stacktrace()));
QMessageBox::information(nullptr, _("Standard Exception Thrown"),
_("Oops, an standard exception was thrown "
"during the running of the "
@@ -68,9 +69,10 @@ bool GpgFrontendApplication::notify(QObject *receiver, QEvent *event) {
"be the negligence of the programmer, "
"please report this problem if you can."));
} catch (...) {
- SPDLOG_ERROR("unknown exception was caught in notify");
- SPDLOG_ERROR("stacktrace of the exception: {}",
- boost::stacktrace::to_string(boost::stacktrace::stacktrace()));
+ GF_UI_LOG_ERROR("unknown exception was caught in notify");
+ GF_UI_LOG_ERROR(
+ "stacktrace of the exception: {}",
+ boost::stacktrace::to_string(boost::stacktrace::stacktrace()));
QMessageBox::information(
nullptr, _("Unhandled Exception Thrown"),
_("Oops, an unhandled exception was thrown "
diff --git a/src/ui/GpgFrontendUI.h b/src/ui/GpgFrontendUI.h
index f67da43e..b3115795 100644
--- a/src/ui/GpgFrontendUI.h
+++ b/src/ui/GpgFrontendUI.h
@@ -33,9 +33,16 @@
*/
#include <QtWidgets>
-/**
- * Project internal dependencies
- */
+// Core
#include "GpgFrontend.h"
#include "core/GpgFrontendCore.h"
+#include "core/utils/LogUtils.h"
+
+// UI
#include "ui/GpgFrontendUIExport.h"
+
+#define GF_UI_LOG_TRACE(...) GF_LOG_TRACE("ui", __VA_ARGS__)
+#define GF_UI_LOG_DEBUG(...) GF_LOG_DEBUG("ui", __VA_ARGS__)
+#define GF_UI_LOG_INFO(...) GF_LOG_INFO("ui", __VA_ARGS__)
+#define GF_UI_LOG_WARN(...) GF_LOG_WARN("ui", __VA_ARGS__)
+#define GF_UI_LOG_ERROR(...) GF_LOG_ERROR("ui", __VA_ARGS__)
diff --git a/src/ui/GpgFrontendUIInit.cpp b/src/ui/GpgFrontendUIInit.cpp
index 99a9541f..e896229f 100644
--- a/src/ui/GpgFrontendUIInit.cpp
+++ b/src/ui/GpgFrontendUIInit.cpp
@@ -30,10 +30,6 @@
#include <qapplication.h>
#include <qcoreapplication.h>
-#include <spdlog/async.h>
-#include <spdlog/common.h>
-#include <spdlog/sinks/rotating_file_sink.h>
-#include <spdlog/sinks/stdout_color_sinks.h>
#include <QtNetwork>
#include <string>
@@ -42,22 +38,16 @@
#include "core/function/CoreSignalStation.h"
#include "core/function/GlobalSettingStation.h"
#include "core/module/ModuleManager.h"
-#include "core/thread/TaskRunnerGetter.h"
#include "ui/UISignalStation.h"
#include "ui/UserInterfaceUtils.h"
-#include "ui/dialog/gnupg/GnuPGControllerDialog.h"
#include "ui/main_window/MainWindow.h"
-#if !defined(RELEASE) && defined(WINDOWS)
-#include "core/function/GlobalSettingStation.h"
-#endif
-
namespace GpgFrontend::UI {
extern void InitLocale();
void WaitEnvCheckingProcess() {
- SPDLOG_DEBUG("need to waiting for env checking process");
+ GF_UI_LOG_DEBUG("need to waiting for env checking process");
// create and show loading window before starting the main window
auto* waiting_dialog = new QProgressDialog();
@@ -75,7 +65,7 @@ void WaitEnvCheckingProcess() {
QApplication::connect(CoreSignalStation::GetInstance(),
&CoreSignalStation::SignalGoodGnupgEnv, waiting_dialog,
[=]() {
- SPDLOG_DEBUG("gpg env loaded successfuly");
+ GF_UI_LOG_DEBUG("gpg env loaded successfuly");
waiting_dialog->finished(0);
waiting_dialog->deleteLater();
});
@@ -87,7 +77,7 @@ void WaitEnvCheckingProcess() {
&QEventLoop::quit);
QApplication::connect(waiting_dialog, &QProgressDialog::canceled, [=]() {
- SPDLOG_DEBUG("cancel clicked on wairing dialog");
+ GF_UI_LOG_DEBUG("cancel clicked on wairing dialog");
QApplication::quit();
exit(0);
});
@@ -95,12 +85,12 @@ void WaitEnvCheckingProcess() {
auto env_state =
Module::RetrieveRTValueTypedOrDefault<>("core", "env.state.basic", 0);
- SPDLOG_DEBUG("ui is ready to wating for env initialized, env_state: {}",
- env_state);
+ GF_UI_LOG_DEBUG("ui is ready to wating for env initialized, env_state: {}",
+ env_state);
// check twice to avoid some unlucky sitations
if (env_state == 1) {
- SPDLOG_DEBUG("env state turned initialized before the looper start");
+ GF_UI_LOG_DEBUG("env state turned initialized before the looper start");
waiting_dialog->finished(0);
waiting_dialog->deleteLater();
return;
@@ -160,8 +150,8 @@ void InitGpgFrontendUI(QApplication* /*app*/) {
std::string proxy_password =
GlobalSettingStation::GetInstance().LookupSettings("proxy.password",
std::string{});
- SPDLOG_DEBUG("proxy settings: type {}, host {}, port: {}", proxy_type,
- proxy_host, proxy_port);
+ GF_UI_LOG_DEBUG("proxy settings: type {}, host {}, port: {}", proxy_type,
+ proxy_host, proxy_port);
QNetworkProxy::ProxyType proxy_type_qt = QNetworkProxy::NoProxy;
if (proxy_type == "HTTP") {
@@ -190,7 +180,7 @@ void InitGpgFrontendUI(QApplication* /*app*/) {
QNetworkProxy::setApplicationProxy(proxy);
} catch (...) {
- SPDLOG_ERROR("setting operation error: proxy setings");
+ GF_UI_LOG_ERROR("setting operation error: proxy setings");
// no proxy by default
QNetworkProxy::setApplicationProxy(QNetworkProxy::NoProxy);
}
@@ -211,7 +201,7 @@ auto RunGpgFrontendUI(QApplication* app) -> int {
// pre-check, if application need to restart
if (CommonUtils::GetInstance()->isApplicationNeedRestart()) {
- SPDLOG_DEBUG("application need to restart, before mian window init");
+ GF_UI_LOG_DEBUG("application need to restart, before mian window init");
return kDeepRestartCode;
}
@@ -219,56 +209,14 @@ auto RunGpgFrontendUI(QApplication* app) -> int {
main_window->Init();
// show main windows
- SPDLOG_DEBUG("main window is ready to show");
+ GF_UI_LOG_DEBUG("main window is ready to show");
main_window->show();
// start the main event loop
return app->exec();
}
-void InitUILoggingSystem(spdlog::level::level_enum level) {
- // get the log directory
- auto logfile_path = (GlobalSettingStation::GetInstance().GetLogDir() / "ui");
- logfile_path.replace_extension(".log");
-
- // sinks
- std::vector<spdlog::sink_ptr> sinks;
- sinks.push_back(GpgFrontend::SecureCreateSharedObject<
- spdlog::sinks::stderr_color_sink_mt>());
- sinks.push_back(GpgFrontend::SecureCreateSharedObject<
- spdlog::sinks::rotating_file_sink_mt>(logfile_path.u8string(),
- 1048576 * 32, 32));
-
- // thread pool
- spdlog::init_thread_pool(1024, 2);
-
- // logger
- auto ui_logger = GpgFrontend::SecureCreateSharedObject<spdlog::async_logger>(
- "ui", begin(sinks), end(sinks), spdlog::thread_pool());
- ui_logger->set_pattern(
- "[%H:%M:%S.%e] [T:%t] [%=6n] %^[%=8l]%$ [%s:%#] [%!] -> %v (+%ius)");
-
- // set the level of logger
- ui_logger->set_level(level);
-
- // flush policy
- ui_logger->flush_on(spdlog::level::err);
- spdlog::flush_every(std::chrono::seconds(5));
-
- // register it as default logger
- spdlog::set_default_logger(ui_logger);
-}
-
-void ShutdownUILoggingSystem() {
-#ifdef WINDOWS
- // Under VisualStudio, this must be called before main finishes to workaround
- // a known VS issue
- spdlog::drop_all();
- spdlog::shutdown();
-#endif
-}
-
-void GPGFRONTEND_UI_EXPORT DestroyGpgFrontendUI() { ShutdownUILoggingSystem(); }
+void GPGFRONTEND_UI_EXPORT DestroyGpgFrontendUI() {}
/**
* @brief setup the locale and load the translations
@@ -294,20 +242,20 @@ void InitLocale() {
// sync the settings to the file
GpgFrontend::GlobalSettingStation::GetInstance().SyncSettings();
- SPDLOG_DEBUG("current system locale: {}", setlocale(LC_ALL, nullptr));
+ GF_UI_LOG_DEBUG("current system locale: {}", setlocale(LC_ALL, nullptr));
// read from settings file
std::string lang;
if (!general.lookupValue("lang", lang)) {
- SPDLOG_ERROR(_("could not read properly from configure file"));
+ GF_UI_LOG_ERROR(_("could not read properly from configure file"));
};
- SPDLOG_DEBUG("lang from settings: {}", lang);
- SPDLOG_DEBUG("project name: {}", PROJECT_NAME);
- SPDLOG_DEBUG("locales path: {}",
- GpgFrontend::GlobalSettingStation::GetInstance()
- .GetLocaleDir()
- .u8string());
+ GF_UI_LOG_DEBUG("lang from settings: {}", lang);
+ GF_UI_LOG_DEBUG("project name: {}", PROJECT_NAME);
+ GF_UI_LOG_DEBUG("locales path: {}",
+ GpgFrontend::GlobalSettingStation::GetInstance()
+ .GetLocaleDir()
+ .u8string());
#ifndef WINDOWS
if (!lang.empty()) {
@@ -315,14 +263,14 @@ void InitLocale() {
// set LC_ALL
auto* locale_name = setlocale(LC_ALL, lc.c_str());
- if (locale_name == nullptr) SPDLOG_WARN("set LC_ALL failed, lc: {}", lc);
+ if (locale_name == nullptr) GF_UI_LOG_WARN("set LC_ALL failed, lc: {}", lc);
auto* language = getenv("LANGUAGE");
// set LANGUAGE
std::string language_env = language == nullptr ? "en" : language;
language_env.insert(0, lang + ":");
- SPDLOG_DEBUG("language env: {}", language_env);
+ GF_UI_LOG_DEBUG("language env: {}", language_env);
if (setenv("LANGUAGE", language_env.c_str(), 1) != 0) {
- SPDLOG_WARN("set LANGUAGE {} failed", language_env);
+ GF_UI_LOG_WARN("set LANGUAGE {} failed", language_env);
};
}
#else
@@ -331,16 +279,16 @@ void InitLocale() {
// set LC_ALL
auto* locale_name = setlocale(LC_ALL, lc.c_str());
- if (locale_name == nullptr) SPDLOG_WARN("set LC_ALL failed, lc: {}", lc);
+ if (locale_name == nullptr) GF_UI_LOG_WARN("set LC_ALL failed, lc: {}", lc);
auto language = getenv("LANGUAGE");
// set LANGUAGE
std::string language_env = language == nullptr ? "en" : language;
language_env.insert(0, lang + ":");
language_env.insert(0, "LANGUAGE=");
- SPDLOG_DEBUG("language env: {}", language_env);
+ GF_UI_LOG_DEBUG("language env: {}", language_env);
if (putenv(language_env.c_str())) {
- SPDLOG_WARN("set LANGUAGE {} failed", language_env);
+ GF_UI_LOG_WARN("set LANGUAGE {} failed", language_env);
};
}
#endif
diff --git a/src/ui/GpgFrontendUIInit.h b/src/ui/GpgFrontendUIInit.h
index 42c00c5a..fd62f3f6 100644
--- a/src/ui/GpgFrontendUIInit.h
+++ b/src/ui/GpgFrontendUIInit.h
@@ -45,24 +45,12 @@ void GPGFRONTEND_UI_EXPORT PreInitGpgFrontendUI();
void GPGFRONTEND_UI_EXPORT InitGpgFrontendUI(QApplication *);
/**
- * @brief
- *
- */
-void GPGFRONTEND_UI_EXPORT InitUILoggingSystem(spdlog::level::level_enum level);
-
-/**
* @brief init the UI library
*
*/
void GPGFRONTEND_UI_EXPORT DestroyGpgFrontendUI();
/**
- * @brief
- *
- */
-void GPGFRONTEND_UI_EXPORT ShutdownUILoggingSystem();
-
-/**
* @brief run main window
*/
auto GPGFRONTEND_UI_EXPORT RunGpgFrontendUI(QApplication *) -> int;
diff --git a/src/ui/UserInterfaceUtils.cpp b/src/ui/UserInterfaceUtils.cpp
index 81627ee8..bed7fcf2 100644
--- a/src/ui/UserInterfaceUtils.cpp
+++ b/src/ui/UserInterfaceUtils.cpp
@@ -83,7 +83,7 @@ void import_unknown_key_from_keyserver(
auto key_ids = std::make_unique<KeyIdArgsList>();
auto *signature = verify_res.GetSignatures();
while (signature != nullptr) {
- SPDLOG_DEBUG("signature fpr: {}", signature->fpr);
+ GF_UI_LOG_DEBUG("signature fpr: {}", signature->fpr);
key_ids->push_back(signature->fpr);
signature = signature->next;
}
@@ -236,8 +236,8 @@ void CommonUtils::WaitForOpera(QWidget *parent,
QTimer::singleShot(64, parent, [=]() {
opera([dialog]() {
- SPDLOG_DEBUG("called operating waiting cb, dialog: {}",
- static_cast<void *>(dialog));
+ GF_UI_LOG_DEBUG("called operating waiting cb, dialog: {}",
+ static_cast<void *>(dialog));
dialog->close();
dialog->accept();
});
@@ -319,18 +319,18 @@ void CommonUtils::SlotExecuteCommand(
&QEventLoop::quit);
connect(cmd_process, &QProcess::errorOccurred, &looper, &QEventLoop::quit);
connect(cmd_process, &QProcess::started,
- []() -> void { SPDLOG_DEBUG("process started"); });
+ []() -> void { GF_UI_LOG_DEBUG("process started"); });
connect(cmd_process, &QProcess::readyReadStandardOutput,
[interact_func, cmd_process]() { interact_func(cmd_process); });
connect(cmd_process, &QProcess::errorOccurred, this,
- [=]() -> void { SPDLOG_ERROR("error in process"); });
+ [=]() -> void { GF_UI_LOG_ERROR("error in process"); });
connect(cmd_process,
qOverload<int, QProcess::ExitStatus>(&QProcess::finished), this,
[=](int, QProcess::ExitStatus status) {
if (status == QProcess::NormalExit)
- SPDLOG_DEBUG("succeed in executing command: {}", cmd);
+ GF_UI_LOG_DEBUG("succeed in executing command: {}", cmd);
else
- SPDLOG_WARN("error in executing command: {}", cmd);
+ GF_UI_LOG_WARN("error in executing command: {}", cmd);
});
cmd_process->setProgram(QString::fromStdString(cmd));
@@ -356,11 +356,11 @@ void CommonUtils::SlotExecuteGpgCommand(
&WaitingDialog::deleteLater);
connect(gpg_process, &QProcess::errorOccurred, &looper, &QEventLoop::quit);
connect(gpg_process, &QProcess::started,
- []() -> void { SPDLOG_DEBUG("gpg process started"); });
+ []() -> void { GF_UI_LOG_DEBUG("gpg process started"); });
connect(gpg_process, &QProcess::readyReadStandardOutput,
[interact_func, gpg_process]() { interact_func(gpg_process); });
connect(gpg_process, &QProcess::errorOccurred, this, [=]() -> void {
- SPDLOG_ERROR("Error in Process");
+ GF_UI_LOG_ERROR("Error in Process");
dialog->close();
QMessageBox::critical(nullptr, _("Failure"),
_("Failed to execute command."));
@@ -379,7 +379,7 @@ void CommonUtils::SlotExecuteGpgCommand(
const auto app_path = Module::RetrieveRTValueTypedOrDefault<>(
"core", "gpgme.ctx.app_path", std::string{});
- SPDLOG_DEBUG("got gnupg app path from rt: {}", app_path);
+ GF_UI_LOG_DEBUG("got gnupg app path from rt: {}", app_path);
gpg_process->setProgram(app_path.c_str());
gpg_process->setArguments(arguments);
@@ -412,10 +412,10 @@ void CommonUtils::SlotImportKeyFromKeyServer(
target_keyserver =
key_server_list[target_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"));
@@ -436,7 +436,7 @@ void CommonUtils::SlotImportKeyFromKeyServer(
target_keyserver_url.scheme() + "://" + target_keyserver_url.host() +
"/pks/lookup?op=get&search=0x" + key_id.c_str() + "&options=mr");
- SPDLOG_DEBUG("request url: {}", req_url.toString().toStdString());
+ GF_UI_LOG_DEBUG("request url: {}", req_url.toString().toStdString());
// Waiting for reply
QNetworkReply *reply = network_manager->get(QNetworkRequest(req_url));
@@ -523,7 +523,7 @@ void CommonUtils::slot_popup_passphrase_input_dialog() {
}
void CommonUtils::SlotRestartApplication(int code) {
- SPDLOG_DEBUG("application need restart, code: {}", code);
+ GF_UI_LOG_DEBUG("application need restart, code: {}", code);
if (code == 0) {
std::exit(0);
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());
diff --git a/src/ui/function/ArchiveDirectory.cpp b/src/ui/function/ArchiveDirectory.cpp
index 9cbfc41e..89bb7ff2 100644
--- a/src/ui/function/ArchiveDirectory.cpp
+++ b/src/ui/function/ArchiveDirectory.cpp
@@ -71,13 +71,13 @@ auto ArchiveDirectory::Exec(const std::filesystem::path& target_directory)
auto target_path = target_directory;
target_path = target_path.replace_extension("");
- SPDLOG_DEBUG("archive directory, base path: {}, target path: {}",
- base_path.string(), target_path.string());
+ GF_UI_LOG_DEBUG("archive directory, base path: {}, target path: {}",
+ base_path.string(), target_path.string());
// ArchiveFileOperator::CreateArchive(base_path, target_path, 0, );
} catch (...) {
- SPDLOG_ERROR("archive caught exception error");
+ GF_UI_LOG_ERROR("archive caught exception error");
return {false, {}};
}
}
diff --git a/src/ui/function/GenerateRevokeCertification.cpp b/src/ui/function/GenerateRevokeCertification.cpp
index a1c99d95..5d5b1702 100644
--- a/src/ui/function/GenerateRevokeCertification.cpp
+++ b/src/ui/function/GenerateRevokeCertification.cpp
@@ -48,12 +48,12 @@ auto GenerateRevokeCertification::Exec(const GpgKey& key,
std::move(output_path), "--gen-revoke", key.GetFingerprint()},
[=](int exit_code, const std::string& p_out, const std::string& p_err) {
if (exit_code != 0) {
- SPDLOG_ERROR(
+ GF_UI_LOG_ERROR(
"gnupg gen revoke execute error, process stderr: {}, process "
"stdout: {}",
p_err, p_out);
} else {
- SPDLOG_DEBUG(
+ GF_UI_LOG_DEBUG(
"gnupg gen revoke exit_code: {}, process stdout size: {}",
exit_code, p_out.size());
}
@@ -63,7 +63,7 @@ auto GenerateRevokeCertification::Exec(const GpgKey& key,
// Code From Gpg4Win
while (proc->canReadLine()) {
const QString line = QString::fromUtf8(proc->readLine()).trimmed();
- SPDLOG_DEBUG("line: {}", line.toStdString());
+ GF_UI_LOG_DEBUG("line: {}", line.toStdString());
if (line == QLatin1String("[GNUPG:] GET_BOOL gen_revoke.okay")) {
proc->write("y\n");
} else if (line == QLatin1String("[GNUPG:] GET_LINE "
diff --git a/src/ui/function/RaisePinentry.cpp b/src/ui/function/RaisePinentry.cpp
index 31804fa8..1e48e984 100644
--- a/src/ui/function/RaisePinentry.cpp
+++ b/src/ui/function/RaisePinentry.cpp
@@ -39,8 +39,8 @@ auto FindTopMostWindow(QWidget* fallback) -> QWidget* {
QList<QWidget*> top_widgets = QApplication::topLevelWidgets();
foreach (QWidget* widget, top_widgets) {
if (widget->isActiveWindow()) {
- SPDLOG_TRACE("find a topmost widget, address: {}",
- static_cast<void*>(widget));
+ GF_UI_LOG_TRACE("find a topmost widget, address: {}",
+ static_cast<void*>(widget));
return widget;
}
}
@@ -55,7 +55,7 @@ auto RaisePinentry::Exec() -> int {
QString::fromStdString(_("Show passphrase")),
QString::fromStdString(_("Hide passphrase")));
- SPDLOG_DEBUG("setting pinetry's arguments");
+ GF_UI_LOG_DEBUG("setting pinetry's arguments");
pinentry->setPrompt(QString::fromStdString(_("PIN:")));
pinentry->setDescription(QString());
@@ -74,11 +74,11 @@ auto RaisePinentry::Exec() -> int {
pinentry->setOkText(_("Confirm"));
pinentry->setCancelText(_("Cancel"));
- SPDLOG_DEBUG("pinentry is ready to start");
+ GF_UI_LOG_DEBUG("pinentry is ready to start");
connect(pinentry, &PinEntryDialog::finished, this, [pinentry](int result) {
bool ret = result != 0;
- SPDLOG_DEBUG("pinentry finished, ret: {}", ret);
+ GF_UI_LOG_DEBUG("pinentry finished, ret: {}", ret);
if (!ret) {
emit CoreSignalStation::GetInstance()->SignalUserInputPassphraseCallback(
diff --git a/src/ui/function/SetOwnerTrustLevel.cpp b/src/ui/function/SetOwnerTrustLevel.cpp
index 4154b5ff..290b1436 100644
--- a/src/ui/function/SetOwnerTrustLevel.cpp
+++ b/src/ui/function/SetOwnerTrustLevel.cpp
@@ -54,7 +54,7 @@ auto SetOwnerTrustLevel::Exec(const std::string& key_id) -> bool {
key.GetOwnerTrustLevel(), false, &ok);
if (ok && !item.isEmpty()) {
- SPDLOG_DEBUG("selected owner trust policy: {}", item.toStdString());
+ GF_UI_LOG_DEBUG("selected owner trust policy: {}", item.toStdString());
int trust_level = 0; // Unknown Level
if (item == _("Ultimate")) {
trust_level = 5;
diff --git a/src/ui/main_window/GeneralMainWindow.cpp b/src/ui/main_window/GeneralMainWindow.cpp
index a62d862c..93c5ca4a 100644
--- a/src/ui/main_window/GeneralMainWindow.cpp
+++ b/src/ui/main_window/GeneralMainWindow.cpp
@@ -41,7 +41,8 @@ GpgFrontend::UI::GeneralMainWindow::GeneralMainWindow(std::string name,
GpgFrontend::UI::GeneralMainWindow::~GeneralMainWindow() = default;
void GpgFrontend::UI::GeneralMainWindow::closeEvent(QCloseEvent *event) {
- SPDLOG_DEBUG("main window close event caught, event type: {}", event->type());
+ GF_UI_LOG_DEBUG("main window close event caught, event type: {}",
+ event->type());
slot_save_settings();
QMainWindow::closeEvent(event);
@@ -53,7 +54,7 @@ void GpgFrontend::UI::GeneralMainWindow::slot_restore_settings() noexcept {
std::string window_state = general_windows_state.Check(
"window_state", saveState().toBase64().toStdString());
- SPDLOG_DEBUG("restore main window state: {}", window_state);
+ GF_UI_LOG_DEBUG("restore main window state: {}", window_state);
// state sets pos & size of dock-widgets
this->restoreState(
@@ -76,7 +77,8 @@ void GpgFrontend::UI::GeneralMainWindow::slot_restore_settings() noexcept {
size_ = {width, height};
if (this->parent() != nullptr) {
- SPDLOG_DEBUG("parent address: {}", static_cast<void *>(this->parent()));
+ GF_UI_LOG_DEBUG("parent address: {}",
+ static_cast<void *>(this->parent()));
QPoint parent_pos = {0, 0};
QSize parent_size = {0, 0};
@@ -93,10 +95,11 @@ void GpgFrontend::UI::GeneralMainWindow::slot_restore_settings() noexcept {
parent_size = parent_window->size();
}
- SPDLOG_DEBUG("parent pos x: {} y: {}", parent_pos.x(), parent_pos.y());
+ GF_UI_LOG_DEBUG("parent pos x: {} y: {}", parent_pos.x(),
+ parent_pos.y());
- SPDLOG_DEBUG("parent size width: {} height: {}", parent_size.width(),
- parent_size.height());
+ GF_UI_LOG_DEBUG("parent size width: {} height: {}", parent_size.width(),
+ parent_size.height());
if (parent_pos != QPoint{0, 0}) {
QPoint parent_center{parent_pos.x() + parent_size.width() / 2,
@@ -116,7 +119,7 @@ void GpgFrontend::UI::GeneralMainWindow::slot_restore_settings() noexcept {
int width = general_settings_state.Check("icon_size").Check("width", 24),
height = general_settings_state.Check("icon_size").Check("height", 24);
- SPDLOG_DEBUG("icon size: {} {}", width, height);
+ GF_UI_LOG_DEBUG("icon size: {} {}", width, height);
icon_size_ = {width, height};
font_size_ = general_settings_state.Check("font_size", 10);
@@ -130,13 +133,13 @@ void GpgFrontend::UI::GeneralMainWindow::slot_restore_settings() noexcept {
icon_style_ = toolButtonStyle();
} catch (...) {
- SPDLOG_ERROR(name_, "error");
+ GF_UI_LOG_ERROR(name_, "error");
}
}
void GpgFrontend::UI::GeneralMainWindow::slot_save_settings() noexcept {
try {
- SPDLOG_DEBUG("save main window state, name: {}", name_);
+ GF_UI_LOG_DEBUG("save main window state, name: {}", name_);
SettingsObject general_windows_state(name_ + "_state");
// window position and size
@@ -165,6 +168,6 @@ void GpgFrontend::UI::GeneralMainWindow::slot_save_settings() noexcept {
general_settings_state["icon_style"] = this->toolButtonStyle();
} catch (...) {
- SPDLOG_ERROR(name_, "error");
+ GF_UI_LOG_ERROR(name_, "error");
}
}
diff --git a/src/ui/main_window/KeyMgmt.cpp b/src/ui/main_window/KeyMgmt.cpp
index 81bd2f03..4462011a 100644
--- a/src/ui/main_window/KeyMgmt.cpp
+++ b/src/ui/main_window/KeyMgmt.cpp
@@ -451,7 +451,7 @@ void KeyMgmt::SlotExportAsOpenSSHFormat() {
}
void KeyMgmt::SlotImportKeyPackage() {
- SPDLOG_INFO("Importing key package...");
+ GF_UI_LOG_INFO("Importing key package...");
auto key_package_file_name = QFileDialog::getOpenFileName(
this, _("Import Key Package"), {},
@@ -465,7 +465,8 @@ void KeyMgmt::SlotImportKeyPackage() {
GpgImportInformation info;
- SPDLOG_INFO("importing key package: {}", key_package_file_name.toStdString());
+ GF_UI_LOG_INFO("importing key package: {}",
+ key_package_file_name.toStdString());
if (KeyPackageOperator::ImportKeyPackage(key_package_file_name.toStdString(),
key_file_name.toStdString(), info)) {
diff --git a/src/ui/main_window/MainWindow.cpp b/src/ui/main_window/MainWindow.cpp
index 8cc76d65..d5d8db63 100644
--- a/src/ui/main_window/MainWindow.cpp
+++ b/src/ui/main_window/MainWindow.cpp
@@ -124,14 +124,14 @@ void MainWindow::Init() noexcept {
// before application exit
connect(qApp, &QCoreApplication::aboutToQuit, this, []() {
- SPDLOG_DEBUG("about to quit process started");
+ GF_UI_LOG_DEBUG("about to quit process started");
if (GlobalSettingStation::GetInstance().LookupSettings(
"general.clear_gpg_password_cache", false)) {
if (GpgFrontend::GpgAdvancedOperator::ClearGpgPasswordCache()) {
- SPDLOG_DEBUG("clear gpg password cache done");
+ GF_UI_LOG_DEBUG("clear gpg password cache done");
} else {
- SPDLOG_ERROR("clear gpg password cache error");
+ GF_UI_LOG_ERROR("clear gpg password cache error");
}
}
});
@@ -140,7 +140,7 @@ void MainWindow::Init() noexcept {
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_version_upgrade_nofity();
@@ -171,14 +171,14 @@ void MainWindow::Init() noexcept {
bool show_wizard = true;
wizard.lookupValue("show_wizard", show_wizard);
- SPDLOG_DEBUG("wizard show_wizard: {}", show_wizard);
+ GF_UI_LOG_DEBUG("wizard show_wizard: {}", show_wizard);
if (show_wizard) {
slot_start_wizard();
}
} catch (...) {
- SPDLOG_ERROR(_("Critical error occur while loading GpgFrontend."));
+ GF_UI_LOG_ERROR(_("Critical error occur while loading GpgFrontend."));
QMessageBox::critical(nullptr, _("Loading Failed"),
_("Critical error occur while loading GpgFrontend."));
QCoreApplication::quit();
@@ -188,7 +188,7 @@ void MainWindow::Init() noexcept {
void MainWindow::restore_settings() {
try {
- SPDLOG_DEBUG("restore settings key_server");
+ GF_UI_LOG_DEBUG("restore settings key_server");
SettingsObject key_server_json("key_server");
if (!key_server_json.contains("server_list") ||
@@ -224,7 +224,7 @@ void MainWindow::restore_settings() {
import_button_->setToolButtonStyle(icon_style_);
try {
- SPDLOG_DEBUG("restore settings default_key_checked");
+ GF_UI_LOG_DEBUG("restore settings default_key_checked");
// Checked Keys
SettingsObject default_key_checked("default_key_checked");
@@ -232,13 +232,13 @@ void MainWindow::restore_settings() {
auto key_ids_ptr = std::make_unique<KeyIdArgsList>();
for (auto &it : default_key_checked) {
std::string key_id = it;
- SPDLOG_DEBUG("get checked key id: {}", key_id);
+ GF_UI_LOG_DEBUG("get checked key id: {}", key_id);
key_ids_ptr->push_back(key_id);
}
m_key_list_->SetChecked(std::move(key_ids_ptr));
}
} catch (...) {
- SPDLOG_ERROR("restore default_key_checked failed");
+ GF_UI_LOG_ERROR("restore default_key_checked failed");
}
prohibit_update_checking_ = false;
@@ -246,15 +246,15 @@ void MainWindow::restore_settings() {
prohibit_update_checking_ =
settings.lookup("network.prohibit_update_checking");
} catch (...) {
- SPDLOG_ERROR("setting operation error: prohibit_update_checking");
+ GF_UI_LOG_ERROR("setting operation error: prohibit_update_checking");
}
} catch (...) {
- SPDLOG_ERROR("cannot resolve settings");
+ GF_UI_LOG_ERROR("cannot resolve settings");
}
GlobalSettingStation::GetInstance().SyncSettings();
- SPDLOG_DEBUG("settings restored");
+ GF_UI_LOG_DEBUG("settings restored");
}
void MainWindow::recover_editor_unsaved_pages_from_cache() {
@@ -265,8 +265,8 @@ void MainWindow::recover_editor_unsaved_pages_from_cache() {
return;
}
- SPDLOG_DEBUG("plan ot recover unsaved page from cache, page array: {}",
- unsaved_page_array.dump());
+ GF_UI_LOG_DEBUG("plan ot recover unsaved page from cache, page array: {}",
+ unsaved_page_array.dump());
bool first = true;
@@ -278,7 +278,7 @@ void MainWindow::recover_editor_unsaved_pages_from_cache() {
std::string title = unsaved_page_json["title"];
std::string content = unsaved_page_json["content"];
- SPDLOG_DEBUG(
+ GF_UI_LOG_DEBUG(
"recovering unsaved page from cache, page title: {}, content size",
title, content.size());
diff --git a/src/ui/main_window/MainWindowFileSlotFunction.cpp b/src/ui/main_window/MainWindowFileSlotFunction.cpp
index 43e96fcf..69da6678 100644
--- a/src/ui/main_window/MainWindowFileSlotFunction.cpp
+++ b/src/ui/main_window/MainWindowFileSlotFunction.cpp
@@ -471,9 +471,9 @@ void MainWindow::SlotFileVerify(std::filesystem::path path) {
return;
}
- SPDLOG_DEBUG("verification data file path: {}", data_file_path.u8string());
- SPDLOG_DEBUG("verification signature file path: {}",
- sign_file_path.u8string());
+ GF_UI_LOG_DEBUG("verification data file path: {}", data_file_path.u8string());
+ GF_UI_LOG_DEBUG("verification signature file path: {}",
+ sign_file_path.u8string());
CommonUtils::WaitForOpera(
this, _("Verifying"), [=](const OperaWaitingHd& op_hd) {
diff --git a/src/ui/main_window/MainWindowGpgOperaFunction.cpp b/src/ui/main_window/MainWindowGpgOperaFunction.cpp
index bdad2809..1efff3df 100644
--- a/src/ui/main_window/MainWindowGpgOperaFunction.cpp
+++ b/src/ui/main_window/MainWindowGpgOperaFunction.cpp
@@ -284,11 +284,11 @@ void MainWindow::SlotEncryptSign() {
auto signer_keys = GpgKeyGetter::GetInstance().GetKeys(signer_key_ids);
for (const auto& key : *keys) {
- SPDLOG_DEBUG("keys {}", key.GetEmail());
+ GF_UI_LOG_DEBUG("keys {}", key.GetEmail());
}
for (const auto& signer : *signer_keys) {
- SPDLOG_DEBUG("signers {}", signer.GetEmail());
+ GF_UI_LOG_DEBUG("signers {}", signer.GetEmail());
}
// data to transfer into task
diff --git a/src/ui/main_window/MainWindowSlotFunction.cpp b/src/ui/main_window/MainWindowSlotFunction.cpp
index 95eb9871..40c0dcb3 100644
--- a/src/ui/main_window/MainWindowSlotFunction.cpp
+++ b/src/ui/main_window/MainWindowSlotFunction.cpp
@@ -73,7 +73,7 @@ void MainWindow::slot_append_selected_keys() {
auto key_ids = m_key_list_->GetSelected();
if (key_ids->empty()) {
- SPDLOG_ERROR("no key is selected");
+ GF_UI_LOG_ERROR("no key is selected");
return;
}
@@ -93,7 +93,7 @@ void MainWindow::slot_append_keys_create_datetime() {
auto key_ids = m_key_list_->GetSelected();
if (key_ids->empty()) {
- SPDLOG_ERROR("no key is selected");
+ GF_UI_LOG_ERROR("no key is selected");
return;
}
@@ -119,7 +119,7 @@ void MainWindow::slot_append_keys_expire_datetime() {
auto key_ids = m_key_list_->GetSelected();
if (key_ids->empty()) {
- SPDLOG_ERROR("no key is selected");
+ GF_UI_LOG_ERROR("no key is selected");
return;
}
@@ -271,16 +271,16 @@ void MainWindow::SlotOpenFile(const QString& path) {
}
void MainWindow::slot_version_upgrade_nofity() {
- SPDLOG_DEBUG(
+ 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",
"version.loading_done", false);
- SPDLOG_DEBUG("checking version info from rt, is loading done state: {}",
- is_loading_done);
+ GF_UI_LOG_DEBUG("checking version info from rt, is loading done state: {}",
+ is_loading_done);
if (!is_loading_done) {
- SPDLOG_ERROR("invalid version info from rt, loading hasn't done yet");
+ GF_UI_LOG_ERROR("invalid version info from rt, loading hasn't done yet");
return;
}
@@ -300,7 +300,7 @@ void MainWindow::slot_version_upgrade_nofity() {
"com.bktus.gpgfrontend.module.integrated.version-checking",
"version.latest_version", std::string{});
- SPDLOG_DEBUG(
+ GF_UI_LOG_DEBUG(
"got version info from rt, need upgrade: {}, with drawn: {}, current "
"version "
"released: {}",
diff --git a/src/ui/main_window/MainWindowSlotUI.cpp b/src/ui/main_window/MainWindowSlotUI.cpp
index 37eb688b..54b4e413 100644
--- a/src/ui/main_window/MainWindowSlotUI.cpp
+++ b/src/ui/main_window/MainWindowSlotUI.cpp
@@ -113,7 +113,7 @@ void MainWindow::slot_open_settings_dialog() {
int width = general_settings_state.Check("icon_size").Check("width", 24),
height = general_settings_state.Check("icon_size").Check("height", 24);
- SPDLOG_DEBUG("icon_size: {} {}", width, height);
+ GF_UI_LOG_DEBUG("icon_size: {} {}", width, height);
general_settings_state.Check("info_font_size", 10);
@@ -187,7 +187,7 @@ void MainWindow::slot_cut_pgp_header() {
}
void MainWindow::SlotSetRestartNeeded(int mode) {
- SPDLOG_DEBUG("restart mode: {}", mode);
+ GF_UI_LOG_DEBUG("restart mode: {}", mode);
this->restart_needed_ = mode;
}
@@ -195,7 +195,7 @@ int MainWindow::get_restart_needed() const { return this->restart_needed_; }
void MainWindow::SetCryptoMenuStatus(
MainWindow::CryptoMenu::OperationType type) {
- SPDLOG_DEBUG("type: {}", type);
+ GF_UI_LOG_DEBUG("type: {}", type);
// refresh status to disable all
verify_act_->setDisabled(true);
diff --git a/src/ui/struct/SettingsObject.cpp b/src/ui/struct/SettingsObject.cpp
index 4b60410c..cf11fc5e 100644
--- a/src/ui/struct/SettingsObject.cpp
+++ b/src/ui/struct/SettingsObject.cpp
@@ -32,7 +32,7 @@ nlohmann::json& GpgFrontend::UI::SettingsObject::Check(
const std::string& key, const nlohmann::json& default_value) {
// check if the self null
if (this->nlohmann::json::is_null()) {
- SPDLOG_DEBUG("settings object is null, creating new one");
+ GF_UI_LOG_DEBUG("settings object is null, creating new one");
this->nlohmann::json::operator=(nlohmann::json::object());
}
@@ -41,9 +41,9 @@ nlohmann::json& GpgFrontend::UI::SettingsObject::Check(
this->nlohmann::json::at(key).is_null() ||
this->nlohmann::json::at(key).type_name() !=
default_value.type_name()) {
- SPDLOG_DEBUG("added missing key: {}", key);
+ GF_UI_LOG_DEBUG("added missing key: {}", key);
if (default_value.is_null()) {
- SPDLOG_WARN("default value is null, using empty object");
+ GF_UI_LOG_WARN("default value is null, using empty object");
this->nlohmann::json::operator[](key) = nlohmann::json::object();
} else {
this->nlohmann::json::operator[](key) = default_value;
@@ -51,7 +51,7 @@ nlohmann::json& GpgFrontend::UI::SettingsObject::Check(
}
return this->nlohmann::json::at(key);
} catch (nlohmann::json::exception& e) {
- SPDLOG_ERROR(e.what());
+ GF_UI_LOG_ERROR(e.what());
throw e;
}
}
@@ -60,14 +60,14 @@ GpgFrontend::UI::SettingsObject GpgFrontend::UI::SettingsObject::Check(
const std::string& key) {
// check if the self null
if (this->nlohmann::json::is_null()) {
- SPDLOG_DEBUG("settings object is null, creating new one");
+ GF_UI_LOG_DEBUG("settings object is null, creating new one");
this->nlohmann::json::operator=(nlohmann::json::object());
}
if (!nlohmann::json::contains(key) ||
this->nlohmann::json::at(key).is_null() ||
this->nlohmann::json::at(key).type() != nlohmann::json::value_t::object) {
- SPDLOG_DEBUG("added missing key: {}", key);
+ GF_UI_LOG_DEBUG("added missing key: {}", key);
this->nlohmann::json::operator[](key) = nlohmann::json::object();
}
return SettingsObject{nlohmann::json::operator[](key), false};
@@ -76,21 +76,21 @@ GpgFrontend::UI::SettingsObject GpgFrontend::UI::SettingsObject::Check(
GpgFrontend::UI::SettingsObject::SettingsObject(std::string settings_name)
: settings_name_(std::move(settings_name)) {
try {
- SPDLOG_DEBUG("loading settings from: {}", this->settings_name_);
+ GF_UI_LOG_DEBUG("loading settings from: {}", this->settings_name_);
auto _json_optional =
GpgFrontend::DataObjectOperator::GetInstance().GetDataObject(
settings_name_);
if (_json_optional.has_value()) {
- SPDLOG_DEBUG("settings object: {} loaded.", settings_name_);
+ GF_UI_LOG_DEBUG("settings object: {} loaded.", settings_name_);
nlohmann::json::operator=(_json_optional.value());
} else {
- SPDLOG_DEBUG("settings object: {} not found.", settings_name_);
+ GF_UI_LOG_DEBUG("settings object: {} not found.", settings_name_);
nlohmann::json::operator=({});
}
} catch (std::exception& e) {
- SPDLOG_ERROR(e.what());
+ GF_UI_LOG_ERROR(e.what());
}
}
diff --git a/src/ui/thread/ListedKeyServerTestTask.cpp b/src/ui/thread/ListedKeyServerTestTask.cpp
index 28eb33f7..18299725 100644
--- a/src/ui/thread/ListedKeyServerTestTask.cpp
+++ b/src/ui/thread/ListedKeyServerTestTask.cpp
@@ -47,20 +47,20 @@ void GpgFrontend::UI::ListedKeyServerTestTask::run() {
size_t index = 0;
for (const auto& url : urls_) {
auto key_url = QUrl{url};
- SPDLOG_DEBUG("key server request: {}", key_url.host().toStdString());
+ GF_UI_LOG_DEBUG("key server request: {}", key_url.host().toStdString());
auto* network_reply = network_manager_->get(QNetworkRequest{key_url});
auto* timer = new QTimer(this);
connect(network_reply, &QNetworkReply::finished, this,
[this, index, network_reply]() {
- SPDLOG_DEBUG("key server domain reply: {}",
- urls_[index].toStdString());
+ GF_UI_LOG_DEBUG("key server domain reply: {}",
+ urls_[index].toStdString());
this->slot_process_network_reply(index, network_reply);
});
connect(timer, &QTimer::timeout, this, [this, index, network_reply]() {
- SPDLOG_DEBUG("timeout for key server: {}", urls_[index].toStdString());
+ GF_UI_LOG_DEBUG("timeout for key server: {}", urls_[index].toStdString());
if (network_reply->isRunning()) {
network_reply->abort();
this->slot_process_network_reply(index, network_reply);
diff --git a/src/ui/thread/ProxyConnectionTestTask.cpp b/src/ui/thread/ProxyConnectionTestTask.cpp
index 9a723727..b952d0b9 100644
--- a/src/ui/thread/ProxyConnectionTestTask.cpp
+++ b/src/ui/thread/ProxyConnectionTestTask.cpp
@@ -45,13 +45,13 @@ void GpgFrontend::UI::ProxyConnectionTestTask::run() {
connect(network_reply, &QNetworkReply::finished, this,
[this, network_reply]() {
- SPDLOG_DEBUG("key server domain reply: {} received",
- url_.toStdString());
+ GF_UI_LOG_DEBUG("key server domain reply: {} received",
+ url_.toStdString());
this->slot_process_network_reply(network_reply);
});
connect(timer, &QTimer::timeout, this, [this, network_reply]() {
- SPDLOG_DEBUG("timeout for key server: {}", url_.toStdString());
+ GF_UI_LOG_DEBUG("timeout for key server: {}", url_.toStdString());
if (network_reply->isRunning()) {
network_reply->abort();
this->slot_process_network_reply(network_reply);
@@ -64,8 +64,8 @@ void GpgFrontend::UI::ProxyConnectionTestTask::run() {
void GpgFrontend::UI::ProxyConnectionTestTask::slot_process_network_reply(
QNetworkReply* reply) {
auto buffer = reply->readAll();
- SPDLOG_DEBUG("key server domain reply: {}, buffer size: {}",
- url_.toStdString(), buffer.size());
+ GF_UI_LOG_DEBUG("key server domain reply: {}, buffer size: {}",
+ url_.toStdString(), buffer.size());
if (reply->error() == QNetworkReply::NoError && !buffer.isEmpty()) {
result_ = "Reachable";
diff --git a/src/ui/widgets/FilePage.cpp b/src/ui/widgets/FilePage.cpp
index 8823eb96..71961c25 100644
--- a/src/ui/widgets/FilePage.cpp
+++ b/src/ui/widgets/FilePage.cpp
@@ -167,7 +167,7 @@ void FilePage::SlotGoPath() {
}
void FilePage::keyPressEvent(QKeyEvent* event) {
- SPDLOG_DEBUG("file page notices key press by user: {}", event->key());
+ GF_UI_LOG_DEBUG("file page notices key press by user: {}", event->key());
if (ui_->pathEdit->hasFocus() &&
(event->key() == Qt::Key_Return || event->key() == Qt::Key_Enter)) {
SlotGoPath();
diff --git a/src/ui/widgets/FileTreeView.cpp b/src/ui/widgets/FileTreeView.cpp
index 9fc8aec4..79db51ac 100644
--- a/src/ui/widgets/FileTreeView.cpp
+++ b/src/ui/widgets/FileTreeView.cpp
@@ -58,8 +58,8 @@ void FileTreeView::selectionChanged(const QItemSelection& selected,
if (!selected.indexes().empty()) {
selected_path_ = dir_model_->fileInfo(selected.indexes().first())
.filesystemAbsoluteFilePath();
- SPDLOG_DEBUG("file tree view selected target path: {}",
- selected_path_.u8string());
+ GF_UI_LOG_DEBUG("file tree view selected target path: {}",
+ selected_path_.u8string());
emit SignalSelectedChanged(QString::fromStdString(selected_path_));
} else {
selected_path_ = std::filesystem::path{};
@@ -70,8 +70,8 @@ void FileTreeView::SlotGoPath(const std::filesystem::path& target_path) {
auto file_info = QFileInfo(target_path);
if (file_info.isDir() && file_info.isReadable() && file_info.isExecutable()) {
current_path_ = file_info.filesystemAbsoluteFilePath();
- SPDLOG_DEBUG("file tree view set target path: {}",
- current_path_.u8string());
+ GF_UI_LOG_DEBUG("file tree view set target path: {}",
+ current_path_.u8string());
this->setRootIndex(dir_model_->index(file_info.filePath()));
dir_model_->setRootPath(file_info.filePath());
for (int i = 1; i < dir_model_->columnCount(); ++i) {
@@ -107,7 +107,8 @@ void FileTreeView::SlotUpLevel() {
dir_model_->fileInfo(current_root).filesystemAbsoluteFilePath();
if (target_path.has_parent_path() && !target_path.parent_path().empty()) {
target_path = target_path.parent_path();
- SPDLOG_DEBUG("file tree view go parent path: {}", target_path.u8string());
+ GF_UI_LOG_DEBUG("file tree view go parent path: {}",
+ target_path.u8string());
this->SlotGoPath(target_path);
}
current_path_ = target_path;
@@ -140,7 +141,7 @@ auto FileTreeView::GetPathByClickPoint(const QPoint& point)
}
auto index_path = dir_model_->fileInfo(index).filesystemAbsoluteFilePath();
- SPDLOG_DEBUG("file tree view right click on: {}", index_path.string());
+ GF_UI_LOG_DEBUG("file tree view right click on: {}", index_path.string());
return index_path;
}
@@ -158,7 +159,7 @@ auto FileTreeView::SlotDeleteSelectedItem() -> void {
if (ret == QMessageBox::Cancel) return;
- SPDLOG_DEBUG("delete item: {}", data.toString().toStdString());
+ GF_UI_LOG_DEBUG("delete item: {}", data.toString().toStdString());
if (!dir_model_->remove(index)) {
QMessageBox::critical(this, _("Error"),
@@ -278,14 +279,14 @@ void FileTreeView::SlotRenameSelectedItem() {
#else
auto new_name_path = selected_path_.parent_path() / text.toStdString();
#endif
- SPDLOG_DEBUG("new name path: {}", new_name_path.u8string());
+ GF_UI_LOG_DEBUG("new name path: {}", new_name_path.u8string());
std::filesystem::rename(selected_path_, new_name_path);
// refresh
SlotGoPath(current_path_);
} catch (...) {
- SPDLOG_ERROR("file tree view rename error: {}",
- selected_path_.u8string());
+ GF_UI_LOG_ERROR("file tree view rename error: {}",
+ selected_path_.u8string());
QMessageBox::critical(this, _("Error"),
_("Unable to rename the file or folder."));
}
diff --git a/src/ui/widgets/InfoBoardWidget.cpp b/src/ui/widgets/InfoBoardWidget.cpp
index c3369ff8..b2ac0119 100644
--- a/src/ui/widgets/InfoBoardWidget.cpp
+++ b/src/ui/widgets/InfoBoardWidget.cpp
@@ -116,7 +116,7 @@ void InfoBoardWidget::AssociateTabWidget(QTabWidget* tab) {
void InfoBoardWidget::AddOptionalAction(const QString& name,
const std::function<void()>& action) {
- SPDLOG_DEBUG("add option: {}", name.toStdString());
+ GF_UI_LOG_DEBUG("add option: {}", name.toStdString());
auto actionButton = new QPushButton(name);
auto layout = new QHBoxLayout();
layout->setContentsMargins(5, 0, 5, 0);
@@ -165,7 +165,7 @@ void InfoBoardWidget::slot_copy() {
void InfoBoardWidget::slot_save() {
auto file_path = QFileDialog::getSaveFileName(
this, _("Save Information Board's Content"), {}, tr("Text (*.txt)"));
- SPDLOG_DEBUG("file path: {}", file_path.toStdString());
+ GF_UI_LOG_DEBUG("file path: {}", file_path.toStdString());
if (file_path.isEmpty()) return;
QFile file(file_path);
diff --git a/src/ui/widgets/KeyList.cpp b/src/ui/widgets/KeyList.cpp
index 0e4bba5e..04c184b0 100644
--- a/src/ui/widgets/KeyList.cpp
+++ b/src/ui/widgets/KeyList.cpp
@@ -116,7 +116,7 @@ void KeyList::AddListGroupTab(const QString& name, const QString& id,
KeyListRow::KeyType selectType,
KeyListColumn::InfoType infoType,
const KeyTable::KeyTableFilter filter) {
- SPDLOG_DEBUG("add tab: {}", name.toStdString());
+ GF_UI_LOG_DEBUG("add tab: {}", name.toStdString());
auto key_list = new QTableWidget(this);
if (m_key_list_ == nullptr) {
@@ -176,7 +176,7 @@ void KeyList::AddListGroupTab(const QString& name, const QString& id,
}
void KeyList::SlotRefresh() {
- SPDLOG_DEBUG("refresh, address: {}", static_cast<void*>(this));
+ GF_UI_LOG_DEBUG("refresh, address: {}", static_cast<void*>(this));
ui_->refreshKeyListButton->setDisabled(true);
ui_->syncButton->setDisabled(true);
@@ -187,7 +187,7 @@ void KeyList::SlotRefresh() {
}
void KeyList::SlotRefreshUI() {
- SPDLOG_DEBUG("refresh, address: {}", static_cast<void*>(this));
+ GF_UI_LOG_DEBUG("refresh, address: {}", static_cast<void*>(this));
this->slot_refresh_ui();
}
@@ -315,8 +315,8 @@ void KeyList::contextMenuEvent(QContextMenuEvent* event) {
QString current_tab_widget_obj_name =
ui_->keyGroupTab->widget(ui_->keyGroupTab->currentIndex())->objectName();
- SPDLOG_DEBUG("current tab widget object name: {}",
- current_tab_widget_obj_name.toStdString());
+ GF_UI_LOG_DEBUG("current tab widget object name: {}",
+ current_tab_widget_obj_name.toStdString());
if (current_tab_widget_obj_name == "favourite") {
QList<QAction*> actions = popup_menu_->actions();
for (QAction* action : actions) {
@@ -401,7 +401,7 @@ void KeyList::dropEvent(QDropEvent* event) {
QFile file;
file.setFileName(tmp.toLocalFile());
if (!file.open(QIODevice::ReadOnly)) {
- SPDLOG_ERROR("couldn't open file: {}", tmp.toString().toStdString());
+ GF_UI_LOG_ERROR("couldn't open file: {}", tmp.toString().toStdString());
}
QByteArray inBuffer = file.readAll();
this->import_keys(inBuffer);
@@ -463,7 +463,7 @@ std::string KeyList::GetSelectedKey() {
}
void KeyList::slot_refresh_ui() {
- SPDLOG_DEBUG("refresh: {}", static_cast<void*>(buffered_keys_list_.get()));
+ GF_UI_LOG_DEBUG("refresh: {}", static_cast<void*>(buffered_keys_list_.get()));
if (buffered_keys_list_ != nullptr) {
std::lock_guard<std::mutex> guard(buffered_key_list_mutex_);
@@ -496,8 +496,8 @@ void KeyList::slot_sync_with_key_server() {
CommonUtils::SlotImportKeyFromKeyServer(
key_ids, [=](const std::string& key_id, const std::string& status,
size_t current_index, size_t all_index) {
- SPDLOG_DEBUG("import key: {} {} {} {}", key_id, status, current_index,
- all_index);
+ GF_UI_LOG_DEBUG("import key: {} {} {} {}", key_id, status,
+ current_index, all_index);
auto key = GpgKeyGetter::GetInstance().GetKey(key_id);
boost::format status_str = boost::format(_("Sync [%1%/%2%] %3% %4%")) %
@@ -518,7 +518,7 @@ void KeyList::filter_by_keyword() {
auto keyword = ui_->searchBarEdit->text();
keyword = keyword.trimmed();
- SPDLOG_DEBUG("get new keyword of search bar: {}", keyword.toStdString());
+ GF_UI_LOG_DEBUG("get new keyword of search bar: {}", keyword.toStdString());
for (auto& table : m_key_tables_) {
// refresh arguments
table.SetFilterKeyword(keyword.toLower().toStdString());
diff --git a/src/ui/widgets/PlainTextEditorPage.cpp b/src/ui/widgets/PlainTextEditorPage.cpp
index 2037689e..d5094dd3 100644
--- a/src/ui/widgets/PlainTextEditorPage.cpp
+++ b/src/ui/widgets/PlainTextEditorPage.cpp
@@ -182,7 +182,7 @@ void PlainTextEditorPage::ReadFile() {
&FileReadTask::SignalFileBytesReadNext, Qt::QueuedConnection);
connect(read_task, &FileReadTask::SignalTaskShouldEnd, this,
- []() { SPDLOG_DEBUG("read thread closed"); });
+ []() { GF_UI_LOG_DEBUG("read thread closed"); });
connect(this, &PlainTextEditorPage::close, read_task,
[=]() { read_task->SignalTaskShouldEnd(0); });
connect(read_task, &FileReadTask::SignalFileBytesReadEnd, this, [=]() {
@@ -210,7 +210,7 @@ auto BinaryToString(const std::string &source) -> std::string {
void PlainTextEditorPage::slot_insert_text(QByteArray bytes_data) {
std::string data = bytes_data.toStdString();
- SPDLOG_TRACE("inserting data read to editor, data size: {}", data.size());
+ GF_UI_LOG_TRACE("inserting data read to editor, data size: {}", data.size());
read_bytes_ += data.size();
// If binary format is detected, the entire file is converted to binary
// format for display.
diff --git a/src/ui/widgets/TextEdit.cpp b/src/ui/widgets/TextEdit.cpp
index 5ec44230..079a8496 100644
--- a/src/ui/widgets/TextEdit.cpp
+++ b/src/ui/widgets/TextEdit.cpp
@@ -118,8 +118,8 @@ void TextEdit::SlotNewFileTab() const {
void TextEdit::SlotOpenFile(const QString& path) {
QFile file(path);
- SPDLOG_DEBUG("main window editor is opening file at path: {}",
- path.toStdString());
+ GF_UI_LOG_DEBUG("main window editor is opening file at path: {}",
+ path.toStdString());
auto result = file.open(QIODevice::ReadOnly | QIODevice::Text);
if (result) {
auto* page = new PlainTextEditorPage(path);
@@ -541,7 +541,7 @@ QHash<int, QString> TextEdit::UnsavedDocuments() const {
if (ep != nullptr && ep->ReadDone() &&
ep->GetTextPage()->document()->isModified()) {
QString doc_name = tab_widget_->tabText(i);
- SPDLOG_DEBUG("unsaved: {}", doc_name.toStdString());
+ GF_UI_LOG_DEBUG("unsaved: {}", doc_name.toStdString());
// remove * before name of modified doc
doc_name.remove(0, 2);
@@ -642,16 +642,16 @@ void TextEdit::slot_save_status_to_cache_for_revovery() {
restore_text_editor_page =
settings.lookup("general.restore_text_editor_page");
} catch (...) {
- SPDLOG_ERROR("setting operation error: restore_text_editor_page");
+ GF_UI_LOG_ERROR("setting operation error: restore_text_editor_page");
}
if (!restore_text_editor_page) {
- SPDLOG_DEBUG("restore_text_editor_page is false, ignoring...");
+ GF_UI_LOG_DEBUG("restore_text_editor_page is false, ignoring...");
return;
}
int tab_count = tab_widget_->count();
- SPDLOG_DEBUG(
+ GF_UI_LOG_DEBUG(
"restore_text_editor_page is true, pan to save pages, current tabs "
"count: "
"{}",
@@ -676,8 +676,8 @@ void TextEdit::slot_save_status_to_cache_for_revovery() {
}
auto raw_text = document->toRawText().toStdString();
- SPDLOG_DEBUG("unsaved page index: {}, tab title: {} tab content: {}", i,
- tab_title, raw_text.size());
+ GF_UI_LOG_DEBUG("unsaved page index: {}, tab title: {} tab content: {}", i,
+ tab_title, raw_text.size());
unsaved_pages.push_back({i, tab_title, raw_text});
}
@@ -691,7 +691,7 @@ void TextEdit::slot_save_status_to_cache_for_revovery() {
unsaved_page_array.push_back(page_json);
}
- SPDLOG_DEBUG("unsaved page json array: {}", unsaved_page_array.dump());
+ GF_UI_LOG_DEBUG("unsaved page json array: {}", unsaved_page_array.dump());
CacheManager::GetInstance().SaveCache("editor_unsaved_pages",
unsaved_page_array);
}