chore(cpn): move global variables from flight/drive modes tab to own tab (#6624)

This commit is contained in:
Neil Horne
2025-10-11 07:53:25 +10:00
committed by GitHub
parent 130860aad5
commit c6668071ea
36 changed files with 1623 additions and 1631 deletions
+2 -2
View File
@@ -29,7 +29,7 @@
#include "hardware.h"
#include "../modeledit/customfunctions.h"
#include "generaloptions.h"
#include "verticalscrollarea.h"
#include "scrollarea.h"
#include "compounditemmodels.h"
GeneralEdit::GeneralEdit(QWidget * parent, RadioData & radioData, Firmware * firmware) :
@@ -96,7 +96,7 @@ void GeneralEdit::addTab(GenericPanel *panel, QString text)
panels << panel;
QWidget * widget = new QWidget(ui->tabWidget);
QVBoxLayout *baseLayout = new QVBoxLayout(widget);
VerticalScrollArea * area = new VerticalScrollArea(widget, panel);
ScrollArea * area = new ScrollArea(widget, panel);
baseLayout->addWidget(area);
ui->tabWidget->addTab(widget, text);
connect(panel, &GenericPanel::modified, this, &GeneralEdit::onTabModified);
+1 -1
View File
@@ -68,7 +68,7 @@ GeneralOptionsPanel::GeneralOptionsPanel(QWidget * parent, GeneralSettings & gen
addParams();
}
addLabel(tr("%1 Modes").arg(Boards::getRadioTypeString(board)));
addLabel(tr("%1 Modes").arg(Boards::getRadioModeString(board)));
AutoCheckBox *fmDisable = new AutoCheckBox(this);
fmDisable->setField(generalSettings.modelFMDisabled, this, true);
params->append(fmDisable);
@@ -145,14 +145,6 @@ ui(new Ui::GeneralSetup)
ui->faimode_CB->setChecked(generalSettings.fai);
}
if (!firmware->getCapability(RotaryEncoderNavigation)) {
ui->rotEncMode_CB->hide();
ui->rotEncMode_label->hide();
}
else {
populateRotEncModeCB();
}
if (!firmware->getCapability(HasPxxCountry)) {
ui->countrycode_label->hide();
ui->countrycode_CB->hide();
@@ -260,15 +252,6 @@ ui(new Ui::GeneralSetup)
ui->hapticmodeCB->setDisabled(true);
}
int reCount = firmware->getCapability(RotaryEncoders);
if (reCount == 0) {
ui->re_label->hide();
ui->re_CB->hide();
}
else {
populateRotEncCB(reCount);
}
if (Boards::getCapability(firmware->getBoard(), Board::HasColorLcd)) {
ui->backlightautoSB->setMinimum(5);
}
@@ -505,18 +488,6 @@ void GeneralSetupPanel::updateVarioPitchRange()
ui->varioPMax_SB->setMinimum(700 + (generalSettings.varioPitch * 10) + 1000 - 800);
}
void GeneralSetupPanel::populateRotEncCB(int reCount)
{
QString strings[] = { tr("No"), tr("RotEnc A"), tr("Rot Enc B"), tr("Rot Enc C"), tr("Rot Enc D"), 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);
}
int pwrDelayFromYaml(int delay)
{
static int8_t vals[] = { 1, 4, 3, 2, 0 };
@@ -631,31 +602,6 @@ void GeneralSetupPanel::on_faimode_CB_stateChanged(int)
}
}
void GeneralSetupPanel::populateRotEncModeCB()
{
QComboBox * b = ui->rotEncMode_CB;
QString strings[] = { tr("Normal"), tr("Inverted"), tr("Vertical Inverted, Horizontal Normal"), tr("Vertical Inverted, Horizontal Alternate"), tr("Normal, Edit Inverted") };
int itemCount = 5;
if (Boards::getCapability(firmware->getBoard(), Board::HasColorLcd)) {
itemCount = 2;
}
b->clear();
for (int i = 0; i < itemCount; i++) {
b->addItem(strings[i], 0);
}
b->setCurrentIndex(generalSettings.rotEncMode);
}
void GeneralSetupPanel::on_rotEncMode_CB_currentIndexChanged(int index)
{
if (!lock) {
generalSettings.rotEncMode = index;
emit modified();
}
}
void GeneralSetupPanel::on_speakerPitchSB_editingFinished()
{
if (!lock) {
@@ -835,14 +781,6 @@ void GeneralSetupPanel::on_vBatMaxDSB_editingFinished()
}
}
void GeneralSetupPanel::on_re_CB_currentIndexChanged(int index)
{
if (!lock) {
generalSettings.reNavigation = ui->re_CB->currentIndex();
emit modified();
}
}
void GeneralSetupPanel::on_countrycode_CB_currentIndexChanged(int index)
{
if (!lock) {
+1 -8
View File
@@ -19,8 +19,7 @@
* GNU General Public License for more details.
*/
#ifndef _GENERALSETUP_H_
#define _GENERALSETUP_H_
#pragma once
#include "generaledit.h"
#include "eeprominterface.h"
@@ -48,12 +47,10 @@ class GeneralSetupPanel : public GeneralPanel
void on_displayTypeCB_currentIndexChanged(int index);
void on_BLBright_SB_editingFinished();
void on_OFFBright_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_ppm_units_CB_currentIndexChanged(int index);
void on_faimode_CB_stateChanged(int );
void on_rotEncMode_CB_currentIndexChanged(int index);
void on_speakerPitchSB_editingFinished();
void on_timezoneLE_textEdited(const QString &text);
void on_adjustRTC_stateChanged(int);
@@ -116,9 +113,5 @@ class GeneralSetupPanel : public GeneralPanel
void setValues();
void populateBacklightCB();
void populateVoiceLangCB();
void populateRotEncCB(int reCount);
void populateRotEncModeCB();
void updateVarioPitchRange();
};
#endif // _GENERALSETUP_H_
File diff suppressed because it is too large Load Diff