summaryrefslogtreecommitdiff
path: root/sowatchui/watchscannermodel.h
diff options
context:
space:
mode:
authorJavier S. Pedro <maemo@javispedro.com>2012-08-09 16:38:56 +0200
committerJavier S. Pedro <maemo@javispedro.com>2012-08-09 16:38:56 +0200
commitc7c6a2c596637fd4942c7fb80341ca2ef7b47808 (patch)
tree0d4196fa95444dd7e14fbaed61299454609d4762 /sowatchui/watchscannermodel.h
parent406332eb6b3199d19388f359d04c9f184e6082b5 (diff)
downloadsowatch-c7c6a2c596637fd4942c7fb80341ca2ef7b47808.tar.gz
sowatch-c7c6a2c596637fd4942c7fb80341ca2ef7b47808.zip
moving scanner logic to ui, new icon
Diffstat (limited to 'sowatchui/watchscannermodel.h')
-rw-r--r--sowatchui/watchscannermodel.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/sowatchui/watchscannermodel.h b/sowatchui/watchscannermodel.h
new file mode 100644
index 0000000..32701f7
--- /dev/null
+++ b/sowatchui/watchscannermodel.h
@@ -0,0 +1,47 @@
+#ifndef WATCHSCANNERMODEL_H
+#define WATCHSCANNERMODEL_H
+
+#include <QtCore/QAbstractListModel>
+
+#include <sowatch.h>
+
+class WatchScannerModel : public QAbstractListModel
+{
+ Q_OBJECT
+ Q_PROPERTY(bool enabled READ enabled WRITE setEnabled)
+ Q_PROPERTY(bool active READ active NOTIFY activeChanged)
+
+public:
+ explicit WatchScannerModel(QObject *parent = 0);
+ ~WatchScannerModel();
+
+ enum DataRoles {
+ ObjectRole = Qt::UserRole
+ };
+
+ bool enabled() const;
+ void setEnabled(bool enabled);
+
+ bool active() const;
+
+ int rowCount(const QModelIndex &parent) const;
+ QVariant data(const QModelIndex &index, int role) const;
+
+signals:
+ void activeChanged();
+
+private slots:
+ void handleWatchFound(const QVariantMap& info);
+ void handleStarted();
+ void handleFinished();
+ void handleTimeout();
+
+private:
+ sowatch::WatchScanner *_scanner;
+ QList<QVariantMap> _list;
+ QTimer *_timer;
+ bool _enabled;
+ bool _active;
+};
+
+#endif // WATCHSCANNERMODEL_H