From a644a7cc6749f8dd5ca20589ee6e59acc2892b3e Mon Sep 17 00:00:00 2001 From: "Javier S. Pedro" Date: Tue, 27 Sep 2011 04:51:30 +0200 Subject: new qmafw watchlet --- qmafwwatchlet/qmafwwatchletplayer.h | 81 +++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 qmafwwatchlet/qmafwwatchletplayer.h (limited to 'qmafwwatchlet/qmafwwatchletplayer.h') 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 + +#include + +#include +#include + +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& 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 -- cgit v1.2.3