diff --git a/companion/src/CMakeLists.txt b/companion/src/CMakeLists.txt index 1cf4c0105..96b38633f 100644 --- a/companion/src/CMakeLists.txt +++ b/companion/src/CMakeLists.txt @@ -105,6 +105,7 @@ include_directories( ) add_subdirectory(modeledit) +add_subdirectory(generaledit) add_subdirectory(simulation) set(common_SRCS @@ -145,7 +146,6 @@ set(companion_SRCS # ${PROJECT_BINARY_DIR}/radio.cxx helpers.cpp mdichild.cpp - generaledit.cpp modelslist.cpp mountlist.cpp avroutputdialog.cpp @@ -184,7 +184,6 @@ set(companion_MOC_HDRS splashlabel.h burndialog.h downloaddialog.h - generaledit.h modelslist.h mdichild.h mainwindow.h @@ -205,7 +204,6 @@ set(companion_UIS fwpreferencesdialog.ui burnconfigdialog.ui downloaddialog.ui - generaledit.ui printdialog.ui contributorsdialog.ui customizesplashdialog.ui @@ -283,7 +281,7 @@ ELSE( ) ADD_EXECUTABLE( ${PROJECT_NAME} WIN32 ${companion_SRCS} ${companion_QM} ) ENDIF( ) -TARGET_LINK_LIBRARIES( ${PROJECT_NAME} modeledit simulation common ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY} ${XERCESC_LIBRARY} ${PTHREAD_LIBRARY} ${SDL_LIBRARY} ${PHONON_LIBS} ) +TARGET_LINK_LIBRARIES( ${PROJECT_NAME} generaledit modeledit simulation common ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY} ${XERCESC_LIBRARY} ${PTHREAD_LIBRARY} ${SDL_LIBRARY} ${PHONON_LIBS} ) ############# Standalone simu ############### diff --git a/companion/src/generaledit.cpp b/companion/src/generaledit.cpp deleted file mode 100644 index 062532175..000000000 --- a/companion/src/generaledit.cpp +++ /dev/null @@ -1,1175 +0,0 @@ -#include "generaledit.h" -#include "ui_generaledit.h" -#include "helpers.h" -#include "appdata.h" -#include -#include - -#define BIT_WARN_THR ( 0x01 ) -#define BIT_WARN_SW ( 0x02 ) -#define BIT_WARN_MEM ( 0x04 ) -#define BIT_WARN_BEEP ( 0x80 ) -#define BIT_BEEP_VAL ( 0x38 ) // >>3 -#define BEEP_VAL_SHIFT 3 - -GeneralEdit::GeneralEdit(RadioData &radioData, QWidget *parent) : - QDialog(parent), - ui(new Ui::GeneralEdit), - radioData(radioData), - g_eeGeneral(radioData.generalSettings) -{ - ui->setupUi(this); - this->setWindowIcon(CompanionIcon("open.png")); - - QString firmware_id = g.profile[g.id()].fwType(); - ui->tabWidget->setCurrentIndex( g.generalEditTab() ); - QString name=g.profile[g.id()].name(); - if (name.isEmpty()) { - ui->calstore_PB->setDisabled(true); - } - EEPROMInterface *eepromInterface = GetEepromInterface(); - QLabel * pmsl[] = {ui->ro_label,ui->ro1_label,ui->ro2_label,ui->ro3_label,ui->ro4_label,ui->ro5_label,ui->ro6_label,ui->ro7_label,ui->ro8_label, NULL}; - QSlider * tpmsld[] = {ui->chkSA, ui->chkSB, ui->chkSC, ui->chkSD, ui->chkSE, ui->chkSF, ui->chkSG, ui->chkSH, NULL}; - - if (IS_TARANIS(eepromInterface->getBoard())) { - ui->contrastSB->setMinimum(0); - if (firmware_id.contains("readonly")) { - uint16_t switchstate=(g_eeGeneral.switchUnlockStates); - ui->chkSA->setValue(switchstate & 0x3); - switchstate >>= 2; - ui->chkSB->setValue(switchstate & 0x3); - switchstate >>= 2; - ui->chkSC->setValue(switchstate & 0x3); - switchstate >>= 2; - ui->chkSD->setValue(switchstate & 0x3); - switchstate >>= 2; - ui->chkSE->setValue(switchstate & 0x3); - switchstate >>= 2; - ui->chkSF->setValue((switchstate & 0x3)/2); - switchstate >>= 2; - ui->chkSG->setValue(switchstate & 0x3); - switchstate >>= 2; - ui->chkSH->setValue(switchstate & 0x3); - } - else { - for (int i=0; pmsl[i]; i++) { - pmsl[i]->hide(); - } - for (int i=0; tpmsld[i]; i++) { - tpmsld[i]->hide(); - } - this->layout()->removeItem(ui->TaranisReadOnlyUnlock); - } - } - else { - for (int i=0; pmsl[i]; i++) { - pmsl[i]->hide(); - } - for (int i=0; tpmsld[i]; i++) { - tpmsld[i]->hide(); - } - this->layout()->removeItem(ui->TaranisReadOnlyUnlock); - } - ui->profile_CB->clear(); - for ( int i = 0; i < MAX_PROFILES; ++i) { - QString name=g.profile[i].name(); - if (!name.isEmpty()) { - ui->profile_CB->addItem(name, i); - if (i==g.id()) { - ui->profile_CB->setCurrentIndex(ui->profile_CB->count()-1); - } - } - } - - switchDefPosEditLock=true; - populateBacklightCB(ui->backlightswCB, g_eeGeneral.backlightMode); - - if (!GetCurrentFirmware()->getCapability(MultiLangVoice)) { - ui->VoiceLang_label->hide(); - ui->voiceLang_CB->hide(); - } - else { - voiceLangEditLock = true; - populateVoiceLangCB(ui->voiceLang_CB, g_eeGeneral.ttsLanguage); - voiceLangEditLock = false; - } - - if (!GetCurrentFirmware()->getCapability(MavlinkTelemetry)) { - ui->mavbaud_CB->hide(); - ui->mavbaud_label->hide(); - } - else { - mavbaudEditLock = true; - ui->mavbaud_CB->setCurrentIndex(g_eeGeneral.mavbaud); - // TODO why ??? populateVoiceLangCB(ui->voiceLang_CB, g_eeGeneral.ttsLanguage); - mavbaudEditLock = false; - } - - if (!GetCurrentFirmware()->getCapability(HasSoundMixer)) { - ui->beepVolume_SL->hide(); - ui->beepVolume_label->hide(); - ui->varioVolume_SL->hide(); - ui->varioVolume_label->hide(); - ui->bgVolume_SL->hide(); - ui->bgVolume_label->hide(); - ui->wavVolume_SL->hide(); - ui->wavVolume_label->hide(); - ui->varioP0_label->hide(); - ui->varioP0_SB->hide(); - ui->varioPMax_label->hide(); - ui->varioPMax_SB->hide(); - ui->varioR0_label->hide(); - ui->varioR0_SB->hide(); - } - else { - ui->beepVolume_SL->setValue(g_eeGeneral.beepVolume); - ui->varioVolume_SL->setValue(g_eeGeneral.varioVolume); - ui->bgVolume_SL->setValue(g_eeGeneral.backgroundVolume); - ui->wavVolume_SL->setValue(g_eeGeneral.wavVolume); - ui->varioP0_SB->setValue(700+(g_eeGeneral.varioPitch*10)); - updateVarioPitchRange(); - ui->varioPMax_SB->setValue(700+(g_eeGeneral.varioPitch*10)+1000+(g_eeGeneral.varioRange*10)); - ui->varioR0_SB->setValue(500+(g_eeGeneral.varioRepeat*10)); - } - if (!GetCurrentFirmware()->getCapability(HasFAIMode)) { - ui->faimode_CB->hide(); - ui->label_faimode->hide(); - } - else { - ui->faimode_CB->setChecked(g_eeGeneral.fai); - } - if (!GetCurrentFirmware()->getCapability( HasPxxCountry)) { - ui->countrycode_label->hide(); - ui->countrycode_CB->hide(); - } - else { - ui->countrycode_CB->setCurrentIndex(g_eeGeneral.countryCode); - } - if (!GetCurrentFirmware()->getCapability( HasGeneralUnits)) { - ui->units_label->hide(); - ui->units_CB->hide(); - } - else { - ui->units_CB->setCurrentIndex(g_eeGeneral.imperial); - } - - if (!GetCurrentFirmware()->getCapability(TelemetryTimeshift)) { - ui->label_timezone->hide(); - ui->timezoneSB->hide(); - ui->timezoneSB->setDisabled(true); - ui->gpsFormatCB->hide(); - ui->gpsFormatLabel->hide(); - } - ui->gpsFormatCB->setCurrentIndex(g_eeGeneral.gpsFormat); - ui->timezoneSB->setValue(g_eeGeneral.timezone); - - if (!GetCurrentFirmware()->getCapability(OptrexDisplay)) { - ui->label_displayType->hide(); - ui->displayTypeCB->setDisabled(true); - ui->displayTypeCB->hide(); - } - if (!GetCurrentFirmware()->getCapability(HasVolume)) { - ui->volume_SB->hide(); - ui->volume_SB->setDisabled(true); - ui->label_volume->hide(); - } - else { - ui->volume_SB->setMaximum(GetCurrentFirmware()->getCapability(MaxVolume)); - } - if (!GetCurrentFirmware()->getCapability(HasBrightness)) { - ui->BLBright_SB->hide(); - ui->BLBright_SB->setDisabled(true); - ui->label_BLBright->hide(); - } - if (!GetCurrentFirmware()->getCapability(HasCurrentCalibration)) { - ui->CurrentCalib_SB->hide(); - ui->CurrentCalib_SB->setDisabled(true); - ui->label_CurrentCalib->hide(); - } - - ui->tabWidget->setCurrentIndex(0); - - if (!GetCurrentFirmware()->getCapability(SoundMod)) { - ui->soundModeCB->setDisabled(true); - ui->label_soundMode->hide(); - ui->soundModeCB->hide(); - } - - if (!GetCurrentFirmware()->getCapability(SoundPitch)) { - ui->speakerPitchSB->setDisabled(true); - ui->label_speakerPitch->hide(); - ui->speakerPitchSB->hide(); - } - - if (!GetCurrentFirmware()->getCapability(Haptic)) { - ui->hapticStrength->setDisabled(true); - ui->hapticmodeCB->setDisabled(true); - } - - int renumber=GetCurrentFirmware()->getCapability(RotaryEncoders); - if (renumber==0) { - ui->re_label->hide(); - ui->re_CB->hide(); - } - else { - populateRotEncCB(ui->re_CB, g_eeGeneral.reNavigation, renumber); - } - - ui->contrastSB->setValue(g_eeGeneral.contrast); - ui->battwarningDSB->setValue((double)g_eeGeneral.vBatWarn/10); - ui->backlightautoSB->setValue(g_eeGeneral.backlightDelay*5); - ui->inactimerSB->setValue(g_eeGeneral.inactivityTimer); - - ui->memwarnChkB->setChecked(!g_eeGeneral.disableMemoryWarning); //Default is zero=checked - ui->alarmwarnChkB->setChecked(!g_eeGeneral.disableAlarmWarning);//Default is zero=checked - - if (IS_TARANIS(GetEepromInterface()->getBoard())) { - ui->splashScreenChkB->hide(); - ui->splashScreenDuration->setCurrentIndex(3-g_eeGeneral.splashDuration); - } - else { - ui->splashScreenDuration->hide(); - ui->splashScreenChkB->setChecked(!g_eeGeneral.splashMode); - } - - ui->trnMode_1->setCurrentIndex(g_eeGeneral.trainer.mix[0].mode); - ui->trnChn_1->setCurrentIndex(g_eeGeneral.trainer.mix[0].src); - ui->trnWeight_1->setValue(g_eeGeneral.trainer.mix[0].weight); - ui->trnMode_2->setCurrentIndex(g_eeGeneral.trainer.mix[1].mode); - ui->trnChn_2->setCurrentIndex(g_eeGeneral.trainer.mix[1].src); - ui->trnWeight_2->setValue(g_eeGeneral.trainer.mix[1].weight); - ui->trnMode_3->setCurrentIndex(g_eeGeneral.trainer.mix[2].mode); - ui->trnChn_3->setCurrentIndex(g_eeGeneral.trainer.mix[2].src); - ui->trnWeight_3->setValue(g_eeGeneral.trainer.mix[2].weight); - ui->trnMode_4->setCurrentIndex(g_eeGeneral.trainer.mix[3].mode); - ui->trnChn_4->setCurrentIndex(g_eeGeneral.trainer.mix[3].src); - ui->trnWeight_4->setValue(g_eeGeneral.trainer.mix[3].weight); - int potsnum=GetCurrentFirmware()->getCapability(Pots); - if (potsnum==3) { - ui->label_pot4->hide(); - ui->ana8Neg->hide(); - ui->ana8Mid->hide(); - ui->ana8Pos->hide(); - } - setValues(); - switchDefPosEditLock=false; - QTimer::singleShot(0, this, SLOT(shrink())); - for (int i=0; tpmsld[i]; i++) { - connect(tpmsld[i], SIGNAL(valueChanged(int)),this,SLOT(unlockSwitchEdited())); - } - - if (GetCurrentFirmware()->getCapability(MultiposPots)) { - ui->pot1Type->setCurrentIndex(g_eeGeneral.potsType[0]); - ui->pot2Type->setCurrentIndex(g_eeGeneral.potsType[1]); - ui->pot3Type->setCurrentIndex(g_eeGeneral.potsType[2]); - } - else { - ui->potsTypeSeparator->hide(); - ui->pot1Type->hide(); - ui->pot1TypeLabel->hide(); - ui->pot2Type->hide(); - ui->pot2TypeLabel->hide(); - ui->pot3Type->hide(); - ui->pot3TypeLabel->hide(); - } - - if (IS_TARANIS(eepromInterface->getBoard())) { - ui->serialPortMode->setCurrentIndex(g_eeGeneral.hw_uartMode); - } - else { - ui->serialPortMode->hide(); - ui->serialPortLabel->hide(); - } - - if (!IS_TARANIS(eepromInterface->getBoard())) { - ui->stickReverse1->setChecked(g_eeGeneral.stickReverse & (1 << 0)); - ui->stickReverse2->setChecked(g_eeGeneral.stickReverse & (1 << 1)); - ui->stickReverse3->setChecked(g_eeGeneral.stickReverse & (1 << 2)); - ui->stickReverse4->setChecked(g_eeGeneral.stickReverse & (1 << 3)); - connect(ui->stickReverse1, SIGNAL(toggled(bool)), this, SLOT(stickReverseEdited())); - connect(ui->stickReverse2, SIGNAL(toggled(bool)), this, SLOT(stickReverseEdited())); - connect(ui->stickReverse3, SIGNAL(toggled(bool)), this, SLOT(stickReverseEdited())); - connect(ui->stickReverse4, SIGNAL(toggled(bool)), this, SLOT(stickReverseEdited())); - } - else { - ui->stickReverseLB->hide(); - ui->stickReverse1->hide(); - ui->stickReverse2->hide(); - ui->stickReverse3->hide(); - ui->stickReverse4->hide(); - } - - if (IS_TARANIS_PLUS(eepromInterface->getBoard())) { - ui->backlightColor_SL->setValue(g_eeGeneral.backlightColor); - } - else { - ui->backlightColor_label->hide(); - ui->backlightColor_SL->hide(); - ui->backlightColor1_label->hide(); - ui->backlightColor2_label->hide(); - } - - if (IS_ARM(eepromInterface->getBoard())) { - ui->switchesDelay->setValue(10*(g_eeGeneral.switchesDelay+15)); - } - else { - ui->switchesDelay->hide(); - ui->switchesDelayLabel->hide(); - } - ui->blAlarm_ChkB->setChecked(g_eeGeneral.flashBeep); - - disableMouseScrolling(); -} - -GeneralEdit::~GeneralEdit() -{ - delete ui; -} - -void GeneralEdit::on_blAlarm_ChkB_stateChanged() -{ - g_eeGeneral.flashBeep = ui->blAlarm_ChkB->isChecked(); - updateSettings(); -} - -void GeneralEdit::stickReverseEdited() -{ - g_eeGeneral.stickReverse = ((int)ui->stickReverse1->isChecked()) | ((int)ui->stickReverse2->isChecked()<<1) | ((int)ui->stickReverse3->isChecked()<<2) | ((int)ui->stickReverse4->isChecked()<<3); - updateSettings(); -} - -void GeneralEdit::on_pot1Type_currentIndexChanged(int index) -{ - g_eeGeneral.potsType[0] = index; - updateSettings(); -} - -void GeneralEdit::on_pot2Type_currentIndexChanged(int index) -{ - g_eeGeneral.potsType[1] = index; - updateSettings(); -} - -void GeneralEdit::on_pot3Type_currentIndexChanged(int index) -{ - g_eeGeneral.potsType[2] = index; - updateSettings(); -} - -void GeneralEdit::on_serialPortMode_currentIndexChanged(int index) -{ - g_eeGeneral.hw_uartMode = index; - updateSettings(); -} - -void GeneralEdit::unlockSwitchEdited() -{ - int i=0; - i|=(((uint16_t)ui->chkSA->value())); - i|=(((uint16_t)ui->chkSB->value())<<2); - i|=(((uint16_t)ui->chkSC->value())<<4); - i|=(((uint16_t)ui->chkSD->value())<<6); - i|=(((uint16_t)ui->chkSE->value())<<8); - i|=(((uint16_t)ui->chkSF->value())<<10); - i|=(((uint16_t)ui->chkSG->value())<<12); - i|=(((uint16_t)ui->chkSH->value())<<14); - g_eeGeneral.switchUnlockStates=i; - updateSettings(); -} - -void GeneralEdit::setValues() -{ - ui->beeperCB->setCurrentIndex(g_eeGeneral.beeperMode+2); - ui->channelorderCB->setCurrentIndex(g_eeGeneral.templateSetup); - ui->stickmodeCB->setCurrentIndex(g_eeGeneral.stickMode); - if (GetCurrentFirmware()->getCapability(Haptic)) { - ui->hapticLengthCB->setCurrentIndex(g_eeGeneral.hapticLength+2); - } - else { - ui->label_HL->hide(); - ui->hapticLengthCB->hide(); - } - ui->BLBright_SB->setValue(100-g_eeGeneral.backlightBright); - ui->soundModeCB->setCurrentIndex(g_eeGeneral.speakerMode); - ui->volume_SB->setValue(g_eeGeneral.speakerVolume); - ui->beeperlenCB->setCurrentIndex(g_eeGeneral.beeperLength+2); - ui->speakerPitchSB->setValue(g_eeGeneral.speakerPitch); - ui->hapticStrength->setValue(g_eeGeneral.hapticStrength); - ui->hapticmodeCB->setCurrentIndex(g_eeGeneral.hapticMode+2); - ui->battCalibDSB->setValue((double)g_eeGeneral.vBatCalib/10); - ui->CurrentCalib_SB->setValue((double)g_eeGeneral.currentCalib); - - ui->ana1Neg->setValue(g_eeGeneral.calibSpanNeg[0]); - ui->ana2Neg->setValue(g_eeGeneral.calibSpanNeg[1]); - ui->ana3Neg->setValue(g_eeGeneral.calibSpanNeg[2]); - ui->ana4Neg->setValue(g_eeGeneral.calibSpanNeg[3]); - ui->ana5Neg->setValue(g_eeGeneral.calibSpanNeg[4]); - ui->ana6Neg->setValue(g_eeGeneral.calibSpanNeg[5]); - ui->ana7Neg->setValue(g_eeGeneral.calibSpanNeg[6]); - ui->ana8Neg->setValue(g_eeGeneral.calibSpanNeg[7]); - - ui->ana1Mid->setValue(g_eeGeneral.calibMid[0]); - ui->ana2Mid->setValue(g_eeGeneral.calibMid[1]); - ui->ana3Mid->setValue(g_eeGeneral.calibMid[2]); - ui->ana4Mid->setValue(g_eeGeneral.calibMid[3]); - ui->ana5Mid->setValue(g_eeGeneral.calibMid[4]); - ui->ana6Mid->setValue(g_eeGeneral.calibMid[5]); - ui->ana7Mid->setValue(g_eeGeneral.calibMid[6]); - ui->ana8Mid->setValue(g_eeGeneral.calibMid[7]); - - ui->ana1Pos->setValue(g_eeGeneral.calibSpanPos[0]); - ui->ana2Pos->setValue(g_eeGeneral.calibSpanPos[1]); - ui->ana3Pos->setValue(g_eeGeneral.calibSpanPos[2]); - ui->ana4Pos->setValue(g_eeGeneral.calibSpanPos[3]); - ui->ana5Pos->setValue(g_eeGeneral.calibSpanPos[4]); - ui->ana6Pos->setValue(g_eeGeneral.calibSpanPos[5]); - ui->ana7Pos->setValue(g_eeGeneral.calibSpanPos[6]); - ui->ana8Pos->setValue(g_eeGeneral.calibSpanPos[7]); - - ui->PPM1->setValue(g_eeGeneral.trainer.calib[0]); - ui->PPM2->setValue(g_eeGeneral.trainer.calib[1]); - ui->PPM3->setValue(g_eeGeneral.trainer.calib[2]); - ui->PPM4->setValue(g_eeGeneral.trainer.calib[3]); - ui->PPM_MultiplierDSB->setValue((qreal)(g_eeGeneral.PPM_Multiplier+10)/10); -} - -void GeneralEdit::updateSettings() -{ - radioData.generalSettings = g_eeGeneral; - emit modelValuesChanged(); -} - -void GeneralEdit::on_contrastSB_editingFinished() -{ - g_eeGeneral.contrast = ui->contrastSB->value(); - updateSettings(); -} - -void GeneralEdit::on_battwarningDSB_editingFinished() -{ - g_eeGeneral.vBatWarn = (int)(ui->battwarningDSB->value()*10); - updateSettings(); -} - -void GeneralEdit::on_battCalibDSB_editingFinished() -{ - g_eeGeneral.vBatCalib = ui->battCalibDSB->value()*10; - updateSettings(); -} - -void GeneralEdit::on_re_CB_currentIndexChanged(int index) -{ - g_eeGeneral.reNavigation = ui->re_CB->currentIndex(); - updateSettings(); -} - -void GeneralEdit::on_countrycode_CB_currentIndexChanged(int index) -{ - g_eeGeneral.countryCode = ui->countrycode_CB->currentIndex(); - updateSettings(); -} - -void GeneralEdit::on_units_CB_currentIndexChanged(int index) -{ - g_eeGeneral.imperial = ui->units_CB->currentIndex(); - updateSettings(); -} - -void GeneralEdit::on_backlightswCB_currentIndexChanged(int index) -{ - if (switchDefPosEditLock) - return; - g_eeGeneral.backlightMode = ui->backlightswCB->currentIndex(); - updateSettings(); -} - -void GeneralEdit::on_mavbaud_CB_currentIndexChanged(int index) -{ - if (mavbaudEditLock) - return; - g_eeGeneral.mavbaud = ui->mavbaud_CB->currentIndex(); - updateSettings(); -} - - -void GeneralEdit::on_voiceLang_CB_currentIndexChanged(int index) -{ - if (voiceLangEditLock) - return; - QString code=ui->voiceLang_CB->itemData(index).toString(); - for (int i=0; i<2; i++) { - g_eeGeneral.ttsLanguage[i]=code.at(i).toAscii(); - } - g_eeGeneral.ttsLanguage[2]=0; - updateSettings(); -} - -void GeneralEdit::on_beeperlenCB_currentIndexChanged(int index) -{ - g_eeGeneral.beeperLength = index-2; - updateSettings(); -} - -void GeneralEdit::on_hapticLengthCB_currentIndexChanged(int index) -{ - g_eeGeneral.hapticLength = index-2; - updateSettings(); -} - -void GeneralEdit::on_gpsFormatCB_currentIndexChanged(int index) -{ - g_eeGeneral.gpsFormat = index; - updateSettings(); -} - - -void GeneralEdit::on_backlightautoSB_editingFinished() -{ - int i = ui->backlightautoSB->value()/5; - if((i*5)!=ui->backlightautoSB->value()) - ui->backlightautoSB->setValue(i*5); - else - { - g_eeGeneral.backlightDelay = i; - updateSettings(); - } -} - -void GeneralEdit::on_switchesDelay_valueChanged() -{ - g_eeGeneral.switchesDelay = (ui->switchesDelay->value() / 10) - 15; - updateSettings(); -} - -void GeneralEdit::on_backlightColor_SL_valueChanged() -{ - g_eeGeneral.backlightColor = ui->backlightColor_SL->value(); - updateSettings(); -} - -void GeneralEdit::on_timezoneSB_editingFinished() -{ - g_eeGeneral.timezone = ui->timezoneSB->value(); - updateSettings(); -} - -void GeneralEdit::on_inactimerSB_editingFinished() -{ - g_eeGeneral.inactivityTimer = ui->inactimerSB->value(); - updateSettings(); -} - -void GeneralEdit::on_memwarnChkB_stateChanged(int ) -{ - g_eeGeneral.disableMemoryWarning = ui->memwarnChkB->isChecked() ? 0 : 1; - updateSettings(); -} - -void GeneralEdit::on_alarmwarnChkB_stateChanged(int ) -{ - g_eeGeneral.disableAlarmWarning = ui->alarmwarnChkB->isChecked() ? 0 : 1; - updateSettings(); -} - -void GeneralEdit::on_beeperCB_currentIndexChanged(int index) -{ - g_eeGeneral.beeperMode = (BeeperMode)(index-2); - updateSettings(); -} - -void GeneralEdit::on_displayTypeCB_currentIndexChanged(int index) -{ - g_eeGeneral.optrexDisplay = index; - updateSettings(); -} - -void GeneralEdit::on_hapticmodeCB_currentIndexChanged(int index) -{ - g_eeGeneral.hapticMode = (BeeperMode)(index-2); - updateSettings(); -} - - -void GeneralEdit::on_channelorderCB_currentIndexChanged(int index) -{ - g_eeGeneral.templateSetup = index; - updateSettings(); -} - -void GeneralEdit::on_stickmodeCB_currentIndexChanged(int index) -{ - g_eeGeneral.stickMode = index; - updateSettings(); -} - -void GeneralEdit::on_trnMode_1_currentIndexChanged(int index) -{ - g_eeGeneral.trainer.mix[0].mode = index; - updateSettings(); -} - -void GeneralEdit::on_trnChn_1_currentIndexChanged(int index) -{ - g_eeGeneral.trainer.mix[0].src = index; - updateSettings(); -} - -void GeneralEdit::on_trnWeight_1_editingFinished() -{ - g_eeGeneral.trainer.mix[0].weight = ui->trnWeight_1->value(); - updateSettings(); -} - -void GeneralEdit::on_trnMode_2_currentIndexChanged(int index) -{ - g_eeGeneral.trainer.mix[1].mode = index; - updateSettings(); -} - -void GeneralEdit::on_trnChn_2_currentIndexChanged(int index) -{ - g_eeGeneral.trainer.mix[1].src = index; - updateSettings(); -} - -void GeneralEdit::on_trnWeight_2_editingFinished() -{ - g_eeGeneral.trainer.mix[1].weight = ui->trnWeight_2->value(); - updateSettings(); -} - -void GeneralEdit::on_trnMode_3_currentIndexChanged(int index) -{ - g_eeGeneral.trainer.mix[2].mode = index; - updateSettings(); -} - -void GeneralEdit::on_trnChn_3_currentIndexChanged(int index) -{ - g_eeGeneral.trainer.mix[2].src = index; - updateSettings(); -} - -void GeneralEdit::on_trnWeight_3_editingFinished() -{ - g_eeGeneral.trainer.mix[2].weight = ui->trnWeight_3->value(); - updateSettings(); -} - -void GeneralEdit::on_trnMode_4_currentIndexChanged(int index) -{ - g_eeGeneral.trainer.mix[3].mode = index; - updateSettings(); -} - -void GeneralEdit::on_trnChn_4_currentIndexChanged(int index) -{ - g_eeGeneral.trainer.mix[3].src = index; - updateSettings(); -} - -void GeneralEdit::on_trnWeight_4_editingFinished() -{ - g_eeGeneral.trainer.mix[3].weight = ui->trnWeight_4->value(); - updateSettings(); -} - -void GeneralEdit::on_ana1Neg_editingFinished() -{ - g_eeGeneral.calibSpanNeg[0] = ui->ana1Neg->value(); - updateSettings(); -} - -void GeneralEdit::on_ana2Neg_editingFinished() -{ - g_eeGeneral.calibSpanNeg[1] = ui->ana2Neg->value(); - updateSettings(); -} - -void GeneralEdit::on_ana3Neg_editingFinished() -{ - g_eeGeneral.calibSpanNeg[2] = ui->ana3Neg->value(); - updateSettings(); -} - -void GeneralEdit::on_ana4Neg_editingFinished() -{ - g_eeGeneral.calibSpanNeg[3] = ui->ana4Neg->value(); - updateSettings(); -} - -void GeneralEdit::on_ana5Neg_editingFinished() -{ - g_eeGeneral.calibSpanNeg[4] = ui->ana5Neg->value(); - updateSettings(); -} - -void GeneralEdit::on_ana6Neg_editingFinished() -{ - g_eeGeneral.calibSpanNeg[5] = ui->ana6Neg->value(); - updateSettings(); -} - -void GeneralEdit::on_ana7Neg_editingFinished() -{ - g_eeGeneral.calibSpanNeg[6] = ui->ana7Neg->value(); - updateSettings(); -} - -void GeneralEdit::on_ana8Neg_editingFinished() -{ - g_eeGeneral.calibSpanNeg[7] = ui->ana8Neg->value(); - updateSettings(); -} - -void GeneralEdit::on_ana1Mid_editingFinished() -{ - g_eeGeneral.calibMid[0] = ui->ana1Mid->value(); - updateSettings(); -} - -void GeneralEdit::on_ana2Mid_editingFinished() -{ - g_eeGeneral.calibMid[1] = ui->ana2Mid->value(); - updateSettings(); -} - -void GeneralEdit::on_ana3Mid_editingFinished() -{ - g_eeGeneral.calibMid[2] = ui->ana3Mid->value(); - updateSettings(); -} - -void GeneralEdit::on_ana4Mid_editingFinished() -{ - g_eeGeneral.calibMid[3] = ui->ana4Mid->value(); - updateSettings(); -} - -void GeneralEdit::on_ana5Mid_editingFinished() -{ - g_eeGeneral.calibMid[4] = ui->ana5Mid->value(); - updateSettings(); -} - -void GeneralEdit::on_ana6Mid_editingFinished() -{ - g_eeGeneral.calibMid[5] = ui->ana6Mid->value(); - updateSettings(); -} - -void GeneralEdit::on_ana7Mid_editingFinished() -{ - g_eeGeneral.calibMid[6] = ui->ana7Mid->value(); - updateSettings(); -} - -void GeneralEdit::on_ana8Mid_editingFinished() -{ - g_eeGeneral.calibMid[7] = ui->ana8Mid->value(); - updateSettings(); -} - - -void GeneralEdit::on_ana1Pos_editingFinished() -{ - g_eeGeneral.calibSpanPos[0] = ui->ana1Pos->value(); - updateSettings(); -} - -void GeneralEdit::on_ana2Pos_editingFinished() -{ - g_eeGeneral.calibSpanPos[1] = ui->ana2Pos->value(); - updateSettings(); -} - -void GeneralEdit::on_ana3Pos_editingFinished() -{ - g_eeGeneral.calibSpanPos[2] = ui->ana3Pos->value(); - updateSettings(); -} - -void GeneralEdit::on_ana4Pos_editingFinished() -{ - g_eeGeneral.calibSpanPos[3] = ui->ana4Pos->value(); - updateSettings(); -} - -void GeneralEdit::on_ana5Pos_editingFinished() -{ - g_eeGeneral.calibSpanPos[4] = ui->ana5Pos->value(); - updateSettings(); -} - -void GeneralEdit::on_ana6Pos_editingFinished() -{ - g_eeGeneral.calibSpanPos[5] = ui->ana6Pos->value(); - updateSettings(); -} - -void GeneralEdit::on_ana7Pos_editingFinished() -{ - g_eeGeneral.calibSpanPos[6] = ui->ana7Pos->value(); - updateSettings(); -} - -void GeneralEdit::on_ana8Pos_editingFinished() -{ - g_eeGeneral.calibSpanPos[7] = ui->ana8Pos->value(); - updateSettings(); -} - -void GeneralEdit::on_volume_SB_editingFinished() -{ - g_eeGeneral.speakerVolume = ui->volume_SB->value(); - updateSettings(); -} - -void GeneralEdit::on_BLBright_SB_editingFinished() -{ - g_eeGeneral.backlightBright = 100 - ui->BLBright_SB->value(); - updateSettings(); -} - -void GeneralEdit::on_CurrentCalib_SB_editingFinished() -{ - g_eeGeneral.currentCalib = ui->CurrentCalib_SB->value(); - updateSettings(); -} - -void GeneralEdit::on_beepVolume_SL_valueChanged() -{ - g_eeGeneral.beepVolume=ui->beepVolume_SL->value(); - updateSettings(); -} - -void GeneralEdit::on_wavVolume_SL_valueChanged() -{ - g_eeGeneral.wavVolume=ui->wavVolume_SL->value(); - updateSettings(); -} - -void GeneralEdit::on_varioVolume_SL_valueChanged() -{ - g_eeGeneral.varioVolume=ui->varioVolume_SL->value(); - updateSettings(); -} - -void GeneralEdit::on_bgVolume_SL_valueChanged() -{ - g_eeGeneral.backgroundVolume=ui->bgVolume_SL->value(); - updateSettings(); -} - -void GeneralEdit::on_varioP0_SB_editingFinished() -{ - g_eeGeneral.varioPitch = (ui->varioP0_SB->value()-700)/10; - updateVarioPitchRange(); - updateSettings(); -} - -void GeneralEdit::updateVarioPitchRange() -{ - ui->varioPMax_SB->setMaximum(700+(g_eeGeneral.varioPitch*10)+1000+800); - ui->varioPMax_SB->setMinimum(700+(g_eeGeneral.varioPitch*10)+1000-800); -} - -void GeneralEdit::on_varioPMax_SB_editingFinished() -{ - g_eeGeneral.varioRange = (ui->varioPMax_SB->value()-(700+(g_eeGeneral.varioPitch*10))-1000)/10; - updateSettings(); -} - -void GeneralEdit::on_varioR0_SB_editingFinished() -{ - g_eeGeneral.varioRepeat = (ui->varioR0_SB->value()-500)/10; - updateSettings(); -} - -void GeneralEdit::on_PPM1_editingFinished() -{ - g_eeGeneral.trainer.calib[0] = ui->PPM1->value(); - updateSettings(); -} - -void GeneralEdit::on_PPM2_editingFinished() -{ - g_eeGeneral.trainer.calib[1] = ui->PPM2->value(); - updateSettings(); -} - -void GeneralEdit::on_PPM3_editingFinished() -{ - g_eeGeneral.trainer.calib[2] = ui->PPM3->value(); - updateSettings(); -} - -void GeneralEdit::on_PPM4_editingFinished() -{ - g_eeGeneral.trainer.calib[3] = ui->PPM4->value(); - updateSettings(); -} - -void GeneralEdit::on_tabWidget_currentChanged(int index) -{ - g.generalEditTab(index); -} - -void GeneralEdit::on_splashScreenChkB_stateChanged(int ) -{ - g_eeGeneral.splashMode = ui->splashScreenChkB->isChecked() ? 0 : 1; - updateSettings(); -} - -void GeneralEdit::on_splashScreenDuration_currentIndexChanged(int index) -{ - g_eeGeneral.splashDuration = 3-index; - updateSettings(); -} - -void GeneralEdit::on_PPM_MultiplierDSB_editingFinished() -{ - g_eeGeneral.PPM_Multiplier = (int)(ui->PPM_MultiplierDSB->value()*10)-10; - updateSettings(); -} - -void GeneralEdit::on_speakerPitchSB_editingFinished() -{ - g_eeGeneral.speakerPitch = ui->speakerPitchSB->value(); - updateSettings(); -} - -void GeneralEdit::on_hapticStrength_valueChanged() -{ - g_eeGeneral.hapticStrength = ui->hapticStrength->value(); - updateSettings(); -} - -void GeneralEdit::on_soundModeCB_currentIndexChanged(int index) -{ - g_eeGeneral.speakerMode = index; - updateSettings(); -} - -void GeneralEdit::on_faimode_CB_stateChanged(int ) -{ - if (ui->faimode_CB->isChecked()) { - int ret = QMessageBox::question(this, "Companion", - tr("If you enable FAI, you loose the vario, the play functions, the telemetry screen.\nThis function cannot be disabled by the radio.\nAre you sure ?") , - QMessageBox::Yes | QMessageBox::No); - if (ret==QMessageBox::Yes) { - g_eeGeneral.fai = true; - } else { - ui->faimode_CB->setChecked(false); - } - } else { - g_eeGeneral.fai = false; - } - updateSettings(); -} - -void GeneralEdit::on_calretrieve_PB_clicked() -{ - int profile_id=ui->profile_CB->itemData(ui->profile_CB->currentIndex()).toInt(); - QString calib=g.profile[profile_id].stickPotCalib(); - int potsnum=GetCurrentFirmware()->getCapability(Pots); - if (calib.isEmpty()) { - return; - } else { - QString trainercalib = g.profile[profile_id].trainerCalib(); - int8_t vBatCalib = (int8_t)g.profile[profile_id].vBatCalib(); - int8_t currentCalib = (int8_t)g.profile[profile_id].currentCalib(); - int8_t PPM_Multiplier = (int8_t)g.profile[profile_id].ppmMultiplier(); - uint8_t GSStickMode = (uint8_t)g.profile[profile_id].gsStickMode(); - uint8_t vBatWarn = (uint8_t)g.profile[profile_id].vBatWarn(); - QString DisplaySet = g.profile[profile_id].display(); - QString BeeperSet = g.profile[profile_id].beeper(); - QString HapticSet = g.profile[profile_id].haptic(); - QString SpeakerSet = g.profile[profile_id].speaker(); - QString CountrySet = g.profile[profile_id].countryCode(); - - if ((calib.length()==(NUM_STICKS+potsnum)*12) && (trainercalib.length()==16)) { - QString Byte; - int16_t byte16; - bool ok; - for (int i=0; i<(NUM_STICKS+potsnum); i++) { - Byte=calib.mid(i*12,4); - byte16=(int16_t)Byte.toInt(&ok,16); - if (ok) - g_eeGeneral.calibMid[i]=byte16; - Byte=calib.mid(4+i*12,4); - byte16=(int16_t)Byte.toInt(&ok,16); - if (ok) - g_eeGeneral.calibSpanNeg[i]=byte16; - Byte=calib.mid(8+i*12,4); - byte16=(int16_t)Byte.toInt(&ok,16); - if (ok) - g_eeGeneral.calibSpanPos[i]=byte16; - } - for (int i=0; i<4; i++) { - Byte=trainercalib.mid(i*4,4); - byte16=(int16_t)Byte.toInt(&ok,16); - if (ok) - g_eeGeneral.trainer.calib[i]=byte16; - } - g_eeGeneral.currentCalib=currentCalib; - g_eeGeneral.vBatCalib=vBatCalib; - g_eeGeneral.vBatWarn=vBatWarn; - g_eeGeneral.PPM_Multiplier=PPM_Multiplier; - } else { - QMessageBox::critical(this, tr("Warning"), tr("Wrong data in profile, radio calibration was not retrieved")); - } - if ((DisplaySet.length()==6) && (BeeperSet.length()==4) && (HapticSet.length()==6) && (SpeakerSet.length()==6)) { - g_eeGeneral.stickMode=GSStickMode; - uint8_t byte8u; - int8_t byte8; - QString chars; - bool ok; - byte8=(int8_t)DisplaySet.mid(0,2).toInt(&ok,16); - if (ok) - g_eeGeneral.optrexDisplay=(byte8==1 ? true : false); - byte8u=(uint8_t)DisplaySet.mid(2,2).toUInt(&ok,16); - if (ok) - g_eeGeneral.contrast=byte8u; - byte8u=(uint8_t)DisplaySet.mid(4,2).toUInt(&ok,16); - if (ok) - g_eeGeneral.backlightBright=byte8u; - byte8=(int8_t)BeeperSet.mid(0,2).toUInt(&ok,16); - if (ok) - g_eeGeneral.beeperMode=(BeeperMode)byte8; - byte8=(int8_t)BeeperSet.mid(2,2).toInt(&ok,16); - if (ok) - g_eeGeneral.beeperLength=byte8; - byte8=(int8_t)HapticSet.mid(0,2).toUInt(&ok,16); - if (ok) - g_eeGeneral.hapticMode=(BeeperMode)byte8; - byte8=(int8_t)HapticSet.mid(2,2).toInt(&ok,16); - if (ok) - g_eeGeneral.hapticStrength=byte8; - byte8=(int8_t)HapticSet.mid(4,2).toInt(&ok,16); - if (ok) - g_eeGeneral.hapticLength=byte8; - byte8u=(uint8_t)SpeakerSet.mid(0,2).toUInt(&ok,16); - if (ok) - g_eeGeneral.speakerMode=byte8u; - byte8u=(uint8_t)SpeakerSet.mid(2,2).toUInt(&ok,16); - if (ok) - g_eeGeneral.speakerPitch=byte8u; - byte8u=(uint8_t)SpeakerSet.mid(4,2).toUInt(&ok,16); - if (ok) - g_eeGeneral.speakerVolume=byte8u; - if (CountrySet.length()==6) { - byte8u=(uint8_t)CountrySet.mid(0,2).toUInt(&ok,16); - if (ok) - g_eeGeneral.countryCode=byte8u; - byte8u=(uint8_t)CountrySet.mid(2,2).toUInt(&ok,16); - if (ok) - g_eeGeneral.imperial=byte8u; - chars=CountrySet.mid(4,2); - g_eeGeneral.ttsLanguage[0]=chars[0].toAscii(); - g_eeGeneral.ttsLanguage[1]=chars[1].toAscii(); - } - } else { - QMessageBox::critical(this, tr("Warning"), tr("Wrong data in profile, hw related parameters were not retrieved")); - } - } - setValues(); - updateSettings(); -} - -void GeneralEdit::on_calstore_PB_clicked() -{ - int profile_id=ui->profile_CB->itemData(ui->profile_CB->currentIndex()).toInt(); - - QString name=g.profile[profile_id].name(); - int potsnum=GetCurrentFirmware()->getCapability(Pots); - if (name.isEmpty()) { - ui->calstore_PB->setDisabled(true); - return; - } - else { - QString calib=g.profile[profile_id].stickPotCalib(); - if (!(calib.isEmpty())) { - int ret = QMessageBox::question(this, "Companion", - tr("Do you want to store calibration in %1 profile
overwriting existing calibration?").arg(name) , - QMessageBox::Yes | QMessageBox::No); - if (ret == QMessageBox::No) { - return; - } - } - calib.clear(); - for (int i=0; i< (NUM_STICKS+potsnum); i++) { - calib.append(QString("%1").arg((uint16_t)g_eeGeneral.calibMid[i], 4, 16, QChar('0'))); - calib.append(QString("%1").arg((uint16_t)g_eeGeneral.calibSpanNeg[i], 4, 16, QChar('0'))); - calib.append(QString("%1").arg((uint16_t)g_eeGeneral.calibSpanPos[i], 4, 16, QChar('0'))); - } - g.profile[profile_id].stickPotCalib( calib ); - calib.clear(); - for (int i=0; i< 4; i++) { - calib.append(QString("%1").arg((uint16_t)g_eeGeneral.trainer.calib[i], 4, 16, QChar('0'))); - } - g.profile[profile_id].trainerCalib( calib ); - g.profile[profile_id].vBatCalib( g_eeGeneral.vBatCalib ); - g.profile[profile_id].currentCalib( g_eeGeneral.currentCalib ); - g.profile[profile_id].vBatWarn( g_eeGeneral.vBatWarn ); - g.profile[profile_id].ppmMultiplier( g_eeGeneral.PPM_Multiplier ); - g.profile[profile_id].gsStickMode( g_eeGeneral.stickMode ); - g.profile[profile_id].display( QString("%1%2%3").arg((g_eeGeneral.optrexDisplay ? 1:0), 2, 16, QChar('0')).arg((uint8_t)g_eeGeneral.contrast, 2, 16, QChar('0')).arg((uint8_t)g_eeGeneral.backlightBright, 2, 16, QChar('0')) ); - g.profile[profile_id].beeper( QString("%1%2").arg(((uint8_t)g_eeGeneral.beeperMode), 2, 16, QChar('0')).arg((uint8_t)g_eeGeneral.beeperLength, 2, 16, QChar('0'))); - g.profile[profile_id].haptic( QString("%1%2%3").arg(((uint8_t)g_eeGeneral.hapticMode), 2, 16, QChar('0')).arg((int8_t)g_eeGeneral.hapticStrength, 2, 16, QChar('0')).arg((uint8_t)g_eeGeneral.hapticLength, 2, 16, QChar('0'))); - g.profile[profile_id].speaker( QString("%1%2%3").arg((uint8_t)g_eeGeneral.speakerMode, 2, 16, QChar('0')).arg((uint8_t)g_eeGeneral.speakerPitch, 2, 16, QChar('0')).arg((uint8_t)g_eeGeneral.speakerVolume, 2, 16, QChar('0'))); - g.profile[profile_id].countryCode( QString("%1%2%3").arg((uint8_t)g_eeGeneral.countryCode, 2, 16, QChar('0')).arg((uint8_t)g_eeGeneral.imperial, 2, 16, QChar('0')).arg(g_eeGeneral.ttsLanguage)); - - QDateTime dateTime = QDateTime::currentDateTime(); - g.profile[profile_id].timeStamp(dateTime.toString("yyyy-MM-dd hh:mm")); - QMessageBox::information(this, "Companion", tr("Calibration and HW parameters saved.")); - } -} - -void GeneralEdit::shrink() -{ - resize(100, 100); - resize(0, 0); -} - -bool GeneralEdit::eventFilter(QObject *object, QEvent * event) -{ - QWidget * widget = qobject_cast(object); - if (widget) { - if (event->type() == QEvent::Wheel) { - if (widget->focusPolicy() == Qt::WheelFocus) { - event->accept(); - return false; - } - else { - event->ignore(); - return true; - } - } - else if (event->type() == QEvent::FocusIn) { - widget->setFocusPolicy(Qt::WheelFocus); - } - else if (event->type() == QEvent::FocusOut) { - widget->setFocusPolicy(Qt::StrongFocus); - } - } - return QWidget::eventFilter(object, event); -} - -void GeneralEdit::disableMouseScrolling() -{ - Q_FOREACH(QComboBox * cb, findChildren()) { - cb->installEventFilter(this); - cb->setFocusPolicy(Qt::StrongFocus); - } - - Q_FOREACH(QAbstractSpinBox * sb, findChildren()) { - sb->installEventFilter(this); - sb->setFocusPolicy(Qt::StrongFocus); - } - - Q_FOREACH(QSlider * slider, findChildren()) { - slider->installEventFilter(this); - slider->setFocusPolicy(Qt::StrongFocus); - } -} diff --git a/companion/src/generaledit.h b/companion/src/generaledit.h deleted file mode 100644 index 6422589d2..000000000 --- a/companion/src/generaledit.h +++ /dev/null @@ -1,143 +0,0 @@ -#ifndef GENERALEDIT_H -#define GENERALEDIT_H - -#include -#include "eeprominterface.h" - -namespace Ui { - class GeneralEdit; -} - -class GeneralEdit : public QDialog -{ - Q_OBJECT - - public: - explicit GeneralEdit(RadioData &radioData, QWidget *parent = 0); - ~GeneralEdit(); - void updateSettings(); - - private: - Ui::GeneralEdit *ui; - RadioData &radioData; - GeneralSettings g_eeGeneral; - - bool switchDefPosEditLock; - bool voiceLangEditLock; - bool mavbaudEditLock; - void getGeneralSwitchDefPos(int i, bool val); - void setSwitchDefPos(); - void updateVarioPitchRange(); - void disableMouseScrolling(); - - protected: - virtual bool eventFilter(QObject *obj, QEvent *event); - - signals: - void modelValuesChanged(); - - private slots: - void on_faimode_CB_stateChanged(int ); - void on_speakerPitchSB_editingFinished(); - void on_timezoneSB_editingFinished(); - void on_hapticStrength_valueChanged(); - void on_soundModeCB_currentIndexChanged(int index); - void on_beeperlenCB_currentIndexChanged(int index); - void on_volume_SB_editingFinished(); - void on_hapticmodeCB_currentIndexChanged(int index); - void on_hapticLengthCB_currentIndexChanged(int index); - void on_PPM_MultiplierDSB_editingFinished(); - void on_splashScreenChkB_stateChanged(int); - void on_splashScreenDuration_currentIndexChanged(int index); - void on_alarmwarnChkB_stateChanged(int ); - void on_gpsFormatCB_currentIndexChanged(int index); - void on_tabWidget_currentChanged(int index); - void on_displayTypeCB_currentIndexChanged(int index); - void on_BLBright_SB_editingFinished(); - void on_backlightColor_SL_valueChanged(); - void on_re_CB_currentIndexChanged(int index); - void on_countrycode_CB_currentIndexChanged(int index); - void on_units_CB_currentIndexChanged(int index); - void on_trnMode_1_currentIndexChanged(int index); - void on_trnChn_1_currentIndexChanged(int index); - void on_trnWeight_1_editingFinished(); - void on_trnMode_2_currentIndexChanged(int index); - void on_trnChn_2_currentIndexChanged(int index); - void on_trnWeight_2_editingFinished(); - void on_trnMode_3_currentIndexChanged(int index); - void on_trnChn_3_currentIndexChanged(int index); - void on_trnWeight_3_editingFinished(); - void on_trnMode_4_currentIndexChanged(int index); - void on_trnChn_4_currentIndexChanged(int index); - void on_trnWeight_4_editingFinished(); - - void on_CurrentCalib_SB_editingFinished(); - - void on_ana1Neg_editingFinished(); - void on_ana2Neg_editingFinished(); - void on_ana3Neg_editingFinished(); - void on_ana4Neg_editingFinished(); - void on_ana5Neg_editingFinished(); - void on_ana6Neg_editingFinished(); - void on_ana7Neg_editingFinished(); - void on_ana8Neg_editingFinished(); - - void on_ana1Mid_editingFinished(); - void on_ana2Mid_editingFinished(); - void on_ana3Mid_editingFinished(); - void on_ana4Mid_editingFinished(); - void on_ana5Mid_editingFinished(); - void on_ana6Mid_editingFinished(); - void on_ana7Mid_editingFinished(); - void on_ana8Mid_editingFinished(); - - void on_ana1Pos_editingFinished(); - void on_ana2Pos_editingFinished(); - void on_ana3Pos_editingFinished(); - void on_ana4Pos_editingFinished(); - void on_ana5Pos_editingFinished(); - void on_ana6Pos_editingFinished(); - void on_ana7Pos_editingFinished(); - void on_ana8Pos_editingFinished(); - - void on_PPM1_editingFinished(); - void on_PPM2_editingFinished(); - void on_PPM3_editingFinished(); - void on_PPM4_editingFinished(); - void on_beepVolume_SL_valueChanged(); - void on_bgVolume_SL_valueChanged(); - void on_varioVolume_SL_valueChanged(); - void on_wavVolume_SL_valueChanged(); - - void on_varioP0_SB_editingFinished(); - void on_varioPMax_SB_editingFinished(); - void on_varioR0_SB_editingFinished(); - - void on_pot1Type_currentIndexChanged(int index); - void on_pot2Type_currentIndexChanged(int index); - void on_pot3Type_currentIndexChanged(int index); - void on_serialPortMode_currentIndexChanged(int index); - - void on_stickmodeCB_currentIndexChanged(int index); - void on_channelorderCB_currentIndexChanged(int index); - void on_beeperCB_currentIndexChanged(int index); - void on_memwarnChkB_stateChanged(int ); - void on_inactimerSB_editingFinished(); - void on_backlightautoSB_editingFinished(); - void on_backlightswCB_currentIndexChanged(int index); - void on_mavbaud_CB_currentIndexChanged(int index); - void on_voiceLang_CB_currentIndexChanged(int index); - void on_battCalibDSB_editingFinished(); - void on_battwarningDSB_editingFinished(); - void on_contrastSB_editingFinished(); - void on_calretrieve_PB_clicked(); - void on_calstore_PB_clicked(); - void unlockSwitchEdited(); - void setValues(); - void shrink(); - void stickReverseEdited(); - void on_switchesDelay_valueChanged(); - void on_blAlarm_ChkB_stateChanged(); -}; - -#endif // GENERALEDIT_H diff --git a/companion/src/generaledit.ui b/companion/src/generaledit.ui deleted file mode 100644 index 257afbea6..000000000 --- a/companion/src/generaledit.ui +++ /dev/null @@ -1,3403 +0,0 @@ - - - GeneralEdit - - - - 0 - 0 - 804 - 912 - - - - - 0 - 0 - - - - General Edit - - - true - - - - - - - 0 - 0 - - - - QFrame::Panel - - - QFrame::Raised - - - - QLayout::SetDefaultConstraint - - - - - - - - 0 - 0 - - - - Retrieve calib. and hw settings from profile - - - - - - - Qt::Horizontal - - - QSizePolicy::Expanding - - - - 10 - 20 - - - - - - - - - 0 - 0 - - - - Store calib. and hw settings in selected profile - - - - - - - - - - - - - - - - 0 - 0 - - - - General settings used throught the transmitter. -These will be relevant for all models in the same EEPROM. - - - 0 - - - - Setup - - - - - - GPS Coordinates - - - - - - - Speaker Pitch (spkr only) - - - - - - - - - - Measurement Units - - - - - - - - hh° (N/S) mm' ss''.dd - - - - - NMEA - - - - - - - - -14 - - - 12 - - - 0 - - - - - - - Voice Language - - - - - - - Timeshift from UTC - - - - - - - - Metric - - - - - Imperial - - - - - - - - Country Code - - - - - - - - America - - - - - Japan - - - - - Europe - - - - - - - - -2 - - - 2 - - - 1 - - - Qt::Horizontal - - - - - - - - X-Short - - - - - Short - - - - - Normal - - - - - Long - - - - - X-Long - - - - - - - - - - Color 1 - - - - - - - 20 - - - 5 - - - Qt::Horizontal - - - - - - - Color 2 - - - - - - - - - Beeper Length - - - - - - - RotEnc Navigation - - - - - - - Beeper Mode - - - - - - - Vario pitch at zero - - - - - - - - Standard - - - - - Optrex - - - - - - - - Readonly Unlock - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop - - - - - - - Qt::Vertical - - - - 20 - 5 - - - - - - - - Sound Mode - - - - - - - - - - - - - Beeper volume - -0 - Quiet. No beeps at all. -1 - No Keys. Normal beeps but menu keys do not beep. -2 - Normal. -3 - Loud. -4 - Extra loud. - - - - Quiet - - - - - Alarms Only - - - - - No Keys - - - - - All - - - - - - - - - Quiet - - - - - Only Alarms - - - - - No Keys - - - - - All - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Haptic Mode - - - - - - - - X-Short - - - - - Short - - - - - Normal - - - - - Long - - - - - X-Long - - - - - - - - - Beeper - - - - - Speaker - - - - - BeeperVoice - - - - - SpeakerVoice - - - - - - - - - - - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">LCD Screen Contrast</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">Values can be 20-45</span></p></body></html> - - - 1 - - - 20 - - - 1 - - - - - - - QLayout::SetMinimumSize - - - 0 - - - 0 - - - - - - 0 - 0 - - - - SC - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - - 0 - 50 - - - - - 16777215 - 50 - - - - 0 - - - 2 - - - 1 - - - 0 - - - Qt::Vertical - - - true - - - QSlider::TicksBothSides - - - 1 - - - - - - - - 0 - 0 - - - - SE - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - - 0 - 50 - - - - - 16777215 - 50 - - - - 0 - - - 1 - - - 1 - - - 1 - - - 0 - - - Qt::Vertical - - - true - - - QSlider::TicksBothSides - - - 1 - - - - - - - - 0 - 0 - - - - - 0 - 50 - - - - - 16777215 - 50 - - - - 0 - - - 2 - - - 1 - - - 0 - - - Qt::Vertical - - - true - - - QSlider::TicksBothSides - - - 1 - - - - - - - - 0 - 0 - - - - - 0 - 50 - - - - - 16777215 - 50 - - - - 0 - - - 2 - - - 1 - - - 0 - - - Qt::Vertical - - - true - - - QSlider::TicksBothSides - - - 1 - - - - - - - - 0 - 0 - - - - - 0 - 50 - - - - - 16777215 - 50 - - - - 0 - - - 2 - - - 1 - - - 0 - - - Qt::Vertical - - - true - - - QSlider::TicksBothSides - - - 1 - - - - - - - - 0 - 0 - - - - - 0 - 50 - - - - - 16777215 - 50 - - - - 0 - - - 2 - - - 1 - - - 0 - - - Qt::Vertical - - - true - - - QSlider::TicksBothSides - - - 1 - - - - - - - - 0 - 0 - - - - - 0 - 50 - - - - - 16777215 - 50 - - - - 0 - - - 2 - - - 1 - - - 0 - - - Qt::Vertical - - - true - - - QSlider::TicksBothSides - - - 1 - - - - - - - - 0 - 0 - - - - SA - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - SF - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - SH - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - SD - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - SB - - - Qt::AlignCenter - - - - - - - - 0 - 0 - - - - - 0 - 50 - - - - - 16777215 - 50 - - - - 0 - - - 1 - - - 1 - - - 1 - - - 0 - - - Qt::Vertical - - - true - - - QSlider::TicksBothSides - - - 1 - - - - - - - - 0 - 0 - - - - SG - - - Qt::AlignCenter - - - - - - - Qt::Horizontal - - - - 40 - 0 - - - - - - - - - - Hz - - - 300 - - - 1100 - - - 10 - - - 700 - - - - - - - - - - Battery Warning - - - - - - - - 0 - 0 - - - - - - - - - - Battery warning voltage. -This is the threashhold where the battery warning sounds. - -Acceptable values are 5v..10v - - - - - - V - - - 1 - - - 4.000000000000000 - - - 12.000000000000000 - - - 0.100000000000000 - - - 9.600000000000000 - - - - - - - Vario pitch at max - - - - - - - - 0 - 0 - - - - - - - - - - If this value is not 0, any keypress will turn on the backlight and turn it off after the specified number of seconds. - - - sec - - - 600 - - - 5 - - - - - - - Hz - - - 1300 - - - 2900 - - - 10 - - - 1700 - - - - - - - ms - - - 200 - - - 1000 - - - 10 - - - 500 - - - - - - - Backlight Brightness - - - - - - - Vario repeat at zero - - - - - - - Backlight Auto OFF after - - - - - - - 100 - - - - - - - - - - Backlight color - - - - - - - - - - Contrast - - - - - - - - 0 - 0 - - - - - - - - - - If not zero will sound beeps if the transmitter has been left without inputs for the specified number of minutes. - - - min - - - 120 - - - - - - - - 4800 Baud - - - - - 9600 Baud - - - - - 14400 Baud - - - - - 19200 Baud - - - - - 38400 Baud - - - - - 57600 Baud - - - - - 76800 Baud - - - - - 115200 Baud - - - - - - - - Backlight Switch - - - - - - - - 0 - 0 - - - - 23 - - - - - - - - 0 - 0 - - - - Show Splash Screen on Startup - - - - - - - - - - - - - This is the switch selectrion for turning on the backlight (if installed). - - - - - -1 - - - - - - - LCD Display Type - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" text-decoration: underline;">Warnings</span></p> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">These will define startup warnings.</p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Throttle warning - will alert if the throttle is not at idle during startup</p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Switch warning - will alert if switches are not in their defaul position</p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Memory warning - will alert if there's not a lot of memory left</p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Silent mode warning - will alert you if the beeper is set to quiet (0)</p></body></html> - - - - - - true - - - - - - - MAVLink Baud Rate - - - - - - - - 0 - 0 - - - - - - - - - - - - - 10 - - - 45 - - - 25 - - - - - - - Speaker Volume - - - - - - - Haptic Length - - - - - - - Inactivity Timer - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" text-decoration: underline;">Warnings</span></p> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">These will define startup warnings.</p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Throttle warning - will alert if the throttle is not at idle during startup</p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Switch warning - will alert if switches are not in their defaul position</p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Memory warning - will alert if there's not a lot of memory left</p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Silent mode warning - will alert you if the beeper is set to quiet (0)</p></body></html> - - - - - - true - - - - - - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - - - Show splash screen on startup - - - Show splash screen on startup - - - - - - - - - - - 0 - 0 - - - - - --- - - - - - 2s - - - - - 3s - - - - - 4s - - - - - 6s - - - - - 8s - - - - - 10s - - - - - 15s - - - - - - - - - - "No Sound" Warning - - - - - - - Low Memory Warning - - - - - - - Haptic Strength - - - - - - - - - Beep volume - - - - - - - -2 - - - 2 - - - 1 - - - Qt::Horizontal - - - - - - - Wav volume - - - - - - - -2 - - - 2 - - - 1 - - - Qt::Horizontal - - - - - - - Vario volume - - - - - - - -2 - - - 2 - - - 1 - - - Qt::Horizontal - - - - - - - Background volume - - - - - - - -2 - - - 2 - - - 1 - - - Qt::Horizontal - - - - - - - - - Stick Mode - - - - - - - - 0 - 0 - - - - Stick reverse (order as above) - - - - - - - - 0 - 0 - - - - Default Channel Order - - - - - - - FAI Mode - - - - - - - - - - - - - Mode selection: - -Mode 1: - Left stick: Elevator, Rudder - Right stick: Throttle, Aileron - -Mode 2: - Left stick: Throttle, Rudder - Right stick: Elevator, Aileron - -Mode 3: - Left stick: Elevator, Aileron - Right stick: Throttle, Rudder - -Mode 4: - Left stick: Throttle, Aileron - Right stick: Elevator, Rudder - - - - - 1 - - - - Mode 1 (RUD ELE THR AIL) - - - - - Mode 2 (RUD THR ELE AIL) - - - - - Mode 3 (AIL ELE THR RUD) - - - - - Mode 4 (AIL THR ELE RUD) - - - - - - - - - - 1 - - - - - - - 2 - - - - - - - 3 - - - - - - - 4 - - - - - - - - - - - - - - - <html><head/><body><p>Channel order</p><p><br/></p><p>Defines the order of the default mixes created on a new model.</p></body></html> - - - 0 - - - - R E T A - - - - - R E A T - - - - - R T E A - - - - - R T A E - - - - - R A E T - - - - - R A T E - - - - - E R T A - - - - - E R A T - - - - - E T R A - - - - - E T A R - - - - - E A R T - - - - - E A T R - - - - - T R E A - - - - - T R A E - - - - - T E R A - - - - - T E A R - - - - - T A R E - - - - - T A E R - - - - - A R E T - - - - - A R T E - - - - - A E R T - - - - - A E T R - - - - - A T R E - - - - - A T E R - - - - - - - - If you enable FAI, you loose the vario, the play functions, the telemetry screen. This function cannot be disabled by the radio. - - - - - - - - - - - 0 - 0 - - - - Play Delay (switch mid position) - - - - - - - - - - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">LCD Screen Contrast</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">Values can be 20-45</span></p></body></html> - - - ms - - - 0 - - - 300 - - - 10 - - - 0 - - - - - - - Backlight flash on alarm - - - - - - - - - - - - - - - Trainer - - - - - - - - - - - - - - - -125 - - - 125 - - - - - - - Mode - - - - - - - Input - - - - - - - Weight - - - - - - - - 0 - 0 - - - - Rud - - - - - - - - - - - - - Beeper volume - -0 - Quiet. No beeps at all. -1 - No Keys. Normal beeps but menu keys do not beep. -2 - Normal. -3 - Loud. -4 - Extra loud. - - - - Off - - - - - += (Sum) - - - - - := (Replace) - - - - - - - - - - - - - - Beeper volume - -0 - Quiet. No beeps at all. -1 - No Keys. Normal beeps but menu keys do not beep. -2 - Normal. -3 - Loud. -4 - Extra loud. - - - - chn1 - - - - - chn2 - - - - - chn3 - - - - - chn4 - - - - - - - - - - - - - - - - - -125 - - - 125 - - - - - - - - 0 - 0 - - - - Ele - - - - - - - - - - - - - Beeper volume - -0 - Quiet. No beeps at all. -1 - No Keys. Normal beeps but menu keys do not beep. -2 - Normal. -3 - Loud. -4 - Extra loud. - - - - Off - - - - - += (Sum) - - - - - := (Replace) - - - - - - - - - - - - - - Beeper volume - -0 - Quiet. No beeps at all. -1 - No Keys. Normal beeps but menu keys do not beep. -2 - Normal. -3 - Loud. -4 - Extra loud. - - - - chn1 - - - - - chn2 - - - - - chn3 - - - - - chn4 - - - - - - - - - - - - - - Beeper volume - -0 - Quiet. No beeps at all. -1 - No Keys. Normal beeps but menu keys do not beep. -2 - Normal. -3 - Loud. -4 - Extra loud. - - - - chn1 - - - - - chn2 - - - - - chn3 - - - - - chn4 - - - - - - - - - - - - - - - - - -125 - - - 125 - - - - - - - - 0 - 0 - - - - Thr - - - - - - - - - - - - - Beeper volume - -0 - Quiet. No beeps at all. -1 - No Keys. Normal beeps but menu keys do not beep. -2 - Normal. -3 - Loud. -4 - Extra loud. - - - - Off - - - - - += (Sum) - - - - - := (Replace) - - - - - - - - - 0 - 0 - - - - Ail - - - - - - - - - - - - - Beeper volume - -0 - Quiet. No beeps at all. -1 - No Keys. Normal beeps but menu keys do not beep. -2 - Normal. -3 - Loud. -4 - Extra loud. - - - - Off - - - - - += (Sum) - - - - - := (Replace) - - - - - - - - - - - - - - Beeper volume - -0 - Quiet. No beeps at all. -1 - No Keys. Normal beeps but menu keys do not beep. -2 - Normal. -3 - Loud. -4 - Extra loud. - - - - chn1 - - - - - chn2 - - - - - chn3 - - - - - chn4 - - - - - - - - - - - - - - - - - -125 - - - 125 - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - Calibration - - - - - - - - - -9999 - - - 9999 - - - - - - - Pot. 4 - - - - - - - Qt::Vertical - - - - - - - Pot. 3 - - - - - - - - - - -9999 - - - 9999 - - - - - - - Pot. 2 - - - - - - - Pot. 1 - - - - - - - 1 - - - 5.000000000000000 - - - 1.000000000000000 - - - - - - - PPM 1 - - - - - - - Stick 3 - - - - - - - Negative span - - - Qt::AlignCenter - - - - - - - Mid value - - - Qt::AlignCenter - - - - - - - Positive span - - - Qt::AlignCenter - - - - - - - Stick 1 - - - - - - - - - - -9999 - - - 9999 - - - - - - - - - - -9999 - - - 9999 - - - 0 - - - - - - - - - - -9999 - - - 9999 - - - - - - - Stick 2 - - - - - - - - - - -9999 - - - 9999 - - - - - - - - - - -9999 - - - 9999 - - - - - - - - - - -9999 - - - 9999 - - - - - - - - - - -9999 - - - 9999 - - - - - - - - - - -9999 - - - 9999 - - - - - - - - - - -9999 - - - 9999 - - - - - - - Stick 4 - - - - - - - - - - -9999 - - - 9999 - - - 0 - - - - - - - - - - -9999 - - - 9999 - - - - - - - - - - -9999 - - - 9999 - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Battery - - - - - - - - - - v - - - 1 - - - -9.900000000000000 - - - 9.900000000000000 - - - 0.100000000000000 - - - - - - - PPM Multiplier - - - - - - - - 0 - 0 - - - - - 0 - 10 - - - - QFrame::Sunken - - - 1 - - - Qt::Horizontal - - - - - - - - - - - - - - - - -9999 - - - 9999 - - - - - - - - - - - - - - - - -9999 - - - 9999 - - - - - - - - - - - - - - - - -9999 - - - 9999 - - - - - - - - - - - - - - - - -9999 - - - 9999 - - - - - - - PPM 2 - - - - - - - PPM 3 - - - - - - - PPM 4 - - - - - - - - 0 - 10 - - - - Qt::Horizontal - - - - - - - -49 - - - 49 - - - - - - - Current - - - - - - - - - - -9999 - - - 9999 - - - - - - - - - - -9999 - - - 9999 - - - - - - - - - - -9999 - - - 9999 - - - - - - - - - - -9999 - - - 9999 - - - - - - - - - - -9999 - - - 9999 - - - - - - - - - - -9999 - - - 9999 - - - - - - - - - - -9999 - - - 9999 - - - - - - - - - - -9999 - - - 9999 - - - - - - - - - - -9999 - - - 9999 - - - - - - - - - - -9999 - - - 9999 - - - - - - - Negative span - - - Qt::AlignCenter - - - - - - - Mid value - - - Qt::AlignCenter - - - - - - - Positive span - - - Qt::AlignCenter - - - - - - - - 0 - 10 - - - - Qt::Horizontal - - - - - - - - - - - - - Beeper volume - -0 - Quiet. No beeps at all. -1 - No Keys. Normal beeps but menu keys do not beep. -2 - Normal. -3 - Loud. -4 - Extra loud. - - - - None - - - - - Pot with detent (normal) - - - - - Multipos Switch - - - - - Pot without detent - - - - - - - - S1 Type - - - - - - - - - - - - - Beeper volume - -0 - Quiet. No beeps at all. -1 - No Keys. Normal beeps but menu keys do not beep. -2 - Normal. -3 - Loud. -4 - Extra loud. - - - - None - - - - - Pot with detent (normal) - - - - - Multipos Switch - - - - - Pot without detent - - - - - - - - S2 Type - - - - - - - S3 Type - - - - - - - - - - - - - Beeper volume - -0 - Quiet. No beeps at all. -1 - No Keys. Normal beeps but menu keys do not beep. -2 - Normal. -3 - Loud. -4 - Extra loud. - - - - None - - - - - Pot with detent (normal) - - - - - Multipos Switch - - - - - Pot without detent - - - - - - - - - OFF - - - - - S-Port Mirror - - - - - Debug - - - - - - - - Serial Port - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - - trnMode_1 - trnChn_1 - trnWeight_1 - trnMode_2 - trnChn_2 - trnWeight_2 - trnMode_3 - trnChn_3 - trnWeight_3 - trnMode_4 - trnChn_4 - trnWeight_4 - ana1Neg - ana1Mid - ana1Pos - ana2Neg - ana2Mid - ana2Pos - ana3Neg - ana3Mid - ana3Pos - ana4Neg - ana4Mid - ana4Pos - battCalibDSB - PPM1 - PPM2 - PPM3 - PPM4 - PPM_MultiplierDSB - - - - - - - - 10 - - - 10 - - - true - - - true - - - true - - - diff --git a/companion/src/generaledit/CMakeLists.txt b/companion/src/generaledit/CMakeLists.txt new file mode 100644 index 000000000..4d3572584 --- /dev/null +++ b/companion/src/generaledit/CMakeLists.txt @@ -0,0 +1,28 @@ +include_directories(${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) + +set(generaledit_NAMES + generaledit + setup + trainer + calibration +) + +set(generaledit_SRCS +) + +set(generaledit_HDRS +) + +set(generaledit_UIS +) + +foreach(name ${generaledit_NAMES}) + set(generaledit_SRCS ${generaledit_SRCS} ${name}.cpp) + set(generaledit_HDRS ${generaledit_HDRS} ${name}.h) + set(generaledit_UIS ${generaledit_UIS} ${name}.ui) +endforeach() + +qt4_wrap_ui(generaledit_SRCS ${generaledit_UIS}) +qt4_wrap_cpp(generaledit_SRCS ${generaledit_HDRS}) + +add_library(generaledit ${generaledit_SRCS}) \ No newline at end of file diff --git a/companion/src/generaledit/calibration.cpp b/companion/src/generaledit/calibration.cpp new file mode 100755 index 000000000..1c8120cc7 --- /dev/null +++ b/companion/src/generaledit/calibration.cpp @@ -0,0 +1,299 @@ +#include "calibration.h" +#include "ui_calibration.h" + +CalibrationPanel::CalibrationPanel(QWidget * parent, GeneralSettings & generalSettings, FirmwareInterface * firmware): + GeneralPanel(parent, generalSettings, firmware), + ui(new Ui::Calibration) +{ + ui->setupUi(this); + + if (firmware->getCapability(MultiposPots)) { + ui->pot1Type->setCurrentIndex(generalSettings.potsType[0]); + ui->pot2Type->setCurrentIndex(generalSettings.potsType[1]); + ui->pot3Type->setCurrentIndex(generalSettings.potsType[2]); + } + else { + ui->potsTypeSeparator->hide(); + ui->pot1Type->hide(); + ui->pot1TypeLabel->hide(); + ui->pot2Type->hide(); + ui->pot2TypeLabel->hide(); + ui->pot3Type->hide(); + ui->pot3TypeLabel->hide(); + } + + int potsCount = GetCurrentFirmware()->getCapability(Pots); + if (potsCount == 3) { + ui->label_pot4->hide(); + ui->ana8Neg->hide(); + ui->ana8Mid->hide(); + ui->ana8Pos->hide(); + } + + if (IS_TARANIS(firmware->getBoard())) { + ui->serialPortMode->setCurrentIndex(generalSettings.hw_uartMode); + } + else { + ui->serialPortMode->hide(); + ui->serialPortLabel->hide(); + } + + disableMouseScrolling(); +} + +CalibrationPanel::~CalibrationPanel() +{ + delete ui; +} + +void CalibrationPanel::on_PPM_MultiplierDSB_editingFinished() +{ + generalSettings.PPM_Multiplier = (int)(ui->PPM_MultiplierDSB->value()*10)-10; + emit modified(); +} + +void CalibrationPanel::on_PPM1_editingFinished() +{ + generalSettings.trainer.calib[0] = ui->PPM1->value(); + emit modified(); +} + +void CalibrationPanel::on_PPM2_editingFinished() +{ + generalSettings.trainer.calib[1] = ui->PPM2->value(); + emit modified(); +} + +void CalibrationPanel::on_PPM3_editingFinished() +{ + generalSettings.trainer.calib[2] = ui->PPM3->value(); + emit modified(); +} + +void CalibrationPanel::on_PPM4_editingFinished() +{ + generalSettings.trainer.calib[3] = ui->PPM4->value(); + emit modified(); +} + + +void CalibrationPanel::on_CurrentCalib_SB_editingFinished() +{ + generalSettings.currentCalib = ui->CurrentCalib_SB->value(); + emit modified(); +} + +void CalibrationPanel::setValues() +{ + ui->battCalibDSB->setValue((double)generalSettings.vBatCalib/10); + ui->CurrentCalib_SB->setValue((double)generalSettings.currentCalib); + + ui->ana1Neg->setValue(generalSettings.calibSpanNeg[0]); + ui->ana2Neg->setValue(generalSettings.calibSpanNeg[1]); + ui->ana3Neg->setValue(generalSettings.calibSpanNeg[2]); + ui->ana4Neg->setValue(generalSettings.calibSpanNeg[3]); + ui->ana5Neg->setValue(generalSettings.calibSpanNeg[4]); + ui->ana6Neg->setValue(generalSettings.calibSpanNeg[5]); + ui->ana7Neg->setValue(generalSettings.calibSpanNeg[6]); + ui->ana8Neg->setValue(generalSettings.calibSpanNeg[7]); + + ui->ana1Mid->setValue(generalSettings.calibMid[0]); + ui->ana2Mid->setValue(generalSettings.calibMid[1]); + ui->ana3Mid->setValue(generalSettings.calibMid[2]); + ui->ana4Mid->setValue(generalSettings.calibMid[3]); + ui->ana5Mid->setValue(generalSettings.calibMid[4]); + ui->ana6Mid->setValue(generalSettings.calibMid[5]); + ui->ana7Mid->setValue(generalSettings.calibMid[6]); + ui->ana8Mid->setValue(generalSettings.calibMid[7]); + + ui->ana1Pos->setValue(generalSettings.calibSpanPos[0]); + ui->ana2Pos->setValue(generalSettings.calibSpanPos[1]); + ui->ana3Pos->setValue(generalSettings.calibSpanPos[2]); + ui->ana4Pos->setValue(generalSettings.calibSpanPos[3]); + ui->ana5Pos->setValue(generalSettings.calibSpanPos[4]); + ui->ana6Pos->setValue(generalSettings.calibSpanPos[5]); + ui->ana7Pos->setValue(generalSettings.calibSpanPos[6]); + ui->ana8Pos->setValue(generalSettings.calibSpanPos[7]); + + ui->PPM1->setValue(generalSettings.trainer.calib[0]); + ui->PPM2->setValue(generalSettings.trainer.calib[1]); + ui->PPM3->setValue(generalSettings.trainer.calib[2]); + ui->PPM4->setValue(generalSettings.trainer.calib[3]); + ui->PPM_MultiplierDSB->setValue((qreal)(generalSettings.PPM_Multiplier+10)/10); +} + +void CalibrationPanel::on_battCalibDSB_editingFinished() +{ + generalSettings.vBatCalib = ui->battCalibDSB->value()*10; + emit modified(); +} + + +void CalibrationPanel::on_ana1Neg_editingFinished() +{ + generalSettings.calibSpanNeg[0] = ui->ana1Neg->value(); + emit modified(); +} + +void CalibrationPanel::on_ana2Neg_editingFinished() +{ + generalSettings.calibSpanNeg[1] = ui->ana2Neg->value(); + emit modified(); +} + +void CalibrationPanel::on_ana3Neg_editingFinished() +{ + generalSettings.calibSpanNeg[2] = ui->ana3Neg->value(); + emit modified(); +} + +void CalibrationPanel::on_ana4Neg_editingFinished() +{ + generalSettings.calibSpanNeg[3] = ui->ana4Neg->value(); + emit modified(); +} + +void CalibrationPanel::on_ana5Neg_editingFinished() +{ + generalSettings.calibSpanNeg[4] = ui->ana5Neg->value(); + emit modified(); +} + +void CalibrationPanel::on_ana6Neg_editingFinished() +{ + generalSettings.calibSpanNeg[5] = ui->ana6Neg->value(); + emit modified(); +} + +void CalibrationPanel::on_ana7Neg_editingFinished() +{ + generalSettings.calibSpanNeg[6] = ui->ana7Neg->value(); + emit modified(); +} + +void CalibrationPanel::on_ana8Neg_editingFinished() +{ + generalSettings.calibSpanNeg[7] = ui->ana8Neg->value(); + emit modified(); +} + +void CalibrationPanel::on_ana1Mid_editingFinished() +{ + generalSettings.calibMid[0] = ui->ana1Mid->value(); + emit modified(); +} + +void CalibrationPanel::on_ana2Mid_editingFinished() +{ + generalSettings.calibMid[1] = ui->ana2Mid->value(); + emit modified(); +} + +void CalibrationPanel::on_ana3Mid_editingFinished() +{ + generalSettings.calibMid[2] = ui->ana3Mid->value(); + emit modified(); +} + +void CalibrationPanel::on_ana4Mid_editingFinished() +{ + generalSettings.calibMid[3] = ui->ana4Mid->value(); + emit modified(); +} + +void CalibrationPanel::on_ana5Mid_editingFinished() +{ + generalSettings.calibMid[4] = ui->ana5Mid->value(); + emit modified(); +} + +void CalibrationPanel::on_ana6Mid_editingFinished() +{ + generalSettings.calibMid[5] = ui->ana6Mid->value(); + emit modified(); +} + +void CalibrationPanel::on_ana7Mid_editingFinished() +{ + generalSettings.calibMid[6] = ui->ana7Mid->value(); + emit modified(); +} + +void CalibrationPanel::on_ana8Mid_editingFinished() +{ + generalSettings.calibMid[7] = ui->ana8Mid->value(); + emit modified(); +} + + +void CalibrationPanel::on_ana1Pos_editingFinished() +{ + generalSettings.calibSpanPos[0] = ui->ana1Pos->value(); + emit modified(); +} + +void CalibrationPanel::on_ana2Pos_editingFinished() +{ + generalSettings.calibSpanPos[1] = ui->ana2Pos->value(); + emit modified(); +} + +void CalibrationPanel::on_ana3Pos_editingFinished() +{ + generalSettings.calibSpanPos[2] = ui->ana3Pos->value(); + emit modified(); +} + +void CalibrationPanel::on_ana4Pos_editingFinished() +{ + generalSettings.calibSpanPos[3] = ui->ana4Pos->value(); + emit modified(); +} + +void CalibrationPanel::on_ana5Pos_editingFinished() +{ + generalSettings.calibSpanPos[4] = ui->ana5Pos->value(); + emit modified(); +} + +void CalibrationPanel::on_ana6Pos_editingFinished() +{ + generalSettings.calibSpanPos[5] = ui->ana6Pos->value(); + emit modified(); +} + +void CalibrationPanel::on_ana7Pos_editingFinished() +{ + generalSettings.calibSpanPos[6] = ui->ana7Pos->value(); + emit modified(); +} + +void CalibrationPanel::on_ana8Pos_editingFinished() +{ + generalSettings.calibSpanPos[7] = ui->ana8Pos->value(); + emit modified(); +} + +void CalibrationPanel::on_pot1Type_currentIndexChanged(int index) +{ + generalSettings.potsType[0] = index; + emit modified(); +} + +void CalibrationPanel::on_pot2Type_currentIndexChanged(int index) +{ + generalSettings.potsType[1] = index; + emit modified(); +} + +void CalibrationPanel::on_pot3Type_currentIndexChanged(int index) +{ + generalSettings.potsType[2] = index; + emit modified(); +} + +void CalibrationPanel::on_serialPortMode_currentIndexChanged(int index) +{ + generalSettings.hw_uartMode = index; + emit modified(); +} diff --git a/companion/src/generaledit/calibration.h b/companion/src/generaledit/calibration.h new file mode 100755 index 000000000..0135ce121 --- /dev/null +++ b/companion/src/generaledit/calibration.h @@ -0,0 +1,67 @@ +#ifndef CALIBRATION_H +#define CALIBRATION_H + +#include "generaledit.h" + +namespace Ui { + class Calibration; +} + +class CalibrationPanel : public GeneralPanel +{ + Q_OBJECT + + public: + CalibrationPanel(QWidget *parent, GeneralSettings & generalSettings, FirmwareInterface * firmware); + virtual ~CalibrationPanel(); + + private slots: + void on_battCalibDSB_editingFinished(); + void on_PPM1_editingFinished(); + void on_PPM2_editingFinished(); + void on_PPM3_editingFinished(); + void on_PPM4_editingFinished(); + void on_PPM_MultiplierDSB_editingFinished(); + + void on_CurrentCalib_SB_editingFinished(); + + void on_ana1Neg_editingFinished(); + void on_ana2Neg_editingFinished(); + void on_ana3Neg_editingFinished(); + void on_ana4Neg_editingFinished(); + void on_ana5Neg_editingFinished(); + void on_ana6Neg_editingFinished(); + void on_ana7Neg_editingFinished(); + void on_ana8Neg_editingFinished(); + + void on_ana1Mid_editingFinished(); + void on_ana2Mid_editingFinished(); + void on_ana3Mid_editingFinished(); + void on_ana4Mid_editingFinished(); + void on_ana5Mid_editingFinished(); + void on_ana6Mid_editingFinished(); + void on_ana7Mid_editingFinished(); + void on_ana8Mid_editingFinished(); + + void on_ana1Pos_editingFinished(); + void on_ana2Pos_editingFinished(); + void on_ana3Pos_editingFinished(); + void on_ana4Pos_editingFinished(); + void on_ana5Pos_editingFinished(); + void on_ana6Pos_editingFinished(); + void on_ana7Pos_editingFinished(); + void on_ana8Pos_editingFinished(); + + + void on_pot1Type_currentIndexChanged(int index); + void on_pot2Type_currentIndexChanged(int index); + void on_pot3Type_currentIndexChanged(int index); + void on_serialPortMode_currentIndexChanged(int index); + + private: + Ui::Calibration *ui; + + void setValues(); +}; + +#endif // CALIBRATION_H diff --git a/companion/src/generaledit/calibration.ui b/companion/src/generaledit/calibration.ui new file mode 100755 index 000000000..44cef4ddd --- /dev/null +++ b/companion/src/generaledit/calibration.ui @@ -0,0 +1,863 @@ + + + Calibration + + + + 0 + 0 + 717 + 431 + + + + Form + + + + + + + + + -9999 + + + 9999 + + + + + + + Pot. 4 + + + + + + + Qt::Vertical + + + + + + + Pot. 3 + + + + + + + + + + -9999 + + + 9999 + + + + + + + Pot. 2 + + + + + + + Pot. 1 + + + + + + + 1 + + + 5.000000000000000 + + + 1.000000000000000 + + + + + + + PPM 1 + + + + + + + Stick 3 + + + + + + + Negative span + + + Qt::AlignCenter + + + + + + + Mid value + + + Qt::AlignCenter + + + + + + + Positive span + + + Qt::AlignCenter + + + + + + + Stick 1 + + + + + + + + + + -9999 + + + 9999 + + + + + + + + + + -9999 + + + 9999 + + + 0 + + + + + + + + + + -9999 + + + 9999 + + + + + + + Stick 2 + + + + + + + + + + -9999 + + + 9999 + + + + + + + + + + -9999 + + + 9999 + + + + + + + + + + -9999 + + + 9999 + + + + + + + + + + -9999 + + + 9999 + + + + + + + + + + -9999 + + + 9999 + + + + + + + + + + -9999 + + + 9999 + + + + + + + Stick 4 + + + + + + + + + + -9999 + + + 9999 + + + 0 + + + + + + + + + + -9999 + + + 9999 + + + + + + + + + + -9999 + + + 9999 + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Battery + + + + + + + + + + v + + + 1 + + + -9.900000000000000 + + + 9.900000000000000 + + + 0.100000000000000 + + + + + + + PPM Multiplier + + + + + + + + 0 + 0 + + + + + 0 + 10 + + + + QFrame::Sunken + + + 1 + + + Qt::Horizontal + + + + + + + + + + + + + + + + -9999 + + + 9999 + + + + + + + + + + + + + + + + -9999 + + + 9999 + + + + + + + + + + + + + + + + -9999 + + + 9999 + + + + + + + + + + + + + + + + -9999 + + + 9999 + + + + + + + PPM 2 + + + + + + + PPM 3 + + + + + + + PPM 4 + + + + + + + + 0 + 10 + + + + Qt::Horizontal + + + + + + + -49 + + + 49 + + + + + + + Current + + + + + + + + + + -9999 + + + 9999 + + + + + + + + + + -9999 + + + 9999 + + + + + + + + + + -9999 + + + 9999 + + + + + + + + + + -9999 + + + 9999 + + + + + + + + + + -9999 + + + 9999 + + + + + + + + + + -9999 + + + 9999 + + + + + + + + + + -9999 + + + 9999 + + + + + + + + + + -9999 + + + 9999 + + + + + + + + + + -9999 + + + 9999 + + + + + + + + + + -9999 + + + 9999 + + + + + + + Negative span + + + Qt::AlignCenter + + + + + + + Mid value + + + Qt::AlignCenter + + + + + + + Positive span + + + Qt::AlignCenter + + + + + + + + 0 + 10 + + + + Qt::Horizontal + + + + + + + + + + + + + Beeper volume + +0 - Quiet. No beeps at all. +1 - No Keys. Normal beeps but menu keys do not beep. +2 - Normal. +3 - Loud. +4 - Extra loud. + + + + None + + + + + Pot with detent (normal) + + + + + Multipos Switch + + + + + Pot without detent + + + + + + + + S1 Type + + + + + + + + + + + + + Beeper volume + +0 - Quiet. No beeps at all. +1 - No Keys. Normal beeps but menu keys do not beep. +2 - Normal. +3 - Loud. +4 - Extra loud. + + + + None + + + + + Pot with detent (normal) + + + + + Multipos Switch + + + + + Pot without detent + + + + + + + + S2 Type + + + + + + + S3 Type + + + + + + + + + + + + + Beeper volume + +0 - Quiet. No beeps at all. +1 - No Keys. Normal beeps but menu keys do not beep. +2 - Normal. +3 - Loud. +4 - Extra loud. + + + + None + + + + + Pot with detent (normal) + + + + + Multipos Switch + + + + + Pot without detent + + + + + + + + + OFF + + + + + S-Port Mirror + + + + + Debug + + + + + + + + Serial Port + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + diff --git a/companion/src/generaledit/generaledit.cpp b/companion/src/generaledit/generaledit.cpp new file mode 100644 index 000000000..94079ada2 --- /dev/null +++ b/companion/src/generaledit/generaledit.cpp @@ -0,0 +1,239 @@ +#include +#include +#include +#include "generaledit.h" +#include "ui_generaledit.h" +#include "helpers.h" +#include "appdata.h" +#include "setup.h" +#include "trainer.h" +#include "calibration.h" + +GeneralPanel::GeneralPanel(QWidget * parent, GeneralSettings & generalSettings, FirmwareInterface * firmware): + GenericPanel(parent), + generalSettings(generalSettings), + firmware(firmware) +{ +} + +GeneralPanel::~GeneralPanel() +{ +} + +GeneralEdit::GeneralEdit(QWidget * parent, RadioData & radioData, FirmwareInterface * firmware) : + QDialog(parent), + ui(new Ui::GeneralEdit), + generalSettings(radioData.generalSettings), + firmware(firmware) +{ + ui->setupUi(this); + this->setWindowIcon(CompanionIcon("open.png")); + + QString firmware_id = g.profile[g.id()].fwType(); + ui->tabWidget->setCurrentIndex( g.generalEditTab() ); + QString name=g.profile[g.id()].name(); + if (name.isEmpty()) { + ui->calstore_PB->setDisabled(true); + } + + ui->profile_CB->clear(); + for (int i=0; iprofile_CB->addItem(name, i); + if (i==g.id()) { + ui->profile_CB->setCurrentIndex(ui->profile_CB->count()-1); + } + } + } + + addTab(new GeneralSetupPanel(this, generalSettings, firmware), tr("Setup")); + addTab(new TrainerPanel(this, generalSettings, firmware), tr("Trainer")); + addTab(new CalibrationPanel(this, generalSettings, firmware), tr("Calibration")); +} + +GeneralEdit::~GeneralEdit() +{ + delete ui; +} + +void GeneralEdit::addTab(GeneralPanel *panel, QString text) +{ + panels << panel; + QWidget * widget = new QWidget(ui->tabWidget); + QVBoxLayout *baseLayout = new QVBoxLayout(widget); + VerticalScrollArea * area = new VerticalScrollArea(widget, panel); + baseLayout->addWidget(area); + ui->tabWidget->addTab(widget, text); + connect(panel, SIGNAL(modified()), this, SLOT(onTabModified())); +} + +void GeneralEdit::onTabModified() +{ + emit modified(); +} + +void GeneralEdit::on_tabWidget_currentChanged(int index) +{ + g.generalEditTab(index); +} + +void GeneralEdit::on_calretrieve_PB_clicked() +{ + int profile_id=ui->profile_CB->itemData(ui->profile_CB->currentIndex()).toInt(); + QString calib=g.profile[profile_id].stickPotCalib(); + int potsnum=GetCurrentFirmware()->getCapability(Pots); + if (calib.isEmpty()) { + return; + } + else { + QString trainercalib = g.profile[profile_id].trainerCalib(); + int8_t vBatCalib = (int8_t)g.profile[profile_id].vBatCalib(); + int8_t currentCalib = (int8_t)g.profile[profile_id].currentCalib(); + int8_t PPM_Multiplier = (int8_t)g.profile[profile_id].ppmMultiplier(); + uint8_t GSStickMode = (uint8_t)g.profile[profile_id].gsStickMode(); + uint8_t vBatWarn = (uint8_t)g.profile[profile_id].vBatWarn(); + QString DisplaySet = g.profile[profile_id].display(); + QString BeeperSet = g.profile[profile_id].beeper(); + QString HapticSet = g.profile[profile_id].haptic(); + QString SpeakerSet = g.profile[profile_id].speaker(); + QString CountrySet = g.profile[profile_id].countryCode(); + + if ((calib.length()==(NUM_STICKS+potsnum)*12) && (trainercalib.length()==16)) { + QString Byte; + int16_t byte16; + bool ok; + for (int i=0; i<(NUM_STICKS+potsnum); i++) { + Byte=calib.mid(i*12,4); + byte16=(int16_t)Byte.toInt(&ok,16); + if (ok) + generalSettings.calibMid[i]=byte16; + Byte=calib.mid(4+i*12,4); + byte16=(int16_t)Byte.toInt(&ok,16); + if (ok) + generalSettings.calibSpanNeg[i]=byte16; + Byte=calib.mid(8+i*12,4); + byte16=(int16_t)Byte.toInt(&ok,16); + if (ok) + generalSettings.calibSpanPos[i]=byte16; + } + for (int i=0; i<4; i++) { + Byte=trainercalib.mid(i*4,4); + byte16=(int16_t)Byte.toInt(&ok,16); + if (ok) + generalSettings.trainer.calib[i]=byte16; + } + generalSettings.currentCalib=currentCalib; + generalSettings.vBatCalib=vBatCalib; + generalSettings.vBatWarn=vBatWarn; + generalSettings.PPM_Multiplier=PPM_Multiplier; + } else { + QMessageBox::critical(this, tr("Warning"), tr("Wrong data in profile, radio calibration was not retrieved")); + } + if ((DisplaySet.length()==6) && (BeeperSet.length()==4) && (HapticSet.length()==6) && (SpeakerSet.length()==6)) { + generalSettings.stickMode=GSStickMode; + uint8_t byte8u; + int8_t byte8; + QString chars; + bool ok; + byte8=(int8_t)DisplaySet.mid(0,2).toInt(&ok,16); + if (ok) + generalSettings.optrexDisplay=(byte8==1 ? true : false); + byte8u=(uint8_t)DisplaySet.mid(2,2).toUInt(&ok,16); + if (ok) + generalSettings.contrast=byte8u; + byte8u=(uint8_t)DisplaySet.mid(4,2).toUInt(&ok,16); + if (ok) + generalSettings.backlightBright=byte8u; + byte8=(int8_t)BeeperSet.mid(0,2).toUInt(&ok,16); + if (ok) + generalSettings.beeperMode=(BeeperMode)byte8; + byte8=(int8_t)BeeperSet.mid(2,2).toInt(&ok,16); + if (ok) + generalSettings.beeperLength=byte8; + byte8=(int8_t)HapticSet.mid(0,2).toUInt(&ok,16); + if (ok) + generalSettings.hapticMode=(BeeperMode)byte8; + byte8=(int8_t)HapticSet.mid(2,2).toInt(&ok,16); + if (ok) + generalSettings.hapticStrength=byte8; + byte8=(int8_t)HapticSet.mid(4,2).toInt(&ok,16); + if (ok) + generalSettings.hapticLength=byte8; + byte8u=(uint8_t)SpeakerSet.mid(0,2).toUInt(&ok,16); + if (ok) + generalSettings.speakerMode=byte8u; + byte8u=(uint8_t)SpeakerSet.mid(2,2).toUInt(&ok,16); + if (ok) + generalSettings.speakerPitch=byte8u; + byte8u=(uint8_t)SpeakerSet.mid(4,2).toUInt(&ok,16); + if (ok) + generalSettings.speakerVolume=byte8u; + if (CountrySet.length()==6) { + byte8u=(uint8_t)CountrySet.mid(0,2).toUInt(&ok,16); + if (ok) + generalSettings.countryCode=byte8u; + byte8u=(uint8_t)CountrySet.mid(2,2).toUInt(&ok,16); + if (ok) + generalSettings.imperial=byte8u; + chars=CountrySet.mid(4,2); + generalSettings.ttsLanguage[0]=chars[0].toAscii(); + generalSettings.ttsLanguage[1]=chars[1].toAscii(); + } + } + else { + QMessageBox::critical(this, tr("Warning"), tr("Wrong data in profile, hw related parameters were not retrieved")); + } + } + + emit modified(); +} + +void GeneralEdit::on_calstore_PB_clicked() +{ + int profile_id=ui->profile_CB->itemData(ui->profile_CB->currentIndex()).toInt(); + + QString name=g.profile[profile_id].name(); + int potsnum=GetCurrentFirmware()->getCapability(Pots); + if (name.isEmpty()) { + ui->calstore_PB->setDisabled(true); + return; + } + else { + QString calib=g.profile[profile_id].stickPotCalib(); + if (!(calib.isEmpty())) { + int ret = QMessageBox::question(this, "Companion", + tr("Do you want to store calibration in %1 profile
overwriting existing calibration?").arg(name) , + QMessageBox::Yes | QMessageBox::No); + if (ret == QMessageBox::No) { + return; + } + } + calib.clear(); + for (int i=0; i< (NUM_STICKS+potsnum); i++) { + calib.append(QString("%1").arg((uint16_t)generalSettings.calibMid[i], 4, 16, QChar('0'))); + calib.append(QString("%1").arg((uint16_t)generalSettings.calibSpanNeg[i], 4, 16, QChar('0'))); + calib.append(QString("%1").arg((uint16_t)generalSettings.calibSpanPos[i], 4, 16, QChar('0'))); + } + g.profile[profile_id].stickPotCalib( calib ); + calib.clear(); + for (int i=0; i< 4; i++) { + calib.append(QString("%1").arg((uint16_t)generalSettings.trainer.calib[i], 4, 16, QChar('0'))); + } + g.profile[profile_id].trainerCalib( calib ); + g.profile[profile_id].vBatCalib( generalSettings.vBatCalib ); + g.profile[profile_id].currentCalib( generalSettings.currentCalib ); + g.profile[profile_id].vBatWarn( generalSettings.vBatWarn ); + g.profile[profile_id].ppmMultiplier( generalSettings.PPM_Multiplier ); + g.profile[profile_id].gsStickMode( generalSettings.stickMode ); + g.profile[profile_id].display( QString("%1%2%3").arg((generalSettings.optrexDisplay ? 1:0), 2, 16, QChar('0')).arg((uint8_t)generalSettings.contrast, 2, 16, QChar('0')).arg((uint8_t)generalSettings.backlightBright, 2, 16, QChar('0')) ); + g.profile[profile_id].beeper( QString("%1%2").arg(((uint8_t)generalSettings.beeperMode), 2, 16, QChar('0')).arg((uint8_t)generalSettings.beeperLength, 2, 16, QChar('0'))); + g.profile[profile_id].haptic( QString("%1%2%3").arg(((uint8_t)generalSettings.hapticMode), 2, 16, QChar('0')).arg((int8_t)generalSettings.hapticStrength, 2, 16, QChar('0')).arg((uint8_t)generalSettings.hapticLength, 2, 16, QChar('0'))); + g.profile[profile_id].speaker( QString("%1%2%3").arg((uint8_t)generalSettings.speakerMode, 2, 16, QChar('0')).arg((uint8_t)generalSettings.speakerPitch, 2, 16, QChar('0')).arg((uint8_t)generalSettings.speakerVolume, 2, 16, QChar('0'))); + g.profile[profile_id].countryCode( QString("%1%2%3").arg((uint8_t)generalSettings.countryCode, 2, 16, QChar('0')).arg((uint8_t)generalSettings.imperial, 2, 16, QChar('0')).arg(generalSettings.ttsLanguage)); + + QDateTime dateTime = QDateTime::currentDateTime(); + g.profile[profile_id].timeStamp(dateTime.toString("yyyy-MM-dd hh:mm")); + QMessageBox::information(this, "Companion", tr("Calibration and HW parameters saved.")); + } +} diff --git a/companion/src/generaledit/generaledit.h b/companion/src/generaledit/generaledit.h new file mode 100644 index 000000000..11b821d2d --- /dev/null +++ b/companion/src/generaledit/generaledit.h @@ -0,0 +1,60 @@ +#ifndef GENERALEDIT_H +#define GENERALEDIT_H + +#include +#include "eeprominterface.h" +#include "helpers.h" + +namespace Ui { + class GeneralEdit; +} + +class GeneralPanel : public GenericPanel +{ + Q_OBJECT + + public: + GeneralPanel(QWidget *parent, GeneralSettings & generalSettings, FirmwareInterface * firmware); + virtual ~GeneralPanel(); + + protected: + GeneralSettings & generalSettings; + FirmwareInterface * firmware; +}; + +class GeneralEdit : public QDialog +{ + Q_OBJECT + + public: + GeneralEdit(QWidget * parent, RadioData & radioData, FirmwareInterface * firmware); + ~GeneralEdit(); + + private: + Ui::GeneralEdit *ui; + GeneralSettings & generalSettings; + + bool switchDefPosEditLock; + bool voiceLangEditLock; + bool mavbaudEditLock; + void getGeneralSwitchDefPos(int i, bool val); + void setSwitchDefPos(); + void updateVarioPitchRange(); + + signals: + void modified(); + + private slots: + void onTabModified(); + void on_tabWidget_currentChanged(int index); + void on_calretrieve_PB_clicked(); + void on_calstore_PB_clicked(); + + private: + FirmwareInterface * firmware; + QVector panels; + void addTab(GeneralPanel *panel, QString text); + +}; + +#endif // GENERALEDIT_H diff --git a/companion/src/generaledit/generaledit.ui b/companion/src/generaledit/generaledit.ui new file mode 100644 index 000000000..6fd5f2a2c --- /dev/null +++ b/companion/src/generaledit/generaledit.ui @@ -0,0 +1,136 @@ + + + GeneralEdit + + + + 0 + 0 + 787 + 509 + + + + + 0 + 0 + + + + General Edit + + + true + + + + + + + 0 + 0 + + + + QFrame::Panel + + + QFrame::Raised + + + + QLayout::SetDefaultConstraint + + + + + + + + 0 + 0 + + + + Retrieve calib. and hw settings from profile + + + + + + + Qt::Horizontal + + + QSizePolicy::Expanding + + + + 10 + 20 + + + + + + + + + 0 + 0 + + + + Store calib. and hw settings in selected profile + + + + + + + + + + + + + + + + 0 + 0 + + + + General settings used throught the transmitter. +These will be relevant for all models in the same EEPROM. + + + -1 + + + + + + + + + + + + 10 + + + 10 + + + true + + + true + + + true + + + diff --git a/companion/src/generaledit/setup.cpp b/companion/src/generaledit/setup.cpp new file mode 100755 index 000000000..b93342390 --- /dev/null +++ b/companion/src/generaledit/setup.cpp @@ -0,0 +1,610 @@ +#include "setup.h" +#include "ui_setup.h" +#include + +GeneralSetupPanel::GeneralSetupPanel(QWidget * parent, GeneralSettings & generalSettings, FirmwareInterface * firmware): + GeneralPanel(parent, generalSettings, firmware), + ui(new Ui::Setup) +{ + ui->setupUi(this); + + QLabel * pmsl[] = {ui->ro_label,ui->ro1_label,ui->ro2_label,ui->ro3_label,ui->ro4_label,ui->ro5_label,ui->ro6_label,ui->ro7_label,ui->ro8_label, NULL}; + QSlider * tpmsld[] = {ui->chkSA, ui->chkSB, ui->chkSC, ui->chkSD, ui->chkSE, ui->chkSF, ui->chkSG, ui->chkSH, NULL}; + + if (IS_TARANIS(firmware->getBoard())) { + ui->contrastSB->setMinimum(0); + if (firmware->getId().contains("readonly")) { + uint16_t switchstate = generalSettings.switchUnlockStates; + ui->chkSA->setValue(switchstate & 0x3); + switchstate >>= 2; + ui->chkSB->setValue(switchstate & 0x3); + switchstate >>= 2; + ui->chkSC->setValue(switchstate & 0x3); + switchstate >>= 2; + ui->chkSD->setValue(switchstate & 0x3); + switchstate >>= 2; + ui->chkSE->setValue(switchstate & 0x3); + switchstate >>= 2; + ui->chkSF->setValue((switchstate & 0x3)/2); + switchstate >>= 2; + ui->chkSG->setValue(switchstate & 0x3); + switchstate >>= 2; + ui->chkSH->setValue(switchstate & 0x3); + } + else { + for (int i=0; pmsl[i]; i++) { + pmsl[i]->hide(); + } + for (int i=0; tpmsld[i]; i++) { + tpmsld[i]->hide(); + } + this->layout()->removeItem(ui->TaranisReadOnlyUnlock); + } + } + else { + for (int i=0; pmsl[i]; i++) { + pmsl[i]->hide(); + } + for (int i=0; tpmsld[i]; i++) { + tpmsld[i]->hide(); + } + this->layout()->removeItem(ui->TaranisReadOnlyUnlock); + } + + lock = true; + + populateBacklightCB(); + + if (!firmware->getCapability(MultiLangVoice)) { + ui->VoiceLang_label->hide(); + ui->voiceLang_CB->hide(); + } + else { + populateVoiceLangCB(); + } + + if (!firmware->getCapability(MavlinkTelemetry)) { + ui->mavbaud_CB->hide(); + ui->mavbaud_label->hide(); + } + else { + ui->mavbaud_CB->setCurrentIndex(generalSettings.mavbaud); + // TODO why ??? populateVoiceLangCB(ui->voiceLang_CB, generalSettings.ttsLanguage); + } + + if (!firmware->getCapability(HasSoundMixer)) { + ui->beepVolume_SL->hide(); + ui->beepVolume_label->hide(); + ui->varioVolume_SL->hide(); + ui->varioVolume_label->hide(); + ui->bgVolume_SL->hide(); + ui->bgVolume_label->hide(); + ui->wavVolume_SL->hide(); + ui->wavVolume_label->hide(); + ui->varioP0_label->hide(); + ui->varioP0_SB->hide(); + ui->varioPMax_label->hide(); + ui->varioPMax_SB->hide(); + ui->varioR0_label->hide(); + ui->varioR0_SB->hide(); + } + else { + ui->beepVolume_SL->setValue(generalSettings.beepVolume); + ui->varioVolume_SL->setValue(generalSettings.varioVolume); + ui->bgVolume_SL->setValue(generalSettings.backgroundVolume); + ui->wavVolume_SL->setValue(generalSettings.wavVolume); + ui->varioP0_SB->setValue(700+(generalSettings.varioPitch*10)); + updateVarioPitchRange(); + ui->varioPMax_SB->setValue(700+(generalSettings.varioPitch*10)+1000+(generalSettings.varioRange*10)); + ui->varioR0_SB->setValue(500+(generalSettings.varioRepeat*10)); + } + + if (!firmware->getCapability(HasFAIMode)) { + ui->faimode_CB->hide(); + ui->label_faimode->hide(); + } + else { + ui->faimode_CB->setChecked(generalSettings.fai); + } + + if (!firmware->getCapability(HasPxxCountry)) { + ui->countrycode_label->hide(); + ui->countrycode_CB->hide(); + } + else { + ui->countrycode_CB->setCurrentIndex(generalSettings.countryCode); + } + + if (!firmware->getCapability(HasGeneralUnits)) { + ui->units_label->hide(); + ui->units_CB->hide(); + } + else { + ui->units_CB->setCurrentIndex(generalSettings.imperial); + } + + if (!firmware->getCapability(TelemetryTimeshift)) { + ui->label_timezone->hide(); + ui->timezoneSB->hide(); + ui->timezoneSB->setDisabled(true); + ui->gpsFormatCB->hide(); + ui->gpsFormatLabel->hide(); + } + + ui->gpsFormatCB->setCurrentIndex(generalSettings.gpsFormat); + ui->timezoneSB->setValue(generalSettings.timezone); + + if (!firmware->getCapability(OptrexDisplay)) { + ui->label_displayType->hide(); + ui->displayTypeCB->setDisabled(true); + ui->displayTypeCB->hide(); + } + + if (!firmware->getCapability(HasVolume)) { + ui->volume_SB->hide(); + ui->volume_SB->setDisabled(true); + ui->label_volume->hide(); + } + else { + ui->volume_SB->setMaximum(firmware->getCapability(MaxVolume)); + } + + if (!firmware->getCapability(HasBrightness)) { + ui->BLBright_SB->hide(); + ui->BLBright_SB->setDisabled(true); + ui->label_BLBright->hide(); + } + + if (!firmware->getCapability(SoundMod)) { + ui->soundModeCB->setDisabled(true); + ui->label_soundMode->hide(); + ui->soundModeCB->hide(); + } + + if (!firmware->getCapability(SoundPitch)) { + ui->speakerPitchSB->setDisabled(true); + ui->label_speakerPitch->hide(); + ui->speakerPitchSB->hide(); + } + + if (!firmware->getCapability(Haptic)) { + ui->hapticStrength->setDisabled(true); + ui->hapticmodeCB->setDisabled(true); + } + + int reCount = firmware->getCapability(RotaryEncoders); + if (reCount==0) { + ui->re_label->hide(); + ui->re_CB->hide(); + } + else { + populateRotEncCB(reCount); + } + + ui->contrastSB->setValue(generalSettings.contrast); + ui->battwarningDSB->setValue((double)generalSettings.vBatWarn/10); + ui->backlightautoSB->setValue(generalSettings.backlightDelay*5); + ui->inactimerSB->setValue(generalSettings.inactivityTimer); + + ui->memwarnChkB->setChecked(!generalSettings.disableMemoryWarning); //Default is zero=checked + ui->alarmwarnChkB->setChecked(!generalSettings.disableAlarmWarning);//Default is zero=checked + + if (IS_TARANIS(GetEepromInterface()->getBoard())) { + ui->splashScreenChkB->hide(); + ui->splashScreenDuration->setCurrentIndex(3-generalSettings.splashDuration); + } + else { + ui->splashScreenDuration->hide(); + ui->splashScreenChkB->setChecked(!generalSettings.splashMode); + } + + setValues(); + + lock = false; + + for (int i=0; tpmsld[i]; i++) { + connect(tpmsld[i], SIGNAL(valueChanged(int)),this,SLOT(unlockSwitchEdited())); + } + + if (!IS_TARANIS(firmware->getBoard())) { + ui->stickReverse1->setChecked(generalSettings.stickReverse & (1 << 0)); + ui->stickReverse2->setChecked(generalSettings.stickReverse & (1 << 1)); + ui->stickReverse3->setChecked(generalSettings.stickReverse & (1 << 2)); + ui->stickReverse4->setChecked(generalSettings.stickReverse & (1 << 3)); + connect(ui->stickReverse1, SIGNAL(toggled(bool)), this, SLOT(stickReverseEdited())); + connect(ui->stickReverse2, SIGNAL(toggled(bool)), this, SLOT(stickReverseEdited())); + connect(ui->stickReverse3, SIGNAL(toggled(bool)), this, SLOT(stickReverseEdited())); + connect(ui->stickReverse4, SIGNAL(toggled(bool)), this, SLOT(stickReverseEdited())); + } + else { + ui->stickReverseLB->hide(); + ui->stickReverse1->hide(); + ui->stickReverse2->hide(); + ui->stickReverse3->hide(); + ui->stickReverse4->hide(); + } + + if (IS_TARANIS_PLUS(firmware->getBoard())) { + ui->backlightColor_SL->setValue(generalSettings.backlightColor); + } + else { + ui->backlightColor_label->hide(); + ui->backlightColor_SL->hide(); + ui->backlightColor1_label->hide(); + ui->backlightColor2_label->hide(); + } + + if (IS_ARM(firmware->getBoard())) { + ui->switchesDelay->setValue(10*(generalSettings.switchesDelay+15)); + } + else { + ui->switchesDelay->hide(); + ui->switchesDelayLabel->hide(); + } + ui->blAlarm_ChkB->setChecked(generalSettings.flashBeep); + + disableMouseScrolling(); +} + +GeneralSetupPanel::~GeneralSetupPanel() +{ + delete ui; +} + +void GeneralSetupPanel::populateBacklightCB() +{ + QComboBox * b = ui->backlightswCB; + QString strings[] = { QObject::tr("OFF"), QObject::tr("Keys"), QObject::tr("Sticks"), QObject::tr("Keys + Sticks"), QObject::tr("ON"), NULL }; + + b->clear(); + for (int i=0; !strings[i].isNull(); i++) { + b->addItem(strings[i], 0); + if (generalSettings.backlightMode == i) { + b->setCurrentIndex(b->count()-1); + } + } +} + +void GeneralSetupPanel::populateVoiceLangCB() +{ + QComboBox * b = ui->voiceLang_CB; + QString strings[] = { QObject::tr("English"), QObject::tr("Finnish"), QObject::tr("French"), QObject::tr("Italian"), QObject::tr("German"), QObject::tr("Czech"), QObject::tr("Slovak"), QObject::tr("Spanish"), QObject::tr("Polish"), QObject::tr("Portuguese"), QObject::tr("Swedish"), NULL}; + QString langcode[] = { "en", "fi","fr", "it", "de", "cz", "sk", "es", "pl", "pt", "se", NULL}; + + b->clear(); + for (int i=0; strings[i]!=NULL; i++) { + b->addItem(strings[i],langcode[i]); + if (generalSettings.ttsLanguage == langcode[i]) { + b->setCurrentIndex(b->count()-1); + } + } +} + +void GeneralSetupPanel::on_backlightswCB_currentIndexChanged(int index) +{ + if (!lock) { + generalSettings.backlightMode = ui->backlightswCB->currentIndex(); + emit modified(); + } +} + +void GeneralSetupPanel::on_backlightColor_SL_valueChanged() +{ + if (!lock) { + generalSettings.backlightColor = ui->backlightColor_SL->value(); + emit modified(); + } +} + +void GeneralSetupPanel::on_mavbaud_CB_currentIndexChanged(int index) +{ + if (!lock) { + generalSettings.mavbaud = ui->mavbaud_CB->currentIndex(); + emit modified(); + } +} + +void GeneralSetupPanel::on_voiceLang_CB_currentIndexChanged(int index) +{ + if (!lock) { + QString code = ui->voiceLang_CB->itemData(index).toString(); + for (int i=0; i<2; i++) { + generalSettings.ttsLanguage[i] = code.at(i).toAscii(); + } + generalSettings.ttsLanguage[2] = '\0'; + emit modified(); + } +} + +void GeneralSetupPanel::updateVarioPitchRange() +{ + ui->varioPMax_SB->setMaximum(700+(generalSettings.varioPitch*10)+1000+800); + ui->varioPMax_SB->setMinimum(700+(generalSettings.varioPitch*10)+1000-800); +} + +void GeneralSetupPanel::populateRotEncCB(int reCount) +{ + QString strings[] = { QObject::tr("No"), QObject::tr("RotEnc A"), QObject::tr("Rot Enc B"), QObject::tr("Rot Enc C"), QObject::tr("Rot Enc D"), QObject::tr("Rot Enc E")}; + QComboBox * b = ui->re_CB; + + b->clear(); + for (int i=0; i<=reCount; i++) { + b->addItem(strings[i]); + } + b->setCurrentIndex(generalSettings.reNavigation); +} + +void GeneralSetupPanel::setValues() +{ + ui->beeperCB->setCurrentIndex(generalSettings.beeperMode+2); + ui->channelorderCB->setCurrentIndex(generalSettings.templateSetup); + ui->stickmodeCB->setCurrentIndex(generalSettings.stickMode); + if (GetCurrentFirmware()->getCapability(Haptic)) { + ui->hapticLengthCB->setCurrentIndex(generalSettings.hapticLength+2); + } + else { + ui->label_HL->hide(); + ui->hapticLengthCB->hide(); + } + ui->BLBright_SB->setValue(100-generalSettings.backlightBright); + ui->soundModeCB->setCurrentIndex(generalSettings.speakerMode); + ui->volume_SB->setValue(generalSettings.speakerVolume); + ui->beeperlenCB->setCurrentIndex(generalSettings.beeperLength+2); + ui->speakerPitchSB->setValue(generalSettings.speakerPitch); + ui->hapticStrength->setValue(generalSettings.hapticStrength); + ui->hapticmodeCB->setCurrentIndex(generalSettings.hapticMode+2); +} + +void GeneralSetupPanel::on_faimode_CB_stateChanged(int) +{ + if (ui->faimode_CB->isChecked()) { + int ret = QMessageBox::question(this, "Companion", + tr("If you enable FAI, you loose the vario, the play functions, the telemetry screen.\nThis function cannot be disabled by the radio.\nAre you sure ?") , + QMessageBox::Yes | QMessageBox::No); + if (ret==QMessageBox::Yes) { + generalSettings.fai = true; + } + else { + ui->faimode_CB->setChecked(false); + } + } + else { + generalSettings.fai = false; + } + emit modified(); +} + +void GeneralSetupPanel::on_speakerPitchSB_editingFinished() +{ + generalSettings.speakerPitch = ui->speakerPitchSB->value(); + emit modified(); +} + +void GeneralSetupPanel::on_hapticStrength_valueChanged() +{ + generalSettings.hapticStrength = ui->hapticStrength->value(); + emit modified(); +} + +void GeneralSetupPanel::on_soundModeCB_currentIndexChanged(int index) +{ + generalSettings.speakerMode = index; + emit modified(); +} + + +void GeneralSetupPanel::on_splashScreenChkB_stateChanged(int ) +{ + generalSettings.splashMode = ui->splashScreenChkB->isChecked() ? 0 : 1; + emit modified(); +} + +void GeneralSetupPanel::on_splashScreenDuration_currentIndexChanged(int index) +{ + generalSettings.splashDuration = 3-index; + emit modified(); +} + + +void GeneralSetupPanel::on_beepVolume_SL_valueChanged() +{ + generalSettings.beepVolume=ui->beepVolume_SL->value(); + emit modified(); +} + +void GeneralSetupPanel::on_wavVolume_SL_valueChanged() +{ + generalSettings.wavVolume=ui->wavVolume_SL->value(); + emit modified(); +} + +void GeneralSetupPanel::on_varioVolume_SL_valueChanged() +{ + generalSettings.varioVolume=ui->varioVolume_SL->value(); + emit modified(); +} + +void GeneralSetupPanel::on_bgVolume_SL_valueChanged() +{ + generalSettings.backgroundVolume=ui->bgVolume_SL->value(); + emit modified(); +} + +void GeneralSetupPanel::on_varioP0_SB_editingFinished() +{ + generalSettings.varioPitch = (ui->varioP0_SB->value()-700)/10; + updateVarioPitchRange(); + emit modified(); +} + +void GeneralSetupPanel::on_varioPMax_SB_editingFinished() +{ + generalSettings.varioRange = (ui->varioPMax_SB->value()-(700+(generalSettings.varioPitch*10))-1000)/10; + emit modified(); +} + +void GeneralSetupPanel::on_varioR0_SB_editingFinished() +{ + generalSettings.varioRepeat = (ui->varioR0_SB->value()-500)/10; + emit modified(); +} + +void GeneralSetupPanel::on_BLBright_SB_editingFinished() +{ + generalSettings.backlightBright = 100 - ui->BLBright_SB->value(); + emit modified(); +} + +void GeneralSetupPanel::on_volume_SB_editingFinished() +{ + generalSettings.speakerVolume = ui->volume_SB->value(); + emit modified(); +} + +void GeneralSetupPanel::on_contrastSB_editingFinished() +{ + generalSettings.contrast = ui->contrastSB->value(); + emit modified(); +} + +void GeneralSetupPanel::on_battwarningDSB_editingFinished() +{ + generalSettings.vBatWarn = (int)(ui->battwarningDSB->value()*10); + emit modified(); +} + +void GeneralSetupPanel::on_re_CB_currentIndexChanged(int index) +{ + generalSettings.reNavigation = ui->re_CB->currentIndex(); + emit modified(); +} + +void GeneralSetupPanel::on_countrycode_CB_currentIndexChanged(int index) +{ + generalSettings.countryCode = ui->countrycode_CB->currentIndex(); + emit modified(); +} + +void GeneralSetupPanel::on_units_CB_currentIndexChanged(int index) +{ + generalSettings.imperial = ui->units_CB->currentIndex(); + emit modified(); +} + +void GeneralSetupPanel::on_beeperlenCB_currentIndexChanged(int index) +{ + generalSettings.beeperLength = index-2; + emit modified(); +} + +void GeneralSetupPanel::on_hapticLengthCB_currentIndexChanged(int index) +{ + generalSettings.hapticLength = index-2; + emit modified(); +} + +void GeneralSetupPanel::on_gpsFormatCB_currentIndexChanged(int index) +{ + generalSettings.gpsFormat = index; + emit modified(); +} + +void GeneralSetupPanel::on_backlightautoSB_editingFinished() +{ + int i = ui->backlightautoSB->value()/5; + if((i*5)!=ui->backlightautoSB->value()) + ui->backlightautoSB->setValue(i*5); + else + { + generalSettings.backlightDelay = i; + emit modified(); + } +} + +void GeneralSetupPanel::on_switchesDelay_valueChanged() +{ + generalSettings.switchesDelay = (ui->switchesDelay->value() / 10) - 15; + emit modified(); +} + +void GeneralSetupPanel::on_timezoneSB_editingFinished() +{ + generalSettings.timezone = ui->timezoneSB->value(); + emit modified(); +} + +void GeneralSetupPanel::on_inactimerSB_editingFinished() +{ + generalSettings.inactivityTimer = ui->inactimerSB->value(); + emit modified(); +} + +void GeneralSetupPanel::on_memwarnChkB_stateChanged(int ) +{ + generalSettings.disableMemoryWarning = ui->memwarnChkB->isChecked() ? 0 : 1; + emit modified(); +} + +void GeneralSetupPanel::on_alarmwarnChkB_stateChanged(int ) +{ + generalSettings.disableAlarmWarning = ui->alarmwarnChkB->isChecked() ? 0 : 1; + emit modified(); +} + +void GeneralSetupPanel::on_beeperCB_currentIndexChanged(int index) +{ + generalSettings.beeperMode = (BeeperMode)(index-2); + emit modified(); +} + +void GeneralSetupPanel::on_displayTypeCB_currentIndexChanged(int index) +{ + generalSettings.optrexDisplay = index; + emit modified(); +} + +void GeneralSetupPanel::on_hapticmodeCB_currentIndexChanged(int index) +{ + generalSettings.hapticMode = (BeeperMode)(index-2); + emit modified(); +} + + +void GeneralSetupPanel::on_channelorderCB_currentIndexChanged(int index) +{ + generalSettings.templateSetup = index; + emit modified(); +} + +void GeneralSetupPanel::on_stickmodeCB_currentIndexChanged(int index) +{ + generalSettings.stickMode = index; + emit modified(); +} + +void GeneralSetupPanel::unlockSwitchEdited() +{ + int i=0; + i|=(((uint16_t)ui->chkSA->value())); + i|=(((uint16_t)ui->chkSB->value())<<2); + i|=(((uint16_t)ui->chkSC->value())<<4); + i|=(((uint16_t)ui->chkSD->value())<<6); + i|=(((uint16_t)ui->chkSE->value())<<8); + i|=(((uint16_t)ui->chkSF->value())<<10); + i|=(((uint16_t)ui->chkSG->value())<<12); + i|=(((uint16_t)ui->chkSH->value())<<14); + generalSettings.switchUnlockStates=i; + emit modified(); +} + +void GeneralSetupPanel::on_blAlarm_ChkB_stateChanged() +{ + generalSettings.flashBeep = ui->blAlarm_ChkB->isChecked(); + emit modified(); +} + +void GeneralSetupPanel::stickReverseEdited() +{ + generalSettings.stickReverse = ((int)ui->stickReverse1->isChecked()) | ((int)ui->stickReverse2->isChecked()<<1) | ((int)ui->stickReverse3->isChecked()<<2) | ((int)ui->stickReverse4->isChecked()<<3); + emit modified(); +} diff --git a/companion/src/generaledit/setup.h b/companion/src/generaledit/setup.h new file mode 100755 index 000000000..efc46c4be --- /dev/null +++ b/companion/src/generaledit/setup.h @@ -0,0 +1,75 @@ +#ifndef SETUP_H +#define SETUP_H + +#include "generaledit.h" +#include "eeprominterface.h" + +namespace Ui { + class Setup; +} + +class GeneralSetupPanel : public GeneralPanel +{ + Q_OBJECT + + public: + GeneralSetupPanel(QWidget *parent, GeneralSettings & generalSettings, FirmwareInterface * firmware); + virtual ~GeneralSetupPanel(); + + private slots: + void on_splashScreenChkB_stateChanged(int); + void on_splashScreenDuration_currentIndexChanged(int index); + void on_alarmwarnChkB_stateChanged(int ); + void on_gpsFormatCB_currentIndexChanged(int index); + void on_displayTypeCB_currentIndexChanged(int index); + void on_BLBright_SB_editingFinished(); + void on_re_CB_currentIndexChanged(int index); + void on_countrycode_CB_currentIndexChanged(int index); + void on_units_CB_currentIndexChanged(int index); + void on_faimode_CB_stateChanged(int ); + void on_speakerPitchSB_editingFinished(); + void on_timezoneSB_editingFinished(); + void on_hapticStrength_valueChanged(); + void on_soundModeCB_currentIndexChanged(int index); + void on_beeperlenCB_currentIndexChanged(int index); + void on_volume_SB_editingFinished(); + void on_hapticmodeCB_currentIndexChanged(int index); + void on_hapticLengthCB_currentIndexChanged(int index); + void on_backlightswCB_currentIndexChanged(int index); + void on_backlightColor_SL_valueChanged(); + void on_mavbaud_CB_currentIndexChanged(int index); + void on_voiceLang_CB_currentIndexChanged(int index); + void stickReverseEdited(); + void on_switchesDelay_valueChanged(); + void on_blAlarm_ChkB_stateChanged(); + void unlockSwitchEdited(); + void on_beepVolume_SL_valueChanged(); + void on_bgVolume_SL_valueChanged(); + void on_varioVolume_SL_valueChanged(); + void on_wavVolume_SL_valueChanged(); + + void on_varioP0_SB_editingFinished(); + void on_varioPMax_SB_editingFinished(); + void on_varioR0_SB_editingFinished(); + void on_stickmodeCB_currentIndexChanged(int index); + void on_channelorderCB_currentIndexChanged(int index); + void on_beeperCB_currentIndexChanged(int index); + void on_memwarnChkB_stateChanged(int ); + void on_inactimerSB_editingFinished(); + void on_backlightautoSB_editingFinished(); + + void on_battwarningDSB_editingFinished(); + void on_contrastSB_editingFinished(); + + + private: + Ui::Setup *ui; + + void setValues(); + void populateBacklightCB(); + void populateVoiceLangCB(); + void populateRotEncCB(int reCount); + void updateVarioPitchRange(); +}; + +#endif // SETUP_H diff --git a/companion/src/generaledit/setup.ui b/companion/src/generaledit/setup.ui new file mode 100755 index 000000000..c17b5f185 --- /dev/null +++ b/companion/src/generaledit/setup.ui @@ -0,0 +1,1939 @@ + + + Setup + + + + 0 + 0 + 689 + 606 + + + + Form + + + + + + GPS Coordinates + + + + + + + Speaker Pitch (spkr only) + + + + + + + + + + Measurement Units + + + + + + + + hh° (N/S) mm' ss''.dd + + + + + NMEA + + + + + + + + -14 + + + 12 + + + 0 + + + + + + + Voice Language + + + + + + + Timeshift from UTC + + + + + + + + Metric + + + + + Imperial + + + + + + + + Country Code + + + + + + + + America + + + + + Japan + + + + + Europe + + + + + + + + -2 + + + 2 + + + 1 + + + Qt::Horizontal + + + + + + + + X-Short + + + + + Short + + + + + Normal + + + + + Long + + + + + X-Long + + + + + + + + + + Color 1 + + + + + + + 20 + + + 5 + + + Qt::Horizontal + + + + + + + Color 2 + + + + + + + + + Beeper Length + + + + + + + RotEnc Navigation + + + + + + + Beeper Mode + + + + + + + Vario pitch at zero + + + + + + + + Standard + + + + + Optrex + + + + + + + + Readonly Unlock + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + + + Qt::Vertical + + + + 20 + 5 + + + + + + + + Sound Mode + + + + + + + + + + + + + Beeper volume + +0 - Quiet. No beeps at all. +1 - No Keys. Normal beeps but menu keys do not beep. +2 - Normal. +3 - Loud. +4 - Extra loud. + + + + Quiet + + + + + Alarms Only + + + + + No Keys + + + + + All + + + + + + + + + Quiet + + + + + Only Alarms + + + + + No Keys + + + + + All + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Haptic Mode + + + + + + + + X-Short + + + + + Short + + + + + Normal + + + + + Long + + + + + X-Long + + + + + + + + + Beeper + + + + + Speaker + + + + + BeeperVoice + + + + + SpeakerVoice + + + + + + + + + + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">LCD Screen Contrast</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">Values can be 20-45</span></p></body></html> + + + 1 + + + 20 + + + 1 + + + + + + + QLayout::SetMinimumSize + + + 0 + + + 0 + + + + + + 0 + 0 + + + + SC + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 0 + 50 + + + + + 16777215 + 50 + + + + 0 + + + 2 + + + 1 + + + 0 + + + Qt::Vertical + + + true + + + QSlider::TicksBothSides + + + 1 + + + + + + + + 0 + 0 + + + + SE + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 0 + 50 + + + + + 16777215 + 50 + + + + 0 + + + 1 + + + 1 + + + 1 + + + 0 + + + Qt::Vertical + + + true + + + QSlider::TicksBothSides + + + 1 + + + + + + + + 0 + 0 + + + + + 0 + 50 + + + + + 16777215 + 50 + + + + 0 + + + 2 + + + 1 + + + 0 + + + Qt::Vertical + + + true + + + QSlider::TicksBothSides + + + 1 + + + + + + + + 0 + 0 + + + + + 0 + 50 + + + + + 16777215 + 50 + + + + 0 + + + 2 + + + 1 + + + 0 + + + Qt::Vertical + + + true + + + QSlider::TicksBothSides + + + 1 + + + + + + + + 0 + 0 + + + + + 0 + 50 + + + + + 16777215 + 50 + + + + 0 + + + 2 + + + 1 + + + 0 + + + Qt::Vertical + + + true + + + QSlider::TicksBothSides + + + 1 + + + + + + + + 0 + 0 + + + + + 0 + 50 + + + + + 16777215 + 50 + + + + 0 + + + 2 + + + 1 + + + 0 + + + Qt::Vertical + + + true + + + QSlider::TicksBothSides + + + 1 + + + + + + + + 0 + 0 + + + + + 0 + 50 + + + + + 16777215 + 50 + + + + 0 + + + 2 + + + 1 + + + 0 + + + Qt::Vertical + + + true + + + QSlider::TicksBothSides + + + 1 + + + + + + + + 0 + 0 + + + + SA + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + SF + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + SH + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + SD + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + SB + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 0 + 50 + + + + + 16777215 + 50 + + + + 0 + + + 1 + + + 1 + + + 1 + + + 0 + + + Qt::Vertical + + + true + + + QSlider::TicksBothSides + + + 1 + + + + + + + + 0 + 0 + + + + SG + + + Qt::AlignCenter + + + + + + + Qt::Horizontal + + + + 40 + 0 + + + + + + + + + + Hz + + + 300 + + + 1100 + + + 10 + + + 700 + + + + + + + + + + Battery Warning + + + + + + + + 0 + 0 + + + + + + + + + + Battery warning voltage. +This is the threashhold where the battery warning sounds. + +Acceptable values are 5v..10v + + + + + + V + + + 1 + + + 4.000000000000000 + + + 12.000000000000000 + + + 0.100000000000000 + + + 9.600000000000000 + + + + + + + Vario pitch at max + + + + + + + + 0 + 0 + + + + + + + + + + If this value is not 0, any keypress will turn on the backlight and turn it off after the specified number of seconds. + + + sec + + + 600 + + + 5 + + + + + + + Hz + + + 1300 + + + 2900 + + + 10 + + + 1700 + + + + + + + ms + + + 200 + + + 1000 + + + 10 + + + 500 + + + + + + + Backlight Brightness + + + + + + + Vario repeat at zero + + + + + + + Backlight Auto OFF after + + + + + + + 100 + + + + + + + + + + Backlight color + + + + + + + + + + Contrast + + + + + + + + 0 + 0 + + + + + + + + + + If not zero will sound beeps if the transmitter has been left without inputs for the specified number of minutes. + + + min + + + 120 + + + + + + + + 4800 Baud + + + + + 9600 Baud + + + + + 14400 Baud + + + + + 19200 Baud + + + + + 38400 Baud + + + + + 57600 Baud + + + + + 76800 Baud + + + + + 115200 Baud + + + + + + + + Backlight Switch + + + + + + + + 0 + 0 + + + + 23 + + + + + + + + 0 + 0 + + + + Show Splash Screen on Startup + + + + + + + + + + + + + This is the switch selectrion for turning on the backlight (if installed). + + + + + -1 + + + + + + + LCD Display Type + + + + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" text-decoration: underline;">Warnings</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">These will define startup warnings.</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Throttle warning - will alert if the throttle is not at idle during startup</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Switch warning - will alert if switches are not in their defaul position</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Memory warning - will alert if there's not a lot of memory left</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Silent mode warning - will alert you if the beeper is set to quiet (0)</p></body></html> + + + + + + true + + + + + + + MAVLink Baud Rate + + + + + + + + 0 + 0 + + + + + + + + + + + + + 10 + + + 45 + + + 25 + + + + + + + Speaker Volume + + + + + + + Haptic Length + + + + + + + Inactivity Timer + + + + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" text-decoration: underline;">Warnings</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">These will define startup warnings.</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Throttle warning - will alert if the throttle is not at idle during startup</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Switch warning - will alert if switches are not in their defaul position</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Memory warning - will alert if there's not a lot of memory left</p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Silent mode warning - will alert you if the beeper is set to quiet (0)</p></body></html> + + + + + + true + + + + + + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + Show splash screen on startup + + + Show splash screen on startup + + + + + + + + + + + 0 + 0 + + + + + --- + + + + + 2s + + + + + 3s + + + + + 4s + + + + + 6s + + + + + 8s + + + + + 10s + + + + + 15s + + + + + + + + + + "No Sound" Warning + + + + + + + Low Memory Warning + + + + + + + Haptic Strength + + + + + + + + + Beep volume + + + + + + + -2 + + + 2 + + + 1 + + + Qt::Horizontal + + + + + + + Wav volume + + + + + + + -2 + + + 2 + + + 1 + + + Qt::Horizontal + + + + + + + Vario volume + + + + + + + -2 + + + 2 + + + 1 + + + Qt::Horizontal + + + + + + + Background volume + + + + + + + -2 + + + 2 + + + 1 + + + Qt::Horizontal + + + + + + + + + Stick Mode + + + + + + + + 0 + 0 + + + + Stick reverse (order as above) + + + + + + + + 0 + 0 + + + + Default Channel Order + + + + + + + FAI Mode + + + + + + + + + + + + + Mode selection: + +Mode 1: + Left stick: Elevator, Rudder + Right stick: Throttle, Aileron + +Mode 2: + Left stick: Throttle, Rudder + Right stick: Elevator, Aileron + +Mode 3: + Left stick: Elevator, Aileron + Right stick: Throttle, Rudder + +Mode 4: + Left stick: Throttle, Aileron + Right stick: Elevator, Rudder + + + + + 1 + + + + Mode 1 (RUD ELE THR AIL) + + + + + Mode 2 (RUD THR ELE AIL) + + + + + Mode 3 (AIL ELE THR RUD) + + + + + Mode 4 (AIL THR ELE RUD) + + + + + + + + + + 1 + + + + + + + 2 + + + + + + + 3 + + + + + + + 4 + + + + + + + + + + + + + + + <html><head/><body><p>Channel order</p><p><br/></p><p>Defines the order of the default mixes created on a new model.</p></body></html> + + + 0 + + + + R E T A + + + + + R E A T + + + + + R T E A + + + + + R T A E + + + + + R A E T + + + + + R A T E + + + + + E R T A + + + + + E R A T + + + + + E T R A + + + + + E T A R + + + + + E A R T + + + + + E A T R + + + + + T R E A + + + + + T R A E + + + + + T E R A + + + + + T E A R + + + + + T A R E + + + + + T A E R + + + + + A R E T + + + + + A R T E + + + + + A E R T + + + + + A E T R + + + + + A T R E + + + + + A T E R + + + + + + + + If you enable FAI, you loose the vario, the play functions, the telemetry screen. This function cannot be disabled by the radio. + + + + + + + + + + + 0 + 0 + + + + Play Delay (switch mid position) + + + + + + + + + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">LCD Screen Contrast</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">Values can be 20-45</span></p></body></html> + + + ms + + + 0 + + + 300 + + + 10 + + + 0 + + + + + + + Backlight flash on alarm + + + + + + + + + + + + + + + diff --git a/companion/src/generaledit/trainer.cpp b/companion/src/generaledit/trainer.cpp new file mode 100755 index 000000000..9434fd5af --- /dev/null +++ b/companion/src/generaledit/trainer.cpp @@ -0,0 +1,101 @@ +#include "trainer.h" +#include "ui_trainer.h" + +TrainerPanel::TrainerPanel(QWidget * parent, GeneralSettings & generalSettings, FirmwareInterface * firmware): + GeneralPanel(parent, generalSettings, firmware), + ui(new Ui::Trainer) +{ + ui->setupUi(this); + + + ui->trnMode_1->setCurrentIndex(generalSettings.trainer.mix[0].mode); + ui->trnChn_1->setCurrentIndex(generalSettings.trainer.mix[0].src); + ui->trnWeight_1->setValue(generalSettings.trainer.mix[0].weight); + ui->trnMode_2->setCurrentIndex(generalSettings.trainer.mix[1].mode); + ui->trnChn_2->setCurrentIndex(generalSettings.trainer.mix[1].src); + ui->trnWeight_2->setValue(generalSettings.trainer.mix[1].weight); + ui->trnMode_3->setCurrentIndex(generalSettings.trainer.mix[2].mode); + ui->trnChn_3->setCurrentIndex(generalSettings.trainer.mix[2].src); + ui->trnWeight_3->setValue(generalSettings.trainer.mix[2].weight); + ui->trnMode_4->setCurrentIndex(generalSettings.trainer.mix[3].mode); + ui->trnChn_4->setCurrentIndex(generalSettings.trainer.mix[3].src); + ui->trnWeight_4->setValue(generalSettings.trainer.mix[3].weight); + +} + +TrainerPanel::~TrainerPanel() +{ + delete ui; +} + +void TrainerPanel::on_trnMode_1_currentIndexChanged(int index) +{ + generalSettings.trainer.mix[0].mode = index; + emit modified(); +} + +void TrainerPanel::on_trnChn_1_currentIndexChanged(int index) +{ + generalSettings.trainer.mix[0].src = index; + emit modified(); +} + +void TrainerPanel::on_trnWeight_1_editingFinished() +{ + generalSettings.trainer.mix[0].weight = ui->trnWeight_1->value(); + emit modified(); +} + +void TrainerPanel::on_trnMode_2_currentIndexChanged(int index) +{ + generalSettings.trainer.mix[1].mode = index; + emit modified(); +} + +void TrainerPanel::on_trnChn_2_currentIndexChanged(int index) +{ + generalSettings.trainer.mix[1].src = index; + emit modified(); +} + +void TrainerPanel::on_trnWeight_2_editingFinished() +{ + generalSettings.trainer.mix[1].weight = ui->trnWeight_2->value(); + emit modified(); +} + +void TrainerPanel::on_trnMode_3_currentIndexChanged(int index) +{ + generalSettings.trainer.mix[2].mode = index; + emit modified(); +} + +void TrainerPanel::on_trnChn_3_currentIndexChanged(int index) +{ + generalSettings.trainer.mix[2].src = index; + emit modified(); +} + +void TrainerPanel::on_trnWeight_3_editingFinished() +{ + generalSettings.trainer.mix[2].weight = ui->trnWeight_3->value(); + emit modified(); +} + +void TrainerPanel::on_trnMode_4_currentIndexChanged(int index) +{ + generalSettings.trainer.mix[3].mode = index; + emit modified(); +} + +void TrainerPanel::on_trnChn_4_currentIndexChanged(int index) +{ + generalSettings.trainer.mix[3].src = index; + emit modified(); +} + +void TrainerPanel::on_trnWeight_4_editingFinished() +{ + generalSettings.trainer.mix[3].weight = ui->trnWeight_4->value(); + emit modified(); +} diff --git a/companion/src/generaledit/trainer.h b/companion/src/generaledit/trainer.h new file mode 100755 index 000000000..7bee5055f --- /dev/null +++ b/companion/src/generaledit/trainer.h @@ -0,0 +1,39 @@ +#ifndef TRAINER_H +#define TRAINER_H + +#include "generaledit.h" +#include "eeprominterface.h" + +namespace Ui { + class Trainer; +} + +class TrainerPanel : public GeneralPanel +{ + Q_OBJECT + + public: + TrainerPanel(QWidget *parent, GeneralSettings & generalSettings, FirmwareInterface * firmware); + virtual ~TrainerPanel(); + + private slots: + void on_trnMode_1_currentIndexChanged(int index); + void on_trnChn_1_currentIndexChanged(int index); + void on_trnWeight_1_editingFinished(); + void on_trnMode_2_currentIndexChanged(int index); + void on_trnChn_2_currentIndexChanged(int index); + void on_trnWeight_2_editingFinished(); + void on_trnMode_3_currentIndexChanged(int index); + void on_trnChn_3_currentIndexChanged(int index); + void on_trnWeight_3_editingFinished(); + void on_trnMode_4_currentIndexChanged(int index); + void on_trnChn_4_currentIndexChanged(int index); + void on_trnWeight_4_editingFinished(); + + private: + Ui::Trainer *ui; + + void setValues(); +}; + +#endif // TRAINER_H diff --git a/companion/src/generaledit/trainer.ui b/companion/src/generaledit/trainer.ui new file mode 100755 index 000000000..312999a0d --- /dev/null +++ b/companion/src/generaledit/trainer.ui @@ -0,0 +1,475 @@ + + + Trainer + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + + + + + + + + + + + -125 + + + 125 + + + + + + + Mode + + + + + + + Input + + + + + + + Weight + + + + + + + + 0 + 0 + + + + Rud + + + + + + + + + + + + + Beeper volume + +0 - Quiet. No beeps at all. +1 - No Keys. Normal beeps but menu keys do not beep. +2 - Normal. +3 - Loud. +4 - Extra loud. + + + + Off + + + + + += (Sum) + + + + + := (Replace) + + + + + + + + + + + + + + Beeper volume + +0 - Quiet. No beeps at all. +1 - No Keys. Normal beeps but menu keys do not beep. +2 - Normal. +3 - Loud. +4 - Extra loud. + + + + chn1 + + + + + chn2 + + + + + chn3 + + + + + chn4 + + + + + + + + + + + + + + + + + -125 + + + 125 + + + + + + + + 0 + 0 + + + + Ele + + + + + + + + + + + + + Beeper volume + +0 - Quiet. No beeps at all. +1 - No Keys. Normal beeps but menu keys do not beep. +2 - Normal. +3 - Loud. +4 - Extra loud. + + + + Off + + + + + += (Sum) + + + + + := (Replace) + + + + + + + + + + + + + + Beeper volume + +0 - Quiet. No beeps at all. +1 - No Keys. Normal beeps but menu keys do not beep. +2 - Normal. +3 - Loud. +4 - Extra loud. + + + + chn1 + + + + + chn2 + + + + + chn3 + + + + + chn4 + + + + + + + + + + + + + + Beeper volume + +0 - Quiet. No beeps at all. +1 - No Keys. Normal beeps but menu keys do not beep. +2 - Normal. +3 - Loud. +4 - Extra loud. + + + + chn1 + + + + + chn2 + + + + + chn3 + + + + + chn4 + + + + + + + + + + + + + + + + + -125 + + + 125 + + + + + + + + 0 + 0 + + + + Thr + + + + + + + + + + + + + Beeper volume + +0 - Quiet. No beeps at all. +1 - No Keys. Normal beeps but menu keys do not beep. +2 - Normal. +3 - Loud. +4 - Extra loud. + + + + Off + + + + + += (Sum) + + + + + := (Replace) + + + + + + + + + 0 + 0 + + + + Ail + + + + + + + + + + + + + Beeper volume + +0 - Quiet. No beeps at all. +1 - No Keys. Normal beeps but menu keys do not beep. +2 - Normal. +3 - Loud. +4 - Extra loud. + + + + Off + + + + + += (Sum) + + + + + := (Replace) + + + + + + + + + + + + + + Beeper volume + +0 - Quiet. No beeps at all. +1 - No Keys. Normal beeps but menu keys do not beep. +2 - Normal. +3 - Loud. +4 - Extra loud. + + + + chn1 + + + + + chn2 + + + + + chn3 + + + + + chn4 + + + + + + + + + + + + + + + + + -125 + + + 125 + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + diff --git a/companion/src/helpers.cpp b/companion/src/helpers.cpp index 9390776c0..29ba7b61f 100644 --- a/companion/src/helpers.cpp +++ b/companion/src/helpers.cpp @@ -95,31 +95,6 @@ void populateGvSourceCB(QComboBox *b, int value) b->setCurrentIndex(value); } -void populateVoiceLangCB(QComboBox *b, QString language) -{ - QString strings[] = { QObject::tr("English"), QObject::tr("Finnish"), QObject::tr("French"), QObject::tr("Italian"), QObject::tr("German"), QObject::tr("Czech"), QObject::tr("Slovak"), QObject::tr("Spanish"), QObject::tr("Polish"), QObject::tr("Portuguese"), QObject::tr("Swedish"), NULL}; - QString langcode[] = { "en", "fi","fr", "it", "de", "cz", "sk", "es", "pl", "pt", "se", NULL}; - - b->clear(); - for (int i=0; strings[i]!=NULL; i++) { - b->addItem(strings[i],langcode[i]); - if (language==langcode[i]) { - b->setCurrentIndex(b->count()-1); - } - } -} - -void populateRotEncCB(QComboBox *b, int value, int renumber) -{ - QString strings[] = { QObject::tr("No"), QObject::tr("RotEnc A"), QObject::tr("Rot Enc B"), QObject::tr("Rot Enc C"), QObject::tr("Rot Enc D"), QObject::tr("Rot Enc E")}; - - b->clear(); - for (int i=0; i<= renumber; i++) { - b->addItem(strings[i]); - } - b->setCurrentIndex(value); -} - QString getProtocolStr(const int proto) { static const char *strings[] = { "OFF", @@ -384,18 +359,6 @@ void populateGvarUseCB(QComboBox *b, unsigned int phase) } } -void populateBacklightCB(QComboBox *b, const uint8_t value) -{ - QString strings[] = { QObject::tr("OFF"), QObject::tr("Keys"), QObject::tr("Sticks"), QObject::tr("Keys + Sticks"), QObject::tr("ON"), NULL }; - - b->clear(); - - for (int i=0; !strings[i].isNull(); i++) { - b->addItem(strings[i], 0); - if (value == i) b->setCurrentIndex(b->count()-1); - } -} - void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettings & generalSettings, SwitchContext context) { RawSwitch item; @@ -1034,3 +997,116 @@ QString generateProcessUniqueTempFileName(const QString & fileName) sanitizedFileName.remove('/'); return QDir::tempPath() + QString("/%1-").arg(QCoreApplication::applicationPid()) + sanitizedFileName; } + +GenericPanel::GenericPanel(QWidget * parent): + QWidget(parent), + lock(false) +{ +} + +GenericPanel::~GenericPanel() +{ +} + +void GenericPanel::update() +{ +} + +void GenericPanel::addLabel(QGridLayout * gridLayout, QString text, int col, bool minimize) +{ + QLabel *label = new QLabel(this); + label->setFrameShape(QFrame::Panel); + label->setFrameShadow(QFrame::Raised); + label->setMidLineWidth(0); + label->setAlignment(Qt::AlignCenter); + label->setMargin(5); + label->setText(text); + if (!minimize) + label->setMinimumWidth(100); + gridLayout->addWidget(label, 0, col, 1, 1); +} + +void GenericPanel::addEmptyLabel(QGridLayout * gridLayout, int col) +{ + QLabel *label = new QLabel(this); + label->setText(""); + gridLayout->addWidget(label, 0, col, 1, 1); +} + +void GenericPanel::addHSpring(QGridLayout * gridLayout, int col, int row) +{ + QSpacerItem * spacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum ); + gridLayout->addItem(spacer, row, col); +} + +void GenericPanel::addVSpring(QGridLayout * gridLayout, int col, int row) +{ + QSpacerItem * spacer = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding ); + gridLayout->addItem(spacer, row, col); +} + +void GenericPanel::addDoubleSpring(QGridLayout * gridLayout, int col, int row) +{ + QSpacerItem * spacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Expanding ); + gridLayout->addItem(spacer, row, col); +} + +bool GenericPanel::eventFilter(QObject *object, QEvent * event) +{ + QWidget * widget = qobject_cast(object); + if (widget) { + if (event->type() == QEvent::Wheel) { + if (widget->focusPolicy() == Qt::WheelFocus) { + event->accept(); + return false; + } + else { + event->ignore(); + return true; + } + } + else if (event->type() == QEvent::FocusIn) { + widget->setFocusPolicy(Qt::WheelFocus); + } + else if (event->type() == QEvent::FocusOut) { + widget->setFocusPolicy(Qt::StrongFocus); + } + } + return QWidget::eventFilter(object, event); +} + +void GenericPanel::disableMouseScrolling() +{ + Q_FOREACH(QComboBox * cb, findChildren()) { + cb->installEventFilter(this); + cb->setFocusPolicy(Qt::StrongFocus); + } + + Q_FOREACH(QAbstractSpinBox * sb, findChildren()) { + sb->installEventFilter(this); + sb->setFocusPolicy(Qt::StrongFocus); + } + + Q_FOREACH(QSlider * slider, findChildren()) { + slider->installEventFilter(this); + slider->setFocusPolicy(Qt::StrongFocus); + } +} +VerticalScrollArea::VerticalScrollArea(QWidget * parent, GenericPanel * panel): + QScrollArea(parent), + panel(panel), + parent(parent) +{ + setWidgetResizable(true); + setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); + setWidget(panel); + panel->installEventFilter(this); +} + +bool VerticalScrollArea::eventFilter(QObject *o, QEvent *e) +{ + if (o == panel && e->type() == QEvent::Resize) { + setMinimumWidth(panel->minimumSizeHint().width() + verticalScrollBar()->width()); + } + return false; +} diff --git a/companion/src/helpers.h b/companion/src/helpers.h index 0125e2252..a69f46f8c 100644 --- a/companion/src/helpers.h +++ b/companion/src/helpers.h @@ -26,9 +26,7 @@ extern const QColor colors[C9X_MAX_CURVES]; #define TRIM_MODE_NONE 0x1F // 0b11111 void populateGvSourceCB(QComboBox *b, int value); -void populateVoiceLangCB(QComboBox *b, QString language); void populateRotEncCB(QComboBox *b, int value, int renumber); -void populateBacklightCB(QComboBox *b, const uint8_t value); QString getTheme(); @@ -151,4 +149,44 @@ int qunlink(const QString & fileName); QString generateProcessUniqueTempFileName(const QString & fileName); + +class GenericPanel : public QWidget +{ + Q_OBJECT + + friend class QUnsignedAutoComboBox; + + public: + GenericPanel(QWidget *parent); + virtual ~GenericPanel(); + + signals: + void modified(); + + public slots: + virtual void update(); + + protected: + bool lock; + void addLabel(QGridLayout * gridLayout, QString text, int col, bool mimimize=false); + void addEmptyLabel(QGridLayout * gridLayout, int col); + void addHSpring(QGridLayout *, int col, int row); + void addVSpring(QGridLayout *, int col, int row); + void addDoubleSpring(QGridLayout *, int col, int row); + virtual bool eventFilter(QObject *obj, QEvent *event); + void disableMouseScrolling(); +}; + +class VerticalScrollArea : public QScrollArea +{ + public: + VerticalScrollArea(QWidget * parent, GenericPanel * panel); + + protected: + virtual bool eventFilter(QObject *o, QEvent *e); + + private: + GenericPanel * panel; + QWidget * parent; +}; #endif // HELPERS_H diff --git a/companion/src/mdichild.cpp b/companion/src/mdichild.cpp index 42f3fa8d1..eff715666 100644 --- a/companion/src/mdichild.cpp +++ b/companion/src/mdichild.cpp @@ -45,7 +45,7 @@ #include "hexinterface.h" #include "mainwindow.h" #include "modeledit/modeledit.h" -#include "generaledit.h" +#include "generaledit/generaledit.h" #include "avroutputdialog.h" #include "burnconfigdialog.h" #include "printdialog.h" @@ -163,8 +163,8 @@ void MdiChild::checkAndInitModel(int row) void MdiChild::generalEdit() { - GeneralEdit *t = new GeneralEdit(radioData, this); - connect(t, SIGNAL(modelValuesChanged()), this, SLOT(setModified())); + GeneralEdit *t = new GeneralEdit(this, radioData, GetCurrentFirmware()/*firmware*/); + connect(t, SIGNAL(modified()), this, SLOT(setModified())); t->show(); } diff --git a/companion/src/modeledit/modeledit.cpp b/companion/src/modeledit/modeledit.cpp index 380e15990..e3bbc5ad6 100644 --- a/companion/src/modeledit/modeledit.cpp +++ b/companion/src/modeledit/modeledit.cpp @@ -55,38 +55,6 @@ void ModelEdit::closeEvent(QCloseEvent *event) g.modelEditGeo( saveGeometry() ); } -class VerticalScrollArea : public QScrollArea -{ - public: - VerticalScrollArea(QWidget * parent, ModelPanel * panel); - - protected: - virtual bool eventFilter(QObject *o, QEvent *e); - - private: - ModelPanel * panel; - QWidget * parent; -}; - -VerticalScrollArea::VerticalScrollArea(QWidget * parent, ModelPanel * panel): - QScrollArea(parent), - panel(panel), - parent(parent) -{ - setWidgetResizable(true); - setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - setWidget(panel); - panel->installEventFilter(this); -} - -bool VerticalScrollArea::eventFilter(QObject *o, QEvent *e) -{ - if (o == panel && e->type() == QEvent::Resize) { - setMinimumWidth(panel->minimumSizeHint().width() + verticalScrollBar()->width()); - } - return false; -} - void ModelEdit::addTab(ModelPanel *panel, QString text) { panels << panel; diff --git a/companion/src/modeledit/modelpanel.cpp b/companion/src/modeledit/modelpanel.cpp index 0ea59652d..b689bbcae 100644 --- a/companion/src/modeledit/modelpanel.cpp +++ b/companion/src/modeledit/modelpanel.cpp @@ -4,11 +4,10 @@ #include ModelPanel::ModelPanel(QWidget * parent, ModelData & model, GeneralSettings & generalSettings, FirmwareInterface * firmware): - QWidget(parent), + GenericPanel(parent), model(model), generalSettings(generalSettings), - firmware(firmware), - lock(false) + firmware(firmware) { } @@ -16,87 +15,3 @@ ModelPanel::~ModelPanel() { } -void ModelPanel::update() -{ -} - -void ModelPanel::addLabel(QGridLayout * gridLayout, QString text, int col, bool minimize) -{ - QLabel *label = new QLabel(this); - label->setFrameShape(QFrame::Panel); - label->setFrameShadow(QFrame::Raised); - label->setMidLineWidth(0); - label->setAlignment(Qt::AlignCenter); - label->setMargin(5); - label->setText(text); - if (!minimize) - label->setMinimumWidth(100); - gridLayout->addWidget(label, 0, col, 1, 1); -} - -void ModelPanel::addEmptyLabel(QGridLayout * gridLayout, int col) -{ - QLabel *label = new QLabel(this); - label->setText(""); - gridLayout->addWidget(label, 0, col, 1, 1); -} - -void ModelPanel::addHSpring(QGridLayout * gridLayout, int col, int row) -{ - QSpacerItem * spacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum ); - gridLayout->addItem(spacer, row, col); -} - -void ModelPanel::addVSpring(QGridLayout * gridLayout, int col, int row) -{ - QSpacerItem * spacer = new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding ); - gridLayout->addItem(spacer, row, col); -} - -void ModelPanel::addDoubleSpring(QGridLayout * gridLayout, int col, int row) -{ - QSpacerItem * spacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Expanding ); - gridLayout->addItem(spacer, row, col); -} - -bool ModelPanel::eventFilter(QObject *object, QEvent * event) -{ - QWidget * widget = qobject_cast(object); - if (widget) { - if (event->type() == QEvent::Wheel) { - if (widget->focusPolicy() == Qt::WheelFocus) { - event->accept(); - return false; - } - else { - event->ignore(); - return true; - } - } - else if (event->type() == QEvent::FocusIn) { - widget->setFocusPolicy(Qt::WheelFocus); - } - else if (event->type() == QEvent::FocusOut) { - widget->setFocusPolicy(Qt::StrongFocus); - } - } - return QWidget::eventFilter(object, event); -} - -void ModelPanel::disableMouseScrolling() -{ - Q_FOREACH(QComboBox * cb, findChildren()) { - cb->installEventFilter(this); - cb->setFocusPolicy(Qt::StrongFocus); - } - - Q_FOREACH(QAbstractSpinBox * sb, findChildren()) { - sb->installEventFilter(this); - sb->setFocusPolicy(Qt::StrongFocus); - } - - Q_FOREACH(QSlider * slider, findChildren()) { - slider->installEventFilter(this); - slider->setFocusPolicy(Qt::StrongFocus); - } -} diff --git a/companion/src/modeledit/modelpanel.h b/companion/src/modeledit/modelpanel.h index fa2a450d6..8cd1aab8a 100644 --- a/companion/src/modeledit/modelpanel.h +++ b/companion/src/modeledit/modelpanel.h @@ -1,38 +1,21 @@ #ifndef MODELPANEL_H #define MODELPANEL_H -#include -#include #include "eeprominterface.h" +#include "helpers.h" -class ModelPanel : public QWidget +class ModelPanel : public GenericPanel { - Q_OBJECT - - friend class QUnsignedAutoComboBox; + Q_OBJECT public: ModelPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings, FirmwareInterface * firmware); virtual ~ModelPanel(); - signals: - void modified(); - - public slots: - virtual void update(); - protected: ModelData & model; GeneralSettings & generalSettings; FirmwareInterface * firmware; - bool lock; - void addLabel(QGridLayout * gridLayout, QString text, int col, bool mimimize=false); - void addEmptyLabel(QGridLayout * gridLayout, int col); - void addHSpring(QGridLayout *, int col, int row); - void addVSpring(QGridLayout *, int col, int row); - void addDoubleSpring(QGridLayout *, int col, int row); - virtual bool eventFilter(QObject *obj, QEvent *event); - void disableMouseScrolling(); }; #endif // CHANNELS_H