add more highlight state functions

This commit is contained in:
unknown 2024-10-17 20:05:05 +02:00
parent 8745d0740f
commit 39e0e00f2d
3 changed files with 59 additions and 7 deletions

View file

@ -444,9 +444,43 @@ bool NotebookTab::isLive() const
return this->isLive_; return this->isLive_;
} }
void NotebookTab::setHighlightState(HighlightState newHighlightStyle, HighlightState NotebookTab::highlightState() const
const ChannelView &channelViewSource, {
const MessagePtr &message) return this->highlightState_;
}
void NotebookTab::setHighlightState(HighlightState newHighlightStyle)
{
if (this->isSelected())
{
return;
}
if (!this->highlightEnabled_ &&
newHighlightStyle == HighlightState::NewMessage)
{
return;
}
if (this->highlightState_ == newHighlightStyle ||
this->highlightState_ == HighlightState::Highlighted)
{
return;
}
this->highlightState_ = newHighlightStyle;
this->update();
}
void NotebookTab::forceHighlightState(HighlightState newHighlightStyle)
{
this->highlightState_ = newHighlightStyle;
this->update();
}
void NotebookTab::updateHighlightState(HighlightState newHighlightStyle,
const ChannelView &channelViewSource,
const MessagePtr &message)
{ {
if (this->isSelected()) if (this->isSelected())
{ {

View file

@ -60,12 +60,30 @@ public:
**/ **/
bool isLive() const; bool isLive() const;
void setHighlightState(HighlightState style, /**
const ChannelView &channelViewSource, * @brief Sets the highlight state of this tab clearing out highlight sources
const MessagePtr &message); *
* Obeys the HighlightsEnabled setting and highlight states hierarchy
*/
void setHighlightState(HighlightState style);
/**
* @brief Forces the highlight state of this tab
*
* Does NOT obey the HighlightsEnabled setting and the highlight states hierarchy
*/
void forceHighlightState(HighlightState style);
/**
* @brief Updates the highlight state and highlight sources of this tab
*
* Obeys the HighlightsEnabled setting and the highlight state hierarchy and tracks the highlight state update sources
*/
void updateHighlightState(HighlightState style,
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);
bool hasHighlightsEnabled() const; bool hasHighlightsEnabled() const;
HighlightState highlightState() const;
void moveAnimated(QPoint targetPos, bool animated = true); void moveAnimated(QPoint targetPos, bool animated = true);

View file

@ -218,7 +218,7 @@ void SplitContainer::addSplit(Split *split)
HighlightState state, const MessagePtr &message) { HighlightState state, const MessagePtr &message) {
if (this->tab_ != nullptr) if (this->tab_ != nullptr)
{ {
this->tab_->setHighlightState( this->tab_->updateHighlightState(
state, channelView, message); state, channelView, message);
} }
}); });