feat: Add options to disable radio and model menu tabs (#3484)
* Add options to disable radio and model menu tabs. - Update radio and model data structs - UI for color LCD radios - Convert existing 'noGlobalFunctions' property. - Language strings. * Make 'theme' control specific to color LCD radios. * Add B&W radio UI. * Simplify code, reduce compiled code size. Fix page count display on model select tab. Fix GVARS for 212x64 radios. * Collapse timer sections if timer is off. * Remove 'Use global functions' checkbox from B&W model setup. * Make preflight checks, throttle and view options sections expand & collapse (default collapsed). * Fix build. * Add view options to companion data classes, save and load values in YAML files. Fix scrolling for radio setup view options. * Add Companion UI for view option settings. * Remove 'Mixes' from list of tabs that can be hidden. * Updated Companion UI from elecpower. * Use view options flags to enable/disable functionality: - skip heli mixer logic if heli not enabled - Remove heli, gvars and telemetry options from source selection if not enabled * Remove 'flight mode', 'curve' and 'global variable' settings from input & mix editors if option disabled. * Rename 'View Options' to 'Enabled Features'. Put GVAR option under Flight Mode and indent text. Make relationship between FM and GV more obvious. * Remove global variable option dependency on flight modes. Hide FM1-FM8 in global variables if flight modes hidden. * Hide 'Custom Mixer Scripts' in source selection menu popup if disabled. * Add translation strings for Hebrew language file. * Fix typo. Add comment for double call to setCurrentTab.
This commit is contained in:
@@ -9,12 +9,14 @@ set(generaledit_SRCS
|
||||
calibration.cpp
|
||||
hardware.cpp
|
||||
trainer.cpp
|
||||
generaloptions.cpp
|
||||
)
|
||||
|
||||
set(generaledit_HDRS
|
||||
calibration.h
|
||||
hardware.h
|
||||
trainer.h
|
||||
generaloptions.h
|
||||
)
|
||||
|
||||
set(generaledit_UIS
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "calibration.h"
|
||||
#include "hardware.h"
|
||||
#include "../modeledit/customfunctions.h"
|
||||
#include "generaloptions.h"
|
||||
#include "verticalscrollarea.h"
|
||||
#include "compounditemmodels.h"
|
||||
|
||||
@@ -69,6 +70,7 @@ GeneralEdit::GeneralEdit(QWidget * parent, RadioData & radioData, Firmware * fir
|
||||
auto hwpnl = new HardwarePanel(this, generalSettings, firmware, editorItemModels);
|
||||
addTab(hwpnl, tr("Hardware"));
|
||||
addTab(new CalibrationPanel(this, generalSettings, firmware), tr("Calibration"));
|
||||
addTab(new GeneralOptionsPanel(this, generalSettings, firmware), tr("Enabled Features"));
|
||||
|
||||
connect(hwpnl, &HardwarePanel::internalModuleChanged, this, [&] { intModChanged = true; });
|
||||
|
||||
|
||||
@@ -0,0 +1,160 @@
|
||||
/*
|
||||
* Copyright (C) EdgeTX
|
||||
*
|
||||
* Based on code named
|
||||
* opentx - https://github.com/opentx/opentx
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#include "generaloptions.h"
|
||||
#include "autocheckbox.h"
|
||||
|
||||
#include <QLabel>
|
||||
#include <QGridLayout>
|
||||
|
||||
GeneralOptionsPanel::GeneralOptionsPanel(QWidget * parent, GeneralSettings & generalSettings, Firmware * firmware):
|
||||
GeneralPanel(parent, generalSettings, firmware),
|
||||
board(firmware->getBoard()),
|
||||
params(new QList<QWidget *>),
|
||||
row(0),
|
||||
col(0)
|
||||
{
|
||||
grid = new QGridLayout(this);
|
||||
|
||||
addSection(tr("Radio Menus"));
|
||||
|
||||
if (Boards::getCapability(board, Board::HasColorLcd)) {
|
||||
addLabel(tr("Themes"));
|
||||
AutoCheckBox *themesDisable = new AutoCheckBox(this);
|
||||
themesDisable->setField(generalSettings.radioThemesDisabled, this, true);
|
||||
params->append(themesDisable);
|
||||
addParams();
|
||||
}
|
||||
|
||||
addLabel(tr("Global Functions"));
|
||||
AutoCheckBox *globalFuncsDisable = new AutoCheckBox(this);
|
||||
globalFuncsDisable->setField(generalSettings.radioGFDisabled, this, true);
|
||||
params->append(globalFuncsDisable);
|
||||
addParams();
|
||||
|
||||
addLabel(tr("Trainer"));
|
||||
AutoCheckBox *trainerDisable = new AutoCheckBox(this);
|
||||
trainerDisable->setField(generalSettings.radioTrainerDisabled, this, true);
|
||||
params->append(trainerDisable);
|
||||
addParams();
|
||||
|
||||
row = 0;
|
||||
col = 2;
|
||||
addSection(tr("Model Menus"));
|
||||
|
||||
if (firmware->getCapability(Heli)) {
|
||||
addLabel(tr("Heli"));
|
||||
AutoCheckBox *heliDisable = new AutoCheckBox(this);
|
||||
heliDisable->setField(generalSettings.modelHeliDisabled, this, true);
|
||||
params->append(heliDisable);
|
||||
addParams();
|
||||
}
|
||||
|
||||
addLabel(tr("Flight Modes"));
|
||||
AutoCheckBox *fmDisable = new AutoCheckBox(this);
|
||||
fmDisable->setField(generalSettings.modelFMDisabled, this, true);
|
||||
params->append(fmDisable);
|
||||
addParams();
|
||||
|
||||
addLabel(tr("Curves"));
|
||||
AutoCheckBox *curvesDisable = new AutoCheckBox(this);
|
||||
curvesDisable->setField(generalSettings.modelCurvesDisabled, this, true);
|
||||
params->append(curvesDisable);
|
||||
addParams();
|
||||
|
||||
if (firmware->getCapability(Gvars)) {
|
||||
addLabel(tr("Global Variables"));
|
||||
AutoCheckBox *gvDisable = new AutoCheckBox(this);
|
||||
gvDisable->setField(generalSettings.modelGVDisabled, this, true);
|
||||
params->append(gvDisable);
|
||||
addParams();
|
||||
}
|
||||
|
||||
addLabel(tr("Logical Switches"));
|
||||
AutoCheckBox *lsDisable = new AutoCheckBox(this);
|
||||
lsDisable->setField(generalSettings.modelLSDisabled, this, true);
|
||||
params->append(lsDisable);
|
||||
addParams();
|
||||
|
||||
addLabel(tr("Special Functions"));
|
||||
AutoCheckBox *sfDisable = new AutoCheckBox(this);
|
||||
sfDisable->setField(generalSettings.modelSFDisabled, this, true);
|
||||
params->append(sfDisable);
|
||||
addParams();
|
||||
|
||||
addLabel(tr("Custom Mix Scripts"));
|
||||
AutoCheckBox *cmsDisable = new AutoCheckBox(this);
|
||||
cmsDisable->setField(generalSettings.modelCustomScriptsDisabled, this, true);
|
||||
params->append(cmsDisable);
|
||||
addParams();
|
||||
|
||||
addLabel(tr("Telemetry"));
|
||||
AutoCheckBox *teleDisable = new AutoCheckBox(this);
|
||||
teleDisable->setField(generalSettings.modelTelemetryDisabled, this, true);
|
||||
params->append(teleDisable);
|
||||
addParams();
|
||||
|
||||
addVSpring(grid, 0, grid->rowCount());
|
||||
addHSpring(grid, grid->columnCount(), 0);
|
||||
disableMouseScrolling();
|
||||
}
|
||||
|
||||
GeneralOptionsPanel::~GeneralOptionsPanel()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void GeneralOptionsPanel::addLabel(QString text)
|
||||
{
|
||||
QLabel *label = new QLabel(this);
|
||||
label->setText(text);
|
||||
grid->addWidget(label, row, col);
|
||||
}
|
||||
|
||||
void GeneralOptionsPanel::addLine()
|
||||
{
|
||||
QFrame *line = new QFrame(this);
|
||||
line->setFrameShape(QFrame::HLine);
|
||||
line->setFrameShadow(QFrame::Sunken);
|
||||
line->setLineWidth(1);
|
||||
line->setMidLineWidth(0);
|
||||
grid->addWidget(line, row++, 0, 1, grid->columnCount());
|
||||
}
|
||||
|
||||
void GeneralOptionsPanel::addParams()
|
||||
{
|
||||
int col = 0;
|
||||
QGridLayout *subgrid = new QGridLayout();
|
||||
|
||||
for (int i = 0; i < params->size(); i++) {
|
||||
subgrid->addWidget(params->at(i), 0, col++);
|
||||
}
|
||||
|
||||
addHSpring(subgrid, col, 0);
|
||||
grid->addLayout(subgrid, row++, this->col + 1);
|
||||
params->clear();
|
||||
}
|
||||
|
||||
void GeneralOptionsPanel::addSection(QString text)
|
||||
{
|
||||
addLabel(QString("<b>%1</b>").arg(text));
|
||||
row++;
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (C) EdgeTX
|
||||
*
|
||||
* Based on code named
|
||||
* opentx - https://github.com/opentx/opentx
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "generaledit.h"
|
||||
|
||||
class QGridLayout;
|
||||
|
||||
class GeneralOptionsPanel : public GeneralPanel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GeneralOptionsPanel(QWidget * parent, GeneralSettings & generalSettings, Firmware * firmware);
|
||||
virtual ~GeneralOptionsPanel();
|
||||
|
||||
private:
|
||||
Board::Type board;
|
||||
QGridLayout *grid;
|
||||
QList<QWidget *> *params;
|
||||
int row;
|
||||
int col;
|
||||
|
||||
void addLabel(QString text);
|
||||
void addLine();
|
||||
void addParams();
|
||||
void addSection(QString text);
|
||||
};
|
||||
Reference in New Issue
Block a user