From 37d3f5a24ac64f250411da2d447fc47bec47fe8d Mon Sep 17 00:00:00 2001 From: hemirt Date: Tue, 3 Jul 2018 13:44:59 +0200 Subject: [PATCH] last message pattern --- src/messages/layouts/MessageLayout.cpp | 3 ++- src/singletons/Settings.hpp | 1 + src/widgets/settingspages/AppearancePage.cpp | 24 ++++++++++++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/messages/layouts/MessageLayout.cpp b/src/messages/layouts/MessageLayout.cpp index 772955fbc..259da3439 100644 --- a/src/messages/layouts/MessageLayout.cpp +++ b/src/messages/layouts/MessageLayout.cpp @@ -175,7 +175,8 @@ void MessageLayout::paint(QPainter &painter, int width, int y, int messageIndex, QColor color = isWindowFocused ? app->themes->tabs.selected.backgrounds.regular.color() : app->themes->tabs.selected.backgrounds.unfocused.color(); - QBrush brush(color, Qt::VerPattern); + QBrush brush(color, + static_cast(app->settings->lastMessagePattern.getValue())); painter.fillRect(0, y + this->container_.getHeight() - 1, pixmap->width(), 1, brush); } diff --git a/src/singletons/Settings.hpp b/src/singletons/Settings.hpp index c1f769340..315e8b60d 100644 --- a/src/singletons/Settings.hpp +++ b/src/singletons/Settings.hpp @@ -27,6 +27,7 @@ public: QStringSetting timestampFormat = {"/appearance/messages/timestampFormat", "h:mm"}; BoolSetting showBadges = {"/appearance/messages/showBadges", true}; BoolSetting showLastMessageIndicator = {"/appearance/messages/showLastMessageIndicator", false}; + IntSetting lastMessagePattern = {"/appearance/messages/lastMessagePattern", Qt::VerPattern}; BoolSetting hideEmptyInput = {"/appearance/hideEmptyInputBox", false}; BoolSetting showMessageLength = {"/appearance/messages/showMessageLength", false}; BoolSetting separateMessages = {"/appearance/messages/separateMessages", false}; diff --git a/src/widgets/settingspages/AppearancePage.cpp b/src/widgets/settingspages/AppearancePage.cpp index e31401d05..a9b5f0098 100644 --- a/src/widgets/settingspages/AppearancePage.cpp +++ b/src/widgets/settingspages/AppearancePage.cpp @@ -103,6 +103,30 @@ AppearancePage::AppearancePage() app->settings->showMessageLength)); messages.append(this->createCheckBox(LAST_MSG, app->settings->showLastMessageIndicator)); + { + auto *combo = new QComboBox(this); + combo->addItems({"Ver", "Solid"}); + + QObject::connect(combo, + static_cast(&QComboBox::currentIndexChanged), + [](int index) { + Qt::BrushStyle brush; + switch (index) { + case 1: + brush = Qt::SolidPattern; + break; + default: + case 0: + brush = Qt::VerPattern; + break; + } + getApp()->settings->lastMessagePattern = brush; + }); + + auto hbox = messages.emplace().withoutMargin(); + hbox.emplace("Last message indicator pattern"); + hbox.append(combo); + } } auto emotes = layout.emplace("Emotes").setLayoutType();