diff --git a/.gitea/workflows/develop-qt6.yml b/.gitea/workflows/develop-qt6.yml index f3ac980f..1a1630fe 100644 --- a/.gitea/workflows/develop-qt6.yml +++ b/.gitea/workflows/develop-qt6.yml @@ -59,7 +59,7 @@ jobs: sudo apt-get update sudo apt-get -y install build-essential binutils git cmake sudo apt-get -y install autoconf automake gettext texinfo - sudo apt-get -y install gcc g++ ninja-build gnupg qt6-base-dev qt6-base-dev-tools qt6-l10n-tools qt6-tools-dev qt6-tools-dev-tools libqt6svg6 + sudo apt-get -y install gcc g++ ninja-build gnupg qtchooser qt6-base-dev qt6-base-dev-tools qt6-l10n-tools qt6-tools-dev qt6-tools-dev-tools libqt6svg6 sudo apt-get -y install libarchive-dev libssl-dev libgpgme-dev libgl1-mesa-dev libfuse2 - name: Build GpgME diff --git a/src/core/function/KeyPackageOperator.cpp b/src/core/function/KeyPackageOperator.cpp index ace277b8..a5f1989c 100644 --- a/src/core/function/KeyPackageOperator.cpp +++ b/src/core/function/KeyPackageOperator.cpp @@ -45,7 +45,7 @@ namespace GpgFrontend { auto KeyPackageOperator::GeneratePassphrase(const QString& phrase_path, QString& phrase) -> bool { phrase = PassphraseGenerator::GetInstance().Generate(256); - FLOG_D("generated passphrase: %lld bytes", phrase.size()); + FLOG_D() << "generated passphrase: " << phrase.size() << "bytes"; return WriteFile(phrase_path, phrase.toUtf8()); } diff --git a/src/core/function/basic/GpgFunctionObject.h b/src/core/function/basic/GpgFunctionObject.h index 41a597e5..fea400aa 100644 --- a/src/core/function/basic/GpgFunctionObject.h +++ b/src/core/function/basic/GpgFunctionObject.h @@ -34,6 +34,7 @@ #include "core/function/basic/ChannelObject.h" #include "core/function/basic/SingletonStorage.h" #include "core/function/basic/SingletonStorageCollection.h" +#include "core/typedef/CoreTypedef.h" #include "core/utils/MemoryUtils.h" namespace GpgFrontend { diff --git a/src/core/function/gpg/GpgBasicOperator.cpp b/src/core/function/gpg/GpgBasicOperator.cpp index 7f36e60a..30fd8912 100644 --- a/src/core/function/gpg/GpgBasicOperator.cpp +++ b/src/core/function/gpg/GpgBasicOperator.cpp @@ -55,7 +55,9 @@ void SetSignersImpl(GpgContext& ctx_, const KeyArgsList& signers, bool ascii) { CheckGpgError(error); } } - if (signers.size() != gpgme_signers_count(ctx_.DefaultContext())) { + + auto count = gpgme_signers_count(ctx_.DefaultContext()); + if (static_cast(signers.size()) != count) { FLOG_D("not all signers added"); } } @@ -286,7 +288,7 @@ auto EncryptSignImpl(GpgContext& ctx_, const KeyArgsList& keys, QContainer recipients(keys.begin(), keys.end()); // Last entry data_in array has to be nullptr - recipients.emplace_back(nullptr); + recipients.push_back(nullptr); SetSignersImpl(ctx_, signers, ascii); diff --git a/src/core/function/gpg/GpgCommandExecutor.cpp b/src/core/function/gpg/GpgCommandExecutor.cpp index 5256de60..b244dfa4 100644 --- a/src/core/function/gpg/GpgCommandExecutor.cpp +++ b/src/core/function/gpg/GpgCommandExecutor.cpp @@ -201,7 +201,7 @@ void GpgCommandExecutor::ExecuteConcurrentlySync(ExecuteContexts contexts) { QObject::connect(task, &Thread::Task::SignalTaskEnd, [&]() { --remaining_tasks; - FLOG_D("remaining tasks: %lld", remaining_tasks); + LOG_D() << "remaining tasks: " << remaining_tasks; if (remaining_tasks <= 0) { FLOG_D("no remaining task, quit"); looper.quit(); diff --git a/src/core/function/gpg/GpgCommandExecutor.h b/src/core/function/gpg/GpgCommandExecutor.h index cb35e686..5a2f13db 100644 --- a/src/core/function/gpg/GpgCommandExecutor.h +++ b/src/core/function/gpg/GpgCommandExecutor.h @@ -56,7 +56,7 @@ class GPGFRONTEND_CORE_EXPORT GpgCommandExecutor { GpgCommandExecutorInterator int_func = [](QProcess *) {}); }; - using ExecuteContexts = QList; + using ExecuteContexts = QContainer; /** * @brief Excuting a command diff --git a/src/core/function/gpg/GpgFileOpera.cpp b/src/core/function/gpg/GpgFileOpera.cpp index 3b2efd52..a3ad1ac5 100644 --- a/src/core/function/gpg/GpgFileOpera.cpp +++ b/src/core/function/gpg/GpgFileOpera.cpp @@ -461,6 +461,8 @@ auto GpgFileOpera::EncryptDirectorySymmetricSync( const QString& out_path) -> std::tuple { auto ex = CreateStandardGFDataExchanger(); + CreateArchiveHelper(in_path, ex); + return RunGpgOperaSync( [=](const DataObjectPtr& data_object) -> GpgError { GpgData data_in(ex); @@ -470,8 +472,6 @@ auto GpgFileOpera::EncryptDirectorySymmetricSync( data_object); }, "gpgme_op_encrypt_symmetric", "2.1.0"); - - CreateArchiveHelper(in_path, ex); } } // namespace GpgFrontend \ No newline at end of file diff --git a/src/core/function/gpg/GpgKeyGetter.cpp b/src/core/function/gpg/GpgKeyGetter.cpp index e5b234f8..a4ca6021 100644 --- a/src/core/function/gpg/GpgKeyGetter.cpp +++ b/src/core/function/gpg/GpgKeyGetter.cpp @@ -151,7 +151,7 @@ class GpgKeyGetter::Impl : public SingletonFunctionObject { auto GetKeys(const KeyIdArgsList& ids) -> GpgKeyList { auto keys = GpgKeyList{}; - for (const auto& key_id : ids) keys.emplace_back(GetKey(key_id, true)); + for (const auto& key_id : ids) keys.push_back(GetKey(key_id, true)); return keys; } @@ -159,7 +159,7 @@ class GpgKeyGetter::Impl : public SingletonFunctionObject { // get the lock std::lock_guard lock(ctx_mutex_); auto keys_copy = GpgKeyList{}; - for (const auto& key : keys) keys_copy.emplace_back(key); + for (const auto& key : keys) keys_copy.push_back(key); return keys_copy; } @@ -192,7 +192,7 @@ class GpgKeyGetter::Impl : public SingletonFunctionObject { * @brief * */ - QList keys_cache_; + QContainer keys_cache_; /** * @brief shared mutex for the keys cache diff --git a/src/core/function/gpg/GpgKeyImportExporter.cpp b/src/core/function/gpg/GpgKeyImportExporter.cpp index 6c78f760..60c06995 100644 --- a/src/core/function/gpg/GpgKeyImportExporter.cpp +++ b/src/core/function/gpg/GpgKeyImportExporter.cpp @@ -60,7 +60,7 @@ auto GpgKeyImportExporter::ImportKey(const GFBuffer& in_buffer) GpgImportInformation::GpgImportedKey key; key.import_status = static_cast(status->status); key.fpr = status->fpr; - import_info->imported_keys.emplace_back(key); + import_info->imported_keys.push_back(key); status = status->next; } return import_info; @@ -85,8 +85,8 @@ auto GpgKeyImportExporter::ExportKey(const GpgKey& key, bool secret, bool ascii, QContainer keys_array; // Last entry data_in array has to be nullptr - keys_array.emplace_back(key); - keys_array.emplace_back(nullptr); + keys_array.push_back(static_cast(key)); + keys_array.push_back(nullptr); GpgData data_out; auto* ctx = ascii ? ctx_.DefaultContext() : ctx_.BinaryContext(); @@ -117,7 +117,7 @@ void GpgKeyImportExporter::ExportKeys(const KeyArgsList& keys, bool secret, QContainer keys_array(keys.begin(), keys.end()); // Last entry data_in array has to be nullptr - keys_array.emplace_back(nullptr); + keys_array.push_back(nullptr); GpgData data_out; auto* ctx = ascii ? ctx_.DefaultContext() : ctx_.BinaryContext(); @@ -147,7 +147,7 @@ void GpgKeyImportExporter::ExportAllKeys(const KeyArgsList& keys, bool secret, QContainer keys_array(keys.begin(), keys.end()); // Last entry data_in array has to be nullptr - keys_array.emplace_back(nullptr); + keys_array.push_back(nullptr); GpgData data_out; auto* ctx = ascii ? ctx_.DefaultContext() : ctx_.BinaryContext(); diff --git a/src/core/function/gpg/GpgKeyManager.cpp b/src/core/function/gpg/GpgKeyManager.cpp index afa775eb..36f68bdc 100644 --- a/src/core/function/gpg/GpgKeyManager.cpp +++ b/src/core/function/gpg/GpgKeyManager.cpp @@ -272,7 +272,7 @@ auto GpgKeyManager::RevokeSubkey(const GpgKey& key, int subkey_index, // dealing with reason text auto reason_text_lines = SecureCreateSharedObject( - reason_text.split('\n', Qt::SkipEmptyParts).toVector()); + reason_text.split('\n', Qt::SkipEmptyParts)); AutomatonNextStateHandler next_state_handler = [](AutomatonState state, QString status, QString args) { diff --git a/src/core/function/gpg/GpgKeyOpera.cpp b/src/core/function/gpg/GpgKeyOpera.cpp index 23a848ee..9511b347 100644 --- a/src/core/function/gpg/GpgKeyOpera.cpp +++ b/src/core/function/gpg/GpgKeyOpera.cpp @@ -111,7 +111,7 @@ void GpgKeyOpera::GenerateRevokeCert(const GpgKey& key, // dealing with reason text auto reason_text_lines = GpgFrontend::SecureCreateSharedObject( - revocation_reason_text.split('\n', Qt::SkipEmptyParts).toVector()); + revocation_reason_text.split('\n', Qt::SkipEmptyParts)); const auto app_path = Module::RetrieveRTValueTypedOrDefault<>( "core", "gpgme.ctx.app_path", QString{}); @@ -124,10 +124,10 @@ void GpgKeyOpera::GenerateRevokeCert(const GpgKey& key, if (exit_code != 0) { LOG_W() << "gnupg gen revoke execute error, process stderr: " << p_err << ", process stdout: " << p_out; - } else { - FLOG_D("gnupg gen revoke exit_code: %d, process stdout size: %lld", - exit_code, p_out.size()); + return; } + LOG_D() << "gnupg gen revoke exit_code: " << exit_code + << "process stdout size: " << p_out.size(); }, nullptr, [revocation_reason_code, reason_text_lines](QProcess* proc) -> void { diff --git a/src/core/function/gpg/GpgUIDOperator.cpp b/src/core/function/gpg/GpgUIDOperator.cpp index e87a710d..b9312745 100644 --- a/src/core/function/gpg/GpgUIDOperator.cpp +++ b/src/core/function/gpg/GpgUIDOperator.cpp @@ -156,7 +156,7 @@ auto GpgUIDOperator::RevokeUID(const GpgKey& key, int uid_index, // dealing with reason text auto reason_text_lines = GpgFrontend::SecureCreateSharedObject( - reason_text.split('\n', Qt::SkipEmptyParts).toVector()); + reason_text.split('\n', Qt::SkipEmptyParts)); AutomatonNextStateHandler next_state_handler = [](AutomatonState state, QString status, diff --git a/src/core/model/DataObject.cpp b/src/core/model/DataObject.cpp index 13838941..dbe5588e 100644 --- a/src/core/model/DataObject.cpp +++ b/src/core/model/DataObject.cpp @@ -41,7 +41,7 @@ class DataObject::Impl { void AppendObject(const std::any& obj) { params_.push_back(obj); } auto GetParameter(size_t index) -> std::any { - if (index >= params_.size()) { + if (index >= static_cast(params_.size())) { throw std::out_of_range("index out of range"); } return params_[index]; diff --git a/src/core/model/DataObject.h b/src/core/model/DataObject.h index 1713e8dd..a2b19413 100644 --- a/src/core/model/DataObject.h +++ b/src/core/model/DataObject.h @@ -65,7 +65,7 @@ class GPGFRONTEND_CORE_EXPORT DataObject { if (sizeof...(Args) != GetObjectSize()) return false; QContainer type_list = {&typeid(Args)...}; - for (size_t i = 0; i < type_list.size(); ++i) { + for (qsizetype i = 0; i < static_cast(type_list.size()); ++i) { if (std::type_index(*type_list[i]) != std::type_index((*this)[i].type())) { return false; diff --git a/src/core/model/GpgDecryptResult.cpp b/src/core/model/GpgDecryptResult.cpp index 82398d96..a2e2c9a7 100644 --- a/src/core/model/GpgDecryptResult.cpp +++ b/src/core/model/GpgDecryptResult.cpp @@ -53,7 +53,7 @@ auto GpgDecryptResult::Recipients() -> QContainer { for (auto* reci = result_ref_->recipients; reci != nullptr; reci = reci->next) { try { - result.emplace_back(reci); + result.push_back(GpgRecipient{reci}); } catch (...) { FLOG_W( "caught exception when processing invalid_recipients, " diff --git a/src/core/model/GpgEncryptResult.cpp b/src/core/model/GpgEncryptResult.cpp index b5af09b1..69a8535a 100644 --- a/src/core/model/GpgEncryptResult.cpp +++ b/src/core/model/GpgEncryptResult.cpp @@ -53,7 +53,10 @@ auto GpgEncryptResult::InvalidRecipients() for (auto* invalid_key = result_ref_->invalid_recipients; invalid_key != nullptr; invalid_key = invalid_key->next) { try { - result.emplace_back(QString{invalid_key->fpr}, invalid_key->reason); + result.push_back({ + QString{invalid_key->fpr}, + invalid_key->reason, + }); } catch (...) { FLOG_W( "caught exception when processing invalid_recipients, " diff --git a/src/core/model/GpgKey.h b/src/core/model/GpgKey.h index 1f902ca5..26423dae 100644 --- a/src/core/model/GpgKey.h +++ b/src/core/model/GpgKey.h @@ -356,12 +356,8 @@ class GPGFRONTEND_CORE_EXPORT GpgKey { */ auto operator<=(const GpgKey&) const -> bool; - /** - * @brief - * - * @return gpgme_key_t - */ - explicit operator gpgme_key_t() const; + // NOLINTNEXTLINE(google-explicit-constructor) + operator gpgme_key_t() const; private: /** diff --git a/src/core/model/GpgSignResult.cpp b/src/core/model/GpgSignResult.cpp index 4eb28523..8227d46e 100644 --- a/src/core/model/GpgSignResult.cpp +++ b/src/core/model/GpgSignResult.cpp @@ -52,7 +52,10 @@ auto GpgSignResult::InvalidSigners() for (auto* invalid_key = result_ref_->invalid_signers; invalid_key != nullptr; invalid_key = invalid_key->next) { try { - result.emplace_back(QString{invalid_key->fpr}, invalid_key->reason); + result.push_back({ + QString{invalid_key->fpr}, + invalid_key->reason, + }); } catch (...) { FLOG_W( "caught exception when processing invalid_signers, " diff --git a/src/core/model/GpgVerifyResult.cpp b/src/core/model/GpgVerifyResult.cpp index cd232c02..ca5784d8 100644 --- a/src/core/model/GpgVerifyResult.cpp +++ b/src/core/model/GpgVerifyResult.cpp @@ -50,13 +50,13 @@ auto GpgVerifyResult::GetRaw() const -> gpgme_verify_result_t { } auto GpgVerifyResult::GetSignature() const -> QContainer { - QContainer sigatures; + QContainer signatures; auto* signature = result_ref_->signatures; while (signature != nullptr) { - sigatures.emplace_back(signature); + signatures.push_back(GpgSignature{signature}); signature = signature->next; } - return sigatures; + return signatures; } } // namespace GpgFrontend \ No newline at end of file diff --git a/src/core/module/GlobalModuleContext.cpp b/src/core/module/GlobalModuleContext.cpp index 932fcac1..043117e8 100644 --- a/src/core/module/GlobalModuleContext.cpp +++ b/src/core/module/GlobalModuleContext.cpp @@ -325,8 +325,8 @@ class GlobalModuleContext::Impl { return m.has_value() && m->get()->integrated; } - auto ListAllRegisteredModuleID() -> QList { - QList module_ids; + auto ListAllRegisteredModuleID() -> QStringList { + QStringList module_ids; for (const auto& module : module_register_table_) { module_ids.append(module.first); } @@ -334,8 +334,7 @@ class GlobalModuleContext::Impl { return module_ids; } - auto GetModuleListening(const ModuleIdentifier& module_id) - -> QList { + auto GetModuleListening(const ModuleIdentifier& module_id) -> QStringList { auto module_info = search_module_register_table(module_id); if (!module_info.has_value()) return {}; return module_info->get()->listening_event_ids; @@ -464,13 +463,12 @@ auto GlobalModuleContext::IsIntegratedModule(ModuleIdentifier m_id) -> bool { return p_->IsIntegratedModule(m_id); } -auto GlobalModuleContext::ListAllRegisteredModuleID() - -> QList { +auto GlobalModuleContext::ListAllRegisteredModuleID() -> QStringList { return p_->ListAllRegisteredModuleID(); } auto GlobalModuleContext::GetModuleListening(ModuleIdentifier module_id) - -> QList { + -> QStringList { return p_->GetModuleListening(module_id); } diff --git a/src/core/module/GlobalModuleContext.h b/src/core/module/GlobalModuleContext.h index f122f36f..e0f8e644 100644 --- a/src/core/module/GlobalModuleContext.h +++ b/src/core/module/GlobalModuleContext.h @@ -82,13 +82,13 @@ class GPGFRONTEND_CORE_EXPORT GlobalModuleContext : public QObject { auto SearchEvent(EventTriggerIdentifier) -> std::optional; - auto GetModuleListening(ModuleIdentifier) -> QList; + auto GetModuleListening(ModuleIdentifier) -> QStringList; auto IsModuleActivated(ModuleIdentifier) -> bool; auto IsIntegratedModule(ModuleIdentifier) -> bool; - auto ListAllRegisteredModuleID() -> QList; + auto ListAllRegisteredModuleID() -> QStringList; [[nodiscard]] auto GetRegisteredModuleNum() const -> int; diff --git a/src/core/module/GlobalRegisterTable.cpp b/src/core/module/GlobalRegisterTable.cpp index ae0d3ee9..4dc6bc7d 100644 --- a/src/core/module/GlobalRegisterTable.cpp +++ b/src/core/module/GlobalRegisterTable.cpp @@ -121,7 +121,7 @@ class GlobalRegisterTable::Impl { current = it.value(); } - for (auto& key : current->children.keys()) rtn.emplace_back(key); + for (auto& key : current->children.keys()) rtn.push_back(key); } return rtn; } diff --git a/src/core/module/Module.cpp b/src/core/module/Module.cpp index 1be4a4bd..a77b974d 100644 --- a/src/core/module/Module.cpp +++ b/src/core/module/Module.cpp @@ -237,7 +237,7 @@ class Module::Impl { void** pointer; }; - QList module_required_symbols_ = { + QContainer module_required_symbols_ = { {"GFGetModuleGFSDKVersion", reinterpret_cast(&get_sdk_ver_api_)}, {"GFGetModuleQtEnvVersion", reinterpret_cast(&get_qt_ver_api_)}, {"GFGetModuleID", reinterpret_cast(&get_id_api_)}, diff --git a/src/core/module/ModuleManager.cpp b/src/core/module/ModuleManager.cpp index d340a561..0f6a280a 100644 --- a/src/core/module/ModuleManager.cpp +++ b/src/core/module/ModuleManager.cpp @@ -133,7 +133,7 @@ class ModuleManager::Impl { return gmc_->SearchModule(std::move(module_id)); } - auto ListAllRegisteredModuleID() -> QList { + auto ListAllRegisteredModuleID() -> QStringList { return gmc_->ListAllRegisteredModuleID(); } @@ -176,8 +176,7 @@ class ModuleManager::Impl { return gmc_->SearchEvent(std::move(trigger_id)); } - auto GetModuleListening(ModuleIdentifier module_id) - -> QList { + auto GetModuleListening(ModuleIdentifier module_id) -> QStringList { return gmc_->GetModuleListening(std::move(module_id)); } @@ -246,7 +245,7 @@ class ModuleManager::Impl { static ModuleMangerPtr global_module_manager; SecureUniquePtr gmc_; SecureUniquePtr grt_; - QList module_libraries_; + QContainer module_libraries_; int need_register_modules_ = -1; }; @@ -300,7 +299,7 @@ void ModuleManager::ListenEvent(ModuleIdentifier module, } auto ModuleManager::GetModuleListening(ModuleIdentifier module_id) - -> QList { + -> QStringList { return p_->GetModuleListening(module_id); } @@ -353,7 +352,7 @@ auto ModuleManager::IsIntegratedModule(ModuleIdentifier id) -> bool { return p_->IsIntegratedModule(id); } -auto ModuleManager::ListAllRegisteredModuleID() -> QList { +auto ModuleManager::ListAllRegisteredModuleID() -> QStringList { return p_->ListAllRegisteredModuleID(); }; diff --git a/src/core/module/ModuleManager.h b/src/core/module/ModuleManager.h index 3ac35b98..0077fe44 100644 --- a/src/core/module/ModuleManager.h +++ b/src/core/module/ModuleManager.h @@ -71,7 +71,7 @@ class GPGFRONTEND_CORE_EXPORT ModuleManager void SetNeedRegisterModulesNum(int); - auto ListAllRegisteredModuleID() -> QList; + auto ListAllRegisteredModuleID() -> QStringList; void RegisterModule(ModulePtr); @@ -87,7 +87,7 @@ class GPGFRONTEND_CORE_EXPORT ModuleManager auto SearchEvent(EventTriggerIdentifier) -> std::optional; - auto GetModuleListening(ModuleIdentifier) -> QList; + auto GetModuleListening(ModuleIdentifier) -> QStringList; void ActiveModule(ModuleIdentifier); diff --git a/src/core/struct/settings_object/KeyDatabaseListSO.h b/src/core/struct/settings_object/KeyDatabaseListSO.h index 3e5e1320..6d9f276d 100644 --- a/src/core/struct/settings_object/KeyDatabaseListSO.h +++ b/src/core/struct/settings_object/KeyDatabaseListSO.h @@ -29,11 +29,12 @@ #pragma once #include "core/struct/settings_object/KeyDatabaseItemSO.h" +#include "core/typedef/CoreTypedef.h" namespace GpgFrontend { struct KeyDatabaseListSO { - QList key_databases; + QContainer key_databases; KeyDatabaseListSO() = default; diff --git a/src/core/utils/GpgUtils.cpp b/src/core/utils/GpgUtils.cpp index ec0f35e2..c96f523b 100644 --- a/src/core/utils/GpgUtils.cpp +++ b/src/core/utils/GpgUtils.cpp @@ -176,10 +176,10 @@ auto SetExtensionOfOutputFileForArchive(const QString& path, GpgOperation opera, return file_info.absolutePath() + "/" + file_info.baseName(); } -static QList gpg_key_database_info_cache; +static QContainer gpg_key_database_info_cache; auto GPGFRONTEND_CORE_EXPORT GetGpgKeyDatabaseInfos() - -> QList { + -> QContainer { if (!gpg_key_database_info_cache.empty()) return gpg_key_database_info_cache; auto context_index_list = Module::ListRTChildKeys("core", "gpgme.ctx.list"); @@ -300,7 +300,7 @@ auto GetCanonicalKeyDatabasePath(const QDir& app_path, return {}; } -auto GetKeyDatabaseInfoBySettings() -> QList { +auto GetKeyDatabaseInfoBySettings() -> QContainer { auto key_dbs = GetKeyDatabasesBySettings(); QContainer key_db_infos; @@ -329,7 +329,7 @@ auto GetKeyDatabaseInfoBySettings() -> QList { auto GPGFRONTEND_CORE_EXPORT Convert2RawGpgMEKeyList( const QContainer& keys) -> QContainer { QContainer recipients(keys.begin(), keys.end()); - recipients.emplace_back(nullptr); + recipients.push_back(nullptr); return recipients; } diff --git a/src/core/utils/GpgUtils.h b/src/core/utils/GpgUtils.h index 89f3720a..7710f56e 100644 --- a/src/core/utils/GpgUtils.h +++ b/src/core/utils/GpgUtils.h @@ -128,22 +128,23 @@ auto GPGFRONTEND_CORE_EXPORT GetKeyDatabasesBySettings() /** * @brief * - * @return QList + * @return QContainer */ auto GPGFRONTEND_CORE_EXPORT GetKeyDatabaseInfoBySettings() - -> QList; + -> QContainer; /** * @brief * - * @return QList + * @return QContainer */ -auto GPGFRONTEND_CORE_EXPORT GetGpgKeyDatabaseInfos() -> QList; +auto GPGFRONTEND_CORE_EXPORT GetGpgKeyDatabaseInfos() + -> QContainer; /** * @brief * - * @return QList + * @return QContainer */ auto GPGFRONTEND_CORE_EXPORT GetGpgKeyDatabaseName(int channel) -> QString; diff --git a/src/sdk/GFSDKBasic.cpp b/src/sdk/GFSDKBasic.cpp index ef96237f..b912740e 100644 --- a/src/sdk/GFSDKBasic.cpp +++ b/src/sdk/GFSDKBasic.cpp @@ -65,9 +65,10 @@ void GFExecuteCommandSync(const char* cmd, int32_t argc, char** argv, void GFExecuteCommandBatchSync(GFCommandExecuteContext** contexts, int32_t contexts_size) { - QList core_contexts; + GpgFrontend::QContainer + core_contexts; - QList sdk_contexts = + GpgFrontend::QContainer sdk_contexts = ArrayToQList(contexts, contexts_size); for (const auto sdk_context : sdk_contexts) { QStringList args = diff --git a/src/sdk/private/GFSDKPrivat.h b/src/sdk/private/GFSDKPrivat.h index 1d1cc8d3..aff71420 100644 --- a/src/sdk/private/GFSDKPrivat.h +++ b/src/sdk/private/GFSDKPrivat.h @@ -29,6 +29,7 @@ #pragma once #include +#include Q_DECLARE_LOGGING_CATEGORY(sdk) @@ -108,12 +109,13 @@ auto CharArrayToQStringList(char **char_array, int size) -> QStringList; auto QStringListToCharArray(const QStringList &list) -> char **; template -inline auto ArrayToQList(T **pl_components, int size) -> QList { +inline auto ArrayToQList(T **pl_components, + int size) -> GpgFrontend::QContainer { if (pl_components == nullptr || size <= 0) { - return QList(); + return GpgFrontend::QContainer(); } - QList list; + GpgFrontend::QContainer list; for (int i = 0; i < size; ++i) { list.append(*pl_components[i]); GpgFrontend::SecureMemoryAllocator::Deallocate(pl_components[i]); @@ -123,7 +125,7 @@ inline auto ArrayToQList(T **pl_components, int size) -> QList { } template -inline auto QListToArray(const QList &list) -> T ** { +inline auto QListToArray(const GpgFrontend::QContainer &list) -> T ** { T **array = static_cast( GpgFrontend::SecureMemoryAllocator::Allocate(list.size() * sizeof(T *))); int index = 0; diff --git a/src/ui/GpgFrontendUIInit.cpp b/src/ui/GpgFrontendUIInit.cpp index 9b24141f..e9c99dbc 100644 --- a/src/ui/GpgFrontendUIInit.cpp +++ b/src/ui/GpgFrontendUIInit.cpp @@ -42,8 +42,8 @@ namespace GpgFrontend::UI { -QList registered_translators; -QList loaded_qm_datum; +QContainer registered_translators; +QContainer loaded_qm_datum; extern void InitUITranslations(); diff --git a/src/ui/UIModuleManager.cpp b/src/ui/UIModuleManager.cpp index 89621f9c..b172892a 100644 --- a/src/ui/UIModuleManager.cpp +++ b/src/ui/UIModuleManager.cpp @@ -76,7 +76,8 @@ auto UIModuleManager::MountEntry(const QString& id, return true; } -auto UIModuleManager::QueryMountedEntries(QString id) -> QList { +auto UIModuleManager::QueryMountedEntries(QString id) + -> QContainer { if (id.isEmpty() || !mount_points_.contains(id)) return {}; return mounted_entries_[id]; } diff --git a/src/ui/UIModuleManager.h b/src/ui/UIModuleManager.h index 2388dc71..fbe9fae2 100644 --- a/src/ui/UIModuleManager.h +++ b/src/ui/UIModuleManager.h @@ -98,9 +98,9 @@ class GPGFRONTEND_UI_EXPORT UIModuleManager * @brief * * @param id - * @return QList + * @return QContainer */ - auto QueryMountedEntries(QString id) -> QList; + auto QueryMountedEntries(QString id) -> QContainer; /** * @brief @@ -156,10 +156,10 @@ class GPGFRONTEND_UI_EXPORT UIModuleManager private: QMap mount_points_; - QMap> mounted_entries_; + QMap> mounted_entries_; QMap translator_data_readers_; - QList registered_translators_; - QList read_translator_data_list_; + QContainer registered_translators_; + QContainer read_translator_data_list_; QMap> registered_qobjects_; QMap capsule_; }; diff --git a/src/ui/dialog/KeyDatabaseEditDialog.cpp b/src/ui/dialog/KeyDatabaseEditDialog.cpp index bde50f0c..3fb444b8 100644 --- a/src/ui/dialog/KeyDatabaseEditDialog.cpp +++ b/src/ui/dialog/KeyDatabaseEditDialog.cpp @@ -37,7 +37,7 @@ namespace GpgFrontend::UI { KeyDatabaseEditDialog::KeyDatabaseEditDialog( - QList key_db_infos, QWidget* parent) + QContainer key_db_infos, QWidget* parent) : GeneralDialog("KeyDatabaseEditDialog", parent), ui_(GpgFrontend::SecureCreateSharedObject()), key_database_infos_(std::move(key_db_infos)) { diff --git a/src/ui/dialog/KeyDatabaseEditDialog.h b/src/ui/dialog/KeyDatabaseEditDialog.h index 9c0e96b0..c2e9f435 100644 --- a/src/ui/dialog/KeyDatabaseEditDialog.h +++ b/src/ui/dialog/KeyDatabaseEditDialog.h @@ -28,9 +28,8 @@ #pragma once -#include - #include "core/model/KeyDatabaseInfo.h" +#include "core/typedef/CoreTypedef.h" #include "ui/dialog/GeneralDialog.h" class Ui_KeyDatabaseEditDialog; @@ -39,7 +38,7 @@ namespace GpgFrontend::UI { class KeyDatabaseEditDialog : public GeneralDialog { Q_OBJECT public: - explicit KeyDatabaseEditDialog(QList key_db_infos, + explicit KeyDatabaseEditDialog(QContainer key_db_infos, QWidget* parent); void SetDefaultName(QString name); @@ -56,7 +55,7 @@ class KeyDatabaseEditDialog : public GeneralDialog { QString default_path_; QString name_; QString path_; - QList key_database_infos_; + QContainer key_database_infos_; void slot_button_box_accepted(); diff --git a/src/ui/dialog/QuitDialog.cpp b/src/ui/dialog/QuitDialog.cpp index 39b1e965..8e83b0cc 100755 --- a/src/ui/dialog/QuitDialog.cpp +++ b/src/ui/dialog/QuitDialog.cpp @@ -132,8 +132,8 @@ void QuitDialog::slot_my_discard() { auto QuitDialog::IsDiscarded() const -> bool { return discarded_; } -auto QuitDialog::GetTabIdsToSave() -> QList { - QList tab_ids_to_save; +auto QuitDialog::GetTabIdsToSave() -> QContainer { + QContainer tab_ids_to_save; for (int i = 0; i < m_fileList_->rowCount(); i++) { if (m_fileList_->item(i, 0)->checkState() == Qt::Checked) { tab_ids_to_save << m_fileList_->item(i, 2)->text().toInt(); diff --git a/src/ui/dialog/QuitDialog.h b/src/ui/dialog/QuitDialog.h index 6eb71dcc..f6596c1d 100755 --- a/src/ui/dialog/QuitDialog.h +++ b/src/ui/dialog/QuitDialog.h @@ -28,6 +28,7 @@ #pragma once +#include "core/typedef/CoreTypedef.h" #include "ui/GpgFrontendUI.h" #include "ui/dialog/GeneralDialog.h" @@ -60,9 +61,9 @@ class QuitDialog : public GeneralDialog { /** * @brief Get the Tab Ids To Save object * - * @return QList + * @return QContainer */ - auto GetTabIdsToSave() -> QList; + auto GetTabIdsToSave() -> QContainer; private slots: diff --git a/src/ui/dialog/controller/GnuPGControllerDialog.h b/src/ui/dialog/controller/GnuPGControllerDialog.h index f0994c27..3ee129b9 100644 --- a/src/ui/dialog/controller/GnuPGControllerDialog.h +++ b/src/ui/dialog/controller/GnuPGControllerDialog.h @@ -28,7 +28,8 @@ #pragma once -#include "core/struct/settings_object/KeyDatabaseItemSO.h" +#include "core/model/KeyDatabaseInfo.h" +#include "core/typedef/CoreTypedef.h" #include "ui/dialog/GeneralDialog.h" class Ui_GnuPGControllerDialog; @@ -131,8 +132,8 @@ class GnuPGControllerDialog : public GeneralDialog { QString custom_key_database_path_; QString custom_gnupg_path_; QMenu* popup_menu_{}; - QList active_key_db_infos_; - QList key_db_infos_; + QContainer active_key_db_infos_; + QContainer key_db_infos_; /** * @brief Get the Restart Needed object diff --git a/src/ui/dialog/key_generate/KeyGenerateDialog.cpp b/src/ui/dialog/key_generate/KeyGenerateDialog.cpp index ab3a5ac8..39c39c91 100644 --- a/src/ui/dialog/key_generate/KeyGenerateDialog.cpp +++ b/src/ui/dialog/key_generate/KeyGenerateDialog.cpp @@ -424,7 +424,8 @@ void KeyGenerateDialog::set_signal_slot_config() { slot_set_easy_valid_date_2_custom(); }); - connect(ui_->keyDBIndexComboBox, &QComboBox::currentIndexChanged, this, + connect(ui_->keyDBIndexComboBox, + qOverload(&QComboBox::currentIndexChanged), this, [=](int index) { channel_ = index; }); connect(ui_->easyCombinationComboBox, &QComboBox::currentTextChanged, this, diff --git a/src/ui/main_window/MainWindow.cpp b/src/ui/main_window/MainWindow.cpp index 319a1ad9..5cabd52d 100644 --- a/src/ui/main_window/MainWindow.cpp +++ b/src/ui/main_window/MainWindow.cpp @@ -279,15 +279,17 @@ void MainWindow::closeEvent(QCloseEvent* event) { } } -auto MainWindow::create_action( - const QString& id, const QString& name, const QString& icon, - const QString& too_tip, const QList& shortcuts) -> QAction* { +auto MainWindow::create_action(const QString& id, const QString& name, + const QString& icon, const QString& too_tip, + const QContainer& shortcuts) + -> QAction* { auto* action = new QAction(name, this); action->setIcon(QIcon(icon)); action->setToolTip(too_tip); if (!shortcuts.isEmpty()) { - action->setShortcuts(shortcuts); + action->setShortcuts( + QList{shortcuts.cbegin(), shortcuts.cend()}); } buffered_actions_.insert(id, {action}); diff --git a/src/ui/main_window/MainWindow.h b/src/ui/main_window/MainWindow.h index 8ec6bffd..165deee5 100644 --- a/src/ui/main_window/MainWindow.h +++ b/src/ui/main_window/MainWindow.h @@ -580,7 +580,8 @@ class MainWindow : public GeneralMainWindow { */ auto create_action(const QString& id, const QString& name, const QString& icon, const QString& too_tip, - const QList& shortcuts = {}) -> QAction*; + const QContainer& shortcuts = {}) + -> QAction*; /** * @brief diff --git a/src/ui/widgets/PlainTextEditorPage.cpp b/src/ui/widgets/PlainTextEditorPage.cpp index ac41c9ab..91d7af1e 100644 --- a/src/ui/widgets/PlainTextEditorPage.cpp +++ b/src/ui/widgets/PlainTextEditorPage.cpp @@ -107,8 +107,8 @@ void PlainTextEditorPage::ShowNotificationWidget(QWidget *widget, } void PlainTextEditorPage::CloseNoteByClass(const char *className) { - QList widgets = findChildren(); - for (QWidget *widget : widgets) { + auto widgets = findChildren(); + for (auto *widget : widgets) { if (widget->property(className) == true) { widget->close(); } diff --git a/src/ui/widgets/TextEdit.cpp b/src/ui/widgets/TextEdit.cpp index 8b32983a..219f1447 100644 --- a/src/ui/widgets/TextEdit.cpp +++ b/src/ui/widgets/TextEdit.cpp @@ -370,7 +370,7 @@ auto TextEdit::MaybeSaveAnyTab() -> bool { } bool all_saved = true; - QList const tab_ids_to_save = dialog->GetTabIdsToSave(); + QContainer const tab_ids_to_save = dialog->GetTabIdsToSave(); for (const auto& tab_id : tab_ids_to_save) { tab_widget_->setCurrentIndex(tab_id); if (!maybe_save_current_tab(false)) { diff --git a/src/ui/widgets/TextEditTabWidget.cpp b/src/ui/widgets/TextEditTabWidget.cpp index 0427a6e8..11400f1f 100644 --- a/src/ui/widgets/TextEditTabWidget.cpp +++ b/src/ui/widgets/TextEditTabWidget.cpp @@ -228,7 +228,7 @@ void TextEditTabWidget::slot_save_status_to_cache_for_recovery() { continue; } - unsaved_pages.emplace_back(i, tab_title, document->toRawText()); + unsaved_pages.push_back({i, tab_title, document->toRawText()}); } CacheObject cache("editor_unsaved_pages");