#include "pirkeysetmetadata.h"
+#include "pirselectdeviceform.h"
+#include "pirkeysetwidgetitem.h"
+#include "protocols/pirprotocol.h"
#include <iostream>
+// Global helper objects:
+extern PIRMakeMgr makeManager;
+//extern PIRDeviceTypeMgr deviceManager;
+
PIRKeysetMetaData::PIRKeysetMetaData(
const char *r,
PIRMakeName m,
unsigned int i)
- : keysetName(r),
- make(m),
- id(i)
+ : threadableProtocol(NULL),
+ index(i),
+ keysetName(r),
+ make(m)
{
}
}
-void PIRKeysetMetaData::moveProtocolToThread(
- QThread &thread)
+void PIRKeysetMetaData::moveToThread(
+ QThread *thread)
{
- threadableProtocol->moveToThread(&thread);
+ if (threadableProtocol)
+ {
+ // Do I need some error checking here?
+ threadableProtocol->moveToThread(thread);
+ }
}
-void PIRKeysetMetaData::populateDeviceTypes(
- PIRKeysetWidgetItem *kwi) const
+void PIRKeysetMetaData::populateDevices(
+ unsigned int id,
+ PIRSelectDeviceForm *sdf) const
{
- PIRDeviceTypeCollection::const_iterator i = deviceTypes.begin();
- while (i != deviceTypes.end())
+ PIRKeysetWidgetItem *kwi;
+
+ PIRDeviceCollection::const_iterator i = controlledDevices.begin();
+
+ while (i != controlledDevices.end())
{
- kwi->addDeviceType(*i);
+ // Create a widget for the keyset:
+ QString tempString = makeManager.getMakeString(i->make);
+ tempString.append(" ");
+ tempString.append(i->model);
+ kwi = new PIRKeysetWidgetItem(tempString, id, i->make, i->type);
+ sdf->addWidgetItem(kwi);
+
++i;
}
}
unsigned int PIRKeysetMetaData::getID() const
{
- return id;
+ return index;
}
if (key != Unmapped_Key)
{
keys[key] = name;
-
threadableProtocol->addSIRCKey(key, addressData, 5, commandData);
}
}
}
+/*
+void PIRKeysetMetaData::addRCAKey(
+ const char *name,
+ PIRKeyName key,
+ unsigned int addressData,
+ unsigned int commandData)
+{
+ if (key != Unmapped_Key)
+ {
+ keys[key] = name;
+ threadableProtocol->addPioneerKey(
+ key, addressData, commandData);
+ }
+}
+*/
+
+
+void PIRKeysetMetaData::addKaseikyoKey(
+ const char *name,
+ PIRKeyName key,
+ unsigned int addressData,
+ unsigned int commandData)
+{
+ if (key != Unmapped_Key)
+ {
+ keys[key] = name;
+ threadableProtocol->addKaseikyoKey(key, addressData, commandData);
+ }
+}
+
+
+void PIRKeysetMetaData::addDishKey(
+ const char *name,
+ PIRKeyName key,
+ unsigned int firstCommand,
+ unsigned int secondCommand)
+{
+ if (key != Unmapped_Key)
+ {
+ keys[key] = name;
+ threadableProtocol->addDishKey(key, firstCommand, secondCommand);
+ }
+}
+
+
void PIRKeysetMetaData::setPreData(
unsigned long data,
unsigned int bits)