diff options
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rw-r--r-- | README.md | 51 | ||||
-rw-r--r-- | include/GpgFrontend.h | 8 | ||||
-rw-r--r-- | src/gpg/GpgContext.cpp | 30 | ||||
-rw-r--r-- | src/main.cpp | 2 |
5 files changed, 57 insertions, 36 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 67b3245e..163b03ea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.19) -project(GPGFrontend VERSION 1.0.0 LANGUAGES CXX) +project(GpgFrontend VERSION 1.0.0 LANGUAGES CXX) message(STATUS "GPGFrontend Build Configuration Started CMAKE Version ${CMAKE_VERSION}") @@ -1,15 +1,16 @@ -GPG Frontend ---- -GPGFrontend is a modern, easy-to-use, compact, cross-platform, and installation-free gpg front-end tool. By using -GPGFrontend, you can quickly **encrypt and decrypt text or files**. Or at the same time as the above operations, you can add +# Gpg Frontend + +GpgFrontend is a modern, easy-to-use, compact, cross-platform, and installation-free gpg front-end tool. By using +GpgFrontend, you can quickly **encrypt and decrypt text or files**. Or at the same time as the above operations, you can +add **your own signature** to let others know that this document or this paragraph of text was issued by you. Furthermore, it visualizes most of the common operations of gpg commands. It aims to allow ordinary users to quickly use -gpg and make professional users more convenient. GPGFrontend supports some new features of OpenPGP. +gpg and make professional users more convenient. GpgFrontend supports some new features of OpenPGP.  -# Features +## Features - Open source, free, no need to install. - Can run on Windows, Linux and macOS. @@ -17,41 +18,43 @@ gpg and make professional users more convenient. GPGFrontend supports some new f - Before use, you only need to install gnupg. A tiny tool of a few MB. - Supports multiple languages. Don’t forget to help me translate this software. -How to Use it ---------- +## How to Use it 0. Install gnupg. To check if it is installed, you can enter gpg on the command line. - For Windows User, Click [this link](https://gnupg.org/ftp/gcrypt/binary/gnupg-w32-2.3.1_20210420.exe) to download gnupg. - For macOS User, Use [Homebrew](https://brew.sh/) to install **gpg**. - For Linux User, Use the package manager(e.g., apt, yum, pacman) to install **gpg**. -1. Unzip gpgfrontend.zip. The compressed package can be downloaded in Release. -2. Start GpgFrontend with gpgfrontend.exe or gpgfrontend (depending on your os). +1. Unzip GpgFrontend.zip. The compressed package can be downloaded in Release. +2. Start GpgFrontend with GpgFrontend.exe or GpgFrontend (depending on your os). + +## Purpose -Purpose ------ -The GPGFrontend project inherit from a relatively mature but not maintained gpg4usb project. It inherits the stable, +The GpgFrontend project inherit from a relatively mature but not maintained gpg4usb project. It inherits the stable, easy-to-use, compact, and installation-free features of gpg4usb, and plans to support some new features of OpenPGP based on it and continue to improve it. -GPGFrontend will add more functions in the future to improve the ease of use of GPG in end-to-end transmission. At the +GpgFrontend will add more functions in the future to improve the ease of use of GPG in end-to-end transmission. At the same time, the addition of new functions does not affect the old basic functions. My personal strength is always -limited. GPGFrontend welcomes volunteers to join. You can use the GitHub platform to file an issue, or submit a pull +limited. GpgFrontend welcomes volunteers to join. You can use the GitHub platform to file an issue, or submit a pull request. -The GPGFrontend project is as open source, and it also insists on using open source codes and libraries. +The GpgFrontend project is as open source, and it also insists on using open source codes and libraries. -How to Build it ---------- +## How to Build it The tutorial for building the software will be released shortly. -Contract -------- +## Contract + If you have any questions, please open an issue. If you want to contact me individually, you can email [email protected]. -LICENSES --------- + +## LOGO + + +## LICENSES + GpgFrontend itself is licensed under the GPLv3 (see COPYING). There are some libraries, and the gpg-binary included in the zip-file / a static gpg-build which (may) have different @@ -61,6 +64,6 @@ GPG: http://gnupg.org/ QT: http://trolltech.no/ , http://trolltech.no/downloads/opensource The icons of this software use materials from Alibaba vector icon library. The Alibaba vector icon library is free to -use. The icons in the free library aren't registered as trademarks. There is no copyright issue involved and can be -used commercially. +use. The icons in the free library aren't registered as trademarks. There is no copyright issue involved and can be used +commercially. diff --git a/include/GpgFrontend.h b/include/GpgFrontend.h index fcad90af..014647fb 100644 --- a/include/GpgFrontend.h +++ b/include/GpgFrontend.h @@ -16,17 +16,17 @@ #include <gpgme.h> -#define PROJECT_NAME "GPGFrontend" +#define PROJECT_NAME "GpgFrontend" #define BUILD_VERSION "1.0.0_Windows-10.0.19042_AMD64_Debug" -#define GIT_VERSION "develop_55316c75051e1b488f05a57c4d4a7695bb178322" +#define GIT_VERSION "develop_80f0dcfb8ea78ac64960079f4a95eb3cbeb0af49" #define VERSION_MAJOR 1 #define VERSION_MINOR 0 #define VERSION_PATCH 0 -#define BUILD_TIMESTAMP "2021-06-19 18:07:40" +#define BUILD_TIMESTAMP "2021-06-19 19:27:52" #define GIT_BRANCH_NAME "develop" -#define GIT_COMMIT_HASH "55316c75051e1b488f05a57c4d4a7695bb178322" +#define GIT_COMMIT_HASH "80f0dcfb8ea78ac64960079f4a95eb3cbeb0af49" #endif //GPGFRONTEND_H_IN diff --git a/src/gpg/GpgContext.cpp b/src/gpg/GpgContext.cpp index 962ebaf4..62d7a246 100644 --- a/src/gpg/GpgContext.cpp +++ b/src/gpg/GpgContext.cpp @@ -28,7 +28,9 @@ #include <Mime.h> #ifdef _WIN32 + #include <windows.h> + #endif #define INT2VOIDP(i) (void*)(uintptr_t)(i) @@ -47,14 +49,9 @@ namespace GpgME { * subsystem in GPGME. (from the info page) */ gpgme_check_version(nullptr); - // TODO: Set gpgme_language to config - /*QSettings qSettings; - qDebug() << " - " << qSettings.value("int/lang").toLocale().name(); - qDebug() << " - " << QLocale(qSettings.value("int/lang").toString()).name();*/ - // the locale set here is used for the other setlocale calls which have nullptr // -> nullptr means use default, which is configured here - setlocale(LC_ALL, ""); + setlocale(LC_ALL, settings.value("int/lang").toLocale().name().toUtf8().constData()); /** set locale, because tests do also */ gpgme_set_locale(nullptr, LC_CTYPE, setlocale(LC_CTYPE, nullptr)); @@ -69,12 +66,33 @@ namespace GpgME { gpgme_engine_info_t engineInfo; engineInfo = gpgme_ctx_get_engine_info(mCtx); + // Check ENV before running + bool check_pass = false, find_openpgp = false, find_gpgconf = false, find_assuan = false, find_cms = false; while (engineInfo != nullptr) { qDebug() << gpgme_get_protocol_name(engineInfo->protocol) << engineInfo->file_name << engineInfo->protocol << engineInfo->home_dir << engineInfo->version; + if (engineInfo->protocol == GPGME_PROTOCOL_GPGCONF && strcmp(engineInfo->version, "1.0.0") != 0) + find_gpgconf = true; + if (engineInfo->protocol == GPGME_PROTOCOL_OpenPGP && strcmp(engineInfo->version, "1.0.0") != 0) + find_openpgp = true; + if (engineInfo->protocol == GPGME_PROTOCOL_CMS && strcmp(engineInfo->version, "1.0.0") != 0) + find_cms = true; + if (engineInfo->protocol == GPGME_PROTOCOL_ASSUAN) + find_assuan = true; + engineInfo = engineInfo->next; } + if (find_gpgconf && find_openpgp && find_cms && find_assuan) + check_pass = true; + + if (!check_pass) { + QMessageBox::critical(nullptr, tr("ENV Loading Failed"), + tr("Gnupg is not installed correctly, please follow the ReadME instructions to install gnupg and then open GPGFrontend.")); + QCoreApplication::quit(); + exit(0); + } + /** Setting the output type must be done at the beginning */ /** think this means ascii-armor --> ? */ gpgme_set_armor(mCtx, 1); diff --git a/src/main.cpp b/src/main.cpp index b2aca517..e9e975d9 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -34,7 +34,7 @@ int main(int argc, char *argv[]) { QString appPath = qApp->applicationDirPath(); QApplication::setApplicationVersion(BUILD_VERSION); - QApplication::setApplicationName("GPGFrontend"); + QApplication::setApplicationName(PROJECT_NAME); // dont show icons in menus QApplication::setAttribute(Qt::AA_DontShowIconsInMenus); |