mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
Added button on tab to enable/disable highlighting.
This commit is contained in:
parent
3868feb0fa
commit
f25f31a837
2 changed files with 9 additions and 7 deletions
|
@ -62,12 +62,13 @@ NotebookTab::NotebookTab(Notebook *notebook)
|
||||||
this->menu_.addAction("Close",
|
this->menu_.addAction("Close",
|
||||||
[=]() { this->notebook_->removePage(this->page); });
|
[=]() { this->notebook_->removePage(this->page); });
|
||||||
|
|
||||||
// this->menu.addAction(enableHighlightsOnNewMessageAction);
|
auto highlightNewMessagesAction = new QAction("Enable highlights on new messages", &this->menu_);
|
||||||
|
highlightNewMessagesAction->setCheckable(true);
|
||||||
// QObject::connect(enableHighlightsOnNewMessageAction,
|
highlightNewMessagesAction->setChecked(true);
|
||||||
// &QAction::toggled, [this](bool newValue) {
|
QObject::connect(highlightNewMessagesAction, &QAction::triggered, [this] (bool checked) {
|
||||||
// Log("New value is {}", newValue); //
|
this->highlightEnabled = checked;
|
||||||
// });
|
});
|
||||||
|
this->menu_.addAction(highlightNewMessagesAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotebookTab::themeChangedEvent()
|
void NotebookTab::themeChangedEvent()
|
||||||
|
@ -168,7 +169,7 @@ void NotebookTab::setSelected(bool value)
|
||||||
|
|
||||||
void NotebookTab::setHighlightState(HighlightState newHighlightStyle)
|
void NotebookTab::setHighlightState(HighlightState newHighlightStyle)
|
||||||
{
|
{
|
||||||
if (this->isSelected()) {
|
if (this->isSelected() || !this->highlightEnabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (this->highlightState_ != HighlightState::Highlighted &&
|
if (this->highlightState_ != HighlightState::Highlighted &&
|
||||||
|
|
|
@ -82,6 +82,7 @@ private:
|
||||||
bool mouseDownX_ = false;
|
bool mouseDownX_ = false;
|
||||||
|
|
||||||
HighlightState highlightState_ = HighlightState::None;
|
HighlightState highlightState_ = HighlightState::None;
|
||||||
|
bool highlightEnabled = true;
|
||||||
|
|
||||||
QMenu menu_;
|
QMenu menu_;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue