aboutsummaryrefslogtreecommitdiffstats
path: root/src/server/ComUtils.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/ComUtils.h')
-rw-r--r--src/server/ComUtils.h77
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