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 chatterino {
|
||||||
namespace {
|
namespace {
|
||||||
auto formatRoomMode(TwitchChannel &channel)
|
auto formatRoomMode(TwitchChannel &channel) -> QString
|
||||||
{
|
{
|
||||||
QString text;
|
QString text;
|
||||||
|
|
||||||
|
@ -54,6 +54,8 @@ auto formatRoomMode(TwitchChannel &channel)
|
||||||
text = match.captured(1) + '\n' + match.captured(2);
|
text = match.captured(1) + '\n' + match.captured(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (text.isEmpty() && channel.hasModRights()) return "none";
|
||||||
|
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
auto formatTooltip(const TwitchChannel::StreamStatus &s)
|
auto formatTooltip(const TwitchChannel::StreamStatus &s)
|
||||||
|
@ -156,11 +158,8 @@ void SplitHeader::initializeLayout()
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
// dropdown
|
// dropdown
|
||||||
this->dropdownButton_ = makeWidget<Button>([&](auto w) {
|
this->dropdownButton_ = makeWidget<Button>(
|
||||||
w->setMouseTracking(true);
|
[&](auto w) { w->setMenu(this->createMainMenu()); })});
|
||||||
w->setMenu(this->createMainMenu());
|
|
||||||
QObject::connect(w, &Button::leftMousePress, this, [this] {});
|
|
||||||
})});
|
|
||||||
|
|
||||||
layout->setMargin(0);
|
layout->setMargin(0);
|
||||||
layout->setSpacing(0);
|
layout->setSpacing(0);
|
||||||
|
@ -293,32 +292,22 @@ void SplitHeader::updateRoomModes()
|
||||||
void SplitHeader::initializeModeSignals(EffectLabel &label)
|
void SplitHeader::initializeModeSignals(EffectLabel &label)
|
||||||
{
|
{
|
||||||
this->modeUpdateRequested_.connect([this, &label] {
|
this->modeUpdateRequested_.connect([this, &label] {
|
||||||
auto twitchChannel =
|
if (auto twitchChannel = dynamic_cast<TwitchChannel *>(
|
||||||
dynamic_cast<TwitchChannel *>(this->split_->getChannel().get());
|
this->split_->getChannel().get())) //
|
||||||
|
{
|
||||||
// return if the channel is not a twitch channel
|
|
||||||
if (twitchChannel == nullptr) {
|
|
||||||
label.hide();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// set lable enabled
|
|
||||||
label.setEnable(twitchChannel->hasModRights());
|
label.setEnable(twitchChannel->hasModRights());
|
||||||
|
|
||||||
// set the label text
|
// set the label text
|
||||||
auto text = formatRoomMode(*twitchChannel);
|
auto text = formatRoomMode(*twitchChannel);
|
||||||
|
|
||||||
if (text.isEmpty()) {
|
if (!text.isEmpty()) {
|
||||||
if (twitchChannel->hasModRights()) {
|
|
||||||
label.getLabel().setText("none");
|
|
||||||
label.show();
|
|
||||||
} else {
|
|
||||||
label.hide();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
label.getLabel().setText(text);
|
label.getLabel().setText(text);
|
||||||
label.show();
|
label.show();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
label.hide();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue