diff options
26 files changed, 50 insertions, 40 deletions
diff --git a/src/core/GpgCoreInit.cpp b/src/core/GpgCoreInit.cpp index ad720d1d..78f3ed7a 100644 --- a/src/core/GpgCoreInit.cpp +++ b/src/core/GpgCoreInit.cpp @@ -79,7 +79,11 @@ void InitCoreLoggingSystem() { #endif // flush policy +#ifdef DEBUG + core_logger->flush_on(spdlog::level::debug); +#else core_logger->flush_on(spdlog::level::err); +#endif spdlog::flush_every(std::chrono::seconds(5)); // register it as default logger diff --git a/src/core/function/ArchiveFileOperator.cpp b/src/core/function/ArchiveFileOperator.cpp index efe824dd..4fc8f5df 100644 --- a/src/core/function/ArchiveFileOperator.cpp +++ b/src/core/function/ArchiveFileOperator.cpp @@ -82,8 +82,6 @@ void GpgFrontend::ArchiveFileOperator::CreateArchive( struct archive *a; struct archive_entry *entry; - ssize_t len; - int fd; SPDLOG_DEBUG("compress: {}", compress); diff --git a/src/core/function/CacheManager.cpp b/src/core/function/CacheManager.cpp index 27133957..1641c3f8 100644 --- a/src/core/function/CacheManager.cpp +++ b/src/core/function/CacheManager.cpp @@ -33,7 +33,6 @@ #include <string> #include "function/DataObjectOperator.h" -#include "spdlog/spdlog.h" GpgFrontend::CacheManager::CacheManager(int channel) : SingletonFunctionObject<CacheManager>(channel), diff --git a/src/core/function/gpg/GpgAdvancedOperator.cpp b/src/core/function/gpg/GpgAdvancedOperator.cpp index c338e69a..7faab674 100644 --- a/src/core/function/gpg/GpgAdvancedOperator.cpp +++ b/src/core/function/gpg/GpgAdvancedOperator.cpp @@ -33,7 +33,6 @@ #include "GpgAdvancedOperator.h" #include "core/function/gpg/GpgCommandExecutor.h" -#include "spdlog/spdlog.h" GpgFrontend::GpgAdvancedOperator::GpgAdvancedOperator(int channel) : SingletonFunctionObject(channel) {} diff --git a/src/core/function/gpg/GpgKeyManager.cpp b/src/core/function/gpg/GpgKeyManager.cpp index aad47f9d..056dd9be 100644 --- a/src/core/function/gpg/GpgKeyManager.cpp +++ b/src/core/function/gpg/GpgKeyManager.cpp @@ -35,7 +35,6 @@ #include "GpgBasicOperator.h" #include "GpgKeyGetter.h" -#include "spdlog/spdlog.h" GpgFrontend::GpgKeyManager::GpgKeyManager(int channel) : SingletonFunctionObject<GpgKeyManager>(channel) {} diff --git a/src/core/module/GlobalModuleContext.cpp b/src/core/module/GlobalModuleContext.cpp index 1e6d87b1..edd35000 100644 --- a/src/core/module/GlobalModuleContext.cpp +++ b/src/core/module/GlobalModuleContext.cpp @@ -38,7 +38,6 @@ #include "core/module/Event.h" #include "core/module/Module.h" #include "core/thread/Task.h" -#include "spdlog/spdlog.h" #include "thread/DataObject.h" namespace GpgFrontend::Module { diff --git a/src/core/module/ModuleManager.cpp b/src/core/module/ModuleManager.cpp index c151ebb1..4a78a85b 100644 --- a/src/core/module/ModuleManager.cpp +++ b/src/core/module/ModuleManager.cpp @@ -51,29 +51,29 @@ class ModuleManager::Impl { void RegisterModule(ModulePtr module) { task_runner_->PostTask(new Thread::Task( - std::move([=](GpgFrontend::Thread::DataObjectPtr) -> int { + [=](GpgFrontend::Thread::DataObjectPtr) -> int { module->SetGPC(gmc_); gmc_->RegisterModule(module); return 0; - }), + }, __func__, nullptr)); } void TriggerEvent(EventRefrernce event) { task_runner_->PostTask(new Thread::Task( - std::move([=](GpgFrontend::Thread::DataObjectPtr) -> int { + [=](GpgFrontend::Thread::DataObjectPtr) -> int { gmc_->TriggerEvent(event); return 0; - }), + }, __func__, nullptr)); } void ActiveModule(ModuleIdentifier identifier) { task_runner_->PostTask(new Thread::Task( - std::move([=](GpgFrontend::Thread::DataObjectPtr) -> int { + [=](GpgFrontend::Thread::DataObjectPtr) -> int { gmc_->ActiveModule(identifier); return 0; - }), + }, __func__, nullptr)); } diff --git a/src/core/thread/Task.cpp b/src/core/thread/Task.cpp index b1c8135a..ad3d3321 100644 --- a/src/core/thread/Task.cpp +++ b/src/core/thread/Task.cpp @@ -36,8 +36,6 @@ #include <boost/uuid/uuid_io.hpp> #include <memory> -#include "spdlog/spdlog.h" - namespace GpgFrontend::Thread { class Task::Impl : public QObject { @@ -56,8 +54,8 @@ class Task::Impl : public QObject { parent_(parent), uuid_(generate_uuid()), name_(name), - runnable_(std::move(runnable)), - callback_(std::move([](int, const DataObjectPtr &) {})), + runnable_(runnable), + callback_([](int, const DataObjectPtr &) {}), callback_thread_(QThread::currentThread()), data_object_(data_object) { SPDLOG_TRACE("task {} created with runnable, callback_thread_: {}", @@ -71,8 +69,8 @@ class Task::Impl : public QObject { parent_(parent), uuid_(generate_uuid()), name_(name), - runnable_(std::move(runnable)), - callback_(std::move(callback)), + runnable_(runnable), + callback_(callback), callback_thread_(QThread::currentThread()), data_object_(data_object) { SPDLOG_TRACE( @@ -142,8 +140,8 @@ class Task::Impl : public QObject { Task *const parent_; const std::string uuid_; const std::string name_; - TaskCallback callback_; ///< TaskRunnable runnable_; ///< + TaskCallback callback_; ///< int rtn_ = 0; ///< QThread *callback_thread_ = nullptr; ///< DataObjectPtr data_object_ = nullptr; ///< diff --git a/src/core/thread/TaskRunner.cpp b/src/core/thread/TaskRunner.cpp index 8250bb5b..ca6a4033 100644 --- a/src/core/thread/TaskRunner.cpp +++ b/src/core/thread/TaskRunner.cpp @@ -36,7 +36,6 @@ #include <memory> #include "core/thread/Task.h" -#include "spdlog/spdlog.h" namespace GpgFrontend::Thread { diff --git a/src/main.cpp b/src/main.cpp index 83e7b103..ab3b9af6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -40,7 +40,6 @@ #include "core/GpgCoreInit.h" #include "core/function/GlobalSettingStation.h" #include "module/GpgFrontendModuleInit.h" -#include "spdlog/spdlog.h" #include "ui/GpgFrontendApplication.h" #include "ui/GpgFrontendUIInit.h" diff --git a/src/ui/GpgFrontendUIInit.cpp b/src/ui/GpgFrontendUIInit.cpp index 579baebe..c3bbbfd2 100644 --- a/src/ui/GpgFrontendUIInit.cpp +++ b/src/ui/GpgFrontendUIInit.cpp @@ -40,7 +40,6 @@ #include "core/function/GlobalSettingStation.h" #include "core/thread/CtxCheckTask.h" #include "core/thread/TaskRunnerGetter.h" -#include "spdlog/spdlog.h" #include "ui/SignalStation.h" #include "ui/UserInterfaceUtils.h" #include "ui/main_window/MainWindow.h" diff --git a/src/ui/UserInterfaceUtils.cpp b/src/ui/UserInterfaceUtils.cpp index e44eae4d..63a78873 100644 --- a/src/ui/UserInterfaceUtils.cpp +++ b/src/ui/UserInterfaceUtils.cpp @@ -44,7 +44,6 @@ #include "core/thread/TaskRunner.h" #include "core/thread/TaskRunnerGetter.h" #include "dialog/gnupg/GnuPGControllerDialog.h" -#include "spdlog/spdlog.h" #include "ui/SignalStation.h" #include "ui/dialog/WaitingDialog.h" #include "ui/struct/SettingsObject.h" @@ -341,7 +340,6 @@ void CommonUtils::SlotImportKeyFromKeyServer( std::string target_keyserver; try { - auto &settings = GlobalSettingStation::GetInstance().GetMainSettings(); SettingsObject key_server_json("key_server"); // get key servers from settings @@ -351,7 +349,7 @@ void CommonUtils::SlotImportKeyFromKeyServer( throw std::runtime_error("No key server configured"); } - const int target_key_server_index = + const size_t target_key_server_index = key_server_json.Check("default_server", 0); if (target_key_server_index >= key_server_list.size()) { throw std::runtime_error("default_server index out of range"); diff --git a/src/ui/dialog/GeneralDialog.cpp b/src/ui/dialog/GeneralDialog.cpp index 0e71140e..3556c403 100644 --- a/src/ui/dialog/GeneralDialog.cpp +++ b/src/ui/dialog/GeneralDialog.cpp @@ -31,7 +31,7 @@ #include "ui/struct/SettingsObject.h" GpgFrontend::UI::GeneralDialog::GeneralDialog(std::string name, QWidget *parent) - : name_(std::move(name)), QDialog(parent) { + : QDialog(parent), name_(std::move(name)) { slot_restore_settings(); connect(this, &QDialog::finished, this, &GeneralDialog::slot_save_settings); } diff --git a/src/ui/dialog/help/AboutDialog.cpp b/src/ui/dialog/help/AboutDialog.cpp index 77363bef..9948f1fc 100644 --- a/src/ui/dialog/help/AboutDialog.cpp +++ b/src/ui/dialog/help/AboutDialog.cpp @@ -37,6 +37,7 @@ #include "core/function/GlobalSettingStation.h" #include "core/module/Module.h" #include "core/module/ModuleManager.h" +#include "core/thread/TaskRunnerGetter.h" #include "ui/dialog/help/GnupgTab.h" namespace GpgFrontend::UI { diff --git a/src/ui/dialog/import_export/KeyServerImportDialog.cpp b/src/ui/dialog/import_export/KeyServerImportDialog.cpp index 1bb1651c..f6feba1a 100644 --- a/src/ui/dialog/import_export/KeyServerImportDialog.cpp +++ b/src/ui/dialog/import_export/KeyServerImportDialog.cpp @@ -179,7 +179,8 @@ QComboBox* KeyServerImportDialog::create_comboBox() { comboBox->addItem(key_server_str.c_str()); } - int default_key_server_index = key_server_json.Check("default_server", 0); + size_t default_key_server_index = + key_server_json.Check("default_server", 0); if (default_key_server_index >= key_server_list.size()) { throw std::runtime_error("default_server index out of range"); } @@ -450,7 +451,8 @@ void KeyServerImportDialog::SlotImport(const KeyIdArgsListPtr& keys) { const auto key_server_list = key_server_json.Check("server_list", nlohmann::json::array()); - int default_key_server_index = key_server_json.Check("default_server", 0); + size_t default_key_server_index = + key_server_json.Check("default_server", 0); if (default_key_server_index >= key_server_list.size()) { throw std::runtime_error("default_server index out of range"); } diff --git a/src/ui/dialog/import_export/KeyUploadDialog.cpp b/src/ui/dialog/import_export/KeyUploadDialog.cpp index 4e9c78c9..8c5552ae 100644 --- a/src/ui/dialog/import_export/KeyUploadDialog.cpp +++ b/src/ui/dialog/import_export/KeyUploadDialog.cpp @@ -79,7 +79,8 @@ void KeyUploadDialog::slot_upload_key_to_server( const auto key_server_list = key_server_json.Check("server_list", nlohmann::json::array()); - int default_key_server_index = key_server_json.Check("default_server", 0); + size_t default_key_server_index = + key_server_json.Check("default_server", 0); if (default_key_server_index >= key_server_list.size()) { throw std::runtime_error("default_server index out of range"); } diff --git a/src/ui/dialog/key_generate/KeygenDialog.cpp b/src/ui/dialog/key_generate/KeygenDialog.cpp index 40896269..7d29036f 100644 --- a/src/ui/dialog/key_generate/KeygenDialog.cpp +++ b/src/ui/dialog/key_generate/KeygenDialog.cpp @@ -275,7 +275,8 @@ void KeyGenDialog::slot_activated_key_type(int index) { SPDLOG_DEBUG("key type index changed: {}", index); // check - assert(gen_key_info_->GetSupportedKeyAlgo().size() > index); + assert(gen_key_info_->GetSupportedKeyAlgo().size() > + static_cast<size_t>(index)); gen_key_info_->SetAlgo(gen_key_info_->GetSupportedKeyAlgo()[index]); refresh_widgets_state(); } diff --git a/src/ui/dialog/key_generate/SubkeyGenerateDialog.cpp b/src/ui/dialog/key_generate/SubkeyGenerateDialog.cpp index d1c91692..b0c0e6ca 100644 --- a/src/ui/dialog/key_generate/SubkeyGenerateDialog.cpp +++ b/src/ui/dialog/key_generate/SubkeyGenerateDialog.cpp @@ -29,6 +29,7 @@ #include "SubkeyGenerateDialog.h" #include <cassert> +#include <cstddef> #include "core/common/CoreCommonUtil.h" #include "core/function/GlobalSettingStation.h" @@ -381,7 +382,8 @@ void SubkeyGenerateDialog::slot_activated_key_type(int index) { SPDLOG_DEBUG("key type index changed: {}", index); // check - assert(gen_key_info_->GetSupportedSubkeyAlgo().size() > index); + assert(gen_key_info_->GetSupportedSubkeyAlgo().size() > + static_cast<size_t>(index)); gen_key_info_->SetAlgo(gen_key_info_->GetSupportedSubkeyAlgo()[index]); refresh_widgets_state(); } diff --git a/src/ui/dialog/settings/SettingsKeyServer.cpp b/src/ui/dialog/settings/SettingsKeyServer.cpp index 02936c3e..7905192d 100644 --- a/src/ui/dialog/settings/SettingsKeyServer.cpp +++ b/src/ui/dialog/settings/SettingsKeyServer.cpp @@ -28,6 +28,8 @@ #include "SettingsKeyServer.h" +#include <cstddef> + #include "core/function/GlobalSettingStation.h" #include "core/thread/Task.h" #include "core/thread/TaskRunnerGetter.h" @@ -126,7 +128,8 @@ void KeyserverTab::SetSettings() { this->key_server_str_list_.append(key_server_str.c_str()); } - int default_key_server_index = key_server_json.Check("default_server", 0); + size_t default_key_server_index = + key_server_json.Check("default_server", 0); if (default_key_server_index >= key_server_list.size()) { throw std::runtime_error("default_server index out of range"); } @@ -243,10 +246,10 @@ void KeyserverTab::slot_test_listed_key_server() { this, [=](std::vector<ListedKeyServerTestTask::KeyServerTestResultType> result) { - const auto row_size = ui_->keyServerListTable->rowCount(); + const size_t row_size = ui_->keyServerListTable->rowCount(); if (result.size() != row_size) return; ui_->keyServerListTable->blockSignals(true); - for (int i = 0; i < row_size; i++) { + for (size_t i = 0; i < row_size; i++) { const auto status = result[i]; auto status_iem = ui_->keyServerListTable->item(i, 3); if (status == ListedKeyServerTestTask::kTestResultType_Success) { diff --git a/src/ui/main_window/MainWindow.cpp b/src/ui/main_window/MainWindow.cpp index 31fec620..fdad9ad1 100644 --- a/src/ui/main_window/MainWindow.cpp +++ b/src/ui/main_window/MainWindow.cpp @@ -32,6 +32,7 @@ #include "core/function/GlobalSettingStation.h" #include "core/function/gpg/GpgAdvancedOperator.h" #include "core/module/ModuleManager.h" +#include "main_window/GeneralMainWindow.h" #include "ui/SignalStation.h" #include "ui/main_window/GeneralMainWindow.h" #include "ui/struct/SettingsObject.h" diff --git a/src/ui/main_window/MainWindowFileSlotFunction.cpp b/src/ui/main_window/MainWindowFileSlotFunction.cpp index 325cc348..8df74862 100644 --- a/src/ui/main_window/MainWindowFileSlotFunction.cpp +++ b/src/ui/main_window/MainWindowFileSlotFunction.cpp @@ -26,14 +26,20 @@ * */ +#include <boost/format.hpp> + #include "MainWindow.h" #include "core/function/ArchiveFileOperator.h" #include "core/function/GlobalSettingStation.h" #include "core/function/gpg/GpgFileOpera.h" #include "core/function/gpg/GpgKeyGetter.h" +#include "core/function/result_analyse/GpgDecryptResultAnalyse.h" +#include "core/function/result_analyse/GpgEncryptResultAnalyse.h" +#include "core/function/result_analyse/GpgSignResultAnalyse.h" +#include "core/function/result_analyse/GpgVerifyResultAnalyse.h" #include "core/thread/Task.h" -#include "dialog/SignersPicker.h" #include "ui/UserInterfaceUtils.h" +#include "ui/dialog/SignersPicker.h" namespace GpgFrontend::UI { diff --git a/src/ui/main_window/MainWindowSlotUI.cpp b/src/ui/main_window/MainWindowSlotUI.cpp index 1d627f32..038a8aab 100644 --- a/src/ui/main_window/MainWindowSlotUI.cpp +++ b/src/ui/main_window/MainWindowSlotUI.cpp @@ -30,6 +30,8 @@ #include "core/GpgConstants.h" #include "core/function/GlobalSettingStation.h" #include "ui/UserInterfaceUtils.h" +#include "ui/dialog/Wizard.h" +#include "ui/main_window/KeyMgmt.h" #include "ui/struct/SettingsObject.h" namespace GpgFrontend::UI { diff --git a/src/ui/main_window/MainWindowUI.cpp b/src/ui/main_window/MainWindowUI.cpp index fea9d398..f18a7c7b 100644 --- a/src/ui/main_window/MainWindowUI.cpp +++ b/src/ui/main_window/MainWindowUI.cpp @@ -29,8 +29,9 @@ #include "MainWindow.h" #include "core/function/GlobalSettingStation.h" #include "core/function/gpg/GpgAdvancedOperator.h" -#include "dialog/gnupg/GnuPGControllerDialog.h" #include "ui/UserInterfaceUtils.h" +#include "ui/dialog/gnupg/GnuPGControllerDialog.h" +#include "ui/dialog/help/AboutDialog.h" namespace GpgFrontend::UI { diff --git a/src/ui/thread/KeyServerImportTask.cpp b/src/ui/thread/KeyServerImportTask.cpp index 99e662af..1f9b1b92 100644 --- a/src/ui/thread/KeyServerImportTask.cpp +++ b/src/ui/thread/KeyServerImportTask.cpp @@ -61,7 +61,7 @@ void GpgFrontend::UI::KeyServerImportTask::dealing_reply_from_server() { } emit SignalKeyServerImportResult(network_reply, buffer); - if (result_count_++ == keyids_.size() - 1) { + if (static_cast<size_t>(result_count_++) == keyids_.size() - 1) { emit SignalTaskShouldEnd(0); } }
\ No newline at end of file diff --git a/src/ui/widgets/KeyList.cpp b/src/ui/widgets/KeyList.cpp index e867735b..fb007481 100644 --- a/src/ui/widgets/KeyList.cpp +++ b/src/ui/widgets/KeyList.cpp @@ -29,13 +29,13 @@ #include "ui/widgets/KeyList.h" #include <boost/format.hpp> +#include <cstddef> #include <mutex> #include <utility> #include "core/GpgCoreInit.h" #include "core/function/GlobalSettingStation.h" #include "core/function/gpg/GpgKeyGetter.h" -#include "spdlog/spdlog.h" #include "ui/SignalStation.h" #include "ui/UserInterfaceUtils.h" #include "ui_KeyList.h" @@ -559,7 +559,7 @@ KeyIdArgsListPtr& KeyTable::GetChecked() { if (checked_key_ids_ == nullptr) checked_key_ids_ = std::make_unique<KeyIdArgsList>(); auto& ret = checked_key_ids_; - for (int i = 0; i < buffered_keys_.size(); i++) { + for (size_t i = 0; i < buffered_keys_.size(); i++) { auto key_id = buffered_keys_[i].GetId(); if (key_list_->item(i, 0)->checkState() == Qt::Checked && std::find(ret->begin(), ret->end(), key_id) == ret->end()) { diff --git a/src/ui/widgets/TextEdit.cpp b/src/ui/widgets/TextEdit.cpp index fff7ca1b..9c53b311 100644 --- a/src/ui/widgets/TextEdit.cpp +++ b/src/ui/widgets/TextEdit.cpp @@ -36,7 +36,6 @@ #include "core/function/CacheManager.h" #include "core/function/GlobalSettingStation.h" -#include "spdlog/spdlog.h" namespace GpgFrontend::UI { |