aboutsummaryrefslogtreecommitdiffstats
path: root/src/ui/main_window
diff options
context:
space:
mode:
Diffstat (limited to 'src/ui/main_window')
-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
7 files changed, 48 insertions, 44 deletions
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);