mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
minor changes
This commit is contained in:
parent
d89b62692a
commit
5957b87298
1 changed files with 16 additions and 27 deletions
|
@ -28,7 +28,7 @@
|
|||
|
||||
namespace chatterino {
|
||||
namespace {
|
||||
auto formatRoomMode(TwitchChannel &channel)
|
||||
auto formatRoomMode(TwitchChannel &channel) -> QString
|
||||
{
|
||||
QString text;
|
||||
|
||||
|
@ -54,6 +54,8 @@ auto formatRoomMode(TwitchChannel &channel)
|
|||
text = match.captured(1) + '\n' + match.captured(2);
|
||||
}
|
||||
|
||||
if (text.isEmpty() && channel.hasModRights()) return "none";
|
||||
|
||||
return text;
|
||||
}
|
||||
auto formatTooltip(const TwitchChannel::StreamStatus &s)
|
||||
|
@ -156,11 +158,8 @@ void SplitHeader::initializeLayout()
|
|||
});
|
||||
}),
|
||||
// dropdown
|
||||
this->dropdownButton_ = makeWidget<Button>([&](auto w) {
|
||||
w->setMouseTracking(true);
|
||||
w->setMenu(this->createMainMenu());
|
||||
QObject::connect(w, &Button::leftMousePress, this, [this] {});
|
||||
})});
|
||||
this->dropdownButton_ = makeWidget<Button>(
|
||||
[&](auto w) { w->setMenu(this->createMainMenu()); })});
|
||||
|
||||
layout->setMargin(0);
|
||||
layout->setSpacing(0);
|
||||
|
@ -293,32 +292,22 @@ void SplitHeader::updateRoomModes()
|
|||
void SplitHeader::initializeModeSignals(EffectLabel &label)
|
||||
{
|
||||
this->modeUpdateRequested_.connect([this, &label] {
|
||||
auto twitchChannel =
|
||||
dynamic_cast<TwitchChannel *>(this->split_->getChannel().get());
|
||||
|
||||
// return if the channel is not a twitch channel
|
||||
if (twitchChannel == nullptr) {
|
||||
label.hide();
|
||||
return;
|
||||
}
|
||||
|
||||
// set lable enabled
|
||||
if (auto twitchChannel = dynamic_cast<TwitchChannel *>(
|
||||
this->split_->getChannel().get())) //
|
||||
{
|
||||
label.setEnable(twitchChannel->hasModRights());
|
||||
|
||||
// set the label text
|
||||
auto text = formatRoomMode(*twitchChannel);
|
||||
|
||||
if (text.isEmpty()) {
|
||||
if (twitchChannel->hasModRights()) {
|
||||
label.getLabel().setText("none");
|
||||
label.show();
|
||||
} else {
|
||||
label.hide();
|
||||
}
|
||||
} else {
|
||||
if (!text.isEmpty()) {
|
||||
label.getLabel().setText(text);
|
||||
label.show();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
label.hide();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue