mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
Return previous state of tab when channel go offline.
This commit is contained in:
parent
31b9d497d7
commit
da120312af
5 changed files with 13 additions and 1 deletions
|
@ -18,6 +18,7 @@ enum class HighlightState {
|
|||
Highlighted,
|
||||
NewMessage,
|
||||
Notification,
|
||||
Offline,
|
||||
};
|
||||
|
||||
inline QString qS(const std::string &string)
|
||||
|
|
|
@ -419,6 +419,8 @@ void TwitchChannel::setLive(bool newLiveStatus)
|
|||
auto offline =
|
||||
makeSystemMessage(this->getName() + " is offline");
|
||||
this->addMessage(offline);
|
||||
this->tabHighlightRequested.invoke(
|
||||
HighlightState::Offline);
|
||||
}
|
||||
guard->live = newLiveStatus;
|
||||
}
|
||||
|
|
|
@ -555,7 +555,7 @@ void ChannelView::setChannel(ChannelPtr newChannel)
|
|||
TwitchChannel *tc = dynamic_cast<TwitchChannel *>(newChannel.get());
|
||||
if (tc != nullptr) {
|
||||
tc->tabHighlightRequested.connect([this](HighlightState state) {
|
||||
this->tabHighlightRequested.invoke(HighlightState::Notification);
|
||||
this->tabHighlightRequested.invoke(state);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -164,6 +164,7 @@ void NotebookTab::setSelected(bool value)
|
|||
this->selected_ = value;
|
||||
|
||||
this->highlightState_ = HighlightState::None;
|
||||
this->lastHighlightState_ = HighlightState::None;
|
||||
|
||||
this->update();
|
||||
}
|
||||
|
@ -178,6 +179,13 @@ void NotebookTab::setHighlightState(HighlightState newHighlightStyle)
|
|||
this->highlightState_ = newHighlightStyle;
|
||||
|
||||
this->update();
|
||||
} else if (newHighlightStyle == HighlightState::Offline) {
|
||||
this->highlightState_ = this->lastHighlightState_;
|
||||
this->update();
|
||||
}
|
||||
|
||||
if (newHighlightStyle != HighlightState::Notification) {
|
||||
this->lastHighlightState_ = newHighlightStyle;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -85,6 +85,7 @@ private:
|
|||
bool mouseDownX_ = false;
|
||||
|
||||
HighlightState highlightState_ = HighlightState::None;
|
||||
HighlightState lastHighlightState_ = HighlightState::None;
|
||||
bool highlightEnabled_ = true;
|
||||
QAction *highlightNewMessagesAction_;
|
||||
|
||||
|
|
Loading…
Reference in a new issue