Refactor SplitHeader class (#4276)
* Flatten static functions in anonymous namespace * SplitHeader ctor: Rename param * Header: Remove unnecessary `virtual`s * auto ptr where possible * Add curly braces * Comment twitch room modes * Treat roomModes->slowMode as an integer * Remove unused `this` from lambdas * Add `unsigned int` overload for localizeNumbers * Move thumbnail max age to a constexpr static & set explicit types * Explicitly use `QObject::connect` * Use `empty()` instead of `size()` * Name unused parameters * Move moderation action refreshing logic from SplitHeader to Split
This commit is contained in:
@@ -198,6 +198,12 @@ Split::Split(QWidget *parent)
|
||||
this->setSizePolicy(QSizePolicy::MinimumExpanding,
|
||||
QSizePolicy::MinimumExpanding);
|
||||
|
||||
// update moderation button when items changed
|
||||
this->signalHolder_.managedConnect(
|
||||
getSettings()->moderationActions.delayedItemsChanged, [this] {
|
||||
this->refreshModerationMode();
|
||||
});
|
||||
|
||||
this->signalHolder_.managedConnect(
|
||||
modifierStatusChanged, [this](Qt::KeyboardModifiers status) {
|
||||
if ((status ==
|
||||
@@ -632,6 +638,12 @@ void Split::joinChannelInNewTab(ChannelPtr channel)
|
||||
container->insertSplit(split);
|
||||
}
|
||||
|
||||
void Split::refreshModerationMode()
|
||||
{
|
||||
this->header_->updateModerationModeIcon();
|
||||
this->view_->queueLayout();
|
||||
}
|
||||
|
||||
void Split::openChannelInBrowserPlayer(ChannelPtr channel)
|
||||
{
|
||||
if (auto twitchChannel = dynamic_cast<TwitchChannel *>(channel.get()))
|
||||
@@ -723,8 +735,7 @@ void Split::setChannel(IndirectChannel newChannel)
|
||||
void Split::setModerationMode(bool value)
|
||||
{
|
||||
this->moderationMode_ = value;
|
||||
this->header_->updateModerationModeIcon();
|
||||
this->view_->queueLayout();
|
||||
this->refreshModerationMode();
|
||||
}
|
||||
|
||||
bool Split::getModerationMode() const
|
||||
|
||||
Reference in New Issue
Block a user