From 7c963381f5a9cb901b9727cafacd76997a4022cc Mon Sep 17 00:00:00 2001 From: Skarn Date: Fri, 11 Feb 2022 21:20:19 +0300 Subject: [PATCH] Update cmake, SettingsEntry.cpp, and SettingsEntry.hpp --- cmake | 2 +- .../Configuration/SettingsEntry.cpp | 6 ++ .../Configuration/SettingsEntry.hpp | 69 +++++++++++++++++++ 3 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 src/noggit/application/Configuration/SettingsEntry.cpp create mode 100644 src/noggit/application/Configuration/SettingsEntry.hpp diff --git a/cmake b/cmake index de8a3b94..c4e9d83c 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit de8a3b94ba7d40becf5a647e5d429ebeeeab64ba +Subproject commit c4e9d83cb2da9bf250a1a3443e02e7303dfc9c84 diff --git a/src/noggit/application/Configuration/SettingsEntry.cpp b/src/noggit/application/Configuration/SettingsEntry.cpp new file mode 100644 index 00000000..f745d5fa --- /dev/null +++ b/src/noggit/application/Configuration/SettingsEntry.cpp @@ -0,0 +1,6 @@ +// This file is part of Noggit3, licensed under GNU General Public License (version 3). + +#include "SettingsEntry.hpp" + +using namespace Noggit::Application::Configuration; + diff --git a/src/noggit/application/Configuration/SettingsEntry.hpp b/src/noggit/application/Configuration/SettingsEntry.hpp new file mode 100644 index 00000000..31a459c0 --- /dev/null +++ b/src/noggit/application/Configuration/SettingsEntry.hpp @@ -0,0 +1,69 @@ +// This file is part of Noggit3, licensed under GNU General Public License (version 3). + +#ifndef NOGGIT_SETTINGSENTRY_HPP +#define NOGGIT_SETTINGSENTRY_HPP + +#include +#include +#include + +#include + +class QJsonObject; +class QWidget; + +namespace Noggit::Application::Configuration +{ + + using filepath = std::string; + + enum class SettingsEntryType + { + FILE_PATH, + DIR_PATH, + STRING, + COLOR_RGB, + COLOR_RGBA, + DOUBLE, + INT, + BOOL + }; + + enum class SettingsEntryDataType + { + STRING, + DOUBLE, + COLOR, + INT, + BOOL + }; + + + class SettingsEntry : public QObject + { + Q_OBJECT + public: + SettingsEntry() = default; + + virtual QWidget* createWidget(QWidget* parent) = 0; + virtual QJsonObject valueToJson() = 0; + virtual void valueFromJson(QJsonObject const& json_obj) = 0; + + //ValueType value() { return _value; }; + //void setValue(ValueType value) { _value = value; emit valueChanged(_type, &_value); } + + signals: + //void valueChanged(std::variant< const& value); + + private: + SettingsEntryType _type; + std::variant _value; + + }; + + + + +} + +#endif //NOGGIT_SETTINGSENTRY_HPP