mirror of
https://github.com/opentx/opentx.git
synced 2025-07-23 16:25:16 +03:00
36 switches hidden in Companion when no Multipos switches ...
This commit is contained in:
parent
a522dc149f
commit
1bf95c9438
29 changed files with 101 additions and 93 deletions
|
@ -361,8 +361,10 @@ void populateBacklightCB(QComboBox *b, const uint8_t value)
|
||||||
|
|
||||||
void populateAndSwitchCB(QComboBox *b, const RawSwitch & value)
|
void populateAndSwitchCB(QComboBox *b, const RawSwitch & value)
|
||||||
{
|
{
|
||||||
|
GeneralSettings fakeSettings;
|
||||||
|
|
||||||
if (IS_ARM(GetEepromInterface()->getBoard())) {
|
if (IS_ARM(GetEepromInterface()->getBoard())) {
|
||||||
populateSwitchCB(b, value);
|
populateSwitchCB(b, value, fakeSettings);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
RawSwitch item;
|
RawSwitch item;
|
||||||
|
@ -387,7 +389,7 @@ void populateAndSwitchCB(QComboBox *b, const RawSwitch & value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void populateSwitchCB(QComboBox *b, const RawSwitch & value, unsigned long attr)
|
void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettings & generalSettings, unsigned long attr)
|
||||||
{
|
{
|
||||||
RawSwitch item;
|
RawSwitch item;
|
||||||
|
|
||||||
|
@ -417,10 +419,14 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, unsigned long attr)
|
||||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i=-GetEepromInterface()->getCapability(MultiposPots) * GetEepromInterface()->getCapability(MultiposPotsPositions); i<0; i++) {
|
for (int i=GetEepromInterface()->getCapability(MultiposPots)-1; i>=0; i--) {
|
||||||
item = RawSwitch(SWITCH_TYPE_MULTIPOS_POT, i);
|
if (generalSettings.potsType[i] == 2/* TODO constant*/) {
|
||||||
b->addItem(item.toString(), item.toValue());
|
for (int j=-GetEepromInterface()->getCapability(MultiposPotsPositions); j<0; j++) {
|
||||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
item = RawSwitch(SWITCH_TYPE_MULTIPOS_POT, -i*GetEepromInterface()->getCapability(MultiposPotsPositions)+j);
|
||||||
|
b->addItem(item.toString(), item.toValue());
|
||||||
|
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i=-GetEepromInterface()->getCapability(SwitchesPositions); i<0; i++) {
|
for (int i=-GetEepromInterface()->getCapability(SwitchesPositions); i<0; i++) {
|
||||||
|
@ -448,10 +454,14 @@ void populateSwitchCB(QComboBox *b, const RawSwitch & value, unsigned long attr)
|
||||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i=1; i<=GetEepromInterface()->getCapability(MultiposPots) * GetEepromInterface()->getCapability(MultiposPotsPositions); i++) {
|
for (int i=0; i<GetEepromInterface()->getCapability(MultiposPots); i++) {
|
||||||
item = RawSwitch(SWITCH_TYPE_MULTIPOS_POT, i);
|
if (generalSettings.potsType[i] == 2/* TODO constant*/) {
|
||||||
b->addItem(item.toString(), item.toValue());
|
for (int j=1; j<=GetEepromInterface()->getCapability(MultiposPotsPositions); j++) {
|
||||||
if (item == value) b->setCurrentIndex(b->count()-1);
|
item = RawSwitch(SWITCH_TYPE_MULTIPOS_POT, i*GetEepromInterface()->getCapability(MultiposPotsPositions)+j);
|
||||||
|
b->addItem(item.toString(), item.toValue());
|
||||||
|
if (item == value) b->setCurrentIndex(b->count()-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i=1; i<=8; i++) {
|
for (int i=1; i<=8; i++) {
|
||||||
|
|
|
@ -85,7 +85,7 @@ class CurveGroup : public QObject {
|
||||||
#define POPULATE_ONOFF 0x01
|
#define POPULATE_ONOFF 0x01
|
||||||
#define POPULATE_TIMER_MODES 0x02
|
#define POPULATE_TIMER_MODES 0x02
|
||||||
void populateAndSwitchCB(QComboBox *b, const RawSwitch & value);
|
void populateAndSwitchCB(QComboBox *b, const RawSwitch & value);
|
||||||
void populateSwitchCB(QComboBox *b, const RawSwitch & value, unsigned long attr=0);
|
void populateSwitchCB(QComboBox *b, const RawSwitch & value, const GeneralSettings & generalSettings, unsigned long attr=0);
|
||||||
|
|
||||||
void populatePhasesCB(QComboBox *b, int value);
|
void populatePhasesCB(QComboBox *b, int value);
|
||||||
void populateGvarUseCB(QComboBox *b, unsigned int phase);
|
void populateGvarUseCB(QComboBox *b, unsigned int phase);
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
#include <QDoubleSpinBox>
|
#include <QDoubleSpinBox>
|
||||||
|
|
||||||
Channels::Channels(QWidget * parent, ModelData & model):
|
Channels::Channels(QWidget * parent, ModelData & model, GeneralSettings & generalSettings):
|
||||||
ModelPanel(parent, model)
|
ModelPanel(parent, model, generalSettings)
|
||||||
{
|
{
|
||||||
QGridLayout * gridLayout = new QGridLayout(this);
|
QGridLayout * gridLayout = new QGridLayout(this);
|
||||||
bool minimize = false;
|
bool minimize = false;
|
||||||
|
|
|
@ -8,7 +8,7 @@ class Channels : public ModelPanel
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Channels(QWidget *parent, ModelData & model);
|
Channels(QWidget *parent, ModelData & model, GeneralSettings & generalSettings);
|
||||||
~Channels();
|
~Channels();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
|
@ -130,8 +130,8 @@ float curveSymmetricalX(float x, float coeff, float yMin, float yMid, float yMax
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Curves::Curves(QWidget * parent, ModelData & model):
|
Curves::Curves(QWidget * parent, ModelData & model, GeneralSettings & generalSettings):
|
||||||
ModelPanel(parent, model),
|
ModelPanel(parent, model, generalSettings),
|
||||||
ui(new Ui::Curves),
|
ui(new Ui::Curves),
|
||||||
currentCurve(0)
|
currentCurve(0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,7 +21,7 @@ class Curves : public ModelPanel
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Curves(QWidget *parent, ModelData & model);
|
Curves(QWidget *parent, ModelData & model, GeneralSettings & generalSettings);
|
||||||
virtual ~Curves();
|
virtual ~Curves();
|
||||||
|
|
||||||
virtual void update();
|
virtual void update();
|
||||||
|
|
|
@ -48,8 +48,7 @@ void RepeatComboBox::update()
|
||||||
}
|
}
|
||||||
|
|
||||||
CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData & model, GeneralSettings & generalSettings):
|
CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData & model, GeneralSettings & generalSettings):
|
||||||
ModelPanel(parent, model),
|
ModelPanel(parent, model, generalSettings),
|
||||||
generalSettings(generalSettings),
|
|
||||||
initialized(false),
|
initialized(false),
|
||||||
phononCurrent(-1),
|
phononCurrent(-1),
|
||||||
clickObject(NULL),
|
clickObject(NULL),
|
||||||
|
@ -476,7 +475,7 @@ void CustomFunctionsPanel::update()
|
||||||
lock = true;
|
lock = true;
|
||||||
for (int i=0; i<GetEepromInterface()->getCapability(CustomFunctions); i++) {
|
for (int i=0; i<GetEepromInterface()->getCapability(CustomFunctions); i++) {
|
||||||
if (!initialized) {
|
if (!initialized) {
|
||||||
populateSwitchCB(fswtchSwtch[i], model.funcSw[i].swtch, POPULATE_ONOFF);
|
populateSwitchCB(fswtchSwtch[i], model.funcSw[i].swtch, generalSettings, POPULATE_ONOFF);
|
||||||
populateFuncCB(fswtchFunc[i], model.funcSw[i].func);
|
populateFuncCB(fswtchFunc[i], model.funcSw[i].func);
|
||||||
populateGVmodeCB(fswtchGVmode[i], model.funcSw[i].adjustMode);
|
populateGVmodeCB(fswtchGVmode[i], model.funcSw[i].adjustMode);
|
||||||
populateFuncParamCB(fswtchParamT[i], model, model.funcSw[i].func, model.funcSw[i].param, model.funcSw[i].adjustMode);
|
populateFuncParamCB(fswtchParamT[i], model, model.funcSw[i].func, model.funcSw[i].param, model.funcSw[i].adjustMode);
|
||||||
|
@ -497,7 +496,7 @@ void CustomFunctionsPanel::fswPaste()
|
||||||
FuncSwData *fsw = &model.funcSw[selectedFunction];
|
FuncSwData *fsw = &model.funcSw[selectedFunction];
|
||||||
memcpy(fsw, fswData.mid(0, sizeof(FuncSwData)).constData(), sizeof(FuncSwData));
|
memcpy(fsw, fswData.mid(0, sizeof(FuncSwData)).constData(), sizeof(FuncSwData));
|
||||||
lock = true;
|
lock = true;
|
||||||
populateSwitchCB(fswtchSwtch[selectedFunction], model.funcSw[selectedFunction].swtch, POPULATE_ONOFF);
|
populateSwitchCB(fswtchSwtch[selectedFunction], model.funcSw[selectedFunction].swtch, generalSettings, POPULATE_ONOFF);
|
||||||
populateFuncCB(fswtchFunc[selectedFunction], model.funcSw[selectedFunction].func);
|
populateFuncCB(fswtchFunc[selectedFunction], model.funcSw[selectedFunction].func);
|
||||||
refreshCustomFunction(selectedFunction);
|
refreshCustomFunction(selectedFunction);
|
||||||
lock = false;
|
lock = false;
|
||||||
|
@ -510,7 +509,7 @@ void CustomFunctionsPanel::fswDelete()
|
||||||
model.funcSw[selectedFunction].clear();
|
model.funcSw[selectedFunction].clear();
|
||||||
// TODO update switch and func
|
// TODO update switch and func
|
||||||
lock = true;
|
lock = true;
|
||||||
populateSwitchCB(fswtchSwtch[selectedFunction], model.funcSw[selectedFunction].swtch, POPULATE_ONOFF);
|
populateSwitchCB(fswtchSwtch[selectedFunction], model.funcSw[selectedFunction].swtch, generalSettings, POPULATE_ONOFF);
|
||||||
populateFuncCB(fswtchFunc[selectedFunction], model.funcSw[selectedFunction].func);
|
populateFuncCB(fswtchFunc[selectedFunction], model.funcSw[selectedFunction].func);
|
||||||
refreshCustomFunction(selectedFunction);
|
refreshCustomFunction(selectedFunction);
|
||||||
lock = false;
|
lock = false;
|
||||||
|
|
|
@ -61,7 +61,6 @@ class CustomFunctionsPanel : public ModelPanel
|
||||||
void populateFuncParamCB(QComboBox *b, const ModelData & model, uint function, unsigned int value, unsigned int adjustmode=0);
|
void populateFuncParamCB(QComboBox *b, const ModelData & model, uint function, unsigned int value, unsigned int adjustmode=0);
|
||||||
void populateFuncParamArmTCB(QComboBox *b, char * value, QStringList & paramsList);
|
void populateFuncParamArmTCB(QComboBox *b, char * value, QStringList & paramsList);
|
||||||
|
|
||||||
GeneralSettings & generalSettings;
|
|
||||||
bool initialized;
|
bool initialized;
|
||||||
QStringList paramarmList;
|
QStringList paramarmList;
|
||||||
int phononCurrent;
|
int phononCurrent;
|
||||||
|
|
|
@ -2,12 +2,13 @@
|
||||||
#include "ui_expodialog.h"
|
#include "ui_expodialog.h"
|
||||||
#include "helpers.h"
|
#include "helpers.h"
|
||||||
|
|
||||||
ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, int stickMode, char * inputName) :
|
ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, GeneralSettings & generalSettings, char * inputName) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
ui(new Ui::ExpoDialog),
|
ui(new Ui::ExpoDialog),
|
||||||
model(model),
|
model(model),
|
||||||
ed(expoData),
|
generalSettings(generalSettings),
|
||||||
inputName(inputName)
|
ed(expoData),
|
||||||
|
inputName(inputName)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
QLabel * lb_fp[] = {ui->lb_FP0,ui->lb_FP1,ui->lb_FP2,ui->lb_FP3,ui->lb_FP4,ui->lb_FP5,ui->lb_FP6,ui->lb_FP7,ui->lb_FP8 };
|
QLabel * lb_fp[] = {ui->lb_FP0,ui->lb_FP1,ui->lb_FP2,ui->lb_FP3,ui->lb_FP4,ui->lb_FP5,ui->lb_FP6,ui->lb_FP7,ui->lb_FP8 };
|
||||||
|
@ -23,7 +24,7 @@ ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, i
|
||||||
|
|
||||||
curveGroup = new CurveGroup(ui->curveTypeCB, ui->curveGVarCB, ui->curveValueCB, ui->curveValueSB, ed->curve);
|
curveGroup = new CurveGroup(ui->curveTypeCB, ui->curveGVarCB, ui->curveValueCB, ui->curveValueSB, ed->curve);
|
||||||
|
|
||||||
populateSwitchCB(ui->switchesCB,ed->swtch);
|
populateSwitchCB(ui->switchesCB, ed->swtch, generalSettings);
|
||||||
|
|
||||||
ui->sideCB->setCurrentIndex(ed->mode-1);
|
ui->sideCB->setCurrentIndex(ed->mode-1);
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ namespace Ui {
|
||||||
class ExpoDialog : public QDialog {
|
class ExpoDialog : public QDialog {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expodata, int stickMode, char * inputName);
|
ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expodata, GeneralSettings & generalSettings, char * inputName);
|
||||||
~ExpoDialog();
|
~ExpoDialog();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -27,6 +27,7 @@ class ExpoDialog : public QDialog {
|
||||||
private:
|
private:
|
||||||
Ui::ExpoDialog * ui;
|
Ui::ExpoDialog * ui;
|
||||||
ModelData & model;
|
ModelData & model;
|
||||||
|
GeneralSettings & generalSettings;
|
||||||
ExpoData * ed;
|
ExpoData * ed;
|
||||||
char * inputName;
|
char * inputName;
|
||||||
GVarGroup * gvGroup;
|
GVarGroup * gvGroup;
|
||||||
|
|
|
@ -6,9 +6,8 @@
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
|
|
||||||
FlightMode::FlightMode(QWidget * parent, ModelData & model, int phaseIdx, GeneralSettings & generalSettings):
|
FlightMode::FlightMode(QWidget * parent, ModelData & model, int phaseIdx, GeneralSettings & generalSettings):
|
||||||
ModelPanel(parent, model),
|
ModelPanel(parent, model, generalSettings),
|
||||||
ui(new Ui::FlightMode),
|
ui(new Ui::FlightMode),
|
||||||
generalSettings(generalSettings),
|
|
||||||
phaseIdx(phaseIdx),
|
phaseIdx(phaseIdx),
|
||||||
phase(model.phaseData[phaseIdx]),
|
phase(model.phaseData[phaseIdx]),
|
||||||
reCount(GetEepromInterface()->getCapability(RotaryEncoders)),
|
reCount(GetEepromInterface()->getCapability(RotaryEncoders)),
|
||||||
|
@ -32,7 +31,7 @@ FlightMode::FlightMode(QWidget * parent, ModelData & model, int phaseIdx, Genera
|
||||||
|
|
||||||
// Phase switch
|
// Phase switch
|
||||||
if (phaseIdx > 0) {
|
if (phaseIdx > 0) {
|
||||||
populateSwitchCB(ui->swtch, phase.swtch);
|
populateSwitchCB(ui->swtch, phase.swtch, generalSettings);
|
||||||
connect(ui->swtch, SIGNAL(currentIndexChanged(int)), this, SLOT(phaseSwitch_currentIndexChanged(int)));
|
connect(ui->swtch, SIGNAL(currentIndexChanged(int)), this, SLOT(phaseSwitch_currentIndexChanged(int)));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -401,7 +400,7 @@ void FlightMode::phaseTrimSlider_valueChanged()
|
||||||
/**********************************************************/
|
/**********************************************************/
|
||||||
|
|
||||||
FlightModes::FlightModes(QWidget * parent, ModelData & model, GeneralSettings & generalSettings):
|
FlightModes::FlightModes(QWidget * parent, ModelData & model, GeneralSettings & generalSettings):
|
||||||
ModelPanel(parent, model),
|
ModelPanel(parent, model, generalSettings),
|
||||||
modesCount(GetEepromInterface()->getCapability(FlightPhases))
|
modesCount(GetEepromInterface()->getCapability(FlightPhases))
|
||||||
{
|
{
|
||||||
QGridLayout * gridLayout = new QGridLayout(this);
|
QGridLayout * gridLayout = new QGridLayout(this);
|
||||||
|
|
|
@ -42,7 +42,6 @@ class FlightMode : public ModelPanel
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::FlightMode *ui;
|
Ui::FlightMode *ui;
|
||||||
GeneralSettings & generalSettings;
|
|
||||||
int phaseIdx;
|
int phaseIdx;
|
||||||
PhaseData & phase;
|
PhaseData & phase;
|
||||||
int reCount;
|
int reCount;
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
#include "ui_heli.h"
|
#include "ui_heli.h"
|
||||||
#include "helpers.h"
|
#include "helpers.h"
|
||||||
|
|
||||||
HeliPanel::HeliPanel(QWidget *parent, ModelData & model):
|
HeliPanel::HeliPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings):
|
||||||
ModelPanel(parent, model),
|
ModelPanel(parent, model, generalSettings),
|
||||||
ui(new Ui::Heli)
|
ui(new Ui::Heli)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
|
@ -12,7 +12,7 @@ class HeliPanel : public ModelPanel
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
HeliPanel(QWidget *parent, ModelData & model);
|
HeliPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings);
|
||||||
~HeliPanel();
|
~HeliPanel();
|
||||||
void update();
|
void update();
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,7 @@
|
||||||
#include "helpers.h"
|
#include "helpers.h"
|
||||||
|
|
||||||
InputsPanel::InputsPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings):
|
InputsPanel::InputsPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings):
|
||||||
ModelPanel(parent, model),
|
ModelPanel(parent, model, generalSettings),
|
||||||
generalSettings(generalSettings),
|
|
||||||
expoInserted(false)
|
expoInserted(false)
|
||||||
{
|
{
|
||||||
QGridLayout * exposLayout = new QGridLayout(this);
|
QGridLayout * exposLayout = new QGridLayout(this);
|
||||||
|
@ -175,7 +174,7 @@ void InputsPanel::gm_openExpo(int index)
|
||||||
if (GetEepromInterface()->getCapability(VirtualInputs))
|
if (GetEepromInterface()->getCapability(VirtualInputs))
|
||||||
strcpy(inputName, model.inputNames[mixd.chn]);
|
strcpy(inputName, model.inputNames[mixd.chn]);
|
||||||
|
|
||||||
ExpoDialog *g = new ExpoDialog(this, model, &mixd, generalSettings.stickMode, inputName);
|
ExpoDialog *g = new ExpoDialog(this, model, &mixd, generalSettings, inputName);
|
||||||
if (g->exec()) {
|
if (g->exec()) {
|
||||||
model.expoData[index] = mixd;
|
model.expoData[index] = mixd;
|
||||||
if (GetEepromInterface()->getCapability(VirtualInputs))
|
if (GetEepromInterface()->getCapability(VirtualInputs))
|
||||||
|
|
|
@ -31,7 +31,6 @@ class InputsPanel : public ModelPanel
|
||||||
void expoAdd();
|
void expoAdd();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GeneralSettings & generalSettings;
|
|
||||||
bool expoInserted;
|
bool expoInserted;
|
||||||
MixersList *ExposlistWidget;
|
MixersList *ExposlistWidget;
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
#include <QDoubleSpinBox>
|
#include <QDoubleSpinBox>
|
||||||
#include "helpers.h"
|
#include "helpers.h"
|
||||||
|
|
||||||
LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model):
|
LogicalSwitchesPanel::LogicalSwitchesPanel(QWidget * parent, ModelData & model, GeneralSettings & generalSettings):
|
||||||
ModelPanel(parent, model),
|
ModelPanel(parent, model, generalSettings),
|
||||||
selectedSwitch(0)
|
selectedSwitch(0)
|
||||||
{
|
{
|
||||||
QGridLayout * gridLayout = new QGridLayout(this);
|
QGridLayout * gridLayout = new QGridLayout(this);
|
||||||
|
@ -303,12 +303,12 @@ void LogicalSwitchesPanel::setSwitchWidgetVisibility(int i)
|
||||||
case LS_FAMILY_VBOOL:
|
case LS_FAMILY_VBOOL:
|
||||||
case LS_FAMILY_STICKY:
|
case LS_FAMILY_STICKY:
|
||||||
mask |= SOURCE1_VISIBLE | SOURCE2_VISIBLE;
|
mask |= SOURCE1_VISIBLE | SOURCE2_VISIBLE;
|
||||||
populateSwitchCB(cswitchSource1[i], RawSwitch(model.customSw[i].val1));
|
populateSwitchCB(cswitchSource1[i], RawSwitch(model.customSw[i].val1), generalSettings);
|
||||||
populateSwitchCB(cswitchSource2[i], RawSwitch(model.customSw[i].val2));
|
populateSwitchCB(cswitchSource2[i], RawSwitch(model.customSw[i].val2), generalSettings);
|
||||||
break;
|
break;
|
||||||
case LS_FAMILY_STAY:
|
case LS_FAMILY_STAY:
|
||||||
mask |= SOURCE1_VISIBLE | VALUE2_VISIBLE | VALUE3_VISIBLE;
|
mask |= SOURCE1_VISIBLE | VALUE2_VISIBLE | VALUE3_VISIBLE;
|
||||||
populateSwitchCB(cswitchSource1[i], RawSwitch(model.customSw[i].val1));
|
populateSwitchCB(cswitchSource1[i], RawSwitch(model.customSw[i].val1), generalSettings);
|
||||||
updateTimerParam(cswitchOffset[i], model.customSw[i].val2, true);
|
updateTimerParam(cswitchOffset[i], model.customSw[i].val2, true);
|
||||||
updateTimerParam(cswitchOffset2[i], model.customSw[i].val2+model.customSw[i].val3, true);
|
updateTimerParam(cswitchOffset2[i], model.customSw[i].val2+model.customSw[i].val3, true);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -10,7 +10,7 @@ class LogicalSwitchesPanel : public ModelPanel
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LogicalSwitchesPanel(QWidget *parent, ModelData & model);
|
LogicalSwitchesPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings);
|
||||||
virtual ~LogicalSwitchesPanel();
|
virtual ~LogicalSwitchesPanel();
|
||||||
|
|
||||||
virtual void update();
|
virtual void update();
|
||||||
|
|
|
@ -3,12 +3,13 @@
|
||||||
#include "eeprominterface.h"
|
#include "eeprominterface.h"
|
||||||
#include "helpers.h"
|
#include "helpers.h"
|
||||||
|
|
||||||
MixerDialog::MixerDialog(QWidget *parent, ModelData & model, MixData *mixdata, int stickMode) :
|
MixerDialog::MixerDialog(QWidget *parent, ModelData & model, MixData *mixdata, GeneralSettings & generalSettings) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
ui(new Ui::MixerDialog),
|
ui(new Ui::MixerDialog),
|
||||||
model(model),
|
model(model),
|
||||||
md(mixdata),
|
generalSettings(generalSettings),
|
||||||
lock(false)
|
md(mixdata),
|
||||||
|
lock(false)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
QRegExp rx(CHAR_FOR_NAMES_REGEX);
|
QRegExp rx(CHAR_FOR_NAMES_REGEX);
|
||||||
|
@ -76,7 +77,7 @@ MixerDialog::MixerDialog(QWidget *parent, ModelData & model, MixData *mixdata, i
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
populateSwitchCB(ui->switchesCB,md->swtch);
|
populateSwitchCB(ui->switchesCB, md->swtch, generalSettings);
|
||||||
ui->warningCB->setCurrentIndex(md->mixWarn);
|
ui->warningCB->setCurrentIndex(md->mixWarn);
|
||||||
ui->mltpxCB->setCurrentIndex(md->mltpx);
|
ui->mltpxCB->setCurrentIndex(md->mltpx);
|
||||||
int scale=GetEepromInterface()->getCapability(SlowScale);
|
int scale=GetEepromInterface()->getCapability(SlowScale);
|
||||||
|
|
|
@ -14,7 +14,7 @@ namespace Ui {
|
||||||
class MixerDialog : public QDialog {
|
class MixerDialog : public QDialog {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
MixerDialog(QWidget *parent, ModelData & model, MixData *mixdata, int stickMode);
|
MixerDialog(QWidget *parent, ModelData & model, MixData *mixdata, GeneralSettings & generalSettings);
|
||||||
~MixerDialog();
|
~MixerDialog();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -27,6 +27,7 @@ class MixerDialog : public QDialog {
|
||||||
private:
|
private:
|
||||||
Ui::MixerDialog *ui;
|
Ui::MixerDialog *ui;
|
||||||
ModelData & model;
|
ModelData & model;
|
||||||
|
GeneralSettings & generalSettings;
|
||||||
MixData *md;
|
MixData *md;
|
||||||
bool lock;
|
bool lock;
|
||||||
GVarGroup * gvWeightGroup;
|
GVarGroup * gvWeightGroup;
|
||||||
|
|
|
@ -4,8 +4,7 @@
|
||||||
// #include "expodialog.h"
|
// #include "expodialog.h"
|
||||||
|
|
||||||
MixesPanel::MixesPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings):
|
MixesPanel::MixesPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings):
|
||||||
ModelPanel(parent, model),
|
ModelPanel(parent, model, generalSettings),
|
||||||
generalSettings(generalSettings),
|
|
||||||
mixInserted(false)
|
mixInserted(false)
|
||||||
{
|
{
|
||||||
QGridLayout * mixesLayout = new QGridLayout(this);
|
QGridLayout * mixesLayout = new QGridLayout(this);
|
||||||
|
@ -193,7 +192,7 @@ void MixesPanel::gm_openMix(int index)
|
||||||
emit modified();
|
emit modified();
|
||||||
update();
|
update();
|
||||||
|
|
||||||
MixerDialog *g = new MixerDialog(this, model, &mixd, generalSettings.stickMode);
|
MixerDialog *g = new MixerDialog(this, model, &mixd, generalSettings);
|
||||||
if(g->exec()) {
|
if(g->exec()) {
|
||||||
model.mixData[index] = mixd;
|
model.mixData[index] = mixd;
|
||||||
emit modified();
|
emit modified();
|
||||||
|
|
|
@ -38,7 +38,6 @@ class MixesPanel : public ModelPanel
|
||||||
void mixesEdited();
|
void mixesEdited();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GeneralSettings & generalSettings;
|
|
||||||
MixersList *MixerlistWidget;
|
MixersList *MixerlistWidget;
|
||||||
bool mixInserted;
|
bool mixInserted;
|
||||||
|
|
||||||
|
|
|
@ -25,18 +25,18 @@ ModelEdit::ModelEdit(RadioData & radioData, int modelId, bool openWizard, bool i
|
||||||
setWindowIcon(CompanionIcon("edit.png"));
|
setWindowIcon(CompanionIcon("edit.png"));
|
||||||
restoreGeometry(g.modelEditGeo());
|
restoreGeometry(g.modelEditGeo());
|
||||||
ui->pushButton->setIcon(CompanionIcon("simulate.png"));
|
ui->pushButton->setIcon(CompanionIcon("simulate.png"));
|
||||||
addTab(new Setup(this, model), tr("Setup"));
|
addTab(new Setup(this, model, generalSettings), tr("Setup"));
|
||||||
addTab(new HeliPanel(this, model), tr("Heli"));
|
addTab(new HeliPanel(this, model, generalSettings), tr("Heli"));
|
||||||
addTab(new FlightModes(this, model, radioData.generalSettings), tr("Flight Modes"));
|
addTab(new FlightModes(this, model, generalSettings), tr("Flight Modes"));
|
||||||
addTab(new InputsPanel(this, model, radioData.generalSettings), tr("Inputs"));
|
addTab(new InputsPanel(this, model, generalSettings), tr("Inputs"));
|
||||||
addTab(new MixesPanel(this, model, radioData.generalSettings), tr("Mixes"));
|
addTab(new MixesPanel(this, model, generalSettings), tr("Mixes"));
|
||||||
addTab(new Channels(this, model), tr("Channels"));
|
addTab(new Channels(this, model, generalSettings), tr("Channels"));
|
||||||
addTab(new LogicalSwitchesPanel(this, model), tr("Logical Switches"));
|
addTab(new LogicalSwitchesPanel(this, model, generalSettings), tr("Logical Switches"));
|
||||||
if (GetEepromInterface()->getCapability(CustomFunctions))
|
if (GetEepromInterface()->getCapability(CustomFunctions))
|
||||||
addTab(new CustomFunctionsPanel(this, model, radioData.generalSettings), tr("Special Functions"));
|
addTab(new CustomFunctionsPanel(this, model, generalSettings), tr("Special Functions"));
|
||||||
addTab(new Curves(this, model), tr("Curves"));
|
addTab(new Curves(this, model, generalSettings), tr("Curves"));
|
||||||
if (GetEepromInterface()->getCapability(Telemetry) & TM_HASTELEMETRY)
|
if (GetEepromInterface()->getCapability(Telemetry) & TM_HASTELEMETRY)
|
||||||
addTab(new TelemetryPanel(this, model), tr("Telemetry"));
|
addTab(new TelemetryPanel(this, model, generalSettings), tr("Telemetry"));
|
||||||
}
|
}
|
||||||
|
|
||||||
ModelEdit::~ModelEdit()
|
ModelEdit::~ModelEdit()
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
#include "modelpanel.h"
|
#include "modelpanel.h"
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
|
||||||
ModelPanel::ModelPanel(QWidget * parent, ModelData & model):
|
ModelPanel::ModelPanel(QWidget * parent, ModelData & model, GeneralSettings & generalSettings):
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
model(model),
|
model(model),
|
||||||
|
generalSettings(generalSettings),
|
||||||
lock(false)
|
lock(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ class ModelPanel : public QWidget
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ModelPanel(QWidget *parent, ModelData & model);
|
ModelPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings);
|
||||||
virtual ~ModelPanel();
|
virtual ~ModelPanel();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
@ -21,6 +21,7 @@ class ModelPanel : public QWidget
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ModelData & model;
|
ModelData & model;
|
||||||
|
GeneralSettings & generalSettings;
|
||||||
bool lock;
|
bool lock;
|
||||||
void addLabel(QGridLayout * gridLayout, QString text, int col, bool mimimize=false);
|
void addLabel(QGridLayout * gridLayout, QString text, int col, bool mimimize=false);
|
||||||
void addEmptyLabel(QGridLayout * gridLayout, int col);
|
void addEmptyLabel(QGridLayout * gridLayout, int col);
|
||||||
|
|
|
@ -5,8 +5,8 @@
|
||||||
#include "helpers.h"
|
#include "helpers.h"
|
||||||
#include "appdata.h"
|
#include "appdata.h"
|
||||||
|
|
||||||
TimerPanel::TimerPanel(QWidget *parent, ModelData & model, TimerData & timer):
|
TimerPanel::TimerPanel(QWidget *parent, ModelData & model, TimerData & timer, GeneralSettings & generalSettings):
|
||||||
ModelPanel(parent, model),
|
ModelPanel(parent, model, generalSettings),
|
||||||
timer(timer),
|
timer(timer),
|
||||||
ui(new Ui::Timer)
|
ui(new Ui::Timer)
|
||||||
{
|
{
|
||||||
|
@ -15,7 +15,7 @@ TimerPanel::TimerPanel(QWidget *parent, ModelData & model, TimerData & timer):
|
||||||
lock = true;
|
lock = true;
|
||||||
|
|
||||||
// Mode
|
// Mode
|
||||||
populateSwitchCB(ui->mode, timer.mode, POPULATE_TIMER_MODES);
|
populateSwitchCB(ui->mode, timer.mode, generalSettings, POPULATE_TIMER_MODES);
|
||||||
|
|
||||||
if (!GetEepromInterface()->getCapability(PermTimers)) {
|
if (!GetEepromInterface()->getCapability(PermTimers)) {
|
||||||
ui->persistent->hide();
|
ui->persistent->hide();
|
||||||
|
@ -94,8 +94,8 @@ void TimerPanel::on_minuteBeep_toggled(bool checked)
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
ModulePanel::ModulePanel(QWidget *parent, ModelData & model, ModuleData & module, int moduleIdx):
|
ModulePanel::ModulePanel(QWidget *parent, ModelData & model, ModuleData & module, GeneralSettings & generalSettings, int moduleIdx):
|
||||||
ModelPanel(parent, model),
|
ModelPanel(parent, model, generalSettings),
|
||||||
module(module),
|
module(module),
|
||||||
moduleIdx(moduleIdx),
|
moduleIdx(moduleIdx),
|
||||||
ui(new Ui::Module)
|
ui(new Ui::Module)
|
||||||
|
@ -320,8 +320,8 @@ void ModulePanel::onFailsafeSpinChanged(double value)
|
||||||
|
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
|
|
||||||
Setup::Setup(QWidget *parent, ModelData & model):
|
Setup::Setup(QWidget *parent, ModelData & model, GeneralSettings & generalSettings):
|
||||||
ModelPanel(parent, model),
|
ModelPanel(parent, model, generalSettings),
|
||||||
ui(new Ui::Setup)
|
ui(new Ui::Setup)
|
||||||
{
|
{
|
||||||
lock = true;
|
lock = true;
|
||||||
|
@ -333,19 +333,19 @@ Setup::Setup(QWidget *parent, ModelData & model):
|
||||||
ui->name->setMaxLength(IS_TARANIS(GetEepromInterface()->getBoard()) ? 12 : 10);
|
ui->name->setMaxLength(IS_TARANIS(GetEepromInterface()->getBoard()) ? 12 : 10);
|
||||||
|
|
||||||
for (int i=0; i<C9X_MAX_TIMERS; i++) {
|
for (int i=0; i<C9X_MAX_TIMERS; i++) {
|
||||||
timers[i] = new TimerPanel(this, model, model.timers[i]);
|
timers[i] = new TimerPanel(this, model, model.timers[i], generalSettings);
|
||||||
ui->gridLayout->addWidget(timers[i], 1+i, 1);
|
ui->gridLayout->addWidget(timers[i], 1+i, 1);
|
||||||
connect(timers[i], SIGNAL(modified()), this, SLOT(onChildModified()));
|
connect(timers[i], SIGNAL(modified()), this, SLOT(onChildModified()));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i=0; i<GetEepromInterface()->getCapability(NumModules); i++) {
|
for (int i=0; i<GetEepromInterface()->getCapability(NumModules); i++) {
|
||||||
modules[i] = new ModulePanel(this, model, model.moduleData[i], i);
|
modules[i] = new ModulePanel(this, model, model.moduleData[i], generalSettings, i);
|
||||||
ui->modulesLayout->addWidget(modules[i]);
|
ui->modulesLayout->addWidget(modules[i]);
|
||||||
connect(modules[i], SIGNAL(modified()), this, SLOT(onChildModified()));
|
connect(modules[i], SIGNAL(modified()), this, SLOT(onChildModified()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetEepromInterface()->getCapability(ModelTrainerEnable)) {
|
if (GetEepromInterface()->getCapability(ModelTrainerEnable)) {
|
||||||
modules[C9X_NUM_MODULES] = new ModulePanel(this, model, model.moduleData[C9X_NUM_MODULES], -1);
|
modules[C9X_NUM_MODULES] = new ModulePanel(this, model, model.moduleData[C9X_NUM_MODULES], generalSettings, -1);
|
||||||
ui->modulesLayout->addWidget(modules[C9X_NUM_MODULES]);
|
ui->modulesLayout->addWidget(modules[C9X_NUM_MODULES]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ class TimerPanel : public ModelPanel
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TimerPanel(QWidget *parent, ModelData & model, TimerData & timer);
|
TimerPanel(QWidget *parent, ModelData & model, TimerData & timer, GeneralSettings & generalSettings);
|
||||||
virtual ~TimerPanel();
|
virtual ~TimerPanel();
|
||||||
|
|
||||||
virtual void update();
|
virtual void update();
|
||||||
|
@ -42,7 +42,7 @@ class ModulePanel : public ModelPanel
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ModulePanel(QWidget *parent, ModelData & model, ModuleData & module, int moduleIdx);
|
ModulePanel(QWidget *parent, ModelData & model, ModuleData & module, GeneralSettings & generalSettings, int moduleIdx);
|
||||||
virtual ~ModulePanel();
|
virtual ~ModulePanel();
|
||||||
|
|
||||||
virtual void update();
|
virtual void update();
|
||||||
|
@ -71,7 +71,7 @@ class Setup : public ModelPanel
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Setup(QWidget *parent, ModelData & model);
|
Setup(QWidget *parent, ModelData & model, GeneralSettings & generalSettings);
|
||||||
virtual ~Setup();
|
virtual ~Setup();
|
||||||
|
|
||||||
virtual void update();
|
virtual void update();
|
||||||
|
|
|
@ -280,8 +280,8 @@ TelemetryAnalog::~TelemetryAnalog()
|
||||||
|
|
||||||
/******************************************************/
|
/******************************************************/
|
||||||
|
|
||||||
TelemetryCustomScreen::TelemetryCustomScreen(QWidget *parent, ModelData & model, FrSkyScreenData & screen):
|
TelemetryCustomScreen::TelemetryCustomScreen(QWidget *parent, ModelData & model, FrSkyScreenData & screen, GeneralSettings & generalSettings):
|
||||||
ModelPanel(parent, model),
|
ModelPanel(parent, model, generalSettings),
|
||||||
ui(new Ui::TelemetryCustomScreen),
|
ui(new Ui::TelemetryCustomScreen),
|
||||||
screen(screen)
|
screen(screen)
|
||||||
{
|
{
|
||||||
|
@ -465,8 +465,8 @@ void TelemetryCustomScreen::barMaxChanged(double value)
|
||||||
|
|
||||||
/******************************************************/
|
/******************************************************/
|
||||||
|
|
||||||
TelemetryPanel::TelemetryPanel(QWidget *parent, ModelData & model):
|
TelemetryPanel::TelemetryPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings):
|
||||||
ModelPanel(parent, model),
|
ModelPanel(parent, model, generalSettings),
|
||||||
ui(new Ui::Telemetry)
|
ui(new Ui::Telemetry)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
@ -484,7 +484,7 @@ TelemetryPanel::TelemetryPanel(QWidget *parent, ModelData & model):
|
||||||
connect(analogs[1], SIGNAL(modified()), this, SLOT(onAnalogModified()));
|
connect(analogs[1], SIGNAL(modified()), this, SLOT(onAnalogModified()));
|
||||||
|
|
||||||
for (int i=0; i<GetEepromInterface()->getCapability(TelemetryCustomScreens); i++) {
|
for (int i=0; i<GetEepromInterface()->getCapability(TelemetryCustomScreens); i++) {
|
||||||
TelemetryCustomScreen * tab = new TelemetryCustomScreen(this, model, model.frsky.screens[i]);
|
TelemetryCustomScreen * tab = new TelemetryCustomScreen(this, model, model.frsky.screens[i], generalSettings);
|
||||||
ui->customScreens->addTab(tab, tr("Telemetry screen %1").arg(i+1));
|
ui->customScreens->addTab(tab, tr("Telemetry screen %1").arg(i+1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ class TelemetryCustomScreen : public ModelPanel
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TelemetryCustomScreen(QWidget *parent, ModelData & model, FrSkyScreenData & screen);
|
TelemetryCustomScreen(QWidget *parent, ModelData & model, FrSkyScreenData & screen, GeneralSettings & generalSettings);
|
||||||
~TelemetryCustomScreen();
|
~TelemetryCustomScreen();
|
||||||
void update();
|
void update();
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ class TelemetryPanel : public ModelPanel
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TelemetryPanel(QWidget *parent, ModelData & model);
|
TelemetryPanel(QWidget *parent, ModelData & model, GeneralSettings & generalSettings);
|
||||||
virtual ~TelemetryPanel();
|
virtual ~TelemetryPanel();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue