summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Branson <andrew.branson@cern.ch>2015-04-17 17:20:41 +0200
committerAndrew Branson <andrew.branson@cern.ch>2015-04-17 19:11:42 +0200
commita66d43943235ef0555c37131e906b25f8a7a940e (patch)
tree0f06fd4d787f64943949a573a926ba5d1dba7280
parent8da20a7c3088aee2b04d45feeee8ca0753dc260e (diff)
Fix checking to see if we should bail out of a music command if there's
no music player running. Allow only volume controls, and only if system volume is enabled.
-rw-r--r--daemon/musicmanager.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/daemon/musicmanager.cpp b/daemon/musicmanager.cpp
index f51daeb..aa961d3 100644
--- a/daemon/musicmanager.cpp
+++ b/daemon/musicmanager.cpp
@@ -5,7 +5,7 @@
MusicManager::MusicManager(WatchConnector *watch, Settings *settings, QObject *parent)
: QObject(parent), l(metaObject()->className()),
- watch(watch), _watcher(new QDBusServiceWatcher(this)), _pulseBus(NULL), settings(settings),_maxVolume(0), mprisVolumeWorks(true)
+ watch(watch), _watcher(new QDBusServiceWatcher(this)), _pulseBus(NULL), settings(settings),_maxVolume(0), mprisVolumeWorks(false)
{
QDBusConnection bus = QDBusConnection::sessionBus();
QDBusConnectionInterface *bus_iface = bus.interface();
@@ -200,9 +200,14 @@ void MusicManager::callMprisMethod(const QString &method)
void MusicManager::handleMusicControl(WatchConnector::MusicControl operation)
{
qCDebug(l) << "operation from watch:" << operation;
+ QVariant useSystemVolumeVar = settings->property("useSystemVolume");
+ bool useSystemVolume = (useSystemVolumeVar.isValid() && useSystemVolumeVar.toBool());
+ qCDebug(l) << "useSystemVolume: " << useSystemVolume;
+ qCDebug(l) << "mprisVolumeWorks: " << mprisVolumeWorks;
+ //Don't allow any music operations if there's no MPRIS player, unless we are allowed to control the system volume and it's a volume command
if (_curService.isEmpty() &&
- ((operation != WatchConnector::musicVOLUME_UP && operation != WatchConnector::musicVOLUME_DOWN) || mprisVolumeWorks)) {
+ !((operation == WatchConnector::musicVOLUME_UP || operation == WatchConnector::musicVOLUME_DOWN) && useSystemVolume)) {
qCDebug(l) << "can't do any music operation, no mpris interface active";
return;
}
@@ -226,9 +231,7 @@ void MusicManager::handleMusicControl(WatchConnector::MusicControl operation)
case WatchConnector::musicVOLUME_UP:
case WatchConnector::musicVOLUME_DOWN: {
- QVariant useSystemVolumeVar = settings->property("useSystemVolume");
- bool useSystemVolume = (useSystemVolumeVar.isValid() && useSystemVolumeVar.toBool());
- qCDebug(l) << "useSystemVolume: " << useSystemVolume;
+
if (mprisVolumeWorks || !useSystemVolume) {
QDBusConnection bus = QDBusConnection::sessionBus();
QDBusMessage call = QDBusMessage::createMethodCall(_curService, "/org/mpris/MediaPlayer2",