blob: 681c758d3b779bc8bb9f2f2b92dece5f87cc8cc9 (
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
71
72
73
74
|
#ifndef SOWATCH_WATCHSERVER_H
#define SOWATCH_WATCHSERVER_H
#include <QtCore/QList>
#include <QtCore/QMap>
#include <QtCore/QQueue>
#include "sowatch_global.h"
#include "notification.h"
namespace sowatch
{
class Watch;
class Watchlet;
class NotificationProvider;
class SOWATCH_EXPORT WatchServer : public QObject
{
Q_OBJECT
Q_PROPERTY(Watch* watch READ watch CONSTANT)
Q_PROPERTY(QString nextWatchletButton READ nextWatchletButton WRITE setNextWatchletButton)
public:
explicit WatchServer(Watch* watch, QObject* parent = 0);
Watch* watch();
QString nextWatchletButton() const;
void setNextWatchletButton(const QString& value);
void addProvider(NotificationProvider* provider);
void runWatchlet(const QString& id);
void closeWatchlet();
protected:
Watch* _watch;
char _nextWatchletButton;
QMap<QString, Watchlet*> _watchlets;
/** Stores current notifications, classified by type. */
QList<Notification*> _notifications[Notification::TypeCount];
QQueue<Notification*> _pendingNotifications;
Watchlet* _currentWatchlet;
char _currentWatchletIndex;
void registerWatchlet(Watchlet *watchlet);
void reactivateCurrentWatchlet();
void nextWatchlet();
void nextNotification();
uint getNotificationCount(Notification::Type type);
void goToIdle();
protected slots:
void watchConnected();
void watchDisconnected();
void watchIdling();
void watchButtonPress(int button);
void notificationReceived(Notification* notification);
void notificationChanged();
void notificationCleared();
friend class Watchlet;
};
}
#endif // SOWATCH_WATCHSERVER_H
|