mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-22 02:07:24 +00:00
Added ability to change master volume of notifications from settings.
This commit is contained in:
parent
37214f33b8
commit
85054e5987
@ -512,6 +512,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_settings_notify_global" = "Global settings";
|
||||
"lng_settings_notify_title" = "Notifications for chats";
|
||||
"lng_settings_desktop_notify" = "Desktop notifications";
|
||||
"lng_settings_master_volume_notifications" = "Volume";
|
||||
"lng_settings_native_title" = "System integration";
|
||||
"lng_settings_use_windows" = "Use Windows notifications";
|
||||
"lng_settings_skip_in_focus" = "Respect system Focus mode";
|
||||
|
@ -7,10 +7,12 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "settings/settings_notifications.h"
|
||||
|
||||
#include "ui/widgets/continuous_sliders.h"
|
||||
#include "settings/settings_notifications_type.h"
|
||||
#include "ui/boxes/confirm_box.h"
|
||||
#include "ui/controls/chat_service_checkbox.h"
|
||||
#include "ui/effects/animations.h"
|
||||
#include "data/notify/data_peer_notify_volume.h"
|
||||
#include "ui/text/text_utilities.h"
|
||||
#include "ui/wrap/vertical_layout.h"
|
||||
#include "ui/wrap/slide_wrap.h"
|
||||
@ -1017,6 +1019,25 @@ void SetupNotificationsContent(
|
||||
{ &st::menuIconUnmute },
|
||||
soundAllowed->events_starting_with(allowed()));
|
||||
|
||||
Ui::AddRingtonesVolumeSlider(
|
||||
container,
|
||||
soundAllowed->events_starting_with(allowed()),
|
||||
tr::lng_settings_master_volume_notifications(),
|
||||
Data::VolumeController{
|
||||
.volume = []() -> ushort {
|
||||
const auto volume
|
||||
= Core::App().settings().notificationsVolume();
|
||||
return volume ? volume : 100;
|
||||
},
|
||||
.saveVolume = [=](ushort volume) {
|
||||
Core::App().notifications().playSound(
|
||||
session,
|
||||
0,
|
||||
volume / 100.);
|
||||
Core::App().settings().setNotificationsVolume(volume);
|
||||
Core::App().saveSettingsDelayed();
|
||||
}});
|
||||
|
||||
Ui::AddSkip(container);
|
||||
|
||||
const auto checkboxes = SetupNotifyViewOptions(
|
||||
|
@ -12,6 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "base/unixtime.h"
|
||||
#include "boxes/ringtones_box.h"
|
||||
#include "boxes/peer_list_box.h"
|
||||
#include "data/notify/data_peer_notify_volume.h"
|
||||
#include "boxes/peer_list_controllers.h"
|
||||
#include "data/notify/data_notify_settings.h"
|
||||
#include "data/data_changes.h"
|
||||
@ -476,6 +477,13 @@ void SetupChecks(
|
||||
st::settingsButton,
|
||||
{ &st::menuIconSoundOn });
|
||||
|
||||
Ui::AddRingtonesVolumeSlider(
|
||||
toneInner,
|
||||
true,
|
||||
rpl::single(true),
|
||||
rpl::single(u"Volume"_q),
|
||||
DefaultRingtonesVolumeController(session, type));
|
||||
|
||||
enabled->toggledValue(
|
||||
) | rpl::filter([=](bool value) {
|
||||
return (value != NotificationsEnabledForType(session, type));
|
||||
@ -499,7 +507,7 @@ void SetupChecks(
|
||||
controller->show(Box(RingtonesBox, session, toneValue(), [=](
|
||||
Data::NotifySound sound) {
|
||||
settings->defaultUpdate(type, {}, {}, sound);
|
||||
}));
|
||||
}, DefaultRingtonesVolumeController(session, type)));
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user