mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
Merge pull request #739 from Cranken/enableHighlightTab
Option to disable highlight of tab; disabled switching tabs by only right clicking
This commit is contained in:
commit
0e794f5a6d
|
@ -62,12 +62,14 @@ NotebookTab::NotebookTab(Notebook *notebook)
|
|||
this->menu_.addAction("Close",
|
||||
[=]() { this->notebook_->removePage(this->page); });
|
||||
|
||||
// this->menu.addAction(enableHighlightsOnNewMessageAction);
|
||||
|
||||
// QObject::connect(enableHighlightsOnNewMessageAction,
|
||||
// &QAction::toggled, [this](bool newValue) {
|
||||
// Log("New value is {}", newValue); //
|
||||
// });
|
||||
auto highlightNewMessagesAction =
|
||||
new QAction("Enable highlights on new messages", &this->menu_);
|
||||
highlightNewMessagesAction->setCheckable(true);
|
||||
highlightNewMessagesAction->setChecked(true);
|
||||
QObject::connect(
|
||||
highlightNewMessagesAction, &QAction::triggered,
|
||||
[this](bool checked) { this->highlightEnabled_ = checked; });
|
||||
this->menu_.addAction(highlightNewMessagesAction);
|
||||
}
|
||||
|
||||
void NotebookTab::themeChangedEvent()
|
||||
|
@ -168,7 +170,7 @@ void NotebookTab::setSelected(bool value)
|
|||
|
||||
void NotebookTab::setHighlightState(HighlightState newHighlightStyle)
|
||||
{
|
||||
if (this->isSelected()) {
|
||||
if (this->isSelected() || !this->highlightEnabled_) {
|
||||
return;
|
||||
}
|
||||
if (this->highlightState_ != HighlightState::Highlighted &&
|
||||
|
@ -356,13 +358,15 @@ bool NotebookTab::shouldDrawXButton()
|
|||
|
||||
void NotebookTab::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
this->mouseDown_ = true;
|
||||
this->mouseDownX_ = this->getXRect().contains(event->pos());
|
||||
if (event->button() == Qt::LeftButton) {
|
||||
this->mouseDown_ = true;
|
||||
this->mouseDownX_ = this->getXRect().contains(event->pos());
|
||||
|
||||
this->notebook_->select(page);
|
||||
}
|
||||
|
||||
this->update();
|
||||
|
||||
this->notebook_->select(page);
|
||||
|
||||
if (this->notebook_->getAllowUserTabManagement()) {
|
||||
switch (event->button()) {
|
||||
case Qt::RightButton: {
|
||||
|
|
|
@ -82,6 +82,7 @@ private:
|
|||
bool mouseDownX_ = false;
|
||||
|
||||
HighlightState highlightState_ = HighlightState::None;
|
||||
bool highlightEnabled_ = true;
|
||||
|
||||
QMenu menu_;
|
||||
|
||||
|
|
Loading…
Reference in a new issue