added settingssnapshot

This commit is contained in:
fourtf 2017-01-24 20:15:12 +01:00
parent de8f6d1e82
commit 3d6b9f7645
15 changed files with 38 additions and 34 deletions

View file

@ -61,7 +61,7 @@ public:
QColor HighlightColors[3]; QColor HighlightColors[3];
static ColorScheme & static ColorScheme &
instance() getInstance()
{ {
static ColorScheme instance; static ColorScheme instance;

View file

@ -22,7 +22,7 @@ main(int argc, char *argv[])
Resources::load(); Resources::load();
Emojis::loadEmojis(); Emojis::loadEmojis();
ColorScheme::instance().setColors(0, -0.8); ColorScheme::getInstance().setColors(0, -0.8);
MainWindow &w = Windows::getMainWindow(); MainWindow &w = Windows::getMainWindow();
w.show(); w.show();

View file

@ -26,14 +26,17 @@ QRegularExpression *Message::cheerRegex =
new QRegularExpression("cheer[1-9][0-9]*"); new QRegularExpression("cheer[1-9][0-9]*");
Message::Message(const QString &text) Message::Message(const QString &text)
: wordParts(new std::vector<WordPart>()) : wordParts()
{ {
words.push_back(Word(text, Word::Text,
ColorScheme::getInstance().SystemMessageColor, text,
QString()));
} }
Message::Message(const IrcPrivateMessage &ircMessage, const Channel &channel, Message::Message(const IrcPrivateMessage &ircMessage, const Channel &channel,
bool enablePingSound, bool isReceivedWhisper, bool enablePingSound, bool isReceivedWhisper,
bool isSentWhisper, bool includeChannel) bool isSentWhisper, bool includeChannel)
: wordParts(new std::vector<WordPart>()) : wordParts()
{ {
this->parseTime = std::chrono::system_clock::now(); this->parseTime = std::chrono::system_clock::now();
@ -67,11 +70,11 @@ Message::Message(const IrcPrivateMessage &ircMessage, const Channel &channel,
QString timestampWithSeconds = QString(timeStampBuffer); QString timestampWithSeconds = QString(timeStampBuffer);
words.push_back(Word(timestamp, Word::TimestampNoSeconds, words.push_back(Word(timestamp, Word::TimestampNoSeconds,
ColorScheme::instance().SystemMessageColor, QString(), ColorScheme::getInstance().SystemMessageColor,
QString())); QString(), QString()));
words.push_back(Word(timestampWithSeconds, Word::TimestampWithSeconds, words.push_back(Word(timestampWithSeconds, Word::TimestampWithSeconds,
ColorScheme::instance().SystemMessageColor, QString(), ColorScheme::getInstance().SystemMessageColor,
QString())); QString(), QString()));
// mod buttons // mod buttons
static QString buttonBanTooltip("Ban user"); static QString buttonBanTooltip("Ban user");
@ -131,7 +134,7 @@ Message::Message(const IrcPrivateMessage &ircMessage, const Channel &channel,
} }
// color // color
QColor usernameColor = ColorScheme::instance().SystemMessageColor; QColor usernameColor = ColorScheme::getInstance().SystemMessageColor;
iterator = tags.find("color"); iterator = tags.find("color");
if (iterator != tags.end()) { if (iterator != tags.end()) {
@ -142,9 +145,9 @@ Message::Message(const IrcPrivateMessage &ircMessage, const Channel &channel,
if (includeChannel) { if (includeChannel) {
QString channelName("#" + channel.getName()); QString channelName("#" + channel.getName());
words.push_back(Word( words.push_back(Word(
channelName, Word::Misc, ColorScheme::instance().SystemMessageColor, channelName, Word::Misc,
QString(channelName), QString(), ColorScheme::getInstance().SystemMessageColor, QString(channelName),
Link(Link::Url, channel.getName() + "\n" + this->id))); QString(), Link(Link::Url, channel.getName() + "\n" + this->id)));
} }
// username // username
@ -248,7 +251,7 @@ Message::Message(const IrcPrivateMessage &ircMessage, const Channel &channel,
// words // words
QColor textColor = QColor textColor =
ircMessage.isAction() ? usernameColor : ColorScheme::instance().Text; ircMessage.isAction() ? usernameColor : ColorScheme::getInstance().Text;
QStringList splits = ircMessage.content().split(' '); QStringList splits = ircMessage.content().split(' ');

View file

@ -78,7 +78,7 @@ ChatWidget::paintEvent(QPaintEvent *)
{ {
QPainter painter(this); QPainter painter(this);
painter.fillRect(this->rect(), ColorScheme::instance().ChatBackground); painter.fillRect(this->rect(), ColorScheme::getInstance().ChatBackground);
} }
} }
} }

View file

@ -79,7 +79,7 @@ void
ChatWidgetHeader::updateColors() ChatWidgetHeader::updateColors()
{ {
QPalette palette; QPalette palette;
palette.setColor(QPalette::Foreground, ColorScheme::instance().Text); palette.setColor(QPalette::Foreground, ColorScheme::getInstance().Text);
this->leftLabel.setPalette(palette); this->leftLabel.setPalette(palette);
this->middleLabel.setPalette(palette); this->middleLabel.setPalette(palette);
@ -99,8 +99,8 @@ ChatWidgetHeader::paintEvent(QPaintEvent *)
{ {
QPainter painter(this); QPainter painter(this);
painter.fillRect(rect(), ColorScheme::instance().ChatHeaderBackground); painter.fillRect(rect(), ColorScheme::getInstance().ChatHeaderBackground);
painter.setPen(ColorScheme::instance().ChatHeaderBorder); painter.setPen(ColorScheme::getInstance().ChatHeaderBorder);
painter.drawRect(0, 0, width() - 1, height() - 1); painter.drawRect(0, 0, width() - 1, height() - 1);
} }

View file

@ -34,7 +34,7 @@ ChatWidgetHeaderButton::paintEvent(QPaintEvent *)
{ {
QPainter painter(this); QPainter painter(this);
QBrush brush(ColorScheme::instance().IsLightTheme QBrush brush(ColorScheme::getInstance().IsLightTheme
? QColor(0, 0, 0, 32) ? QColor(0, 0, 0, 32)
: QColor(255, 255, 255, 32)); : QColor(255, 255, 255, 32));

View file

@ -65,11 +65,11 @@ ChatWidgetInput::refreshTheme()
{ {
QPalette palette; QPalette palette;
palette.setColor(QPalette::Foreground, ColorScheme::instance().Text); palette.setColor(QPalette::Foreground, ColorScheme::getInstance().Text);
this->textLengthLabel.setPalette(palette); this->textLengthLabel.setPalette(palette);
edit.setStyleSheet(ColorScheme::instance().InputStyleSheet); edit.setStyleSheet(ColorScheme::getInstance().InputStyleSheet);
} }
void void
@ -77,8 +77,8 @@ ChatWidgetInput::paintEvent(QPaintEvent *)
{ {
QPainter painter(this); QPainter painter(this);
painter.fillRect(rect(), ColorScheme::instance().ChatInputBackground); painter.fillRect(rect(), ColorScheme::getInstance().ChatInputBackground);
painter.setPen(ColorScheme::instance().ChatInputBorder); painter.setPen(ColorScheme::getInstance().ChatInputBorder);
painter.drawRect(0, 0, width() - 1, height() - 1); painter.drawRect(0, 0, width() - 1, height() - 1);
} }

View file

@ -73,7 +73,7 @@ ChatWidgetView::paintEvent(QPaintEvent *)
QColor color; QColor color;
ColorScheme &scheme = ColorScheme::instance(); ColorScheme &scheme = ColorScheme::getInstance();
// code for tesing colors // code for tesing colors
/* /*

View file

@ -16,7 +16,7 @@ MainWindow::MainWindow(QWidget *parent)
QPalette palette; QPalette palette;
palette.setColor(QPalette::Background, palette.setColor(QPalette::Background,
ColorScheme::instance().TabPanelBackground); ColorScheme::getInstance().TabPanelBackground);
setPalette(palette); setPalette(palette);
resize(1280, 800); resize(1280, 800);

View file

@ -21,7 +21,7 @@ NotebookButton::paintEvent(QPaintEvent *)
QColor background; QColor background;
QColor foreground; QColor foreground;
auto colorScheme = ColorScheme::instance(); auto colorScheme = ColorScheme::getInstance();
if (mouseDown) { if (mouseDown) {
background = colorScheme.TabSelectedBackground; background = colorScheme.TabSelectedBackground;

View file

@ -224,18 +224,19 @@ NotebookPage::paintEvent(QPaintEvent *)
QPainter painter(this); QPainter painter(this);
if (this->hbox.count() == 0) { if (this->hbox.count() == 0) {
painter.fillRect(rect(), ColorScheme::instance().ChatBackground); painter.fillRect(rect(), ColorScheme::getInstance().ChatBackground);
painter.fillRect(0, 0, width(), 2, painter.fillRect(0, 0, width(), 2,
ColorScheme::instance().TabSelectedBackground); ColorScheme::getInstance().TabSelectedBackground);
painter.setPen(ColorScheme::instance().Text); painter.setPen(ColorScheme::getInstance().Text);
painter.drawText(rect(), "Add Chat", QTextOption(Qt::AlignCenter)); painter.drawText(rect(), "Add Chat", QTextOption(Qt::AlignCenter));
} else { } else {
painter.fillRect(rect(), ColorScheme::instance().TabSelectedBackground); painter.fillRect(rect(),
ColorScheme::getInstance().TabSelectedBackground);
painter.fillRect(0, 0, width(), 2, painter.fillRect(0, 0, width(), 2,
ColorScheme::instance().TabSelectedBackground); ColorScheme::getInstance().TabSelectedBackground);
} }
} }
} }

View file

@ -20,7 +20,7 @@ NotebookPageDropPreview::paintEvent(QPaintEvent *)
QPainter painter(this); QPainter painter(this);
painter.fillRect(8, 8, width() - 17, height() - 17, painter.fillRect(8, 8, width() - 17, height() - 17,
ColorScheme::instance().DropPreviewBackground); ColorScheme::getInstance().DropPreviewBackground);
} }
void void

View file

@ -82,7 +82,7 @@ NotebookTab::paintEvent(QPaintEvent *)
QColor fg = QColor(0, 0, 0); QColor fg = QColor(0, 0, 0);
auto colorScheme = ColorScheme::instance(); auto colorScheme = ColorScheme::getInstance();
if (this->selected) { if (this->selected) {
painter.fillRect(rect(), colorScheme.TabSelectedBackground); painter.fillRect(rect(), colorScheme.TabSelectedBackground);

View file

@ -80,7 +80,7 @@ void
ScrollBar::paintEvent(QPaintEvent *) ScrollBar::paintEvent(QPaintEvent *)
{ {
QPainter painter(this); QPainter painter(this);
painter.fillRect(rect(), ColorScheme::instance().ScrollbarBG); painter.fillRect(rect(), ColorScheme::getInstance().ScrollbarBG);
painter.fillRect(QRect(0, 0, width(), this->buttonHeight), painter.fillRect(QRect(0, 0, width(), this->buttonHeight),
QColor(255, 0, 0)); QColor(255, 0, 0));

View file

@ -8,7 +8,7 @@ ScrollBarHighlight::ScrollBarHighlight(float position, int colorIndex,
Style style, QString tag) Style style, QString tag)
: position(position) : position(position)
, colorIndex(std::max( , colorIndex(std::max(
0, std::min(ColorScheme::instance().HighlightColorCount, colorIndex))) 0, std::min(ColorScheme::getInstance().HighlightColorCount, colorIndex)))
, style(style) , style(style)
, tag(tag) , tag(tag)
, next(NULL) , next(NULL)