2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-05 08:55:59 +00:00

Native notifications switched off by default. Libnotify supported.

This commit is contained in:
John Preston
2016-10-03 18:07:50 +03:00
parent 6db52f7fa9
commit c9288f2d0a
15 changed files with 348 additions and 85 deletions

View File

@@ -60,11 +60,20 @@ void NotificationsWidget::createControls() {
}
addChildRow(_playSound, margin, lang(lng_settings_sound_notify), SLOT(onPlaySound()), Global::SoundNotify());
addChildRow(_includeMuted, margin, lang(lng_settings_include_muted), SLOT(onIncludeMuted()), Global::IncludeMuted());
QString nativeNotificationsLabel;
#ifdef Q_OS_WIN
if (App::wnd()->psHasNativeNotifications()) {
addChildRow(_windowsNative, margin, lang(lng_settings_use_windows), SLOT(onWindowsNative()), Global::WindowsNotifications());
nativeNotificationsLabel = lang(lng_settings_use_windows);
}
#elif defined Q_OS_LINUX64 || defined Q_OS_LINUX32
if (App::wnd()->psHasNativeNotifications()) {
nativeNotificationsLabel = lang(lng_settings_use_native_notifications);
}
#endif // Q_OS_WIN
if (!nativeNotificationsLabel.isEmpty()) {
addChildRow(_nativeNotifications, margin, nativeNotificationsLabel, SLOT(onNativeNotifications()), Global::NativeNotifications());
}
}
void NotificationsWidget::onDesktopNotifications() {
@@ -132,13 +141,13 @@ void NotificationsWidget::viewParamUpdated() {
}
}
void NotificationsWidget::onWindowsNative() {
if (Global::WindowsNotifications() == _windowsNative->checked()) {
void NotificationsWidget::onNativeNotifications() {
if (Global::NativeNotifications() == _nativeNotifications->checked()) {
return;
}
Window::Notifications::manager()->clearAllFast();
Global::SetWindowsNotifications(_windowsNative->checked());
Global::SetNativeNotifications(_nativeNotifications->checked());
Local::writeUserSettings();
}