mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
Compare commits
1 commit
f9e395e447
...
42b8f69e7d
Author | SHA1 | Date | |
---|---|---|---|
42b8f69e7d |
|
@ -1194,11 +1194,13 @@ void ChannelView::messageAppended(MessagePtr &message,
|
|||
(this->channel_->getType() == Channel::Type::TwitchAutomod &&
|
||||
getSettings()->enableAutomodHighlight))
|
||||
{
|
||||
this->tabHighlightRequested.invoke(HighlightState::Highlighted);
|
||||
this->tabHighlightRequested.invoke(HighlightState::Highlighted,
|
||||
message);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->tabHighlightRequested.invoke(HighlightState::NewMessage);
|
||||
this->tabHighlightRequested.invoke(HighlightState::NewMessage,
|
||||
message);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -225,7 +225,8 @@ public:
|
|||
|
||||
pajlada::Signals::Signal<QMouseEvent *> mouseDown;
|
||||
pajlada::Signals::NoArgSignal selectionChanged;
|
||||
pajlada::Signals::Signal<HighlightState> tabHighlightRequested;
|
||||
pajlada::Signals::Signal<HighlightState, const MessagePtr &>
|
||||
tabHighlightRequested;
|
||||
pajlada::Signals::NoArgSignal liveStatusChanged;
|
||||
pajlada::Signals::Signal<const Link &> linkClicked;
|
||||
pajlada::Signals::Signal<QString, FromTwitchLinkOpenChannelIn>
|
||||
|
|
|
@ -518,7 +518,8 @@ void NotebookTab::setHighlightState(HighlightState newHighlightStyle)
|
|||
}
|
||||
|
||||
void NotebookTab::updateHighlightState(HighlightState newHighlightStyle,
|
||||
const ChannelView &channelViewSource)
|
||||
const ChannelView &channelViewSource,
|
||||
const MessagePtr &message)
|
||||
{
|
||||
if (this->isSelected())
|
||||
{
|
||||
|
@ -527,7 +528,7 @@ void NotebookTab::updateHighlightState(HighlightState newHighlightStyle,
|
|||
return;
|
||||
}
|
||||
|
||||
if (!this->shouldMessageHighlight(channelViewSource))
|
||||
if (!this->shouldMessageHighlight(channelViewSource, message))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -571,8 +572,8 @@ void NotebookTab::updateHighlightState(HighlightState newHighlightStyle,
|
|||
this->update();
|
||||
}
|
||||
|
||||
bool NotebookTab::shouldMessageHighlight(
|
||||
const ChannelView &channelViewSource) const
|
||||
bool NotebookTab::shouldMessageHighlight(const ChannelView &channelViewSource,
|
||||
const MessagePtr &message) const
|
||||
{
|
||||
auto *visibleSplitContainer =
|
||||
dynamic_cast<SplitContainer *>(this->notebook_->getSelectedPage());
|
||||
|
@ -582,7 +583,9 @@ bool NotebookTab::shouldMessageHighlight(
|
|||
for (const auto &visibleSplit : visibleSplits)
|
||||
{
|
||||
if (channelViewSource.getID() ==
|
||||
visibleSplit->getChannelView().getID())
|
||||
visibleSplit->getChannelView().getID() &&
|
||||
visibleSplit->getChannelView().shouldIncludeMessage(message) &&
|
||||
channelViewSource.shouldIncludeMessage(message))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -72,7 +72,8 @@ public:
|
|||
* Obeys the HighlightsEnabled setting and the highlight state hierarchy and tracks the highlight state update sources
|
||||
*/
|
||||
void updateHighlightState(HighlightState style,
|
||||
const ChannelView &channelViewSource);
|
||||
const ChannelView &channelViewSource,
|
||||
const MessagePtr &message);
|
||||
void copyHighlightStateAndSourcesFrom(const NotebookTab *sourceTab);
|
||||
void setHighlightsEnabled(const bool &newVal);
|
||||
void newHighlightSourceAdded(const ChannelView &channelViewSource);
|
||||
|
@ -121,7 +122,8 @@ private:
|
|||
|
||||
int normalTabWidthForHeight(int height) const;
|
||||
|
||||
bool shouldMessageHighlight(const ChannelView &channelViewSource) const;
|
||||
bool shouldMessageHighlight(const ChannelView &channelViewSource,
|
||||
const MessagePtr &message) const;
|
||||
|
||||
using HighlightSources =
|
||||
std::unordered_map<ChannelView::ChannelViewID, HighlightState>;
|
||||
|
|
|
@ -213,12 +213,13 @@ void SplitContainer::addSplit(Split *split)
|
|||
|
||||
auto &&conns = this->connectionsPerSplit_[split];
|
||||
|
||||
conns.managedConnect(split->getChannelView().tabHighlightRequested,
|
||||
[this, split](HighlightState state) {
|
||||
conns.managedConnect(
|
||||
split->getChannelView().tabHighlightRequested,
|
||||
[this, split](HighlightState state, const MessagePtr &message) {
|
||||
if (this->tab_ != nullptr)
|
||||
{
|
||||
this->tab_->updateHighlightState(
|
||||
state, split->getChannelView());
|
||||
this->tab_->updateHighlightState(state, split->getChannelView(),
|
||||
message);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue