From 2554604b93a8a5949473071bef145f4ec7cf8fce Mon Sep 17 00:00:00 2001 From: saturneric Date: Tue, 30 Jan 2024 17:33:16 +0800 Subject: [PATCH 1/6] fix: add general main window rect state fallback logic --- src/ui/dialog/GeneralDialog.h | 2 +- .../import_export/KeyImportDetailDialog.cpp | 2 +- .../import_export/KeyImportDetailDialog.h | 2 +- src/ui/main_window/GeneralMainWindow.cpp | 88 ++++++++++++++++++- src/ui/main_window/GeneralMainWindow.h | 20 +++++ 5 files changed, 108 insertions(+), 6 deletions(-) diff --git a/src/ui/dialog/GeneralDialog.h b/src/ui/dialog/GeneralDialog.h index 604c8475..3576319f 100644 --- a/src/ui/dialog/GeneralDialog.h +++ b/src/ui/dialog/GeneralDialog.h @@ -61,7 +61,7 @@ class GeneralDialog : public QDialog { * @brief * */ - [[nodiscard]] bool isRectRestored(); + [[nodiscard]] auto isRectRestored() -> bool; /** * @brief diff --git a/src/ui/dialog/import_export/KeyImportDetailDialog.cpp b/src/ui/dialog/import_export/KeyImportDetailDialog.cpp index 5b71c0f6..dfd6c35a 100644 --- a/src/ui/dialog/import_export/KeyImportDetailDialog.cpp +++ b/src/ui/dialog/import_export/KeyImportDetailDialog.cpp @@ -159,7 +159,7 @@ void KeyImportDetailDialog::create_keys_table() { keys_table_->resizeColumnsToContents(); } -QString KeyImportDetailDialog::get_status_string(int key_status) { +auto KeyImportDetailDialog::get_status_string(int key_status) -> QString { QString status_string; // keystatus is greater than 15, if key is private if (key_status > 15) { diff --git a/src/ui/dialog/import_export/KeyImportDetailDialog.h b/src/ui/dialog/import_export/KeyImportDetailDialog.h index db355570..2af0397d 100644 --- a/src/ui/dialog/import_export/KeyImportDetailDialog.h +++ b/src/ui/dialog/import_export/KeyImportDetailDialog.h @@ -80,7 +80,7 @@ class KeyImportDetailDialog : public GeneralDialog { * @param keyStatus * @return QString */ - static QString get_status_string(int keyStatus); + static auto get_status_string(int) -> QString; QTableWidget* keys_table_{}; ///< QGroupBox* general_info_box_{}; ///< diff --git a/src/ui/main_window/GeneralMainWindow.cpp b/src/ui/main_window/GeneralMainWindow.cpp index e3577199..f58326f9 100644 --- a/src/ui/main_window/GeneralMainWindow.cpp +++ b/src/ui/main_window/GeneralMainWindow.cpp @@ -59,9 +59,11 @@ void GpgFrontend::UI::GeneralMainWindow::slot_restore_settings() noexcept { GF_UI_LOG_DEBUG("restore main window state: {}", window_state.window_state_data); - // state sets pos & size of dock-widgets - this->restoreState( - QByteArray::fromBase64(window_state.window_state_data.toUtf8())); + if (!window_state.window_state_data.isEmpty()) { + // state sets pos & size of dock-widgets + this->restoreState( + QByteArray::fromBase64(window_state.window_state_data.toUtf8())); + } // restore window size & location if (window_state.window_save) { @@ -107,6 +109,8 @@ void GpgFrontend::UI::GeneralMainWindow::slot_restore_settings() noexcept { this->move(pos_); this->resize(size_); + } else { + movePosition2CenterOfParent(); } // appearance @@ -148,4 +152,82 @@ void GpgFrontend::UI::GeneralMainWindow::slot_save_settings() noexcept { } } +void GeneralMainWindow::setPosCenterOfScreen() { + // update cache + update_rect_cache(); + + int screen_width = screen_rect_.width(); + int screen_height = screen_rect_.height(); + GF_UI_LOG_DEBUG("dialog current screen available geometry", screen_width, + screen_height); + + // update rect of current dialog + rect_ = this->geometry(); + this->move(screen_rect_.center() - + QPoint(rect_.width() / 2, rect_.height() / 2)); +} + +void GeneralMainWindow::movePosition2CenterOfParent() { + // update cache + update_rect_cache(); + + // log for debug + GF_UI_LOG_DEBUG("parent pos x: {} y: {}", parent_rect_.x(), parent_rect_.y()); + GF_UI_LOG_DEBUG("parent size width: {}, height: {}", parent_rect_.width(), + parent_rect_.height()); + GF_UI_LOG_DEBUG("parent center pos x: {}, y: {}", parent_rect_.center().x(), + parent_rect_.center().y()); + GF_UI_LOG_DEBUG("dialog pos x: {} y: {}", rect_.x(), rect_.y()); + GF_UI_LOG_DEBUG("dialog size width: {} height: {}", rect_.width(), + rect_.height()); + + if (parent_rect_.topLeft() != QPoint{0, 0} && + parent_rect_.size() != QSize{0, 0}) { + if (rect_.width() <= 0) rect_.setWidth(100); + if (rect_.height() <= 0) rect_.setHeight(100); + + QPoint target_position = + parent_rect_.center() - QPoint(rect_.width() / 2, rect_.height() / 2); + + GF_UI_LOG_DEBUG( + "update position to parent's center, target pos, x:{}, y: {}", + target_position.x(), target_position.y()); + + this->move(target_position); + } else { + setPosCenterOfScreen(); + } +} + +void GeneralMainWindow::update_rect_cache() { + // update size of current dialog + rect_ = this->geometry(); + + auto *screen = this->window()->screen(); + screen_rect_ = screen->availableGeometry(); + + // read pos and size from parent + if (this->parent() != nullptr) { + QRect parent_rect; + + auto *parent_widget = qobject_cast(this->parent()); + if (parent_widget != nullptr) { + parent_rect = parent_widget->geometry(); + } else { + auto *parent_dialog = qobject_cast(this->parent()); + if (parent_dialog != nullptr) { + parent_rect = parent_dialog->geometry(); + } else { + auto *parent_window = qobject_cast(this->parent()); + if (parent_window != nullptr) { + parent_rect = parent_window->geometry(); + } + } + } + parent_rect_ = parent_rect; + } else { + // reset parent's pos and size + this->parent_rect_ = QRect{0, 0, 0, 0}; + } +} } // namespace GpgFrontend::UI \ No newline at end of file diff --git a/src/ui/main_window/GeneralMainWindow.h b/src/ui/main_window/GeneralMainWindow.h index e1ff31bb..70dad5f3 100644 --- a/src/ui/main_window/GeneralMainWindow.h +++ b/src/ui/main_window/GeneralMainWindow.h @@ -55,6 +55,17 @@ class GeneralMainWindow : public QMainWindow { */ void closeEvent(QCloseEvent* event) override; + /** + * + */ + void setPosCenterOfScreen(); + + /** + * @brief + * + */ + void movePosition2CenterOfParent(); + QSize icon_size_{}; ///< int font_size_{}; ///< Qt::ToolButtonStyle icon_style_; ///< @@ -70,9 +81,18 @@ class GeneralMainWindow : public QMainWindow { */ void slot_save_settings() noexcept; + /** + * @brief + * + */ + void update_rect_cache(); + private: QString name_; ///< QPoint pos_; ///< QSize size_; ///< + QRect rect_; + QRect screen_rect_; + QRect parent_rect_; }; } // namespace GpgFrontend::UI From 8874026c55e60600ee6f981966acf79a480a83fb Mon Sep 17 00:00:00 2001 From: saturneric Date: Tue, 30 Jan 2024 20:21:46 +0800 Subject: [PATCH 2/6] feat: try to add qt5 support --- .github/workflows/release-qt5.yml | 76 ++++++++++++++++++ CMakeLists.txt | 7 ++ src/CMakeLists.txt | 78 ++++++++++++++----- src/core/CMakeLists.txt | 11 ++- .../version_checking_module/CMakeLists.txt | 9 ++- src/pinentry/CMakeLists.txt | 9 ++- src/ui/CMakeLists.txt | 12 ++- 7 files changed, 174 insertions(+), 28 deletions(-) create mode 100644 .github/workflows/release-qt5.yml diff --git a/.github/workflows/release-qt5.yml b/.github/workflows/release-qt5.yml new file mode 100644 index 00000000..d19bc68b --- /dev/null +++ b/.github/workflows/release-qt5.yml @@ -0,0 +1,76 @@ +name: Build & Package + +on: + push: + branches: [ main, 'develop' ] + paths-ignore: + - 'resource/locale/**' + - 'manual/**' + - '**.md' + pull_request: + branches: [ main, 'develop' ] + paths-ignore: + - 'resource/locale/**' + - 'manual/**' + - '**.md' + +env: + # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) + BUILD_TYPE: Release + EXECUTABLE_OUTPUT_PATH: ./ + +jobs: + build: + strategy: + matrix: + os: [ 'windows-2019' ] + runs-on: ${{ matrix.os }} + continue-on-error: true + steps: + - name: Set git to use LF(Windows) or CRLF(MacOS) line endings + run: | + git config --global core.autocrlf false + git config --global core.eol lf + if: matrix.os == 'windows-2019' || matrix.os == 'macos-11' || matrix.os == 'macos-12' + + - uses: actions/checkout@v3 + with: + lfs: 'false' + submodules: recursive + + - name: Get Short SHA of Commit + id: vars + run: echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_ENV + + - name: Set up MinGW (Windows) + uses: msys2/setup-msys2@v2 + with: + install: git msys2-devel base-devel binutils mingw-w64-x86_64-toolchain + release: false + if: matrix.os == 'windows-2019' + + - name: Set up Dependence (Windows) + shell: msys2 {0} + run: | + pacman --noconfirm -S --needed mingw-w64-x86_64-gcc mingw-w64-x86_64-make mingw-w64-x86_64-cmake autoconf + pacman --noconfirm -S --needed make texinfo automake + pacman --noconfirm -S --needed mingw-w64-x86_64-qt5 libintl msys2-runtime-devel gettext-devel mingw-w64-x86_64-gpgme + pacman --noconfirm -S --needed mingw-w64-x86_64-ninja mingw-w64-x86_64-gnupg mingw-w64-x86_64-libarchive + if: matrix.os == 'windows-2019' + + - name: Configure CMake & Build Binary(Windows) + shell: msys2 {0} + run: | + cd $(echo "/${{github.workspace}}" | sed 's/\\/\//g' | sed 's/://') + mkdir build && cd build + cmake -G Ninja -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DGPGFRONTEND_BUILD_TYPE_STABLE=ON .. + # Build your program with the given configuration + cmake --build . --config ${{env.BUILD_TYPE}} -- -j 2 + if: matrix.os == 'windows-2019' + + - name: Upload Artifact(Windows) + uses: actions/upload-artifact@master + with: + name: gpgfrontend-${{matrix.os}}-${{env.BUILD_TYPE}}-${{ github.sha }} + path: ${{github.workspace}}/build/artifacts/* + if: matrix.os == 'windows-2019' diff --git a/CMakeLists.txt b/CMakeLists.txt index 44c64140..2819895f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,6 +64,7 @@ option(GPGFRONTEND_BUILD_TYPE_TEST_ALL "Generate a graphical interface with all functions" OFF) option(GPGFRONTEND_BUILD_TYPE_STABLE "Generate release version" ON) +option(GPGFRONTEND_QT5_BUILD "Swith to Qt5 building mode" OFF) option(GPGFRONTEND_GENERATE_LINUX_INSTALL_SOFTWARE "Generate an installable version" OFF) option(GPGFRONTEND_CONFIGURE_FOR_XCODE_BUILD "Generate a version that can be successfully compiled and packaged in Xcode" OFF) option(GPGFRONTEND_XCODE_TEAM_ID "GpgFrontend Apple Team ID" "NONE") @@ -330,6 +331,12 @@ else () set(APP_INSTALL_FLAG BUNDLE) endif () +if (GPGFRONTEND_QT5_BUILD) + add_compile_definitions(QT5_BUILD) +else() + add_compile_definitions(QT6_BUILD) +endif() + # Basic ENV Configure set(BASIC_ENV_CONFIG 1) set(QT_MOC_CONFIG 1) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6a7cf4a8..a464b4c3 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -53,9 +53,17 @@ if (APPLE) endif() find_package(OpenSSL REQUIRED) -# Introduce Qt -# Support Qt version: 6.x -find_package(Qt6 6 COMPONENTS Core Test Widgets PrintSupport Network Core5Compat LinguistTools REQUIRED) + +if(GPGFRONTEND_QT5_BUILD) + # Introduce Qt + # Support Qt version: 5.15.x + find_package(Qt5 5.15 COMPONENTS Core Widgets PrintSupport Network LinguistTools REQUIRED) +else() + # Introduce Qt + # Support Qt version: 6.x + find_package(Qt6 6 COMPONENTS Core Widgets PrintSupport Network Core5Compat LinguistTools REQUIRED) +endif() + # Qt configuration set(CMAKE_AUTOMOC ON) @@ -447,22 +455,56 @@ if (BUILD_APPLICATION) "${LOCALE_TS_PATH}/GpgFrontend.zh_TW.ts" "${LOCALE_TS_PATH}/GpgFrontend.it_IT.ts") file(GLOB_RECURSE ALL_SOURCE_FILES RELACTIVE ${CMAKE_SOURCE_DIR}/src/*.cpp) - qt_add_translations(${AppName} - RESOURCE_PREFIX "/i18n" - TS_FILES ${TS_FILES} - SOURCES ${ALL_SOURCE_FILES} - INCLUDE_DIRECTORIES ${CMAKE_SOURCE_DIR}/src) - file(GLOB QT_TRANSLATIONS_TS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/third_party/qttranslations/translations/*.ts) - list(FILTER QT_TRANSLATIONS_TS INCLUDE REGEX ".*(qt|qtbase)_.*\.ts$") - add_custom_target(qttranslations ALL) - qt_add_lrelease(qttranslations - TS_FILES ${QT_TRANSLATIONS_TS} - QM_FILES_OUTPUT_VARIABLE QT_TRANSLATIONS_QM) - qt_add_resources(${AppName} "qttranslations" - PREFIX "/i18n_qt" - BASE ${CMAKE_CURRENT_BINARY_DIR} - FILES ${QT_TRANSLATIONS_QM}) + if(GPGFRONTEND_QT5_BUILD) + # TODO + qt5_add_translation(GF_TRANSLATIONS_QM ${TS_FILES}) + message(STATUS "GF_TRANSLATIONS_QM ${GF_TRANSLATIONS_QM}") + + set(GF_QM_TRANSLATIONS_RESOURCE_FILE "${CMAKE_CURRENT_BINARY_DIR}/i18n.qrc") + file(WRITE ${GF_QM_TRANSLATIONS_RESOURCE_FILE} "\n\n \n") + foreach(QM_FILE ${GF_TRANSLATIONS_QM}) + file(RELATIVE_PATH QM_FILENAME ${CMAKE_CURRENT_BINARY_DIR} ${QM_FILE}) + file(APPEND ${GF_QM_TRANSLATIONS_RESOURCE_FILE} " ${QM_FILE}\n") + endforeach() + file(APPEND ${GF_QM_TRANSLATIONS_RESOURCE_FILE} " \n\n") + qt5_add_resources(GF_I18N_RESOURCES ${GF_QM_TRANSLATIONS_RESOURCE_FILE}) + + file(GLOB QT_TRANSLATIONS_TS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/third_party/qttranslations/translations/*.ts) + list(FILTER QT_TRANSLATIONS_TS INCLUDE REGEX ".*(qt|qtbase)_.*\.ts$") + qt5_add_translation(QT_TRANSLATIONS_QM ${QT_TRANSLATIONS_TS}) + + set(QT_QM_TRANSLATIONS_RESOURCE_FILE "${CMAKE_CURRENT_BINARY_DIR}/qt_i18n.qrc") + file(WRITE ${QT_QM_TRANSLATIONS_RESOURCE_FILE} "\n\n \n") + foreach(QM_FILE ${QT_TRANSLATIONS_QM}) + file(RELATIVE_PATH QM_FILENAME ${CMAKE_CURRENT_BINARY_DIR} ${QM_FILE}) + file(APPEND ${QT_QM_TRANSLATIONS_RESOURCE_FILE} " ${QM_FILE}\n") + endforeach() + file(APPEND ${QT_QM_TRANSLATIONS_RESOURCE_FILE} " \n\n") + qt5_add_resources(GF_I18N_RESOURCES ${QT_QM_TRANSLATIONS_RESOURCE_FILE}) + + message(STATUS "GF_I18N_RESOURCES ${GF_I18N_RESOURCES}") + + target_sources(${AppName} PRIVATE ${GF_I18N_RESOURCES}) + else() + qt_add_translations(${AppName} + RESOURCE_PREFIX "/i18n" + TS_FILES ${TS_FILES} + SOURCES ${ALL_SOURCE_FILES} + INCLUDE_DIRECTORIES ${CMAKE_SOURCE_DIR}/src) + file(GLOB QT_TRANSLATIONS_TS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/third_party/qttranslations/translations/*.ts) + list(FILTER QT_TRANSLATIONS_TS INCLUDE REGEX ".*(qt|qtbase)_.*\.ts$") + add_custom_target(qttranslations ALL) + qt_add_lrelease(qttranslations + TS_FILES ${QT_TRANSLATIONS_TS} + QM_FILES_OUTPUT_VARIABLE QT_TRANSLATIONS_QM) + qt_add_resources(${AppName} "qttranslations" + PREFIX "/i18n_qt" + BASE ${CMAKE_CURRENT_BINARY_DIR} + FILES ${QT_TRANSLATIONS_QM}) + endif() + + endif() # if building linux package diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index a37ea7ee..b5dd3571 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -99,9 +99,14 @@ endif() # link libarchive target_link_libraries(gpgfrontend_core PRIVATE archive) - -# link Qt core -target_link_libraries(gpgfrontend_core PUBLIC Qt6::Core) + +if(GPGFRONTEND_QT5_BUILD) + # link Qt core + target_link_libraries(gpgfrontend_core PUBLIC Qt5::Core) +else() + # link Qt core + target_link_libraries(gpgfrontend_core PUBLIC Qt6::Core) +endif() # set up pch target_precompile_headers(gpgfrontend_core diff --git a/src/module/integrated/version_checking_module/CMakeLists.txt b/src/module/integrated/version_checking_module/CMakeLists.txt index f122be88..76459b0e 100644 --- a/src/module/integrated/version_checking_module/CMakeLists.txt +++ b/src/module/integrated/version_checking_module/CMakeLists.txt @@ -46,8 +46,13 @@ endif () target_link_libraries(gpgfrontend_integrated_module_version_checking PRIVATE gpgfrontend_module_sdk) -# link Qt -target_link_libraries(gpgfrontend_integrated_module_version_checking PRIVATE Qt6::Network) +if(GPGFRONTEND_QT5_BUILD) + # link Qt + target_link_libraries(gpgfrontend_integrated_module_version_checking PUBLIC Qt5::Network) +else() + # link Qt + target_link_libraries(gpgfrontend_integrated_module_version_checking PUBLIC Qt6::Network) +endif() # property set_property(TARGET gpgfrontend_integrated_module_version_checking PROPERTY AUTOMOC ON) diff --git a/src/pinentry/CMakeLists.txt b/src/pinentry/CMakeLists.txt index b31e4f05..3145719a 100644 --- a/src/pinentry/CMakeLists.txt +++ b/src/pinentry/CMakeLists.txt @@ -37,8 +37,13 @@ add_library(gpgfrontend_pinentry SHARED ${PINENTRY_SOURCE}) target_link_libraries(gpgfrontend_pinentry PUBLIC gpgfrontend_core) -# link Qt core -target_link_libraries(gpgfrontend_pinentry PUBLIC Qt6::Widgets) +if(GPGFRONTEND_QT5_BUILD) + # link Qt core + target_link_libraries(gpgfrontend_pinentry PUBLIC Qt5::Widgets) +else() + # link Qt core + target_link_libraries(gpgfrontend_pinentry PUBLIC Qt6::Widgets) +endif() # spdlog target_link_libraries(gpgfrontend_pinentry PRIVATE spdlog) diff --git a/src/ui/CMakeLists.txt b/src/ui/CMakeLists.txt index c9c27462..3f0686e2 100644 --- a/src/ui/CMakeLists.txt +++ b/src/ui/CMakeLists.txt @@ -47,9 +47,15 @@ add_library(gpgfrontend_ui SHARED ${UI_SOURCE}) set(_export_file "${CMAKE_CURRENT_SOURCE_DIR}/GpgFrontendUIExport.h") generate_export_header(gpgfrontend_ui EXPORT_FILE_NAME "${_export_file}") -# link Qt -target_link_libraries(gpgfrontend_ui - Qt6::Network Qt6::PrintSupport Qt6::Test Qt6::Core5Compat) +if(GPGFRONTEND_QT5_BUILD) + # link Qt + target_link_libraries(gpgfrontend_ui + Qt5::Core Qt5::Widgets Qt5::Network Qt5::PrintSupport) +else() + # link Qt + target_link_libraries(gpgfrontend_ui + Qt6::Core Qt6::Widgets Qt6::Network Qt6::PrintSupport Qt6::Core5Compat) +endif() # link gpgfrontend_core From 01dfc8df4f019e439e7b3e774ef3a02a2a908de2 Mon Sep 17 00:00:00 2001 From: saturneric Date: Wed, 31 Jan 2024 13:57:48 +0800 Subject: [PATCH 3/6] feat: support qt5 build option --- .github/workflows/release-qt5.yml | 2 +- src/core/function/ArchiveFileOperator.cpp | 4 ++++ src/core/function/gpg/GpgCommandExecutor.cpp | 2 +- src/core/function/gpg/GpgContext.cpp | 14 ++++++++++++-- .../GnuPGInfoGatheringModule.cpp | 9 ++++++++- src/pinentry/pinentry.cpp | 8 ++++---- src/pinentry/qti18n.cpp | 2 +- src/ui/GpgFrontendUIInit.cpp | 1 + src/ui/dialog/keypair_details/KeyPairOperaTab.cpp | 5 +++++ src/ui/dialog/settings/SettingsDialog.cpp | 4 ++++ src/ui/main_window/MainWindow.cpp | 1 + src/ui/widgets/FileTreeView.cpp | 2 +- 12 files changed, 43 insertions(+), 11 deletions(-) diff --git a/.github/workflows/release-qt5.yml b/.github/workflows/release-qt5.yml index d19bc68b..00ec531e 100644 --- a/.github/workflows/release-qt5.yml +++ b/.github/workflows/release-qt5.yml @@ -63,7 +63,7 @@ jobs: run: | cd $(echo "/${{github.workspace}}" | sed 's/\\/\//g' | sed 's/://') mkdir build && cd build - cmake -G Ninja -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DGPGFRONTEND_BUILD_TYPE_STABLE=ON .. + cmake -G Ninja -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DGPGFRONTEND_BUILD_TYPE_STABLE=ON -DGPGFRONTEND_QT5_BUILD=ON .. # Build your program with the given configuration cmake --build . --config ${{env.BUILD_TYPE}} -- -j 2 if: matrix.os == 'windows-2019' diff --git a/src/core/function/ArchiveFileOperator.cpp b/src/core/function/ArchiveFileOperator.cpp index 2b76e4ac..475ef434 100644 --- a/src/core/function/ArchiveFileOperator.cpp +++ b/src/core/function/ArchiveFileOperator.cpp @@ -143,7 +143,11 @@ void ArchiveFileOperator::NewArchive2DataExchanger( #endif QFile file(source_path); +#ifdef QT5_BUILD + if (file.open(QIODevice::ReadOnly)) { +#else if (file.open(QIODeviceBase::ReadOnly)) { +#endif // turn absolute path to relative path auto relativ_path_name = base_path.relativeFilePath(source_path); archive_entry_set_pathname(entry, relativ_path_name.toUtf8()); diff --git a/src/core/function/gpg/GpgCommandExecutor.cpp b/src/core/function/gpg/GpgCommandExecutor.cpp index 6d24f9bd..66c18ae1 100644 --- a/src/core/function/gpg/GpgCommandExecutor.cpp +++ b/src/core/function/gpg/GpgCommandExecutor.cpp @@ -41,7 +41,7 @@ auto BuildTaskFromExecCtx(const GpgCommandExecutor::ExecuteContext &context) const auto &interact_function = context.int_func; const auto &cmd_executor_callback = context.cb_func; - const QString joined_argument = QStringList::fromVector(arguments).join(" "); + const QString joined_argument = arguments.join(" "); GF_CORE_LOG_DEBUG("building task: called cmd {} arguments size: {}", cmd, arguments.size()); diff --git a/src/core/function/gpg/GpgContext.cpp b/src/core/function/gpg/GpgContext.cpp index 6523386c..7c84d3c4 100644 --- a/src/core/function/gpg/GpgContext.cpp +++ b/src/core/function/gpg/GpgContext.cpp @@ -93,13 +93,23 @@ class GpgContext::Impl { const char *passphrase_info, int last_was_bad, int fd) -> gpgme_error_t { size_t res; - QString pass = "abcdefg\n"; +#ifdef QT5_BUILD + QString pass_qstr = "abcdefg\n"; + QByteArray pass = pass_qstr.toUtf8(); +#else + QString pass = "abcdefg\n"; +#endif + auto passpahrase_size = pass.size(); - size_t off = 0; do { +#ifdef QT5_BUILD + const char* p_pass = pass.data(); + res = gpgme_io_write(fd, &p_pass[off], passpahrase_size - off); +#else res = gpgme_io_write(fd, &pass[off], passpahrase_size - off); +#endif if (res > 0) off += res; } while (res > 0 && off != passpahrase_size); diff --git a/src/module/integrated/gnupg_info_gathering_module/GnuPGInfoGatheringModule.cpp b/src/module/integrated/gnupg_info_gathering_module/GnuPGInfoGatheringModule.cpp index c965ed30..a1e5cd5a 100644 --- a/src/module/integrated/gnupg_info_gathering_module/GnuPGInfoGatheringModule.cpp +++ b/src/module/integrated/gnupg_info_gathering_module/GnuPGInfoGatheringModule.cpp @@ -209,8 +209,11 @@ auto GnuPGInfoGatheringModule::Exec(EventRefrernce event) -> int { getTaskRunner()}); GpgCommandExecutor::ExecuteContexts exec_contexts; - +#ifdef QT5_BUILD + exec_contexts.push_back(GpgCommandExecutor::ExecuteContext{ +#else exec_contexts.emplace_back(GpgCommandExecutor::ExecuteContext{ +#endif gpgconf_path, QStringList{"--list-dirs"}, [this](int exit_code, const QString &p_out, const QString &p_err) { if (exit_code != 0) return; @@ -264,7 +267,11 @@ auto GnuPGInfoGatheringModule::Exec(EventRefrernce event) -> int { continue; } +#ifdef QT5_BUILD + exec_contexts.push_back(GpgCommandExecutor::ExecuteContext{ +#else exec_contexts.emplace_back(GpgCommandExecutor::ExecuteContext{ +#endif gpgconf_path, QStringList{"--list-options", component_info.name}, [this, component_info](int exit_code, const QString &p_out, const QString &p_err) { diff --git a/src/pinentry/pinentry.cpp b/src/pinentry/pinentry.cpp index c648aea6..5f233f5d 100644 --- a/src/pinentry/pinentry.cpp +++ b/src/pinentry/pinentry.cpp @@ -375,19 +375,19 @@ int pinentry_inq_quality(const QString &passphrase) { static_cast(has_digit) + static_cast(has_special); score += variety_count * 10; - for (size_t i = 0; i < passphrase.length() - 1; ++i) { + for (auto i = 0; i < passphrase.length() - 1; ++i) { if (passphrase[i] == passphrase[i + 1]) { score -= 5; } } - std::unordered_map char_count; + QHash char_count; for (const auto ch : passphrase) { char_count[ch]++; } for (auto &p : char_count) { - if (p.second > 1) { - score -= (p.second - 1) * 3; + if (p > 1) { + score -= (p - 1) * 3; } } diff --git a/src/pinentry/qti18n.cpp b/src/pinentry/qti18n.cpp index 49c27dd3..198e6cc4 100644 --- a/src/pinentry/qti18n.cpp +++ b/src/pinentry/qti18n.cpp @@ -30,7 +30,7 @@ static bool loadCatalog(const QString &catalog, const QLocale &locale) { auto translator = new QTranslator(QCoreApplication::instance()); if (!translator->load(locale, catalog, QString(), - QLibraryInfo::path(QLibraryInfo::TranslationsPath))) { + QLatin1String(":/i18n_qt"))) { qDebug() << "Loading the" << catalog << "catalog failed for locale" << locale; delete translator; diff --git a/src/ui/GpgFrontendUIInit.cpp b/src/ui/GpgFrontendUIInit.cpp index 148402d4..08cf012d 100644 --- a/src/ui/GpgFrontendUIInit.cpp +++ b/src/ui/GpgFrontendUIInit.cpp @@ -33,6 +33,7 @@ #include "core/GpgConstants.h" #include "core/function/CoreSignalStation.h" #include "core/function/GlobalSettingStation.h" +#include "core/model/GpgPassphraseContext.h" #include "core/module/ModuleManager.h" #include "ui/UISignalStation.h" #include "ui/UserInterfaceUtils.h" diff --git a/src/ui/dialog/keypair_details/KeyPairOperaTab.cpp b/src/ui/dialog/keypair_details/KeyPairOperaTab.cpp index 6e4a1df0..74f827aa 100644 --- a/src/ui/dialog/keypair_details/KeyPairOperaTab.cpp +++ b/src/ui/dialog/keypair_details/KeyPairOperaTab.cpp @@ -432,7 +432,12 @@ void KeyPairOperaTab::slot_import_revoke_cert() { } QFile rev_file(rev_file_info.absoluteFilePath()); + +#ifdef QT5_BUILD + if (!rev_file.open(QIODevice::ReadOnly)) { +#else if (!rev_file.open(QIODeviceBase::ReadOnly)) { +#endif QMessageBox::critical( this, tr("Error"), tr("Cannot open this file. Please make sure that this " diff --git a/src/ui/dialog/settings/SettingsDialog.cpp b/src/ui/dialog/settings/SettingsDialog.cpp index a26ddf0b..cb17eb0d 100644 --- a/src/ui/dialog/settings/SettingsDialog.cpp +++ b/src/ui/dialog/settings/SettingsDialog.cpp @@ -137,7 +137,11 @@ auto SettingsDialog::ListLanguages() -> QHash { auto locale = file.mid(start, end - start); QLocale const q_locale(locale); +#ifdef QT5_BUILD + if (q_locale.nativeCountryName().isEmpty()) continue; +#else if (q_locale.nativeTerritoryName().isEmpty()) continue; +#endif auto language = q_locale.nativeLanguageName() + " (" + locale + ")"; languages.insert(q_locale.name(), language); diff --git a/src/ui/main_window/MainWindow.cpp b/src/ui/main_window/MainWindow.cpp index 27634570..a7bd63d8 100644 --- a/src/ui/main_window/MainWindow.cpp +++ b/src/ui/main_window/MainWindow.cpp @@ -32,6 +32,7 @@ #include "core/function/CoreSignalStation.h" #include "core/function/GlobalSettingStation.h" #include "core/function/gpg/GpgAdvancedOperator.h" +#include "core/model/GpgPassphraseContext.h" #include "core/module/ModuleManager.h" #include "ui/UISignalStation.h" #include "ui/main_window/GeneralMainWindow.h" diff --git a/src/ui/widgets/FileTreeView.cpp b/src/ui/widgets/FileTreeView.cpp index b0241b63..7a725e10 100644 --- a/src/ui/widgets/FileTreeView.cpp +++ b/src/ui/widgets/FileTreeView.cpp @@ -67,7 +67,7 @@ void FileTreeView::selectionChanged(const QItemSelection& selected, GF_UI_LOG_DEBUG("file tree view selected target path: {}", selected_path_); emit SignalSelectedChanged(selected_path_); } else { - selected_path_ = {}; + selected_path_ = QString(); if (!this->selectedIndexes().isEmpty()) { selected_path_ = dir_model_->filePath(this->selectedIndexes().front()); emit SignalSelectedChanged(selected_path_); From 07178f643f00a8b2da20ba8beebc4b6dc13b95a0 Mon Sep 17 00:00:00 2001 From: saturneric Date: Wed, 31 Jan 2024 17:19:37 +0800 Subject: [PATCH 4/6] fix: update translations --- resource/lfs/locale/ts/GpgFrontend.de_DE.ts | 138 +++++++++++--------- resource/lfs/locale/ts/GpgFrontend.fr_FR.ts | 28 ++-- resource/lfs/locale/ts/GpgFrontend.it_IT.ts | 28 ++-- resource/lfs/locale/ts/GpgFrontend.zh_CN.ts | 56 ++++---- resource/lfs/locale/ts/GpgFrontend.zh_TW.ts | 28 ++-- src/ui/function/RaisePinentry.cpp | 8 +- 6 files changed, 155 insertions(+), 131 deletions(-) diff --git a/resource/lfs/locale/ts/GpgFrontend.de_DE.ts b/resource/lfs/locale/ts/GpgFrontend.de_DE.ts index e6e52b5c..f43e0d1a 100644 --- a/resource/lfs/locale/ts/GpgFrontend.de_DE.ts +++ b/resource/lfs/locale/ts/GpgFrontend.de_DE.ts @@ -74,7 +74,7 @@ German Encryption Standards - Allgemeine Verschlüsselungsstandards + Deutsche Verschlüsselungsstandards @@ -202,7 +202,7 @@ Subkey - + Unterschlüssel @@ -212,18 +212,18 @@ Key Create Date - + Schlüssel Erstellungsdatum <unknown> - + <unbekannt> Sign Date - + Unterschrift Datum @@ -386,12 +386,12 @@ Tips - + Hinweise Adjust Trust Level to make it Fully Vaild - + Anpassen der Vertrauensstufe, um sie vollständig zu sichern @@ -403,7 +403,7 @@ <unknown> - + <unbekannt> @@ -411,28 +411,28 @@ Sign Date - + Unterschrift Datum Key ID - Schlüssel-ID + Schlüssel-ID Subkey - + Unterschlüssel Primary Key - Primärschlüssel + Primärschlüssel Key Create Date - + Schlüssel Erstellungsdatum (Adjust Trust Level to make it Fully Vaild) @@ -704,7 +704,7 @@ Gpg Operation succeed. - GPG Vorgang abgeschlossen. + Gpg-Verarbeitung erfolgreich. @@ -754,7 +754,7 @@ Beschrei: %3 The target file is too large for a keyring. - + Die Zieldatei ist zu groß für einen Schlüsselring. @@ -1143,7 +1143,7 @@ Beschrei: %3 Calculating - + Berechnen @@ -1226,7 +1226,7 @@ Beschrei: %3 Reveal in File Explorer - + Im Datei-Explorer öffnen @@ -1264,7 +1264,7 @@ This will result in loss of all cached form positions, statuses, key servers, et Use Binary Mode for File Operations - + Binärmodus für Dateioperationen verwenden @@ -1274,7 +1274,7 @@ This will result in loss of all cached form positions, statuses, key servers, et Enable GpgME Debug Log - + GpgME-Debug-Log einschalten @@ -1299,7 +1299,7 @@ This will result in loss of all cached form positions, statuses, key servers, et Restart Gpg Agent on start - + Gpg-Agent beim Start neu starten @@ -1399,22 +1399,22 @@ This will result in loss of all cached form positions, statuses, key servers, et Directories - + Verzeichnisse Options - + Optionen Directory Type - + Verzeichnis Typ Path - + Pfad Configurations @@ -1512,7 +1512,7 @@ This will result in loss of all cached form positions, statuses, key servers, et GpgFrontend is an easy-to-use, compact, cross-platform, and installation-free GnuPG Frontend.It visualizes most of the common operations of GnuPG.GpgFrontend is licensed under the GPLv3 - GpgFrontend ist ein benutzerfreundliches, kompaktes, plattformübergreifendes und installationsfreies GnuPG-Frontend. Es visualisiert die meisten gängigen Operationen von GnuPG. GpgFrontend ist unter der GPLv3 lizenziert. + GpgFrontend ist ein benutzerfreundliches, kompaktes, plattformübergreifendes und installationsfreies GnuPG-Frontend. Es visualisiert die meisten gängigen Operationen von GnuPG. GpgFrontend ist unter der GPLv3 lizenziert. @@ -1808,7 +1808,7 @@ This will result in loss of all cached form positions, statuses, key servers, et New Revocations - + Neue Widerrufe @@ -2339,7 +2339,7 @@ This will result in loss of all cached form positions, statuses, key servers, et The target file is too large for a key package. - + Die Zieldatei ist zu groß für ein Schlüsselpaket. @@ -2354,12 +2354,12 @@ This will result in loss of all cached form positions, statuses, key servers, et The target file is too large for a key package passphrase. - + Die Zieldatei ist zu groß für eine Schlüsselpaket-Passphrase. Importing - + Importieren @@ -2613,7 +2613,7 @@ This will result in loss of all cached form positions, statuses, key servers, et Revoke Certificate Operation - + Zertifikat widerrufen Operation @@ -2643,7 +2643,7 @@ This will result in loss of all cached form positions, statuses, key servers, et Import Revoke Certificate - + Zertifikat importieren widerrufen @@ -2781,45 +2781,45 @@ This will result in loss of all cached form positions, statuses, key servers, et Import Key Revocation Certificate - + Schlüssel-Widerrufs-Zertifikat importieren You are about to import the - + Sie sind dabei, das REVOCATION CERTIFICATE - + Schlüssel-Widerrufs-Zertifikat importieren A successful import will result in the key being irreversibly revoked. - + Ein erfolgreicher Import führt dazu, dass der Schlüssel unwiderruflich widerrufen wird. Do you REALLY want to execute this operation? - + Wollen Sie diesen Vorgang WIRKLICH durchführen? - + Error Fehler - + Cannot open this file. Please make sure that this is a regular file and it's readable. Kann diese Datei nicht öffnen. Bitte stellen Sie sicher, dass es sich um eine reguläre, lesbare Datei handelt. The target file is too large for a key revocation certificate. - + Die Zieldatei ist zu groß für ein Schlüsselwiderrufszertifikat. @@ -3621,13 +3621,13 @@ This will result in loss of all cached form positions, statuses, key servers, et GpgFrontend::UI::MainWindow - - + + Critical error occur while loading GpgFrontend. Beim Laden von GpgFrontend ist ein kritischer Fehler aufgetreten. - + Loading Failed Laden fehlgeschlagen @@ -4838,9 +4838,8 @@ Fals Daten und Signatur in einer Datei COMBINIERT sind, LASSEN SIE DIES LEER: GpgFrontend::UI::RaisePinentry - Repeat PIN: - PIN wiederholen: + PIN wiederholen: @@ -4853,14 +4852,27 @@ Fals Daten und Signatur in einer Datei COMBINIERT sind, LASSEN SIE DIES LEER: Passwortphrase verbergen - Given PIN was wrong. Please retry. - Eingegebene PIN ist ungültig. Bitte erneut versuchen. + Eingegebene PIN ist ungültig. Bitte erneut versuchen. + + + PIN: + PIN: + + + + Repeat Passphrase: + Passphrase wiederholen: + + + + Given Passphrase was wrong. Please retry. + Die angegebene Passphrase war falsch. Bitte versuchen Sie es erneut. - PIN: - PIN: + Passphrase: + Passphrase: @@ -4875,7 +4887,7 @@ Fals Daten und Signatur in einer Datei COMBINIERT sind, LASSEN SIE DIES LEER: Bundled Pinentry - + Eingabe Passphrase Buddled Pinentry @@ -4884,12 +4896,12 @@ Fals Daten und Signatur in einer Datei COMBINIERT sind, LASSEN SIE DIES LEER: Confirm - Bestätigen + Bestätigen Cancel - Abbrechen + Abbrechen @@ -5545,32 +5557,32 @@ Fals Daten und Signatur in einer Datei COMBINIERT sind, LASSEN SIE DIES LEER: Build DateTime: - Build DateTime: + Build DateTime: Build Version: - Build Version: + Build Version: Source Code Version: - Sourcecode Version: + Sourcecode Version: GpgME initiation failed - + GpgME-Initiation fehlgeschlagen GpgME Context initiation failed - + GpgME-Kontext-Initiation fehlgeschlagen Gpg Key Detabase initiation failed - + Gpg Key Detabase initiation fehlgeschlagen @@ -5581,7 +5593,7 @@ Fals Daten und Signatur in einer Datei COMBINIERT sind, LASSEN SIE DIES LEER: Filename - + Dateiname @@ -5598,12 +5610,12 @@ Fals Daten und Signatur in einer Datei COMBINIERT sind, LASSEN SIE DIES LEER: File Size - + Dateigröße Error: cannot read target file - + Fehler: Zieldatei kann nicht gelesen werden @@ -5623,15 +5635,15 @@ Fals Daten und Signatur in einer Datei COMBINIERT sind, LASSEN SIE DIES LEER: Success - + erfolgreich - + Loading Gnupg Info... Gnupg-Info wird geladen... - + If this process is too slow, please set the key server address appropriately in the gnupg configuration file (depending on the network situation in your country or region). Sollte dieser Vorgang zu langsam sein, stellen Sie bitte die Keyserver-Adresse entsprechend in der gnupg-Konfigurationsdatei ein (abhängig von der Netzwerksituation in Ihrem Land oder Ihrer Region). diff --git a/resource/lfs/locale/ts/GpgFrontend.fr_FR.ts b/resource/lfs/locale/ts/GpgFrontend.fr_FR.ts index 5f676fcc..8ae8f7b7 100644 --- a/resource/lfs/locale/ts/GpgFrontend.fr_FR.ts +++ b/resource/lfs/locale/ts/GpgFrontend.fr_FR.ts @@ -2794,13 +2794,13 @@ This will result in loss of all cached form positions, statuses, key servers, et - + Error Erreur - + Cannot open this file. Please make sure that this is a regular file and it's readable. @@ -3609,13 +3609,13 @@ This will result in loss of all cached form positions, statuses, key servers, et GpgFrontend::UI::MainWindow - - + + Critical error occur while loading GpgFrontend. Une erreur critique s'est produite lors du chargement de GpgFrontend. - + Loading Failed Échec du chargement @@ -4820,11 +4820,6 @@ If Data And Signature is COMBINED within a single file, KEEP THIS EMPTY: GpgFrontend::UI::RaisePinentry - - - Repeat PIN: - - Show passphrase @@ -4835,14 +4830,19 @@ If Data And Signature is COMBINED within a single file, KEEP THIS EMPTY: Hide passphrase + + + Repeat Passphrase: + + - Given PIN was wrong. Please retry. + Given Passphrase was wrong. Please retry. - PIN: + Passphrase: @@ -5537,12 +5537,12 @@ If Data And Signature is COMBINED within a single file, KEEP THIS EMPTY: - + Loading Gnupg Info... Chargement des informations sur Gnupg... - + If this process is too slow, please set the key server address appropriately in the gnupg configuration file (depending on the network situation in your country or region). Si ce processus est trop lent, veuillez définir l'adresse du serveur de clés de manière appropriée dans le fichier de configuration gnupg (en fonction de la situation du réseau dans votre pays ou région). diff --git a/resource/lfs/locale/ts/GpgFrontend.it_IT.ts b/resource/lfs/locale/ts/GpgFrontend.it_IT.ts index 4122612a..1024f4a1 100644 --- a/resource/lfs/locale/ts/GpgFrontend.it_IT.ts +++ b/resource/lfs/locale/ts/GpgFrontend.it_IT.ts @@ -2790,13 +2790,13 @@ This will result in loss of all cached form positions, statuses, key servers, et - + Error Errore - + Cannot open this file. Please make sure that this is a regular file and it's readable. @@ -3605,13 +3605,13 @@ This will result in loss of all cached form positions, statuses, key servers, et GpgFrontend::UI::MainWindow - - + + Critical error occur while loading GpgFrontend. Si è verificato un errore critico durante il caricamento di GpgFrontend. - + Loading Failed Caricamento non riuscito @@ -4816,11 +4816,6 @@ If Data And Signature is COMBINED within a single file, KEEP THIS EMPTY: GpgFrontend::UI::RaisePinentry - - - Repeat PIN: - - Show passphrase @@ -4831,14 +4826,19 @@ If Data And Signature is COMBINED within a single file, KEEP THIS EMPTY: Hide passphrase + + + Repeat Passphrase: + + - Given PIN was wrong. Please retry. + Given Passphrase was wrong. Please retry. - PIN: + Passphrase: @@ -5533,12 +5533,12 @@ If Data And Signature is COMBINED within a single file, KEEP THIS EMPTY: - + Loading Gnupg Info... Caricamento informazioni Gnupg... - + If this process is too slow, please set the key server address appropriately in the gnupg configuration file (depending on the network situation in your country or region). Se questo processo è troppo lento, impostare l'indirizzo del server delle chiavi in modo appropriato nel file di configurazione di gnupg (a seconda della situazione della rete nel proprio paese o regione). diff --git a/resource/lfs/locale/ts/GpgFrontend.zh_CN.ts b/resource/lfs/locale/ts/GpgFrontend.zh_CN.ts index 476f3807..a67c2a5e 100644 --- a/resource/lfs/locale/ts/GpgFrontend.zh_CN.ts +++ b/resource/lfs/locale/ts/GpgFrontend.zh_CN.ts @@ -1779,32 +1779,32 @@ This will result in loss of all cached form positions, statuses, key servers, et Imported - 导入 + 导入的密钥 Not Imported - 未导入 + 未导入的密钥 Private Read - 私有且可读 + 读取的私钥 Private Imported - 私有并导入 + 导入的私钥 Private Unchanged - 私有未变更 + 未变更的私钥 New Revocations - + 新的吊销 @@ -2331,22 +2331,22 @@ This will result in loss of all cached form positions, statuses, key servers, et The target file is too large for a key package. - + 目标文件对于密钥包来说太大。 Import Key Package Passphrase File - 导入密钥包密码文件 + 导入密钥包口令文件 Key Package Passphrase File - 密钥包密码文件 + 密钥包口令文件 The target file is too large for a key package passphrase. - + 目标文件对于密钥包口令来说太大。 @@ -2798,13 +2798,13 @@ This will result in loss of all cached form positions, statuses, key servers, et - + Error 错误 - + Cannot open this file. Please make sure that this is a regular file and it's readable. 无法打开此文件。请确保这是一个普通文件,并且有读取权限。 @@ -3613,13 +3613,13 @@ This will result in loss of all cached form positions, statuses, key servers, et GpgFrontend::UI::MainWindow - - + + Critical error occur while loading GpgFrontend. 加载 GpgFrontend 时发生严重错误。 - + Loading Failed 加载失败 @@ -4826,9 +4826,8 @@ If Data And Signature is COMBINED within a single file, KEEP THIS EMPTY: GpgFrontend::UI::RaisePinentry - Repeat PIN: - 重复密码: + 重复密码: @@ -4841,13 +4840,26 @@ If Data And Signature is COMBINED within a single file, KEEP THIS EMPTY: 隐藏密码 - Given PIN was wrong. Please retry. - 所给的密码有误,请重新输入。 + 所给的密码有误,请重新输入。 + + + PIN: + 密码: + + + + Repeat Passphrase: + 重新输入密码: + + + + Given Passphrase was wrong. Please retry. + 密码错误。请重试。 - PIN: + Passphrase: 密码: @@ -5546,12 +5558,12 @@ If Data And Signature is COMBINED within a single file, KEEP THIS EMPTY: 源代码版本: - + Loading Gnupg Info... 正在加载 Gnupg 信息... - + If this process is too slow, please set the key server address appropriately in the gnupg configuration file (depending on the network situation in your country or region). 如果此过程太慢,请在 gnupg 配置文件中适当设置密钥服务器地址(取决于您所在国家或地区的网络情况)。 diff --git a/resource/lfs/locale/ts/GpgFrontend.zh_TW.ts b/resource/lfs/locale/ts/GpgFrontend.zh_TW.ts index b94379ff..989a19e8 100644 --- a/resource/lfs/locale/ts/GpgFrontend.zh_TW.ts +++ b/resource/lfs/locale/ts/GpgFrontend.zh_TW.ts @@ -2790,13 +2790,13 @@ This will result in loss of all cached form positions, statuses, key servers, et - + Error 錯誤 - + Cannot open this file. Please make sure that this is a regular file and it's readable. @@ -3605,13 +3605,13 @@ This will result in loss of all cached form positions, statuses, key servers, et GpgFrontend::UI::MainWindow - - + + Critical error occur while loading GpgFrontend. 加載 GpgFrontend 時發生嚴重錯誤。 - + Loading Failed 加載失敗 @@ -4816,11 +4816,6 @@ If Data And Signature is COMBINED within a single file, KEEP THIS EMPTY: GpgFrontend::UI::RaisePinentry - - - Repeat PIN: - - Show passphrase @@ -4831,14 +4826,19 @@ If Data And Signature is COMBINED within a single file, KEEP THIS EMPTY: Hide passphrase + + + Repeat Passphrase: + + - Given PIN was wrong. Please retry. + Given Passphrase was wrong. Please retry. - PIN: + Passphrase: @@ -5533,12 +5533,12 @@ If Data And Signature is COMBINED within a single file, KEEP THIS EMPTY: - + Loading Gnupg Info... 正在加載 Gnupg 信息... - + If this process is too slow, please set the key server address appropriately in the gnupg configuration file (depending on the network situation in your country or region). 如果此過程太慢,請在 gnupg 組態檔案中適當設定金鑰伺服器位址(取決於您所在國家或地區的網絡情況)。 diff --git a/src/ui/function/RaisePinentry.cpp b/src/ui/function/RaisePinentry.cpp index 216712e8..7c68d67c 100644 --- a/src/ui/function/RaisePinentry.cpp +++ b/src/ui/function/RaisePinentry.cpp @@ -64,17 +64,17 @@ auto RaisePinentry::Exec() -> int { auto* pinentry = new PinEntryDialog(FindTopMostWindow(this), 0, 15, true, ask_for_new, - ask_for_new ? tr("Repeat PIN:") : QString(), + ask_for_new ? tr("Repeat Passphrase:") : QString(), tr("Show passphrase"), tr("Hide passphrase")); if (context_->IsPreWasBad()) { - pinentry->setError(tr("Given PIN was wrong. Please retry.")); + pinentry->setError(tr("Given Passphrase was wrong. Please retry.")); } - pinentry->setPrompt(tr("PIN:")); + pinentry->setPrompt(tr("Passphrase:")); if (!context_->GetUidsInfo().isEmpty()) { - pinentry->setDescription(QString("Please provide PIN of Key:\n%1\n") + pinentry->setDescription(QString("Please provide Passphrase of Key:\n%1\n") .arg(context_->GetUidsInfo())); } From a0b4f5280e36ff402d8aca27acdf2dea1df7873f Mon Sep 17 00:00:00 2001 From: saturneric Date: Wed, 31 Jan 2024 17:27:23 +0800 Subject: [PATCH 5/6] fix: update ci configure --- .github/workflows/release-qt5.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-qt5.yml b/.github/workflows/release-qt5.yml index 00ec531e..2a9336a1 100644 --- a/.github/workflows/release-qt5.yml +++ b/.github/workflows/release-qt5.yml @@ -1,4 +1,4 @@ -name: Build & Package +name: Build & Package Qt5 on: push: @@ -31,7 +31,7 @@ jobs: run: | git config --global core.autocrlf false git config --global core.eol lf - if: matrix.os == 'windows-2019' || matrix.os == 'macos-11' || matrix.os == 'macos-12' + if: matrix.os == 'windows-2019' - uses: actions/checkout@v3 with: From ea2262575149cb79509377107b6f0d6017ec3821 Mon Sep 17 00:00:00 2001 From: saturneric Date: Wed, 31 Jan 2024 19:15:39 +0800 Subject: [PATCH 6/6] fix: copy qt5 dlls at qt5 build mode --- src/CMakeLists.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a464b4c3..e47e2bae 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -285,7 +285,13 @@ if (BUILD_APPLICATION) list(APPEND ALL_RUNTIME_DEP_PATH_LIST ${_libExEPath}) set(ALL_RUNTIME_DLL_FILES "") - list(APPEND ALL_RUNTIME_DLL_FILES "Qt6Core.dll;Qt6Core5Compat.dll;Qt6Gui.dll;Qt6Network.dll;Qt6PrintSupport.dll;Qt6Svg.dll;Qt6Widgets.dll;libbrotlicommon.dll;libbrotlidec.dll;libdouble-conversion.dll;libzstd.dll;libmd4c.dll;") + + if(GPGFRONTEND_QT5_BUILD) + list(APPEND ALL_RUNTIME_DLL_FILES "Qt5Core.dll;Qt5Gui.dll;Qt5Network.dll;Qt5PrintSupport.dll;Qt5Svg.dll;Qt5Widgets.dll;libbrotlicommon.dll;libbrotlidec.dll;libdouble-conversion.dll;libzstd.dll;libmd4c.dll;") + else() + list(APPEND ALL_RUNTIME_DLL_FILES "Qt6Core.dll;Qt6Core5Compat.dll;Qt6Gui.dll;Qt6Network.dll;Qt6PrintSupport.dll;Qt6Svg.dll;Qt6Widgets.dll;libbrotlicommon.dll;libbrotlidec.dll;libdouble-conversion.dll;libzstd.dll;libmd4c.dll;") + endif() + # find the other dlls foreach (_dllFileName ${ALL_RUNTIME_DLL_FILES}) message(STATUS "DLL FILE ${_dllFileName}")