summaryrefslogtreecommitdiff
path: root/sowatchui/watchesmodel.h
diff options
context:
space:
mode:
authorJavier S. Pedro <maemo@javispedro.com>2012-08-09 01:53:38 +0200
committerJavier S. Pedro <maemo@javispedro.com>2012-08-09 01:53:38 +0200
commit3aa62b0543d978c1a01c5cf05a898fd8d805c44b (patch)
tree84ebdd8d94728375cd21457d8f5773f46ee0dcc7 /sowatchui/watchesmodel.h
parent081aa7b760986092377be7f62cac3bdee7400874 (diff)
downloadsowatch-3aa62b0543d978c1a01c5cf05a898fd8d805c44b.tar.gz
sowatch-3aa62b0543d978c1a01c5cf05a898fd8d805c44b.zip
new watch scanning ui
Diffstat (limited to 'sowatchui/watchesmodel.h')
-rw-r--r--sowatchui/watchesmodel.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/sowatchui/watchesmodel.h b/sowatchui/watchesmodel.h
new file mode 100644
index 0000000..cc6c9af
--- /dev/null
+++ b/sowatchui/watchesmodel.h
@@ -0,0 +1,40 @@
+#ifndef WATCHESMODEL_H
+#define WATCHESMODEL_H
+
+#include <QAbstractListModel>
+
+#include <sowatch.h>
+
+class WatchesModel : public QAbstractListModel
+{
+ Q_OBJECT
+public:
+ explicit WatchesModel(QObject *parent = 0);
+ ~WatchesModel();
+
+ enum DataRoles {
+ ObjectRole = Qt::UserRole
+ };
+
+ int rowCount(const QModelIndex &parent) const;
+ QVariant data(const QModelIndex &index, int role) const;
+ bool removeRows(int row, int count, const QModelIndex &parent);
+
+public slots:
+ void addFoundWatch(const QVariantMap& info);
+
+private slots:
+ void reload();
+ void handleConfigChanged();
+ void handleSubkeyChanged(const QString& subkey);
+
+private:
+ int findRowByWatchId(const QString& id);
+
+private:
+ sowatch::ConfigKey *_config;
+ sowatch::ConfigKey *_active_watches;
+ QList<sowatch::ConfigKey*> _list;
+};
+
+#endif // WATCHESMODEL_H