Merge pull request #558 from hemirt/master

last message indicator pattern
This commit is contained in:
fourtf 2018-07-03 17:25:37 +02:00 committed by GitHub
commit 748283d7be
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 49 additions and 1 deletions

View file

@ -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<Qt::BrushStyle>(app->settings->lastMessagePattern.getValue()));
painter.fillRect(0, y + this->container_.getHeight() - 1, pixmap->width(), 1, brush);
}

View file

@ -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};

View file

@ -120,6 +120,15 @@ void AppearancePage::addMessagesGroup(QVBoxLayout &layout)
combo->addItems(
{"Never", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15"});
const auto currentIndex = []() -> int {
auto val = getSettings()->collpseMessagesMinLines.getValue();
if (val > 0) {
--val;
}
return val;
}();
combo->setCurrentIndex(currentIndex);
QObject::connect(combo, &QComboBox::currentTextChanged, [](const QString &str) {
getSettings()->collpseMessagesMinLines = str.toInt();
});

View file

@ -43,6 +43,43 @@ BehaviourPage::BehaviourPage()
form->addRow("", this->createCheckBox("Show message length while typing",
getSettings()->showMessageLength));
form->addRow("", this->createCheckBox(LAST_MSG, getSettings()->showLastMessageIndicator));
{
auto *combo = new QComboBox(this);
combo->addItems({"Dotted", "Solid"});
const auto currentIndex = []() -> int {
switch (getApp()->settings->lastMessagePattern.getValue()) {
case Qt::SolidLine: {
return 1;
}
default:
case Qt::VerPattern: {
return 0;
}
}
}();
combo->setCurrentIndex(currentIndex);
QObject::connect(combo,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
[](int index) {
Qt::BrushStyle brush;
switch (index) {
case 1:
brush = Qt::SolidPattern;
break;
default:
case 0:
brush = Qt::VerPattern;
break;
}
getSettings()->lastMessagePattern = brush;
});
auto hbox = form.emplace<QHBoxLayout>().withoutMargin();
hbox.emplace<QLabel>("Last message indicator pattern");
hbox.append(combo);
}
form->addRow("Pause chat:",
this->createCheckBox(PAUSE_HOVERING, app->settings->pauseChatHover));