Add viewer list button to twitch channel header (#2042)
This commit is contained in:
@@ -314,6 +314,15 @@ void Split::setChannel(IndirectChannel newChannel)
|
||||
this->header_->updateChannelText();
|
||||
this->header_->updateRoomModes();
|
||||
|
||||
if (newChannel.getType() == Channel::Type::Twitch)
|
||||
{
|
||||
this->header_->setViewersButtonVisible(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->header_->setViewersButtonVisible(false);
|
||||
}
|
||||
|
||||
this->channelChanged.invoke();
|
||||
|
||||
// Queue up save because: Split channel changed
|
||||
|
||||
@@ -228,6 +228,11 @@ void SplitHeader::initializeLayout()
|
||||
}
|
||||
});
|
||||
}),
|
||||
// viewer list
|
||||
this->viewersButton_ = makeWidget<Button>([&](auto w) {
|
||||
QObject::connect(w, &Button::leftClicked, this,
|
||||
[this]() { this->split_->showViewerList(); });
|
||||
}),
|
||||
// dropdown
|
||||
this->dropdownButton_ = makeWidget<Button>([&](auto w) {
|
||||
/// XXX: this never gets disconnected
|
||||
@@ -567,6 +572,7 @@ void SplitHeader::scaleChangedEvent(float scale)
|
||||
this->setFixedHeight(w);
|
||||
this->dropdownButton_->setFixedWidth(w);
|
||||
this->moderationButton_->setFixedWidth(w);
|
||||
this->viewersButton_->setFixedWidth(w);
|
||||
this->addButton_->setFixedWidth(w * 5 / 8);
|
||||
}
|
||||
|
||||
@@ -575,6 +581,11 @@ void SplitHeader::setAddButtonVisible(bool value)
|
||||
this->addButton_->setVisible(value);
|
||||
}
|
||||
|
||||
void SplitHeader::setViewersButtonVisible(bool value)
|
||||
{
|
||||
this->viewersButton_->setVisible(value);
|
||||
}
|
||||
|
||||
void SplitHeader::updateChannelText()
|
||||
{
|
||||
auto indirectChannel = this->split_->getIndirectChannel();
|
||||
@@ -780,11 +791,13 @@ void SplitHeader::themeChangedEvent()
|
||||
// --
|
||||
if (this->theme->isLightTheme())
|
||||
{
|
||||
this->viewersButton_->setPixmap(getResources().buttons.viewersDark);
|
||||
this->dropdownButton_->setPixmap(getResources().buttons.menuDark);
|
||||
this->addButton_->setPixmap(getResources().buttons.addSplit);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->viewersButton_->setPixmap(getResources().buttons.viewersLight);
|
||||
this->dropdownButton_->setPixmap(getResources().buttons.menuLight);
|
||||
this->addButton_->setPixmap(getResources().buttons.addSplitDark);
|
||||
}
|
||||
|
||||
@@ -25,6 +25,7 @@ public:
|
||||
explicit SplitHeader(Split *_chatWidget);
|
||||
|
||||
void setAddButtonVisible(bool value);
|
||||
void setViewersButtonVisible(bool value);
|
||||
|
||||
void updateChannelText();
|
||||
void updateModerationModeIcon();
|
||||
@@ -60,6 +61,7 @@ private:
|
||||
Label *titleLabel_{};
|
||||
EffectLabel *modeButton_{};
|
||||
Button *moderationButton_{};
|
||||
Button *viewersButton_{};
|
||||
Button *addButton_{};
|
||||
|
||||
// states
|
||||
|
||||
Reference in New Issue
Block a user