Fix the Phonon notification backend not playing any sound
authorManuel Nickschas <sputnick@quassel-irc.org>
Tue, 19 Nov 2013 21:59:47 +0000 (22:59 +0100)
committerManuel Nickschas <sputnick@quassel-irc.org>
Tue, 19 Nov 2013 21:59:47 +0000 (22:59 +0100)
Phonon won't report its capabilities before a player has been created,
which leads to Quassel thinking that it can't play audio since we checked
for that before instantiating the player.

Some reordering in the ctor fixes this.

src/qtui/phononnotificationbackend.cpp

index 8bd7020..b4adc1c 100644 (file)
@@ -34,13 +34,14 @@ PhononNotificationBackend::PhononNotificationBackend(QObject *parent)
     : AbstractNotificationBackend(parent),
     _media(0)
 {
-    _audioAvailable = !Phonon::BackendCapabilities::availableAudioOutputDevices().isEmpty();
     NotificationSettings notificationSettings;
-    _enabled = notificationSettings.value("Phonon/Enabled", true).toBool();
-    createMediaObject(notificationSettings.value("Phonon/AudioFile", QString()).toString());
-
     notificationSettings.notify("Phonon/Enabled", this, SLOT(enabledChanged(const QVariant &)));
     notificationSettings.notify("Phonon/AudioFile", this, SLOT(audioFileChanged(const QVariant &)));
+
+    createMediaObject(notificationSettings.value("Phonon/AudioFile", QString()).toString());
+
+    _enabled = notificationSettings.value("Phonon/Enabled", true).toBool();
+    _audioAvailable = !Phonon::BackendCapabilities::availableAudioOutputDevices().isEmpty();
 }