//#include <iostream>
+//#define DEBUGGING
+
extern PIRMakeMgr makeManager;
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent),
ui(new Ui::MainWindow),
- mySelectionWindow(0),
+ selectKeysetForm(0),
documentationForm(0),
aboutForm(0),
currentKeyset(0)
myKeysets = new PIRKeysetManager(this);
// Set up the keyset selection window:
- mySelectionWindow = new SelectionWindow(this);
+ selectKeysetForm = new PIRSelectKeysetForm(this);
- myKeysets->populateGuiWidget(mySelectionWindow);
+ myKeysets->populateGuiWidget(selectKeysetForm);
// Remember any favorites the user has already set:
populateFavorites();
this,
SLOT(keysetSelectionChanged(QListWidgetItem *)),
Qt::QueuedConnection);
+
+ // Make sure the two selection lists don't show different selections:
+ QListWidget *klw = selectKeysetForm->getKeysetListWidget();
+ connect(
+ ui->favoriteKeysetsWidget,
+ SIGNAL(itemActivated(QListWidgetItem *)),
+ klw,
+ SLOT(clearSelection()),
+ Qt::QueuedConnection);
+
+ connect(
+ klw,
+ SIGNAL(itemActivated(QListWidgetItem *)),
+ ui->favoriteKeysetsWidget,
+ SLOT(clearSelection()),
+ Qt::QueuedConnection);
+
+#ifndef DEBUGGING
+ // The PIRModprobe object should take care of setting up and shutting down
+ // the lirc_rx51 kernel module, if necessary:
+
+ if (modprobeObj.loadRX51Module() != 0)
+ {
+ // Couldn't load module, quit:
+ QMessageBox errBox;
+ errBox.setText("Couldn't load lirc_rx51 kernel module!");
+ errBox.setIcon(QMessageBox::Warning);
+ errBox.exec();
+// throw; // Need a clean way to exit here!!!
+ }
+#endif
}
MainWindow::~MainWindow()
{
delete myKeysets;
- delete mySelectionWindow;
+ if (selectKeysetForm) delete selectKeysetForm;
if (documentationForm) delete documentationForm;
if (aboutForm) delete aboutForm;
delete ui;
void MainWindow::on_actionSelectKeyset_triggered()
{
- mySelectionWindow->show();
+ selectKeysetForm->show();
}
void MainWindow::on_actionAbout_triggered()
PIRMakeName make;
QString name;
unsigned int id;
+// PIRKeysetWidgetItem *kwi;
while (index < size)
{
name = makeManager.getMakeString(make);
name.append(" ");
name.append(myKeysets->getDisplayName(id));
- ui->favoriteKeysetsWidget->addItem(
- new PIRKeysetWidgetItem(name, id, make));
+// kwi = new PIRKeysetWidgetItem(name, id, make);
+// myKeysets->populateDeviceTypes(kwi, id);
+ ui->favoriteKeysetsWidget->addItem(new PIRKeysetWidgetItem(name, id, make));
++index;
}