2017-01-05 20:49:13 +01:00
|
|
|
#ifndef APPSETTINGS_H
|
|
|
|
#define APPSETTINGS_H
|
|
|
|
|
2017-01-18 21:30:23 +01:00
|
|
|
#include "messages/word.h"
|
2017-01-20 06:10:28 +01:00
|
|
|
#include "settings/boolsetting.h"
|
|
|
|
#include "settings/floatsetting.h"
|
|
|
|
#include "settings/setting.h"
|
|
|
|
#include "settings/stringsetting.h"
|
|
|
|
|
|
|
|
#include <QSettings>
|
2017-01-05 20:49:13 +01:00
|
|
|
|
2017-01-18 21:30:23 +01:00
|
|
|
namespace chatterino {
|
|
|
|
namespace settings {
|
|
|
|
|
|
|
|
class Settings
|
2017-01-05 20:49:13 +01:00
|
|
|
{
|
|
|
|
public:
|
2017-01-18 21:30:23 +01:00
|
|
|
static messages::Word::Type
|
2017-01-18 04:33:30 +01:00
|
|
|
getWordTypeMask()
|
2017-01-11 18:52:09 +01:00
|
|
|
{
|
2017-01-18 04:33:30 +01:00
|
|
|
return wordTypeMask;
|
2017-01-05 20:49:33 +01:00
|
|
|
}
|
|
|
|
|
2017-01-11 18:52:09 +01:00
|
|
|
static bool isIgnoredEmote(const QString &emote);
|
2017-01-18 04:33:30 +01:00
|
|
|
|
2017-01-20 06:10:28 +01:00
|
|
|
static void load();
|
|
|
|
static void save();
|
|
|
|
|
|
|
|
static bool
|
|
|
|
getPortable()
|
2017-01-11 18:52:09 +01:00
|
|
|
{
|
2017-01-20 06:10:28 +01:00
|
|
|
return portable;
|
2017-01-11 01:08:20 +01:00
|
|
|
}
|
|
|
|
|
2017-01-20 06:10:28 +01:00
|
|
|
static void
|
|
|
|
setPortable(bool value)
|
2017-01-11 18:52:09 +01:00
|
|
|
{
|
2017-01-20 06:10:28 +01:00
|
|
|
portable = value;
|
2017-01-11 01:08:20 +01:00
|
|
|
}
|
|
|
|
|
2017-01-20 06:10:28 +01:00
|
|
|
private:
|
|
|
|
Settings();
|
|
|
|
|
|
|
|
static int _;
|
|
|
|
static int
|
|
|
|
_init()
|
|
|
|
{
|
|
|
|
settingsItems.reserve(25);
|
|
|
|
settingsItems.push_back(&theme);
|
|
|
|
settingsItems.push_back(&user);
|
|
|
|
settingsItems.push_back(&emoteScale);
|
|
|
|
settingsItems.push_back(&scaleEmotesByLineHeight);
|
|
|
|
settingsItems.push_back(&showTimestamps);
|
|
|
|
settingsItems.push_back(&showTimestampSeconds);
|
|
|
|
settingsItems.push_back(&allowDouplicateMessages);
|
|
|
|
settingsItems.push_back(&linksDoubleClickOnly);
|
|
|
|
settingsItems.push_back(&hideEmptyInput);
|
|
|
|
settingsItems.push_back(&showMessageLength);
|
|
|
|
settingsItems.push_back(&seperateMessages);
|
|
|
|
settingsItems.push_back(&mentionUsersWithAt);
|
|
|
|
settingsItems.push_back(&allowCommandsAtEnd);
|
|
|
|
settingsItems.push_back(&enableHighlights);
|
|
|
|
settingsItems.push_back(&enableHighlightSound);
|
|
|
|
settingsItems.push_back(&enableHighlightTaskbar);
|
|
|
|
settingsItems.push_back(&customHighlightSound);
|
|
|
|
settingsItems.push_back(&enableTwitchEmotes);
|
|
|
|
settingsItems.push_back(&enableBttvEmotes);
|
|
|
|
settingsItems.push_back(&enableFFzEmotes);
|
|
|
|
settingsItems.push_back(&enableEmojis);
|
|
|
|
settingsItems.push_back(&enableGifAnimations);
|
|
|
|
settingsItems.push_back(&enableGifs);
|
|
|
|
settingsItems.push_back(&inlineWhispers);
|
|
|
|
settingsItems.push_back(&windowTopMost);
|
2017-01-21 05:14:27 +01:00
|
|
|
settingsItems.push_back(&compactTabs);
|
2017-01-20 06:10:28 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static QSettings settings;
|
|
|
|
static std::vector<Setting *> settingsItems;
|
|
|
|
|
|
|
|
template <class T>
|
|
|
|
static T
|
|
|
|
addSetting(T setting)
|
|
|
|
{
|
|
|
|
settingsItems.push_back(setting);
|
|
|
|
return setting;
|
|
|
|
}
|
|
|
|
|
|
|
|
static bool portable;
|
|
|
|
|
|
|
|
static messages::Word::Type wordTypeMask;
|
|
|
|
|
|
|
|
// settings
|
|
|
|
public:
|
|
|
|
static StringSetting
|
|
|
|
getTheme()
|
|
|
|
{
|
|
|
|
return Settings::theme;
|
|
|
|
}
|
|
|
|
static StringSetting
|
|
|
|
getUser()
|
|
|
|
{
|
|
|
|
return Settings::user;
|
|
|
|
}
|
|
|
|
static FloatSetting
|
|
|
|
getEmoteScale()
|
|
|
|
{
|
|
|
|
return Settings::emoteScale;
|
|
|
|
}
|
|
|
|
static BoolSetting
|
2017-01-18 04:33:30 +01:00
|
|
|
getScaleEmotesByLineHeight()
|
2017-01-11 18:52:09 +01:00
|
|
|
{
|
2017-01-20 06:10:28 +01:00
|
|
|
return Settings::scaleEmotesByLineHeight;
|
|
|
|
}
|
|
|
|
static BoolSetting
|
|
|
|
getShowTimestamps()
|
|
|
|
{
|
|
|
|
return Settings::showTimestamps;
|
|
|
|
}
|
|
|
|
static BoolSetting
|
|
|
|
getShowTimestampSeconds()
|
|
|
|
{
|
|
|
|
return Settings::showTimestampSeconds;
|
|
|
|
}
|
|
|
|
static BoolSetting
|
|
|
|
getAllowDouplicateMessages()
|
|
|
|
{
|
|
|
|
return Settings::allowDouplicateMessages;
|
|
|
|
}
|
|
|
|
static BoolSetting
|
|
|
|
getLinksDoubleClickOnly()
|
|
|
|
{
|
|
|
|
return Settings::linksDoubleClickOnly;
|
|
|
|
}
|
|
|
|
static BoolSetting
|
|
|
|
getHideEmptyInput()
|
|
|
|
{
|
|
|
|
return Settings::hideEmptyInput;
|
|
|
|
}
|
|
|
|
static BoolSetting
|
|
|
|
getShowMessageLength()
|
|
|
|
{
|
|
|
|
return Settings::showMessageLength;
|
|
|
|
}
|
|
|
|
static BoolSetting
|
|
|
|
getSeperateMessages()
|
|
|
|
{
|
|
|
|
return Settings::seperateMessages;
|
|
|
|
}
|
|
|
|
static BoolSetting
|
|
|
|
getMentionUsersWithAt()
|
|
|
|
{
|
|
|
|
return Settings::mentionUsersWithAt;
|
|
|
|
}
|
|
|
|
static BoolSetting
|
|
|
|
getAllowCommandsAtEnd()
|
|
|
|
{
|
|
|
|
return Settings::allowCommandsAtEnd;
|
|
|
|
}
|
|
|
|
static BoolSetting
|
|
|
|
getEnableHighlights()
|
|
|
|
{
|
|
|
|
return Settings::enableHighlights;
|
|
|
|
}
|
|
|
|
static BoolSetting
|
|
|
|
getEnableHighlightSound()
|
|
|
|
{
|
|
|
|
return Settings::enableHighlightSound;
|
|
|
|
}
|
|
|
|
static BoolSetting
|
|
|
|
getEnableHighlightTaskbar()
|
|
|
|
{
|
|
|
|
return Settings::enableHighlightTaskbar;
|
|
|
|
}
|
|
|
|
static BoolSetting
|
|
|
|
getCustomHighlightSound()
|
|
|
|
{
|
|
|
|
return Settings::customHighlightSound;
|
|
|
|
}
|
|
|
|
static BoolSetting
|
|
|
|
getEnableTwitchEmotes()
|
|
|
|
{
|
|
|
|
return Settings::enableTwitchEmotes;
|
|
|
|
}
|
|
|
|
static BoolSetting
|
|
|
|
getEnableBttvEmotes()
|
|
|
|
{
|
|
|
|
return Settings::enableBttvEmotes;
|
|
|
|
}
|
|
|
|
static BoolSetting
|
|
|
|
getEnableFFzEmotes()
|
|
|
|
{
|
|
|
|
return Settings::enableFFzEmotes;
|
|
|
|
}
|
|
|
|
static BoolSetting
|
|
|
|
getEnableEmojis()
|
|
|
|
{
|
|
|
|
return Settings::enableEmojis;
|
|
|
|
}
|
|
|
|
static BoolSetting
|
|
|
|
getEnableGifAnimations()
|
|
|
|
{
|
|
|
|
return Settings::enableGifAnimations;
|
|
|
|
}
|
|
|
|
static BoolSetting
|
|
|
|
getEnableGifs()
|
|
|
|
{
|
|
|
|
return Settings::enableGifs;
|
|
|
|
}
|
|
|
|
static BoolSetting
|
|
|
|
getInlineWhispers()
|
|
|
|
{
|
|
|
|
return Settings::inlineWhispers;
|
|
|
|
}
|
|
|
|
static BoolSetting
|
|
|
|
getWindowTopMost()
|
|
|
|
{
|
|
|
|
return Settings::windowTopMost;
|
2017-01-11 01:08:20 +01:00
|
|
|
}
|
2017-01-21 05:14:27 +01:00
|
|
|
static BoolSetting
|
|
|
|
getCompactTabs()
|
|
|
|
{
|
|
|
|
return Settings::compactTabs;
|
|
|
|
}
|
2017-01-06 23:28:48 +01:00
|
|
|
|
2017-01-05 20:49:33 +01:00
|
|
|
private:
|
2017-01-20 06:10:28 +01:00
|
|
|
static StringSetting theme;
|
|
|
|
static StringSetting user;
|
|
|
|
static FloatSetting emoteScale;
|
|
|
|
static BoolSetting scaleEmotesByLineHeight;
|
|
|
|
static BoolSetting showTimestamps;
|
|
|
|
static BoolSetting showTimestampSeconds;
|
|
|
|
static BoolSetting allowDouplicateMessages;
|
|
|
|
static BoolSetting linksDoubleClickOnly;
|
|
|
|
static BoolSetting hideEmptyInput;
|
|
|
|
static BoolSetting showMessageLength;
|
|
|
|
static BoolSetting seperateMessages;
|
|
|
|
static BoolSetting mentionUsersWithAt;
|
|
|
|
static BoolSetting allowCommandsAtEnd;
|
|
|
|
static BoolSetting enableHighlights;
|
|
|
|
static BoolSetting enableHighlightSound;
|
|
|
|
static BoolSetting enableHighlightTaskbar;
|
|
|
|
static BoolSetting customHighlightSound;
|
|
|
|
static BoolSetting enableTwitchEmotes;
|
|
|
|
static BoolSetting enableBttvEmotes;
|
|
|
|
static BoolSetting enableFFzEmotes;
|
|
|
|
static BoolSetting enableEmojis;
|
|
|
|
static BoolSetting enableGifAnimations;
|
|
|
|
static BoolSetting enableGifs;
|
|
|
|
static BoolSetting inlineWhispers;
|
|
|
|
static BoolSetting windowTopMost;
|
2017-01-21 05:14:27 +01:00
|
|
|
static BoolSetting compactTabs;
|
2017-01-05 20:49:13 +01:00
|
|
|
};
|
2017-01-18 21:30:23 +01:00
|
|
|
}
|
|
|
|
}
|
2017-01-05 20:49:13 +01:00
|
|
|
|
2017-01-11 18:52:09 +01:00
|
|
|
#endif // APPSETTINGS_H
|