-
-
Notifications
You must be signed in to change notification settings - Fork 458
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: globally suppress highlight notifications #5629
Draft
jupjohn
wants to merge
14
commits into
Chatterino:master
Choose a base branch
from
jupjohn:feature/5628-globally-suppress-notifications
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+166
−2
Draft
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
e0cd185
feat: don't notify when global suppression is enabled
jupjohn 66f2c10
feat(hotkey): allow toggling of global suppression via window hotkey
jupjohn 4572a59
fix: correctly toggle global notifications setting
jupjohn dfeb588
feat: support passing toggle/on/off args to global notification mute …
jupjohn 296a838
chore: nicely ask clang to reformat files
jupjohn 54354ee
feat: toggle global notification suppression from notebook context menu
jupjohn eb0b0b4
feat: show global notification suppression hotkey alongside manu action
jupjohn 99a0aac
chore: set explicit value even though it's assigned on all paths
jupjohn 4d1af02
chore: rename user-facing notification muting text
jupjohn ea24653
doc: add changelog entry
jupjohn 1319caa
chore: adjust wording of notification muting hotkey args
jupjohn 57ffa7c
fix: pass off global notification signal connection to manager
jupjohn f9d68ed
feat: implement copy/pasted DnD tab bar icon
jupjohn 8d53756
chore: reformat closure argument
jupjohn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -222,6 +222,17 @@ void Window::addCustomTitlebarButtons() | |||||
QObject::connect(getApp()->getStreamerMode(), &IStreamerMode::changed, this, | ||||||
&Window::updateStreamerModeIcon); | ||||||
|
||||||
// do not disturb | ||||||
this->doNotDisturbTitlebarIcon_ = | ||||||
this->addTitleBarButton(TitleBarButtonStyle::DoNotDisturb, [this] { | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: lambda capture 'this' is not used [clang-diagnostic-unused-lambda-capture]
Suggested change
|
||||||
getSettings()->globallySuppressNotifications = false; | ||||||
}); | ||||||
getSettings()->globallySuppressNotifications.connect( | ||||||
[this] { | ||||||
this->updateDoNotDisturbIcon(); | ||||||
}, | ||||||
this->signalHolder_); | ||||||
|
||||||
// Update initial state | ||||||
this->updateStreamerModeIcon(); | ||||||
} | ||||||
|
@@ -256,6 +267,38 @@ void Window::updateStreamerModeIcon() | |||||
#endif | ||||||
} | ||||||
|
||||||
void Window::updateDoNotDisturbIcon() | ||||||
{ | ||||||
// TODO(jupjohn): add custom icon for this | ||||||
|
||||||
// A duplicate of this code is in SplitNotebook class (in Notebook.{c,h}pp) | ||||||
// That one is the one near splits (on linux and mac or non-main windows on Windows) | ||||||
// This copy handles the TitleBar icon in Window (main window on Windows) | ||||||
if (this->doNotDisturbTitlebarIcon_ == nullptr) | ||||||
{ | ||||||
return; | ||||||
} | ||||||
#ifdef Q_OS_WIN | ||||||
assert(this->getType() == WindowType::Main); | ||||||
if (getTheme()->isLightTheme()) | ||||||
{ | ||||||
this->doNotDisturbIcon_->setPixmap( | ||||||
getResources().buttons.streamerModeEnabledLight); | ||||||
} | ||||||
else | ||||||
{ | ||||||
this->doNotDisturbIcon_->setPixmap( | ||||||
getResources().buttons.streamerModeEnabledDark); | ||||||
} | ||||||
this->doNotDisturbIcon_->setVisible( | ||||||
getSettings()->globallySuppressNotifications); | ||||||
#else | ||||||
// clang-format off | ||||||
assert(false && "Streamer mode TitleBar icon should not exist on non-Windows OSes"); | ||||||
// clang-format on | ||||||
#endif | ||||||
} | ||||||
|
||||||
void Window::themeChangedEvent() | ||||||
{ | ||||||
this->updateStreamerModeIcon(); | ||||||
|
@@ -682,7 +725,38 @@ void Window::addShortcuts() | |||||
|
||||||
return ""; | ||||||
}}, | ||||||
}; | ||||||
{"toggleGlobalNotificationSuppression", | ||||||
[](const std::vector<QString> &arguments) -> QString { | ||||||
QString arg = arguments.empty() ? "toggle" : arguments.front(); | ||||||
|
||||||
bool desiredValue = false; | ||||||
if (arg == "toggle") | ||||||
{ | ||||||
desiredValue = !getSettings()->globallySuppressNotifications; | ||||||
} | ||||||
else if (arg == "on") | ||||||
{ | ||||||
desiredValue = true; | ||||||
} | ||||||
else if (arg == "off") | ||||||
{ | ||||||
desiredValue = false; | ||||||
} | ||||||
else | ||||||
{ | ||||||
qCWarning(chatterinoHotkeys) | ||||||
<< "Invalid argument for " | ||||||
"toggleGlobalNotificationSuppression hotkey: " | ||||||
<< arg; | ||||||
return QString("Invalid argument for " | ||||||
"toggleGlobalNotificationSuppression hotkey: " | ||||||
"%1. Use \"on\", \"off\", or \"toggle\".") | ||||||
.arg(arg); | ||||||
} | ||||||
|
||||||
getSettings()->globallySuppressNotifications = desiredValue; | ||||||
return ""; | ||||||
}}}; | ||||||
|
||||||
this->addDebugStuff(actions); | ||||||
|
||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: lambda capture 'this' is not used [clang-diagnostic-unused-lambda-capture]