Possible Uninstall Fix, plus cleanup, more keysets
[pierogi] / pirkeysetmetadata.h
1 #ifndef PIRKEYSETMETADATA_H
2 #define PIRKEYSETMETADATA_H
3
4 #include "pirkeynames.h"
5 #include "pirmakenames.h"
6 #include "pirdevicetypenames.h"
7
8 #include <map>
9 #include <list>
10
11 class QThread;
12
13 class PIRKeysetWidgetItem;
14 class PIRProtocol;
15
16 typedef std::map<PIRKeyName, const char *> KeyCollection;
17
18 class DeviceInfo
19 {
20 public:
21   DeviceInfo(
22     PIRMakeName ma,
23     const char *mo,
24     PIRDeviceTypeName t)
25   : make(ma),
26     model(mo),
27     type(t)
28   {}
29
30   PIRMakeName make;
31   const char *model;
32   PIRDeviceTypeName type;
33 };
34
35 typedef std::list<DeviceInfo> DeviceCollection;
36
37 class PIRKeysetMetaData
38 {
39 public:
40   PIRKeysetMetaData(
41     const char *keysetName,
42     PIRMakeName make,
43     unsigned int index);
44
45   bool hasKey(
46     PIRKeyName name) const;
47
48   unsigned int getID() const;
49
50   PIRMakeName getMake() const;
51
52   const char *getKeysetName() const;
53
54   void moveProtocolToThread(
55     QThread *thread);
56
57   void populateDeviceTypes(
58     PIRKeysetWidgetItem *kwi) const;
59
60 protected:
61   void addControlledDevice(
62     PIRMakeName make,
63     const char *model,
64     PIRDeviceTypeName type);
65
66   void addDeviceType(
67     PIRDeviceTypeName n);
68
69   void addKey(
70     const char *name,
71     PIRKeyName key,
72     unsigned long data,
73     unsigned int size);
74
75   // Special helper methods for SIRC keys:
76   void addSIRC12Key(
77     const char *name,
78     PIRKeyName key,
79     unsigned int addressData,
80     unsigned int commandData);
81
82   void addSIRC15Key(
83     const char *name,
84     PIRKeyName key,
85     unsigned int addressData,
86     unsigned int commandData);
87
88   void addSIRC20Key(
89     const char *name,
90     PIRKeyName key,
91     unsigned int secondaryAddressData,
92     unsigned int primaryAddressData,
93     unsigned int commandData);
94
95   // Helper method for Sharp keys:
96   void addSharpKey(
97     const char *name,
98     PIRKeyName key,
99     unsigned int addressData,
100     unsigned int commandData);
101
102   void addNECKey(
103     const char *name,
104     PIRKeyName key,
105     unsigned int addressData,
106     unsigned int commandData);
107
108   void addPioneerKey(
109     const char *name,
110     PIRKeyName key,
111     unsigned int addressOne,
112     unsigned int commandOne,
113     unsigned int addressTwo,
114     unsigned int commandTwo);
115
116 /*
117   void addRCAKey(
118     const char *name,
119     PIRKeyName key,
120     unsigned int addressData,
121     unsigned int commandData);
122 */
123
124   void setPreData(
125     unsigned long data,
126     unsigned int bits);
127
128   void setPostData(
129     unsigned long data,
130     unsigned int bits);
131
132   KeyCollection keys;
133
134   DeviceCollection controlledDevices;
135
136   PIRProtocol *threadableProtocol;
137
138   void setKeysetName(
139     const char *name);
140
141 private:
142   const char *keysetName;
143   PIRMakeName make;
144   PIRDeviceTypeCollection deviceTypes;
145
146   unsigned int id;
147 };
148
149
150 #endif // PIRKEYSETMETADATA_H