summaryrefslogtreecommitdiff
path: root/qmafwwatchlet/qmafwwatchletplayer.h
diff options
context:
space:
mode:
authorJavier S. Pedro <maemo@javispedro.com>2011-09-27 04:51:30 +0200
committerJavier S. Pedro <maemo@javispedro.com>2011-09-27 04:51:30 +0200
commita644a7cc6749f8dd5ca20589ee6e59acc2892b3e (patch)
treeb995528dc14d1f58d9d7c958d1eaad855b2a2412 /qmafwwatchlet/qmafwwatchletplayer.h
parent0822b88738e00625efd27ccca9119885272924d2 (diff)
downloadsowatch-a644a7cc6749f8dd5ca20589ee6e59acc2892b3e.tar.gz
sowatch-a644a7cc6749f8dd5ca20589ee6e59acc2892b3e.zip
new qmafw watchlet
Diffstat (limited to 'qmafwwatchlet/qmafwwatchletplayer.h')
-rw-r--r--qmafwwatchlet/qmafwwatchletplayer.h81
1 files changed, 81 insertions, 0 deletions
diff --git a/qmafwwatchlet/qmafwwatchletplayer.h b/qmafwwatchlet/qmafwwatchletplayer.h
new file mode 100644
index 0000000..d85f38c
--- /dev/null
+++ b/qmafwwatchlet/qmafwwatchletplayer.h
@@ -0,0 +1,81 @@
+#ifndef QMAFWWATCHLETPLAYER_H
+#define QMAFWWATCHLETPLAYER_H
+
+#include <QtCore/QUrl>
+
+#include <sowatch.h>
+
+#include <MafwRenderer.h>
+#include <MafwMediaInfo.h>
+
+namespace sowatch
+{
+
+class QMafwWatchlet;
+
+class QMafwWatchletPlayer : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QString title READ title NOTIFY titleChanged)
+ Q_PROPERTY(QString album READ album NOTIFY albumChanged)
+ Q_PROPERTY(QString artist READ artist NOTIFY artistChanged)
+ Q_PROPERTY(QUrl imageUrl READ imageUrl NOTIFY imageUrlChanged)
+
+public:
+ explicit QMafwWatchletPlayer(QMafwWatchlet* watchlet);
+
+ QString title() const;
+ QString album() const;
+ QString artist() const;
+ QUrl imageUrl() const;
+
+signals:
+ void titleChanged();
+ void albumChanged();
+ void artistChanged();
+ void imageUrlChanged();
+
+public slots:
+ void activate();
+ void deactivate();
+
+ void playPause();
+ void play();
+ void pause();
+ void stop();
+ void next();
+ void previous();
+
+ void volumeUp();
+ void volumeDown();
+
+private:
+ bool _active;
+ MafwRenderer* _renderer;
+ MafwRenderer::State _state;
+ QString _title;
+ QString _album;
+ QString _artist;
+ QUrl _imageUrl;
+
+ void setRenderer(MafwRenderer*);
+ void reconnect();
+
+ static QString stripAlbumArtComponent(const QString& component);
+ QString mediaArtPath() const;
+
+private slots:
+ void handleChangedMetadata(const QString& s, const QList<QVariant>& l);
+ void handleChangedState(MafwRenderer::State state);
+ void handleMediaInfo(const MafwMediaInfo& info);
+ void doVolumeUp(const QString& name, const QVariant& value);
+ void doVolumeDown(const QString& name, const QVariant& value);
+
+ friend class QMafwWatchlet;
+};
+
+}
+
+QML_DECLARE_TYPE(sowatch::QMafwWatchletPlayer)
+
+#endif // QMAFWWATCHLETPLAYER_H