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