diff --git a/src/singletons/Settings.hpp b/src/singletons/Settings.hpp index 0bb92b966..5816d5ee7 100644 --- a/src/singletons/Settings.hpp +++ b/src/singletons/Settings.hpp @@ -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 diff --git a/src/widgets/settingspages/LookPage.cpp b/src/widgets/settingspages/LookPage.cpp index ad1649740..56d59beb6 100644 --- a/src/widgets/settingspages/LookPage.cpp +++ b/src/widgets/settingspages/LookPage.cpp @@ -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 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 layout) layout->addStretch(1); } +void LookPage::addSplitHeaderTab(LayoutCreator 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 layout) { // combo diff --git a/src/widgets/settingspages/LookPage.hpp b/src/widgets/settingspages/LookPage.hpp index 972271f6f..3b3a4f264 100644 --- a/src/widgets/settingspages/LookPage.hpp +++ b/src/widgets/settingspages/LookPage.hpp @@ -22,6 +22,7 @@ private: void addInterfaceTab(LayoutCreator layout); void addMessageTab(LayoutCreator layout); void addEmoteTab(LayoutCreator layout); + void addSplitHeaderTab(LayoutCreator layout); void addLastReadMessageIndicatorPatternSelector(LayoutCreator layout); diff --git a/src/widgets/splits/SplitHeader.cpp b/src/widgets/splits/SplitHeader.cpp index 8d6b92676..9c45383e4 100644 --- a/src/widgets/splits/SplitHeader.cpp +++ b/src/widgets/splits/SplitHeader.cpp @@ -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(); }