summaryrefslogtreecommitdiff
path: root/qmafwwatchlet/qmafwwatchletvolumecontrol.h
diff options
context:
space:
mode:
authorJavier S. Pedro <maemo@javispedro.com>2012-09-04 03:27:30 +0200
committerJavier S. Pedro <maemo@javispedro.com>2012-09-04 03:27:30 +0200
commit4e10566c9b0c4fb723ad68e44ae4c231e6959323 (patch)
tree6f8aaa80a481b08e7827750e40b1c923ffc29046 /qmafwwatchlet/qmafwwatchletvolumecontrol.h
parent2f631362b54180252d0daa34f359338860a8782b (diff)
downloadsowatch-4e10566c9b0c4fb723ad68e44ae4c231e6959323.tar.gz
sowatch-4e10566c9b0c4fb723ad68e44ae4c231e6959323.zip
improve media player's watchlet volume change
Diffstat (limited to 'qmafwwatchlet/qmafwwatchletvolumecontrol.h')
-rw-r--r--qmafwwatchlet/qmafwwatchletvolumecontrol.h53
1 files changed, 53 insertions, 0 deletions
diff --git a/qmafwwatchlet/qmafwwatchletvolumecontrol.h b/qmafwwatchlet/qmafwwatchletvolumecontrol.h
new file mode 100644
index 0000000..1e1261a
--- /dev/null
+++ b/qmafwwatchlet/qmafwwatchletvolumecontrol.h
@@ -0,0 +1,53 @@
+#ifndef QMAFWWATCHLETVOLUMECONTROL_H
+#define QMAFWWATCHLETVOLUMECONTROL_H
+
+#include <QtCore/QObject>
+#include <dbus/dbus.h>
+
+class MainVolumeControlProxy;
+
+namespace sowatch
+{
+
+class QMafwWatchletVolumeControl : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(int volume READ volume WRITE setVolume NOTIFY volumeChanged)
+ Q_PROPERTY(int min READ min NOTIFY minChanged)
+ Q_PROPERTY(int max READ max NOTIFY maxChanged)
+
+public:
+ explicit QMafwWatchletVolumeControl(QObject *parent = 0);
+ ~QMafwWatchletVolumeControl();
+
+ int volume() const;
+ int min() const;
+ int max() const;
+
+ void setVolume(int vol);
+
+signals:
+ void volumeChanged();
+ void minChanged();
+ void maxChanged();
+
+public slots:
+ void up();
+ void down();
+
+private:
+ void _openConnection();
+ void _listenForSignal();
+ void _fetchValues();
+ static void handleFetchReply(DBusPendingCall *pending, void *user_data);
+ static DBusHandlerResult handleDBusSignal(DBusConnection *connection, DBusMessage *message, void *user_data);
+
+private:
+ DBusConnection *_conn;
+ uint _curStep;
+ uint _maxStep;
+};
+
+}
+
+#endif // QMAFWWATCHLETVOLUMECONTROL_H