Fix for unintended snapshots while parenting/un-parenting

This commit is contained in:
Thijs Wenker 2018-11-03 00:27:40 +01:00
parent afd69d04dd
commit cc207537a3

View file

@ -4039,21 +4039,23 @@ void Application::keyPressEvent(QKeyEvent* event) {
break;
case Qt::Key_P: {
AudioInjectorOptions options;
options.localOnly = true;
options.stereo = true;
Setting::Handle<bool> notificationSounds{ MenuOption::NotificationSounds, true};
Setting::Handle<bool> notificationSoundSnapshot{ MenuOption::NotificationSoundsSnapshot, true};
if (notificationSounds.get() && notificationSoundSnapshot.get()) {
if (_snapshotSoundInjector) {
_snapshotSoundInjector->setOptions(options);
_snapshotSoundInjector->restart();
} else {
QByteArray samples = _snapshotSound->getByteArray();
_snapshotSoundInjector = AudioInjector::playSound(samples, options);
if (!isShifted && !isMeta && !isOption && !event->isAutoRepeat()) {
AudioInjectorOptions options;
options.localOnly = true;
options.stereo = true;
Setting::Handle<bool> notificationSounds{ MenuOption::NotificationSounds, true };
Setting::Handle<bool> notificationSoundSnapshot{ MenuOption::NotificationSoundsSnapshot, true };
if (notificationSounds.get() && notificationSoundSnapshot.get()) {
if (_snapshotSoundInjector) {
_snapshotSoundInjector->setOptions(options);
_snapshotSoundInjector->restart();
} else {
QByteArray samples = _snapshotSound->getByteArray();
_snapshotSoundInjector = AudioInjector::playSound(samples, options);
}
}
takeSnapshot(true);
}
takeSnapshot(true);
break;
}