diff options
author | saturneric <[email protected]> | 2023-10-23 10:27:25 +0000 |
---|---|---|
committer | saturneric <[email protected]> | 2023-10-23 10:27:25 +0000 |
commit | 8fdeb3af49999f29e017b7f7a70bd36f020ba721 (patch) | |
tree | db90267c3c88d488570a8e359bd511b64c5686d8 | |
parent | feat: improve project structure and add GRT for modules (diff) | |
download | GpgFrontend-8fdeb3af49999f29e017b7f7a70bd36f020ba721.tar.gz GpgFrontend-8fdeb3af49999f29e017b7f7a70bd36f020ba721.zip |
perf: reduce header includes and improve build speed
122 files changed, 234 insertions, 571 deletions
diff --git a/src/GpgFrontend.h.in b/src/GpgFrontend.h.in index 8a27212c..50be4d66 100644 --- a/src/GpgFrontend.h.in +++ b/src/GpgFrontend.h.in @@ -26,26 +26,18 @@ * */ -#ifndef GPGFRONTEND_H_IN -#define GPGFRONTEND_H_IN - -// standard headers -#include <cstdint> -#include <optional> -#include <filesystem> +#pragma once #ifdef WINDOWS -#include <winsock2.h> #include <windows.h> +#include <winsock2.h> #endif - // i18n support #include <libintl.h> -#define _(String) gettext (String) +#define _(String) gettext(String) #define gettext_noop(String) String -#define N_(String) gettext_noop (String) - +#define N_(String) gettext_noop(String) // fix macro bugs in mingw #ifdef WINDOWS @@ -55,17 +47,11 @@ #undef snprintf #endif - -// logging system -#define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_TRACE -#include <spdlog/spdlog.h> - // build info #define PROJECT_NAME "@CMAKE_PROJECT_NAME@" -#define OS_PLATFORM @OS_PLATFORM@ +#define OS_PLATFORM @OS_PLATFORM @ #define LOCALE_DIR "@LOCALE_DIR@" - // macros to find resource files #if defined(MACOS) && defined(RELEASE) #define RESOURCE_DIR(appDir) (appDir + "/../Resources/") @@ -77,5 +63,3 @@ #define RESOURCE_DIR(appDir) (appDir) #define RESOURCE_DIR_BOOST_PATH(appDir) (appDir) #endif - -#endif // GPGFRONTEND_H_IN diff --git a/src/GpgFrontendBuildInfo.h.in b/src/GpgFrontendBuildInfo.h.in index 604312cf..ee5b8396 100644 --- a/src/GpgFrontendBuildInfo.h.in +++ b/src/GpgFrontendBuildInfo.h.in @@ -26,8 +26,7 @@ * */ -#ifndef GPGFRONTEND_BUILD_INFO_H_IN -#define GPGFRONTEND_BUILD_INFO_H_IN +#pragma once /** * Logic Version (*.*.*) @@ -54,9 +53,4 @@ */ #define BUILD_FLAG @BUILD_FLAG@ #define BUILD_TIMESTAMP "@BUILD_TIMESTAMP@" -#define APP_INSTALL_FLAG "@APP_INSTALL_FLAG@" - - - - -#endif // GPGFRONTEND_BUILD_INFO_H_IN +#define APP_INSTALL_FLAG "@APP_INSTALL_FLAG@"
\ No newline at end of file diff --git a/src/GpgFrontendBuildInstallInfo.h.in b/src/GpgFrontendBuildInstallInfo.h.in index 43036308..79ae30b6 100644 --- a/src/GpgFrontendBuildInstallInfo.h.in +++ b/src/GpgFrontendBuildInstallInfo.h.in @@ -26,8 +26,7 @@ * */ -#ifndef GPGFRONTEND_BUILD_INSTALL_INFO_H_IN -#define GPGFRONTEND_BUILD_INSTALL_INFO_H_IN +#pragma once /** * Build & Install Path Information @@ -36,6 +35,4 @@ #define APP_BIN_PATH "@CMAKE_INSTALL_FULL_BINDIR@" #define APP_LOCALSTATE_PATH "@CMAKE_INSTALL_FULL_LOCALSTATEDIR@" #define APP_SYSCONF_PATH "@CMAKE_INSTALL_FULL_SYSCONFDIR@" -#define APP_INFO_PATH "@CMAKE_INSTALL_FULL_INFODIR@" - -#endif // GPGFRONTEND_BUILD_INSTALL_INFO_H_IN
\ No newline at end of file +#define APP_INFO_PATH "@CMAKE_INSTALL_FULL_INFODIR@"
\ No newline at end of file diff --git a/src/core/GpgConstants.h b/src/core/GpgConstants.h index 48fa37e6..477c48cc 100644 --- a/src/core/GpgConstants.h +++ b/src/core/GpgConstants.h @@ -26,10 +26,9 @@ * */ -#ifndef GPG_CONSTANTS_H -#define GPG_CONSTANTS_H +#pragma once -#include <memory> +#include <gpgme.h> #include "GpgFrontendCore.h" @@ -217,5 +216,3 @@ class GPGFRONTEND_CORE_EXPORT GpgConstants { }; } // namespace GpgFrontend - -#endif // GPG_CONSTANTS_H diff --git a/src/core/GpgContext.h b/src/core/GpgContext.h index a4368bec..4c09d02c 100644 --- a/src/core/GpgContext.h +++ b/src/core/GpgContext.h @@ -26,11 +26,11 @@ * */ -#ifndef __SGPGMEPP_CONTEXT_H__ -#define __SGPGMEPP_CONTEXT_H__ +#pragma once +#include <mutex> #include <optional> -#include <string> +#include <shared_mutex> #include "GpgFunctionObject.h" #include "GpgInfo.h" @@ -206,5 +206,3 @@ class GPGFRONTEND_CORE_EXPORT GpgContext void SetPassphraseCb(gpgme_passphrase_cb_t func) const; }; } // namespace GpgFrontend - -#endif // __SGPGMEPP_CONTEXT_H__
\ No newline at end of file diff --git a/src/core/GpgCoreInit.cpp b/src/core/GpgCoreInit.cpp index 62344287..261dd2fc 100644 --- a/src/core/GpgCoreInit.cpp +++ b/src/core/GpgCoreInit.cpp @@ -32,17 +32,15 @@ #include <spdlog/sinks/rotating_file_sink.h> #include <spdlog/sinks/stdout_color_sinks.h> -#include <filesystem> -#include <string> +#include <boost/date_time.hpp> #include "GpgFunctionObject.h" #include "core/GpgContext.h" #include "core/function/GlobalSettingStation.h" -#include "function/gpg/GpgAdvancedOperator.h" -#include "spdlog/spdlog.h" -#include "thread/Task.h" -#include "thread/TaskRunner.h" -#include "thread/TaskRunnerGetter.h" +#include "core/function/gpg/GpgAdvancedOperator.h" +#include "core/thread/Task.h" +#include "core/thread/TaskRunner.h" +#include "core/thread/TaskRunnerGetter.h" namespace GpgFrontend { diff --git a/src/core/GpgCoreInit.h b/src/core/GpgCoreInit.h index c2f2d84a..ea33180c 100644 --- a/src/core/GpgCoreInit.h +++ b/src/core/GpgCoreInit.h @@ -26,8 +26,7 @@ * */ -#ifndef GPGFRONTEND_GPGCOREINIT_H -#define GPGFRONTEND_GPGCOREINIT_H +#pragma once #include "GpgConstants.h" @@ -72,5 +71,3 @@ void new_default_settings_channel( int channel = GpgFrontend::GPGFRONTEND_DEFAULT_CHANNEL); } // namespace GpgFrontend - -#endif // GPGFRONTEND_GPGCOREINIT_H diff --git a/src/core/GpgFrontendCore.h b/src/core/GpgFrontendCore.h index 82785fbe..8478e2f0 100644 --- a/src/core/GpgFrontendCore.h +++ b/src/core/GpgFrontendCore.h @@ -26,50 +26,23 @@ * */ -#ifndef GPGFRONTEND_GPGFRONTENDCORE_H -#define GPGFRONTEND_GPGFRONTENDCORE_H +#pragma once -#include "GpgFrontend.h" - -// gnupg -#include <gpgme.h> - -// std includes -#include <any> -#include <cassert> +// std #include <filesystem> -#include <functional> -#include <map> #include <memory> -#include <mutex> -#include <random> -#include <set> -#include <shared_mutex> -#include <stdexcept> #include <string> -#include <typeinfo> -#include <utility> #include <vector> -// boost includes -#include <boost/date_time.hpp> -#include <boost/date_time/posix_time/conversion.hpp> -#include <boost/date_time/posix_time/posix_time.hpp> -#include <boost/date_time/posix_time/ptime.hpp> -#include <boost/filesystem/operations.hpp> -#include <boost/filesystem/path.hpp> -#include <boost/format.hpp> - -// Qt includes +// Qt #include <QtCore> -// libconfig includes -#include <libconfig.h++> +// spdlog library configuration +#define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_TRACE +#include <spdlog/spdlog.h> -// json includes -#include <nlohmann/json.hpp> +// logbal includes or macroes +#include "GpgFrontend.h" -// dll export macro +// dll export macroes #include "GpgFrontendCoreExport.h" - -#endif // GPGFRONTEND_GPGFRONTENDCORE_H diff --git a/src/core/GpgFunctionObject.h b/src/core/GpgFunctionObject.h index d0a992c6..37315b68 100644 --- a/src/core/GpgFunctionObject.h +++ b/src/core/GpgFunctionObject.h @@ -26,8 +26,9 @@ * */ -#ifndef GPGFRONTEND_ZH_CN_TS_FUNCTIONOBJECT_H -#define GPGFRONTEND_ZH_CN_TS_FUNCTIONOBJECT_H +#pragma once + +#include <shared_mutex> #include "core/GpgFrontendCore.h" @@ -305,5 +306,3 @@ class SingletonFunctionObject : public ChannelObject { virtual ~SingletonFunctionObject() = default; }; } // namespace GpgFrontend - -#endif // GPGFRONTEND_ZH_CN_TS_FUNCTIONOBJECT_H diff --git a/src/core/GpgGenKeyInfo.h b/src/core/GpgGenKeyInfo.h index 86e112ab..f0e2c612 100644 --- a/src/core/GpgGenKeyInfo.h +++ b/src/core/GpgGenKeyInfo.h @@ -26,8 +26,7 @@ * */ -#ifndef GPGFRONTEND_GPGGENKEYINFO_H -#define GPGFRONTEND_GPGGENKEYINFO_H +#pragma once #include <boost/date_time.hpp> #include <boost/date_time/gregorian/greg_duration_types.hpp> @@ -433,5 +432,3 @@ class GPGFRONTEND_CORE_EXPORT GenKeyInfo { }; } // namespace GpgFrontend - -#endif // GPGFRONTEND_GPGGENKEYINFO_H diff --git a/src/core/GpgInfo.h b/src/core/GpgInfo.h index e089fd1b..8c1a947c 100644 --- a/src/core/GpgInfo.h +++ b/src/core/GpgInfo.h @@ -26,11 +26,9 @@ * */ -#ifndef GPGFRONTEND_ZH_CN_TS_GPGINFO_H -#define GPGFRONTEND_ZH_CN_TS_GPGINFO_H +#pragma once -#include <mutex> -#include <string> +#include <shared_mutex> namespace GpgFrontend { /** @@ -61,5 +59,3 @@ class GpgInfo { std::shared_mutex Lock; }; } // namespace GpgFrontend - -#endif // GPGFRONTEND_ZH_CN_TS_GPGINFO_H diff --git a/src/core/GpgModel.h b/src/core/GpgModel.h index a5f7d8cc..d227e25d 100644 --- a/src/core/GpgModel.h +++ b/src/core/GpgModel.h @@ -26,8 +26,7 @@ * */ -#ifndef GPGFRONTEND_ZH_CN_TS_GPGMODEL_H -#define GPGFRONTEND_ZH_CN_TS_GPGMODEL_H +#pragma once #include "core/GpgConstants.h" #include "core/model/GpgData.h" @@ -53,5 +52,3 @@ using KeyPtr = std::unique_ptr<GpgKey>; ///< using KeyPtrArgsList = const std::initializer_list<KeyPtr>; ///< } // namespace GpgFrontend - -#endif // GPGFRONTEND_ZH_CN_TS_GPGMODEL_H diff --git a/src/core/common/CoreCommonUtil.h b/src/core/common/CoreCommonUtil.h index 7c1a4397..4a456071 100644 --- a/src/core/common/CoreCommonUtil.h +++ b/src/core/common/CoreCommonUtil.h @@ -26,8 +26,7 @@ *
*/
-#ifndef GPGFRONTEND_CORECOMMONUTIL_H
-#define GPGFRONTEND_CORECOMMONUTIL_H
+#pragma once
#include <string>
@@ -85,5 +84,3 @@ class GPGFRONTEND_CORE_EXPORT CoreCommonUtil : public QObject { };
} // namespace GpgFrontend
-
-#endif // GPGFRONTEND_CORECOMMONUTIL_H
diff --git a/src/core/function/ArchiveFileOperator.h b/src/core/function/ArchiveFileOperator.h index 0531879a..cc74231d 100644 --- a/src/core/function/ArchiveFileOperator.h +++ b/src/core/function/ArchiveFileOperator.h @@ -26,8 +26,7 @@ * */ -#ifndef GPGFRONTEND_ARCHIVEFILEOPERATOR_H -#define GPGFRONTEND_ARCHIVEFILEOPERATOR_H +#pragma once #include "core/GpgFrontendCore.h" #include "core/function/FileOperator.h" @@ -47,5 +46,3 @@ class GPGFRONTEND_CORE_EXPORT ArchiveFileOperator { const std::filesystem::path &base_path); }; } // namespace GpgFrontend - -#endif // GPGFRONTEND_ARCHIVEFILEOPERATOR_H diff --git a/src/core/function/CacheManager.h b/src/core/function/CacheManager.h index 165f4266..9b063a5c 100644 --- a/src/core/function/CacheManager.h +++ b/src/core/function/CacheManager.h @@ -26,9 +26,11 @@ * */ -#ifndef GPGFRONTEND_CACHEMANAGER_H -#define GPGFRONTEND_CACHEMANAGER_H +#pragma once +#include <nlohmann/json.hpp> +#include <optional> +#include <shared_mutex> #include <string> #include "core/GpgFunctionObject.h" @@ -109,5 +111,3 @@ class GPGFRONTEND_CORE_EXPORT CacheManager }; } // namespace GpgFrontend - -#endif diff --git a/src/core/function/CharsetOperator.h b/src/core/function/CharsetOperator.h index a4f64e40..42d6ed4e 100644 --- a/src/core/function/CharsetOperator.h +++ b/src/core/function/CharsetOperator.h @@ -26,8 +26,7 @@ * */ -#ifndef GPGFRONTEND_CHARSETDETECTOR_H -#define GPGFRONTEND_CHARSETDETECTOR_H +#pragma once #include "core/GpgFrontendCore.h" @@ -43,5 +42,3 @@ class GPGFRONTEND_CORE_EXPORT CharsetOperator { std::string from_charset_name); }; } // namespace GpgFrontend - -#endif // GPGFRONTEND_CHARSETDETECTOR_H diff --git a/src/core/function/CoreSignalStation.h b/src/core/function/CoreSignalStation.h index 5fe08591..1a48c14c 100644 --- a/src/core/function/CoreSignalStation.h +++ b/src/core/function/CoreSignalStation.h @@ -26,8 +26,7 @@ * */ -#ifndef GPGFRONTEND_CORESIGNALSTATION_H -#define GPGFRONTEND_CORESIGNALSTATION_H +#pragma once #include "core/GpgFrontendCore.h" @@ -65,5 +64,3 @@ class GPGFRONTEND_CORE_EXPORT CoreSignalStation : public QObject { }; } // namespace GpgFrontend - -#endif // GPGFRONTEND_CORESIGNALSTATION_H diff --git a/src/core/function/DataObjectOperator.h b/src/core/function/DataObjectOperator.h index f02551a8..134d9044 100644 --- a/src/core/function/DataObjectOperator.h +++ b/src/core/function/DataObjectOperator.h @@ -26,8 +26,11 @@ * */ -#ifndef GPGFRONTEND_DATAOBJECTOPERATOR_H -#define GPGFRONTEND_DATAOBJECTOPERATOR_H +#pragma once + +#include <boost/format.hpp> +#include <nlohmann/json.hpp> +#include <optional> #include "core/GpgFunctionObject.h" #include "core/function/GlobalSettingStation.h" @@ -76,5 +79,3 @@ class GPGFRONTEND_CORE_EXPORT DataObjectOperator }; } // namespace GpgFrontend - -#endif // GPGFRONTEND_DATAOBJECTOPERATOR_H diff --git a/src/core/function/FileOperator.h b/src/core/function/FileOperator.h index 3abd975f..53f64e5a 100644 --- a/src/core/function/FileOperator.h +++ b/src/core/function/FileOperator.h @@ -26,8 +26,7 @@ * */ -#ifndef GPGFRONTEND_FILEOPERATOR_H -#define GPGFRONTEND_FILEOPERATOR_H +#pragma once #include "core/GpgFrontendCore.h" @@ -88,5 +87,3 @@ class GPGFRONTEND_CORE_EXPORT FileOperator { static std::string CalculateHash(const std::filesystem::path &file_path); }; } // namespace GpgFrontend - -#endif // GPGFRONTEND_FILEOPERATOR_H diff --git a/src/core/function/GlobalSettingStation.h b/src/core/function/GlobalSettingStation.h index fb71adf8..75c9da3b 100644 --- a/src/core/function/GlobalSettingStation.h +++ b/src/core/function/GlobalSettingStation.h @@ -26,8 +26,9 @@ * */ -#ifndef GPGFRONTEND_GLOBALSETTINGSTATION_H -#define GPGFRONTEND_GLOBALSETTINGSTATION_H +#pragma once + +#include <libconfig.h++> #include "core/GpgFunctionObject.h" @@ -156,5 +157,3 @@ class GPGFRONTEND_CORE_EXPORT GlobalSettingStation std::unique_ptr<Impl> p_; }; } // namespace GpgFrontend - -#endif // GPGFRONTEND_GLOBALSETTINGSTATION_H diff --git a/src/core/function/KeyPackageOperator.cpp b/src/core/function/KeyPackageOperator.cpp index ac49a65e..9494d7e1 100644 --- a/src/core/function/KeyPackageOperator.cpp +++ b/src/core/function/KeyPackageOperator.cpp @@ -28,11 +28,15 @@ #include "KeyPackageOperator.h" -#include "FileOperator.h" -#include "function/PassphraseGenerator.h" -#include "function/gpg/GpgKeyGetter.h" -#include "function/gpg/GpgKeyImportExporter.h" -#include "qt-aes/qaesencryption.h" +#include <qt-aes/qaesencryption.h> + +#include <boost/format.hpp> + +#include "core/function/FileOperator.h" +#include "core/function/KeyPackageOperator.h" +#include "core/function/PassphraseGenerator.h" +#include "core/function/gpg/GpgKeyGetter.h" +#include "core/function/gpg/GpgKeyImportExporter.h" namespace GpgFrontend { @@ -116,4 +120,18 @@ std::string KeyPackageOperator::GenerateKeyPackageName() { return generate_key_package_name(); } +/** + * @brief generate key package name + * + * @return std::string key package name + */ +std::string KeyPackageOperator::generate_key_package_name() { + std::random_device rd_; ///< Random device + auto mt_ = std::mt19937(rd_()); ///< Mersenne twister + + std::uniform_int_distribution<int> dist(999, 99999); + auto file_string = boost::format("KeyPackage_%1%") % dist(mt_); + return file_string.str(); +} + } // namespace GpgFrontend diff --git a/src/core/function/KeyPackageOperator.h b/src/core/function/KeyPackageOperator.h index 4aae4d02..7d194028 100644 --- a/src/core/function/KeyPackageOperator.h +++ b/src/core/function/KeyPackageOperator.h @@ -26,8 +26,7 @@ * */ -#ifndef GPGFRONTEND_KEYPACKAGEOPERATOR_H -#define GPGFRONTEND_KEYPACKAGEOPERATOR_H +#pragma once #include "core/GpgFrontendCore.h" #include "core/function/gpg/GpgKeyImportExporter.h" @@ -93,15 +92,6 @@ class GPGFRONTEND_CORE_EXPORT KeyPackageOperator { * * @return std::string key package name */ - static std::string generate_key_package_name() { - std::random_device rd_; ///< Random device - auto mt_ = std::mt19937(rd_()); ///< Mersenne twister - - std::uniform_int_distribution<int> dist(999, 99999); - auto file_string = boost::format("KeyPackage_%1%") % dist(mt_); - return file_string.str(); - } + static std::string generate_key_package_name(); }; } // namespace GpgFrontend - -#endif // GPGFRONTEND_KEYPACKAGEOPERATOR_H diff --git a/src/core/function/PassphraseGenerator.cpp b/src/core/function/PassphraseGenerator.cpp index 84ca8e8c..261f1606 100644 --- a/src/core/function/PassphraseGenerator.cpp +++ b/src/core/function/PassphraseGenerator.cpp @@ -27,3 +27,25 @@ */ #include "PassphraseGenerator.h" + +#include <boost/format.hpp> + +namespace GpgFrontend { + +std::string PassphraseGenerator::Generate(int len) { + std::uniform_int_distribution<int> dist(999, 99999); + + auto file_string = boost::format("KeyPackage_%1%") % dist(mt_); + static const char alphanum[] = + "0123456789" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz"; + std::string tmp_str; + tmp_str.reserve(len); + + for (int i = 0; i < len; ++i) { + tmp_str += alphanum[dist(mt_) % (sizeof(alphanum) - 1)]; + } + return tmp_str; +} +} // namespace GpgFrontend
\ No newline at end of file diff --git a/src/core/function/PassphraseGenerator.h b/src/core/function/PassphraseGenerator.h index 8c0a63eb..dcbc83f5 100644 --- a/src/core/function/PassphraseGenerator.h +++ b/src/core/function/PassphraseGenerator.h @@ -26,8 +26,7 @@ * */ -#ifndef GPGFRONTEND_PASSPHRASEGENERATOR_H -#define GPGFRONTEND_PASSPHRASEGENERATOR_H +#pragma once #include "core/GpgFrontendCore.h" #include "core/GpgFunctionObject.h" @@ -57,27 +56,10 @@ class GPGFRONTEND_CORE_EXPORT PassphraseGenerator * @param len length of the passphrase * @return std::string passphrase */ - std::string Generate(int len) { - std::uniform_int_distribution<int> dist(999, 99999); - - auto file_string = boost::format("KeyPackage_%1%") % dist(mt_); - static const char alphanum[] = - "0123456789" - "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "abcdefghijklmnopqrstuvwxyz"; - std::string tmp_str; - tmp_str.reserve(len); - - for (int i = 0; i < len; ++i) { - tmp_str += alphanum[dist(mt_) % (sizeof(alphanum) - 1)]; - } - return tmp_str; - } + std::string Generate(int len); std::random_device rd_; ///< Random device std::mt19937 mt_ = std::mt19937(rd_()); ///< Mersenne twister }; } // namespace GpgFrontend - -#endif // GPGFRONTEND_PASSPHRASEGENERATOR_H diff --git a/src/core/function/aes/aes_ssl.h b/src/core/function/aes/aes_ssl.h index 064b0791..5c3ac935 100644 --- a/src/core/function/aes/aes_ssl.h +++ b/src/core/function/aes/aes_ssl.h @@ -26,8 +26,7 @@ * */ -#ifndef GPGFRONTEND_AES_SSL_H -#define GPGFRONTEND_AES_SSL_H +#pragma once #include <openssl/aes.h> #include <openssl/evp.h> @@ -70,5 +69,3 @@ uint8_t *aes_256_cbc_encrypt(EVP_CIPHER_CTX *e, uint8_t *plaintext, int *len); uint8_t *aes_256_cbc_decrypt(EVP_CIPHER_CTX *e, uint8_t *ciphertext, int *len); } // namespace GpgFrontend::RawAPI - -#endif // GPGFRONTEND_AES_SSL_H diff --git a/src/core/function/gpg/GpgAdvancedOperator.h b/src/core/function/gpg/GpgAdvancedOperator.h index d5a65809..959764ed 100644 --- a/src/core/function/gpg/GpgAdvancedOperator.h +++ b/src/core/function/gpg/GpgAdvancedOperator.h @@ -30,8 +30,7 @@ // Created by eric on 07.01.2023. // -#ifndef GPGFRONTEND_GPGADVANCEDOPERATOR_H -#define GPGFRONTEND_GPGADVANCEDOPERATOR_H +#pragma once #include "core/GpgConstants.h" #include "core/GpgContext.h" @@ -112,5 +111,3 @@ class GPGFRONTEND_CORE_EXPORT GpgAdvancedOperator }; } // namespace GpgFrontend - -#endif // GPGFRONTEND_GPGADVANCEDOPERATOR_H diff --git a/src/core/function/gpg/GpgBasicOperator.h b/src/core/function/gpg/GpgBasicOperator.h index f1489413..4a762e9b 100644 --- a/src/core/function/gpg/GpgBasicOperator.h +++ b/src/core/function/gpg/GpgBasicOperator.h @@ -26,8 +26,7 @@ * */ -#ifndef GPGFRONTEND_ZH_CN_TS_BASICOPERATOR_H -#define GPGFRONTEND_ZH_CN_TS_BASICOPERATOR_H +#pragma once #include "core/GpgConstants.h" #include "core/GpgContext.h" @@ -175,5 +174,3 @@ class GPGFRONTEND_CORE_EXPORT GpgBasicOperator SingletonFunctionObject::GetChannel()); ///< Corresponding context }; } // namespace GpgFrontend - -#endif // GPGFRONTEND_ZH_CN_TS_BASICOPERATOR_H diff --git a/src/core/function/gpg/GpgCommandExecutor.cpp b/src/core/function/gpg/GpgCommandExecutor.cpp index 2e453388..c367bd72 100644 --- a/src/core/function/gpg/GpgCommandExecutor.cpp +++ b/src/core/function/gpg/GpgCommandExecutor.cpp @@ -57,10 +57,6 @@ void GpgCommandExecutor::ExecuteSync(ExecuteContext context) { void GpgCommandExecutor::ExecuteConcurrentlyAsync(ExecuteContexts contexts) { for (auto &context : contexts) { auto &cmd = context.cmd; - auto &arguments = context.arguments; - auto &interact_func = context.interact_func; - auto &callback = context.callback; - SPDLOG_INFO("gpg concurrently called cmd {}", cmd); Thread::Task *task = build_task(context); @@ -78,10 +74,6 @@ void GpgCommandExecutor::ExecuteConcurrentlySync( for (auto &context : contexts) { auto &cmd = context.cmd; - auto &arguments = context.arguments; - auto &interact_func = context.interact_func; - auto &callback = context.callback; - SPDLOG_INFO("gpg concurrently called cmd {}", cmd); Thread::Task *task = build_task(context); diff --git a/src/core/function/gpg/GpgCommandExecutor.h b/src/core/function/gpg/GpgCommandExecutor.h index 98167269..f8dc3a9c 100644 --- a/src/core/function/gpg/GpgCommandExecutor.h +++ b/src/core/function/gpg/GpgCommandExecutor.h @@ -26,8 +26,7 @@ * */ -#ifndef GPGFRONTEND_ZH_CN_TS_GPGCOMMANDEXECUTOR_H -#define GPGFRONTEND_ZH_CN_TS_GPGCOMMANDEXECUTOR_H +#pragma once #include <initializer_list> #ifndef WINDOWS @@ -98,5 +97,3 @@ class GPGFRONTEND_CORE_EXPORT GpgCommandExecutor }; } // namespace GpgFrontend - -#endif // GPGFRONTEND_ZH_CN_TS_GPGCOMMANDEXECUTOR_H diff --git a/src/core/function/gpg/GpgFileOpera.h b/src/core/function/gpg/GpgFileOpera.h index 651fae58..f8b01a10 100644 --- a/src/core/function/gpg/GpgFileOpera.h +++ b/src/core/function/gpg/GpgFileOpera.h @@ -26,8 +26,7 @@ * */ -#ifndef GPGFRONTEND_GPGFILEOPERA_H -#define GPGFRONTEND_GPGFILEOPERA_H +#pragma once #include "core/GpgConstants.h" #include "core/GpgContext.h" @@ -149,5 +148,3 @@ class GPGFRONTEND_CORE_EXPORT GpgFileOpera }; } // namespace GpgFrontend - -#endif // GPGFRONTEND_GPGFILEOPERA_H diff --git a/src/core/function/gpg/GpgKeyGetter.h b/src/core/function/gpg/GpgKeyGetter.h index 6f4880e4..f6f6b214 100644 --- a/src/core/function/gpg/GpgKeyGetter.h +++ b/src/core/function/gpg/GpgKeyGetter.h @@ -26,8 +26,7 @@ * */ -#ifndef GPGFRONTEND_ZH_CN_TS_GPGKEYGETTER_H -#define GPGFRONTEND_ZH_CN_TS_GPGKEYGETTER_H +#pragma once #include <mutex> #include <vector> @@ -141,5 +140,3 @@ class GPGFRONTEND_CORE_EXPORT GpgKeyGetter GpgKey get_key_in_cache(const std::string& id); }; } // namespace GpgFrontend - -#endif // GPGFRONTEND_ZH_CN_TS_GPGKEYGETTER_H diff --git a/src/core/function/gpg/GpgKeyImportExporter.h b/src/core/function/gpg/GpgKeyImportExporter.h index 1c1dcac1..946d13b9 100644 --- a/src/core/function/gpg/GpgKeyImportExporter.h +++ b/src/core/function/gpg/GpgKeyImportExporter.h @@ -26,8 +26,7 @@ * */ -#ifndef _GPGKEYIMPORTEXPORTOR_H -#define _GPGKEYIMPORTEXPORTOR_H +#pragma once #include <string> @@ -188,5 +187,3 @@ class GPGFRONTEND_CORE_EXPORT GpgKeyImportExporter }; } // namespace GpgFrontend - -#endif // _GPGKEYIMPORTEXPORTOR_H
\ No newline at end of file diff --git a/src/core/function/gpg/GpgKeyManager.h b/src/core/function/gpg/GpgKeyManager.h index d2c4e4dd..9a23050b 100644 --- a/src/core/function/gpg/GpgKeyManager.h +++ b/src/core/function/gpg/GpgKeyManager.h @@ -26,8 +26,7 @@ * */ -#ifndef GPGFRONTEND_ZH_CN_TS_GPGKEYMANAGER_H -#define GPGFRONTEND_ZH_CN_TS_GPGKEYMANAGER_H +#pragma once #include <functional> #include <string> @@ -149,5 +148,3 @@ class GPGFRONTEND_CORE_EXPORT GpgKeyManager }; } // namespace GpgFrontend - -#endif // GPGFRONTEND_ZH_CN_TS_GPGKEYMANAGER_H diff --git a/src/core/function/gpg/GpgKeyOpera.h b/src/core/function/gpg/GpgKeyOpera.h index ff6d56a1..e7e27754 100644 --- a/src/core/function/gpg/GpgKeyOpera.h +++ b/src/core/function/gpg/GpgKeyOpera.h @@ -26,8 +26,7 @@ * */ -#ifndef _GPGKEYOPERA_H -#define _GPGKEYOPERA_H +#pragma once #include "core/GpgConstants.h" #include "core/GpgContext.h" @@ -131,5 +130,3 @@ class GPGFRONTEND_CORE_EXPORT GpgKeyOpera GpgContext::GetInstance(SingletonFunctionObject::GetChannel()); ///< }; } // namespace GpgFrontend - -#endif // _GPGKEYOPERA_H
\ No newline at end of file diff --git a/src/core/function/gpg/GpgUIDOperator.h b/src/core/function/gpg/GpgUIDOperator.h index 05a6c0df..7d92b843 100644 --- a/src/core/function/gpg/GpgUIDOperator.h +++ b/src/core/function/gpg/GpgUIDOperator.h @@ -26,8 +26,7 @@ * */ -#ifndef GPGFRONTEND_ZH_CN_TS_UIDOPERATOR_H -#define GPGFRONTEND_ZH_CN_TS_UIDOPERATOR_H +#pragma once #include "core/GpgContext.h" #include "core/GpgModel.h" @@ -89,5 +88,3 @@ class GPGFRONTEND_CORE_EXPORT GpgUIDOperator }; } // namespace GpgFrontend - -#endif // GPGFRONTEND_ZH_CN_TS_UIDOPERATOR_H diff --git a/src/core/function/result_analyse/GpgDecryptResultAnalyse.h b/src/core/function/result_analyse/GpgDecryptResultAnalyse.h index 994b8a30..de339ba0 100644 --- a/src/core/function/result_analyse/GpgDecryptResultAnalyse.h +++ b/src/core/function/result_analyse/GpgDecryptResultAnalyse.h @@ -26,8 +26,7 @@ * */ -#ifndef GPGFRONTEND_GPGDECRYPTRESULTANALYSE_H -#define GPGFRONTEND_GPGDECRYPTRESULTANALYSE_H +#pragma once #include "GpgResultAnalyse.h" #include "core/GpgConstants.h" @@ -70,5 +69,3 @@ class GPGFRONTEND_CORE_EXPORT GpgDecryptResultAnalyse }; } // namespace GpgFrontend - -#endif // GPGFRONTEND_GPGDECRYPTRESULTANALYSE_H diff --git a/src/core/function/result_analyse/GpgEncryptResultAnalyse.h b/src/core/function/result_analyse/GpgEncryptResultAnalyse.h index 669203b2..7c976c17 100644 --- a/src/core/function/result_analyse/GpgEncryptResultAnalyse.h +++ b/src/core/function/result_analyse/GpgEncryptResultAnalyse.h @@ -26,8 +26,7 @@ * */ -#ifndef GPGFRONTEND_GPGENCRYPTRESULTANALYSE_H -#define GPGFRONTEND_GPGENCRYPTRESULTANALYSE_H +#pragma once #include "GpgResultAnalyse.h" #include "core/GpgConstants.h" @@ -60,5 +59,3 @@ class GPGFRONTEND_CORE_EXPORT GpgEncryptResultAnalyse GpgEncrResult result_; ///< }; } // namespace GpgFrontend - -#endif // GPGFRONTEND_GPGENCRYPTRESULTANALYSE_H diff --git a/src/core/function/result_analyse/GpgResultAnalyse.h b/src/core/function/result_analyse/GpgResultAnalyse.h index 4ccf2180..d28cb651 100644 --- a/src/core/function/result_analyse/GpgResultAnalyse.h +++ b/src/core/function/result_analyse/GpgResultAnalyse.h @@ -25,8 +25,7 @@ * SPDX-License-Identifier: GPL-3.0-or-later * */ -#ifndef GPGFRONTEND_GPGRESULTANALYSE_H -#define GPGFRONTEND_GPGRESULTANALYSE_H +#pragma once #include <sstream> #include <string> @@ -82,5 +81,3 @@ class GPGFRONTEND_CORE_EXPORT GpgResultAnalyse { }; } // namespace GpgFrontend - -#endif // GPGFRONTEND_GPGRESULTANALYSE_H diff --git a/src/core/function/result_analyse/GpgSignResultAnalyse.h b/src/core/function/result_analyse/GpgSignResultAnalyse.h index 4103931f..549b8563 100644 --- a/src/core/function/result_analyse/GpgSignResultAnalyse.h +++ b/src/core/function/result_analyse/GpgSignResultAnalyse.h @@ -26,8 +26,7 @@ * */ -#ifndef GPGFRONTEND_GPGSIGNRESULTANALYSE_H -#define GPGFRONTEND_GPGSIGNRESULTANALYSE_H +#pragma once #include "GpgResultAnalyse.h" @@ -61,5 +60,3 @@ class GPGFRONTEND_CORE_EXPORT GpgSignResultAnalyse : public GpgResultAnalyse { }; } // namespace GpgFrontend - -#endif // GPGFRONTEND_GPGSIGNRESULTANALYSE_H diff --git a/src/core/function/result_analyse/GpgVerifyResultAnalyse.h b/src/core/function/result_analyse/GpgVerifyResultAnalyse.h index bfe5e171..c9e7b689 100644 --- a/src/core/function/result_analyse/GpgVerifyResultAnalyse.h +++ b/src/core/function/result_analyse/GpgVerifyResultAnalyse.h @@ -26,8 +26,7 @@ * */ -#ifndef GPGFRONTEND_GPGVERIFYRESULTANALYSE_H -#define GPGFRONTEND_GPGVERIFYRESULTANALYSE_H +#pragma once #include "GpgResultAnalyse.h" #include "core/model/GpgKeySignature.h" @@ -84,5 +83,3 @@ class GPGFRONTEND_CORE_EXPORT GpgVerifyResultAnalyse : public GpgResultAnalyse { }; } // namespace GpgFrontend - -#endif // GPGFRONTEND_GPGVERIFYRESULTANALYSE_H diff --git a/src/core/model/GpgData.h b/src/core/model/GpgData.h index 8d2c1e52..a4b58638 100644 --- a/src/core/model/GpgData.h +++ b/src/core/model/GpgData.h @@ -26,8 +26,7 @@ * */ -#ifndef _GPGDATA_H -#define _GPGDATA_H +#pragma once #include "core/GpgConstants.h" @@ -83,5 +82,3 @@ class GpgData { }; } // namespace GpgFrontend - -#endif // _GPGDATA_H
\ No newline at end of file diff --git a/src/core/model/GpgKey.h b/src/core/model/GpgKey.h index fe34ec56..0d455f2e 100644 --- a/src/core/model/GpgKey.h +++ b/src/core/model/GpgKey.h @@ -26,8 +26,7 @@ * */ -#ifndef GPGFRONTEND_GPGKEY_H -#define GPGFRONTEND_GPGKEY_H +#pragma once #include <mutex> @@ -367,5 +366,3 @@ class GPGFRONTEND_CORE_EXPORT GpgKey { }; } // namespace GpgFrontend - -#endif // GPGFRONTEND_GPGKEY_H diff --git a/src/core/model/GpgKeySignature.h b/src/core/model/GpgKeySignature.h index 08cdb044..4324d6c6 100644 --- a/src/core/model/GpgKeySignature.h +++ b/src/core/model/GpgKeySignature.h @@ -26,8 +26,7 @@ * */ -#ifndef GPGFRONTEND_GPGKEYSIGNATURE_H -#define GPGFRONTEND_GPGKEYSIGNATURE_H +#pragma once #include <boost/date_time.hpp> #include <string> @@ -195,5 +194,3 @@ class GPGFRONTEND_CORE_EXPORT GpgKeySignature { }; } // namespace GpgFrontend - -#endif // GPGFRONTEND_GPGKEYSIGNATURE_H diff --git a/src/core/model/GpgSignature.h b/src/core/model/GpgSignature.h index cc1ccf79..d34d89ce 100644 --- a/src/core/model/GpgSignature.h +++ b/src/core/model/GpgSignature.h @@ -26,8 +26,7 @@ * */ -#ifndef GPGFRONTEND_GPGSIGNATURE_H -#define GPGFRONTEND_GPGSIGNATURE_H +#pragma once #include <boost/date_time/gregorian/greg_date.hpp> #include <boost/date_time/posix_time/conversion.hpp> @@ -151,5 +150,3 @@ class GPGFRONTEND_CORE_EXPORT GpgSignature { KeySignatrueRefHandler signature_ref_ = nullptr; ///< }; } // namespace GpgFrontend - -#endif // GPGFRONTEND_GPGSIGNATURE_H diff --git a/src/core/model/GpgSubKey.h b/src/core/model/GpgSubKey.h index 4e1568fa..6d7ead84 100644 --- a/src/core/model/GpgSubKey.h +++ b/src/core/model/GpgSubKey.h @@ -26,8 +26,7 @@ * */ -#ifndef GPGFRONTEND_GPGSUBKEY_H -#define GPGFRONTEND_GPGSUBKEY_H +#pragma once #include <boost/date_time.hpp> #include <string> @@ -223,5 +222,3 @@ class GPGFRONTEND_CORE_EXPORT GpgSubKey { }; } // namespace GpgFrontend - -#endif // GPGFRONTEND_GPGSUBKEY_H diff --git a/src/core/model/GpgTOFUInfo.h b/src/core/model/GpgTOFUInfo.h index 88e633e5..f9f6a451 100644 --- a/src/core/model/GpgTOFUInfo.h +++ b/src/core/model/GpgTOFUInfo.h @@ -26,8 +26,7 @@ * */ -#ifndef GPGFRONTEND_GPGTOFU_H -#define GPGFRONTEND_GPGTOFU_H +#pragma once #include "core/GpgConstants.h" @@ -143,5 +142,3 @@ class GPGFRONTEND_CORE_EXPORT GpgTOFUInfo { }; } // namespace GpgFrontend - -#endif // GPGFRONTEND_GPGTOFU_H diff --git a/src/core/model/GpgUID.h b/src/core/model/GpgUID.h index 552a47c9..1d35d993 100644 --- a/src/core/model/GpgUID.h +++ b/src/core/model/GpgUID.h @@ -26,8 +26,7 @@ * */ -#ifndef GPGFRONTEND_GPGUID_H -#define GPGFRONTEND_GPGUID_H +#pragma once #include "GpgKeySignature.h" #include "GpgTOFUInfo.h" @@ -148,5 +147,3 @@ class GPGFRONTEND_CORE_EXPORT GpgUID { }; } // namespace GpgFrontend - -#endif // GPGFRONTEND_GPGUID_H
\ No newline at end of file diff --git a/src/core/module/Event.h b/src/core/module/Event.h index 09514003..4adfc959 100644 --- a/src/core/module/Event.h +++ b/src/core/module/Event.h @@ -28,6 +28,9 @@ #pragma once +#include <any> +#include <optional> + #include "core/GpgFrontendCore.h" namespace GpgFrontend::Module { diff --git a/src/core/module/GlobalModuleContext.cpp b/src/core/module/GlobalModuleContext.cpp index 10c3e549..de1e244b 100644 --- a/src/core/module/GlobalModuleContext.cpp +++ b/src/core/module/GlobalModuleContext.cpp @@ -28,12 +28,10 @@ #include "GlobalModuleContext.h" -#include <boost/format/format_fwd.hpp> -#include <boost/random/mersenne_twister.hpp> -#include <boost/random/uniform_int_distribution.hpp> -#include <memory> -#include <optional> -#include <string> +#include <boost/date_time.hpp> +#include <boost/format.hpp> +#include <boost/random.hpp> +#include <set> #include <unordered_map> #include <unordered_set> @@ -48,11 +46,11 @@ namespace GpgFrontend::Module { class GlobalModuleContext::Impl { public: Impl(TaskRunnerPtr task_runner) - : default_task_runner_(task_runner), - random_gen_( + : random_gen_( (boost::posix_time::microsec_clock::universal_time() - boost::posix_time::ptime(boost::gregorian::date(1970, 1, 1))) - .total_milliseconds()) { + .total_milliseconds()), + default_task_runner_(task_runner) { // Initialize acquired channels with default values. acquired_channel_.insert(GPGFRONTEND_DEFAULT_CHANNEL); acquired_channel_.insert(GPGFRONTEND_NON_ASCII_CHANNEL); diff --git a/src/core/module/GlobalModuleContext.h b/src/core/module/GlobalModuleContext.h index 82ce23c1..e48f186e 100644 --- a/src/core/module/GlobalModuleContext.h +++ b/src/core/module/GlobalModuleContext.h @@ -28,6 +28,8 @@ #pragma once +#include <optional> + #include "core/module/Event.h" #include "core/thread/TaskRunner.h" #include "module/GlobalRegisterTable.h" diff --git a/src/core/module/GlobalRegisterTable.h b/src/core/module/GlobalRegisterTable.h index 787f93b8..f900559e 100644 --- a/src/core/module/GlobalRegisterTable.h +++ b/src/core/module/GlobalRegisterTable.h @@ -28,6 +28,9 @@ #pragma once +#include <any> +#include <optional> + #include "core/GpgFrontendCore.h" namespace GpgFrontend::Module { diff --git a/src/core/module/Module.cpp b/src/core/module/Module.cpp index 71a91cb8..d66773ff 100644 --- a/src/core/module/Module.cpp +++ b/src/core/module/Module.cpp @@ -28,7 +28,7 @@ #include "Module.h" -#include <memory> +#include <boost/format.hpp> #include "core/module/GlobalModuleContext.h" diff --git a/src/core/thread/CtxCheckTask.h b/src/core/thread/CtxCheckTask.h index 2f543f47..f1a443ec 100644 --- a/src/core/thread/CtxCheckTask.h +++ b/src/core/thread/CtxCheckTask.h @@ -26,8 +26,7 @@ * */ -#ifndef GPGFRONTEND_CTXCHECKTRHEAD_H -#define GPGFRONTEND_CTXCHECKTRHEAD_H +#pragma once #include "core/GpgFrontendCore.h" #include "core/thread/Task.h" @@ -61,5 +60,3 @@ class GPGFRONTEND_CORE_EXPORT CtxCheckTask : public Task { void Run() override; }; } // namespace GpgFrontend::Thread - -#endif // GPGFRONTEND_CTXCHECKTRHEAD_H diff --git a/src/core/thread/DataObject.h b/src/core/thread/DataObject.h index af5f0f5f..3676ec7a 100644 --- a/src/core/thread/DataObject.h +++ b/src/core/thread/DataObject.h @@ -28,7 +28,7 @@ #pragma once -#include <stack> +#include <any> #include "core/GpgFrontendCoreExport.h" diff --git a/src/core/thread/FileReadTask.h b/src/core/thread/FileReadTask.h index 7013b8e3..666cc6f3 100644 --- a/src/core/thread/FileReadTask.h +++ b/src/core/thread/FileReadTask.h @@ -26,8 +26,7 @@ * */ -#ifndef GPGFRONTEND_FILEREADTHREAD_H -#define GPGFRONTEND_FILEREADTHREAD_H +#pragma once #include "core/GpgFrontendCore.h" #include "core/thread/Task.h" @@ -63,5 +62,3 @@ class GPGFRONTEND_CORE_EXPORT FileReadTask : public GpgFrontend::Thread::Task { }; } // namespace GpgFrontend::UI - -#endif // GPGFRONTEND_FILEREADTHREAD_H diff --git a/src/core/thread/TaskRunner.h b/src/core/thread/TaskRunner.h index a4f9c98b..b4ff3552 100644 --- a/src/core/thread/TaskRunner.h +++ b/src/core/thread/TaskRunner.h @@ -26,8 +26,7 @@ * */ -#ifndef GPGFRONTEND_TASKRUNNER_H -#define GPGFRONTEND_TASKRUNNER_H +#pragma once #include <vector> @@ -87,5 +86,3 @@ class GPGFRONTEND_CORE_EXPORT TaskRunner : public QObject { std::unique_ptr<Impl> p_; }; } // namespace GpgFrontend::Thread - -#endif // GPGFRONTEND_TASKRUNNER_H
\ No newline at end of file diff --git a/src/core/thread/TaskRunnerGetter.h b/src/core/thread/TaskRunnerGetter.h index 95060267..f6500a5f 100644 --- a/src/core/thread/TaskRunnerGetter.h +++ b/src/core/thread/TaskRunnerGetter.h @@ -26,8 +26,7 @@ * */ -#ifndef GPGFRONTEND_TASKRUNNERGETTER_H -#define GPGFRONTEND_TASKRUNNERGETTER_H +#pragma once #include "core/GpgFrontendCore.h" #include "core/GpgFunctionObject.h" @@ -56,5 +55,3 @@ class GPGFRONTEND_CORE_EXPORT TaskRunnerGetter }; } // namespace GpgFrontend::Thread - -#endif // GPGFRONTEND_TASKRUNNERGETTER_H
\ No newline at end of file diff --git a/src/core/thread/ThreadingModel.h b/src/core/thread/ThreadingModel.h index 08d9d14d..2fcc11c8 100644 --- a/src/core/thread/ThreadingModel.h +++ b/src/core/thread/ThreadingModel.h @@ -26,11 +26,8 @@ * */ -#ifndef GPGFRONTEND_THREADINGMODEL_H -#define GPGFRONTEND_THREADINGMODEL_H +#pragma once #include "core/thread/Task.h" #include "core/thread/TaskRunner.h" #include "core/thread/TaskRunnerGetter.h" - -#endif // GPGFRONTEND_THREADINGMODEL_H
\ No newline at end of file diff --git a/src/module/GpgFrontendModule.h b/src/module/GpgFrontendModule.h index 91deda72..cf7d8557 100644 --- a/src/module/GpgFrontendModule.h +++ b/src/module/GpgFrontendModule.h @@ -26,8 +26,7 @@ * */ -#ifndef GPGFRONTEND_GPGFRONTENDMODULE_H -#define GPGFRONTEND_GPGFRONTENDMODULE_H +#pragma once /** * Project internal dependencies @@ -35,5 +34,3 @@ #include "GpgFrontend.h" #include "GpgFrontendModuleExport.h" #include "core/GpgFrontendCore.h" - -#endif // GPGFRONTEND_GPGFRONTENDMODULE_H
\ No newline at end of file diff --git a/src/module/GpgFrontendModuleInit.h b/src/module/GpgFrontendModuleInit.h index 74c5b020..87d7994c 100644 --- a/src/module/GpgFrontendModuleInit.h +++ b/src/module/GpgFrontendModuleInit.h @@ -26,8 +26,7 @@ * */ -#ifndef GPGFRONTEND_GPGFRONTENDMODULEINIT_H -#define GPGFRONTEND_GPGFRONTENDMODULEINIT_H +#pragma once #include "module/GpgFrontendModule.h" @@ -46,5 +45,3 @@ void GPGFRONTEND_MODULE_EXPORT LoadGpgFrontendModules(); void GPGFRONTEND_MODULE_EXPORT ShutdownGpgFrontendModules(); }; // namespace GpgFrontend::Module - -#endif // GPGFRONTEND_GPGFRONTENDMODULEINIT_H diff --git a/src/module/integrated/version_checking_module/SoftwareVersion.cpp b/src/module/integrated/version_checking_module/SoftwareVersion.cpp index 054ea0c3..f2748946 100644 --- a/src/module/integrated/version_checking_module/SoftwareVersion.cpp +++ b/src/module/integrated/version_checking_module/SoftwareVersion.cpp @@ -28,6 +28,9 @@ #include "SoftwareVersion.h" +#include <boost/algorithm/string.hpp> +#include <boost/lexical_cast.hpp> + namespace GpgFrontend::Module::Integrated::VersionCheckingModule { int VersionCheckingModule::SoftwareVersion::version_compare( diff --git a/src/module/integrated/version_checking_module/SoftwareVersion.h b/src/module/integrated/version_checking_module/SoftwareVersion.h index 2d4fa092..a95c8b20 100644 --- a/src/module/integrated/version_checking_module/SoftwareVersion.h +++ b/src/module/integrated/version_checking_module/SoftwareVersion.h @@ -26,8 +26,7 @@ * */ -#ifndef GPGFRONTEND_MODULE_SOFTWAREVERSION_H -#define GPGFRONTEND_MODULE_SOFTWAREVERSION_H +#pragma once #include <module/sdk/GpgFrontendModuleSDK.h> @@ -84,5 +83,3 @@ struct SoftwareVersion { static int version_compare(const std::string& a, const std::string& b); }; } // namespace GpgFrontend::Module::Integrated::VersionCheckingModule - -#endif // GPGFRONTEND_MODULE_SOFTWAREVERSION_H diff --git a/src/module/integrated/version_checking_module/VersionCheckTask.cpp b/src/module/integrated/version_checking_module/VersionCheckTask.cpp index a2a329f6..f709af68 100644 --- a/src/module/integrated/version_checking_module/VersionCheckTask.cpp +++ b/src/module/integrated/version_checking_module/VersionCheckTask.cpp @@ -31,6 +31,7 @@ #include <QMetaType> #include <QtNetwork> #include <memory> +#include <nlohmann/json.hpp> #include "GpgFrontendBuildInfo.h" diff --git a/src/module/integrated/version_checking_module/VersionCheckTask.h b/src/module/integrated/version_checking_module/VersionCheckTask.h index 253914ba..6258507f 100644 --- a/src/module/integrated/version_checking_module/VersionCheckTask.h +++ b/src/module/integrated/version_checking_module/VersionCheckTask.h @@ -26,8 +26,7 @@ * */ -#ifndef GPGFRONTEND_VERSIONCHECKTHREAD_H -#define GPGFRONTEND_VERSIONCHECKTHREAD_H +#pragma once #include <module/sdk/GpgFrontendModuleSDK.h> @@ -94,5 +93,3 @@ class VersionCheckTask : public Thread::Task { } // namespace GpgFrontend::Module::Integrated::VersionCheckingModule // GpgFrontend::Module::Custom::IntegradedModule::VersionCheckingModule - -#endif // GPGFRONTEND_VERSIONCHECKTHREAD_H diff --git a/src/module/integrated/version_checking_module/VersionCheckingModule.h b/src/module/integrated/version_checking_module/VersionCheckingModule.h index 506f948d..83775541 100644 --- a/src/module/integrated/version_checking_module/VersionCheckingModule.h +++ b/src/module/integrated/version_checking_module/VersionCheckingModule.h @@ -26,8 +26,7 @@ * */ -#ifndef GPGFRONTEND_MODULE_VERSIONCHECKINGMODULE_H -#define GPGFRONTEND_MODULE_VERSIONCHECKINGMODULE_H +#pragma once #include <module/sdk/GpgFrontendModuleSDK.h> @@ -48,5 +47,3 @@ class GPGFRONTEND_MODULE_SDK_EXPORT VersionCheckingModule : public Module { virtual bool Deactive() override; }; } // namespace GpgFrontend::Module::Integrated::VersionCheckingModule - -#endif // GPGFRONTEND_MODULE_VERSIONCHECKINGMODULE_H
\ No newline at end of file diff --git a/src/ui/GpgFrontendApplication.h b/src/ui/GpgFrontendApplication.h index dde63fe5..76bef259 100644 --- a/src/ui/GpgFrontendApplication.h +++ b/src/ui/GpgFrontendApplication.h @@ -28,8 +28,7 @@ #include "ui/GpgFrontendUI.h" -#ifndef GPGFRONTEND_GPGFRONTENDAPPLICATION_H -#define GPGFRONTEND_GPGFRONTENDAPPLICATION_H +#pragma once namespace GpgFrontend::UI { @@ -70,5 +69,3 @@ class GPGFRONTEND_UI_EXPORT GpgFrontendApplication : public QApplication { }; } // namespace GpgFrontend::UI - -#endif // GPGFRONTEND_GPGFRONTENDAPPLICATION_H
\ No newline at end of file diff --git a/src/ui/GpgFrontendUI.h b/src/ui/GpgFrontendUI.h index 3d3d74bb..fbc59a00 100644 --- a/src/ui/GpgFrontendUI.h +++ b/src/ui/GpgFrontendUI.h @@ -37,13 +37,5 @@ * Project internal dependencies */ #include "GpgFrontend.h" -#include "core/GpgFrontendCore.h" #include "core/GpgModel.h" -#include "core/thread/ThreadingModel.h" #include "ui/GpgFrontendUIExport.h" - -/** - * 3rd party dependencies - */ - -#include <qt-aes/qaesencryption.h> diff --git a/src/ui/GpgFrontendUIInit.h b/src/ui/GpgFrontendUIInit.h index 62ca3f0c..947d26e4 100644 --- a/src/ui/GpgFrontendUIInit.h +++ b/src/ui/GpgFrontendUIInit.h @@ -26,8 +26,7 @@ * */ -#ifndef GPGFRONTEND_GPGFRONTENDUIINIT_H -#define GPGFRONTEND_GPGFRONTENDUIINIT_H +#pragma once #include "GpgFrontendUI.h" @@ -40,14 +39,14 @@ namespace GpgFrontend::UI { void GPGFRONTEND_UI_EXPORT InitGpgFrontendUI(QApplication *); /** - * @brief - * + * @brief + * */ void GPGFRONTEND_UI_EXPORT InitUILoggingSystem(); /** - * @brief - * + * @brief + * */ void GPGFRONTEND_UI_EXPORT ShutdownUILoggingSystem(); @@ -57,5 +56,3 @@ void GPGFRONTEND_UI_EXPORT ShutdownUILoggingSystem(); int GPGFRONTEND_UI_EXPORT RunGpgFrontendUI(QApplication *); }; // namespace GpgFrontend::UI - -#endif // GPGFRONTEND_GPGFRONTENDUIINIT_H diff --git a/src/ui/SignalStation.cpp b/src/ui/SignalStation.cpp index a20a7e26..0173ca3d 100644 --- a/src/ui/SignalStation.cpp +++ b/src/ui/SignalStation.cpp @@ -28,7 +28,7 @@ #include "SignalStation.h" -#include "UserInterfaceUtils.h" +#include "ui/UserInterfaceUtils.h" namespace GpgFrontend::UI { diff --git a/src/ui/SignalStation.h b/src/ui/SignalStation.h index 6ba29c41..9fa0e778 100644 --- a/src/ui/SignalStation.h +++ b/src/ui/SignalStation.h @@ -26,8 +26,7 @@ * */ -#ifndef GPGFRONTEND_SIGNALSTATION_H -#define GPGFRONTEND_SIGNALSTATION_H +#pragma once #include "ui/GpgFrontendUI.h" #include "ui/widgets/InfoBoardWidget.h" @@ -106,5 +105,3 @@ class SignalStation : public QObject { }; } // namespace GpgFrontend::UI - -#endif // GPGFRONTEND_SIGNALSTATION_H diff --git a/src/ui/UserInterfaceUtils.h b/src/ui/UserInterfaceUtils.h index e54cee59..7031a480 100644 --- a/src/ui/UserInterfaceUtils.h +++ b/src/ui/UserInterfaceUtils.h @@ -26,12 +26,12 @@ * */ -#ifndef GPGFRONTEND_USER_INTERFACE_UTILS_H -#define GPGFRONTEND_USER_INTERFACE_UTILS_H +#pragma once #include "core/GpgModel.h" #include "core/function/result_analyse/GpgVerifyResultAnalyse.h" #include "core/model/GpgKey.h" +#include "core/thread/ThreadingModel.h" #include "ui/GpgFrontendUI.h" namespace GpgFrontend { @@ -292,5 +292,3 @@ class CommonUtils : public QWidget { }; } // namespace GpgFrontend::UI - -#endif // GPGFRONTEND_USER_INTERFACE_UTILS_H diff --git a/src/ui/dialog/GeneralDialog.h b/src/ui/dialog/GeneralDialog.h index 91c3e55f..741b6109 100644 --- a/src/ui/dialog/GeneralDialog.h +++ b/src/ui/dialog/GeneralDialog.h @@ -26,8 +26,7 @@ * */ -#ifndef GPGFRONTEND_GENERALDIALOG_H -#define GPGFRONTEND_GENERALDIALOG_H +#pragma once #include "ui/GpgFrontendUI.h" @@ -94,5 +93,3 @@ class GeneralDialog : public QDialog { bool rect_restored_ = false; }; } // namespace GpgFrontend::UI - -#endif // GPGFRONTEND_GENERALDIALOG_H diff --git a/src/ui/dialog/QuitDialog.h b/src/ui/dialog/QuitDialog.h index 6185a3b7..f6477e4e 100755 --- a/src/ui/dialog/QuitDialog.h +++ b/src/ui/dialog/QuitDialog.h @@ -26,8 +26,7 @@ * */ -#ifndef __QUITDIALOG_H__ -#define __QUITDIALOG_H__ +#pragma once #include "ui/GpgFrontendUI.h" #include "ui/dialog/GeneralDialog.h" @@ -79,5 +78,3 @@ class QuitDialog : public GeneralDialog { }; } // namespace GpgFrontend::UI - -#endif // __QUITDIALOG_H__ diff --git a/src/ui/dialog/SignersPicker.h b/src/ui/dialog/SignersPicker.h index a5e7c0b0..034bf4ab 100644 --- a/src/ui/dialog/SignersPicker.h +++ b/src/ui/dialog/SignersPicker.h @@ -26,8 +26,7 @@ * */ -#ifndef GPGFRONTEND_ZH_CN_TS_SIGNERSPIRCKER_H -#define GPGFRONTEND_ZH_CN_TS_SIGNERSPIRCKER_H +#pragma once #include "GpgFrontendUI.h" #include "ui/dialog//GeneralDialog.h" @@ -70,5 +69,3 @@ class SignersPicker : public GeneralDialog { }; } // namespace GpgFrontend::UI - -#endif // GPGFRONTEND_ZH_CN_TS_SIGNERSPIRCKER_H diff --git a/src/ui/dialog/WaitingDialog.h b/src/ui/dialog/WaitingDialog.h index 47f88961..d042c215 100644 --- a/src/ui/dialog/WaitingDialog.h +++ b/src/ui/dialog/WaitingDialog.h @@ -26,8 +26,7 @@ * */ -#ifndef __UI_WAITING_DIALOG_H__ -#define __UI_WAITING_DIALOG_H__ +#pragma once #include "ui/GpgFrontendUI.h" #include "ui/dialog/GeneralDialog.h" @@ -51,5 +50,3 @@ class WaitingDialog : public GeneralDialog { }; } // namespace GpgFrontend::UI - -#endif // __UI_WAITING_DIALOG_H__ diff --git a/src/ui/dialog/Wizard.h b/src/ui/dialog/Wizard.h index d55f66ac..fbc33d5e 100644 --- a/src/ui/dialog/Wizard.h +++ b/src/ui/dialog/Wizard.h @@ -26,8 +26,7 @@ * */ -#ifndef WIZARD_H -#define WIZARD_H +#pragma once #include "core/GpgConstants.h" #include "main_window/KeyMgmt.h" @@ -185,5 +184,3 @@ class ConclusionPage : public QWizardPage { }; } // namespace GpgFrontend::UI - -#endif diff --git a/src/ui/dialog/details/SignatureDetailsDialog.h b/src/ui/dialog/details/SignatureDetailsDialog.h index 54aaa006..405c11dd 100644 --- a/src/ui/dialog/details/SignatureDetailsDialog.h +++ b/src/ui/dialog/details/SignatureDetailsDialog.h @@ -26,8 +26,7 @@ * */ -#ifndef GPGFRONTEND_SIGNATUREDETAILSDIALOG_H -#define GPGFRONTEND_SIGNATUREDETAILSDIALOG_H +#pragma once #include "ui/GpgFrontendUI.h" @@ -35,5 +34,3 @@ class SignatureDetailsDialog : public QDialog { Q_OBJECT public: }; - -#endif // GPGFRONTEND_SIGNATUREDETAILSDIALOG_H diff --git a/src/ui/dialog/details/VerifyDetailsDialog.h b/src/ui/dialog/details/VerifyDetailsDialog.h index f38a8db6..d1514981 100644 --- a/src/ui/dialog/details/VerifyDetailsDialog.h +++ b/src/ui/dialog/details/VerifyDetailsDialog.h @@ -26,8 +26,7 @@ * */ -#ifndef __VERIFYDETAILSDIALOG_H__ -#define __VERIFYDETAILSDIALOG_H__ +#pragma once #include "ui/GpgFrontendUI.h" #include "ui/widgets/PlainTextEditorPage.h" @@ -70,5 +69,3 @@ class VerifyDetailsDialog : public QDialog { }; } // namespace GpgFrontend::UI - -#endif // __VERIFYDETAILSDIALOG_H__ diff --git a/src/ui/dialog/gnupg/GnuPGControllerDialog.h b/src/ui/dialog/gnupg/GnuPGControllerDialog.h index c6273211..d437550c 100644 --- a/src/ui/dialog/gnupg/GnuPGControllerDialog.h +++ b/src/ui/dialog/gnupg/GnuPGControllerDialog.h @@ -26,10 +26,10 @@ * */ -#ifndef GPGFRONTEND_GNUPGCONTROLLERDIALOGLOG_H -#define GPGFRONTEND_GNUPGCONTROLLERDIALOGLOG_H +#pragma once #include <string> + #include "ui/GpgFrontendUI.h" #include "ui/dialog/GeneralDialog.h" @@ -105,5 +105,3 @@ class GnuPGControllerDialog : public GeneralDialog { bool check_custom_gnupg_key_database_path(std::string); }; } // namespace GpgFrontend::UI - -#endif // GPGFRONTEND_GNUPGCONTROLLERDIALOGLOG_H diff --git a/src/ui/dialog/help/AboutDialog.h b/src/ui/dialog/help/AboutDialog.h index 0dedd774..0caaf64b 100644 --- a/src/ui/dialog/help/AboutDialog.h +++ b/src/ui/dialog/help/AboutDialog.h @@ -26,8 +26,7 @@ * */ -#ifndef __ABOUTDIALOG_H__ -#define __ABOUTDIALOG_H__ +#pragma once #include "core/GpgContext.h" #include "ui/GpgFrontendUI.h" @@ -141,5 +140,3 @@ class AboutDialog : public GeneralDialog { }; } // namespace GpgFrontend::UI - -#endif // __ABOUTDIALOG_H__ diff --git a/src/ui/dialog/help/GnupgTab.h b/src/ui/dialog/help/GnupgTab.h index db759613..f43857e3 100644 --- a/src/ui/dialog/help/GnupgTab.h +++ b/src/ui/dialog/help/GnupgTab.h @@ -30,8 +30,7 @@ // Created by eric on 2022/7/23. // -#ifndef GPGFRONTEND_GNUPGTAB_H -#define GPGFRONTEND_GNUPGTAB_H +#pragma once #include "core/GpgContext.h" #include "ui/GpgFrontendUI.h" @@ -54,5 +53,3 @@ class GnupgTab : public QWidget { void process_software_info(); }; } // namespace GpgFrontend::UI - -#endif // GPGFRONTEND_GNUPGTAB_H diff --git a/src/ui/dialog/import_export/ExportKeyPackageDialog.h b/src/ui/dialog/import_export/ExportKeyPackageDialog.h index b61cc1c4..0b99f530 100644 --- a/src/ui/dialog/import_export/ExportKeyPackageDialog.h +++ b/src/ui/dialog/import_export/ExportKeyPackageDialog.h @@ -26,8 +26,7 @@ * */ -#ifndef GPGFRONTEND_EXPORTKEYPACKAGEDIALOG_H -#define GPGFRONTEND_EXPORTKEYPACKAGEDIALOG_H +#pragma once #include "GpgFrontendUI.h" #include "ui/dialog/GeneralDialog.h" @@ -58,5 +57,3 @@ class ExportKeyPackageDialog : public GeneralDialog { std::string passphrase_; ///< }; } // namespace GpgFrontend::UI - -#endif // GPGFRONTEND_EXPORTKEYPACKAGEDIALOG_H diff --git a/src/ui/dialog/import_export/KeyImportDetailDialog.h b/src/ui/dialog/import_export/KeyImportDetailDialog.h index f69002fe..ba2f3054 100644 --- a/src/ui/dialog/import_export/KeyImportDetailDialog.h +++ b/src/ui/dialog/import_export/KeyImportDetailDialog.h @@ -26,8 +26,7 @@ * */ -#ifndef __KEYIMPORTDETAILSDIALOG_H__ -#define __KEYIMPORTDETAILSDIALOG_H__ +#pragma once #include "core/GpgContext.h" #include "core/function/gpg/GpgKeyImportExporter.h" @@ -88,5 +87,3 @@ class KeyImportDetailDialog : public GeneralDialog { GpgImportInformation m_result_; ///< }; } // namespace GpgFrontend::UI - -#endif // __KEYIMPORTDETAILSDIALOG_H__ diff --git a/src/ui/dialog/import_export/KeyServerImportDialog.h b/src/ui/dialog/import_export/KeyServerImportDialog.h index c5719403..9085e55d 100644 --- a/src/ui/dialog/import_export/KeyServerImportDialog.h +++ b/src/ui/dialog/import_export/KeyServerImportDialog.h @@ -26,8 +26,7 @@ * */ -#ifndef __KEY_SERVER_IMPORT_DIALOG_H__ -#define __KEY_SERVER_IMPORT_DIALOG_H__ +#pragma once #include <QtNetwork> #include <string> @@ -179,5 +178,3 @@ class KeyServerImportDialog : public GeneralDialog { }; } // namespace GpgFrontend::UI - -#endif // __KEY_SERVER_IMPORT_DIALOG_H__ diff --git a/src/ui/dialog/import_export/KeyUploadDialog.h b/src/ui/dialog/import_export/KeyUploadDialog.h index fccf37e7..fe98222e 100644 --- a/src/ui/dialog/import_export/KeyUploadDialog.h +++ b/src/ui/dialog/import_export/KeyUploadDialog.h @@ -26,8 +26,7 @@ * */ -#ifndef GPGFRONTEND_KEYUPLOADWIDGET_H -#define GPGFRONTEND_KEYUPLOADWIDGET_H +#pragma once #include "core/GpgContext.h" #include "ui/GpgFrontendUI.h" @@ -79,5 +78,3 @@ class KeyUploadDialog : public GeneralDialog { }; } // namespace GpgFrontend::UI - -#endif // GPGFRONTEND_KEYUPLOADWIDGET_H diff --git a/src/ui/dialog/key_generate/KeygenDialog.h b/src/ui/dialog/key_generate/KeygenDialog.h index b59a1152..5ddedd96 100644 --- a/src/ui/dialog/key_generate/KeygenDialog.h +++ b/src/ui/dialog/key_generate/KeygenDialog.h @@ -26,8 +26,7 @@ * */ -#ifndef __KEYGENDIALOG_H__ -#define __KEYGENDIALOG_H__ +#pragma once #include "core/GpgContext.h" #include "core/GpgGenKeyInfo.h" @@ -184,5 +183,3 @@ class KeyGenDialog : public GeneralDialog { }; } // namespace GpgFrontend::UI - -#endif // __KEYGENDIALOG_H__ diff --git a/src/ui/dialog/key_generate/SubkeyGenerateDialog.h b/src/ui/dialog/key_generate/SubkeyGenerateDialog.h index d7e22833..cefc4b53 100644 --- a/src/ui/dialog/key_generate/SubkeyGenerateDialog.h +++ b/src/ui/dialog/key_generate/SubkeyGenerateDialog.h @@ -26,8 +26,7 @@ * */ -#ifndef GPGFRONTEND_SUBKEYGENERATEDIALOG_H -#define GPGFRONTEND_SUBKEYGENERATEDIALOG_H +#pragma once #include "core/GpgContext.h" #include "core/GpgGenKeyInfo.h" @@ -153,5 +152,3 @@ class SubkeyGenerateDialog : public GeneralDialog { }; } // namespace GpgFrontend::UI - -#endif // GPGFRONTEND_SUBKEYGENERATEDIALOG_H diff --git a/src/ui/dialog/keypair_details/KeyDetailsDialog.h b/src/ui/dialog/keypair_details/KeyDetailsDialog.h index 9bf7528b..9b6605f5 100644 --- a/src/ui/dialog/keypair_details/KeyDetailsDialog.h +++ b/src/ui/dialog/keypair_details/KeyDetailsDialog.h @@ -26,8 +26,7 @@ * */ -#ifndef __KEYDETAILSDIALOG_H__ -#define __KEYDETAILSDIALOG_H__ +#pragma once #include "core/GpgContext.h" #include "ui/GpgFrontendUI.h" @@ -45,5 +44,3 @@ class KeyDetailsDialog : public GeneralDialog { QTabWidget* tab_widget_{}; }; } // namespace GpgFrontend::UI - -#endif // __KEYDETAILSDIALOG_H__ diff --git a/src/ui/dialog/keypair_details/KeyNewUIDDialog.h b/src/ui/dialog/keypair_details/KeyNewUIDDialog.h index d03a21ea..6a8c8bca 100644 --- a/src/ui/dialog/keypair_details/KeyNewUIDDialog.h +++ b/src/ui/dialog/keypair_details/KeyNewUIDDialog.h @@ -26,8 +26,7 @@ * */ -#ifndef GPGFRONTEND_KEYNEWUIDDIALOG_H -#define GPGFRONTEND_KEYNEWUIDDIALOG_H +#pragma once #include "core/GpgContext.h" #include "ui/GpgFrontendUI.h" @@ -86,5 +85,3 @@ class KeyNewUIDDialog : public GeneralDialog { bool check_email_address(const QString& str); }; } // namespace GpgFrontend::UI - -#endif // GPGFRONTEND_KEYNEWUIDDIALOG_H diff --git a/src/ui/dialog/keypair_details/KeyPairDetailTab.h b/src/ui/dialog/keypair_details/KeyPairDetailTab.h index 97c9efa3..66323ecc 100644 --- a/src/ui/dialog/keypair_details/KeyPairDetailTab.h +++ b/src/ui/dialog/keypair_details/KeyPairDetailTab.h @@ -26,8 +26,7 @@ * */ -#ifndef GPGFRONTEND_KEYPAIRDETAILTAB_H -#define GPGFRONTEND_KEYPAIRDETAILTAB_H +#pragma once #include "KeySetExpireDateDialog.h" #include "core/GpgContext.h" @@ -98,5 +97,3 @@ class KeyPairDetailTab : public QWidget { }; } // namespace GpgFrontend::UI - -#endif // GPGFRONTEND_KEYPAIRDETAILTAB_H diff --git a/src/ui/dialog/keypair_details/KeyPairOperaTab.h b/src/ui/dialog/keypair_details/KeyPairOperaTab.h index d567a02c..1533bf7c 100644 --- a/src/ui/dialog/keypair_details/KeyPairOperaTab.h +++ b/src/ui/dialog/keypair_details/KeyPairOperaTab.h @@ -26,8 +26,7 @@ * */ -#ifndef GPGFRONTEND_KEYPAIROPERATAB_H -#define GPGFRONTEND_KEYPAIROPERATAB_H +#pragma once #include "core/function/gpg/GpgKeyGetter.h" #include "ui/GpgFrontendUI.h" @@ -124,5 +123,3 @@ class KeyPairOperaTab : public QWidget { QMenu* secret_key_export_opera_menu_{}; ///< }; } // namespace GpgFrontend::UI - -#endif // GPGFRONTEND_KEYPAIROPERATAB_H diff --git a/src/ui/dialog/keypair_details/KeyPairSubkeyTab.h b/src/ui/dialog/keypair_details/KeyPairSubkeyTab.h index 35a37dd8..63a65278 100644 --- a/src/ui/dialog/keypair_details/KeyPairSubkeyTab.h +++ b/src/ui/dialog/keypair_details/KeyPairSubkeyTab.h @@ -26,8 +26,7 @@ * */ -#ifndef GPGFRONTEND_KEYPAIRSUBKEYTAB_H -#define GPGFRONTEND_KEYPAIRSUBKEYTAB_H +#pragma once #include "KeySetExpireDateDialog.h" #include "core/GpgContext.h" @@ -135,5 +134,3 @@ class KeyPairSubkeyTab : public QWidget { }; } // namespace GpgFrontend::UI - -#endif // GPGFRONTEND_KEYPAIRSUBKEYTAB_H diff --git a/src/ui/dialog/keypair_details/KeyPairUIDTab.h b/src/ui/dialog/keypair_details/KeyPairUIDTab.h index 19833526..6492d053 100644 --- a/src/ui/dialog/keypair_details/KeyPairUIDTab.h +++ b/src/ui/dialog/keypair_details/KeyPairUIDTab.h @@ -26,8 +26,7 @@ * */ -#ifndef GPGFRONTEND_KEYPAIRUIDTAB_H -#define GPGFRONTEND_KEYPAIRUIDTAB_H +#pragma once #include "KeyNewUIDDialog.h" #include "KeyUIDSignDialog.h" @@ -203,5 +202,3 @@ class KeyPairUIDTab : public QWidget { }; } // namespace GpgFrontend::UI - -#endif // GPGFRONTEND_KEYPAIRUIDTAB_H diff --git a/src/ui/dialog/keypair_details/KeySetExpireDateDialog.h b/src/ui/dialog/keypair_details/KeySetExpireDateDialog.h index 16df7cdf..433da21a 100644 --- a/src/ui/dialog/keypair_details/KeySetExpireDateDialog.h +++ b/src/ui/dialog/keypair_details/KeySetExpireDateDialog.h @@ -26,8 +26,7 @@ * */ -#ifndef GPGFRONTEND_KEYSETEXPIREDATEDIALOG_H -#define GPGFRONTEND_KEYSETEXPIREDATEDIALOG_H +#pragma once #include "core/GpgContext.h" #include "core/model/GpgKey.h" @@ -95,5 +94,3 @@ class KeySetExpireDateDialog : public GeneralDialog { }; } // namespace GpgFrontend::UI - -#endif // GPGFRONTEND_KEYSETEXPIREDATEDIALOG_H diff --git a/src/ui/dialog/keypair_details/KeyUIDSignDialog.h b/src/ui/dialog/keypair_details/KeyUIDSignDialog.h index 80ca002f..52ae841f 100644 --- a/src/ui/dialog/keypair_details/KeyUIDSignDialog.h +++ b/src/ui/dialog/keypair_details/KeyUIDSignDialog.h @@ -26,8 +26,7 @@ * */ -#ifndef GPGFRONTEND_KEYUIDSIGNDIALOG_H -#define GPGFRONTEND_KEYUIDSIGNDIALOG_H +#pragma once #include "core/GpgContext.h" #include "ui/GpgFrontendUI.h" @@ -76,5 +75,3 @@ class KeyUIDSignDialog : public GeneralDialog { }; } // namespace GpgFrontend::UI - -#endif // GPGFRONTEND_KEYUIDSIGNDIALOG_H diff --git a/src/ui/dialog/settings/SettingsAdvanced.h b/src/ui/dialog/settings/SettingsAdvanced.h index 9bf6f2bf..1f7efbb2 100644 --- a/src/ui/dialog/settings/SettingsAdvanced.h +++ b/src/ui/dialog/settings/SettingsAdvanced.h @@ -26,8 +26,7 @@ * */ -#ifndef GPGFRONTEND_SETTINGSADVANCED_H -#define GPGFRONTEND_SETTINGSADVANCED_H +#pragma once #include "ui/GpgFrontendUI.h" @@ -51,5 +50,3 @@ class AdvancedTab : public QWidget { void SignalRestartNeeded(bool needed); }; } // namespace GpgFrontend::UI - -#endif // GPGFRONTEND_SETTINGSADVANCED_H diff --git a/src/ui/dialog/settings/SettingsAppearance.h b/src/ui/dialog/settings/SettingsAppearance.h index 3afb4c3b..6d426934 100644 --- a/src/ui/dialog/settings/SettingsAppearance.h +++ b/src/ui/dialog/settings/SettingsAppearance.h @@ -26,8 +26,7 @@ * */ -#ifndef GPGFRONTEND_SETTINGSAPPEARANCE_H -#define GPGFRONTEND_SETTINGSAPPEARANCE_H +#pragma once #include "ui/GpgFrontendUI.h" @@ -61,7 +60,7 @@ class AppearanceTab : public QWidget { private: std::shared_ptr<Ui_AppearanceSettings> ui_; ///< - QButtonGroup* icon_style_group_; ///< + QButtonGroup* icon_style_group_; ///< QButtonGroup* icon_size_group_; signals: @@ -75,5 +74,3 @@ class AppearanceTab : public QWidget { }; } // namespace GpgFrontend::UI - -#endif // GPGFRONTEND_SETTINGSAPPEARANCE_H diff --git a/src/ui/dialog/settings/SettingsDialog.h b/src/ui/dialog/settings/SettingsDialog.h index 0a5e6a0e..e59cd611 100644 --- a/src/ui/dialog/settings/SettingsDialog.h +++ b/src/ui/dialog/settings/SettingsDialog.h @@ -26,8 +26,7 @@ * */ -#ifndef __SETTINGSDIALOG_H__ -#define __SETTINGSDIALOG_H__ +#pragma once #include "ui/GpgFrontendUI.h" #include "ui/dialog/GeneralDialog.h" @@ -108,5 +107,3 @@ class SettingsDialog : public GeneralDialog { }; } // namespace GpgFrontend::UI - -#endif // __SETTINGSDIALOG_H__ diff --git a/src/ui/dialog/settings/SettingsGeneral.cpp b/src/ui/dialog/settings/SettingsGeneral.cpp index 08d45adf..179ceaee 100644 --- a/src/ui/dialog/settings/SettingsGeneral.cpp +++ b/src/ui/dialog/settings/SettingsGeneral.cpp @@ -34,6 +34,8 @@ #include "SettingsDialog.h" #endif +#include <boost/format.hpp> + #include "core/function/GlobalSettingStation.h" #include "ui_GeneralSettings.h" diff --git a/src/ui/dialog/settings/SettingsGeneral.h b/src/ui/dialog/settings/SettingsGeneral.h index 8164c900..da2ca864 100644 --- a/src/ui/dialog/settings/SettingsGeneral.h +++ b/src/ui/dialog/settings/SettingsGeneral.h @@ -26,8 +26,7 @@ * */ -#ifndef GPGFRONTEND_SETTINGSGENERAL_H -#define GPGFRONTEND_SETTINGSGENERAL_H +#pragma once #include "ui/GpgFrontendUI.h" @@ -101,5 +100,3 @@ class GeneralTab : public QWidget { #endif }; } // namespace GpgFrontend::UI - -#endif // GPGFRONTEND_SETTINGSGENERAL_H diff --git a/src/ui/dialog/settings/SettingsKeyServer.h b/src/ui/dialog/settings/SettingsKeyServer.h index 3232e6d0..ae5a3181 100644 --- a/src/ui/dialog/settings/SettingsKeyServer.h +++ b/src/ui/dialog/settings/SettingsKeyServer.h @@ -26,8 +26,7 @@ * */ -#ifndef GPGFRONTEND_SETTINGSKEYSERVER_H -#define GPGFRONTEND_SETTINGSKEYSERVER_H +#pragma once #include "ui/GpgFrontendUI.h" @@ -107,5 +106,3 @@ class KeyserverTab : public QWidget { void contextMenuEvent(QContextMenuEvent* event) override; }; } // namespace GpgFrontend::UI - -#endif // GPGFRONTEND_SETTINGSKEYSERVER_H diff --git a/src/ui/dialog/settings/SettingsNetwork.h b/src/ui/dialog/settings/SettingsNetwork.h index 2420cca0..4335dff7 100644 --- a/src/ui/dialog/settings/SettingsNetwork.h +++ b/src/ui/dialog/settings/SettingsNetwork.h @@ -26,8 +26,7 @@ * */ -#ifndef GPGFRONTEND_SETTINGSNETWORK_H -#define GPGFRONTEND_SETTINGSNETWORK_H +#pragma once #include <QtNetwork> @@ -92,5 +91,3 @@ class NetworkTab : public QWidget { void switch_ui_proxy_type(const QString& type_text); }; } // namespace GpgFrontend::UI - -#endif // GPGFRONTEND_SETTINGSNETWORK_H diff --git a/src/ui/main_window/GeneralMainWindow.h b/src/ui/main_window/GeneralMainWindow.h index ac6b8477..f65b0668 100644 --- a/src/ui/main_window/GeneralMainWindow.h +++ b/src/ui/main_window/GeneralMainWindow.h @@ -26,8 +26,7 @@ * */ -#ifndef GPGFRONTEND_GENERALMAINWINDOW_H -#define GPGFRONTEND_GENERALMAINWINDOW_H +#pragma once #include "ui/GpgFrontendUI.h" @@ -77,5 +76,3 @@ class GeneralMainWindow : public QMainWindow { QSize size_; ///< }; } // namespace GpgFrontend::UI - -#endif // GPGFRONTEND_GENERALMAINWINDOW_H diff --git a/src/ui/main_window/KeyMgmt.h b/src/ui/main_window/KeyMgmt.h index dc13734f..bc3f41fa 100644 --- a/src/ui/main_window/KeyMgmt.h +++ b/src/ui/main_window/KeyMgmt.h @@ -26,8 +26,7 @@ * */ -#ifndef __KEYMGMT_H__ -#define __KEYMGMT_H__ +#pragma once #include "ui/GpgFrontendUI.h" #include "ui/dialog/import_export/KeyImportDetailDialog.h" @@ -174,5 +173,3 @@ class KeyMgmt : public GeneralMainWindow { }; } // namespace GpgFrontend::UI - -#endif // __KEYMGMT_H__ diff --git a/src/ui/main_window/MainWindow.h b/src/ui/main_window/MainWindow.h index fb00a8e1..2be70242 100644 --- a/src/ui/main_window/MainWindow.h +++ b/src/ui/main_window/MainWindow.h @@ -26,8 +26,7 @@ * */ -#ifndef __GPGWIN_H__ -#define __GPGWIN_H__ +#pragma once #include "KeyMgmt.h" #include "core/GpgConstants.h" @@ -490,5 +489,3 @@ class MainWindow : public GeneralMainWindow { }; } // namespace GpgFrontend::UI - -#endif // __GPGWIN_H__ diff --git a/src/ui/struct/SettingsObject.h b/src/ui/struct/SettingsObject.h index c9079931..8bda90ea 100644 --- a/src/ui/struct/SettingsObject.h +++ b/src/ui/struct/SettingsObject.h @@ -26,8 +26,7 @@ * */ -#ifndef GPGFRONTEND_SETTINGSOBJECT_H -#define GPGFRONTEND_SETTINGSOBJECT_H +#pragma once #include <utility> @@ -84,5 +83,3 @@ class SettingsObject : public nlohmann::json { std::string settings_name_; ///< }; } // namespace GpgFrontend::UI - -#endif // GPGFRONTEND_SETTINGSOBJECT_H diff --git a/src/ui/struct/SoftwareVersion.h b/src/ui/struct/SoftwareVersion.h index 54a78b5d..d4d9f729 100644 --- a/src/ui/struct/SoftwareVersion.h +++ b/src/ui/struct/SoftwareVersion.h @@ -26,8 +26,7 @@ * */ -#ifndef GPGFRONTEND_SOFTWAREVERSION_H -#define GPGFRONTEND_SOFTWAREVERSION_H +#pragma once #include <boost/date_time.hpp> @@ -84,5 +83,3 @@ struct SoftwareVersion { static int version_compare(const std::string& a, const std::string& b); }; } // namespace GpgFrontend::UI - -#endif // GPGFRONTEND_SOFTWAREVERSION_H diff --git a/src/ui/thread/KeyServerImportTask.h b/src/ui/thread/KeyServerImportTask.h index 6f128375..11ecc42b 100644 --- a/src/ui/thread/KeyServerImportTask.h +++ b/src/ui/thread/KeyServerImportTask.h @@ -26,12 +26,13 @@ * */ -#ifndef GPGFRONTEND_KEYSERVERIMPORTTASK_H -#define GPGFRONTEND_KEYSERVERIMPORTTASK_H +#pragma once -#include <QtNetwork> +#include <qnetworkaccessmanager.h> +#include <qnetworkreply.h> #include "GpgFrontendUI.h" +#include "core/thread/ThreadingModel.h" namespace GpgFrontend::UI { class KeyServerImportTask : public Thread::Task { @@ -80,5 +81,3 @@ class KeyServerImportTask : public Thread::Task { QNetworkReply *reply_; ///< }; } // namespace GpgFrontend::UI - -#endif // GPGFRONTEND_KEYSERVERIMPORTTASK_H
\ No newline at end of file diff --git a/src/ui/thread/KeyServerSearchTask.h b/src/ui/thread/KeyServerSearchTask.h index 953c15a5..746ce7a8 100644 --- a/src/ui/thread/KeyServerSearchTask.h +++ b/src/ui/thread/KeyServerSearchTask.h @@ -26,15 +26,15 @@ * */ -#ifndef GPGFRONTEND_KEYSERVERSEARCHTASK_H -#define GPGFRONTEND_KEYSERVERSEARCHTASK_H +#pragma once -#include <QtNetwork> +#include <qnetworkaccessmanager.h> +#include <qnetworkreply.h> #include "GpgFrontendUI.h" +#include "core/thread/ThreadingModel.h" namespace GpgFrontend::UI { - class KeyServerSearchTask : public Thread::Task { Q_OBJECT public: @@ -76,5 +76,3 @@ class KeyServerSearchTask : public Thread::Task { }; } // namespace GpgFrontend::UI - -#endif // GPGFRONTEND_KEYSERVERSEARCHTASK_H
\ No newline at end of file diff --git a/src/ui/thread/ListedKeyServerTestTask.h b/src/ui/thread/ListedKeyServerTestTask.h index 5c322ec3..aa17a12a 100644 --- a/src/ui/thread/ListedKeyServerTestTask.h +++ b/src/ui/thread/ListedKeyServerTestTask.h @@ -26,10 +26,10 @@ * */ -#ifndef GPGFRONTEND_LISTEDKEYSERVERTESTTHREAD_H -#define GPGFRONTEND_LISTEDKEYSERVERTESTTHREAD_H +#pragma once #include "GpgFrontendUI.h" +#include "core/thread/ThreadingModel.h" class QNetworkAccessManager; class QNetworkReply; @@ -87,5 +87,3 @@ class ListedKeyServerTestTask : public Thread::Task { } // namespace GpgFrontend::UI class TestListedKeyServerThread {}; - -#endif // GPGFRONTEND_LISTEDKEYSERVERTESTTHREAD_H diff --git a/src/ui/thread/ProxyConnectionTestTask.h b/src/ui/thread/ProxyConnectionTestTask.h index 110b4e4a..ac8982b5 100644 --- a/src/ui/thread/ProxyConnectionTestTask.h +++ b/src/ui/thread/ProxyConnectionTestTask.h @@ -26,15 +26,10 @@ * */ -#ifndef GPGFRONTEND_PROXYCONNECTIONTESTTHREAD_H -#define GPGFRONTEND_PROXYCONNECTIONTESTTHREAD_H - -#include <qnetworkreply.h> -class ProxyConnectionTestThread {}; - -#include <utility> +#pragma once #include "GpgFrontendUI.h" +#include "core/thread/ThreadingModel.h" class QNetworkAccessManager; class QNetworkReply; @@ -83,5 +78,3 @@ class ProxyConnectionTestTask : public Thread::Task { }; } // namespace GpgFrontend::UI - -#endif // GPGFRONTEND_PROXYCONNECTIONTESTTHREAD_H diff --git a/src/ui/thread/VersionCheckTask.cpp b/src/ui/thread/VersionCheckTask.cpp index c03ccb16..72857ae3 100644 --- a/src/ui/thread/VersionCheckTask.cpp +++ b/src/ui/thread/VersionCheckTask.cpp @@ -28,9 +28,7 @@ #include "VersionCheckTask.h" -#include <QMetaType> -#include <QtNetwork> -#include <memory> +#include <nlohmann/json.hpp> #include "GpgFrontendBuildInfo.h" diff --git a/src/ui/thread/VersionCheckTask.h b/src/ui/thread/VersionCheckTask.h index c23559c5..74428c49 100644 --- a/src/ui/thread/VersionCheckTask.h +++ b/src/ui/thread/VersionCheckTask.h @@ -26,9 +26,9 @@ * */ -#ifndef GPGFRONTEND_VERSIONCHECKTHREAD_H -#define GPGFRONTEND_VERSIONCHECKTHREAD_H +#pragma once +#include <qnetworkaccessmanager.h> #include <qnetworkreply.h> #include <memory> @@ -38,9 +38,6 @@ #include "ui/GpgFrontendUI.h" #include "ui/struct/SoftwareVersion.h" -class QNetworkAccessManager; -class QNetworkReply; - namespace GpgFrontend::UI { /** @@ -99,5 +96,3 @@ class VersionCheckTask : public Thread::Task { }; } // namespace GpgFrontend::UI - -#endif // GPGFRONTEND_VERSIONCHECKTHREAD_H diff --git a/src/ui/widgets/FilePage.h b/src/ui/widgets/FilePage.h index d4cd9d53..634c31db 100644 --- a/src/ui/widgets/FilePage.h +++ b/src/ui/widgets/FilePage.h @@ -26,8 +26,7 @@ * */ -#ifndef GPGFRONTEND_FILEPAGE_H -#define GPGFRONTEND_FILEPAGE_H +#pragma once #include "ui/GpgFrontendUI.h" #include "ui/widgets/InfoBoardWidget.h" @@ -189,5 +188,3 @@ class FilePage : public QWidget { }; } // namespace GpgFrontend::UI - -#endif // GPGFRONTEND_FILEPAGE_H diff --git a/src/ui/widgets/FindWidget.h b/src/ui/widgets/FindWidget.h index c84eb275..a32a877c 100644 --- a/src/ui/widgets/FindWidget.h +++ b/src/ui/widgets/FindWidget.h @@ -26,8 +26,7 @@ * */ -#ifndef FINDWIDGET_H -#define FINDWIDGET_H +#pragma once #include "ui/GpgFrontendUI.h" #include "ui/widgets/PlainTextEditorPage.h" @@ -95,5 +94,3 @@ class FindWidget : public QWidget { }; } // namespace GpgFrontend::UI - -#endif // FINDWIDGET_H diff --git a/src/ui/widgets/HelpPage.h b/src/ui/widgets/HelpPage.h index 1e2522c1..3ab2cbf6 100644 --- a/src/ui/widgets/HelpPage.h +++ b/src/ui/widgets/HelpPage.h @@ -26,8 +26,7 @@ * */ -#ifndef HELPPAGE_H -#define HELPPAGE_H +#pragma once #include "ui/GpgFrontendUI.h" @@ -70,5 +69,3 @@ class HelpPage : public QWidget { }; } // namespace GpgFrontend::UI - -#endif // HELPPAGE_H diff --git a/src/ui/widgets/InfoBoardWidget.h b/src/ui/widgets/InfoBoardWidget.h index 21e285a6..183a386c 100644 --- a/src/ui/widgets/InfoBoardWidget.h +++ b/src/ui/widgets/InfoBoardWidget.h @@ -26,8 +26,7 @@ * */ -#ifndef __VERIFYNOTIFICATION_H__ -#define __VERIFYNOTIFICATION_H__ +#pragma once #include "PlainTextEditorPage.h" #include "core/function/result_analyse/GpgVerifyResultAnalyse.h" @@ -144,5 +143,3 @@ class InfoBoardWidget : public QWidget { }; } // namespace GpgFrontend::UI - -#endif // __VERIFYNOTIFICATION_H__
\ No newline at end of file diff --git a/src/ui/widgets/KeyList.h b/src/ui/widgets/KeyList.h index fd7043f2..31f2b561 100644 --- a/src/ui/widgets/KeyList.h +++ b/src/ui/widgets/KeyList.h @@ -26,8 +26,7 @@ * */ -#ifndef __KEYLIST_H__ -#define __KEYLIST_H__ +#pragma once #include <string> #include <utility> @@ -414,5 +413,3 @@ class KeyList : public QWidget { }; } // namespace GpgFrontend::UI - -#endif // __KEYLIST_H__ diff --git a/src/ui/widgets/PlainTextEditorPage.h b/src/ui/widgets/PlainTextEditorPage.h index 99682054..e2188e4e 100644 --- a/src/ui/widgets/PlainTextEditorPage.h +++ b/src/ui/widgets/PlainTextEditorPage.h @@ -26,8 +26,7 @@ * */ -#ifndef __EDITORPAGE_H__ -#define __EDITORPAGE_H__ +#pragma once #include <string> @@ -124,13 +123,13 @@ class PlainTextEditorPage : public QWidget { std::shared_ptr<Ui_PlainTextEditor> ui_; ///< QString full_file_path_; ///< The path to the file handled in the tab bool sign_marked_{}; ///< true, if the signed header is marked, false if not - bool read_done_ = false; ///< - bool binary_mode_ = false; ///< - size_t read_bytes_ = 0; ///< - std::string charset_name_; ///< - std::string language_name_; ///< + bool read_done_ = false; ///< + bool binary_mode_ = false; ///< + size_t read_bytes_ = 0; ///< + std::string charset_name_; ///< + std::string language_name_; ///< int32_t charset_confidence_{}; ///< - bool is_crlf_ = false; ///< + bool is_crlf_ = false; ///< /** * @brief @@ -162,5 +161,3 @@ class PlainTextEditorPage : public QWidget { }; } // namespace GpgFrontend::UI - -#endif // __EDITORPAGE_H__ diff --git a/src/ui/widgets/TOFUInfoPage.h b/src/ui/widgets/TOFUInfoPage.h index b43f8338..eb076398 100644 --- a/src/ui/widgets/TOFUInfoPage.h +++ b/src/ui/widgets/TOFUInfoPage.h @@ -26,8 +26,7 @@ * */ -#ifndef GPGFRONTEND_TOFUINFOPAGE_H -#define GPGFRONTEND_TOFUINFOPAGE_H +#pragma once #include "core/GpgModel.h" #include "ui/GpgFrontendUI.h" @@ -51,5 +50,3 @@ class TOFUInfoPage : public QWidget { QWidget *parent = nullptr); }; } // namespace GpgFrontend::UI - -#endif // GPGFRONTEND_TOFUINFOPAGE_H diff --git a/src/ui/widgets/TextEdit.h b/src/ui/widgets/TextEdit.h index d7eaa6ff..994e8a64 100644 --- a/src/ui/widgets/TextEdit.h +++ b/src/ui/widgets/TextEdit.h @@ -26,8 +26,7 @@ * */ -#ifndef __TEXTEDIT_H__ -#define __TEXTEDIT_H__ +#pragma once #include "ui/dialog/QuitDialog.h" #include "ui/widgets/FilePage.h" @@ -293,5 +292,3 @@ class TextEdit : public QWidget { }; } // namespace GpgFrontend::UI - -#endif // __TEXTEDIT_H__ diff --git a/src/ui/widgets/VerifyKeyDetailBox.h b/src/ui/widgets/VerifyKeyDetailBox.h index 59d81932..55c261d8 100644 --- a/src/ui/widgets/VerifyKeyDetailBox.h +++ b/src/ui/widgets/VerifyKeyDetailBox.h @@ -26,8 +26,7 @@ * */ -#ifndef __VERIFYKEYDETAILBOX_H__ -#define __VERIFYKEYDETAILBOX_H__ +#pragma once #include "ui/dialog/import_export/KeyServerImportDialog.h" #include "ui/widgets/KeyList.h" @@ -69,5 +68,3 @@ class VerifyKeyDetailBox : public QGroupBox { }; } // namespace GpgFrontend::UI - -#endif // __VERIFYKEYDETAILBOX_H__ |