diff --git a/colorscheme.h b/colorscheme.h index 0bf94024b..9d82b94cb 100644 --- a/colorscheme.h +++ b/colorscheme.h @@ -61,7 +61,7 @@ public: QColor HighlightColors[3]; static ColorScheme & - instance() + getInstance() { static ColorScheme instance; diff --git a/main.cpp b/main.cpp index c04ee88bc..a8366a6a1 100644 --- a/main.cpp +++ b/main.cpp @@ -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(); diff --git a/messages/message.cpp b/messages/message.cpp index 050757d52..d160d7719 100644 --- a/messages/message.cpp +++ b/messages/message.cpp @@ -26,14 +26,17 @@ QRegularExpression *Message::cheerRegex = new QRegularExpression("cheer[1-9][0-9]*"); Message::Message(const QString &text) - : wordParts(new std::vector()) + : 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()) + : 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(' '); diff --git a/widgets/chatwidget.cpp b/widgets/chatwidget.cpp index 2e24375e6..89adcb9d6 100644 --- a/widgets/chatwidget.cpp +++ b/widgets/chatwidget.cpp @@ -78,7 +78,7 @@ ChatWidget::paintEvent(QPaintEvent *) { QPainter painter(this); - painter.fillRect(this->rect(), ColorScheme::instance().ChatBackground); + painter.fillRect(this->rect(), ColorScheme::getInstance().ChatBackground); } } } diff --git a/widgets/chatwidgetheader.cpp b/widgets/chatwidgetheader.cpp index c3ccafc9c..5e215a1c2 100644 --- a/widgets/chatwidgetheader.cpp +++ b/widgets/chatwidgetheader.cpp @@ -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); } diff --git a/widgets/chatwidgetheaderbutton.cpp b/widgets/chatwidgetheaderbutton.cpp index 88def818a..514366792 100644 --- a/widgets/chatwidgetheaderbutton.cpp +++ b/widgets/chatwidgetheaderbutton.cpp @@ -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)); diff --git a/widgets/chatwidgetinput.cpp b/widgets/chatwidgetinput.cpp index 687a8cb85..04edc2d04 100644 --- a/widgets/chatwidgetinput.cpp +++ b/widgets/chatwidgetinput.cpp @@ -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); } diff --git a/widgets/chatwidgetview.cpp b/widgets/chatwidgetview.cpp index 6e0bc0049..7d074964c 100644 --- a/widgets/chatwidgetview.cpp +++ b/widgets/chatwidgetview.cpp @@ -73,7 +73,7 @@ ChatWidgetView::paintEvent(QPaintEvent *) QColor color; - ColorScheme &scheme = ColorScheme::instance(); + ColorScheme &scheme = ColorScheme::getInstance(); // code for tesing colors /* diff --git a/widgets/mainwindow.cpp b/widgets/mainwindow.cpp index 937c869ec..64e1930e8 100644 --- a/widgets/mainwindow.cpp +++ b/widgets/mainwindow.cpp @@ -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); diff --git a/widgets/notebookbutton.cpp b/widgets/notebookbutton.cpp index 27f5d9664..9c40cac36 100644 --- a/widgets/notebookbutton.cpp +++ b/widgets/notebookbutton.cpp @@ -21,7 +21,7 @@ NotebookButton::paintEvent(QPaintEvent *) QColor background; QColor foreground; - auto colorScheme = ColorScheme::instance(); + auto colorScheme = ColorScheme::getInstance(); if (mouseDown) { background = colorScheme.TabSelectedBackground; diff --git a/widgets/notebookpage.cpp b/widgets/notebookpage.cpp index daaf2a199..24b16c1f1 100644 --- a/widgets/notebookpage.cpp +++ b/widgets/notebookpage.cpp @@ -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); } } } diff --git a/widgets/notebookpagedroppreview.cpp b/widgets/notebookpagedroppreview.cpp index 18143fe18..63db87d52 100644 --- a/widgets/notebookpagedroppreview.cpp +++ b/widgets/notebookpagedroppreview.cpp @@ -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 diff --git a/widgets/notebooktab.cpp b/widgets/notebooktab.cpp index e4bded37a..8115dfcfe 100644 --- a/widgets/notebooktab.cpp +++ b/widgets/notebooktab.cpp @@ -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); diff --git a/widgets/scrollbar.cpp b/widgets/scrollbar.cpp index 709296590..da4b78a82 100644 --- a/widgets/scrollbar.cpp +++ b/widgets/scrollbar.cpp @@ -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)); diff --git a/widgets/scrollbarhighlight.cpp b/widgets/scrollbarhighlight.cpp index aab57566c..0591110b5 100644 --- a/widgets/scrollbarhighlight.cpp +++ b/widgets/scrollbarhighlight.cpp @@ -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)