21#ifndef SAYONARA_SETTINGS_H_
22#define SAYONARA_SETTINGS_H_
24#include "Utils/Settings/SettingKey.h"
25#include "Utils/Settings/Setting.h"
26#include "Utils/Settings/SettingNotifier.h"
27#include "Utils/Singleton.h"
32#define GetSetting(x) Settings::instance()->get<x>()
33#define SetSetting(x, y) Settings::instance()->set<x>(y)
34#define ListenSetting(x, y) Set::listen<x>(this, &y)
35#define ListenSettingNoCall(x, y) Set::listen<x>(this, &y, false)
37using SettingArray = std::array<AbstrSetting*, static_cast<unsigned int>(SettingKey::Num_Setting_Keys)>;
49 [[nodiscard]]
AbstrSetting* setting(SettingKey keyIndex)
const;
52 const SettingArray& settings();
61 template<
typename KeyClass>
62 const typename KeyClass::Data& get()
const
65 auto* s =
static_cast<SettingPtr
>(setting(KeyClass::key));
71 template<
typename KeyClass>
72 void set(
const typename KeyClass::Data& val)
75 auto* s =
static_cast<SettingPtr
>(setting(KeyClass::key));
77 if(s->assignValue(val))
85 template<
typename KeyClass>
89 settingNotifier->valueChanged();
The AbstrSetting class Every setting needs a key and a value The SettingKey is only used inside the s...
Definition: Setting.h:38
Definition: SettingNotifier.h:48
The Setting class T is the pure value type e.g. QString.
Definition: Setting.h:74
The Settings class.
Definition: Settings.h:44