rename highlight style to highlight state

This commit is contained in:
Rasmus Karlsson 2017-12-26 12:05:14 +01:00
parent 03962db367
commit ebd682730a
2 changed files with 11 additions and 13 deletions

View file

@ -110,14 +110,9 @@ void NotebookTab::setSelected(bool value)
this->update(); this->update();
} }
NotebookTab::HighlightStyle NotebookTab::getHighlightStyle() const void NotebookTab::setHighlightState(HighlightState newHighlightStyle)
{ {
return this->highlightStyle; this->highlightState = newHighlightStyle;
}
void NotebookTab::setHighlightStyle(HighlightStyle newHighlightStyle)
{
this->highlightStyle = newHighlightStyle;
this->update(); this->update();
} }
@ -174,10 +169,10 @@ void NotebookTab::paintEvent(QPaintEvent *)
} else if (this->mouseOver) { } else if (this->mouseOver) {
painter.fillRect(rect(), this->colorScheme.TabHoverBackground); painter.fillRect(rect(), this->colorScheme.TabHoverBackground);
fg = this->colorScheme.TabHoverText; fg = this->colorScheme.TabHoverText;
} else if (this->highlightStyle == HighlightHighlighted) { } else if (this->highlightState == HighlightState::Highlighted) {
painter.fillRect(rect(), this->colorScheme.TabHighlightedBackground); painter.fillRect(rect(), this->colorScheme.TabHighlightedBackground);
fg = this->colorScheme.TabHighlightedText; fg = this->colorScheme.TabHighlightedText;
} else if (this->highlightStyle == HighlightNewMessage) { } else if (this->highlightState == HighlightState::NewMessage) {
painter.fillRect(rect(), this->colorScheme.TabNewMessageBackground); painter.fillRect(rect(), this->colorScheme.TabNewMessageBackground);
fg = this->colorScheme.TabHighlightedText; fg = this->colorScheme.TabHighlightedText;
} else { } else {

View file

@ -23,7 +23,11 @@ class NotebookTab : public BaseWidget
std::string settingRoot; std::string settingRoot;
public: public:
enum HighlightStyle { HighlightNone, HighlightHighlighted, HighlightNewMessage }; enum class HighlightState {
None,
Highlighted,
NewMessage,
};
explicit NotebookTab(Notebook *_notebook, const std::string &settingPrefix); explicit NotebookTab(Notebook *_notebook, const std::string &settingPrefix);
@ -36,8 +40,7 @@ public:
bool isSelected() const; bool isSelected() const;
void setSelected(bool value); void setSelected(bool value);
HighlightStyle getHighlightStyle() const; void setHighlightState(HighlightState style);
void setHighlightStyle(HighlightStyle style);
void moveAnimated(QPoint pos, bool animated = true); void moveAnimated(QPoint pos, bool animated = true);
@ -77,7 +80,7 @@ private:
bool mouseOverX = false; bool mouseOverX = false;
bool mouseDownX = false; bool mouseDownX = false;
HighlightStyle highlightStyle = HighlightStyle::HighlightNone; HighlightState highlightState = HighlightState::None;
QMenu menu; QMenu menu;