mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
Add viewer list button to twitch channel header (#2042)
This commit is contained in:
parent
e4d7f49952
commit
98762fdfa0
|
@ -2,6 +2,7 @@
|
|||
|
||||
## Unversioned
|
||||
|
||||
- Minor: Added viewer list button to twitch channel header. (#1978)
|
||||
- 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 customizable timeout buttons to the user info popup
|
||||
|
|
BIN
resources/buttons/viewersDark.png
Normal file
BIN
resources/buttons/viewersDark.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.4 KiB |
BIN
resources/buttons/viewersLight.png
Normal file
BIN
resources/buttons/viewersLight.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
|
@ -29,6 +29,8 @@
|
|||
<file>buttons/unvip.png</file>
|
||||
<file>buttons/update.png</file>
|
||||
<file>buttons/updateError.png</file>
|
||||
<file>buttons/viewersDark.png</file>
|
||||
<file>buttons/viewersLight.png</file>
|
||||
<file>buttons/vip.png</file>
|
||||
<file>chatterino.icns</file>
|
||||
<file>com.chatterino.chatterino.appdata.xml</file>
|
||||
|
|
|
@ -28,6 +28,8 @@ Resources2::Resources2()
|
|||
this->buttons.unvip = QPixmap(":/buttons/unvip.png");
|
||||
this->buttons.update = QPixmap(":/buttons/update.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->error = QPixmap(":/error.png");
|
||||
this->icon = QPixmap(":/icon.png");
|
||||
|
|
|
@ -35,6 +35,8 @@ public:
|
|||
QPixmap unvip;
|
||||
QPixmap update;
|
||||
QPixmap updateError;
|
||||
QPixmap viewersDark;
|
||||
QPixmap viewersLight;
|
||||
QPixmap vip;
|
||||
} buttons;
|
||||
QPixmap error;
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue