diff options
author | Javier S. Pedro <maemo@javispedro.com> | 2012-08-09 01:53:38 +0200 |
---|---|---|
committer | Javier S. Pedro <maemo@javispedro.com> | 2012-08-09 01:53:38 +0200 |
commit | 3aa62b0543d978c1a01c5cf05a898fd8d805c44b (patch) | |
tree | 84ebdd8d94728375cd21457d8f5773f46ee0dcc7 /sowatchui/scanwatchesmodel.h | |
parent | 081aa7b760986092377be7f62cac3bdee7400874 (diff) | |
download | sowatch-3aa62b0543d978c1a01c5cf05a898fd8d805c44b.tar.gz sowatch-3aa62b0543d978c1a01c5cf05a898fd8d805c44b.zip |
new watch scanning ui
Diffstat (limited to 'sowatchui/scanwatchesmodel.h')
-rw-r--r-- | sowatchui/scanwatchesmodel.h | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/sowatchui/scanwatchesmodel.h b/sowatchui/scanwatchesmodel.h new file mode 100644 index 0000000..424ded4 --- /dev/null +++ b/sowatchui/scanwatchesmodel.h @@ -0,0 +1,49 @@ +#ifndef SCANWATCHESMODEL_H +#define SCANWATCHESMODEL_H + +#include <QtCore/QAbstractListModel> +#include <QtCore/QTimer> +#include <sowatch.h> + +#include "scannerproxy.h" + +class ScanWatchesModel : public QAbstractListModel +{ + Q_OBJECT + Q_PROPERTY(bool enabled READ enabled WRITE setEnabled) + Q_PROPERTY(bool active READ active NOTIFY activeChanged) + +public: + explicit ScanWatchesModel(QObject *parent = 0); + ~ScanWatchesModel(); + + 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: + ScannerProxy *_scanner; + QList<QVariantMap> _list; + QTimer *_timer; + bool _enabled; + bool _active; +}; + +#endif // SCANWATCHESMODEL_H |