Convert remaining settings to the new settings system

This commit is contained in:
Rasmus Karlsson
2018-01-04 02:19:35 +01:00
parent df733282be
commit 9044700ec6
12 changed files with 27 additions and 181 deletions
+1 -12
View File
@@ -18,13 +18,7 @@ void _registerSetting(std::weak_ptr<pajlada::Settings::ISettingData> setting)
}
SettingManager::SettingManager()
: streamlinkPath("/behaviour/streamlink/path", "")
, preferredQuality("/behaviour/streamlink/quality", "Choose")
, emoteScale(this->settingsItems, "emoteScale", 1.0)
, pathHighlightSound(this->settingsItems, "pathHighlightSound", "qrc:/sounds/ping2.wav")
, highlightUserBlacklist(this->settingsItems, "highlightUserBlacklist", "")
, snapshot(nullptr)
, settings(Path::getAppdataPath() + "settings.ini", QSettings::IniFormat)
: snapshot(nullptr)
{
this->wordMaskListener.addSetting(this->showTimestamps);
this->wordMaskListener.addSetting(this->showTimestampSeconds);
@@ -48,11 +42,6 @@ bool SettingManager::isIgnoredEmote(const QString &)
return false;
}
QSettings &SettingManager::getQSettings()
{
return this->settings;
}
void SettingManager::load()
{
// Just to make sure the singleton is initialized
+8 -11
View File
@@ -2,10 +2,8 @@
#include "messages/highlightphrase.hpp"
#include "messages/word.hpp"
#include "setting.hpp"
#include "singletons/helper/chatterinosetting.hpp"
#include <QSettings>
#include <pajlada/settings/setting.hpp>
#include <pajlada/settings/settinglistener.hpp>
@@ -20,11 +18,12 @@ class SettingManager : public QObject
using BoolSetting = ChatterinoSetting<bool>;
using FloatSetting = ChatterinoSetting<float>;
using StringSetting = ChatterinoSetting<std::string>;
using QStringSetting = ChatterinoSetting<QString>;
public:
messages::Word::Flags getWordTypeMask();
bool isIgnoredEmote(const QString &emote);
QSettings &getQSettings();
void load();
@@ -47,6 +46,8 @@ public:
BoolSetting allowDuplicateMessages = {"/behaviour/allowDuplicateMessages", true};
BoolSetting mentionUsersWithAt = {"/behaviour/mentionUsersWithAt", false};
FloatSetting mouseScrollMultiplier = {"/behaviour/mouseScrollMultiplier", 1.0};
StringSetting streamlinkPath = {"/behaviour/streamlink/path", ""};
StringSetting preferredQuality = {"/behaviour/streamlink/quality", "Choose"};
/// Commands
BoolSetting allowCommandsAtEnd = {"/commands/allowCommandsAtEnd", false};
@@ -58,6 +59,7 @@ public:
BoolSetting enableFfzEmotes = {"/emotes/enableFFZEmotes", true};
BoolSetting enableEmojis = {"/emotes/enableEmojis", true};
BoolSetting enableGifAnimations = {"/emotes/enableGifAnimations", true};
FloatSetting emoteScale = {"/emotes/scale", 1.f};
/// Links
BoolSetting linksDoubleClickOnly = {"/links/doubleClickToOpen", false};
@@ -69,15 +71,12 @@ public:
BoolSetting enableHighlightTaskbar = {"/highlighting/enableTaskbarFlashing", true};
BoolSetting customHighlightSound = {"/highlighting/useCustomSound", false};
pajlada::Settings::Setting<std::string> streamlinkPath;
pajlada::Settings::Setting<std::string> preferredQuality;
Setting<float> emoteScale;
ChatterinoSetting<std::vector<messages::HighlightPhrase>> highlightProperties = {
"/highlighting/highlights"};
Setting<QString> pathHighlightSound;
Setting<QString> highlightUserBlacklist;
QStringSetting pathHighlightSound = {"/highlighting/highlightSoundPath",
"qrc:/sounds/ping2.wav"};
QStringSetting highlightUserBlacklist = {"/highlighting/blacklistedUsers", ""};
BoolSetting highlightAlwaysPlaySound = {"/highlighting/alwaysPlaySound", false};
@@ -101,8 +100,6 @@ private:
SettingManager();
QSettings settings;
std::vector<std::reference_wrapper<BaseSetting>> settingsItems;
messages::Word::Flags wordTypeMask = messages::Word::Default;
pajlada::Settings::SettingListener wordMaskListener;