forked from Raffarti/Touchegg-gce
-
Notifications
You must be signed in to change notification settings - Fork 0
/
memory.h
137 lines (116 loc) · 3.51 KB
/
memory.h
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#ifndef MEMORY_H
#define MEMORY_H
#include <QStringList>
#include <QHash>
#include "general.h"
class Action;
class Gesture;
class Group;
class App;
typedef QHash<QString,QString> type_paramsHash;
typedef QHash<QString,QString> type_propsHash;
class Memory: public QObject
{
Q_OBJECT
public:
explicit Memory(QObject *parent = 0);
static QString addGroup(QString apps);
static Group* getGroup(QString name);
static QStringList* getGroupsNames();
static QList<Group*> getGroups();
static void removeGroup(QString name);
static void addProp(QString name, QString value);
static QString getProp(QString name);
static QStringList* getProps();
static void removeProp(QString name);
static void addApp(QString name, QString group);
static void addApp(QString name);
static App* getApp(QString name);
static QStringList* getAppsNames();
static QList<App*> getApps();
static void removeApp(QString name);
private:
static QStringList *groupsList;
static QStringList *propsList;
static QStringList *appsList;
static QHash<QString, App*> *appsHash;
static QHash<QString, Group*> *groupsHash;
static type_propsHash *propsHash;
static int groupCounter;
};
class Group{
public:
Group(QString name);
QString getName();
void addApp(QString name);
void addApps(QString names);
App *getApp(QString name);
QStringList getAppsNames();
QList<App*> getApps();
//void removeApp(QString name);
void addGest(int fingers, Lists::GestureType type, Lists::GestureDirection direction);
void addGest(Gesture *gesture);
Gesture *getGest(int fingers, Lists::GestureType type, Lists::GestureDirection direction);
QList<Gesture*> getGests();
QList<Gesture*> getSortedGestures();
void removeGesture(int fingers, Lists::GestureType type, Lists::GestureDirection direction);
void removeGesture(Gesture gest);
private:
QString name;
QStringList *gestsList;
QHash<QString, Gesture*> *gestsHash;
};
class App{
public:
App(QString name);
App(QString name, Group *group);
App(QString name, QString group);
QString getName();
Group* getGroup();
void changeGroup(QString name);
void changeGroup(Group *group);
private:
Group *group;
QString name;
};
class Gesture{
public:
operator QString (){
return toString();
}
Gesture(int fingers, Lists::GestureType type, Lists::GestureDirection direction, Group *parent);
Gesture(Gesture *ges);
void destroy();
int getFingers();
Lists::GestureType getType();
Lists::GestureDirection getDirection();
void setGroup(Group *group);
void setAction(Lists::ActionType type);
void setAction(Action *act);
Action* getAction();
void removeAction();
QString toString();
private:
Group *parent;
int fingers;
Lists::GestureType type;
Lists::GestureDirection direction;
Action *act;
};
class Action{
public:
Action(Lists::ActionType type);
Action(Action *act);
void addParam(QString name, QString value);
void addParam(QString name);
Lists::ActionType getType();
QStringList getParamKeys();
QString getParamValue(QString key);
void removeParam(QString name);
void changeParamValue(QString name, QString value);
private:
Lists::ActionType type;
QStringList *paramsList;
type_paramsHash *parHash;
};
#endif // MEMORY_H