Added functionality of customizable split headers #637 (#648)

* Added functionality of customizable split headers

* removed empty line
This commit is contained in:
apa420 2018-08-06 16:42:23 +02:00 committed by fourtf
parent c6cfb548f5
commit 43ba408568
4 changed files with 44 additions and 1 deletions

View file

@ -45,6 +45,12 @@ public:
BoolSetting enableSmoothScrollingNewMessages = {"/appearance/smoothScrollingNewMessages",
false};
BoolSetting enableUsernameBold = {"/appearence/messages/boldUsernames", false};
// BoolSetting customizable splitheader
BoolSetting showViewerCount = {"/appearance/splitheader/showViewerCount", false};
BoolSetting showTitle = {"/appearance/splitheader/showTitle", false};
BoolSetting showGame = {"/appearance/splitheader/showGame", false};
BoolSetting showUptime = {"/appearance/splitheader/showUptime", false};
// BoolSetting useCustomWindowFrame = {"/appearance/useCustomWindowFrame", false};
/// Behaviour

View file

@ -53,6 +53,7 @@ void LookPage::initializeUi()
this->addInterfaceTab(tabs.appendTab(new QVBoxLayout, "Interface"));
this->addMessageTab(tabs.appendTab(new QVBoxLayout, "Messages"));
this->addEmoteTab(tabs.appendTab(new QVBoxLayout, "Emotes"));
this->addSplitHeaderTab(tabs.appendTab(new QVBoxLayout, "Split header"));
layout->addStretch(1);
@ -104,7 +105,6 @@ void LookPage::addInterfaceTab(LayoutCreator<QVBoxLayout> layout)
layout.append(this->createCheckBox(INPUT_EMPTY, getSettings()->showEmptyInput));
layout.append(
this->createCheckBox("Show message length while typing", getSettings()->showMessageLength));
layout->addStretch(1);
}
@ -239,6 +239,16 @@ void LookPage::addEmoteTab(LayoutCreator<QVBoxLayout> layout)
layout->addStretch(1);
}
void LookPage::addSplitHeaderTab(LayoutCreator<QVBoxLayout> layout)
{
layout.append(this->createCheckBox("Show viewer count", getSettings()->showViewerCount));
layout.append(this->createCheckBox("Show title", getSettings()->showTitle));
layout.append(this->createCheckBox("Show game", getSettings()->showGame));
layout.append(this->createCheckBox("Show uptime", getSettings()->showUptime));
layout->addStretch(1);
}
void LookPage::addLastReadMessageIndicatorPatternSelector(LayoutCreator<QVBoxLayout> layout)
{
// combo

View file

@ -22,6 +22,7 @@ private:
void addInterfaceTab(LayoutCreator<QVBoxLayout> layout);
void addMessageTab(LayoutCreator<QVBoxLayout> layout);
void addEmoteTab(LayoutCreator<QVBoxLayout> layout);
void addSplitHeaderTab(LayoutCreator<QVBoxLayout> layout);
void addLastReadMessageIndicatorPatternSelector(LayoutCreator<QVBoxLayout> layout);

View file

@ -101,6 +101,20 @@ SplitHeader::SplitHeader(Split *_split)
this->addModeActions(this->modeMenu_);
this->setMouseTracking(true);
// Update title on title-settings-change
getSettings()->showViewerCount.connect(
[this](const auto &, const auto &) { this->updateChannelText(); },
this->managedConnections_);
getSettings()->showTitle.connect(
[this](const auto &, const auto &) { this->updateChannelText(); },
this->managedConnections_);
getSettings()->showGame.connect(
[this](const auto &, const auto &) { this->updateChannelText(); },
this->managedConnections_);
getSettings()->showUptime.connect(
[this](const auto &, const auto &) { this->updateChannelText(); },
this->managedConnections_);
}
SplitHeader::~SplitHeader()
@ -331,6 +345,18 @@ void SplitHeader::updateChannelText()
} else {
title += " (live)";
}
if (getSettings()->showViewerCount) {
title += " - " + QString::number(streamStatus->viewerCount) + " viewers";
}
if (getSettings()->showTitle) {
title += " - " + streamStatus->title;
}
if (getSettings()->showGame) {
title += " - " + streamStatus->game;
}
if (getSettings()->showUptime) {
title += " - uptime: " + streamStatus->uptime;
}
} else {
this->tooltip_ = QString();
}