#include "pirpanelmanager.h"
//#define DEBUGGING
+//#include <iostream>
// Some ugly globals used for thread communications:
preferencesForm(0),
documentationForm(0),
aboutForm(0),
- currentKeyset(0)
+ currentKeyset(1) // Zero is not a valid keyset any more
{
ui->setupUi(this);
myKeysets = new PIRKeysetManager();
myPanels = new PIRPanelManager(this);
- // Set up the keyset selection window:
+ // Construct the forms:
+ panelSelectionForm = new PIRPanelSelectionForm(this);
+ myPanels->setupPanels(panelSelectionForm);
+
selectKeysetForm = new PIRSelectKeysetForm(this);
myKeysets->populateSelectionWidget(selectKeysetForm);
- // Set up the device selection window:
selectDeviceForm = new PIRSelectDeviceForm(this);
PIRKeysetMetaData::populateDevices(selectDeviceForm);
- // Set up the panel selection window:
- panelSelectionForm = new PIRPanelSelectionForm(this);
- myPanels->setupPanels(panelSelectionForm);
-
- // Set up the preferences window:
- preferencesForm = new PIRPreferencesForm(this);
+ preferencesForm = new PIRPreferencesForm(this, myKeysets);
// Remember any favorites the user has already set:
populateFavorites();
// Just to be sure, check to see if the keyset has been populated:
myKeysets->populateKeyset(this, currentKeyset);
- myPanels->enableButtons(myKeysets, currentKeyset);
+ if (preferencesForm)
+ {
+ unsigned int dk = preferencesForm->getDefaultKeyset();
+ if (preferencesForm->defaultControlsVolume() && dk)
+ {
+ myKeysets->populateKeyset(this, dk);
+ myPanels->enableButtons(myKeysets, currentKeyset, dk);
+ }
+ else
+ {
+ myPanels->enableButtons(myKeysets, currentKeyset);
+ }
+ }
+ else
+ {
+ myPanels->enableButtons(myKeysets, currentKeyset);
+ }
}
}
+QString MainWindow::getCurrentMake()
+{
+ return makeManager.getMakeString(myKeysets->getMake(currentKeyset));
+}
+
+
+QString MainWindow::getCurrentName()
+{
+ return myKeysets->getDisplayName(currentKeyset);
+}
+
+
void MainWindow::receivedExternalWarning(
const char *warning)
{
}
+void MainWindow::startRepeating(
+ PIRKeyName name,
+ unsigned int keysetID)
+{
+ QMutexLocker locker(&commandIFMutex);
+ if (!commandInFlight)
+ {
+ commandInFlight = true;
+ emit buttonPressed(keysetID, name);
+ }
+}
+
+
void MainWindow::stopRepeating()
{
QMutexLocker locker(&stopRepeatingMutex);