diff options
author | saturneric <[email protected]> | 2024-07-30 18:48:25 +0000 |
---|---|---|
committer | saturneric <[email protected]> | 2024-07-30 18:48:25 +0000 |
commit | 99c1b2c3ed902969d8940e384ff9fcd2805098b0 (patch) | |
tree | a86ab01bbe3f85318f869ffdebfcba623be6a857 | |
parent | feat: simplify logging (diff) | |
download | GpgFrontend-99c1b2c3ed902969d8940e384ff9fcd2805098b0.tar.gz GpgFrontend-99c1b2c3ed902969d8940e384ff9fcd2805098b0.zip |
fix: do clean up
-rw-r--r-- | src/CMakeLists.txt | 37 | ||||
-rw-r--r-- | src/core/GpgCoreInit.cpp | 3 | ||||
-rw-r--r-- | src/core/function/ArchiveFileOperator.cpp | 34 | ||||
-rw-r--r-- | src/core/function/basic/SingletonStorage.cpp | 8 | ||||
-rw-r--r-- | src/core/function/basic/SingletonStorageCollection.cpp | 11 | ||||
-rw-r--r-- | src/core/function/gpg/GpgAdvancedOperator.cpp | 3 | ||||
-rw-r--r-- | src/core/function/gpg/GpgCommandExecutor.cpp | 5 | ||||
-rw-r--r-- | src/core/function/gpg/GpgContext.cpp | 4 | ||||
-rw-r--r-- | src/core/function/gpg/GpgKeyOpera.cpp | 5 | ||||
-rw-r--r-- | src/core/model/GFDataExchanger.cpp | 3 | ||||
-rw-r--r-- | src/core/model/GpgDecryptResult.cpp | 6 | ||||
-rw-r--r-- | src/core/model/GpgEncryptResult.cpp | 6 | ||||
-rw-r--r-- | src/core/model/GpgSignResult.cpp | 6 | ||||
-rw-r--r-- | src/test/GpgFrontendTest.cpp | 2 | ||||
-rw-r--r-- | src/ui/function/GenerateRevokeCertification.cpp | 5 | ||||
-rw-r--r-- | src/ui/main_window/MainWindow.cpp | 6 | ||||
-rw-r--r-- | src/ui/main_window/MainWindowSlotFunction.cpp | 3 |
17 files changed, 78 insertions, 69 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index eb7766a1..ddbc0fae 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -304,9 +304,34 @@ if(BUILD_APPLICATION AND MINGW) set(ALL_RUNTIME_DLL_FILES "") if(GPGFRONTEND_QT5_BUILD) - list(APPEND ALL_RUNTIME_DLL_FILES "Qt5Core.dll;Qt5Gui.dll;Qt5Network.dll;Qt5PrintSupport.dll;Qt5Svg.dll;Qt5Widgets.dll;libbrotlicommon.dll;libbrotlidec.dll;libdouble-conversion.dll;libzstd.dll;libmd4c.dll;") + list(APPEND ALL_RUNTIME_DLL_FILES + "Qt5Core.dll" + "Qt5Gui.dll" + "Qt5Network.dll" + "Qt5PrintSupport.dll" + "Qt5Svg.dll" + "Qt5Widgets.dll" + "libbrotlicommon.dll" + "libbrotlidec.dll" + "libdouble-conversion.dll" + "libzstd.dll" + "libmd4c.dll" + ) else() - list(APPEND ALL_RUNTIME_DLL_FILES "Qt6Core.dll;Qt6Core5Compat.dll;Qt6Gui.dll;Qt6Network.dll;Qt6PrintSupport.dll;Qt6Svg.dll;Qt6Widgets.dll;libbrotlicommon.dll;libbrotlidec.dll;libdouble-conversion.dll;libzstd.dll;libmd4c.dll;") + list(APPEND ALL_RUNTIME_DLL_FILES + "Qt6Core.dll" + "Qt6Core5Compat.dll" + "Qt6Gui.dll" + "Qt6Network.dll" + "Qt6PrintSupport.dll" + "Qt6Svg.dll" + "Qt6Widgets.dll" + "libbrotlicommon.dll" + "libbrotlidec.dll" + "libdouble-conversion.dll" + "libzstd.dll" + "libmd4c.dll" + ) endif() # find the other dlls @@ -320,7 +345,9 @@ if(BUILD_APPLICATION AND MINGW) message(STATUS "DLL: ${_dllFileName} , ITS Full Path is ${_runtimeDllLocalPath}") endforeach() - message(STATUS "All the Application Runtime Dependencies Path: ${ALL_RUNTIME_DEP_PATH_LIST}") + foreach(_dllDepPath ${ALL_RUNTIME_DEP_PATH_LIST}) + message(STATUS "Runtime DLL Dependency Path: ${_dllDepPath}") + endforeach() # copy dependencies to release path foreach(_dllRuntimeFilePath ${ALL_RUNTIME_DEP_PATH_LIST}) @@ -439,7 +466,8 @@ endif() # add i18n support if(BUILD_APPLICATION) set(LOCALE_TS_PATH ${CMAKE_SOURCE_DIR}/resource/lfs/locale/ts) - set(TS_FILES "${LOCALE_TS_PATH}/GpgFrontend.en_US.ts" + set(TS_FILES + "${LOCALE_TS_PATH}/GpgFrontend.en_US.ts" "${LOCALE_TS_PATH}/GpgFrontend.de_DE.ts" "${LOCALE_TS_PATH}/GpgFrontend.fr_FR.ts" "${LOCALE_TS_PATH}/GpgFrontend.zh_CN.ts" @@ -479,7 +507,6 @@ if(BUILD_APPLICATION) qt5_add_resources(GF_I18N_RESOURCES ${QT_QM_TRANSLATIONS_RESOURCE_FILE}) message(STATUS "GF_I18N_RESOURCES ${GF_I18N_RESOURCES}") - target_sources(${AppName} PRIVATE ${GF_I18N_RESOURCES}) else() add_custom_target(gftranslations ALL) diff --git a/src/core/GpgCoreInit.cpp b/src/core/GpgCoreInit.cpp index d0f24824..1a00049c 100644 --- a/src/core/GpgCoreInit.cpp +++ b/src/core/GpgCoreInit.cpp @@ -384,8 +384,7 @@ void InitGpgFrontendCore(CoreInitArgs args) { }; } - qCDebug( - core, + FLOG_D( "basic env checking finished, including gpgme, ctx, and key infos"); Module::UpsertRTValue("core", "env.state.basic", 1); diff --git a/src/core/function/ArchiveFileOperator.cpp b/src/core/function/ArchiveFileOperator.cpp index 71c36d46..49b50834 100644 --- a/src/core/function/ArchiveFileOperator.cpp +++ b/src/core/function/ArchiveFileOperator.cpp @@ -125,10 +125,8 @@ void ArchiveFileOperator::NewArchive2DataExchanger( r = archive_read_next_header2(disk, entry); if (r == ARCHIVE_EOF) break; if (r != ARCHIVE_OK) { - qCWarning( - core, - "archive_read_next_header2() failed, ret: %d, explain: %s", r, - archive_error_string(disk)); + FLOG_W("archive_read_next_header2() failed, ret: %d, explain: %s", + r, archive_error_string(disk)); ret = -1; break; } @@ -162,17 +160,16 @@ void ArchiveFileOperator::NewArchive2DataExchanger( r = archive_write_header(archive, entry); if (r < ARCHIVE_OK) { - qCWarning(core, - "archive_write_header() failed, ret: %d, explain: %s", - r, archive_error_string(archive)); + FLOG_W("archive_write_header() failed, ret: %d, explain: %s", r, + archive_error_string(archive)); continue; } if (r == ARCHIVE_FATAL) { - qCWarning(core, - "archive_write_header() failed, ret: %d, explain: %s, " - "abort ...", - r, archive_error_string(archive)); + FLOG_W( + "archive_write_header() failed, ret: %d, explain: %s, " + "abort ...", + r, archive_error_string(archive)); ret = -1; break; } @@ -206,17 +203,15 @@ void ArchiveFileOperator::ExtractArchiveFromDataExchanger( auto r = archive_read_support_filter_all(archive); if (r != ARCHIVE_OK) { - qCWarning(core, - "archive_read_support_filter_all(), ret: %d, reason: %s", r, - archive_error_string(archive)); + FLOG_W("archive_read_support_filter_all(), ret: %d, reason: %s", r, + archive_error_string(archive)); return r; } r = archive_read_support_format_all(archive); if (r != ARCHIVE_OK) { - qCWarning(core, - "archive_read_support_format_all(), ret: %d, reason: %s", r, - archive_error_string(archive)); + FLOG_W("archive_read_support_format_all(), ret: %d, reason: %s", r, + archive_error_string(archive)); return r; } @@ -234,9 +229,8 @@ void ArchiveFileOperator::ExtractArchiveFromDataExchanger( r = archive_write_disk_set_options(ext, 0); if (r != ARCHIVE_OK) { - qCWarning(core, - "archive_write_disk_set_options(), ret: %d, reason: %s", r, - archive_error_string(archive)); + FLOG_W("archive_write_disk_set_options(), ret: %d, reason: %s", r, + archive_error_string(archive)); return r; } diff --git a/src/core/function/basic/SingletonStorage.cpp b/src/core/function/basic/SingletonStorage.cpp index edc52b4a..e51acd77 100644 --- a/src/core/function/basic/SingletonStorage.cpp +++ b/src/core/function/basic/SingletonStorage.cpp @@ -86,10 +86,10 @@ class SingletonStorage::Impl { auto* raw_obj = p_obj.get(); { - qCDebug(core, - "register channel object to instances map, " - "channel: %d, address: %p", - channel, static_cast<void*>(p_obj.get())); + FLOG_D( + "register channel object to instances map, " + "channel: %d, address: %p", + channel, static_cast<void*>(p_obj.get())); std::unique_lock<std::shared_mutex> lock(instances_mutex_); instances_map_[channel] = std::move(p_obj); } diff --git a/src/core/function/basic/SingletonStorageCollection.cpp b/src/core/function/basic/SingletonStorageCollection.cpp index 734bf97c..7e5430fb 100644 --- a/src/core/function/basic/SingletonStorageCollection.cpp +++ b/src/core/function/basic/SingletonStorageCollection.cpp @@ -49,9 +49,8 @@ class SingletonStorageCollection::Impl { static auto GetInstance(bool force_refresh) -> SingletonStorageCollection* { if (force_refresh || global_instance == nullptr) { global_instance = SecureCreateUniqueObject<SingletonStorageCollection>(); - qCDebug(core, - "a new global singleton storage collection created, address: %p", - static_cast<void*>(global_instance.get())); + FLOG_D("a new global singleton storage collection created, address: %p", + static_cast<void*>(global_instance.get())); } return global_instance.get(); } @@ -106,10 +105,8 @@ auto GpgFrontend::SingletonStorageCollection::GetInstance(bool force_refresh) } void SingletonStorageCollection::Destroy() { - qCDebug( - core, - "global singleton storage collection is about to destroy, address: %p", - static_cast<void*>(global_instance.get())); + FLOG_D("global singleton storage collection is about to destroy, address: %p", + static_cast<void*>(global_instance.get())); return SingletonStorageCollection::Impl::Destroy(); } diff --git a/src/core/function/gpg/GpgAdvancedOperator.cpp b/src/core/function/gpg/GpgAdvancedOperator.cpp index 20d9aa4b..f143cdbb 100644 --- a/src/core/function/gpg/GpgAdvancedOperator.cpp +++ b/src/core/function/gpg/GpgAdvancedOperator.cpp @@ -120,8 +120,7 @@ void GpgFrontend::GpgAdvancedOperator::RestartGpgComponents() { FLOG_D("gpgconf --kill --all execute result: %d", success); if (!success) { - qCWarning(core, - "restart all component after core initilized failed"); + FLOG_W("restart all component after core initilized failed"); Module::UpsertRTValue( "core", "gpg_advanced_operator.restart_gpg_components", false); return; diff --git a/src/core/function/gpg/GpgCommandExecutor.cpp b/src/core/function/gpg/GpgCommandExecutor.cpp index 374d59d8..74df1d5a 100644 --- a/src/core/function/gpg/GpgCommandExecutor.cpp +++ b/src/core/function/gpg/GpgCommandExecutor.cpp @@ -45,9 +45,8 @@ auto BuildTaskFromExecCtx(const GpgCommandExecutor::ExecuteContext &context) Thread::Task::TaskCallback result_callback = [cmd](int /*rtn*/, const DataObjectPtr &data_object) { - qCDebug(core, - "data object args count of cmd executor result callback: %ld", - data_object->GetObjectSize()); + FLOG_D("data object args count of cmd executor result callback: %ld", + data_object->GetObjectSize()); if (!data_object->Check<int, QString, GpgCommandExecutorCallback>()) { FLOG_W("data object checking failed"); diff --git a/src/core/function/gpg/GpgContext.cpp b/src/core/function/gpg/GpgContext.cpp index 94a4f522..a4757d7f 100644 --- a/src/core/function/gpg/GpgContext.cpp +++ b/src/core/function/gpg/GpgContext.cpp @@ -192,9 +192,7 @@ class GpgContext::Impl { LOG_D() << "got gpgme version version from rt: " << gpgme_version; if (gpgme_get_keylist_mode(ctx) == 0) { - qCWarning( - core, - "ctx is not a valid pointer, reported by gpgme_get_keylist_mode"); + FLOG_W("ctx is not a valid pointer, reported by gpgme_get_keylist_mode"); return false; } diff --git a/src/core/function/gpg/GpgKeyOpera.cpp b/src/core/function/gpg/GpgKeyOpera.cpp index 54c90182..d501acbc 100644 --- a/src/core/function/gpg/GpgKeyOpera.cpp +++ b/src/core/function/gpg/GpgKeyOpera.cpp @@ -116,9 +116,8 @@ void GpgKeyOpera::GenerateRevokeCert(const GpgKey& key, LOG_W() << "gnupg gen revoke execute error, process stderr: " << p_err << ", process stdout: " << p_out; } else { - qCDebug(core, - "gnupg gen revoke exit_code: %d, process stdout size: %lld", - exit_code, p_out.size()); + FLOG_D("gnupg gen revoke exit_code: %d, process stdout size: %lld", + exit_code, p_out.size()); } }, nullptr, diff --git a/src/core/model/GFDataExchanger.cpp b/src/core/model/GFDataExchanger.cpp index 8b20fdfb..b2dfa4ef 100644 --- a/src/core/model/GFDataExchanger.cpp +++ b/src/core/model/GFDataExchanger.cpp @@ -52,8 +52,7 @@ auto GFDataExchanger::Write(const std::byte* buffer, size_t size) -> ssize_t { write_bytes++; } } catch (...) { - qCWarning( - core, + FLOG_W( "gf data exchanger caught exception when it writes to queue, abort..."); } diff --git a/src/core/model/GpgDecryptResult.cpp b/src/core/model/GpgDecryptResult.cpp index 2956a673..3b6ebd67 100644 --- a/src/core/model/GpgDecryptResult.cpp +++ b/src/core/model/GpgDecryptResult.cpp @@ -55,9 +55,9 @@ auto GpgDecryptResult::Recipients() -> std::vector<GpgRecipient> { try { result.emplace_back(reci); } catch (...) { - qCWarning(core, - "caught exception when processing invalid_recipients, " - "maybe nullptr of fpr"); + FLOG_W( + "caught exception when processing invalid_recipients, " + "maybe nullptr of fpr"); } } return result; diff --git a/src/core/model/GpgEncryptResult.cpp b/src/core/model/GpgEncryptResult.cpp index 98cf83de..b452b6f3 100644 --- a/src/core/model/GpgEncryptResult.cpp +++ b/src/core/model/GpgEncryptResult.cpp @@ -55,9 +55,9 @@ auto GpgEncryptResult::InvalidRecipients() try { result.emplace_back(QString{invalid_key->fpr}, invalid_key->reason); } catch (...) { - qCWarning(core, - "caught exception when processing invalid_recipients, " - "maybe nullptr of fpr"); + FLOG_W( + "caught exception when processing invalid_recipients, " + "maybe nullptr of fpr"); } } return result; diff --git a/src/core/model/GpgSignResult.cpp b/src/core/model/GpgSignResult.cpp index 3cc8d47a..1819c22b 100644 --- a/src/core/model/GpgSignResult.cpp +++ b/src/core/model/GpgSignResult.cpp @@ -55,9 +55,9 @@ auto GpgSignResult::InvalidSigners() try { result.emplace_back(QString{invalid_key->fpr}, invalid_key->reason); } catch (...) { - qCWarning(core, - "caught exception when processing invalid_signers, " - "maybe nullptr of fpr"); + FLOG_W( + "caught exception when processing invalid_signers, " + "maybe nullptr of fpr"); } } return result; diff --git a/src/test/GpgFrontendTest.cpp b/src/test/GpgFrontendTest.cpp index ce026b19..d593d03d 100644 --- a/src/test/GpgFrontendTest.cpp +++ b/src/test/GpgFrontendTest.cpp @@ -85,7 +85,7 @@ void ImportPrivateKeys(const QString& data_path, QSettings settings) { GpgKeyImportExporter::GetInstance(kGpgFrontendDefaultChannel) .ImportKey(gf_buffer); } else { - qCWarning(test) << "read from key file failed: " << key_file; + FLOG_W() << "read from key file failed: " << key_file; } } } diff --git a/src/ui/function/GenerateRevokeCertification.cpp b/src/ui/function/GenerateRevokeCertification.cpp index 9522c125..7bc4a163 100644 --- a/src/ui/function/GenerateRevokeCertification.cpp +++ b/src/ui/function/GenerateRevokeCertification.cpp @@ -51,9 +51,8 @@ auto GenerateRevokeCertification::Exec(const GpgKey& key, LOG_W() << "gnupg gen revoke execute error, process stderr: " << p_err << ", process stdout: " << p_out; } else { - qCDebug(ui, - "gnupg gen revoke exit_code: %d, process stdout size: %lld", - exit_code, p_out.size()); + FLOG_D("gnupg gen revoke exit_code: %d, process stdout size: %lld", + exit_code, p_out.size()); } }, nullptr, diff --git a/src/ui/main_window/MainWindow.cpp b/src/ui/main_window/MainWindow.cpp index 88c61218..2b3f3bda 100644 --- a/src/ui/main_window/MainWindow.cpp +++ b/src/ui/main_window/MainWindow.cpp @@ -132,9 +132,9 @@ void MainWindow::Init() noexcept { Module::ListenRTPublishEvent( this, kVersionCheckingModuleID, "version.loading_done", [=](Module::Namespace, Module::Key, int, std::any) { - qCDebug(ui, - "version-checking version.loading_done changed, calling slot " - "version upgrade"); + FLOG_D( + "version-checking version.loading_done changed, calling slot " + "version upgrade"); this->slot_version_upgrade_notify(); }); diff --git a/src/ui/main_window/MainWindowSlotFunction.cpp b/src/ui/main_window/MainWindowSlotFunction.cpp index fc63a585..5126011c 100644 --- a/src/ui/main_window/MainWindowSlotFunction.cpp +++ b/src/ui/main_window/MainWindowSlotFunction.cpp @@ -264,8 +264,7 @@ void MainWindow::SlotOpenFile(const QString& path) { } void MainWindow::slot_version_upgrade_notify() { - qCDebug( - ui, + FLOG_D( "slot version upgrade notify called, checking version info from rt..."); auto is_loading_done = Module::RetrieveRTValueTypedOrDefault<>( |