X-Git-Url: http://git.maemo.org/git/?a=blobdiff_plain;f=pirkeysetmanager.cpp;h=48b08992166e12a01f2584157f347b51d4b68f38;hb=d4996260671e35f52fddccd2c11ad55d3c6a2995;hp=1d99410e38fd85be0531d4202f3bd25aca590cc9;hpb=717cbb06cb8e85c3ca463753a8098d6e304858de;p=pierogi diff --git a/pirkeysetmanager.cpp b/pirkeysetmanager.cpp index 1d99410..48b0899 100644 --- a/pirkeysetmanager.cpp +++ b/pirkeysetmanager.cpp @@ -1,39 +1,77 @@ #include "pirkeysetmanager.h" + #include "pirkeysetmetadata.h" +#include "pirselectkeysetform.h" +#include "pirkeysetwidgetitem.h" + +#include "keysets/acer.h" +#include "keysets/admiral.h" +#include "keysets/aiwa.h" #include "keysets/apple.h" +#include "keysets/beko.h" +#include "keysets/bose.h" +#include "keysets/cambridge.h" +#include "keysets/daewoo.h" +#include "keysets/denon.h" +#include "keysets/digitalstream.h" +#include "keysets/directv.h" +#include "keysets/dish.h" #include "keysets/ei.h" +#include "keysets/elgato.h" +#include "keysets/emerson.h" +#include "keysets/fortec.h" #include "keysets/goldstar.h" +#include "keysets/grundig.h" +#include "keysets/haier.h" #include "keysets/hauppauge.h" +#include "keysets/hitachi.h" +#include "keysets/homecast.h" +#include "keysets/hp.h" +#include "keysets/huawei.h" #include "keysets/jvc.h" +#include "keysets/kenwood.h" #include "keysets/lg.h" +#include "keysets/logitech.h" +#include "keysets/magnavox.h" +#include "keysets/mce.h" #include "keysets/mitsubishi.h" +#include "keysets/motorola.h" #include "keysets/nokia.h" +#include "keysets/onida.h" #include "keysets/panasonic.h" +#include "keysets/philco.h" +#include "keysets/philips.h" +#include "keysets/pinnacle.h" +#include "keysets/pioneer.h" +#include "keysets/raite.h" #include "keysets/rca.h" +#include "keysets/roku.h" +#include "keysets/saba.h" +#include "keysets/sagem.h" #include "keysets/samsung.h" #include "keysets/sanyo.h" #include "keysets/sharp.h" +#include "keysets/sky.h" #include "keysets/sony.h" +#include "keysets/tivo.h" +#include "keysets/topfield.h" #include "keysets/toshiba.h" +#include "keysets/vestel.h" +#include "keysets/virgin.h" +#include "keysets/vizio.h" +#include "keysets/wd.h" #include "keysets/westinghouse.h" +#include "keysets/yamaha.h" #include "keysets/zenith.h" -//#include "protocol.h" -#include "pirmakenames.h" #include "pirexception.h" -#include -//#include - // I'll be handling the threading of the keyset commands in this object: #include -// This file defines some global stuff! First, threading globals: - -// The stopRepeatingFlag boolean is the method used to tell running commands -// in the worker thread to stop: -bool stopRepeatingFlag; -QMutex stopRepeatingMutex; +// Global communications mechanism: +extern bool stopRepeatingFlag; +extern QMutex stopRepeatingMutex; // Global helper objects: PIRMakeMgr makeManager; @@ -41,175 +79,439 @@ PIRDeviceTypeMgr deviceManager; // Now, on to the actual method definitions: -PIRKeysetManager::PIRKeysetManager( - QObject *guiObject) +PIRKeysetManager::PIRKeysetManager() : counter(0) { // Create the keysets. Ugly! This needs to be worked on! - populateKeyset(new AppleWhiteRemote(guiObject, counter++)); - - populateKeyset(new EiKeyset(guiObject, counter++)); - - populateKeyset(new GoldStarTV1(guiObject, counter++)); - populateKeyset(new GoldStarTV2(guiObject, counter++)); - populateKeyset(new GoldStarVCR1(guiObject, counter++)); - populateKeyset(new GoldStarVCR1a(guiObject, counter++)); - populateKeyset(new GoldStarVCR1b(guiObject, counter++)); - populateKeyset(new GoldStarVCR1c(guiObject, counter++)); - populateKeyset(new GoldStarVCR1d(guiObject, counter++)); - populateKeyset(new GoldStarCD1(guiObject, counter++)); - - populateKeyset(new HauppaugeGeneric(guiObject, counter++)); - populateKeyset(new HauppaugeTV1(guiObject, counter++)); - - populateKeyset(new JVCSat1(guiObject, counter++)); - populateKeyset(new JVCSat2(guiObject, counter++)); - populateKeyset(new JVCVCR1(guiObject, counter++)); - populateKeyset(new JVCVCR1a(guiObject, counter++)); - populateKeyset(new JVCVCR1b(guiObject, counter++)); - populateKeyset(new JVCVCR1c(guiObject, counter++)); - populateKeyset(new JVCVCR2(guiObject, counter++)); - populateKeyset(new JVCVCR2a(guiObject, counter++)); - populateKeyset(new JVCVCR2b(guiObject, counter++)); - populateKeyset(new JVCVCR2c(guiObject, counter++)); - populateKeyset(new JVCTV1(guiObject, counter++)); - populateKeyset(new JVCTV1a(guiObject, counter++)); - populateKeyset(new JVCTV1b(guiObject, counter++)); - populateKeyset(new JVCTV1c(guiObject, counter++)); - populateKeyset(new JVCTV1d(guiObject, counter++)); - populateKeyset(new JVCTV2(guiObject, counter++)); - populateKeyset(new JVCTV2a(guiObject, counter++)); - populateKeyset(new JVCTV2b(guiObject, counter++)); - populateKeyset(new JVCTV2c(guiObject, counter++)); - populateKeyset(new JVCTV2d(guiObject, counter++)); - populateKeyset(new JVCDAT1(guiObject, counter++)); - populateKeyset(new JVCCarDeck1(guiObject, counter++)); - populateKeyset(new JVCPortableAudio1(guiObject, counter++)); - populateKeyset(new JVCPortableAudio1a(guiObject, counter++)); - populateKeyset(new JVCPortableAudio1b(guiObject, counter++)); - populateKeyset(new JVCPortableAudio2(guiObject, counter++)); - populateKeyset(new JVCDVD1(guiObject, counter++)); - - populateKeyset(new LGTV1(guiObject, counter++)); - populateKeyset(new LGTV1a(guiObject, counter++)); - populateKeyset(new LGTV1b(guiObject, counter++)); - populateKeyset(new LGTV1c(guiObject, counter++)); - populateKeyset(new LGTV2(guiObject, counter++)); - populateKeyset(new LGTV2a(guiObject, counter++)); - populateKeyset(new LGTV2b(guiObject, counter++)); - populateKeyset(new LGDisc1(guiObject, counter++)); - populateKeyset(new LGDisc2(guiObject, counter++)); - populateKeyset(new LGDisc2a(guiObject, counter++)); - populateKeyset(new LGVCR1(guiObject, counter++)); - populateKeyset(new LGVCR1a(guiObject, counter++)); - populateKeyset(new LGVCR1b(guiObject, counter++)); - - populateKeyset(new MitsubishiTV1(guiObject, counter++)); - populateKeyset(new MitsubishiTV1a(guiObject, counter++)); - populateKeyset(new MitsubishiVCR1(guiObject, counter++)); - populateKeyset(new MitsubishiVCR1a(guiObject, counter++)); - - populateKeyset(new NokiaGenericVCR(guiObject, counter++)); - - populateKeyset(new PanasonicAmp(guiObject, counter++)); - populateKeyset(new PanasonicCarAudio(guiObject, counter++)); - populateKeyset(new PanasonicSat1(guiObject, counter++)); - populateKeyset(new PanasonicSat1a(guiObject, counter++)); - populateKeyset(new PanasonicTV1(guiObject, counter++)); - populateKeyset(new PanasonicTV1a(guiObject, counter++)); - populateKeyset(new PanasonicTV1b(guiObject, counter++)); - populateKeyset(new PanasonicVCR1(guiObject, counter++)); - populateKeyset(new PanasonicVCR1a(guiObject, counter++)); - populateKeyset(new PanasonicVCR1b(guiObject, counter++)); - populateKeyset(new PanasonicVCR1c(guiObject, counter++)); - populateKeyset(new PanasonicDVD1(guiObject, counter++)); - populateKeyset(new PanasonicDVD1a(guiObject, counter++)); - populateKeyset(new PanasonicAudio(guiObject, counter++)); - - populateKeyset(new RCATV1(guiObject, counter++)); - populateKeyset(new RCATV1a(guiObject, counter++)); - populateKeyset(new RCATV2(guiObject, counter++)); - populateKeyset(new RCAAux1(guiObject, counter++)); - populateKeyset(new RCAAux2(guiObject, counter++)); - populateKeyset(new RCAAux2a(guiObject, counter++)); - populateKeyset(new RCAVCR1(guiObject, counter++)); - populateKeyset(new RCAVCR2(guiObject, counter++)); - populateKeyset(new RCADVD1(guiObject, counter++)); - populateKeyset(new RCADVD1a(guiObject, counter++)); - populateKeyset(new RCASat1(guiObject, counter++)); - populateKeyset(new RCASat2(guiObject, counter++)); - - populateKeyset(new SamsungTV1(guiObject, counter++)); - populateKeyset(new SamsungTV1a(guiObject, counter++)); - populateKeyset(new SamsungTV1b(guiObject, counter++)); - populateKeyset(new SamsungTV1c(guiObject, counter++)); - populateKeyset(new SamsungTV1d(guiObject, counter++)); - populateKeyset(new SamsungTV1e(guiObject, counter++)); - populateKeyset(new SamsungTV1f(guiObject, counter++)); - populateKeyset(new SamsungTV2(guiObject, counter++)); - populateKeyset(new SamsungTV2a(guiObject, counter++)); - populateKeyset(new SamsungVCR1(guiObject, counter++)); - populateKeyset(new SamsungVCR1a(guiObject, counter++)); - populateKeyset(new SamsungVCR1b(guiObject, counter++)); - populateKeyset(new SamsungVCR1c(guiObject, counter++)); - populateKeyset(new SamsungVCR1d(guiObject, counter++)); - populateKeyset(new SamsungVCR1e(guiObject, counter++)); - populateKeyset(new SamsungDVD1(guiObject, counter++)); - populateKeyset(new SamsungDVD1a(guiObject, counter++)); - populateKeyset(new SamsungDVD1b(guiObject, counter++)); - populateKeyset(new SamsungDVD2(guiObject, counter++)); - populateKeyset(new SamsungAC1(guiObject, counter++)); - - populateKeyset(new SanyoTV1(guiObject, counter++)); - populateKeyset(new SanyoTV2(guiObject, counter++)); - populateKeyset(new SanyoVCR1(guiObject, counter++)); - - populateKeyset(new SharpTV1(guiObject, counter++)); - populateKeyset(new SharpTV1a(guiObject, counter++)); - populateKeyset(new SharpTV1b(guiObject, counter++)); - populateKeyset(new SharpTV1c(guiObject, counter++)); - populateKeyset(new SharpTV1d(guiObject, counter++)); - populateKeyset(new SharpTV1e(guiObject, counter++)); - populateKeyset(new SharpVCR1(guiObject, counter++)); - populateKeyset(new SharpReceiver1(guiObject, counter++)); - - populateKeyset(new SonyTV1(guiObject, counter++)); - populateKeyset(new SonyTV1a(guiObject, counter++)); - populateKeyset(new SonyTV1b(guiObject, counter++)); - populateKeyset(new SonyTV1d(guiObject, counter++)); - populateKeyset(new SonyAmp1(guiObject, counter++)); - populateKeyset(new SonyAmp2(guiObject, counter++)); - populateKeyset(new SonyCD1(guiObject, counter++)); - populateKeyset(new SonyCD1a(guiObject, counter++)); - populateKeyset(new SonyCD2(guiObject, counter++)); - populateKeyset(new SonyCD3(guiObject, counter++)); - populateKeyset(new SonyDAT1(guiObject, counter++)); - populateKeyset(new SonyDVD1(guiObject, counter++)); - populateKeyset(new SonyDVD1a(guiObject, counter++)); - populateKeyset(new SonyDVD1b(guiObject, counter++)); - populateKeyset(new SonyDVD1c(guiObject, counter++)); - populateKeyset(new SonyVCR1(guiObject, counter++)); - populateKeyset(new SonyVCR1a(guiObject, counter++)); - populateKeyset(new SonyReceiver1(guiObject, counter++)); - - populateKeyset(new ToshibaTV1(guiObject, counter++)); - populateKeyset(new ToshibaTV1a(guiObject, counter++)); - populateKeyset(new ToshibaTV1b(guiObject, counter++)); - populateKeyset(new ToshibaTV1c(guiObject, counter++)); - populateKeyset(new ToshibaTV1d(guiObject, counter++)); - populateKeyset(new ToshibaTV1e(guiObject, counter++)); - populateKeyset(new ToshibaVCR1(guiObject, counter++)); - populateKeyset(new ToshibaVCR1a(guiObject, counter++)); - populateKeyset(new ToshibaDisc1(guiObject, counter++)); - populateKeyset(new ToshibaDisc1a(guiObject, counter++)); - populateKeyset(new ToshibaDisc1b(guiObject, counter++)); - populateKeyset(new ToshibaDisc1c(guiObject, counter++)); - populateKeyset(new ToshibaDisc1d(guiObject, counter++)); - - populateKeyset(new WestinghouseTV1(guiObject, counter++)); - populateKeyset(new WestinghouseTV2(guiObject, counter++)); - - populateKeyset(new ZenithC32V37(guiObject, counter++)); + setupKeyset(new AcerTV1(counter++)); + setupKeyset(new AcerPC1(counter++)); + + setupKeyset(new AdmiralTV1(counter++)); + setupKeyset(new AdmiralTV2(counter++)); + setupKeyset(new AdmiralVCR1(counter++)); + + setupKeyset(new AiwaVCR1(counter++)); + setupKeyset(new AiwaVCR2(counter++)); + setupKeyset(new AiwaVCR3(counter++)); + setupKeyset(new AiwaAudio1(counter++)); + setupKeyset(new AiwaAudio1a(counter++)); + setupKeyset(new AiwaAudio2(counter++)); + setupKeyset(new AiwaAudio2a(counter++)); + setupKeyset(new AiwaAudio2b(counter++)); + setupKeyset(new AiwaAudio2c(counter++)); + setupKeyset(new AiwaAudio3(counter++)); + setupKeyset(new AiwaAudio4(counter++)); + setupKeyset(new AiwaAudio5(counter++)); + setupKeyset(new AiwaAudio6(counter++)); + setupKeyset(new AiwaCarStereo1(counter++)); + setupKeyset(new AiwaDVD1(counter++)); + + setupKeyset(new AppleWhiteRemote(counter++)); + + setupKeyset(new BekoTV1(counter++)); + + setupKeyset(new BoseRadio1(counter++)); + setupKeyset(new BoseRadio2(counter++)); + setupKeyset(new BoseRadio3(counter++)); + setupKeyset(new BoseHomeTheater1(counter++)); + + setupKeyset(new CambridgeCD1(counter++)); + setupKeyset(new CambridgeAudio1(counter++)); + setupKeyset(new CambridgeAudio2(counter++)); + setupKeyset(new CambridgeAudio3(counter++)); + setupKeyset(new CambridgeDVD1(counter++)); + + setupKeyset(new DaewooTV1(counter++)); + setupKeyset(new DaewooTV2(counter++)); + setupKeyset(new DaewooTV3(counter++)); + setupKeyset(new DaewooTV4(counter++)); + setupKeyset(new DaewooDVD1(counter++)); + setupKeyset(new DaewooVCR1(counter++)); + setupKeyset(new DaewooVCR2(counter++)); + + setupKeyset(new DenonDVD1(counter++)); + setupKeyset(new DenonDVD2(counter++)); + setupKeyset(new DenonDVD3(counter++)); + setupKeyset(new DenonReceiver1(counter++)); + setupKeyset(new DenonReceiver1a(counter++)); + setupKeyset(new DenonReceiver1b(counter++)); + setupKeyset(new DenonReceiver1c(counter++)); + setupKeyset(new DenonReceiver1d(counter++)); + setupKeyset(new DenonReceiver1e(counter++)); + setupKeyset(new DenonReceiver1f(counter++)); + setupKeyset(new DenonReceiver2(counter++)); + setupKeyset(new DenonReceiver2a(counter++)); + setupKeyset(new DenonReceiver3(counter++)); + setupKeyset(new DenonAudio1(counter++)); + setupKeyset(new DenonAudio1a(counter++)); + setupKeyset(new DenonAudio1b(counter++)); + setupKeyset(new DenonAudio1c(counter++)); + setupKeyset(new DenonAudio1d(counter++)); + setupKeyset(new DenonAudio2(counter++)); + setupKeyset(new DenonAudio3(counter++)); + setupKeyset(new DenonAudio4(counter++)); + + setupKeyset(new DigitalStreamReceiver(counter++)); + + setupKeyset(new DirectvReceiver1(counter++)); + + setupKeyset(new DishReceiver1(counter++)); + setupKeyset(new DishReceiver1a(counter++)); + setupKeyset(new DishReceiver1b(counter++)); + setupKeyset(new DishReceiver1c(counter++)); + setupKeyset(new DishReceiver1d(counter++)); + setupKeyset(new DishReceiver1e(counter++)); + setupKeyset(new DishReceiver1f(counter++)); + setupKeyset(new DishReceiver1g(counter++)); + setupKeyset(new DishReceiver1h(counter++)); + setupKeyset(new DishReceiver1i(counter++)); + setupKeyset(new DishReceiver1j(counter++)); + setupKeyset(new DishReceiver1k(counter++)); + setupKeyset(new DishReceiver1l(counter++)); + setupKeyset(new DishReceiver1m(counter++)); + setupKeyset(new DishReceiver1n(counter++)); + setupKeyset(new DishReceiver1o(counter++)); + + setupKeyset(new EiTV1(counter++)); + + setupKeyset(new ElgatoEyeTV1(counter++)); + + setupKeyset(new EmersonTV1(counter++)); + setupKeyset(new EmersonDVD1(counter++)); + + setupKeyset(new FortecReceiver1(counter++)); + setupKeyset(new FortecReceiver2(counter++)); + + setupKeyset(new GoldStarTV1(counter++)); + setupKeyset(new GoldStarTV2(counter++)); + setupKeyset(new GoldStarVCR1(counter++)); + setupKeyset(new GoldStarVCR1a(counter++)); + setupKeyset(new GoldStarVCR1b(counter++)); + setupKeyset(new GoldStarVCR1c(counter++)); + setupKeyset(new GoldStarCD1(counter++)); + + setupKeyset(new GrundigSat1(counter++)); + setupKeyset(new GrundigSat2(counter++)); + setupKeyset(new GrundigAmp1(counter++)); + setupKeyset(new GrundigAudio1(counter++)); + setupKeyset(new GrundigAudio2(counter++)); + setupKeyset(new GrundigVCR1(counter++)); + setupKeyset(new GrundigVCR1a(counter++)); + setupKeyset(new GrundigTV1(counter++)); + setupKeyset(new GrundigTV2(counter++)); + setupKeyset(new GrundigTV3(counter++)); + setupKeyset(new GrundigDVD1(counter++)); + + setupKeyset(new HaierTV1(counter++)); + + setupKeyset(new HauppaugePCTV1(counter++)); + setupKeyset(new HauppaugePCTV1a(counter++)); + setupKeyset(new HauppaugePCTV1b(counter++)); + setupKeyset(new HauppaugePCTV1c(counter++)); + setupKeyset(new HauppaugePCTV2(counter++)); + + setupKeyset(new HitachiTV1(counter++)); + setupKeyset(new HitachiTV1a(counter++)); + setupKeyset(new HitachiTV1b(counter++)); + setupKeyset(new HitachiTV1c(counter++)); + setupKeyset(new HitachiTV2(counter++)); + setupKeyset(new HitachiTV3(counter++)); + setupKeyset(new HitachiProjector(counter++)); + setupKeyset(new HitachiDVD1(counter++)); + setupKeyset(new HitachiAudio1(counter++)); + setupKeyset(new HitachiVCR1(counter++)); + + setupKeyset(new HomecastReceiver1(counter++)); + setupKeyset(new HomecastReceiver2(counter++)); + + setupKeyset(new HPRemote1(counter++)); + + setupKeyset(new HuaweiSTB1(counter++)); + setupKeyset(new HuaweiSTB2(counter++)); + + setupKeyset(new JVCSat1(counter++)); + setupKeyset(new JVCSat2(counter++)); + setupKeyset(new JVCVCR1(counter++)); + setupKeyset(new JVCVCR1a(counter++)); + setupKeyset(new JVCVCRBmode1(counter++)); + setupKeyset(new JVCVCRBmode1a(counter++)); + setupKeyset(new JVCTV1(counter++)); + setupKeyset(new JVCTV1a(counter++)); + setupKeyset(new JVCTV1b(counter++)); + setupKeyset(new JVCTV1c(counter++)); + setupKeyset(new JVCTV1d(counter++)); + setupKeyset(new JVCDAT1(counter++)); + setupKeyset(new JVCCarDeck1(counter++)); + setupKeyset(new JVCAudio1(counter++)); + setupKeyset(new JVCAudio1a(counter++)); + setupKeyset(new JVCAudio1b(counter++)); + setupKeyset(new JVCAudio2(counter++)); + setupKeyset(new JVCDVD1(counter++)); + + setupKeyset(new KenwoodAudio1(counter++)); + setupKeyset(new KenwoodComponent1(counter++)); + setupKeyset(new KenwoodComponent2(counter++)); + setupKeyset(new KenwoodComponent3(counter++)); + setupKeyset(new KenwoodCD1(counter++)); + setupKeyset(new KenwoodDVD1(counter++)); + setupKeyset(new KenwoodTV1(counter++)); + + setupKeyset(new LGTV1(counter++)); + setupKeyset(new LGTV1a(counter++)); + setupKeyset(new LGTV1b(counter++)); + setupKeyset(new LGTV1c(counter++)); + setupKeyset(new LGTV2(counter++)); + setupKeyset(new LGTV2a(counter++)); + setupKeyset(new LGTV2b(counter++)); + setupKeyset(new LGDisc1(counter++)); + setupKeyset(new LGDisc2(counter++)); + setupKeyset(new LGDisc2a(counter++)); + setupKeyset(new LGVCR1(counter++)); + setupKeyset(new LGVCR1a(counter++)); + setupKeyset(new LGVCR1b(counter++)); + setupKeyset(new LGAC1(counter++)); + + setupKeyset(new LogitechSpeakers(counter++)); + + setupKeyset(new MagnavoxDVD1(counter++)); + setupKeyset(new MagnavoxVCR1(counter++)); + setupKeyset(new MagnavoxConverterBox1(counter++)); + setupKeyset(new MagnavoxTV1(counter++)); + + setupKeyset(new MCERemote1(counter++)); + setupKeyset(new MCERemote1a(counter++)); + setupKeyset(new MCERemote1b(counter++)); + setupKeyset(new MCERemote1c(counter++)); + setupKeyset(new MCERemote1d(counter++)); + setupKeyset(new MCERemote1e(counter++)); + setupKeyset(new MCERemote1f(counter++)); + setupKeyset(new MCERemote1g(counter++)); + + setupKeyset(new MitsubishiTV1(counter++)); + setupKeyset(new MitsubishiTV1a(counter++)); + setupKeyset(new MitsubishiVCR1(counter++)); + setupKeyset(new MitsubishiVCR1a(counter++)); + + setupKeyset(new Motorola4DTV(counter++)); + setupKeyset(new MotorolaSTB1(counter++)); + setupKeyset(new MotorolaSTB1a(counter++)); + setupKeyset(new MotorolaSTB1b(counter++)); + setupKeyset(new MotorolaSkyDigital(counter++)); + + setupKeyset(new NokiaGenericVCR(counter++)); + + setupKeyset(new OnidaTV1(counter++)); + setupKeyset(new OnidaDVD1(counter++)); + + setupKeyset(new PanasonicCarAudio(counter++)); + setupKeyset(new PanasonicSat1(counter++)); + setupKeyset(new PanasonicSat1a(counter++)); + setupKeyset(new PanasonicTV1(counter++)); + setupKeyset(new PanasonicTV1a(counter++)); + setupKeyset(new PanasonicTV1b(counter++)); + setupKeyset(new PanasonicVCR1(counter++)); + setupKeyset(new PanasonicVCR1a(counter++)); + setupKeyset(new PanasonicVCR1b(counter++)); + setupKeyset(new PanasonicVCR1c(counter++)); + setupKeyset(new PanasonicDVD1(counter++)); + setupKeyset(new PanasonicDVD1a(counter++)); + setupKeyset(new PanasonicAudio1(counter++)); + setupKeyset(new PanasonicAC1(counter++)); + + setupKeyset(new PhilcoTV(counter++)); + + setupKeyset(new PhilipsTV1(counter++)); + setupKeyset(new PhilipsTV1a(counter++)); + setupKeyset(new PhilipsTV1b(counter++)); + setupKeyset(new PhilipsTV1c(counter++)); + setupKeyset(new PhilipsTV1d(counter++)); + setupKeyset(new PhilipsTV1e(counter++)); + setupKeyset(new PhilipsTV1f(counter++)); + setupKeyset(new PhilipsTV2(counter++)); + setupKeyset(new PhilipsTV2a(counter++)); + setupKeyset(new PhilipsTV2b(counter++)); + setupKeyset(new PhilipsTV3(counter++)); + setupKeyset(new PhilipsDVD1(counter++)); + setupKeyset(new PhilipsDVD1a(counter++)); + setupKeyset(new PhilipsDVD1b(counter++)); + setupKeyset(new PhilipsDVD1c(counter++)); + setupKeyset(new PhilipsDVD1d(counter++)); + setupKeyset(new PhilipsDVD2(counter++)); + setupKeyset(new PhilipsDVD3(counter++)); + setupKeyset(new PhilipsDVD3a(counter++)); + setupKeyset(new PhilipsDVD4(counter++)); + setupKeyset(new PhilipsVCR1(counter++)); + setupKeyset(new PhilipsVCR1a(counter++)); + setupKeyset(new PhilipsVCR1b(counter++)); + setupKeyset(new PhilipsVCR1c(counter++)); + setupKeyset(new PhilipsSat1(counter++)); + setupKeyset(new PhilipsSat2(counter++)); + setupKeyset(new PhilipsSat2a(counter++)); + setupKeyset(new PhilipsSat3(counter++)); + setupKeyset(new PhilipsAudio1(counter++)); + setupKeyset(new PhilipsAudio1a(counter++)); + setupKeyset(new PhilipsAudio1b(counter++)); + setupKeyset(new PhilipsAudio2(counter++)); + setupKeyset(new PhilipsAudio3(counter++)); + setupKeyset(new PhilipsAudio4(counter++)); + + setupKeyset(new PinnaclePCTV1(counter++)); + setupKeyset(new PinnaclePCTV2(counter++)); + setupKeyset(new PinnaclePCTV3(counter++)); + + setupKeyset(new PioneerTV1(counter++)); + setupKeyset(new PioneerTV2(counter++)); + setupKeyset(new PioneerTV3(counter++)); + setupKeyset(new PioneerAudio1(counter++)); + setupKeyset(new PioneerAudio1a(counter++)); + setupKeyset(new PioneerAudio2(counter++)); + setupKeyset(new PioneerAudio3(counter++)); + setupKeyset(new PioneerAudio4(counter++)); + setupKeyset(new PioneerAudio5(counter++)); + setupKeyset(new PioneerCD1(counter++)); + setupKeyset(new PioneerLaserDisc1(counter++)); + setupKeyset(new PioneerDVD1(counter++)); + + setupKeyset(new RaiteDVD1(counter++)); + + setupKeyset(new RCATV1(counter++)); + setupKeyset(new RCATV1a(counter++)); + setupKeyset(new RCATV1b(counter++)); +// setupKeyset(new RCAAux1(counter++)); +// setupKeyset(new RCAAux2(counter++)); +// setupKeyset(new RCAAux2a(counter++)); + setupKeyset(new RCAVCR1(counter++)); + setupKeyset(new RCAVCR1a(counter++)); + setupKeyset(new RCADVD1(counter++)); + setupKeyset(new RCADVD1a(counter++)); + setupKeyset(new RCASat1(counter++)); + setupKeyset(new RCASat2(counter++)); + + setupKeyset(new RokuBox1(counter++)); + setupKeyset(new RokuBox2(counter++)); + + setupKeyset(new SabaTV1(counter++)); + setupKeyset(new SabaTV2(counter++)); + + setupKeyset(new SagemTVBox1(counter++)); + setupKeyset(new SagemTVBox1a(counter++)); + + setupKeyset(new SamsungTV1(counter++)); + setupKeyset(new SamsungTV1a(counter++)); + setupKeyset(new SamsungTV1b(counter++)); + setupKeyset(new SamsungTV1c(counter++)); + setupKeyset(new SamsungTV1d(counter++)); + setupKeyset(new SamsungTV1e(counter++)); + setupKeyset(new SamsungTV1f(counter++)); + setupKeyset(new SamsungTV2(counter++)); + setupKeyset(new SamsungTV2a(counter++)); + setupKeyset(new SamsungVCR1(counter++)); + setupKeyset(new SamsungVCR1a(counter++)); + setupKeyset(new SamsungVCR1b(counter++)); + setupKeyset(new SamsungVCR1c(counter++)); + setupKeyset(new SamsungVCR1d(counter++)); + setupKeyset(new SamsungVCR1e(counter++)); + setupKeyset(new SamsungDVD1(counter++)); + setupKeyset(new SamsungDVD1a(counter++)); + setupKeyset(new SamsungDVD1b(counter++)); + setupKeyset(new SamsungDVD2(counter++)); + setupKeyset(new SamsungAC1(counter++)); + setupKeyset(new SamsungDVBT1(counter++)); + + setupKeyset(new SanyoVCR1(counter++)); + setupKeyset(new SanyoDVD1(counter++)); + setupKeyset(new SanyoTV1(counter++)); + setupKeyset(new SanyoTV1a(counter++)); + setupKeyset(new SanyoTV1b(counter++)); + setupKeyset(new SanyoTV1c(counter++)); + setupKeyset(new SanyoTV1d(counter++)); + setupKeyset(new SanyoProjector(counter++)); + + setupKeyset(new SharpTV1(counter++)); + setupKeyset(new SharpTV1a(counter++)); + setupKeyset(new SharpTV1b(counter++)); + setupKeyset(new SharpTV1c(counter++)); + setupKeyset(new SharpTV1d(counter++)); + setupKeyset(new SharpTV1e(counter++)); + setupKeyset(new SharpVCR1(counter++)); + setupKeyset(new SharpReceiver1(counter++)); + setupKeyset(new SharpAC1(counter++)); + + setupKeyset(new SkyReceiver1(counter++)); + setupKeyset(new SkyReceiver1a(counter++)); + + setupKeyset(new SonyTV1(counter++)); + setupKeyset(new SonyTV1a(counter++)); + setupKeyset(new SonyTV1b(counter++)); + setupKeyset(new SonyTV1c(counter++)); + setupKeyset(new SonyAmp1(counter++)); + setupKeyset(new SonyAmp2(counter++)); + setupKeyset(new SonyAudio1(counter++)); + setupKeyset(new SonyAudio1a(counter++)); + setupKeyset(new SonyDAT1(counter++)); + setupKeyset(new SonyDVD1(counter++)); + setupKeyset(new SonyDVD1a(counter++)); + setupKeyset(new SonyDVD1b(counter++)); + setupKeyset(new SonyDVD1c(counter++)); + setupKeyset(new SonyVCR1(counter++)); + setupKeyset(new SonyVCR1a(counter++)); + setupKeyset(new SonyVCR1b(counter++)); + setupKeyset(new SonyReceiver1(counter++)); + + setupKeyset(new Tivo1(counter++)); + setupKeyset(new Tivo1a(counter++)); + setupKeyset(new Tivo1b(counter++)); + setupKeyset(new Tivo1c(counter++)); + setupKeyset(new Tivo1d(counter++)); + + setupKeyset(new TopfieldPVR1(counter++)); + setupKeyset(new TopfieldSat1(counter++)); + + setupKeyset(new ToshibaTV1(counter++)); + setupKeyset(new ToshibaTV1a(counter++)); + setupKeyset(new ToshibaTV1b(counter++)); + setupKeyset(new ToshibaTV1c(counter++)); + setupKeyset(new ToshibaTV1d(counter++)); + setupKeyset(new ToshibaTV1e(counter++)); + setupKeyset(new ToshibaTV1f(counter++)); + setupKeyset(new ToshibaTV1g(counter++)); + setupKeyset(new ToshibaTV1h(counter++)); + setupKeyset(new ToshibaVCR1(counter++)); + setupKeyset(new ToshibaVCR1a(counter++)); + setupKeyset(new ToshibaDisc1(counter++)); + setupKeyset(new ToshibaDisc1a(counter++)); + setupKeyset(new ToshibaDisc1b(counter++)); + setupKeyset(new ToshibaDisc1c(counter++)); + setupKeyset(new ToshibaDisc1d(counter++)); + + setupKeyset(new VestelTV1(counter++)); + setupKeyset(new VestelTV2(counter++)); + + setupKeyset(new VirginSTB1(counter++)); + + setupKeyset(new VizioTV1(counter++)); + + setupKeyset(new WDMediaPlayer1(counter++)); + setupKeyset(new WDMediaPlayer1a(counter++)); + + setupKeyset(new WestinghouseTV1(counter++)); + setupKeyset(new WestinghouseTV2(counter++)); + + setupKeyset(new YamahaDVD1(counter++)); + setupKeyset(new YamahaDVD1a(counter++)); + setupKeyset(new YamahaAudio1(counter++)); + setupKeyset(new YamahaAudio1a(counter++)); + setupKeyset(new YamahaAudio2(counter++)); + setupKeyset(new YamahaAudio2a(counter++)); + setupKeyset(new YamahaAudio2b(counter++)); + setupKeyset(new YamahaAudio2c(counter++)); + setupKeyset(new YamahaAudio2d(counter++)); + setupKeyset(new YamahaAudio3(counter++)); + setupKeyset(new YamahaAudio4(counter++)); + setupKeyset(new YamahaTV1(counter++)); + setupKeyset(new YamahaKaraoke1(counter++)); + + setupKeyset(new ZenithC32V37(counter++)); // Start the thread running: commandThread.start(); @@ -219,7 +521,10 @@ PIRKeysetManager::PIRKeysetManager( PIRKeysetManager::~PIRKeysetManager() { // Tell the keysets to stop doing any work: - stopRepeating(); + { + QMutexLocker locker(&stopRepeatingMutex); + stopRepeatingFlag = true; + } // Tell the thread that we want it to stop: commandThread.exit(); @@ -237,62 +542,132 @@ PIRKeysetManager::~PIRKeysetManager() } -void PIRKeysetManager::stopRepeating() +bool PIRKeysetManager::keysetExists( + unsigned int keysetID) const { - QMutexLocker locker(&stopRepeatingMutex); - stopRepeatingFlag = true; + PIRKeysetCollection::const_iterator i = keysetsInfo.find(keysetID); + + return (i != keysetsInfo.end()); +} + + +bool PIRKeysetManager::findKeysetID( + QString make, + QString name, + unsigned int &id) const +{ + // Only modify the id if we actually find a match! + + PIRKeysetMakeIndex::const_iterator i = makeIndex.find(make); + if (i == makeIndex.end()) + { + return false; + } + + PIRKeysetNameIndex::const_iterator ii = (*i).second.find(name); + if (ii == (*i).second.end()) + { + return false; + } + + // Ok, we've found it, pull out the id: + id = (*ii).second; + return true; +} + + +PIRKeysetWidgetItem *PIRKeysetManager::makeKeysetItem( + QString make, + QString name) const +{ + unsigned int id; + + if (!findKeysetID(make, name, id)) + { + return NULL; + } + + QString fullname = make; + fullname.append(" "); + fullname.append(name); + + return new PIRKeysetWidgetItem(fullname, id, getMake(id)); } bool PIRKeysetManager::hasKey( - int keysetID, - PIRKeyName name) + unsigned int keysetID, + PIRKeyName name) const { - PIRKeysetMetaData *meta = keysetsInfo[keysetID]; + PIRKeysetCollection::const_iterator i = keysetsInfo.find(keysetID); - if (!meta) return false; + if ((i == keysetsInfo.end()) || !i->second) return false; - return meta->hasKey(name); + return i->second->hasKey(name); } PIRMakeName PIRKeysetManager::getMake( - int keysetID) + unsigned int keysetID) const { - PIRKeysetMetaData *meta = keysetsInfo[keysetID]; + PIRKeysetCollection::const_iterator i = keysetsInfo.find(keysetID); - if (!meta) return Any_Make; // Work on this! + if ((i == keysetsInfo.end()) || !i->second) return Any_Make; - return meta->getMake(); + return i->second->getMake(); } QString PIRKeysetManager::getDisplayName( - int keysetID) + unsigned int keysetID) const { - PIRKeysetMetaData *meta = keysetsInfo[keysetID]; + PIRKeysetCollection::const_iterator i = keysetsInfo.find(keysetID); - if (!meta) return QString("Database Error"); + if ((i == keysetsInfo.end()) || !i->second) + return QString("Database Error"); - return QString(meta->getKeysetName()); + return QString(i->second->getKeysetName()); } void PIRKeysetManager::populateKeyset( + QObject *guiObject, + unsigned int keysetID) +{ + PIRKeysetCollection::iterator i = keysetsInfo.find(keysetID); + + if (i == keysetsInfo.end()) + { + // Should have some sort of error message here! + return; + } + + i->second->populateProtocol(guiObject); + i->second->moveToThread(&commandThread); +} + + +void PIRKeysetManager::setupKeyset( PIRKeysetMetaData *keyset) { + // Set up the keyset collection: keysetsInfo[keyset->getID()] = keyset; - keyset->moveProtocolToThread(commandThread); + // Set up a name-based index into the collection: + makeIndex + [QString(makeManager.getMakeString(keyset->getMake()))] + [QString(keyset->getKeysetName())] + = keyset->getID(); } void PIRKeysetManager::populateGuiWidget( - PIRSelectKeysetForm *skf) + PIRSelectKeysetForm *skf) const { - PIRKeysetCollection::const_iterator i = keysetsInfo.begin(); - PIRMakeName make; + PIRKeysetWidgetItem *kwi; + + PIRKeysetCollection::const_iterator i = keysetsInfo.begin(); while (i != keysetsInfo.end()) { @@ -300,7 +675,9 @@ void PIRKeysetManager::populateGuiWidget( QString tempString = makeManager.getMakeString(make); tempString.append(" "); tempString.append(i->second->getKeysetName()); - skf->addNameToList(tempString, i->first, make); + kwi = new PIRKeysetWidgetItem(tempString, i->first, make); + i->second->populateDeviceTypes(kwi); + skf->addWidgetItem(kwi); ++i; } } @@ -308,8 +685,11 @@ void PIRKeysetManager::populateGuiWidget( void PIRKeysetManager::populateDeviceTypes( PIRKeysetWidgetItem *kwi, - int keysetID) + unsigned int keysetID) const { - // Pass the buck: (Need to check for bad keysetID here?) - keysetsInfo[keysetID]->populateDeviceTypes(kwi); + PIRKeysetCollection::const_iterator i = keysetsInfo.find(keysetID); + if ((i != keysetsInfo.end()) && i->second) + { + i->second->populateDeviceTypes(kwi); + } }