Added a Live status indicator to tabs
This commit is contained in:
@@ -168,13 +168,20 @@ void NotebookTab::setSelected(bool value)
|
||||
this->update();
|
||||
}
|
||||
|
||||
void NotebookTab::setLive(bool isLive)
|
||||
{
|
||||
if (this->isLive_ != isLive) {
|
||||
this->isLive_ = isLive;
|
||||
this->update();
|
||||
}
|
||||
}
|
||||
|
||||
void NotebookTab::setHighlightState(HighlightState newHighlightStyle)
|
||||
{
|
||||
if (this->isSelected() || !this->highlightEnabled_) {
|
||||
return;
|
||||
}
|
||||
if (this->highlightState_ != HighlightState::Highlighted &&
|
||||
this->highlightState_ != HighlightState::Notification) {
|
||||
if (this->highlightState_ != HighlightState::Highlighted) {
|
||||
this->highlightState_ = newHighlightStyle;
|
||||
|
||||
this->update();
|
||||
@@ -252,8 +259,6 @@ void NotebookTab::paintEvent(QPaintEvent *)
|
||||
colors = this->theme->tabs.selected;
|
||||
} else if (this->highlightState_ == HighlightState::Highlighted) {
|
||||
colors = this->theme->tabs.highlighted;
|
||||
} else if (this->highlightState_ == HighlightState::Notification) {
|
||||
colors = this->theme->tabs.notified;
|
||||
} else if (this->highlightState_ == HighlightState::NewMessage) {
|
||||
colors = this->theme->tabs.newMessage;
|
||||
} else {
|
||||
@@ -297,6 +302,20 @@ void NotebookTab::paintEvent(QPaintEvent *)
|
||||
? colors.line.hover
|
||||
: (windowFocused ? colors.line.regular : colors.line.unfocused));
|
||||
|
||||
// draw live indicator
|
||||
if (this->isLive_) {
|
||||
painter.setPen(QColor(Qt::GlobalColor::red));
|
||||
QBrush b;
|
||||
b.setColor(QColor(Qt::GlobalColor::red));
|
||||
b.setStyle(Qt::SolidPattern);
|
||||
painter.setBrush(b);
|
||||
|
||||
auto x = this->width() - (6.f * scale);
|
||||
auto y = 4.f * scale;
|
||||
auto diameter = 4.f * scale;
|
||||
painter.drawEllipse(QRectF(x, y, diameter, diameter));
|
||||
}
|
||||
|
||||
// set the pen color
|
||||
painter.setPen(colors.text);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user