mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
Now saves the enable highlight on new message tab setting.
This commit is contained in:
parent
0e794f5a6d
commit
22d009962d
|
@ -301,6 +301,10 @@ void WindowManager::initialize(Settings &settings, Paths &paths)
|
|||
window.getNotebook().select(page);
|
||||
}
|
||||
|
||||
// highlighting on new messages
|
||||
bool val = tab_obj.value("highlightsEnabled").toBool(true);
|
||||
page->getTab()->setHighlightsEnabled(val);
|
||||
|
||||
// load splits
|
||||
QJsonObject splitRoot = tab_obj.value("splits2").toObject();
|
||||
|
||||
|
@ -400,6 +404,10 @@ void WindowManager::save()
|
|||
tab_obj.insert("selected", true);
|
||||
}
|
||||
|
||||
// highlighting on new messages
|
||||
tab_obj.insert("highlightsEnabled",
|
||||
tab->getTab()->hasHighlightsEnabled());
|
||||
|
||||
// splits
|
||||
QJsonObject splits;
|
||||
|
||||
|
|
|
@ -55,21 +55,17 @@ NotebookTab::NotebookTab(Notebook *notebook)
|
|||
}
|
||||
});
|
||||
|
||||
// QAction *enableHighlightsOnNewMessageAction =
|
||||
// new QAction("Enable highlights on new message", &this->menu);
|
||||
// enableHighlightsOnNewMessageAction->setCheckable(true);
|
||||
|
||||
this->menu_.addAction("Close",
|
||||
[=]() { this->notebook_->removePage(this->page); });
|
||||
|
||||
auto highlightNewMessagesAction =
|
||||
highlightNewMessagesAction_ =
|
||||
new QAction("Enable highlights on new messages", &this->menu_);
|
||||
highlightNewMessagesAction->setCheckable(true);
|
||||
highlightNewMessagesAction->setChecked(true);
|
||||
highlightNewMessagesAction_->setCheckable(true);
|
||||
highlightNewMessagesAction_->setChecked(highlightEnabled_);
|
||||
QObject::connect(
|
||||
highlightNewMessagesAction, &QAction::triggered,
|
||||
highlightNewMessagesAction_, &QAction::triggered,
|
||||
[this](bool checked) { this->highlightEnabled_ = checked; });
|
||||
this->menu_.addAction(highlightNewMessagesAction);
|
||||
this->menu_.addAction(highlightNewMessagesAction_);
|
||||
}
|
||||
|
||||
void NotebookTab::themeChangedEvent()
|
||||
|
@ -181,6 +177,17 @@ void NotebookTab::setHighlightState(HighlightState newHighlightStyle)
|
|||
}
|
||||
}
|
||||
|
||||
void NotebookTab::setHighlightsEnabled(const bool &newVal)
|
||||
{
|
||||
this->highlightNewMessagesAction_->setChecked(newVal);
|
||||
this->highlightEnabled_ = newVal;
|
||||
}
|
||||
|
||||
bool NotebookTab::hasHighlightsEnabled() const
|
||||
{
|
||||
return this->highlightEnabled_;
|
||||
}
|
||||
|
||||
QRect NotebookTab::getDesiredRect() const
|
||||
{
|
||||
return QRect(this->positionAnimationDesiredPoint_, size());
|
||||
|
|
|
@ -40,6 +40,8 @@ public:
|
|||
void setSelected(bool value);
|
||||
|
||||
void setHighlightState(HighlightState style);
|
||||
void setHighlightsEnabled(const bool &newVal);
|
||||
bool hasHighlightsEnabled() const;
|
||||
|
||||
void moveAnimated(QPoint pos, bool animated = true);
|
||||
|
||||
|
@ -83,6 +85,7 @@ private:
|
|||
|
||||
HighlightState highlightState_ = HighlightState::None;
|
||||
bool highlightEnabled_ = true;
|
||||
QAction *highlightNewMessagesAction_;
|
||||
|
||||
QMenu menu_;
|
||||
|
||||
|
|
Loading…
Reference in a new issue