Improved Keyset Selection Window
[pierogi] / pirkeysetmetadata.h
1 #ifndef PIRKEYSETMETADATA_H
2 #define PIRKEYSETMETADATA_H
3
4 #include <map>
5 #include <list>
6 //#include <string>
7
8 #include "pirkeynames.h"
9 #include "pirmakenames.h"
10 #include "pirdevicetypenames.h"
11 #include "pirkeysetwidgetitem.h"
12 #include "pirprotocol.h"
13
14 typedef std::map<PIRKeyName, const char *> KeyCollection;
15
16 class DeviceInfo
17 {
18 public:
19   DeviceInfo(
20     PIRMakeName ma,
21     const char *mo,
22     PIRDeviceTypeName t)
23   : make(ma),
24     model(mo),
25     type(t)
26   {}
27
28   PIRMakeName make;
29   const char *model;
30   PIRDeviceTypeName type;
31 };
32
33 typedef std::list<DeviceInfo> DeviceCollection;
34
35 class PIRKeysetMetaData
36 {
37 public:
38   PIRKeysetMetaData(
39     const char *keysetName,
40     PIRMakeName make,
41     unsigned int index);
42
43   bool hasKey(
44     PIRKeyName name);
45
46   unsigned int getID();
47
48   PIRMakeName getMake();
49   const char *getKeysetName();
50
51   void moveProtocolToThread(
52     QThread &thread);
53
54   void populateDeviceTypes(
55     PIRKeysetWidgetItem *kwi);
56
57 protected:
58   void addControlledDevice(
59     PIRMakeName make,
60     const char *model,
61     PIRDeviceTypeName type);
62
63   void addDeviceType(
64     PIRDeviceTypeName n);
65
66   void addKey(
67     const char *name,
68     PIRKeyName key,
69     unsigned long data,
70     unsigned int bits);
71
72   KeyCollection keys;
73
74   DeviceCollection controlledDevices;
75
76   PIRProtocol *threadableProtocol;
77
78   void setKeysetName(
79     const char *name);
80
81 private:
82   const char *keysetName;
83   PIRMakeName make;
84   PIRDeviceTypeCollection deviceTypes;
85
86   unsigned int id;
87 };
88
89
90 #endif // PIRKEYSETMETADATA_H