Add viewer list button to twitch channel header (#2042)

This commit is contained in:
Dave 2020-10-10 11:24:53 -04:00 committed by GitHub
parent e4d7f49952
commit 98762fdfa0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 31 additions and 0 deletions

View file

@ -2,6 +2,7 @@
## Unversioned ## Unversioned
- Minor: Added viewer list button to twitch channel header. (#1978)
- Minor: Added followage and subage information to usercard. (#2023) - Minor: Added followage and subage information to usercard. (#2023)
- Minor: Added an option to only open channels specified in command line with `-c` parameter. You can also use `--help` to display short help message (#1940) - Minor: Added an option to only open channels specified in command line with `-c` parameter. You can also use `--help` to display short help message (#1940)
- Minor: Added customizable timeout buttons to the user info popup - Minor: Added customizable timeout buttons to the user info popup

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View file

@ -29,6 +29,8 @@
<file>buttons/unvip.png</file> <file>buttons/unvip.png</file>
<file>buttons/update.png</file> <file>buttons/update.png</file>
<file>buttons/updateError.png</file> <file>buttons/updateError.png</file>
<file>buttons/viewersDark.png</file>
<file>buttons/viewersLight.png</file>
<file>buttons/vip.png</file> <file>buttons/vip.png</file>
<file>chatterino.icns</file> <file>chatterino.icns</file>
<file>com.chatterino.chatterino.appdata.xml</file> <file>com.chatterino.chatterino.appdata.xml</file>

View file

@ -28,6 +28,8 @@ Resources2::Resources2()
this->buttons.unvip = QPixmap(":/buttons/unvip.png"); this->buttons.unvip = QPixmap(":/buttons/unvip.png");
this->buttons.update = QPixmap(":/buttons/update.png"); this->buttons.update = QPixmap(":/buttons/update.png");
this->buttons.updateError = QPixmap(":/buttons/updateError.png"); this->buttons.updateError = QPixmap(":/buttons/updateError.png");
this->buttons.viewersDark = QPixmap(":/buttons/viewersDark.png");
this->buttons.viewersLight = QPixmap(":/buttons/viewersLight.png");
this->buttons.vip = QPixmap(":/buttons/vip.png"); this->buttons.vip = QPixmap(":/buttons/vip.png");
this->error = QPixmap(":/error.png"); this->error = QPixmap(":/error.png");
this->icon = QPixmap(":/icon.png"); this->icon = QPixmap(":/icon.png");

View file

@ -35,6 +35,8 @@ public:
QPixmap unvip; QPixmap unvip;
QPixmap update; QPixmap update;
QPixmap updateError; QPixmap updateError;
QPixmap viewersDark;
QPixmap viewersLight;
QPixmap vip; QPixmap vip;
} buttons; } buttons;
QPixmap error; QPixmap error;

View file

@ -314,6 +314,15 @@ void Split::setChannel(IndirectChannel newChannel)
this->header_->updateChannelText(); this->header_->updateChannelText();
this->header_->updateRoomModes(); this->header_->updateRoomModes();
if (newChannel.getType() == Channel::Type::Twitch)
{
this->header_->setViewersButtonVisible(true);
}
else
{
this->header_->setViewersButtonVisible(false);
}
this->channelChanged.invoke(); this->channelChanged.invoke();
// Queue up save because: Split channel changed // Queue up save because: Split channel changed

View file

@ -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 // dropdown
this->dropdownButton_ = makeWidget<Button>([&](auto w) { this->dropdownButton_ = makeWidget<Button>([&](auto w) {
/// XXX: this never gets disconnected /// XXX: this never gets disconnected
@ -567,6 +572,7 @@ void SplitHeader::scaleChangedEvent(float scale)
this->setFixedHeight(w); this->setFixedHeight(w);
this->dropdownButton_->setFixedWidth(w); this->dropdownButton_->setFixedWidth(w);
this->moderationButton_->setFixedWidth(w); this->moderationButton_->setFixedWidth(w);
this->viewersButton_->setFixedWidth(w);
this->addButton_->setFixedWidth(w * 5 / 8); this->addButton_->setFixedWidth(w * 5 / 8);
} }
@ -575,6 +581,11 @@ void SplitHeader::setAddButtonVisible(bool value)
this->addButton_->setVisible(value); this->addButton_->setVisible(value);
} }
void SplitHeader::setViewersButtonVisible(bool value)
{
this->viewersButton_->setVisible(value);
}
void SplitHeader::updateChannelText() void SplitHeader::updateChannelText()
{ {
auto indirectChannel = this->split_->getIndirectChannel(); auto indirectChannel = this->split_->getIndirectChannel();
@ -780,11 +791,13 @@ void SplitHeader::themeChangedEvent()
// -- // --
if (this->theme->isLightTheme()) if (this->theme->isLightTheme())
{ {
this->viewersButton_->setPixmap(getResources().buttons.viewersDark);
this->dropdownButton_->setPixmap(getResources().buttons.menuDark); this->dropdownButton_->setPixmap(getResources().buttons.menuDark);
this->addButton_->setPixmap(getResources().buttons.addSplit); this->addButton_->setPixmap(getResources().buttons.addSplit);
} }
else else
{ {
this->viewersButton_->setPixmap(getResources().buttons.viewersLight);
this->dropdownButton_->setPixmap(getResources().buttons.menuLight); this->dropdownButton_->setPixmap(getResources().buttons.menuLight);
this->addButton_->setPixmap(getResources().buttons.addSplitDark); this->addButton_->setPixmap(getResources().buttons.addSplitDark);
} }

View file

@ -25,6 +25,7 @@ public:
explicit SplitHeader(Split *_chatWidget); explicit SplitHeader(Split *_chatWidget);
void setAddButtonVisible(bool value); void setAddButtonVisible(bool value);
void setViewersButtonVisible(bool value);
void updateChannelText(); void updateChannelText();
void updateModerationModeIcon(); void updateModerationModeIcon();
@ -60,6 +61,7 @@ private:
Label *titleLabel_{}; Label *titleLabel_{};
EffectLabel *modeButton_{}; EffectLabel *modeButton_{};
Button *moderationButton_{}; Button *moderationButton_{};
Button *viewersButton_{};
Button *addButton_{}; Button *addButton_{};
// states // states