diff options
author | Saturneric <[email protected]> | 2022-07-22 17:26:53 +0000 |
---|---|---|
committer | Saturneric <[email protected]> | 2022-07-22 17:26:53 +0000 |
commit | f3ff43494674b9eeeb7d2514d21aa15f477b4092 (patch) | |
tree | 96d4986e25fc5277c67ab7a28f05fa863b867ccd | |
parent | feat(ui): use general main window and dialog class (diff) | |
download | GpgFrontend-f3ff43494674b9eeeb7d2514d21aa15f477b4092.tar.gz GpgFrontend-f3ff43494674b9eeeb7d2514d21aa15f477b4092.zip |
style(src): reformat code
42 files changed, 138 insertions, 160 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index fb38cb9a..8b3e1773 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -129,7 +129,7 @@ if (BASIC_ENV_CONFIG) configure_file(${CMAKE_SOURCE_DIR}/src/GpgFrontend.h.in ${CMAKE_SOURCE_DIR}/src/GpgFrontend.h @ONLY) configure_file(${CMAKE_SOURCE_DIR}/src/GpgFrontendBuildInfo.h.in ${CMAKE_SOURCE_DIR}/src/GpgFrontendBuildInfo.h @ONLY) configure_file(${CMAKE_SOURCE_DIR}/src/GpgFrontendBuildInstallInfo.h.in ${CMAKE_SOURCE_DIR}/src/GpgFrontendBuildInstallInfo.h @ONLY) - if(APPLE) + if (APPLE) configure_file(${CMAKE_SOURCE_DIR}/resource/plist/ExportOptions.plist.in ${CMAKE_BINARY_DIR}/ExportOptions.plist @ONLY) endif () endif () @@ -183,7 +183,7 @@ if (APPLICATION_BUILD) if (${CMAKE_BUILD_TYPE} STREQUAL "Release") if (MINGW) add_executable(${AppName} WIN32 ${BASE_SOURCE} ${RESOURCE_FILES} ${QT5_MOCS}) - # custom app bundle packing + # custom app bundle packing elseif (APPLE AND NOT XCODE_BUILD) add_executable(${AppName} MACOSX_BUNDLE ${ICON_RESOURCE} ${BASE_SOURCE} ${RESOURCE_FILES} ${QT5_MOCS}) set_target_properties(${AppName} PROPERTIES @@ -212,7 +212,7 @@ if (APPLICATION_BUILD) COMMAND /bin/mkdir -p ./gpgfrontend/usr/lib WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} COMMENT "Complement to build the required architecture") - # app bundle packing using xcode + # app bundle packing using xcode elseif (APPLE AND XCODE_BUILD) add_executable(${AppName} MACOSX_BUNDLE ${ICON_RESOURCE} ${BASE_SOURCE} ${RESOURCE_FILES} ${QT5_MOCS}) set_target_properties(${AppName} PROPERTIES @@ -272,10 +272,10 @@ if (APPLICATION_BUILD) message(STATUS "Link Application Library For Linux") target_link_libraries(${AppName} crypto pthread) # issue on filesystem support of gcc - if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 9.0) + if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 9.0) target_link_libraries(${AppName} stdc++fs) endif () - endif() + endif () endif () # using c++ standard 17 diff --git a/src/before_exit.cpp b/src/before_exit.cpp index 04e245db..f13649db 100644 --- a/src/before_exit.cpp +++ b/src/before_exit.cpp @@ -32,6 +32,4 @@ * @brief Actions performed before exiting the application * */ -void before_exit() { - LOG(INFO) << "called"; -} +void before_exit() { LOG(INFO) << "called"; } diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index f9c354a2..0282b58c 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -60,7 +60,7 @@ aux_source_directory(${CMAKE_SOURCE_DIR}/third_party/encoding-detect ENCODING_DE target_sources(gpgfrontend_core PUBLIC ${ENCODING_DETECT_SOURCE_CODE}) # icu -if(APPLE) +if (APPLE) target_include_directories(gpgfrontend_core PRIVATE /usr/local/opt/icu4c/include) target_link_directories(gpgfrontend_core PRIVATE /usr/local/opt/icu4c/lib) target_link_libraries(gpgfrontend_core PRIVATE icui18n icuuc icudata) @@ -77,10 +77,10 @@ target_link_libraries(gpgfrontend_core PRIVATE gpgme assuan gpg-error) target_link_libraries(gpgfrontend_core PUBLIC OpenSSL::SSL OpenSSL::Crypto) # link boost libraries target_link_libraries(gpgfrontend_core PUBLIC ${Boost_LIBRARIES}) -if(MINGW) +if (MINGW) # for uuid ability in mingw target_link_libraries(gpgfrontend_core PUBLIC bcrypt) -endif() +endif () # link libarchive target_link_libraries(gpgfrontend_core PRIVATE archive) diff --git a/src/core/function/ArchiveFileOperator.cpp b/src/core/function/ArchiveFileOperator.cpp index 17f29df1..64c7389e 100644 --- a/src/core/function/ArchiveFileOperator.cpp +++ b/src/core/function/ArchiveFileOperator.cpp @@ -151,7 +151,8 @@ void GpgFrontend::ArchiveFileOperator::CreateArchive( #ifdef WINDOWS auto entry_path = - QString::fromStdWString(std::wstring(archive_entry_pathname_w(entry))).toUtf8() + QString::fromStdWString(std::wstring(archive_entry_pathname_w(entry))) + .toUtf8() .toStdString(); #else auto entry_path = std::string(archive_entry_pathname_utf8(entry)); @@ -161,7 +162,6 @@ void GpgFrontend::ArchiveFileOperator::CreateArchive( << archive_entry_size(entry) << " bytes" << "file type" << archive_entry_filetype(entry); - r = archive_write_header(a, entry); if (r < ARCHIVE_OK) { LOG(ERROR) << "archive_write_header() failed: " @@ -231,11 +231,11 @@ void GpgFrontend::ArchiveFileOperator::ExtractArchive( LOG(ERROR) << "cannot read from stdin"; } #ifdef WINDOWS - if (archive_read_open_filename_w(a, archive_path.wstring().c_str(), - 10240) != ARCHIVE_OK) { + if (archive_read_open_filename_w(a, archive_path.wstring().c_str(), 10240) != + ARCHIVE_OK) { #else - if (archive_read_open_filename(a, archive_path.u8string().c_str(), - 10240) != ARCHIVE_OK) { + if (archive_read_open_filename(a, archive_path.u8string().c_str(), 10240) != + ARCHIVE_OK) { #endif LOG(ERROR) << "archive_read_open_filename() failed: " << archive_error_string(a); diff --git a/src/core/function/ArchiveFileOperator.h b/src/core/function/ArchiveFileOperator.h index 28d1ad65..4db5af5f 100644 --- a/src/core/function/ArchiveFileOperator.h +++ b/src/core/function/ArchiveFileOperator.h @@ -46,15 +46,13 @@ class GPGFRONTEND_CORE_EXPORT ArchiveFileOperator { public: static void ListArchive(const std::filesystem::path &archive_path); - static void CreateArchive( - const std::filesystem::path &base_path, - const std::filesystem::path &archive_path, + static void CreateArchive(const std::filesystem::path &base_path, + const std::filesystem::path &archive_path, int compress, const std::vector<std::filesystem::path> &files); - static void ExtractArchive( - const std::filesystem::path &archive_path, - const std::filesystem::path &base_path); + static void ExtractArchive(const std::filesystem::path &archive_path, + const std::filesystem::path &base_path); }; } // namespace GpgFrontend diff --git a/src/core/function/DataObjectOperator.cpp b/src/core/function/DataObjectOperator.cpp index d5b746d6..2744c448 100644 --- a/src/core/function/DataObjectOperator.cpp +++ b/src/core/function/DataObjectOperator.cpp @@ -29,6 +29,7 @@ #include "DataObjectOperator.h" #include <qt-aes/qaesencryption.h> + #include <boost/date_time.hpp> #include "core/function/FileOperator.h" diff --git a/src/core/function/FileOperator.cpp b/src/core/function/FileOperator.cpp index 4977b3a9..fcbdb91c 100644 --- a/src/core/function/FileOperator.cpp +++ b/src/core/function/FileOperator.cpp @@ -1,30 +1,30 @@ /** -* Copyright (C) 2021 Saturneric -* -* This file is part of GpgFrontend. -* -* GpgFrontend is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* GpgFrontend is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with GpgFrontend. If not, see <https://www.gnu.org/licenses/>. -* -* The initial version of the source code is inherited from -* the gpg4usb project, which is under GPL-3.0-or-later. -* -* All the source code of GpgFrontend was modified and released by -* Saturneric<[email protected]> starting on May 12, 2021. -* -* SPDX-License-Identifier: GPL-3.0-or-later -* -*/ + * Copyright (C) 2021 Saturneric + * + * This file is part of GpgFrontend. + * + * GpgFrontend is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GpgFrontend is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GpgFrontend. If not, see <https://www.gnu.org/licenses/>. + * + * The initial version of the source code is inherited from + * the gpg4usb project, which is under GPL-3.0-or-later. + * + * All the source code of GpgFrontend was modified and released by + * Saturneric<[email protected]> starting on May 12, 2021. + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ #include "FileOperator.h" @@ -56,9 +56,11 @@ bool GpgFrontend::FileOperator::ReadFileStd( const std::filesystem::path& file_name, std::string& data) { QByteArray byte_data; #ifdef WINDOWS - bool res = ReadFile(QString::fromStdU16String(file_name.u16string()).toUtf8(), byte_data); + bool res = ReadFile(QString::fromStdU16String(file_name.u16string()).toUtf8(), + byte_data); #else - bool res = ReadFile(QString::fromStdString(file_name.u8string()).toUtf8(), byte_data); + bool res = ReadFile(QString::fromStdString(file_name.u8string()).toUtf8(), + byte_data); #endif data = byte_data.toStdString(); return res; @@ -66,7 +68,8 @@ bool GpgFrontend::FileOperator::ReadFileStd( bool GpgFrontend::FileOperator::WriteFileStd( const std::filesystem::path& file_name, const std::string& data) { - return WriteFile(QString::fromStdString(file_name.u8string()).toUtf8(), QByteArray::fromStdString(data)); + return WriteFile(QString::fromStdString(file_name.u8string()).toUtf8(), + QByteArray::fromStdString(data)); } std::string GpgFrontend::FileOperator::CalculateHash( @@ -80,12 +83,11 @@ std::string GpgFrontend::FileOperator::CalculateHash( ss << " " << _("filename") << _(": ") << file_path.filename().u8string().c_str() << std::endl; - QFile f(info.filePath()); f.open(QFile::ReadOnly); auto buffer = f.readAll(); - ss << " " << _("file size(bytes)") << _(": ") - << buffer.size() << std::endl; + ss << " " << _("file size(bytes)") << _(": ") << buffer.size() + << std::endl; f.close(); if (f.open(QFile::ReadOnly)) { auto hash_md5 = QCryptographicHash(QCryptographicHash::Md5); diff --git a/src/core/function/GlobalSettingStation.h b/src/core/function/GlobalSettingStation.h index ccf8e8f0..58282466 100644 --- a/src/core/function/GlobalSettingStation.h +++ b/src/core/function/GlobalSettingStation.h @@ -142,8 +142,8 @@ class GPGFRONTEND_CORE_EXPORT GlobalSettingStation void SyncSettings() noexcept; private: - std::filesystem::path app_path_ = - QCoreApplication::applicationDirPath().toStdString(); ///< Program Location + std::filesystem::path app_path_ = QCoreApplication::applicationDirPath() + .toStdString(); ///< Program Location std::filesystem::path app_data_path_ = QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) .toStdString(); ///< Program Data Location diff --git a/src/core/function/KeyPackageOperator.cpp b/src/core/function/KeyPackageOperator.cpp index 67fa3fac..3779c64b 100644 --- a/src/core/function/KeyPackageOperator.cpp +++ b/src/core/function/KeyPackageOperator.cpp @@ -72,7 +72,6 @@ bool KeyPackageOperator::ImportKeyPackage( const std::filesystem::path& key_package_path, const std::filesystem::path& phrase_path, GpgFrontend::GpgImportInformation& import_info) { - LOG(INFO) << "Importing key package: " << key_package_path.u8string(); std::string encrypted_data; @@ -101,7 +100,7 @@ bool KeyPackageOperator::ImportKeyPackage( auto decoded = encryption.removePadding(encryption.decode(encoded, hash_key)); auto key_data = QByteArray::fromBase64(decoded); - LOG(INFO) << "key data" << key_data.size(); + LOG(INFO) << "key data" << key_data.size(); if (!key_data.startsWith(GpgConstants::PGP_PUBLIC_KEY_BEGIN) && !key_data.startsWith(GpgConstants::PGP_PRIVATE_KEY_BEGIN)) { return false; diff --git a/src/core/function/PassphraseGenerator.cpp b/src/core/function/PassphraseGenerator.cpp index 0267edda..de963fa1 100644 --- a/src/core/function/PassphraseGenerator.cpp +++ b/src/core/function/PassphraseGenerator.cpp @@ -1,29 +1,29 @@ /** -* Copyright (C) 2021 Saturneric -* -* This file is part of GpgFrontend. -* -* GpgFrontend is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* GpgFrontend is distributed in the hope that it will be useful, -* but WITHOUT ANY WARRANTY; without even the implied warranty of -* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -* GNU General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with GpgFrontend. If not, see <https://www.gnu.org/licenses/>. -* -* The initial version of the source code is inherited from -* the gpg4usb project, which is under GPL-3.0-or-later. -* -* All the source code of GpgFrontend was modified and released by -* Saturneric<[email protected]> starting on May 12, 2021. -* -* SPDX-License-Identifier: GPL-3.0-or-later -* + * Copyright (C) 2021 Saturneric + * + * This file is part of GpgFrontend. + * + * GpgFrontend is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * GpgFrontend is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with GpgFrontend. If not, see <https://www.gnu.org/licenses/>. + * + * The initial version of the source code is inherited from + * the gpg4usb project, which is under GPL-3.0-or-later. + * + * All the source code of GpgFrontend was modified and released by + * Saturneric<[email protected]> starting on May 12, 2021. + * + * SPDX-License-Identifier: GPL-3.0-or-later + * */ #include "PassphraseGenerator.h" diff --git a/src/core/function/aes/aes_ssl.h b/src/core/function/aes/aes_ssl.h index b5f0820f..e75b68dd 100644 --- a/src/core/function/aes/aes_ssl.h +++ b/src/core/function/aes/aes_ssl.h @@ -29,11 +29,11 @@ #ifndef GPGFRONTEND_AES_SSL_H #define GPGFRONTEND_AES_SSL_H -#include "GpgFrontend.h" - #include <openssl/aes.h> #include <openssl/evp.h> +#include "GpgFrontend.h" + namespace GpgFrontend::RawAPI { /** @@ -69,6 +69,6 @@ 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 +} // namespace GpgFrontend::RawAPI -#endif // GPGFRONTEND_AES_SSL_H +#endif // GPGFRONTEND_AES_SSL_H diff --git a/src/core/function/aes/aes_ssl_cbc.cpp b/src/core/function/aes/aes_ssl_cbc.cpp index 95ae0ce2..88a54baa 100644 --- a/src/core/function/aes/aes_ssl_cbc.cpp +++ b/src/core/function/aes/aes_ssl_cbc.cpp @@ -96,4 +96,4 @@ uint8_t *aes_256_cbc_decrypt(EVP_CIPHER_CTX *e, uint8_t *ciphertext, int *len) { return plaintext; } -} // namespace GpgFrontend::RawAPI
\ No newline at end of file +} // namespace GpgFrontend::RawAPI
\ No newline at end of file diff --git a/src/core/function/gpg/GpgCommandExecutor.h b/src/core/function/gpg/GpgCommandExecutor.h index 00d9b43d..40ee22df 100644 --- a/src/core/function/gpg/GpgCommandExecutor.h +++ b/src/core/function/gpg/GpgCommandExecutor.h @@ -42,7 +42,8 @@ namespace GpgFrontend { * @brief Extra commands related to GPG * */ -class GPGFRONTEND_CORE_EXPORT GpgCommandExecutor : public SingletonFunctionObject<GpgCommandExecutor> { +class GPGFRONTEND_CORE_EXPORT GpgCommandExecutor + : public SingletonFunctionObject<GpgCommandExecutor> { public: /** * @brief Construct a new Gpg Command Executor object diff --git a/src/core/function/gpg/GpgFileOpera.h b/src/core/function/gpg/GpgFileOpera.h index 3f223535..dc81bc53 100644 --- a/src/core/function/gpg/GpgFileOpera.h +++ b/src/core/function/gpg/GpgFileOpera.h @@ -43,7 +43,6 @@ namespace GpgFrontend { class GPGFRONTEND_CORE_EXPORT GpgFileOpera : public SingletonFunctionObject<GpgFileOpera> { public: - explicit GpgFileOpera( int channel = SingletonFunctionObject::GetDefaultChannel()); diff --git a/src/core/function/gpg/GpgKeyOpera.cpp b/src/core/function/gpg/GpgKeyOpera.cpp index e36edfd9..03d8c8d9 100644 --- a/src/core/function/gpg/GpgKeyOpera.cpp +++ b/src/core/function/gpg/GpgKeyOpera.cpp @@ -36,13 +36,12 @@ #include <string> #include <vector> -#include "core/GpgConstants.h" -#include "core/GpgGenKeyInfo.h" #include "GpgCommandExecutor.h" #include "GpgKeyGetter.h" +#include "core/GpgConstants.h" +#include "core/GpgGenKeyInfo.h" -GpgFrontend::GpgKeyOpera::GpgKeyOpera( - int channel) +GpgFrontend::GpgKeyOpera::GpgKeyOpera(int channel) : SingletonFunctionObject<GpgKeyOpera>(channel) {} /** diff --git a/src/core/function/result_analyse/GpgDecryptResultAnalyse.cpp b/src/core/function/result_analyse/GpgDecryptResultAnalyse.cpp index ff3d2e27..d3ec8d6e 100644 --- a/src/core/function/result_analyse/GpgDecryptResultAnalyse.cpp +++ b/src/core/function/result_analyse/GpgDecryptResultAnalyse.cpp @@ -30,8 +30,8 @@ #include "function/gpg/GpgKeyGetter.h" -GpgFrontend::GpgDecryptResultAnalyse::GpgDecryptResultAnalyse(GpgError m_error, - GpgDecrResult m_result) +GpgFrontend::GpgDecryptResultAnalyse::GpgDecryptResultAnalyse( + GpgError m_error, GpgDecrResult m_result) : error_(m_error), result_(std::move(m_result)) {} void GpgFrontend::GpgDecryptResultAnalyse::do_analyse() { diff --git a/src/core/function/result_analyse/GpgEncryptResultAnalyse.cpp b/src/core/function/result_analyse/GpgEncryptResultAnalyse.cpp index 053a15a5..9b3b9700 100644 --- a/src/core/function/result_analyse/GpgEncryptResultAnalyse.cpp +++ b/src/core/function/result_analyse/GpgEncryptResultAnalyse.cpp @@ -28,8 +28,8 @@ #include "GpgEncryptResultAnalyse.h" -GpgFrontend::GpgEncryptResultAnalyse::GpgEncryptResultAnalyse(GpgError error, - GpgEncrResult result) +GpgFrontend::GpgEncryptResultAnalyse::GpgEncryptResultAnalyse( + GpgError error, GpgEncrResult result) : error_(error), result_(std::move(result)) {} void GpgFrontend::GpgEncryptResultAnalyse::do_analyse() { diff --git a/src/core/function/result_analyse/GpgSignResultAnalyse.cpp b/src/core/function/result_analyse/GpgSignResultAnalyse.cpp index e389523c..a47b8e3e 100644 --- a/src/core/function/result_analyse/GpgSignResultAnalyse.cpp +++ b/src/core/function/result_analyse/GpgSignResultAnalyse.cpp @@ -31,7 +31,7 @@ #include "function/gpg/GpgKeyGetter.h" GpgFrontend::GpgSignResultAnalyse::GpgSignResultAnalyse(GpgError error, - GpgSignResult result) + GpgSignResult result) : error_(error), result_(std::move(result)) {} void GpgFrontend::GpgSignResultAnalyse::do_analyse() { diff --git a/src/core/model/GpgKey.cpp b/src/core/model/GpgKey.cpp index 4b9d11d3..ad88a649 100644 --- a/src/core/model/GpgKey.cpp +++ b/src/core/model/GpgKey.cpp @@ -45,9 +45,7 @@ bool GpgFrontend::GpgKey::operator<=(const GpgKey &o) const { return this->GetId() < o.GetId(); } -GpgFrontend::GpgKey::operator gpgme_key_t() const { - return key_ref_.get(); -} +GpgFrontend::GpgKey::operator gpgme_key_t() const { return key_ref_.get(); } bool GpgFrontend::GpgKey::IsGood() const { return key_ref_ != nullptr; } @@ -226,10 +224,9 @@ bool GpgFrontend::GpgKey::IsHasActualEncryptionCapability() const { return false; } - GpgFrontend::GpgKey GpgFrontend::GpgKey::Copy() const { gpgme_key_ref(key_ref_.get()); - auto* _new_key_ref = key_ref_.get(); + auto *_new_key_ref = key_ref_.get(); return GpgKey(std::move(_new_key_ref)); } diff --git a/src/ui/GpgFrontendApplication.cpp b/src/ui/GpgFrontendApplication.cpp index 2045746f..b1c5beed 100644 --- a/src/ui/GpgFrontendApplication.cpp +++ b/src/ui/GpgFrontendApplication.cpp @@ -30,7 +30,7 @@ namespace GpgFrontend::UI { -GpgFrontendApplication::GpgFrontendApplication(int& argc, char *argv[]) +GpgFrontendApplication::GpgFrontendApplication(int &argc, char *argv[]) : QApplication(argc, argv) { #ifndef MACOS this->setWindowIcon(QIcon(":gpgfrontend.png")); @@ -56,7 +56,6 @@ GpgFrontendApplication::GpgFrontendApplication(int& argc, char *argv[]) GpgFrontendApplication *GpgFrontendApplication::GetInstance(int argc, char *argv[], bool new_instance) { - static GpgFrontendApplication *instance = nullptr; static int static_argc = argc; static char **static_argv = argv; diff --git a/src/ui/GpgFrontendApplication.h b/src/ui/GpgFrontendApplication.h index caf0750d..06338bb6 100644 --- a/src/ui/GpgFrontendApplication.h +++ b/src/ui/GpgFrontendApplication.h @@ -40,7 +40,7 @@ class GPGFRONTEND_UI_EXPORT GpgFrontendApplication : public QApplication { * @param argc * @param argv */ - explicit GpgFrontendApplication(int& argc, char *argv[]); + explicit GpgFrontendApplication(int &argc, char *argv[]); /** * @brief Destroy the GpgFrontend Application object diff --git a/src/ui/GpgFrontendUIInit.cpp b/src/ui/GpgFrontendUIInit.cpp index fbc6877f..5cbca31b 100644 --- a/src/ui/GpgFrontendUIInit.cpp +++ b/src/ui/GpgFrontendUIInit.cpp @@ -106,7 +106,6 @@ void InitGpgFrontendUI(QApplication* app) { waiting_dialog->setFocus(); waiting_dialog->show(); - // new local event looper QEventLoop looper; app->connect(init_ctx_task, &Thread::CtxCheckTask::SignalTaskFinished, diff --git a/src/ui/dialog/GeneralDialog.h b/src/ui/dialog/GeneralDialog.h index e401de85..037277fa 100644 --- a/src/ui/dialog/GeneralDialog.h +++ b/src/ui/dialog/GeneralDialog.h @@ -25,15 +25,14 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ - #ifndef GPGFRONTEND_GENERALDIALOG_H #define GPGFRONTEND_GENERALDIALOG_H #include "ui/GpgFrontendUI.h" -namespace GpgFrontend::UI{ +namespace GpgFrontend::UI { -class GeneralDialog: public QDialog { +class GeneralDialog : public QDialog { public: /** * @@ -58,12 +57,8 @@ class GeneralDialog: public QDialog { void slot_save_settings() noexcept; private: - - std::string name_; ///< - + std::string name_; ///< }; -} - - +} // namespace GpgFrontend::UI #endif // GPGFRONTEND_GENERALDIALOG_H diff --git a/src/ui/dialog/QuitDialog.h b/src/ui/dialog/QuitDialog.h index 82a97cd4..2fd9e382 100755 --- a/src/ui/dialog/QuitDialog.h +++ b/src/ui/dialog/QuitDialog.h @@ -38,7 +38,7 @@ namespace GpgFrontend::UI { * @brief * */ -class QuitDialog : public GeneralDialog { +class QuitDialog : public GeneralDialog { Q_OBJECT public: diff --git a/src/ui/dialog/Wizard.h b/src/ui/dialog/Wizard.h index 8f418ed1..1ab0f782 100644 --- a/src/ui/dialog/Wizard.h +++ b/src/ui/dialog/Wizard.h @@ -30,8 +30,8 @@ #define WIZARD_H #include "core/GpgConstants.h" -#include "ui/GpgFrontendUI.h" #include "main_window/KeyMgmt.h" +#include "ui/GpgFrontendUI.h" #include "ui/key_generate/KeygenDialog.h" #include "ui/settings/SettingsDialog.h" diff --git a/src/ui/import_export/ExportKeyPackageDialog.cpp b/src/ui/import_export/ExportKeyPackageDialog.cpp index 357812c0..074f07ba 100644 --- a/src/ui/import_export/ExportKeyPackageDialog.cpp +++ b/src/ui/import_export/ExportKeyPackageDialog.cpp @@ -30,8 +30,8 @@ #include <boost/format.hpp> -#include "core/function/gpg/GpgKeyGetter.h" #include "core/function/KeyPackageOperator.h" +#include "core/function/gpg/GpgKeyGetter.h" #include "ui_ExportKeyPackageDialog.h" GpgFrontend::UI::ExportKeyPackageDialog::ExportKeyPackageDialog( diff --git a/src/ui/key_generate/KeygenDialog.cpp b/src/ui/key_generate/KeygenDialog.cpp index 1295a7ac..d33ed5fb 100644 --- a/src/ui/key_generate/KeygenDialog.cpp +++ b/src/ui/key_generate/KeygenDialog.cpp @@ -35,7 +35,8 @@ namespace GpgFrontend::UI { -KeyGenDialog::KeyGenDialog(QWidget* parent) : GeneralDialog(typeid(KeyGenDialog).name(), parent) { +KeyGenDialog::KeyGenDialog(QWidget* parent) + : GeneralDialog(typeid(KeyGenDialog).name(), parent) { button_box_ = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); diff --git a/src/ui/keypair_details/KeyPairDetailTab.h b/src/ui/keypair_details/KeyPairDetailTab.h index 9d0d6560..441596f0 100644 --- a/src/ui/keypair_details/KeyPairDetailTab.h +++ b/src/ui/keypair_details/KeyPairDetailTab.h @@ -60,19 +60,19 @@ class KeyPairDetailTab : public QWidget { private: GpgKey key_; ///< - QGroupBox* owner_box_; ///< Groupbox containing owner information - QGroupBox* key_box_; ///< Groupbox containing key information - QGroupBox* fingerprint_box_; ///< Groupbox containing fingerprint information + QGroupBox* owner_box_; ///< Groupbox containing owner information + QGroupBox* key_box_; ///< Groupbox containing key information + QGroupBox* fingerprint_box_; ///< Groupbox containing fingerprint information QGroupBox* additional_uid_box_; ///< Groupbox containing information about ///< additional uids - QLabel* name_var_label_; ///< Label containing the keys name - QLabel* email_var_label_; ///< Label containing the keys email - QLabel* comment_var_label_; ///< Label containing the keys comment - QLabel* key_size_var_label_; ///< Label containing the keys key size - QLabel* expire_var_label_; ///< Label containing the keys expiration date - QLabel* created_var_label_; ///< Label containing the keys creation date - QLabel* last_update_var_label_; ///< + QLabel* name_var_label_; ///< Label containing the keys name + QLabel* email_var_label_; ///< Label containing the keys email + QLabel* comment_var_label_; ///< Label containing the keys comment + QLabel* key_size_var_label_; ///< Label containing the keys key size + QLabel* expire_var_label_; ///< Label containing the keys expiration date + QLabel* created_var_label_; ///< Label containing the keys creation date + QLabel* last_update_var_label_; ///< QLabel* algorithm_var_label_; ///< Label containing the keys algorithm QLabel* key_id_var_label; ///< Label containing the keys keyid QLabel* fingerprint_var_label_; ///< Label containing the keys fingerprint diff --git a/src/ui/keypair_details/KeyUIDSignDialog.h b/src/ui/keypair_details/KeyUIDSignDialog.h index d64ce57c..bfaff6d2 100644 --- a/src/ui/keypair_details/KeyUIDSignDialog.h +++ b/src/ui/keypair_details/KeyUIDSignDialog.h @@ -29,8 +29,8 @@ #include "core/GpgContext.h" #include "ui/GpgFrontendUI.h" -#include "ui/widgets/KeyList.h" #include "ui/dialog/GeneralDialog.h" +#include "ui/widgets/KeyList.h" namespace GpgFrontend::UI { diff --git a/src/ui/main_window/GeneralMainWindow.h b/src/ui/main_window/GeneralMainWindow.h index 143096bb..14b5d534 100644 --- a/src/ui/main_window/GeneralMainWindow.h +++ b/src/ui/main_window/GeneralMainWindow.h @@ -50,7 +50,6 @@ class GeneralMainWindow : public QMainWindow { ~GeneralMainWindow() override; protected: - /** * * @param event @@ -72,8 +71,7 @@ class GeneralMainWindow : public QMainWindow { void slot_save_settings() noexcept; private: - - std::string name_; ///< + std::string name_; ///< }; } // namespace GpgFrontend::UI diff --git a/src/ui/main_window/KeyMgmt.cpp b/src/ui/main_window/KeyMgmt.cpp index dd0f4dd0..57db8cdf 100644 --- a/src/ui/main_window/KeyMgmt.cpp +++ b/src/ui/main_window/KeyMgmt.cpp @@ -45,7 +45,6 @@ namespace GpgFrontend::UI { KeyMgmt::KeyMgmt(QWidget* parent) : GeneralMainWindow("key_management", parent) { - /* the list of Keys available*/ key_list_ = new KeyList(KeyMenuAbility::ALL, this); @@ -361,7 +360,6 @@ void KeyMgmt::SlotGenerateKeyDialog() { keyGenDialog->show(); } - void KeyMgmt::SlotGenerateSubKey() { auto keys_selected = key_list_->GetSelected(); if (keys_selected->empty()) { diff --git a/src/ui/main_window/KeyMgmt.h b/src/ui/main_window/KeyMgmt.h index 06ad0c1b..8821d41b 100644 --- a/src/ui/main_window/KeyMgmt.h +++ b/src/ui/main_window/KeyMgmt.h @@ -34,8 +34,8 @@ #include "ui/import_export/KeyServerImportDialog.h" #include "ui/key_generate/KeygenDialog.h" #include "ui/keypair_details/KeyDetailsDialog.h" -#include "ui/widgets/KeyList.h" #include "ui/main_window/GeneralMainWindow.h" +#include "ui/widgets/KeyList.h" namespace GpgFrontend::UI { @@ -171,7 +171,6 @@ class KeyMgmt : public GeneralMainWindow { QAction* close_act_{}; ///< QAction* show_key_details_act_{}; ///< KeyServerImportDialog* import_dialog_{}; ///< - }; } // namespace GpgFrontend::UI diff --git a/src/ui/main_window/MainWindow.cpp b/src/ui/main_window/MainWindow.cpp index 949e394f..8260934f 100644 --- a/src/ui/main_window/MainWindow.cpp +++ b/src/ui/main_window/MainWindow.cpp @@ -36,7 +36,7 @@ namespace GpgFrontend::UI { -MainWindow::MainWindow(): GeneralMainWindow("main_window") { +MainWindow::MainWindow() : GeneralMainWindow("main_window") { this->setMinimumSize(1200, 700); this->setWindowTitle(qApp->applicationName()); } @@ -135,7 +135,6 @@ void MainWindow::restore_settings() { LOG(INFO) << _("Called"); try { - LOG(INFO) << "restore settings key_server"; SettingsObject key_server_json("key_server"); @@ -207,7 +206,6 @@ void MainWindow::save_settings() { auto &settings = GlobalSettingStation::GetInstance().GetUISettings(); try { - bool save_key_checked = settings.lookup("general.save_key_checked"); // keyid-list of private checked keys diff --git a/src/ui/main_window/MainWindow.h b/src/ui/main_window/MainWindow.h index 23053a6f..914a7d3b 100644 --- a/src/ui/main_window/MainWindow.h +++ b/src/ui/main_window/MainWindow.h @@ -29,21 +29,21 @@ #ifndef __GPGWIN_H__ #define __GPGWIN_H__ +#include "KeyMgmt.h" #include "core/GpgConstants.h" #include "core/function/result_analyse/GpgDecryptResultAnalyse.h" #include "core/function/result_analyse/GpgEncryptResultAnalyse.h" #include "core/function/result_analyse/GpgSignResultAnalyse.h" #include "ui/GpgFrontendUI.h" -#include "KeyMgmt.h" #include "ui/dialog/WaitingDialog.h" #include "ui/dialog/Wizard.h" #include "ui/help/AboutDialog.h" #include "ui/import_export/KeyUploadDialog.h" +#include "ui/main_window/GeneralMainWindow.h" #include "ui/settings/SettingsDialog.h" #include "ui/widgets/FindWidget.h" #include "ui/widgets/InfoBoardWidget.h" #include "ui/widgets/TextEdit.h" -#include "ui/main_window/GeneralMainWindow.h" namespace GpgFrontend::UI { /** @@ -54,7 +54,6 @@ class MainWindow : public GeneralMainWindow { Q_OBJECT public: - /** * */ diff --git a/src/ui/settings/SettingsAppearance.cpp b/src/ui/settings/SettingsAppearance.cpp index 7e54c9f8..11a59985 100644 --- a/src/ui/settings/SettingsAppearance.cpp +++ b/src/ui/settings/SettingsAppearance.cpp @@ -114,7 +114,6 @@ AppearanceTab::AppearanceTab(QWidget* parent) : QWidget(parent) { * appropriately **********************************/ void AppearanceTab::SetSettings() { - SettingsObject main_windows_state("main_windows_state"); int width = main_windows_state.Check("icon_size").Check("width", 24), @@ -166,7 +165,6 @@ void AppearanceTab::SetSettings() { * write them to settings-file *************************************/ void AppearanceTab::ApplySettings() { - SettingsObject main_windows_state("main_windows_state"); int icon_size = 24; @@ -203,7 +201,6 @@ void AppearanceTab::ApplySettings() { main_windows_state["window_save"] = window_size_check_box_->isChecked(); main_windows_state["info_font_size"] = info_board_font_size_spin_->value(); - } } // namespace GpgFrontend::UI diff --git a/src/ui/settings/SettingsDialog.h b/src/ui/settings/SettingsDialog.h index acb60bd3..172370d0 100755 --- a/src/ui/settings/SettingsDialog.h +++ b/src/ui/settings/SettingsDialog.h @@ -30,8 +30,8 @@ #define __SETTINGSDIALOG_H__ #include "ui/GpgFrontendUI.h" -#include "ui/widgets/KeyList.h" #include "ui/dialog/GeneralDialog.h" +#include "ui/widgets/KeyList.h" namespace GpgFrontend::UI { @@ -55,7 +55,7 @@ class SettingsDialog : public GeneralDialog { */ explicit SettingsDialog(QWidget* parent = nullptr); - GeneralTab* general_tab_; ///< + GeneralTab* general_tab_; ///< AppearanceTab* appearance_tab_; ///< KeyserverTab* key_server_tab_; ///< NetworkTab* network_tab_; ///< diff --git a/src/ui/struct/SettingsObject.h b/src/ui/struct/SettingsObject.h index 653a543f..d1e85be5 100644 --- a/src/ui/struct/SettingsObject.h +++ b/src/ui/struct/SettingsObject.h @@ -69,7 +69,8 @@ class SettingsObject : public nlohmann::json { * @param default_value * @return nlohmann::json& */ - nlohmann::json& Check(const std::string& key, const nlohmann::json& default_value); + nlohmann::json& Check(const std::string& key, + const nlohmann::json& default_value); /** * @brief diff --git a/src/ui/thread/KeyServerSearchTask.cpp b/src/ui/thread/KeyServerSearchTask.cpp index bdbb8080..0090e79d 100644 --- a/src/ui/thread/KeyServerSearchTask.cpp +++ b/src/ui/thread/KeyServerSearchTask.cpp @@ -51,7 +51,7 @@ void GpgFrontend::UI::KeyServerSearchTask::run() { void GpgFrontend::UI::KeyServerSearchTask::dealing_reply_from_server() { QByteArray buffer; QNetworkReply::NetworkError network_reply = reply_->error(); - if(network_reply == QNetworkReply::NoError) { + if (network_reply == QNetworkReply::NoError) { buffer = reply_->readAll(); } emit SignalKeyServerSearchResult(network_reply, buffer); diff --git a/src/ui/widgets/FilePage.h b/src/ui/widgets/FilePage.h index cff395a8..8e278de7 100644 --- a/src/ui/widgets/FilePage.h +++ b/src/ui/widgets/FilePage.h @@ -29,8 +29,6 @@ #ifndef GPGFRONTEND_FILEPAGE_H #define GPGFRONTEND_FILEPAGE_H - - #include "ui/GpgFrontendUI.h" #include "ui/widgets/InfoBoardWidget.h" diff --git a/src/ui/widgets/FindWidget.cpp b/src/ui/widgets/FindWidget.cpp index defcf31c..598d8004 100644 --- a/src/ui/widgets/FindWidget.cpp +++ b/src/ui/widgets/FindWidget.cpp @@ -49,9 +49,11 @@ FindWidget::FindWidget(QWidget* parent, PlainTextEditorPage* edit) this->setLayout(notificationWidgetLayout); connect(find_edit_, &QLineEdit::textEdited, this, &FindWidget::slot_find); - connect(find_edit_, &QLineEdit::returnPressed, this, &FindWidget::slot_find_next); + connect(find_edit_, &QLineEdit::returnPressed, this, + &FindWidget::slot_find_next); connect(nextButton, &QPushButton::clicked, this, &FindWidget::slot_find_next); - connect(previousButton, &QPushButton::clicked, this, &FindWidget::slot_find_previous); + connect(previousButton, &QPushButton::clicked, this, + &FindWidget::slot_find_previous); connect(closeButton, &QPushButton::clicked, this, &FindWidget::slot_close); // The timer is necessary for setting the focus diff --git a/src/ui/widgets/InfoBoardWidget.cpp b/src/ui/widgets/InfoBoardWidget.cpp index ec2971cc..264a67d1 100644 --- a/src/ui/widgets/InfoBoardWidget.cpp +++ b/src/ui/widgets/InfoBoardWidget.cpp @@ -28,10 +28,10 @@ #include "ui/widgets/InfoBoardWidget.h" -#include "ui/SignalStation.h" #include "core/function/GlobalSettingStation.h" -#include "ui_InfoBoard.h" +#include "ui/SignalStation.h" #include "ui/struct/SettingsObject.h" +#include "ui_InfoBoard.h" namespace GpgFrontend::UI { diff --git a/src/ui/widgets/VerifyKeyDetailBox.cpp b/src/ui/widgets/VerifyKeyDetailBox.cpp index 4c936f4f..c6c4982c 100644 --- a/src/ui/widgets/VerifyKeyDetailBox.cpp +++ b/src/ui/widgets/VerifyKeyDetailBox.cpp @@ -41,7 +41,7 @@ VerifyKeyDetailBox::VerifyKeyDetailBox(const GpgSignature& signature, case GPG_ERR_NO_PUBKEY: { this->setTitle("A Error Signature"); auto* importButton = new QPushButton(_("Import from keyserver")); - connect(importButton,&QPushButton::clicked, this, + connect(importButton, &QPushButton::clicked, this, &VerifyKeyDetailBox::slot_import_form_key_server); this->setTitle(QString(_("Key not present with id 0x")) + fpr_.c_str()); |