added basic alternating messages backgrounds
This commit is contained in:
@@ -167,6 +167,12 @@ void MessageLayout::paint(QPainter &painter, int y, int messageIndex, Selection
|
||||
this->container.paintSelection(painter, messageIndex, selection, y);
|
||||
}
|
||||
|
||||
// draw message seperation line
|
||||
if (app->settings->seperateMessages.getValue()) {
|
||||
painter.fillRect(0, y + this->container.getHeight() - 1, this->container.getWidth(), 1,
|
||||
app->themes->splits.messageSeperator);
|
||||
}
|
||||
|
||||
// draw last read message line
|
||||
if (isLastReadMessage) {
|
||||
QColor color = isWindowFocused ? app->themes->tabs.selected.backgrounds.regular.color()
|
||||
@@ -190,9 +196,16 @@ void MessageLayout::updateBuffer(QPixmap *buffer, int messageIndex, Selection &s
|
||||
painter.setRenderHint(QPainter::SmoothPixmapTransform);
|
||||
|
||||
// draw background
|
||||
painter.fillRect(buffer->rect(), this->message->flags & Message::Highlighted
|
||||
? app->themes->messages.backgrounds.highlighted
|
||||
: app->themes->messages.backgrounds.regular);
|
||||
QColor backgroundColor;
|
||||
if (this->message->flags & Message::Highlighted) {
|
||||
backgroundColor = app->themes->messages.backgrounds.highlighted;
|
||||
} else if (app->settings->alternateMessageBackground.getValue() &&
|
||||
this->flags & MessageLayout::AlternateBackground) {
|
||||
backgroundColor = app->themes->messages.backgrounds.alternate;
|
||||
} else {
|
||||
backgroundColor = app->themes->messages.backgrounds.regular;
|
||||
}
|
||||
painter.fillRect(buffer->rect(), backgroundColor);
|
||||
|
||||
// draw message
|
||||
this->container.paintElements(painter);
|
||||
|
||||
@@ -19,7 +19,11 @@ namespace layouts {
|
||||
class MessageLayout : boost::noncopyable
|
||||
{
|
||||
public:
|
||||
enum Flags : uint8_t { RequiresBufferUpdate = 1 << 1, RequiresLayout = 1 << 2 };
|
||||
enum Flags : uint8_t {
|
||||
RequiresBufferUpdate = 1 << 1,
|
||||
RequiresLayout = 1 << 2,
|
||||
AlternateBackground = 1 << 3
|
||||
};
|
||||
|
||||
MessageLayout(MessagePtr message);
|
||||
~MessageLayout();
|
||||
|
||||
Reference in New Issue
Block a user