Live streams that are marked as reruns now mark a tab as yellow instead of red (#5176)

This commit is contained in:
Mm2PL
2024-02-18 17:22:53 +01:00
committed by GitHub
parent 641cb26a76
commit 5c51ec8382
9 changed files with 71 additions and 5 deletions
+26 -4
View File
@@ -327,6 +327,18 @@ void NotebookTab::setTabLocation(NotebookTabLocation location)
}
}
bool NotebookTab::setRerun(bool isRerun)
{
if (this->isRerun_ != isRerun)
{
this->isRerun_ = isRerun;
this->update();
return true;
}
return false;
}
bool NotebookTab::setLive(bool isLive)
{
if (this->isLive_ != isLive)
@@ -514,12 +526,22 @@ void NotebookTab::paintEvent(QPaintEvent *)
painter.fillRect(lineRect, lineColor);
// draw live indicator
if (this->isLive_ && getSettings()->showTabLive)
if ((this->isLive_ || this->isRerun_) && getSettings()->showTabLive)
{
painter.setPen(QColor(Qt::GlobalColor::red));
painter.setRenderHint(QPainter::Antialiasing);
// Live overrides rerun
QBrush b;
b.setColor(QColor(Qt::GlobalColor::red));
if (this->isLive_)
{
painter.setPen(QColor(Qt::GlobalColor::red));
b.setColor(QColor(Qt::GlobalColor::red));
}
else
{
painter.setPen(QColor(Qt::GlobalColor::yellow));
b.setColor(QColor(Qt::GlobalColor::yellow));
}
painter.setRenderHint(QPainter::Antialiasing);
b.setStyle(Qt::SolidPattern);
painter.setBrush(b);
+8
View File
@@ -47,6 +47,13 @@ public:
**/
bool setLive(bool isLive);
/**
* @brief Sets the rerun status of this tab
*
* Returns true if the rerun status was changed, false if nothing changed.
**/
bool setRerun(bool isRerun);
/**
* @brief Returns true if any split in this tab is live
**/
@@ -121,6 +128,7 @@ private:
QAction *highlightNewMessagesAction_;
bool isLive_{};
bool isRerun_{};
int growWidth_ = 0;
+7 -1
View File
@@ -926,9 +926,15 @@ void SplitContainer::refreshTabLiveStatus()
}
bool liveStatus = false;
bool rerunStatus = false;
for (const auto &s : this->splits_)
{
auto c = s->getChannel();
if (c->isRerun())
{
rerunStatus = true;
continue; // reruns are also marked as live, SKIP
}
if (c->isLive())
{
liveStatus = true;
@@ -936,7 +942,7 @@ void SplitContainer::refreshTabLiveStatus()
}
}
if (this->tab_->setLive(liveStatus))
if (this->tab_->setLive(liveStatus) || this->tab_->setRerun(rerunStatus))
{
auto *notebook = dynamic_cast<Notebook *>(this->parentWidget());
if (notebook)