#include <QMutex>
#include <QtGui/QMessageBox>
#include <QSettings>
+#include <QMaemo5InformationBox>
#include "pirkeysetwidgetitem.h"
#include "pirselectkeysetform.h"
bool stopRepeatingFlag = false;
QMutex stopRepeatingMutex;
+
extern PIRMakeMgr makeManager;
setAttribute(Qt::WA_Maemo5StackedWindow);
// Collect the keysets:
- myKeysets = new PIRKeysetManager(this);
+ myKeysets = new PIRKeysetManager();
// Set up the keyset selection window:
selectKeysetForm = new PIRSelectKeysetForm(this);
}
enableButtons();
- secondaryForm->enableButtons(myKeysets, currentKeyset);
connect(
ui->favoriteKeysetsWidget,
-// SIGNAL(itemActivated(QListWidgetItem *)),
- SIGNAL(currentItemChanged(QListWidgetItem *, QListWidgetItem *)),
+ SIGNAL(itemActivated(QListWidgetItem *)),
this,
SLOT(keysetSelectionChanged(QListWidgetItem *)),
Qt::QueuedConnection);
void MainWindow::enableButtons()
{
+ // Just to be sure, check to see if the keyset has been populated:
+ myKeysets->populateKeyset(this, currentKeyset);
+
// This is going to be a little painful...
// Main keys
emit powerEnabled(myKeysets->hasKey(currentKeyset, Power_Key));
emit volumeDownEnabled(myKeysets->hasKey(currentKeyset, VolumeDown_Key));
emit channelUpEnabled(myKeysets->hasKey(currentKeyset, ChannelUp_Key));
emit channelDownEnabled(myKeysets->hasKey(currentKeyset, ChannelDown_Key));
+ emit muteEnabled(myKeysets->hasKey(currentKeyset, Mute_Key));
// Main tab labels:
emit keysetMakeChanged(
emit greenEnabled(myKeysets->hasKey(currentKeyset, Green_Key));
emit yellowEnabled(myKeysets->hasKey(currentKeyset, Yellow_Key));
emit blueEnabled(myKeysets->hasKey(currentKeyset, Blue_Key));
+ emit pictureModeEnabled(myKeysets->hasKey(currentKeyset, PictureMode_Key));
+ emit soundModeEnabled(myKeysets->hasKey(currentKeyset, SoundMode_Key));
emit aspectRatioEnabled(myKeysets->hasKey(currentKeyset, AspectRatio_Key));
- emit surroundEnabled(myKeysets->hasKey(currentKeyset, Surround_Key));
+// emit surroundEnabled(myKeysets->hasKey(currentKeyset, Surround_Key));
emit audioEnabled(myKeysets->hasKey(currentKeyset, Audio_Key));
emit infoEnabled(myKeysets->hasKey(currentKeyset, Info_Key));
emit captionsEnabled(myKeysets->hasKey(currentKeyset, Captions_Key));
emit sleepEnabled(myKeysets->hasKey(currentKeyset, Sleep_Key));
emit inputEnabled(myKeysets->hasKey(currentKeyset, Input_Key));
- emit muteEnabled(myKeysets->hasKey(currentKeyset, Mute_Key));
// Keypad keys
emit zeroEnabled(myKeysets->hasKey(currentKeyset, Zero_Key));
emit pauseEnabled(myKeysets->hasKey(currentKeyset, Pause_Key));
emit stopEnabled(myKeysets->hasKey(currentKeyset, Stop_Key));
emit ejectEnabled(myKeysets->hasKey(currentKeyset, Eject_Key));
+
+ // Also enable the buttons on the secondary form:
+ secondaryForm->enableButtons(myKeysets, currentKeyset);
}
stopRepeating();
}
+void MainWindow::on_muteButton_pressed()
+{
+ startRepeating(Mute_Key);
+}
+
+void MainWindow::on_muteButton_released()
+{
+ stopRepeating();
+}
+
// Utility tab buttons:
stopRepeating();
}
+void MainWindow::on_pictureModeButton_pressed()
+{
+ startRepeating(PictureMode_Key);
+}
+
+void MainWindow::on_pictureModeButton_released()
+{
+ stopRepeating();
+}
+
+void MainWindow::on_soundModeButton_pressed()
+{
+ startRepeating(SoundMode_Key);
+}
+
+void MainWindow::on_soundModeButton_released()
+{
+ stopRepeating();
+}
+
void MainWindow::on_aspectRatioButton_pressed()
{
startRepeating(AspectRatio_Key);
stopRepeating();
}
+/*
void MainWindow::on_surroundButton_pressed()
{
startRepeating(Surround_Key);
{
stopRepeating();
}
+*/
void MainWindow::on_audioButton_pressed()
{
stopRepeating();
}
-void MainWindow::on_muteButton_pressed()
-{
- startRepeating(Mute_Key);
-}
-
-void MainWindow::on_muteButton_released()
-{
- stopRepeating();
-}
-
// Keypad tab buttons:
void MainWindow::keysetSelectionChanged(
QListWidgetItem *item)
{
- if (!item) return; // Should probably say something here!
+ if (!item) return; // Should probably display error message here!
PIRKeysetWidgetItem *kwi = dynamic_cast<PIRKeysetWidgetItem *>(item);
if (!kwi) return; // Also need to say something here
+
+ if (currentKeyset == kwi->getID())
+ {
+ // We're already on that keyset, so nothing to do:
+ return;
+ }
currentKeyset = kwi->getID();
myKeysets->getDisplayName(currentKeyset));
enableButtons();
- secondaryForm->enableButtons(myKeysets, currentKeyset);
}
stopRepeatingFlag = true;
}
+
+QWidget *MainWindow::getSecondaryWindow()
+{
+ return secondaryForm;
+}
+
+
+void MainWindow::selectPrevFavKeyset()
+{
+ int size = ui->favoriteKeysetsWidget->count();
+
+ if (size == 0)
+ {
+ // No favorites, so nothing to do!
+ return;
+ }
+
+ int position = ui->favoriteKeysetsWidget->currentRow();
+
+ --position;
+ if (position < 0)
+ {
+ position = size - 1;
+ }
+
+ ui->favoriteKeysetsWidget->setCurrentRow(
+ position,
+ QItemSelectionModel::ClearAndSelect);
+
+ keysetSelectionChanged(ui->favoriteKeysetsWidget->currentItem());
+
+ // Tell the user about the change:
+ QMaemo5InformationBox::information(
+ 0,
+ ui->favoriteKeysetsWidget->item(position)->text());
+}
+
+
+void MainWindow::selectNextFavKeyset()
+{
+ int size = ui->favoriteKeysetsWidget->count();
+
+ if (size == 0)
+ {
+ // No favorites, so just return:
+ return;
+ }
+
+ int position = ui->favoriteKeysetsWidget->currentRow();
+
+ ++position;
+ if (position == size)
+ {
+ position = 0;
+ }
+
+ ui->favoriteKeysetsWidget->setCurrentRow(
+ position,
+ QItemSelectionModel::ClearAndSelect);
+
+ keysetSelectionChanged(ui->favoriteKeysetsWidget->currentItem());
+
+ // Tell the user about the change:
+ QMaemo5InformationBox::information(
+ 0,
+ ui->favoriteKeysetsWidget->item(position)->text());
+}