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; break;
case Qt::Key_P: { case Qt::Key_P: {
AudioInjectorOptions options; if (!isShifted && !isMeta && !isOption && !event->isAutoRepeat()) {
options.localOnly = true; AudioInjectorOptions options;
options.stereo = true; options.localOnly = true;
Setting::Handle<bool> notificationSounds{ MenuOption::NotificationSounds, true}; options.stereo = true;
Setting::Handle<bool> notificationSoundSnapshot{ MenuOption::NotificationSoundsSnapshot, true}; Setting::Handle<bool> notificationSounds{ MenuOption::NotificationSounds, true };
if (notificationSounds.get() && notificationSoundSnapshot.get()) { Setting::Handle<bool> notificationSoundSnapshot{ MenuOption::NotificationSoundsSnapshot, true };
if (_snapshotSoundInjector) { if (notificationSounds.get() && notificationSoundSnapshot.get()) {
_snapshotSoundInjector->setOptions(options); if (_snapshotSoundInjector) {
_snapshotSoundInjector->restart(); _snapshotSoundInjector->setOptions(options);
} else { _snapshotSoundInjector->restart();
QByteArray samples = _snapshotSound->getByteArray(); } else {
_snapshotSoundInjector = AudioInjector::playSound(samples, options); QByteArray samples = _snapshotSound->getByteArray();
_snapshotSoundInjector = AudioInjector::playSound(samples, options);
}
} }
takeSnapshot(true);
} }
takeSnapshot(true);
break; break;
} }