diff --git a/src/messages/layouts/messagelayoutcontainer.cpp b/src/messages/layouts/messagelayoutcontainer.cpp index c0c126617..34f55e4d3 100644 --- a/src/messages/layouts/messagelayoutcontainer.cpp +++ b/src/messages/layouts/messagelayoutcontainer.cpp @@ -179,6 +179,9 @@ void MessageLayoutContainer::paintAnimatedElements(QPainter &painter, int yOffse void MessageLayoutContainer::paintSelection(QPainter &painter, int messageIndex, Selection &selection) { + singletons::ThemeManager &themeManager = singletons::ThemeManager::getInstance(); + QColor selectionColor = themeManager.messages.selection; + // don't draw anything if (selection.min.messageIndex > messageIndex || selection.max.messageIndex < messageIndex) { return; @@ -194,7 +197,7 @@ void MessageLayoutContainer::paintSelection(QPainter &painter, int messageIndex, rect.setLeft(this->elements[line.startIndex]->getRect().left()); rect.setRight(this->elements[line.endIndex - 1]->getRect().right()); - painter.fillRect(rect, QColor(255, 255, 0, 127)); + painter.fillRect(rect, selectionColor); } return; } @@ -253,7 +256,7 @@ void MessageLayoutContainer::paintSelection(QPainter &painter, int messageIndex, rect.setLeft(this->elements[line.startIndex]->getRect().left()); rect.setRight(this->elements[line.endIndex - 1]->getRect().right()); - painter.fillRect(rect, QColor(255, 255, 0, 127)); + painter.fillRect(rect, selectionColor); } returnAfter = true; } else { @@ -273,7 +276,7 @@ void MessageLayoutContainer::paintSelection(QPainter &painter, int messageIndex, rect.setLeft(x); rect.setRight(r); - painter.fillRect(rect, QColor(255, 255, 0, 127)); + painter.fillRect(rect, selectionColor); if (returnAfter) { return; @@ -289,7 +292,6 @@ void MessageLayoutContainer::paintSelection(QPainter &painter, int messageIndex, for (; lineIndex < this->lines.size(); lineIndex++) { Line &line = this->lines[lineIndex]; index = line.startCharIndex; - bool breakAfter = false; // just draw the garbage if (line.endCharIndex < /*=*/selection.max.charIndex) { @@ -300,7 +302,7 @@ void MessageLayoutContainer::paintSelection(QPainter &painter, int messageIndex, rect.setLeft(this->elements[line.startIndex]->getRect().left()); rect.setRight(this->elements[line.endIndex - 1]->getRect().right()); - painter.fillRect(rect, QColor(255, 255, 0, 127)); + painter.fillRect(rect, selectionColor); continue; } @@ -324,23 +326,11 @@ void MessageLayoutContainer::paintSelection(QPainter &painter, int messageIndex, rect.setLeft(this->elements[line.startIndex]->getRect().left()); rect.setRight(r); - painter.fillRect(rect, QColor(255, 255, 0, 127)); + painter.fillRect(rect, selectionColor); break; } } -void MessageLayoutContainer::_paintLine(QPainter &painter, Line &line, int x, int y) -{ - QRect rect = line.rect; - - rect.setTop(std::max(0, rect.top())); - rect.setBottom(std::min(this->height, rect.bottom())); - rect.setLeft(this->elements[line.startIndex]->getRect().left()); - rect.setRight(this->elements[line.endIndex - 1]->getRect().right()); - - painter.fillRect(rect, QColor(255, 255, 0, 127)); -} - // selection int MessageLayoutContainer::getSelectionIndex(QPoint point) { diff --git a/src/messages/layouts/messagelayoutcontainer.hpp b/src/messages/layouts/messagelayoutcontainer.hpp index bbc6dfd61..2499fd1c4 100644 --- a/src/messages/layouts/messagelayoutcontainer.hpp +++ b/src/messages/layouts/messagelayoutcontainer.hpp @@ -83,7 +83,6 @@ private: // helpers void _addElement(MessageLayoutElement *element); - void _paintLine(QPainter &painter, Line &line, int x, int y); // variables int line;