blob: 4b6faf1f17604fef050122729b8ba6b27b346642 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
#ifndef DAEMON_H
#define DAEMON_H
#include <QtCore/QObject>
#include <QtQuick/QQuickView>
#include <MDConfGroup>
#include "metawatch.h"
#include "reconnecttimer.h"
#include "notificationmonitor.h"
#include "widgetinfomodel.h"
class Controller : public QObject
{
Q_OBJECT
Q_PROPERTY(MetaWatch::WatchMode mode READ mode NOTIFY modeChanged)
Q_PROPERTY(int page READ page WRITE setPage NOTIFY pageChanged)
Q_PROPERTY(int batteryCharge READ batteryCharge NOTIFY batteryChargeChanged)
Q_PROPERTY(bool batteryCharging READ batteryCharging NOTIFY batteryChargingChanged)
public:
explicit Controller(const QString &settingsPrefix, QQuickView *view = 0, QObject *parent = 0);
~Controller();
bool isWatchConnected() const;
MetaWatch::WatchMode mode() const;
int page() const;
void setPage(int page);
int batteryCharge() const;
bool batteryCharging() const;
signals:
void modeChanged();
void pageChanged();
void batteryChargeChanged();
void batteryChargingChanged();
private:
void connectToDevice();
void updateProperties();
private slots:
void handleSettingChanged(const QString &key);
void handleMetaWatchConnected();
void handleMetaWatchModeChange(MetaWatch::WatchMode mode, int page);
void handleMetaWatchBatteryStatus(bool charging, int charge);
void handleIncomingNotification(const QString &sender, const QIcon &icon, const QString &summary, int count, const QString &body, const QDateTime &dateTime);
void handleWidgetChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles);
private:
MDConfGroup *_settings;
MetaWatch *_metawatch;
ReconnectTimer *_reconnect;
NotificationMonitor *_monitor;
WidgetInfoModel *_widgets;
QString _address;
// Watch status
MetaWatch::WatchMode _curMode;
int _curPage;
int _batteryCharge;
bool _batteryCharging;
};
#endif // DAEMON_H
|