From 1f7be79a923c2efff205063711899df0684ed0fa Mon Sep 17 00:00:00 2001 From: Kjell Kernen Date: Wed, 5 Feb 2014 17:48:01 +0100 Subject: [PATCH] Revert "Two new dialogs defined." This reverts commit d9f97016e2c65306a8f5baad267e43edc38871eb. --- companion/src/CMakeLists.txt | 6 - companion/src/apppreferencesdialog.cpp | 85 -- companion/src/apppreferencesdialog.h | 30 - companion/src/apppreferencesdialog.ui | 250 ------ companion/src/fwpreferencesdialog.cpp | 518 ----------- companion/src/fwpreferencesdialog.h | 50 -- companion/src/fwpreferencesdialog.ui | 1092 ----------------------- companion/src/mainwindow.cpp | 39 - companion/src/mainwindow.h | 5 - companion/src/preferences_simulation.ui | 481 ---------- 10 files changed, 2556 deletions(-) delete mode 100644 companion/src/apppreferencesdialog.cpp delete mode 100644 companion/src/apppreferencesdialog.h delete mode 100644 companion/src/apppreferencesdialog.ui delete mode 100644 companion/src/fwpreferencesdialog.cpp delete mode 100644 companion/src/fwpreferencesdialog.h delete mode 100644 companion/src/fwpreferencesdialog.ui delete mode 100644 companion/src/preferences_simulation.ui diff --git a/companion/src/CMakeLists.txt b/companion/src/CMakeLists.txt index 3a8dd26b7..0f7ca9cd5 100644 --- a/companion/src/CMakeLists.txt +++ b/companion/src/CMakeLists.txt @@ -156,8 +156,6 @@ SET( companion_SRCS mountlist.cpp avroutputdialog.cpp preferencesdialog.cpp - apppreferencesdialog.cpp - fwpreferencesdialog.cpp burnconfigdialog.cpp comparedialog.cpp contributorsdialog.cpp @@ -179,8 +177,6 @@ SET( companion_SRCS SET( companion_MOC_HDRS avroutputdialog.h preferencesdialog.h - apppreferencesdialog.h - fwpreferencesdialog.h burnconfigdialog.h comparedialog.h printdialog.h @@ -215,8 +211,6 @@ SET( companion_UIS fusesdialog.ui logsdialog.ui preferencesdialog.ui - apppreferencesdialog.ui - fwpreferencesdialog.ui simulatordialog.ui xsimulatordialog.ui burnconfigdialog.ui diff --git a/companion/src/apppreferencesdialog.cpp b/companion/src/apppreferencesdialog.cpp deleted file mode 100644 index fcb6157bb..000000000 --- a/companion/src/apppreferencesdialog.cpp +++ /dev/null @@ -1,85 +0,0 @@ -#include "apppreferencesdialog.h" -#include "ui_apppreferencesdialog.h" -#include "mainwindow.h" -#include "helpers.h" -#include -#include - -appPreferencesDialog::appPreferencesDialog(QWidget *parent) : - QDialog(parent), - ui(new Ui::appPreferencesDialog) -{ - ui->setupUi(this); - setWindowIcon(CompanionIcon("preferences.png")); - initSettings(); - connect(this, SIGNAL(accepted()), this, SLOT(writeValues())); -// resize(0,0); -} - -appPreferencesDialog::~appPreferencesDialog() -{ - delete ui; -} - -void appPreferencesDialog::writeValues() -{ - QSettings settings; - settings.setValue("startup_check_companion", ui->startupCheck_companion9x->isChecked()); - settings.setValue("startup_check_fw", ui->startupCheck_fw->isChecked()); - settings.setValue("wizardEnable", ui->wizardEnable_ChkB->isChecked()); - settings.setValue("show_splash", ui->showSplash->isChecked()); - settings.setValue("history_size", ui->historySize->value()); - settings.setValue("gePath", ui->ge_lineedit->text()); - settings.setValue("backupEnable", ui->backupEnable->isChecked()); - MainWindow * mw = (MainWindow *)this->parent(); - mw->unloadProfile(); -} - -void appPreferencesDialog::initSettings() -{ - QSettings settings; - ui->startupCheck_companion9x->setChecked(settings.value("startup_check_companion", true).toBool()); - ui->startupCheck_fw->setChecked(settings.value("startup_check_fw", true).toBool()); - ui->wizardEnable_ChkB->setChecked(settings.value("wizardEnable", true).toBool()); - ui->showSplash->setChecked(settings.value("show_splash", true).toBool()); - ui->historySize->setValue(settings.value("history_size", 10).toInt()); - - QString Path=settings.value("gePath", "").toString(); - if (QFile(Path).exists()) { - ui->ge_lineedit->setText(Path); - } - Path=settings.value("backupPath", "").toString(); - if (!Path.isEmpty()) { - if (QDir(Path).exists()) { - ui->backupPath->setText(Path); - ui->backupEnable->setEnabled(true); - ui->backupEnable->setChecked(settings.value("backupEnable", true).toBool()); - } else { - ui->backupEnable->setDisabled(true); - } - } else { - ui->backupEnable->setDisabled(true); - } -} - -void appPreferencesDialog::on_backupPathButton_clicked() -{ - QSettings settings; - QString fileName = QFileDialog::getExistingDirectory(this,tr("Select your Models and Settings backup folder"), settings.value("backupPath").toString()); - if (!fileName.isEmpty()) { - settings.setValue("backupPath", fileName); - ui->backupPath->setText(fileName); - } - ui->backupEnable->setEnabled(true); -} - -void appPreferencesDialog::on_ge_pathButton_clicked() -{ - QSettings settings; - QString fileName = QFileDialog::getOpenFileName(this, tr("Select Google Earth executable"),ui->ge_lineedit->text()); - if (!fileName.isEmpty()) { - ui->ge_lineedit->setText(fileName); - } -} - - diff --git a/companion/src/apppreferencesdialog.h b/companion/src/apppreferencesdialog.h deleted file mode 100644 index 01b28f08a..000000000 --- a/companion/src/apppreferencesdialog.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef APPPREFERENCESDIALOG_H -#define APPPREFERENCESDIALOG_H - -#include -#include -#include "eeprominterface.h" - -namespace Ui { - class appPreferencesDialog; -} - -class appPreferencesDialog : public QDialog -{ - Q_OBJECT - -public: - explicit appPreferencesDialog(QWidget *parent = 0); - ~appPreferencesDialog(); - -private: - Ui::appPreferencesDialog *ui; - void initSettings(); - -private slots: - void writeValues(); - void on_backupPathButton_clicked(); - void on_ge_pathButton_clicked(); -}; - -#endif // APPPREFERENCESDIALOG_H diff --git a/companion/src/apppreferencesdialog.ui b/companion/src/apppreferencesdialog.ui deleted file mode 100644 index c896b3c2e..000000000 --- a/companion/src/apppreferencesdialog.ui +++ /dev/null @@ -1,250 +0,0 @@ - - - appPreferencesDialog - - - - 0 - 0 - 685 - 313 - - - - - 0 - 0 - - - - - 685 - 0 - - - - Application Preferences - - - - - - - 0 - 0 - - - - Recent Files - - - - - - - - 40 - 0 - - - - 15 - - - 10 - - - - - - - Show splash screen when Companion starts - - - true - - - - - - - Automatic check for Companion updates - - - true - - - - - - - Enable automatic backup before writing firmware - - - - - - - Automatic Backup Folder - - - - - - - Qt::Horizontal - - - - - - - true - - - - - - - Find Executable - - - - - - - Qt::Horizontal - - - - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - Qt::Horizontal - - - - - - - Automatic check for OpenTX firmware updates - - - true - - - - - - - Offer to use wizard for new models - - - true - - - - - - - Google Earth Executable - - - - - - - Qt::Horizontal - - - - - - - (Number of recent Models&Settings files to remember) - - - - - - - Open Folder - - - - - - - true - - - - - historySize - startupCheck_companion9x - backupEnable - label_17 - ge_lineedit - line - buttonBox - backupPath - line_2 - startupCheck_fw - wizardEnable_ChkB - ge_label - label - label_5 - showSplash - line_3 - ge_pathButton - line_4 - backupPathButton - - - - - - - buttonBox - accepted() - appPreferencesDialog - accept() - - - 376 - 596 - - - 157 - 274 - - - - - buttonBox - rejected() - appPreferencesDialog - reject() - - - 396 - 596 - - - 286 - 274 - - - - - diff --git a/companion/src/fwpreferencesdialog.cpp b/companion/src/fwpreferencesdialog.cpp deleted file mode 100644 index 011da2ff7..000000000 --- a/companion/src/fwpreferencesdialog.cpp +++ /dev/null @@ -1,518 +0,0 @@ -#include "fwpreferencesdialog.h" -#include "ui_fwpreferencesdialog.h" -#include "mainwindow.h" -#include "eeprominterface.h" -#include "helpers.h" -#include -#include - -fwPreferencesDialog::fwPreferencesDialog(QWidget *parent) : - QDialog(parent), - ui(new Ui::fwPreferencesDialog), - updateLock(false) -{ - ui->setupUi(this); - setWindowIcon(CompanionIcon("preferences.png")); - - QCheckBox * OptionCheckBox[]= { - ui->optionCheckBox_1, ui->optionCheckBox_2, ui->optionCheckBox_3, ui->optionCheckBox_4, ui->optionCheckBox_5, ui->optionCheckBox_6, ui->optionCheckBox_7, - ui->optionCheckBox_8, ui->optionCheckBox_9, ui->optionCheckBox_10, ui->optionCheckBox_11, ui->optionCheckBox_12, ui->optionCheckBox_13, ui->optionCheckBox_14, - ui->optionCheckBox_15,ui->optionCheckBox_16, ui->optionCheckBox_17, ui->optionCheckBox_18, ui->optionCheckBox_19, ui->optionCheckBox_20, ui->optionCheckBox_21, - ui->optionCheckBox_22, ui->optionCheckBox_23, ui->optionCheckBox_24, ui->optionCheckBox_25, ui->optionCheckBox_26, ui->optionCheckBox_27, ui->optionCheckBox_28, - ui->optionCheckBox_29, ui->optionCheckBox_30, ui->optionCheckBox_31, ui->optionCheckBox_32, ui->optionCheckBox_33, ui->optionCheckBox_34, ui->optionCheckBox_35, - ui->optionCheckBox_36, ui->optionCheckBox_37, ui->optionCheckBox_38, ui->optionCheckBox_39, ui->optionCheckBox_40, ui->optionCheckBox_41, ui->optionCheckBox_42, - NULL }; - - voice=NULL; - - connect(ui->langCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(firmwareLangChanged())); - connect(ui->voiceCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(firmwareLangChanged())); - - for (int i=0; OptionCheckBox[i]; i++) { - optionsCheckBoxes.push_back(OptionCheckBox[i]); - connect(OptionCheckBox[i], SIGNAL(toggled(bool)), this, SLOT(firmwareOptionChanged(bool))); - } - - initSettings(); - - connect(ui->downloadVerCB, SIGNAL(currentIndexChanged(int)), this, SLOT(baseFirmwareChanged())); - connect(this, SIGNAL(accepted()), this, SLOT(writeValues())); - - resize(0,0); -} - - -fwPreferencesDialog::~fwPreferencesDialog() -{ - delete ui; -} - -void fwPreferencesDialog::baseFirmwareChanged() -{ - QVariant selected_firmware = ui->downloadVerCB->itemData(ui->downloadVerCB->currentIndex()); - voice=NULL; - foreach(FirmwareInfo * firmware, firmwares) { - if (firmware->id == selected_firmware) { - if (firmware->voice) { - ui->voiceLabel->show(); - ui->voiceCombo->show(); - ui->voice_dnld->show(); - ui->sdPathButton->show(); - ui->sdPath->show(); - ui->sdPathLabel->show(); - ui->voiceLabel->setEnabled(true); - ui->voiceCombo->setEnabled(true); - ui->voice_dnld->setEnabled(true); - ui->sdPathButton->setEnabled(true); - ui->sdPath->setEnabled(true); - } else { - ui->voiceLabel->hide(); - ui->voiceCombo->hide(); - ui->voice_dnld->hide(); - ui->sdPathButton->hide(); - ui->sdPath->hide(); - ui->sdPathLabel->hide(); - } - populateFirmwareOptions(firmware); - break; - } - } - firmwareChanged(); -} - -FirmwareVariant fwPreferencesDialog::getFirmwareVariant() -{ - QVariant selected_firmware = ui->downloadVerCB->itemData(ui->downloadVerCB->currentIndex()); - bool voice=false; - foreach(FirmwareInfo * firmware, firmwares) { - if (firmware->id == selected_firmware) { - QString id = firmware->id; - foreach(QCheckBox *cb, optionsCheckBoxes) { - if (cb->isChecked()) { - if (cb->text()=="voice" && cb->isChecked()) - voice=true; - id += QString("-") + cb->text(); - } - } - if (! firmware->eepromInterface->getCapability(MultiLangVoice)) { - if (ui->voiceCombo->count() && (voice || firmware->voice)) - id += QString("-tts") + ui->voiceCombo->currentText(); - } - if (ui->langCombo->count()) - id += QString("-") + ui->langCombo->currentText(); - - return GetFirmwareVariant(id); - } - } - - // Should never occur... - return default_firmware_variant; -} - -void fwPreferencesDialog::firmwareLangChanged() -{ - firmwareChanged(); -} - -void fwPreferencesDialog::firmwareOptionChanged(bool state) -{ - QCheckBox *cb = qobject_cast(sender()); - FirmwareInfo * firmware=NULL; - if (cb && state) { - QVariant selected_firmware = ui->downloadVerCB->itemData(ui->downloadVerCB->currentIndex()); - foreach(firmware, firmwares) { - if (firmware->id == selected_firmware) { - foreach(QList