Skip to content
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

fix: special shortcut for Windows live notifications #5975

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .CI/chatterino-installer.iss
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ Source: "{#WORKING_DIR}vc_redist.x64.exe"; DestDir: "{tmp}"; Tasks: vcredist;
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Icons]
Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; AppUserModelID: ".Chatterino 2"
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; AppUserModelID: ".Chatterino 2"; Tasks: desktopicon

[Run]
; VC++ redistributable
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
- Bugfix: Fixed search in emote popup not always working correctly. (#5946)
- Bugfix: Fixed channel point redemptions with messages not showing up if PubSub is disconnected. (#5948)
- Bugfix: Fixed the input font not immediately updating when zooming in/out. (#5960)
- Bugfix: Fixed missing special shortcut for Windows live notifications. (#5975)
- Dev: Subscriptions to PubSub channel points redemption topics now use no auth token, making it continue to work during PubSub shutdown. (#5947)
- Dev: Add initial experimental EventSub support. (#5837, #5895, #5897, #5904, #5910, #5903, #5915, #5916, #5930, #5935, #5932, #5943, #5952, #5953, #5968, #5973, #5974)
- Dev: Remove unneeded platform specifier for toasts. (#5914)
Expand Down
5 changes: 5 additions & 0 deletions src/singletons/Settings.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "common/Channel.hpp"
#include "common/ChatterinoSetting.hpp"
#include "common/enums/MessageOverflow.hpp"
#include "common/Modes.hpp"
#include "common/SignalVector.hpp"
#include "controllers/filters/FilterRecord.hpp"
#include "controllers/highlights/HighlightBadge.hpp"
Expand Down Expand Up @@ -526,6 +527,10 @@ class Settings
"/notifications/suppressInitialLive", false};

BoolSetting notificationToast = {"/notifications/enableToast", false};
BoolSetting createShortcutForToasts = {
"/notifications/createShortcutForToasts",
Modes::instance().isPortable ? false : true,
};
IntSetting openFromToast = {"/notifications/openFromToast",
static_cast<int>(ToastReaction::OpenInBrowser)};

Expand Down
7 changes: 5 additions & 2 deletions src/singletons/Toasts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,11 +228,14 @@ void Toasts::ensureInitialized()
this->initialized_ = true;

auto *instance = WinToast::instance();
instance->setAppName(L"Chatterino2");
instance->setAppName(L"Chatterino");
instance->setAppUserModelId(
WinToast::configureAUMI(L"", L"Chatterino 2", L"",
Version::instance().version().toStdWString()));
instance->setShortcutPolicy(WinToast::SHORTCUT_POLICY_IGNORE);
if (!getSettings()->createShortcutForToasts)
{
instance->setShortcutPolicy(WinToast::SHORTCUT_POLICY_IGNORE);
}
WinToast::WinToastError error{};
instance->initialize(&error);

Expand Down
8 changes: 8 additions & 0 deletions src/widgets/settingspages/NotificationPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ NotificationPage::NotificationPage()
"Show notification", getSettings()->notificationToast));
#endif
#ifdef Q_OS_WIN
settings.append(this->createCheckBox(
"Create start menu shortcut (requires "
"restart)",
getSettings()->createShortcutForToasts,
"When enabled, a shortcut will be created inside your "
"start menu folder if needed by live notifications."
"\n(On portable mode, this is disabled by "
"default)"));
Comment on lines +54 to +61
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use SettingWidget here, which means you wouldn't have to update the createCheckBox implementation - see

SettingWidget::dropdown("Show blocked term automod messages",
s.showBlockedTermAutomodMessages)
->setTooltip("Show messages that are blocked by AutoMod for containing "
"a public blocked term in the current channel.")
->addTo(layout);
as a reference

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on the NotificationPage i can't do ->addTo(layout) using SettingWidget::checkbox
What do i need to change?

auto openIn = settings.emplace<QHBoxLayout>().withoutMargin();
{
openIn
Expand Down
4 changes: 3 additions & 1 deletion src/widgets/settingspages/SettingsPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,11 @@ void SettingsPage::setTab(SettingsDialogTab *tab)
}

QCheckBox *SettingsPage::createCheckBox(
const QString &text, pajlada::Settings::Setting<bool> &setting)
const QString &text, pajlada::Settings::Setting<bool> &setting,
const QString &toolTipText)
{
QCheckBox *checkbox = new SCheckBox(text);
checkbox->setToolTip(toolTipText);

// update when setting changes
setting.connect(
Expand Down
3 changes: 2 additions & 1 deletion src/widgets/settingspages/SettingsPage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ class SettingsPage : public QFrame
void setTab(SettingsDialogTab *tab);

QCheckBox *createCheckBox(const QString &text,
pajlada::Settings::Setting<bool> &setting);
pajlada::Settings::Setting<bool> &setting,
const QString &toolTipText = {});
QComboBox *createComboBox(const QStringList &items,
pajlada::Settings::Setting<QString> &setting);
QLineEdit *createLineEdit(pajlada::Settings::Setting<QString> &setting);
Expand Down
Loading