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];
static ColorScheme &
instance()
getInstance()
{
static ColorScheme instance;

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -224,18 +224,19 @@ NotebookPage::paintEvent(QPaintEvent *)
QPainter painter(this);
if (this->hbox.count() == 0) {
painter.fillRect(rect(), ColorScheme::instance().ChatBackground);
painter.fillRect(rect(), ColorScheme::getInstance().ChatBackground);
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));
} else {
painter.fillRect(rect(), ColorScheme::instance().TabSelectedBackground);
painter.fillRect(rect(),
ColorScheme::getInstance().TabSelectedBackground);
painter.fillRect(0, 0, width(), 2,
ColorScheme::instance().TabSelectedBackground);
ColorScheme::getInstance().TabSelectedBackground);
}
}
}

View file

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

View file

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

View file

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

View file

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