mirror of
https://github.com/opentx/opentx.git
synced 2025-07-26 17:55:19 +03:00
Re #1909: tabs fixed for Model Edit -> Setup tab
This commit is contained in:
parent
c6c0f530c8
commit
e9e9ef45a7
2 changed files with 48 additions and 26 deletions
|
@ -5,7 +5,7 @@
|
||||||
#include "helpers.h"
|
#include "helpers.h"
|
||||||
#include "appdata.h"
|
#include "appdata.h"
|
||||||
|
|
||||||
TimerPanel::TimerPanel(QWidget *parent, ModelData & model, TimerData & timer, GeneralSettings & generalSettings, FirmwareInterface * firmware):
|
TimerPanel::TimerPanel(QWidget *parent, ModelData & model, TimerData & timer, GeneralSettings & generalSettings, FirmwareInterface * firmware, QWidget *prevFocus):
|
||||||
ModelPanel(parent, model, generalSettings, firmware),
|
ModelPanel(parent, model, generalSettings, firmware),
|
||||||
timer(timer),
|
timer(timer),
|
||||||
ui(new Ui::Timer)
|
ui(new Ui::Timer)
|
||||||
|
@ -47,6 +47,12 @@ TimerPanel::TimerPanel(QWidget *parent, ModelData & model, TimerData & timer, Ge
|
||||||
ui->persistent->addItem(tr("Persistent (manual reset)"), 2);
|
ui->persistent->addItem(tr("Persistent (manual reset)"), 2);
|
||||||
|
|
||||||
disableMouseScrolling();
|
disableMouseScrolling();
|
||||||
|
QWidget::setTabOrder(prevFocus, ui->name);
|
||||||
|
QWidget::setTabOrder(ui->name, ui->value);
|
||||||
|
QWidget::setTabOrder(ui->value, ui->mode);
|
||||||
|
QWidget::setTabOrder(ui->mode, ui->countdownBeep);
|
||||||
|
QWidget::setTabOrder(ui->countdownBeep, ui->minuteBeep);
|
||||||
|
QWidget::setTabOrder(ui->minuteBeep, ui->persistent);
|
||||||
|
|
||||||
lock = false;
|
lock = false;
|
||||||
}
|
}
|
||||||
|
@ -79,6 +85,11 @@ void TimerPanel::update()
|
||||||
ui->minuteBeep->setChecked(timer.minuteBeep);
|
ui->minuteBeep->setChecked(timer.minuteBeep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QWidget * TimerPanel::getLastFocus()
|
||||||
|
{
|
||||||
|
return ui->persistent;
|
||||||
|
}
|
||||||
|
|
||||||
void TimerPanel::on_value_editingFinished()
|
void TimerPanel::on_value_editingFinished()
|
||||||
{
|
{
|
||||||
timer.val = ui->value->time().minute()*60 + ui->value->time().second();
|
timer.val = ui->value->time().minute()*60 + ui->value->time().second();
|
||||||
|
@ -368,30 +379,6 @@ SetupPanel::SetupPanel(QWidget *parent, ModelData & model, GeneralSettings & gen
|
||||||
|
|
||||||
ui->name->setMaxLength(IS_TARANIS(board) ? 12 : 10);
|
ui->name->setMaxLength(IS_TARANIS(board) ? 12 : 10);
|
||||||
|
|
||||||
for (int i=0; i<C9X_MAX_TIMERS; i++) {
|
|
||||||
if (i<firmware->getCapability(Timers)) {
|
|
||||||
timers[i] = new TimerPanel(this, model, model.timers[i], generalSettings, firmware);
|
|
||||||
ui->gridLayout->addWidget(timers[i], 1+i, 1);
|
|
||||||
connect(timers[i], SIGNAL(modified()), this, SLOT(onChildModified()));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
foreach(QLabel *label, findChildren<QLabel *>(QRegExp(QString("label_timer%1").arg(i+1)))) {
|
|
||||||
label->hide();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i=0; i<firmware->getCapability(NumModules); i++) {
|
|
||||||
modules[i] = new ModulePanel(this, model, model.moduleData[i], generalSettings, firmware, i);
|
|
||||||
ui->modulesLayout->addWidget(modules[i]);
|
|
||||||
connect(modules[i], SIGNAL(modified()), this, SLOT(onChildModified()));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (firmware->getCapability(ModelTrainerEnable)) {
|
|
||||||
modules[C9X_NUM_MODULES] = new ModulePanel(this, model, model.moduleData[C9X_NUM_MODULES], generalSettings, firmware, -1);
|
|
||||||
ui->modulesLayout->addWidget(modules[C9X_NUM_MODULES]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (firmware->getCapability(ModelImage)) {
|
if (firmware->getCapability(ModelImage)) {
|
||||||
QStringList items;
|
QStringList items;
|
||||||
items.append("");
|
items.append("");
|
||||||
|
@ -438,12 +425,28 @@ SetupPanel::SetupPanel(QWidget *parent, ModelData & model, GeneralSettings & gen
|
||||||
ui->modelImage_label->hide();
|
ui->modelImage_label->hide();
|
||||||
ui->imagePreview->hide();
|
ui->imagePreview->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QWidget *prevFocus = ui->image;
|
||||||
|
for (int i=0; i<C9X_MAX_TIMERS; i++) {
|
||||||
|
if (i<firmware->getCapability(Timers)) {
|
||||||
|
timers[i] = new TimerPanel(this, model, model.timers[i], generalSettings, firmware, prevFocus);
|
||||||
|
ui->gridLayout->addWidget(timers[i], 1+i, 1);
|
||||||
|
connect(timers[i], SIGNAL(modified()), this, SLOT(onChildModified()));
|
||||||
|
prevFocus = timers[i]->getLastFocus();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
foreach(QLabel *label, findChildren<QLabel *>(QRegExp(QString("label_timer%1").arg(i+1)))) {
|
||||||
|
label->hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!firmware->getCapability(HasDisplayText)) {
|
if (!firmware->getCapability(HasDisplayText)) {
|
||||||
ui->displayText->hide();
|
ui->displayText->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Beep Center checkboxes
|
// Beep Center checkboxes
|
||||||
|
prevFocus = ui->trimsDisplay;
|
||||||
int analogs = 4 + firmware->getCapability(Pots);
|
int analogs = 4 + firmware->getCapability(Pots);
|
||||||
for (int i=0; i<analogs+firmware->getCapability(RotaryEncoders); i++) {
|
for (int i=0; i<analogs+firmware->getCapability(RotaryEncoders); i++) {
|
||||||
QCheckBox * checkbox = new QCheckBox(this);
|
QCheckBox * checkbox = new QCheckBox(this);
|
||||||
|
@ -455,6 +458,8 @@ SetupPanel::SetupPanel(QWidget *parent, ModelData & model, GeneralSettings & gen
|
||||||
if (!IS_TARANIS_PLUS(board) && i==6) {
|
if (!IS_TARANIS_PLUS(board) && i==6) {
|
||||||
checkbox->hide();
|
checkbox->hide();
|
||||||
}
|
}
|
||||||
|
QWidget::setTabOrder(prevFocus, checkbox);
|
||||||
|
prevFocus = checkbox;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Startup switches warnings
|
// Startup switches warnings
|
||||||
|
@ -498,10 +503,14 @@ SetupPanel::SetupPanel(QWidget *parent, ModelData & model, GeneralSettings & gen
|
||||||
connect(cb, SIGNAL(toggled(bool)), this, SLOT(startupSwitchToggled(bool)));
|
connect(cb, SIGNAL(toggled(bool)), this, SLOT(startupSwitchToggled(bool)));
|
||||||
startupSwitchesSliders << slider;
|
startupSwitchesSliders << slider;
|
||||||
startupSwitchesCheckboxes << cb;
|
startupSwitchesCheckboxes << cb;
|
||||||
|
QWidget::setTabOrder(prevFocus, slider);
|
||||||
|
QWidget::setTabOrder(slider, cb);
|
||||||
|
prevFocus = cb;
|
||||||
}
|
}
|
||||||
ui->switchesStartupLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, firmware->getCapability(Switches));
|
ui->switchesStartupLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, firmware->getCapability(Switches));
|
||||||
|
|
||||||
// Pot warnings
|
// Pot warnings
|
||||||
|
prevFocus = ui->potWarningMode;
|
||||||
if (IS_TARANIS(board)) {
|
if (IS_TARANIS(board)) {
|
||||||
for (int i=0; i<firmware->getCapability(Pots); i++) {
|
for (int i=0; i<firmware->getCapability(Pots); i++) {
|
||||||
QCheckBox * cb = new QCheckBox(this);
|
QCheckBox * cb = new QCheckBox(this);
|
||||||
|
@ -513,6 +522,8 @@ SetupPanel::SetupPanel(QWidget *parent, ModelData & model, GeneralSettings & gen
|
||||||
if (!IS_TARANIS_PLUS(board) && i==2) {
|
if (!IS_TARANIS_PLUS(board) && i==2) {
|
||||||
cb->hide();
|
cb->hide();
|
||||||
}
|
}
|
||||||
|
QWidget::setTabOrder(prevFocus, cb);
|
||||||
|
prevFocus = cb;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -528,6 +539,16 @@ SetupPanel::SetupPanel(QWidget *parent, ModelData & model, GeneralSettings & gen
|
||||||
ui->trimsDisplay->hide();
|
ui->trimsDisplay->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (int i=0; i<firmware->getCapability(NumModules); i++) {
|
||||||
|
modules[i] = new ModulePanel(this, model, model.moduleData[i], generalSettings, firmware, i);
|
||||||
|
ui->modulesLayout->addWidget(modules[i]);
|
||||||
|
connect(modules[i], SIGNAL(modified()), this, SLOT(onChildModified()));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (firmware->getCapability(ModelTrainerEnable)) {
|
||||||
|
modules[C9X_NUM_MODULES] = new ModulePanel(this, model, model.moduleData[C9X_NUM_MODULES], generalSettings, firmware, -1);
|
||||||
|
ui->modulesLayout->addWidget(modules[C9X_NUM_MODULES]);
|
||||||
|
}
|
||||||
|
|
||||||
disableMouseScrolling();
|
disableMouseScrolling();
|
||||||
|
|
||||||
|
|
|
@ -21,10 +21,11 @@ class TimerPanel : public ModelPanel
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TimerPanel(QWidget *parent, ModelData & model, TimerData & timer, GeneralSettings & generalSettings, FirmwareInterface * firmware);
|
TimerPanel(QWidget *parent, ModelData & model, TimerData & timer, GeneralSettings & generalSettings, FirmwareInterface * firmware, QWidget *prevFocus);
|
||||||
virtual ~TimerPanel();
|
virtual ~TimerPanel();
|
||||||
|
|
||||||
virtual void update();
|
virtual void update();
|
||||||
|
QWidget * getLastFocus();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_mode_currentIndexChanged(int index);
|
void on_mode_currentIndexChanged(int index);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue