Compare commits

..

2 commits

Author SHA1 Message Date
hemirt f9e395e447
Merge 0e506fc175 into 90211cca55 2024-10-28 13:41:39 +01:00
unknown 0e506fc175 remove remnants of different strategy 2024-10-28 13:41:16 +01:00
5 changed files with 18 additions and 27 deletions

View file

@ -1194,13 +1194,11 @@ void ChannelView::messageAppended(MessagePtr &message,
(this->channel_->getType() == Channel::Type::TwitchAutomod && (this->channel_->getType() == Channel::Type::TwitchAutomod &&
getSettings()->enableAutomodHighlight)) getSettings()->enableAutomodHighlight))
{ {
this->tabHighlightRequested.invoke(HighlightState::Highlighted, this->tabHighlightRequested.invoke(HighlightState::Highlighted);
message);
} }
else else
{ {
this->tabHighlightRequested.invoke(HighlightState::NewMessage, this->tabHighlightRequested.invoke(HighlightState::NewMessage);
message);
} }
} }

View file

@ -225,8 +225,7 @@ public:
pajlada::Signals::Signal<QMouseEvent *> mouseDown; pajlada::Signals::Signal<QMouseEvent *> mouseDown;
pajlada::Signals::NoArgSignal selectionChanged; pajlada::Signals::NoArgSignal selectionChanged;
pajlada::Signals::Signal<HighlightState, const MessagePtr &> pajlada::Signals::Signal<HighlightState> tabHighlightRequested;
tabHighlightRequested;
pajlada::Signals::NoArgSignal liveStatusChanged; pajlada::Signals::NoArgSignal liveStatusChanged;
pajlada::Signals::Signal<const Link &> linkClicked; pajlada::Signals::Signal<const Link &> linkClicked;
pajlada::Signals::Signal<QString, FromTwitchLinkOpenChannelIn> pajlada::Signals::Signal<QString, FromTwitchLinkOpenChannelIn>

View file

@ -518,8 +518,7 @@ void NotebookTab::setHighlightState(HighlightState newHighlightStyle)
} }
void NotebookTab::updateHighlightState(HighlightState newHighlightStyle, void NotebookTab::updateHighlightState(HighlightState newHighlightStyle,
const ChannelView &channelViewSource, const ChannelView &channelViewSource)
const MessagePtr &message)
{ {
if (this->isSelected()) if (this->isSelected())
{ {
@ -528,7 +527,7 @@ void NotebookTab::updateHighlightState(HighlightState newHighlightStyle,
return; return;
} }
if (!this->shouldMessageHighlight(channelViewSource, message)) if (!this->shouldMessageHighlight(channelViewSource))
{ {
return; return;
} }
@ -572,8 +571,8 @@ void NotebookTab::updateHighlightState(HighlightState newHighlightStyle,
this->update(); this->update();
} }
bool NotebookTab::shouldMessageHighlight(const ChannelView &channelViewSource, bool NotebookTab::shouldMessageHighlight(
const MessagePtr &message) const const ChannelView &channelViewSource) const
{ {
auto *visibleSplitContainer = auto *visibleSplitContainer =
dynamic_cast<SplitContainer *>(this->notebook_->getSelectedPage()); dynamic_cast<SplitContainer *>(this->notebook_->getSelectedPage());
@ -583,9 +582,7 @@ bool NotebookTab::shouldMessageHighlight(const ChannelView &channelViewSource,
for (const auto &visibleSplit : visibleSplits) for (const auto &visibleSplit : visibleSplits)
{ {
if (channelViewSource.getID() == if (channelViewSource.getID() ==
visibleSplit->getChannelView().getID() && visibleSplit->getChannelView().getID())
visibleSplit->getChannelView().shouldIncludeMessage(message) &&
channelViewSource.shouldIncludeMessage(message))
{ {
return false; return false;
} }

View file

@ -72,8 +72,7 @@ public:
* Obeys the HighlightsEnabled setting and the highlight state hierarchy and tracks the highlight state update sources * Obeys the HighlightsEnabled setting and the highlight state hierarchy and tracks the highlight state update sources
*/ */
void updateHighlightState(HighlightState style, void updateHighlightState(HighlightState style,
const ChannelView &channelViewSource, const ChannelView &channelViewSource);
const MessagePtr &message);
void copyHighlightStateAndSourcesFrom(const NotebookTab *sourceTab); void copyHighlightStateAndSourcesFrom(const NotebookTab *sourceTab);
void setHighlightsEnabled(const bool &newVal); void setHighlightsEnabled(const bool &newVal);
void newHighlightSourceAdded(const ChannelView &channelViewSource); void newHighlightSourceAdded(const ChannelView &channelViewSource);
@ -122,8 +121,7 @@ private:
int normalTabWidthForHeight(int height) const; int normalTabWidthForHeight(int height) const;
bool shouldMessageHighlight(const ChannelView &channelViewSource, bool shouldMessageHighlight(const ChannelView &channelViewSource) const;
const MessagePtr &message) const;
using HighlightSources = using HighlightSources =
std::unordered_map<ChannelView::ChannelViewID, HighlightState>; std::unordered_map<ChannelView::ChannelViewID, HighlightState>;

View file

@ -213,15 +213,14 @@ void SplitContainer::addSplit(Split *split)
auto &&conns = this->connectionsPerSplit_[split]; auto &&conns = this->connectionsPerSplit_[split];
conns.managedConnect( conns.managedConnect(split->getChannelView().tabHighlightRequested,
split->getChannelView().tabHighlightRequested, [this, split](HighlightState state) {
[this, split](HighlightState state, const MessagePtr &message) { if (this->tab_ != nullptr)
if (this->tab_ != nullptr) {
{ this->tab_->updateHighlightState(
this->tab_->updateHighlightState(state, split->getChannelView(), state, split->getChannelView());
message); }
} });
});
conns.managedConnect(split->channelChanged, [this, split] { conns.managedConnect(split->channelChanged, [this, split] {
if (this->tab_ != nullptr) if (this->tab_ != nullptr)