From 5fef356ff3fbcb76a5ec44a81a8d54d29a42f25d Mon Sep 17 00:00:00 2001 From: Javier Date: Mon, 23 Mar 2015 03:28:00 +0100 Subject: initial import --- saltoqd/musicmanager.h | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 saltoqd/musicmanager.h (limited to 'saltoqd/musicmanager.h') diff --git a/saltoqd/musicmanager.h b/saltoqd/musicmanager.h new file mode 100644 index 0000000..5bae89b --- /dev/null +++ b/saltoqd/musicmanager.h @@ -0,0 +1,39 @@ +#ifndef MUSICMANAGER_H +#define MUSICMANAGER_H + +#include +#include +#include "toqmanager.h" + +class MusicManager : public QObject, public ToqManager::EndpointHandler, protected QDBusContext +{ + Q_OBJECT +public: + explicit MusicManager(ToqManager *toq); + + void handleMessage(const ToqConnection::Message &msg) Q_DECL_OVERRIDE; + +private: + void handleGetPlayerStatusMessage(const ToqConnection::Message &msg); + + void switchToService(const QString &service); + void fetchMetadataFromService(); + void sendCurrentMprisMetadata(); + void fillWithMetadata(QJsonObject &obj); + void callMprisMethod(const QString &method); + +private slots: + void handleMprisServiceOwnerChanged(const QString &serviceName, const QString &oldOwner, const QString &newOwner); + void handleMprisPropertiesChanged(const QString &interface, const QMap &changed, const QStringList &invalidated); + +private: + ToqManager *_toq; + QDBusServiceWatcher *_watcher; + QString _curService; + QVariantMap _curMetadata; + QString _curPlaybackStatus; + bool _isPlayerVisible; +}; + + +#endif // MUSICMANAGER_H -- cgit v1.2.3