Update cmake, SettingsEntry.cpp, and SettingsEntry.hpp

This commit is contained in:
Skarn
2022-02-11 21:20:19 +03:00
parent fec7f23ce5
commit 7c963381f5
3 changed files with 76 additions and 1 deletions

2
cmake

Submodule cmake updated: de8a3b94ba...c4e9d83cb2

View File

@@ -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;

View File

@@ -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 <type_traits>
#include <QObject>
#include <QColor>
#include <variant>
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<filepath, std::string> _value;
};
}
#endif //NOGGIT_SETTINGSENTRY_HPP