mirror-chatterino2/settings/settings.h

245 lines
4.6 KiB
C
Raw Normal View History

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 {
2017-01-22 12:46:35 +01:00
class Settings : public QObject
2017-01-05 20:49:13 +01:00
{
2017-01-22 12:46:35 +01:00
Q_OBJECT
2017-01-05 20:49:13 +01:00
public:
2017-01-22 12:46:35 +01:00
static Settings &
getInstance()
{
return _;
}
void load();
void save();
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-22 12:46:35 +01:00
bool isIgnoredEmote(const QString &emote);
2017-01-18 04:33:30 +01:00
2017-01-22 12:46:35 +01:00
bool
2017-01-20 06:10:28 +01:00
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-22 12:46:35 +01:00
void
2017-01-20 06:10:28 +01:00
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-22 12:46:35 +01:00
signals:
void wordTypeMaskChanged();
2017-01-20 06:10:28 +01:00
private:
Settings();
2017-01-22 12:46:35 +01:00
static Settings _;
2017-01-20 06:10:28 +01:00
2017-01-22 12:46:35 +01:00
void updateWordTypeMask(bool);
2017-01-20 06:10:28 +01:00
2017-01-22 12:46:35 +01:00
QSettings settings;
std::vector<Setting *> settingsItems;
// template <class T>
// T
// addSetting(T setting)
// {
// settingsItems.push_back(setting);
// return setting;
// }
2017-01-20 06:10:28 +01:00
2017-01-22 12:46:35 +01:00
bool portable;
2017-01-20 06:10:28 +01:00
2017-01-22 12:46:35 +01:00
messages::Word::Type wordTypeMask;
private:
StringSetting theme;
StringSetting user;
FloatSetting emoteScale;
BoolSetting scaleEmotesByLineHeight;
BoolSetting showTimestamps;
BoolSetting showTimestampSeconds;
BoolSetting showLastMessageIndicator;
BoolSetting allowDouplicateMessages;
BoolSetting linksDoubleClickOnly;
BoolSetting hideEmptyInput;
BoolSetting showMessageLength;
BoolSetting seperateMessages;
BoolSetting mentionUsersWithAt;
BoolSetting allowCommandsAtEnd;
BoolSetting enableHighlights;
BoolSetting enableHighlightSound;
BoolSetting enableHighlightTaskbar;
BoolSetting customHighlightSound;
BoolSetting enableTwitchEmotes;
BoolSetting enableBttvEmotes;
BoolSetting enableFfzEmotes;
BoolSetting enableEmojis;
BoolSetting enableGifAnimations;
BoolSetting enableGifs;
BoolSetting inlineWhispers;
BoolSetting windowTopMost;
BoolSetting hideTabX;
2017-01-20 06:10:28 +01:00
// settings
public:
2017-01-22 12:46:35 +01:00
StringSetting &
2017-01-20 06:10:28 +01:00
getTheme()
{
2017-01-22 12:46:35 +01:00
return this->theme;
2017-01-20 06:10:28 +01:00
}
2017-01-22 12:46:35 +01:00
StringSetting &
2017-01-20 06:10:28 +01:00
getUser()
{
2017-01-22 12:46:35 +01:00
return this->user;
2017-01-20 06:10:28 +01:00
}
2017-01-22 12:46:35 +01:00
FloatSetting &
2017-01-20 06:10:28 +01:00
getEmoteScale()
{
2017-01-22 12:46:35 +01:00
return this->emoteScale;
2017-01-20 06:10:28 +01:00
}
2017-01-22 12:46:35 +01:00
BoolSetting &
2017-01-18 04:33:30 +01:00
getScaleEmotesByLineHeight()
2017-01-11 18:52:09 +01:00
{
2017-01-22 12:46:35 +01:00
return this->scaleEmotesByLineHeight;
2017-01-20 06:10:28 +01:00
}
2017-01-22 12:46:35 +01:00
BoolSetting &
2017-01-20 06:10:28 +01:00
getShowTimestamps()
{
2017-01-22 12:46:35 +01:00
return this->showTimestamps;
2017-01-20 06:10:28 +01:00
}
2017-01-22 12:46:35 +01:00
BoolSetting &
2017-01-20 06:10:28 +01:00
getShowTimestampSeconds()
{
2017-01-22 12:46:35 +01:00
return this->showTimestampSeconds;
2017-01-20 06:10:28 +01:00
}
2017-01-22 12:46:35 +01:00
BoolSetting &
getShowLastMessageIndicator()
{
return this->showLastMessageIndicator;
}
BoolSetting &
2017-01-20 06:10:28 +01:00
getAllowDouplicateMessages()
{
2017-01-22 12:46:35 +01:00
return this->allowDouplicateMessages;
2017-01-20 06:10:28 +01:00
}
2017-01-22 12:46:35 +01:00
BoolSetting &
2017-01-20 06:10:28 +01:00
getLinksDoubleClickOnly()
{
2017-01-22 12:46:35 +01:00
return this->linksDoubleClickOnly;
2017-01-20 06:10:28 +01:00
}
2017-01-22 12:46:35 +01:00
BoolSetting &
2017-01-20 06:10:28 +01:00
getHideEmptyInput()
{
2017-01-22 12:46:35 +01:00
return this->hideEmptyInput;
2017-01-20 06:10:28 +01:00
}
2017-01-22 12:46:35 +01:00
BoolSetting &
2017-01-20 06:10:28 +01:00
getShowMessageLength()
{
2017-01-22 12:46:35 +01:00
return this->showMessageLength;
2017-01-20 06:10:28 +01:00
}
2017-01-22 12:46:35 +01:00
BoolSetting &
2017-01-20 06:10:28 +01:00
getSeperateMessages()
{
2017-01-22 12:46:35 +01:00
return this->seperateMessages;
2017-01-20 06:10:28 +01:00
}
2017-01-22 12:46:35 +01:00
BoolSetting &
2017-01-20 06:10:28 +01:00
getMentionUsersWithAt()
{
2017-01-22 12:46:35 +01:00
return this->mentionUsersWithAt;
2017-01-20 06:10:28 +01:00
}
2017-01-22 12:46:35 +01:00
BoolSetting &
2017-01-20 06:10:28 +01:00
getAllowCommandsAtEnd()
{
2017-01-22 12:46:35 +01:00
return this->allowCommandsAtEnd;
2017-01-20 06:10:28 +01:00
}
2017-01-22 12:46:35 +01:00
BoolSetting &
2017-01-20 06:10:28 +01:00
getEnableHighlights()
{
2017-01-22 12:46:35 +01:00
return this->enableHighlights;
2017-01-20 06:10:28 +01:00
}
2017-01-22 12:46:35 +01:00
BoolSetting &
2017-01-20 06:10:28 +01:00
getEnableHighlightSound()
{
2017-01-22 12:46:35 +01:00
return this->enableHighlightSound;
2017-01-20 06:10:28 +01:00
}
2017-01-22 12:46:35 +01:00
BoolSetting &
2017-01-20 06:10:28 +01:00
getEnableHighlightTaskbar()
{
2017-01-22 12:46:35 +01:00
return this->enableHighlightTaskbar;
2017-01-20 06:10:28 +01:00
}
2017-01-22 12:46:35 +01:00
BoolSetting &
2017-01-20 06:10:28 +01:00
getCustomHighlightSound()
{
2017-01-22 12:46:35 +01:00
return this->customHighlightSound;
2017-01-20 06:10:28 +01:00
}
2017-01-22 12:46:35 +01:00
BoolSetting &
2017-01-20 06:10:28 +01:00
getEnableTwitchEmotes()
{
2017-01-22 12:46:35 +01:00
return this->enableTwitchEmotes;
2017-01-20 06:10:28 +01:00
}
2017-01-22 12:46:35 +01:00
BoolSetting &
2017-01-20 06:10:28 +01:00
getEnableBttvEmotes()
{
2017-01-22 12:46:35 +01:00
return this->enableBttvEmotes;
2017-01-20 06:10:28 +01:00
}
2017-01-22 12:46:35 +01:00
BoolSetting &
getEnableFfzEmotes()
2017-01-20 06:10:28 +01:00
{
2017-01-22 12:46:35 +01:00
return this->enableFfzEmotes;
2017-01-20 06:10:28 +01:00
}
2017-01-22 12:46:35 +01:00
BoolSetting &
2017-01-20 06:10:28 +01:00
getEnableEmojis()
{
2017-01-22 12:46:35 +01:00
return this->enableEmojis;
2017-01-20 06:10:28 +01:00
}
2017-01-22 12:46:35 +01:00
BoolSetting &
2017-01-20 06:10:28 +01:00
getEnableGifAnimations()
{
2017-01-22 12:46:35 +01:00
return this->enableGifAnimations;
2017-01-20 06:10:28 +01:00
}
2017-01-22 12:46:35 +01:00
BoolSetting &
2017-01-20 06:10:28 +01:00
getEnableGifs()
{
2017-01-22 12:46:35 +01:00
return this->enableGifs;
2017-01-20 06:10:28 +01:00
}
2017-01-22 12:46:35 +01:00
BoolSetting &
2017-01-20 06:10:28 +01:00
getInlineWhispers()
{
2017-01-22 12:46:35 +01:00
return this->inlineWhispers;
2017-01-20 06:10:28 +01:00
}
2017-01-22 12:46:35 +01:00
BoolSetting &
2017-01-20 06:10:28 +01:00
getWindowTopMost()
{
2017-01-22 12:46:35 +01:00
return this->windowTopMost;
2017-01-11 01:08:20 +01:00
}
2017-01-22 12:46:35 +01:00
BoolSetting &
getHideTabX()
2017-01-21 05:14:27 +01:00
{
2017-01-22 12:46:35 +01:00
return this->hideTabX;
2017-01-21 05:14:27 +01:00
}
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