Another "final" fix to the installer
[pierogi] / pirkeysetmanager.cpp
1 #include "pirkeysetmanager.h"
2
3 #include "pirkeysetmetadata.h"
4 #include "pirselectkeysetform.h"
5 #include "pirkeysetwidgetitem.h"
6
7 #include "keysets/acer.h"
8 #include "keysets/aiwa.h"
9 #include "keysets/apple.h"
10 #include "keysets/bose.h"
11 #include "keysets/denon.h"
12 #include "keysets/ei.h"
13 #include "keysets/elgato.h"
14 #include "keysets/goldstar.h"
15 #include "keysets/hauppauge.h"
16 #include "keysets/hitachi.h"
17 #include "keysets/jvc.h"
18 #include "keysets/lg.h"
19 #include "keysets/magnavox.h"
20 #include "keysets/mitsubishi.h"
21 #include "keysets/nokia.h"
22 #include "keysets/panasonic.h"
23 #include "keysets/philips.h"
24 #include "keysets/pinnacle.h"
25 #include "keysets/pioneer.h"
26 #include "keysets/raite.h"
27 #include "keysets/rca.h"
28 #include "keysets/sagem.h"
29 #include "keysets/samsung.h"
30 #include "keysets/sanyo.h"
31 #include "keysets/sharp.h"
32 #include "keysets/sony.h"
33 #include "keysets/tivo.h"
34 #include "keysets/toshiba.h"
35 #include "keysets/westinghouse.h"
36 #include "keysets/yamaha.h"
37 #include "keysets/zenith.h"
38
39 #include "pirexception.h"
40
41 // I'll be handling the threading of the keyset commands in this object:
42 #include <QMutex>
43
44 // Global communications mechanism:
45 extern bool stopRepeatingFlag;
46 extern QMutex stopRepeatingMutex;
47
48 // Global helper objects:
49 PIRMakeMgr makeManager;
50 PIRDeviceTypeMgr deviceManager;
51
52 // Now, on to the actual method definitions:
53
54 PIRKeysetManager::PIRKeysetManager(
55   QObject *guiObject)
56   : counter(0)
57 {
58   // Create the keysets.  Ugly!  This needs to be worked on!
59   populateKeyset(new AcerTV1(guiObject, counter++));
60   populateKeyset(new AcerPC1(guiObject, counter++));
61
62   populateKeyset(new AiwaVCR1(guiObject, counter++));
63   populateKeyset(new AiwaVCR2(guiObject, counter++));
64   populateKeyset(new AiwaVCR3(guiObject, counter++));
65   populateKeyset(new AiwaAudio1(guiObject, counter++));
66   populateKeyset(new AiwaAudio1a(guiObject, counter++));
67   populateKeyset(new AiwaAudio2(guiObject, counter++));
68   populateKeyset(new AiwaAudio2a(guiObject, counter++));
69   populateKeyset(new AiwaAudio2b(guiObject, counter++));
70   populateKeyset(new AiwaAudio2c(guiObject, counter++));
71   populateKeyset(new AiwaAudio3(guiObject, counter++));
72   populateKeyset(new AiwaAudio4(guiObject, counter++));
73   populateKeyset(new AiwaAudio5(guiObject, counter++));
74   populateKeyset(new AiwaAudio6(guiObject, counter++));
75   populateKeyset(new AiwaCarStereo1(guiObject, counter++));
76   populateKeyset(new AiwaDVD1(guiObject, counter++));
77
78   populateKeyset(new AppleWhiteRemote(guiObject, counter++));
79
80   populateKeyset(new BoseRadio1(guiObject, counter++));
81   populateKeyset(new BoseRadio2(guiObject, counter++));
82   populateKeyset(new BoseRadio3(guiObject, counter++));
83
84   populateKeyset(new DenonDVD1(guiObject, counter++));
85   populateKeyset(new DenonDVD2(guiObject, counter++));
86   populateKeyset(new DenonDVD3(guiObject, counter++));
87   populateKeyset(new DenonReceiver1(guiObject, counter++));
88   populateKeyset(new DenonReceiver1a(guiObject, counter++));
89   populateKeyset(new DenonReceiver1b(guiObject, counter++));
90   populateKeyset(new DenonReceiver1c(guiObject, counter++));
91   populateKeyset(new DenonReceiver1d(guiObject, counter++));
92   populateKeyset(new DenonReceiver1e(guiObject, counter++));
93   populateKeyset(new DenonReceiver1f(guiObject, counter++));
94   populateKeyset(new DenonReceiver2(guiObject, counter++));
95   populateKeyset(new DenonReceiver2a(guiObject, counter++));
96   populateKeyset(new DenonReceiver3(guiObject, counter++));
97   populateKeyset(new DenonAudio1(guiObject, counter++));
98   populateKeyset(new DenonAudio1a(guiObject, counter++));
99   populateKeyset(new DenonAudio1b(guiObject, counter++));
100   populateKeyset(new DenonAudio1c(guiObject, counter++));
101   populateKeyset(new DenonAudio1d(guiObject, counter++));
102   populateKeyset(new DenonAudio2(guiObject, counter++));
103   populateKeyset(new DenonAudio3(guiObject, counter++));
104   populateKeyset(new DenonAudio4(guiObject, counter++));
105
106   populateKeyset(new EiTV1(guiObject, counter++));
107
108   populateKeyset(new ElgatoEyeTV1(guiObject, counter++));
109
110   populateKeyset(new GoldStarTV1(guiObject, counter++));
111   populateKeyset(new GoldStarTV2(guiObject, counter++));
112   populateKeyset(new GoldStarVCR1(guiObject, counter++));
113   populateKeyset(new GoldStarVCR1a(guiObject, counter++));
114   populateKeyset(new GoldStarVCR1b(guiObject, counter++));
115   populateKeyset(new GoldStarVCR1c(guiObject, counter++));
116   populateKeyset(new GoldStarCD1(guiObject, counter++));
117
118   populateKeyset(new HauppaugePCTV1(guiObject, counter++));
119   populateKeyset(new HauppaugePCTV1a(guiObject, counter++));
120   populateKeyset(new HauppaugePCTV1b(guiObject, counter++));
121   populateKeyset(new HauppaugePCTV1c(guiObject, counter++));
122   populateKeyset(new HauppaugePCTV2(guiObject, counter++));
123
124   populateKeyset(new HitachiTV1(guiObject, counter++));
125   populateKeyset(new HitachiTV1a(guiObject, counter++));
126   populateKeyset(new HitachiTV1b(guiObject, counter++));
127   populateKeyset(new HitachiTV1c(guiObject, counter++));
128   populateKeyset(new HitachiTV2(guiObject, counter++));
129   populateKeyset(new HitachiTV3(guiObject, counter++));
130   populateKeyset(new HitachiProjector(guiObject, counter++));
131   populateKeyset(new HitachiDVD1(guiObject, counter++));
132   populateKeyset(new HitachiAudio1(guiObject, counter++));
133   populateKeyset(new HitachiVCR1(guiObject, counter++));
134
135   populateKeyset(new JVCSat1(guiObject, counter++));
136   populateKeyset(new JVCSat2(guiObject, counter++));
137   populateKeyset(new JVCVCR1(guiObject, counter++));
138   populateKeyset(new JVCVCR1a(guiObject, counter++));
139   populateKeyset(new JVCVCRBmode1(guiObject, counter++));
140   populateKeyset(new JVCVCRBmode1a(guiObject, counter++));
141   populateKeyset(new JVCTV1(guiObject, counter++));
142   populateKeyset(new JVCTV1a(guiObject, counter++));
143   populateKeyset(new JVCTV1b(guiObject, counter++));
144   populateKeyset(new JVCTV1c(guiObject, counter++));
145   populateKeyset(new JVCTV1d(guiObject, counter++));
146   populateKeyset(new JVCDAT1(guiObject, counter++));
147   populateKeyset(new JVCCarDeck1(guiObject, counter++));
148   populateKeyset(new JVCAudio1(guiObject, counter++));
149   populateKeyset(new JVCAudio1a(guiObject, counter++));
150   populateKeyset(new JVCAudio1b(guiObject, counter++));
151   populateKeyset(new JVCAudio2(guiObject, counter++));
152   populateKeyset(new JVCDVD1(guiObject, counter++));
153
154   populateKeyset(new LGTV1(guiObject, counter++));
155   populateKeyset(new LGTV1a(guiObject, counter++));
156   populateKeyset(new LGTV1b(guiObject, counter++));
157   populateKeyset(new LGTV1c(guiObject, counter++));
158   populateKeyset(new LGTV2(guiObject, counter++));
159   populateKeyset(new LGTV2a(guiObject, counter++));
160   populateKeyset(new LGTV2b(guiObject, counter++));
161 //  populateKeyset(new LGDisc1(guiObject, counter++));
162 //  populateKeyset(new LGDisc2(guiObject, counter++));
163 //  populateKeyset(new LGDisc2a(guiObject, counter++));
164   populateKeyset(new LGVCR1(guiObject, counter++));
165   populateKeyset(new LGVCR1a(guiObject, counter++));
166   populateKeyset(new LGVCR1b(guiObject, counter++));
167
168   populateKeyset(new MagnavoxDVD1(guiObject, counter++));
169   populateKeyset(new MagnavoxVCR1(guiObject, counter++));
170   populateKeyset(new MagnavoxConverterBox1(guiObject, counter++));
171   populateKeyset(new MagnavoxTV1(guiObject, counter++));
172
173   populateKeyset(new MitsubishiTV1(guiObject, counter++));
174   populateKeyset(new MitsubishiTV1a(guiObject, counter++));
175   populateKeyset(new MitsubishiVCR1(guiObject, counter++));
176   populateKeyset(new MitsubishiVCR1a(guiObject, counter++));
177
178   populateKeyset(new NokiaGenericVCR(guiObject, counter++));
179
180   populateKeyset(new PanasonicCarAudio(guiObject, counter++));
181   populateKeyset(new PanasonicSat1(guiObject, counter++));
182   populateKeyset(new PanasonicSat1a(guiObject, counter++));
183   populateKeyset(new PanasonicTV1(guiObject, counter++));
184   populateKeyset(new PanasonicTV1a(guiObject, counter++));
185   populateKeyset(new PanasonicTV1b(guiObject, counter++));
186   populateKeyset(new PanasonicVCR1(guiObject, counter++));
187   populateKeyset(new PanasonicVCR1a(guiObject, counter++));
188   populateKeyset(new PanasonicVCR1b(guiObject, counter++));
189   populateKeyset(new PanasonicVCR1c(guiObject, counter++));
190   populateKeyset(new PanasonicDVD1(guiObject, counter++));
191   populateKeyset(new PanasonicDVD1a(guiObject, counter++));
192   populateKeyset(new PanasonicAudio1(guiObject, counter++));
193
194   populateKeyset(new PhilipsTV1(guiObject, counter++));
195   populateKeyset(new PhilipsTV1a(guiObject, counter++));
196   populateKeyset(new PhilipsTV1b(guiObject, counter++));
197   populateKeyset(new PhilipsTV1c(guiObject, counter++));
198   populateKeyset(new PhilipsTV1d(guiObject, counter++));
199   populateKeyset(new PhilipsTV1e(guiObject, counter++));
200   populateKeyset(new PhilipsTV1f(guiObject, counter++));
201   populateKeyset(new PhilipsTV2(guiObject, counter++));
202   populateKeyset(new PhilipsTV2a(guiObject, counter++));
203   populateKeyset(new PhilipsTV2b(guiObject, counter++));
204   populateKeyset(new PhilipsTV3(guiObject, counter++));
205   populateKeyset(new PhilipsDVD1(guiObject, counter++));
206   populateKeyset(new PhilipsDVD1a(guiObject, counter++));
207   populateKeyset(new PhilipsDVD1b(guiObject, counter++));
208   populateKeyset(new PhilipsDVD1c(guiObject, counter++));
209   populateKeyset(new PhilipsDVD1d(guiObject, counter++));
210   populateKeyset(new PhilipsDVD2(guiObject, counter++));
211   populateKeyset(new PhilipsDVD3(guiObject, counter++));
212   populateKeyset(new PhilipsDVD4(guiObject, counter++));
213   populateKeyset(new PhilipsVCR1(guiObject, counter++));
214   populateKeyset(new PhilipsVCR1a(guiObject, counter++));
215   populateKeyset(new PhilipsVCR1b(guiObject, counter++));
216   populateKeyset(new PhilipsVCR1c(guiObject, counter++));
217   populateKeyset(new PhilipsSat1(guiObject, counter++));
218   populateKeyset(new PhilipsSat2(guiObject, counter++));
219   populateKeyset(new PhilipsSat2a(guiObject, counter++));
220   populateKeyset(new PhilipsSat3(guiObject, counter++));
221   populateKeyset(new PhilipsAudio1(guiObject, counter++));
222   populateKeyset(new PhilipsAudio1a(guiObject, counter++));
223   populateKeyset(new PhilipsAudio1b(guiObject, counter++));
224   populateKeyset(new PhilipsAudio2(guiObject, counter++));
225   populateKeyset(new PhilipsAudio3(guiObject, counter++));
226   populateKeyset(new PhilipsAudio4(guiObject, counter++));
227
228   populateKeyset(new PinnaclePCTV1(guiObject, counter++));
229   populateKeyset(new PinnaclePCTV2(guiObject, counter++));
230   populateKeyset(new PinnaclePCTV3(guiObject, counter++));
231
232   populateKeyset(new PioneerTV1(guiObject, counter++));
233   populateKeyset(new PioneerTV2(guiObject, counter++));
234   populateKeyset(new PioneerTV3(guiObject, counter++));
235   populateKeyset(new PioneerAudio1(guiObject, counter++));
236   populateKeyset(new PioneerAudio1a(guiObject, counter++));
237   populateKeyset(new PioneerAudio2(guiObject, counter++));
238   populateKeyset(new PioneerAudio3(guiObject, counter++));
239   populateKeyset(new PioneerAudio4(guiObject, counter++));
240   populateKeyset(new PioneerAudio5(guiObject, counter++));
241   populateKeyset(new PioneerCD1(guiObject, counter++));
242   populateKeyset(new PioneerLaserDisc1(guiObject, counter++));
243   populateKeyset(new PioneerDVD1(guiObject, counter++));
244
245   populateKeyset(new RaiteDVD1(guiObject, counter++));
246
247   populateKeyset(new RCATV1(guiObject, counter++));
248   populateKeyset(new RCATV1a(guiObject, counter++));
249   populateKeyset(new RCATV1b(guiObject, counter++));
250 /*
251   populateKeyset(new RCAAux1(guiObject, counter++));
252   populateKeyset(new RCAAux2(guiObject, counter++));
253   populateKeyset(new RCAAux2a(guiObject, counter++));
254 */
255   populateKeyset(new RCAVCR1(guiObject, counter++));
256   populateKeyset(new RCAVCR1a(guiObject, counter++));
257   populateKeyset(new RCADVD1(guiObject, counter++));
258   populateKeyset(new RCADVD1a(guiObject, counter++));
259   populateKeyset(new RCASat1(guiObject, counter++));
260   populateKeyset(new RCASat2(guiObject, counter++));
261
262   populateKeyset(new SagemTVBox1(guiObject, counter++));
263   populateKeyset(new SagemTVBox1a(guiObject, counter++));
264
265   populateKeyset(new SamsungTV1(guiObject, counter++));
266   populateKeyset(new SamsungTV1a(guiObject, counter++));
267   populateKeyset(new SamsungTV1b(guiObject, counter++));
268   populateKeyset(new SamsungTV1c(guiObject, counter++));
269   populateKeyset(new SamsungTV1d(guiObject, counter++));
270   populateKeyset(new SamsungTV1e(guiObject, counter++));
271   populateKeyset(new SamsungTV1f(guiObject, counter++));
272   populateKeyset(new SamsungTV2(guiObject, counter++));
273   populateKeyset(new SamsungTV2a(guiObject, counter++));
274   populateKeyset(new SamsungVCR1(guiObject, counter++));
275   populateKeyset(new SamsungVCR1a(guiObject, counter++));
276   populateKeyset(new SamsungVCR1b(guiObject, counter++));
277   populateKeyset(new SamsungVCR1c(guiObject, counter++));
278   populateKeyset(new SamsungVCR1d(guiObject, counter++));
279   populateKeyset(new SamsungVCR1e(guiObject, counter++));
280   populateKeyset(new SamsungDVD1(guiObject, counter++));
281   populateKeyset(new SamsungDVD1a(guiObject, counter++));
282   populateKeyset(new SamsungDVD1b(guiObject, counter++));
283   populateKeyset(new SamsungDVD2(guiObject, counter++));
284   populateKeyset(new SamsungAC1(guiObject, counter++));
285
286   populateKeyset(new SanyoVCR1(guiObject, counter++));
287   populateKeyset(new SanyoDVD1(guiObject, counter++));
288   populateKeyset(new SanyoTV1(guiObject, counter++));
289   populateKeyset(new SanyoTV1a(guiObject, counter++));
290   populateKeyset(new SanyoTV1b(guiObject, counter++));
291   populateKeyset(new SanyoTV1c(guiObject, counter++));
292   populateKeyset(new SanyoTV1d(guiObject, counter++));
293   populateKeyset(new SanyoProjector(guiObject, counter++));
294
295   populateKeyset(new SharpTV1(guiObject, counter++));
296   populateKeyset(new SharpTV1a(guiObject, counter++));
297   populateKeyset(new SharpTV1b(guiObject, counter++));
298   populateKeyset(new SharpTV1c(guiObject, counter++));
299   populateKeyset(new SharpTV1d(guiObject, counter++));
300   populateKeyset(new SharpTV1e(guiObject, counter++));
301   populateKeyset(new SharpVCR1(guiObject, counter++));
302   populateKeyset(new SharpReceiver1(guiObject, counter++));
303
304   populateKeyset(new SonyTV1(guiObject, counter++));
305   populateKeyset(new SonyTV1a(guiObject, counter++));
306   populateKeyset(new SonyTV1b(guiObject, counter++));
307   populateKeyset(new SonyTV1c(guiObject, counter++));
308   populateKeyset(new SonyAmp1(guiObject, counter++));
309   populateKeyset(new SonyAmp2(guiObject, counter++));
310   populateKeyset(new SonyAudio1(guiObject, counter++));
311   populateKeyset(new SonyAudio1a(guiObject, counter++));
312   populateKeyset(new SonyDAT1(guiObject, counter++));
313   populateKeyset(new SonyDVD1(guiObject, counter++));
314   populateKeyset(new SonyDVD1a(guiObject, counter++));
315   populateKeyset(new SonyDVD1b(guiObject, counter++));
316   populateKeyset(new SonyDVD1c(guiObject, counter++));
317   populateKeyset(new SonyVCR1(guiObject, counter++));
318   populateKeyset(new SonyVCR1a(guiObject, counter++));
319   populateKeyset(new SonyVCR1b(guiObject, counter++));
320   populateKeyset(new SonyReceiver1(guiObject, counter++));
321
322   populateKeyset(new Tivo1(guiObject, counter++));
323   populateKeyset(new Tivo1a(guiObject, counter++));
324   populateKeyset(new Tivo1b(guiObject, counter++));
325   populateKeyset(new Tivo1c(guiObject, counter++));
326   populateKeyset(new Tivo1d(guiObject, counter++));
327
328   populateKeyset(new ToshibaTV1(guiObject, counter++));
329   populateKeyset(new ToshibaTV1a(guiObject, counter++));
330   populateKeyset(new ToshibaTV1b(guiObject, counter++));
331   populateKeyset(new ToshibaTV1c(guiObject, counter++));
332   populateKeyset(new ToshibaTV1d(guiObject, counter++));
333   populateKeyset(new ToshibaTV1e(guiObject, counter++));
334   populateKeyset(new ToshibaTV1f(guiObject, counter++));
335   populateKeyset(new ToshibaTV1g(guiObject, counter++));
336   populateKeyset(new ToshibaVCR1(guiObject, counter++));
337   populateKeyset(new ToshibaVCR1a(guiObject, counter++));
338   populateKeyset(new ToshibaDisc1(guiObject, counter++));
339   populateKeyset(new ToshibaDisc1a(guiObject, counter++));
340   populateKeyset(new ToshibaDisc1b(guiObject, counter++));
341   populateKeyset(new ToshibaDisc1c(guiObject, counter++));
342   populateKeyset(new ToshibaDisc1d(guiObject, counter++));
343
344   populateKeyset(new WestinghouseTV1(guiObject, counter++));
345   populateKeyset(new WestinghouseTV2(guiObject, counter++));
346
347   populateKeyset(new YamahaDVD1(guiObject, counter++));
348   populateKeyset(new YamahaDVD1a(guiObject, counter++));
349   populateKeyset(new YamahaAudio1(guiObject, counter++));
350   populateKeyset(new YamahaAudio1a(guiObject, counter++));
351   populateKeyset(new YamahaAudio2(guiObject, counter++));
352   populateKeyset(new YamahaAudio2a(guiObject, counter++));
353   populateKeyset(new YamahaAudio2b(guiObject, counter++));
354   populateKeyset(new YamahaAudio2c(guiObject, counter++));
355   populateKeyset(new YamahaAudio2d(guiObject, counter++));
356   populateKeyset(new YamahaAudio3(guiObject, counter++));
357   populateKeyset(new YamahaAudio4(guiObject, counter++));
358   populateKeyset(new YamahaTV1(guiObject, counter++));
359   populateKeyset(new YamahaKaraoke1(guiObject, counter++));
360
361   populateKeyset(new ZenithC32V37(guiObject, counter++));
362
363   // Start the thread running:
364   commandThread.start();
365 }
366
367
368 PIRKeysetManager::~PIRKeysetManager()
369 {
370   // Tell the keysets to stop doing any work:
371   {
372     QMutexLocker locker(&stopRepeatingMutex);
373     stopRepeatingFlag = true;
374   }
375
376   // Tell the thread that we want it to stop:
377   commandThread.exit();
378
379   // Wait for the thread to stop:
380   commandThread.wait();
381
382   // Delete all the keysets:
383   PIRKeysetCollection::iterator i = keysetsInfo.begin();
384   while (i != keysetsInfo.end())
385   {
386     if ((*i).second) delete (*i).second;
387     ++i;
388   }
389 }
390
391
392 bool PIRKeysetManager::keysetExists(
393   unsigned int keysetID) const
394 {
395   PIRKeysetCollection::const_iterator i = keysetsInfo.find(keysetID);
396
397   return (i != keysetsInfo.end());
398 }
399
400
401 bool PIRKeysetManager::findKeysetID(
402   QString make,
403   QString name,
404   unsigned int &id) const
405 {
406   // Only modify the id if we actually find a match!
407
408   PIRKeysetMakeIndex::const_iterator i = makeIndex.find(make);
409   if (i == makeIndex.end())
410   {
411     return false;
412   }
413
414   PIRKeysetNameIndex::const_iterator ii = (*i).second.find(name);
415   if (ii == (*i).second.end())
416   {
417     return false;
418   }
419
420   //  Ok, we've found it, pull out the id:
421   id = (*ii).second;
422   return true;
423 }
424
425
426 PIRKeysetWidgetItem *PIRKeysetManager::makeKeysetItem(
427   QString make,
428   QString name) const
429 {
430   unsigned int id;
431
432   if (!findKeysetID(make, name, id))
433   {
434     return NULL;
435   }
436
437   QString fullname = make;
438   fullname.append(" ");
439   fullname.append(name);
440
441   return new PIRKeysetWidgetItem(fullname, id, getMake(id));
442 }
443
444
445 bool PIRKeysetManager::hasKey(
446   unsigned int keysetID,
447   PIRKeyName name) const
448 {
449   PIRKeysetCollection::const_iterator i = keysetsInfo.find(keysetID);
450
451   if ((i == keysetsInfo.end()) || !i->second) return false;
452
453   return i->second->hasKey(name);
454 }
455
456
457 PIRMakeName PIRKeysetManager::getMake(
458   unsigned int keysetID) const
459 {
460   PIRKeysetCollection::const_iterator i = keysetsInfo.find(keysetID);
461
462   if ((i == keysetsInfo.end()) || !i->second) return Any_Make;
463
464   return i->second->getMake();
465 }
466
467
468 QString PIRKeysetManager::getDisplayName(
469   unsigned int keysetID) const
470 {
471   PIRKeysetCollection::const_iterator i = keysetsInfo.find(keysetID);
472
473   if ((i == keysetsInfo.end()) || !i->second)
474     return QString("Database Error");
475
476   return QString(i->second->getKeysetName());
477 }
478
479
480 void PIRKeysetManager::populateKeyset(
481   PIRKeysetMetaData *keyset)
482 {
483   // Set up the keyset collection:
484   keysetsInfo[keyset->getID()] = keyset;
485
486   keyset->moveProtocolToThread(&commandThread);
487
488   // Also, set up a name-based index into the collection:
489   makeIndex
490     [QString(makeManager.getMakeString(keyset->getMake()))]
491     [QString(keyset->getKeysetName())]
492     = keyset->getID();
493 }
494
495
496 void PIRKeysetManager::populateGuiWidget(
497   PIRSelectKeysetForm *skf) const
498 {
499   PIRMakeName make;
500   PIRKeysetWidgetItem *kwi;
501
502   PIRKeysetCollection::const_iterator i = keysetsInfo.begin();
503
504   while (i != keysetsInfo.end())
505   {
506     make = i->second->getMake();
507     QString tempString = makeManager.getMakeString(make);
508     tempString.append(" ");
509     tempString.append(i->second->getKeysetName());
510     kwi = new PIRKeysetWidgetItem(tempString, i->first, make);
511     i->second->populateDeviceTypes(kwi);
512     skf->addWidgetItem(kwi);
513     ++i;
514   }
515 }
516
517
518 void PIRKeysetManager::populateDeviceTypes(
519   PIRKeysetWidgetItem *kwi,
520   unsigned int keysetID) const
521 {
522   PIRKeysetCollection::const_iterator i = keysetsInfo.find(keysetID);
523   if ((i != keysetsInfo.end()) && i->second)
524   {
525     i->second->populateDeviceTypes(kwi);
526   }
527 }