Snapshot notification sound settings

This commit is contained in:
vladest 2018-05-04 22:01:44 +02:00
parent 14dfafa815
commit 9e5dbf9a99
3 changed files with 11 additions and 9 deletions

View file

@ -3601,13 +3601,14 @@ void Application::keyPressEvent(QKeyEvent* event) {
AudioInjectorOptions options;
options.localOnly = true;
options.stereo = true;
if (_snapshotSoundInjector) {
_snapshotSoundInjector->setOptions(options);
_snapshotSoundInjector->restart();
} else {
QByteArray samples = _snapshotSound->getByteArray();
_snapshotSoundInjector = AudioInjector::playSound(samples, options);
if (SettingsScriptingInterface::getInstance()->getValue(MenuOption::NotificationSoundsSnapshot).toBool()) {
if (_snapshotSoundInjector) {
_snapshotSoundInjector->setOptions(options);
_snapshotSoundInjector->restart();
} else {
QByteArray samples = _snapshotSound->getByteArray();
_snapshotSoundInjector = AudioInjector::playSound(samples, options);
}
}
takeSnapshot(true);
break;

View file

@ -282,9 +282,9 @@ Menu::Menu() {
// Settings > Notifications > Snapshot
action = addCheckableActionToQMenuAndActionHash(notificationsMenu, "Snapshot", 0,
settings->getValue("play_notification_sounds_type_0").toBool());
settings->getValue(MenuOption::NotificationSoundsSnapshot).toBool());
connect(action, &QAction::triggered, [action, settings] {
settings->setValue("play_notification_sounds_type_0", action->isChecked());
settings->setValue(MenuOption::NotificationSoundsSnapshot, action->isChecked());
});
// Settings > Notifications > Level of Detail
action = addCheckableActionToQMenuAndActionHash(notificationsMenu, "Level of Detail", 0,

View file

@ -212,6 +212,7 @@ namespace MenuOption {
const QString HMDTabletToToolbar = "HMD Tablet Becomes Toolbar";
const QString Shadows = "Shadows";
const QString AmbientOcclusion = "Ambient Occlusion";
const QString NotificationSoundsSnapshot = "play_notification_sounds_snapshot";
}
#endif // hifi_Menu_h