#pragma once #include #include namespace chatterino { void _registerSetting(std::weak_ptr setting); template class ChatterinoSetting : public pajlada::Settings::Setting { public: ChatterinoSetting(const std::string &path) : pajlada::Settings::Setting(path) { _registerSetting(this->data); } ChatterinoSetting(const std::string &path, const Type &defaultValue) : pajlada::Settings::Setting(path, defaultValue) { _registerSetting(this->data); } template ChatterinoSetting &operator=(const T2 &newValue) { this->setValue(newValue); return *this; } ChatterinoSetting &operator=(Type &&newValue) noexcept { pajlada::Settings::Setting::operator=(newValue); return *this; } using pajlada::Settings::Setting::operator==; using pajlada::Settings::Setting::operator!=; using pajlada::Settings::Setting::operator const Type; }; using BoolSetting = ChatterinoSetting; using FloatSetting = ChatterinoSetting; using IntSetting = ChatterinoSetting; using StringSetting = ChatterinoSetting; using QStringSetting = ChatterinoSetting; } // namespace chatterino