diff options
author | Saturneric <[email protected]> | 2021-12-01 17:25:46 +0000 |
---|---|---|
committer | Saturneric <[email protected]> | 2021-12-01 17:53:09 +0000 |
commit | 1ae8663decb3163b92d32b80cefb46eb678a5af6 (patch) | |
tree | 8e8cb58cacfe12827438b0524917cb0926f926cb /src/server/ComUtils.h | |
parent | Add & Modified (diff) | |
download | GpgFrontend-1ae8663decb3163b92d32b80cefb46eb678a5af6.tar.gz GpgFrontend-1ae8663decb3163b92d32b80cefb46eb678a5af6.zip |
Add i18n Support
1. Remove Qt Linguist.
2. Add GNU gettext libraries.
3. Modified source codes to meet with i18n support.
Diffstat (limited to '')
-rw-r--r-- | src/server/ComUtils.h | 77 |
1 files changed, 41 insertions, 36 deletions
diff --git a/src/server/ComUtils.h b/src/server/ComUtils.h index 1f71f2e6..f281f256 100644 --- a/src/server/ComUtils.h +++ b/src/server/ComUtils.h @@ -1,7 +1,7 @@ /** - * This file is part of GPGFrontend. + * This file is part of GpgFrontend. * - * GPGFrontend is free software: you can redistribute it and/or modify + * 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. @@ -31,53 +31,58 @@ namespace GpgFrontend { - class ComUtils : public QWidget { - Q_OBJECT - public: - - enum ServiceType { GetServiceToken, ShortenCryptText, GetFullCryptText, UploadPubkey, GetPubkey }; - - explicit ComUtils(QWidget *parent) : QWidget(parent), appPath(qApp->applicationDirPath()), +class ComUtils : public QWidget { + Q_OBJECT + public: + enum ServiceType { + GetServiceToken, + ShortenCryptText, + GetFullCryptText, + UploadPubkey, + GetPubkey + }; + + explicit ComUtils(QWidget *parent) + : QWidget(parent), + appPath(qApp->applicationDirPath()), settings(RESOURCE_DIR(appPath) + "/conf/gpgfrontend.ini", - QSettings::IniFormat) { - - } - - [[nodiscard]] QString getUrl(ServiceType type) const; - - bool checkServerReply(const QByteArray &reply); + QSettings::IniFormat) {} - [[nodiscard]] QString getDataValueStr(const QString &key) const; + [[nodiscard]] QString getUrl(ServiceType type) const; - [[nodiscard]] bool checkDataValueStr(const QString &key) const; + bool checkServerReply(const QByteArray &reply); - [[nodiscard]] const rapidjson::Value &getDataValue(const QString &key) const; + [[nodiscard]] QString getDataValueStr(const QString &key) const; - [[nodiscard]] bool checkDataValue(const QString &key) const; + [[nodiscard]] bool checkDataValueStr(const QString &key) const; - [[nodiscard]] bool checkServiceTokenFormat(const QString& serviceToken) const; + [[nodiscard]] const rapidjson::Value &getDataValue(const QString &key) const; - static QByteArray getSignStringBase64(GpgFrontend::GpgContext *ctx, const QString &str, const GpgKey& key); + [[nodiscard]] bool checkDataValue(const QString &key) const; - [[nodiscard]] bool good() const { return is_good; } + [[nodiscard]] bool checkServiceTokenFormat(const QString &serviceToken) const; - QNetworkAccessManager &getNetworkManager() {return networkMgr;} + static QByteArray getSignStringBase64(GpgFrontend::GpgContext *ctx, + const QString &str, const GpgKey &key); - void clear(); + [[nodiscard]] bool good() const { return is_good; } - private: + QNetworkAccessManager &getNetworkManager() { return networkMgr; } - QString appPath; - QSettings settings; - rapidjson::Document replyDoc; - rapidjson::Value dataVal; - QNetworkAccessManager networkMgr; - QRegularExpression re_uuid{R"(\b[0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12}\b)"}; + void clear(); - bool is_good = false; - }; + private: + QString appPath; + QSettings settings; + rapidjson::Document replyDoc; + rapidjson::Value dataVal; + QNetworkAccessManager networkMgr; + QRegularExpression re_uuid{ + R"(\b[0-9a-f]{8}\b-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-\b[0-9a-f]{12}\b)"}; -} + bool is_good = false; +}; +} // namespace GpgFrontend -#endif //GPGFRONTEND_ZH_CN_TS_COMUTILS_H +#endif // GPGFRONTEND_ZH_CN_TS_COMUTILS_H |