From 95997d27106daf91336847f50efaaa32279b7fc7 Mon Sep 17 00:00:00 2001 From: saturneric Date: Mon, 16 Oct 2023 17:54:05 +0800 Subject: fix: check and update copyright at files --- src/core/function/DataObjectOperator.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/core/function/DataObjectOperator.h') diff --git a/src/core/function/DataObjectOperator.h b/src/core/function/DataObjectOperator.h index ae5dc62c..f02551a8 100644 --- a/src/core/function/DataObjectOperator.h +++ b/src/core/function/DataObjectOperator.h @@ -1,5 +1,5 @@ /** - * Copyright (C) 2021 Saturneric + * Copyright (C) 2021 Saturneric * * This file is part of GpgFrontend. * @@ -20,7 +20,7 @@ * the gpg4usb project, which is under GPL-3.0-or-later. * * All the source code of GpgFrontend was modified and released by - * Saturneric starting on May 12, 2021. + * Saturneric starting on May 12, 2021. * * SPDX-License-Identifier: GPL-3.0-or-later * -- cgit v1.2.3 From 8fdeb3af49999f29e017b7f7a70bd36f020ba721 Mon Sep 17 00:00:00 2001 From: saturneric Date: Mon, 23 Oct 2023 18:27:25 +0800 Subject: perf: reduce header includes and improve build speed --- src/core/function/DataObjectOperator.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/core/function/DataObjectOperator.h') diff --git a/src/core/function/DataObjectOperator.h b/src/core/function/DataObjectOperator.h index f02551a8..134d9044 100644 --- a/src/core/function/DataObjectOperator.h +++ b/src/core/function/DataObjectOperator.h @@ -26,8 +26,11 @@ * */ -#ifndef GPGFRONTEND_DATAOBJECTOPERATOR_H -#define GPGFRONTEND_DATAOBJECTOPERATOR_H +#pragma once + +#include +#include +#include #include "core/GpgFunctionObject.h" #include "core/function/GlobalSettingStation.h" @@ -76,5 +79,3 @@ class GPGFRONTEND_CORE_EXPORT DataObjectOperator }; } // namespace GpgFrontend - -#endif // GPGFRONTEND_DATAOBJECTOPERATOR_H -- cgit v1.2.3 From 0251f35c93e3f0e0a6853a50fb5bd82c1b9e4187 Mon Sep 17 00:00:00 2001 From: saturneric Date: Mon, 6 Nov 2023 17:17:47 +0800 Subject: refactor: clean up core's codes --- src/core/function/DataObjectOperator.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/core/function/DataObjectOperator.h') diff --git a/src/core/function/DataObjectOperator.h b/src/core/function/DataObjectOperator.h index 134d9044..b30bce83 100644 --- a/src/core/function/DataObjectOperator.h +++ b/src/core/function/DataObjectOperator.h @@ -32,8 +32,8 @@ #include #include -#include "core/GpgFunctionObject.h" #include "core/function/GlobalSettingStation.h" +#include "core/function/basic/GpgFunctionObject.h" namespace GpgFrontend { -- cgit v1.2.3 From 3ad7fecdb6458fdd6f146bed19fe643c7f93e905 Mon Sep 17 00:00:00 2001 From: saturneric Date: Tue, 7 Nov 2023 15:18:06 +0800 Subject: refactor: remove CommonUtils at core --- src/core/function/DataObjectOperator.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/core/function/DataObjectOperator.h') diff --git a/src/core/function/DataObjectOperator.h b/src/core/function/DataObjectOperator.h index b30bce83..06455211 100644 --- a/src/core/function/DataObjectOperator.h +++ b/src/core/function/DataObjectOperator.h @@ -48,11 +48,13 @@ class GPGFRONTEND_CORE_EXPORT DataObjectOperator explicit DataObjectOperator( int channel = SingletonFunctionObject::GetDefaultChannel()); - std::string SaveDataObj(const std::string &_key, const nlohmann::json &value); + auto SaveDataObj(const std::string &_key, const nlohmann::json &value) + -> std::string; - std::optional GetDataObject(const std::string &_key); + auto GetDataObject(const std::string &_key) -> std::optional; - std::optional GetDataObjectByRef(const std::string &_ref); + auto GetDataObjectByRef(const std::string &_ref) + -> std::optional; private: /** -- cgit v1.2.3 From bf538056b24a68b8fd235b1c50991ee8eb46a776 Mon Sep 17 00:00:00 2001 From: saturneric Date: Fri, 12 Jan 2024 14:02:37 +0800 Subject: refactor: use QString instead of std::string and improve threading system --- src/core/function/DataObjectOperator.h | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'src/core/function/DataObjectOperator.h') diff --git a/src/core/function/DataObjectOperator.h b/src/core/function/DataObjectOperator.h index 06455211..a262bfc2 100644 --- a/src/core/function/DataObjectOperator.h +++ b/src/core/function/DataObjectOperator.h @@ -28,7 +28,6 @@ #pragma once -#include #include #include @@ -48,13 +47,11 @@ class GPGFRONTEND_CORE_EXPORT DataObjectOperator explicit DataObjectOperator( int channel = SingletonFunctionObject::GetDefaultChannel()); - auto SaveDataObj(const std::string &_key, const nlohmann::json &value) - -> std::string; + auto SaveDataObj(const QString &_key, const nlohmann::json &value) -> QString; - auto GetDataObject(const std::string &_key) -> std::optional; + auto GetDataObject(const QString &_key) -> std::optional; - auto GetDataObjectByRef(const std::string &_ref) - -> std::optional; + auto GetDataObjectByRef(const QString &_ref) -> std::optional; private: /** @@ -75,9 +72,7 @@ class GPGFRONTEND_CORE_EXPORT DataObjectOperator ///< object is ///< stored - std::random_device rd_; ///< Random device - std::mt19937 mt_ = std::mt19937(rd_()); ///< Mersenne twister - QByteArray hash_key_; ///< Hash key + QByteArray hash_key_; ///< Hash key }; } // namespace GpgFrontend -- cgit v1.2.3 From 6983b5c1dd82d159236ebd06cf17f071cc9c1ee9 Mon Sep 17 00:00:00 2001 From: saturneric Date: Fri, 12 Jan 2024 23:08:38 +0800 Subject: refactor: remove boost and use QString instead of std::filesystem::path --- src/core/function/DataObjectOperator.h | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'src/core/function/DataObjectOperator.h') diff --git a/src/core/function/DataObjectOperator.h b/src/core/function/DataObjectOperator.h index a262bfc2..3d0606d6 100644 --- a/src/core/function/DataObjectOperator.h +++ b/src/core/function/DataObjectOperator.h @@ -62,15 +62,16 @@ class GPGFRONTEND_CORE_EXPORT DataObjectOperator GlobalSettingStation &global_setting_station_ = GlobalSettingStation::GetInstance(); ///< GlobalSettingStation - std::filesystem::path app_secure_path_ = - global_setting_station_.GetAppConfigPath() / - "secure"; ///< Where sensitive information is stored - std::filesystem::path app_secure_key_path_ = - app_secure_path_ / "app.key"; ///< Where the key of data object is stored - std::filesystem::path app_data_objs_path_ = - global_setting_station_.GetAppDataPath() / "data_objs"; ///< Where data - ///< object is - ///< stored + QString app_secure_path_ = + global_setting_station_.GetAppConfigPath() + + "/secure"; ///< Where sensitive information is stored + QString app_secure_key_path_ = + app_secure_path_ + + "/app.key"; ///< Where the key of data object is stored + QString app_data_objs_path_ = + global_setting_station_.GetAppDataPath() + "/data_objs"; ///< Where data + ///< object is + ///< stored QByteArray hash_key_; ///< Hash key }; -- cgit v1.2.3 From 6c632d70b391f8b317c68f7db8cfd217f9370995 Mon Sep 17 00:00:00 2001 From: saturneric Date: Mon, 15 Jan 2024 17:22:32 +0800 Subject: feat: use qt json support components in data object and infos gathering module --- src/core/function/DataObjectOperator.h | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'src/core/function/DataObjectOperator.h') diff --git a/src/core/function/DataObjectOperator.h b/src/core/function/DataObjectOperator.h index 3d0606d6..992b0c46 100644 --- a/src/core/function/DataObjectOperator.h +++ b/src/core/function/DataObjectOperator.h @@ -28,7 +28,6 @@ #pragma once -#include #include #include "core/function/GlobalSettingStation.h" @@ -47,11 +46,11 @@ class GPGFRONTEND_CORE_EXPORT DataObjectOperator explicit DataObjectOperator( int channel = SingletonFunctionObject::GetDefaultChannel()); - auto SaveDataObj(const QString &_key, const nlohmann::json &value) -> QString; + auto SaveDataObj(const QString &_key, const QJsonDocument &value) -> QString; - auto GetDataObject(const QString &_key) -> std::optional; + auto GetDataObject(const QString &_key) -> std::optional; - auto GetDataObjectByRef(const QString &_ref) -> std::optional; + auto GetDataObjectByRef(const QString &_ref) -> std::optional; private: /** @@ -69,9 +68,7 @@ class GPGFRONTEND_CORE_EXPORT DataObjectOperator app_secure_path_ + "/app.key"; ///< Where the key of data object is stored QString app_data_objs_path_ = - global_setting_station_.GetAppDataPath() + "/data_objs"; ///< Where data - ///< object is - ///< stored + global_setting_station_.GetAppDataPath() + "/data_objs"; QByteArray hash_key_; ///< Hash key }; -- cgit v1.2.3 From d54f52ce70cba15f5199e93d3c6fb122143b0526 Mon Sep 17 00:00:00 2001 From: saturneric Date: Tue, 16 Jan 2024 01:02:40 +0800 Subject: refactor: remove libconfig++ form project --- src/core/function/DataObjectOperator.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/core/function/DataObjectOperator.h') diff --git a/src/core/function/DataObjectOperator.h b/src/core/function/DataObjectOperator.h index 992b0c46..fedbd905 100644 --- a/src/core/function/DataObjectOperator.h +++ b/src/core/function/DataObjectOperator.h @@ -62,7 +62,7 @@ class GPGFRONTEND_CORE_EXPORT DataObjectOperator GlobalSettingStation &global_setting_station_ = GlobalSettingStation::GetInstance(); ///< GlobalSettingStation QString app_secure_path_ = - global_setting_station_.GetAppConfigPath() + + global_setting_station_.GetAppDataPath() + "/secure"; ///< Where sensitive information is stored QString app_secure_key_path_ = app_secure_path_ + -- cgit v1.2.3