{
ui->setupUi(this);
- connect(ui->loadDefault, SIGNAL(toggled()), this, SLOT(buttonPressed("loadDefault")));
- connect(ui->loadIdeal, SIGNAL(toggled()), this, SLOT(buttonPressed("loadIdeal")));
- connect(ui->loadLV, SIGNAL(toggled()), this, SLOT(buttonPressed("loadLV")));
- connect(ui->loadULV, SIGNAL(toggled()), this, SLOT(buttonPressed("loadULV")));
- connect(ui->loadXLV, SIGNAL(toggled()), this, SLOT(buttonPressed("loadXLV")));
- connect(ui->loadCustom, SIGNAL(toggled()), this, SLOT(buttonPressed("loadCustom")));
+ connect(ui->loadDefault, SIGNAL(clicked()), this, SLOT(buttonLoadDefaultPressed()));
+ connect(ui->loadIdeal, SIGNAL(clicked()), this, SLOT(buttonLoadIdealPressed()));
+ connect(ui->loadLV, SIGNAL(clicked()), this, SLOT(buttonLoadLvPressed()));
+ connect(ui->loadULV, SIGNAL(clicked()), this, SLOT(buttonLoadUlvPressed()));
+ connect(ui->loadXLV, SIGNAL(clicked()), this, SLOT(buttonLoadXlvPressed()));
+ connect(ui->loadCustom, SIGNAL(clicked()), this, SLOT(buttonLoadCustomPressed()));
}
/**
- * This slot is called when a button was pressed. It takes care of emmiting
- * the "load" signal. The load signal will contain the actual name of the
- * preset which needs to be loaded.
+ * This slot is called when the loadCustom button was pressed.
+ * It emits the "load" signal and hides the dialog.
*
- * @emits: load(QString)
+ * @emits: load("custom")
*/
-void LoadPreset::buttonPressed(QString buttonName)
+void LoadPreset::buttonLoadCustomPressed()
{
- if (buttonName == "loadDefault") {
- emit load("default");
- } else if (buttonName == "loadIdeal") {
- emit load("ideal");
- } else if (buttonName == "loadLV") {
- emit load("lv");
- } else if (buttonName == "loadULV") {
- emit load("ulv");
- } else if (buttonName == "loadXLV")
- emit load("xlv");
- } else if (buttonName == "loadCustom") {
- emit load("custom");
- }
+ emit load("custom");
+ hide();
+}
+
+
+/**
+ * This slot is called when the loadDefault button was pressed.
+ * It emits the "load" signal and hides the dialog.
+ *
+ * @emits: load("default")
+ */
+void LoadPreset::buttonLoadDefaultPressed()
+{
+ emit load("default");
+ hide();
+}
+
+
+/**
+ * This slot is called when the loadIdeal button was pressed.
+ * It emits the "load" signal and hides the dialog.
+ *
+ * @emits: load("ideal")
+ */
+void LoadPreset::buttonLoadIdealPressed()
+{
+ emit load("ideal");
+ hide();
+}
+
+
+/**
+ * This slot is called when the loadLV button was pressed.
+ * It emits the "load" signal and hides the dialog.
+ *
+ * @emits: load("lv")
+ */
+void LoadPreset::buttonLoadLvPressed()
+{
+ emit load("lv");
+ hide();
+}
+
+
+/**
+ * This slot is called when the loadULV button was pressed.
+ * It emits the "load" signal and hides the dialog.
+ *
+ * @emits: load("ulv")
+ */
+void LoadPreset::buttonLoadUlvPressed()
+{
+ emit load("ulv");
+ hide();
+}
+
+
+/**
+ * This slot is called when the loadXLV button was pressed.
+ * It emits the "load" signal and hides the dialog.
+ *
+ * @emits: load("xlv")
+ */
+void LoadPreset::buttonLoadXlvPressed()
+{
+ emit load("xlv");
+ hide();
}
settings = new Settings;
settings->hide();
+ //load preset dialog
+ loadPresetDialog = new LoadPreset;
+ loadPresetDialog->hide();
+
init();
//applies the settings from the settings dialog
connect(ui->sr_box, SIGNAL(clicked()), this, SLOT(setSmartReflex()));
connect(&refreshTimer, SIGNAL(timeout()), this, SLOT(refresh()));
connect(ui->actionSave, SIGNAL(triggered()), this, SLOT(save()));
- connect(ui->actionLoad, SIGNAL(triggered()), this, SLOT(loadPreset()));
+ connect(ui->actionLoad, SIGNAL(triggered()), loadPresetDialog, SLOT(show()));
connect(ui->actionSettings, SIGNAL(triggered()), this, SLOT(showSettings()));
connect(settings, SIGNAL(settingsChanged()), this, SLOT(applySettings()));
+ connect(loadPresetDialog, SIGNAL(load(QString)), this, SLOT(loadPreset(QString)));
}
MainWindow::~MainWindow()
{
+ delete loadPresetDialog;
delete settings;
delete ui;
}
* - starving
* - custom -> any preset named "custom"
*/
-void MainWindow::loadPreset()
+void MainWindow::loadPreset(QString presetName)
{
- return;
+ callHelper("loadpreset", presetName);
+ #if defined(Q_WS_MAEMO_5)
+ QMaemo5InformationBox::information(this, tr( "The preset was loaded." ), QMaemo5InformationBox::DefaultTimeout);
+ #endif
}
{
#if defined(Q_WS_MAEMO_5)
setAttribute(Qt::WA_Maemo5AutoOrientation, settings->useAutoRotate());
+ loadPresetDialog->setAttribute(Qt::WA_Maemo5AutoOrientation, settings->useAutoRotate());
settings->setAttribute(Qt::WA_Maemo5AutoOrientation, settings->useAutoRotate());
#endif
}