diff options
author | Saturneric <[email protected]> | 2022-01-12 14:57:14 +0000 |
---|---|---|
committer | Saturneric <[email protected]> | 2022-01-12 14:57:14 +0000 |
commit | 1b18bc1457ddc5165430a81e34cb40a1dd29d6b4 (patch) | |
tree | 1f960754e26e442bc811930175e5a19de1456eb8 /src/ui/data_struct/SettingsObject.h | |
parent | <refactor>(ui): Refactoring some settings based on encrypted object settings ... (diff) | |
download | GpgFrontend-1b18bc1457ddc5165430a81e34cb40a1dd29d6b4.tar.gz GpgFrontend-1b18bc1457ddc5165430a81e34cb40a1dd29d6b4.zip |
<refactor, fix>(ui): Refactored settings object to fix issues.
1. Fixed the problem of duplicate storage of unnamed settings objects.
2. Rename the settings object.
Diffstat (limited to 'src/ui/data_struct/SettingsObject.h')
-rw-r--r-- | src/ui/data_struct/SettingsObject.h | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/ui/data_struct/SettingsObject.h b/src/ui/data_struct/SettingsObject.h new file mode 100644 index 00000000..af63b74f --- /dev/null +++ b/src/ui/data_struct/SettingsObject.h @@ -0,0 +1,51 @@ +/** + * This file is part of GpgFrontend. + * + * 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. + * + * Foobar is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Foobar. If not, see <https://www.gnu.org/licenses/>. + * + * The initial version of the source code is inherited from gpg4usb-team. + * Their source code version also complies with GNU General Public License. + * + * The source code version of this software was modified and released + * by Saturneric<[email protected]> starting on May 12, 2021. + * + */ + +#ifndef GPGFRONTEND_SETTINGSOBJECT_H +#define GPGFRONTEND_SETTINGSOBJECT_H + +#include <utility> + +#include "ui/settings/GlobalSettingStation.h" + +namespace GpgFrontend::UI { + +class SettingsObject : public nlohmann::json { + public: + explicit SettingsObject(std::string settings_name); + + explicit SettingsObject(nlohmann::json _sub_json, bool); + + ~SettingsObject(); + + nlohmann::json& Check(const std::string& key, nlohmann::json default_value); + + SettingsObject Check(const std::string& key); + + private: + std::string settings_name_; +}; +} // namespace GpgFrontend::UI + +#endif // GPGFRONTEND_SETTINGSOBJECT_H |