1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-15 04:15:26 +03:00

Support of inputs / mixes from 'next' continued. More duplicated code

removed.
This commit is contained in:
Bertrand Songis 2014-01-17 15:46:19 +01:00
parent ddd8d137fc
commit 11e83de0d3
15 changed files with 332 additions and 347 deletions

View file

@ -305,7 +305,7 @@ void compareDialog::printPhases()
str.append("</b></td><td rowspan=2 align=\"center\" valign=\"bottom\"><b>"+tr("Switch")+"</b></td></tr><tr><td align=center width=\"80\"><b>"+tr("Flight mode name")); str.append("</b></td><td rowspan=2 align=\"center\" valign=\"bottom\"><b>"+tr("Switch")+"</b></td></tr><tr><td align=center width=\"80\"><b>"+tr("Flight mode name"));
str.append("</b></td><td align=center width=\"30\"><b>"+tr("IN")+"</b></td><td align=center width=\"30\"><b>"+tr("OUT")+"</b></td>"); str.append("</b></td><td align=center width=\"30\"><b>"+tr("IN")+"</b></td><td align=center width=\"30\"><b>"+tr("OUT")+"</b></td>");
for (i=0; i<4; i++) { for (i=0; i<4; i++) {
str.append(QString("<td width=\"40\" align=\"center\"><b>%1</b></td>").arg(getStickStr(i))); str.append(QString("<td width=\"40\" align=\"center\"><b>%1</b></td>").arg(getInputStr(*g_model1, i)));
} }
str.append("</tr>"); str.append("</tr>");
for (i=0; i<GetEepromInterface()->getCapability(FlightPhases); i++) { for (i=0; i<GetEepromInterface()->getCapability(FlightPhases); i++) {
@ -406,7 +406,7 @@ void compareDialog::printPhases()
str.append("</b></td><td rowspan=2 align=\"center\" valign=\"bottom\"><b>"+tr("Switch")+"</b></td></tr><tr><td align=center width=\"80\"><b>"+tr("Flight mode name")); str.append("</b></td><td rowspan=2 align=\"center\" valign=\"bottom\"><b>"+tr("Switch")+"</b></td></tr><tr><td align=center width=\"80\"><b>"+tr("Flight mode name"));
str.append("</b></td><td align=center width=\"30\"><b>"+tr("IN")+"</b></td><td align=center width=\"30\"><b>"+tr("OUT")+"</b></td>"); str.append("</b></td><td align=center width=\"30\"><b>"+tr("IN")+"</b></td><td align=center width=\"30\"><b>"+tr("OUT")+"</b></td>");
for (i=0; i<4; i++) { for (i=0; i<4; i++) {
str.append(QString("<td width=\"40\" align=\"center\"><b>%1</b></td>").arg(getStickStr(i))); str.append(QString("<td width=\"40\" align=\"center\"><b>%1</b></td>").arg(getInputStr(*g_model1, i)));
} }
str.append("</tr>"); str.append("</tr>");
for (i=0; i<GetEepromInterface()->getCapability(FlightPhases); i++) { for (i=0; i<GetEepromInterface()->getCapability(FlightPhases); i++) {
@ -694,7 +694,7 @@ void compareDialog::printExpos()
} }
} }
str.append("</table></td>"); str.append("</table></td>");
str.append("<td width=\"10%\" align=\"center\" valign=\"middle\"><b>"+getStickStr(i)+"</b></td>"); str.append("<td width=\"10%\" align=\"center\" valign=\"middle\"><b>"+getInputStr(*g_model2, i)+"</b></td>");
str.append("<td width=\"45%\">"); str.append("<td width=\"45%\">");
str.append("<table border=0 cellspacing=0 cellpadding=0>"); str.append("<table border=0 cellspacing=0 cellpadding=0>");
for (int j=0; j<C9X_MAX_EXPOS; j++) { for (int j=0; j<C9X_MAX_EXPOS; j++) {

View file

@ -65,6 +65,7 @@ const uint8_t modn12x3[4][4]= {
#define C9X_MAX_MODELS 60 #define C9X_MAX_MODELS 60
#define C9X_MAX_PHASES 9 #define C9X_MAX_PHASES 9
#define C9X_MAX_MIXERS 64 #define C9X_MAX_MIXERS 64
#define C9X_MAX_INPUTS 32
#define C9X_MAX_EXPOS 64 #define C9X_MAX_EXPOS 64
#define C9X_MAX_CURVES 32 #define C9X_MAX_CURVES 32
#define C9X_MAX_POINTS 17 #define C9X_MAX_POINTS 17
@ -847,7 +848,10 @@ class ModelData {
PhaseData phaseData[C9X_MAX_PHASES]; PhaseData phaseData[C9X_MAX_PHASES];
MixData mixData[C9X_MAX_MIXERS]; MixData mixData[C9X_MAX_MIXERS];
LimitData limitData[C9X_NUM_CHNOUT]; LimitData limitData[C9X_NUM_CHNOUT];
char inputNames[C9X_MAX_INPUTS][4+1];
ExpoData expoData[C9X_MAX_EXPOS]; ExpoData expoData[C9X_MAX_EXPOS];
CurveData curves[C9X_MAX_CURVES]; CurveData curves[C9X_MAX_CURVES];
CustomSwData customSw[C9X_NUM_CSW]; CustomSwData customSw[C9X_NUM_CSW];
FuncSwData funcSw[C9X_MAX_CUSTOM_FUNCTIONS]; FuncSwData funcSw[C9X_MAX_CUSTOM_FUNCTIONS];
@ -927,7 +931,6 @@ enum Capability {
ChannelsName, ChannelsName,
ExtraChannels, ExtraChannels,
ExtraInputs, ExtraInputs,
ExtraTrims,
ExtendedTrims, ExtendedTrims,
HasInputFilter, HasInputFilter,
NumCurves, NumCurves,

View file

@ -1962,8 +1962,8 @@ Open9xModelDataNew::Open9xModelDataNew(ModelData & modelData, BoardEnum board, u
if (IS_TARANIS(board) && version >= 216) { if (IS_TARANIS(board) && version >= 216) {
// TODO ScriptData scriptsData[MAX_SCRIPTS]; // TODO ScriptData scriptsData[MAX_SCRIPTS];
internalField.Append(new SpareBitsField<720>()); internalField.Append(new SpareBitsField<720>());
// TODO char inputNames[MAX_INPUTS][4]; for (int i=0; i<32; i++)
internalField.Append(new SpareBitsField<1024>()); internalField.Append(new ZCharField<4>(modelData.inputNames[i]));
} }
} }

View file

@ -598,8 +598,6 @@ int Open9xInterface::getCapability(const Capability capability)
return 1; return 1;
case ExtendedTrims: case ExtendedTrims:
return 500; return 500;
case ExtraTrims:
return 1;
case Simulation: case Simulation:
return 1; return 1;
case DSM2Indexes: case DSM2Indexes:
@ -696,6 +694,7 @@ int Open9xInterface::getCapability(const Capability capability)
case GetThrSwitch: case GetThrSwitch:
return (IS_TARANIS(board) ? DSW_SF1 : DSW_THR) ; return (IS_TARANIS(board) ? DSW_SF1 : DSW_THR) ;
case VirtualInputs: case VirtualInputs:
return IS_TARANIS(board) ? 32 : 0;
case LuaInputs: case LuaInputs:
case LimitsPer1000: case LimitsPer1000:
case EnhancedCurves: case EnhancedCurves:

View file

@ -2,5 +2,5 @@
#define DATE_STR "@DATE@" #define DATE_STR "@DATE@"
#define TIME_STR "@TIME@" #define TIME_STR "@TIME@"
#define VERS_STR "c9x" #define VERS_STR "c9x"
#define SVN_STR "@FIRMWARE@-r@G9X_WC_REVISION@" #define VERS_STR "@FIRMWARE@-r@G9X_WC_REVISION@"
#define MOD_STR "FH" #define MOD_STR "FH"

View file

@ -18,9 +18,21 @@ QString getPhaseName(int val, char * phasename)
} }
} }
QString getStickStr(int index) QString getInputStr(ModelData & model, int index)
{ {
return RawSource(SOURCE_TYPE_STICK, index).toString(); QString result;
if (GetEepromInterface()->getCapability(VirtualInputs)) {
result = model.inputNames[index];
if (result.isEmpty()) {
result = QObject::tr("Input%1").arg(index+1, 2, 10, QChar('0'));
}
}
else {
result = RawSource(SOURCE_TYPE_STICK, index).toString();
}
return result;
} }
void populateGvSourceCB(QComboBox *b, int value) void populateGvSourceCB(QComboBox *b, int value)
@ -63,7 +75,7 @@ void populateTTraceCB(QComboBox *b, int value)
} }
int channels=(IS_ARM(GetEepromInterface()->getBoard()) ? 32 : 16); int channels=(IS_ARM(GetEepromInterface()->getBoard()) ? 32 : 16);
for (int i=1; i<= channels; i++) { for (int i=1; i<= channels; i++) {
b->addItem(QObject::tr("CH")+QString("%1").arg(i,2,10,QChar('0'))); b->addItem(QObject::tr("CH%1").arg(i, 2, 10, QChar('0')));
} }
b->setCurrentIndex(value); b->setCurrentIndex(value);
} }
@ -471,6 +483,78 @@ void populatePhasesCB(QComboBox *b, int value)
b->setCurrentIndex(value + GetEepromInterface()->getCapability(FlightPhases)); b->setCurrentIndex(value + GetEepromInterface()->getCapability(FlightPhases));
} }
bool gvarsEnabled()
{
int gvars=0;
if (GetEepromInterface()->getCapability(HasVariants)) {
if ((GetCurrentFirmwareVariant() & GVARS_VARIANT)) {
gvars=1;
}
}
else {
gvars=1;
}
return gvars;
}
GVarGroup::GVarGroup(QCheckBox *weightGV, QSpinBox *weightSB, QComboBox *weightCB, int & weight, const int deflt, const int mini, const int maxi, const unsigned int flags):
QObject(),
weightGV(weightGV),
weightSB(weightSB),
weightCB(weightCB),
weight(weight),
flags(flags),
lock(false)
{
lock = true;
if (gvarsEnabled()) {
populateGVCB(weightCB, weight);
connect(weightGV, SIGNAL(stateChanged(int)), this, SLOT(gvarCBChanged(int)));
connect(weightCB, SIGNAL(currentIndexChanged(int)), this, SLOT(valuesChanged()));
}
else {
weightGV->hide();
if (weight > maxi || weight < -mini) {
weight = deflt;
}
}
weightSB->setMinimum(mini);
weightSB->setMaximum(maxi);
if (weight>maxi || weight<mini) {
weightGV->setChecked(true);
weightSB->hide();
weightCB->show();
}
else {
weightGV->setChecked(false);
weightSB->setValue(weight);
weightSB->show();
weightCB->hide();
}
connect(weightSB, SIGNAL(editingFinished()), this, SLOT(valuesChanged()));
lock = false;
}
void GVarGroup::gvarCBChanged(int state)
{
weightCB->setVisible(state);
weightSB->setVisible(!state);
valuesChanged();
}
void GVarGroup::valuesChanged()
{
if (weightGV->isChecked())
weight = weightCB->itemData(weightCB->currentIndex()).toInt();
else
weight = weightSB->value();
}
CurveGroup::CurveGroup(QComboBox *curveTypeCB, QCheckBox *curveGVarCB, QComboBox *curveValueCB, QSpinBox *curveValueSB, CurveReference & curve, unsigned int flags): CurveGroup::CurveGroup(QComboBox *curveTypeCB, QCheckBox *curveGVarCB, QComboBox *curveValueCB, QSpinBox *curveValueSB, CurveReference & curve, unsigned int flags):
QObject(), QObject(),
curveTypeCB(curveTypeCB), curveTypeCB(curveTypeCB),

View file

@ -29,6 +29,26 @@ void populateTTraceCB(QComboBox *b, int value);
void populateRotEncCB(QComboBox *b, int value, int renumber); void populateRotEncCB(QComboBox *b, int value, int renumber);
void populateBacklightCB(QComboBox *b, const uint8_t value); void populateBacklightCB(QComboBox *b, const uint8_t value);
class GVarGroup : public QObject {
Q_OBJECT
public:
GVarGroup(QCheckBox *weightGV, QSpinBox *weightSB, QComboBox *weightCB, int & weight, const int deflt, const int mini, const int maxi, const unsigned int flags=0);
protected slots:
void gvarCBChanged(int);
void valuesChanged();
protected:
QCheckBox *weightGV;
QSpinBox *weightSB;
QComboBox *weightCB;
int & weight;
const unsigned int flags;
bool lock;
};
class CurveGroup : public QObject { class CurveGroup : public QObject {
Q_OBJECT Q_OBJECT
@ -88,7 +108,7 @@ void populateCSWCB(QComboBox *b, int value);
QString getTimerMode(int tm); QString getTimerMode(int tm);
QString getTimerModeB(int tm); QString getTimerModeB(int tm);
QString getPhaseName(int val, char * phasename=NULL); QString getPhaseName(int val, char * phasename=NULL);
QString getStickStr(int index); QString getInputStr(ModelData & model, int index);
QString getCSWFunc(int val); QString getCSWFunc(int val);
QString getFuncName(unsigned int val); QString getFuncName(unsigned int val);
QString getRepeatString(unsigned int val); QString getRepeatString(unsigned int val);

View file

@ -254,7 +254,7 @@ void CustomSwitchesPanel::setSwitchWidgetVisibility(int i)
cswitchSource2[i]->setVisible(false); cswitchSource2[i]->setVisible(false);
cswitchValue[i]->setVisible(false); cswitchValue[i]->setVisible(false);
cswitchOffset[i]->setVisible(true); cswitchOffset[i]->setVisible(true);
populateSourceCB(cswitchSource1[i], source, POPULATE_SOURCES | (GetEepromInterface()->getCapability(ExtraTrims) ? POPULATE_TRIMS : 0) | POPULATE_SWITCHES | POPULATE_TELEMETRY | (GetEepromInterface()->getCapability(GvarsInCS) ? POPULATE_GVARS : 0)); populateSourceCB(cswitchSource1[i], source, POPULATE_SOURCES | POPULATE_TRIMS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (GetEepromInterface()->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
cswitchOffset[i]->setDecimals(source.getDecimals(model)); cswitchOffset[i]->setDecimals(source.getDecimals(model));
cswitchOffset[i]->setSingleStep(source.getStep(model)); cswitchOffset[i]->setSingleStep(source.getStep(model));
if (model.customSw[i].func>CS_FN_ELESS && model.customSw[i].func<CS_FN_VEQUAL) { if (model.customSw[i].func>CS_FN_ELESS && model.customSw[i].func<CS_FN_VEQUAL) {
@ -280,8 +280,8 @@ void CustomSwitchesPanel::setSwitchWidgetVisibility(int i)
cswitchSource2[i]->setVisible(true); cswitchSource2[i]->setVisible(true);
cswitchValue[i]->setVisible(false); cswitchValue[i]->setVisible(false);
cswitchOffset[i]->setVisible(false); cswitchOffset[i]->setVisible(false);
populateSourceCB(cswitchSource1[i], RawSource(model.customSw[i].val1), POPULATE_SOURCES | (GetEepromInterface()->getCapability(ExtraTrims) ? POPULATE_TRIMS : 0) | POPULATE_SWITCHES | POPULATE_TELEMETRY | (GetEepromInterface()->getCapability(GvarsInCS) ? POPULATE_GVARS : 0)); populateSourceCB(cswitchSource1[i], RawSource(model.customSw[i].val1), POPULATE_SOURCES | POPULATE_TRIMS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (GetEepromInterface()->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
populateSourceCB(cswitchSource2[i], RawSource(model.customSw[i].val2), POPULATE_SOURCES | (GetEepromInterface()->getCapability(ExtraTrims) ? POPULATE_TRIMS : 0) | POPULATE_SWITCHES | POPULATE_TELEMETRY | (GetEepromInterface()->getCapability(GvarsInCS) ? POPULATE_GVARS : 0)); populateSourceCB(cswitchSource2[i], RawSource(model.customSw[i].val2), POPULATE_SOURCES | POPULATE_TRIMS | POPULATE_SWITCHES | POPULATE_TELEMETRY | (GetEepromInterface()->getCapability(GvarsInCS) ? POPULATE_GVARS : 0));
break; break;
case CS_FAMILY_TIMERS: case CS_FAMILY_TIMERS:
cswitchSource1[i]->setVisible(false); cswitchSource1[i]->setVisible(false);

View file

@ -3,126 +3,97 @@
#include "eeprominterface.h" #include "eeprominterface.h"
#include "helpers.h" #include "helpers.h"
ExpoDialog::ExpoDialog(QWidget *parent, ExpoData *expoData, int stickMode) : ExpoDialog::ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expoData, int stickMode) :
QDialog(parent), QDialog(parent),
ui(new Ui::ExpoDialog), ui(new Ui::ExpoDialog),
model(model),
ed(expoData) ed(expoData)
{ {
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 };
QCheckBox * cb_fp[] = {ui->cb_FP0,ui->cb_FP1,ui->cb_FP2,ui->cb_FP3,ui->cb_FP4,ui->cb_FP5,ui->cb_FP6,ui->cb_FP7,ui->cb_FP8 }; QCheckBox * cb_fp[] = {ui->cb_FP0,ui->cb_FP1,ui->cb_FP2,ui->cb_FP3,ui->cb_FP4,ui->cb_FP5,ui->cb_FP6,ui->cb_FP7,ui->cb_FP8 };
setWindowTitle(tr("DEST -> %1").arg(getStickStr(ed->chn))); setWindowTitle(tr("Edit %1").arg(getInputStr(model, ed->chn)));
QRegExp rx(CHAR_FOR_NAMES_REGEX); QRegExp rx(CHAR_FOR_NAMES_REGEX);
int gvars=0;
if (GetEepromInterface()->getCapability(HasVariants)) {
if ((GetCurrentFirmwareVariant() & GVARS_VARIANT)) {
gvars=1;
}
} else {
gvars=1;
}
if (gvars==0) { gvGroup = new GVarGroup(ui->weightGV, ui->weightSB, ui->weightCB, ed->weight, 100, 0, 100);
ui->weightGV->setDisabled(true); curveGroup = new CurveGroup(ui->curveTypeCB, ui->curveGVarCB, ui->curveValueCB, ui->curveValueSB, ed->curve);
ui->curveGVarCB->hide();
if ((ed->curve.type == CurveReference::CURVE_REF_EXPO || ed->curve.type == CurveReference::CURVE_REF_DIFF) && ed->curve.value > 100) {
ed->curve.value = 0;
}
if (ed->weight>100 || ed->weight<-100) {
ed->weight = 100;
}
}
populateGVCB(ui->weightCB, ed->weight); populateSwitchCB(ui->switchesCB,ed->swtch);
ui->weightSB->setMinimum(0); ui->sideCB->setCurrentIndex(ed->mode-1);
ui->weightSB->setMaximum(100);
if (ed->weight>100 || ed->weight<0) {
ui->weightGV->setChecked(true);
ui->weightSB->hide();
ui->weightCB->show();
} else {
ui->weightGV->setChecked(false);
ui->weightSB->setValue(ed->weight);
ui->weightSB->show();
ui->weightCB->hide();
}
populateSwitchCB(ui->switchesCB,ed->swtch); if (!GetEepromInterface()->getCapability(FlightPhases)) {
ui->label_phases->hide();
// TODO keep this group, same in MixerDialog
CurveGroup * curveGroup = new CurveGroup(ui->curveTypeCB, ui->curveGVarCB, ui->curveValueCB, ui->curveValueSB, ed->curve);
ui->sideCB->setCurrentIndex(ed->mode-1);
if (!GetEepromInterface()->getCapability(FlightPhases)) {
ui->label_phases->hide();
for (int i=0; i<9; i++) {
lb_fp[i]->hide();
cb_fp[i]->hide();
}
} else {
int mask=1;
for (int i=0; i<9 ; i++) {
if ((ed->phases & mask)==0) {
cb_fp[i]->setChecked(true);
}
mask <<= 1;
}
for (int i=GetEepromInterface()->getCapability(FlightPhases); i<9;i++) {
lb_fp[i]->hide();
cb_fp[i]->hide();
}
}
if (GetEepromInterface()->getCapability(VirtualInputs)) {
ui->sideLabel->hide();
ui->sideCB->hide();
}
else {
ui->sourceLabel->hide();
ui->sourceCB->hide();
ui->scaleLabel->hide();
ui->scaleSB->hide();
ui->trimLabel->hide();
ui->trimCB->hide();
}
int expolength=GetEepromInterface()->getCapability(HasExpoNames);
if (!expolength) {
ui->label_name->hide();
ui->expoName->hide();
} else {
ui->expoName->setMaxLength(expolength);
}
ui->expoName->setValidator(new QRegExpValidator(rx, this));
ui->expoName->setText(ed->name);
valuesChanged();
connect(ui->expoName,SIGNAL(editingFinished()),this,SLOT(valuesChanged()));
connect(ui->curveTypeCB,SIGNAL(currentIndexChanged(int)),this,SLOT(valuesChanged()));
connect(ui->curveGVarCB,SIGNAL(stateChanged(int)),this,SLOT(valuesChanged()));
connect(ui->curveValueCB,SIGNAL(currentIndexChanged(int)),this,SLOT(valuesChanged()));
connect(ui->curveValueSB,SIGNAL(editingFinished()),this,SLOT(valuesChanged()));
connect(ui->weightCB,SIGNAL(currentIndexChanged(int)),this,SLOT(valuesChanged()));
connect(ui->weightSB,SIGNAL(editingFinished()),this,SLOT(valuesChanged()));
connect(ui->switchesCB,SIGNAL(currentIndexChanged(int)),this,SLOT(valuesChanged()));
connect(ui->sideCB,SIGNAL(currentIndexChanged(int)),this,SLOT(valuesChanged()));
connect(ui->weightGV,SIGNAL(stateChanged(int)),this,SLOT(widgetChanged()));
for (int i=0; i<9; i++) { for (int i=0; i<9; i++) {
connect(cb_fp[i],SIGNAL(toggled(bool)),this,SLOT(valuesChanged())); lb_fp[i]->hide();
cb_fp[i]->hide();
} }
QTimer::singleShot(0, this, SLOT(shrink())); }
else {
int mask=1;
for (int i=0; i<9 ; i++) {
if ((ed->phases & mask)==0) {
cb_fp[i]->setChecked(true);
}
mask <<= 1;
}
for (int i=GetEepromInterface()->getCapability(FlightPhases); i<9;i++) {
lb_fp[i]->hide();
cb_fp[i]->hide();
}
}
if (GetEepromInterface()->getCapability(VirtualInputs)) {
ui->sideLabel->hide();
ui->sideCB->hide();
ui->inputName->setMaxLength(4);
populateSourceCB(ui->sourceCB, ed->srcRaw, POPULATE_SOURCES | POPULATE_SWITCHES | POPULATE_TRIMS | (GetEepromInterface()->getCapability(GvarsAsSources) ? POPULATE_GVARS : 0));
ui->sourceCB->removeItem(0);
}
else {
ui->inputNameLabel->hide();
ui->inputName->hide();
ui->sourceLabel->hide();
ui->sourceCB->hide();
ui->scaleLabel->hide();
ui->scaleSB->hide();
ui->trimLabel->hide();
ui->trimCB->hide();
}
int expolength = GetEepromInterface()->getCapability(HasExpoNames);
if (!expolength) {
ui->lineNameLabel->hide();
ui->lineName->hide();
}
else {
ui->lineName->setMaxLength(expolength);
}
ui->inputName->setValidator(new QRegExpValidator(rx, this));
ui->inputName->setText(model.inputNames[ed->chn]);
ui->lineName->setValidator(new QRegExpValidator(rx, this));
ui->lineName->setText(ed->name);
valuesChanged();
connect(ui->lineName,SIGNAL(editingFinished()),this,SLOT(valuesChanged()));
connect(ui->sourceCB,SIGNAL(currentIndexChanged(int)),this,SLOT(valuesChanged()));
connect(ui->switchesCB,SIGNAL(currentIndexChanged(int)),this,SLOT(valuesChanged()));
connect(ui->sideCB,SIGNAL(currentIndexChanged(int)),this,SLOT(valuesChanged()));
for (int i=0; i<9; i++) {
connect(cb_fp[i],SIGNAL(toggled(bool)),this,SLOT(valuesChanged()));
}
QTimer::singleShot(0, this, SLOT(shrink()));
} }
ExpoDialog::~ExpoDialog() ExpoDialog::~ExpoDialog()
{ {
delete ui; delete gvGroup;
delete curveGroup;
delete ui;
} }
void ExpoDialog::changeEvent(QEvent *e) void ExpoDialog::changeEvent(QEvent *e)
@ -137,54 +108,17 @@ void ExpoDialog::changeEvent(QEvent *e)
} }
} }
void ExpoDialog::widgetChanged()
{
// TODO so many times duplicated :(
int gvars=0;
if (GetEepromInterface()->getCapability(HasVariants)) {
if ((GetCurrentFirmwareVariant() & GVARS_VARIANT)) {
gvars=1;
}
} else {
gvars=1;
}
/* TODO if (gvars==1) {
if (ui->expoCurveGV->isChecked()) {
ui->expoCurveCB->show();
ui->expoCurveSB->hide();
} else {
ui->expoCurveCB->hide();
ui->expoCurveSB->show();
}
if (ui->weightGV->isChecked()) {
ui->weightCB->show();
ui->weightSB->hide();
} else {
ui->weightCB->hide();
ui->weightSB->show();
}
} */
valuesChanged();
QTimer::singleShot(0, this, SLOT(shrink()));
}
void ExpoDialog::valuesChanged() void ExpoDialog::valuesChanged()
{ {
QCheckBox * cb_fp[] = {ui->cb_FP0,ui->cb_FP1,ui->cb_FP2,ui->cb_FP3,ui->cb_FP4,ui->cb_FP5,ui->cb_FP6,ui->cb_FP7,ui->cb_FP8 }; QCheckBox * cb_fp[] = {ui->cb_FP0,ui->cb_FP1,ui->cb_FP2,ui->cb_FP3,ui->cb_FP4,ui->cb_FP5,ui->cb_FP6,ui->cb_FP7,ui->cb_FP8 };
if (ui->weightGV->isChecked()) { ed->srcRaw = RawSource(ui->sourceCB->itemData(ui->sourceCB->currentIndex()).toInt());
ed->weight = ui->weightCB->itemData(ui->weightCB->currentIndex()).toInt();
} else {
ed->weight = ui->weightSB->value();
}
ed->swtch = RawSwitch(ui->switchesCB->itemData(ui->switchesCB->currentIndex()).toInt()); ed->swtch = RawSwitch(ui->switchesCB->itemData(ui->switchesCB->currentIndex()).toInt());
ed->mode = ui->sideCB->currentIndex() + 1; ed->mode = ui->sideCB->currentIndex() + 1;
int i=0;
for (i=0; i<ui->expoName->text().toAscii().length(); i++) { strcpy(ed->name, ui->lineName->text().toAscii().data());
ed->name[i]=ui->expoName->text().toAscii().at(i); strcpy(model.inputNames[ed->chn], ui->inputName->text().toAscii().data());
}
ed->name[i]=0;
ed->phases=0; ed->phases=0;
for (int i=8; i>=0 ; i--) { for (int i=8; i>=0 ; i--) {
if (!cb_fp[i]->checkState()) { if (!cb_fp[i]->checkState()) {
@ -231,5 +165,5 @@ void ExpoDialog::valuesChanged()
void ExpoDialog::shrink() void ExpoDialog::shrink()
{ {
resize(0,0); resize(0,0);
} }

View file

@ -4,27 +4,32 @@
#include <QDialog> #include <QDialog>
#include "eeprominterface.h" #include "eeprominterface.h"
class GVarGroup;
class CurveGroup;
namespace Ui { namespace Ui {
class ExpoDialog; class ExpoDialog;
} }
class ExpoDialog : public QDialog { class ExpoDialog : public QDialog {
Q_OBJECT Q_OBJECT
public: public:
ExpoDialog(QWidget *parent, ExpoData *mixdata, int stickMode); ExpoDialog(QWidget *parent, ModelData & model, ExpoData *expodata, int stickMode);
~ExpoDialog(); ~ExpoDialog();
protected: protected:
void changeEvent(QEvent *e); void changeEvent(QEvent *e);
private slots: private slots:
void valuesChanged(); void valuesChanged();
void widgetChanged();
void shrink(); void shrink();
private: private:
Ui::ExpoDialog *ui; Ui::ExpoDialog * ui;
ExpoData *ed; ModelData & model;
ExpoData * ed;
GVarGroup * gvGroup;
CurveGroup * curveGroup;
}; };
#endif // EXPODIALOG_H #endif // EXPODIALOG_H

View file

@ -30,28 +30,35 @@
<normaloff>:/icon.png</normaloff>:/icon.png</iconset> <normaloff>:/icon.png</normaloff>:/icon.png</iconset>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="2" column="1">
<widget class="QComboBox" name="sourceCB">
<property name="whatsThis">
<string>The source for the mixer</string>
</property>
</widget>
</item>
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="label_name"> <widget class="QLabel" name="inputNameLabel">
<property name="text"> <property name="text">
<string>Name</string> <string>Input name</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item row="0" column="1">
<widget class="QLineEdit" name="expoName"> <widget class="QLineEdit" name="inputName">
<property name="maxLength"> <property name="maxLength">
<number>6</number> <number>6</number>
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="0"> <item row="6" column="0">
<widget class="QLabel" name="label_3"> <widget class="QLabel" name="label_3">
<property name="text"> <property name="text">
<string>Weight</string> <string>Weight</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="1"> <item row="6" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,0,1,0"> <layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,0,1,0">
<item> <item>
<widget class="QCheckBox" name="weightGV"> <widget class="QCheckBox" name="weightGV">
@ -85,14 +92,14 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="6" column="0"> <item row="8" column="0">
<widget class="QLabel" name="label_phases"> <widget class="QLabel" name="label_phases">
<property name="text"> <property name="text">
<string>Flight modes</string> <string>Flight modes</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="6" column="1"> <item row="8" column="1">
<layout class="QGridLayout" name="gridLayout_4"> <layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="lb_FP0"> <widget class="QLabel" name="lb_FP0">
@ -249,14 +256,14 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="7" column="0"> <item row="9" column="0">
<widget class="QLabel" name="label_7"> <widget class="QLabel" name="label_7">
<property name="text"> <property name="text">
<string>Switch</string> <string>Switch</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="7" column="1"> <item row="9" column="1">
<widget class="QComboBox" name="switchesCB"> <widget class="QComboBox" name="switchesCB">
<property name="whatsThis"> <property name="whatsThis">
<string>Switch used by the expo. <string>Switch used by the expo.
@ -264,14 +271,14 @@ If blank then the expo is considered to be &quot;ON&quot; all the time.</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="9" column="0"> <item row="11" column="0">
<widget class="QLabel" name="sideLabel"> <widget class="QLabel" name="sideLabel">
<property name="text"> <property name="text">
<string>Stick Side</string> <string>Stick Side</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="9" column="1"> <item row="11" column="1">
<widget class="QComboBox" name="sideCB"> <widget class="QComboBox" name="sideCB">
<item> <item>
<property name="text"> <property name="text">
@ -290,7 +297,7 @@ If blank then the expo is considered to be &quot;ON&quot; all the time.</string>
</item> </item>
</widget> </widget>
</item> </item>
<item row="11" column="0" colspan="2"> <item row="13" column="0" colspan="2">
<widget class="QDialogButtonBox" name="buttonBox"> <widget class="QDialogButtonBox" name="buttonBox">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
@ -309,7 +316,7 @@ If blank then the expo is considered to be &quot;ON&quot; all the time.</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="10" column="0" colspan="2"> <item row="12" column="0" colspan="2">
<spacer name="verticalSpacer"> <spacer name="verticalSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
@ -322,14 +329,7 @@ If blank then the expo is considered to be &quot;ON&quot; all the time.</string>
</property> </property>
</spacer> </spacer>
</item> </item>
<item row="2" column="1"> <item row="3" column="1">
<widget class="QComboBox" name="sourceCB">
<property name="whatsThis">
<string>The source for the mixer</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="scaleSB"> <widget class="QDoubleSpinBox" name="scaleSB">
<property name="whatsThis"> <property name="whatsThis">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt; <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
@ -352,28 +352,21 @@ p, li { white-space: pre-wrap; }
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="3" column="0">
<widget class="QLabel" name="scaleLabel"> <widget class="QLabel" name="scaleLabel">
<property name="text"> <property name="text">
<string>Scale</string> <string>Scale</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0"> <item row="5" column="0">
<widget class="QLabel" name="trimLabel"> <widget class="QLabel" name="trimLabel">
<property name="text"> <property name="text">
<string>Include Trim</string> <string>Include Trim</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="0"> <item row="5" column="1">
<widget class="QLabel" name="sourceLabel">
<property name="text">
<string>Source</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QComboBox" name="trimCB"> <widget class="QComboBox" name="trimCB">
<item> <item>
<property name="text"> <property name="text">
@ -387,14 +380,14 @@ p, li { white-space: pre-wrap; }
</item> </item>
</widget> </widget>
</item> </item>
<item row="5" column="0"> <item row="7" column="0">
<widget class="QLabel" name="label_curves"> <widget class="QLabel" name="label_curves">
<property name="text"> <property name="text">
<string>Curve</string> <string>Curve</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="5" column="1"> <item row="7" column="1">
<layout class="QHBoxLayout" name="horizontalLayout" stretch="1,0,1,0"> <layout class="QHBoxLayout" name="horizontalLayout" stretch="1,0,1,0">
<item> <item>
<widget class="QComboBox" name="curveTypeCB"> <widget class="QComboBox" name="curveTypeCB">
@ -425,6 +418,27 @@ p, li { white-space: pre-wrap; }
</item> </item>
</layout> </layout>
</item> </item>
<item row="2" column="0">
<widget class="QLabel" name="sourceLabel">
<property name="text">
<string>Source</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="lineNameLabel">
<property name="text">
<string>Line name</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="lineName">
<property name="maxLength">
<number>6</number>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<resources> <resources>

View file

@ -48,6 +48,10 @@ void InputsPanel::update()
{ {
lock = true; lock = true;
int inputsCount = GetEepromInterface()->getCapability(VirtualInputs);
if (inputsCount == 0)
inputsCount = NUM_STICKS;
// curDest -> destination channel // curDest -> destination channel
// i -> mixer number // i -> mixer number
QByteArray qba; QByteArray qba;
@ -58,10 +62,12 @@ void InputsPanel::update()
ExpoData *md = &model.expoData[i]; ExpoData *md = &model.expoData[i];
if (md->mode==0) break; if (md->mode==0) break;
QString str = "";
while(curDest<(int)md->chn-1) { QString str;
while (curDest<(int)md->chn-1) {
curDest++; curDest++;
str = getStickStr(curDest); str = getInputStr(model, curDest);
qba.clear(); qba.clear();
qba.append((quint8)-curDest-1); qba.append((quint8)-curDest-1);
QListWidgetItem *itm = new QListWidgetItem(str); QListWidgetItem *itm = new QListWidgetItem(str);
@ -69,14 +75,21 @@ void InputsPanel::update()
ExposlistWidget->addItem(itm); ExposlistWidget->addItem(itm);
} }
if(curDest!=(int)md->chn) { if (curDest!=(int)md->chn) {
str = getStickStr(md->chn); if (GetEepromInterface()->getCapability(VirtualInputs))
str = QString("%1").arg(getInputStr(model, md->chn), -8, ' ');
else
str = getInputStr(model, md->chn);
curDest = md->chn; curDest = md->chn;
} else { }
else {
str = " "; str = " ";
} }
if (!GetEepromInterface()->getCapability(VirtualInputs)) { if (GetEepromInterface()->getCapability(VirtualInputs)) {
str += " " + tr("Source(%1)").arg(md->srcRaw.toString());
}
else {
switch (md->mode) { switch (md->mode) {
case (1): str += " <-"; break; case (1): str += " <-"; break;
case (2): str += " ->"; break; case (2): str += " ->"; break;
@ -94,12 +107,10 @@ void InputsPanel::update()
if (md->swtch.type != SWITCH_TYPE_NONE) str += " " + tr("Switch(%1)").arg(md->swtch.toString()); if (md->swtch.type != SWITCH_TYPE_NONE) str += " " + tr("Switch(%1)").arg(md->swtch.toString());
if (GetEepromInterface()->getCapability(HasExpoNames)) { if (GetEepromInterface()->getCapability(HasExpoNames)) {
QString ExpoName; QString expoName = md->name;
ExpoName.append(md->name); if (!expoName.isEmpty()) str += QString(" [%1]").arg(expoName);
if (!ExpoName.isEmpty()) {
str+=QString("(%1)").arg(ExpoName);
}
} }
qba.clear(); qba.clear();
qba.append((quint8)i); qba.append((quint8)i);
qba.append((const char*)md, sizeof(ExpoData)); qba.append((const char*)md, sizeof(ExpoData));
@ -108,9 +119,9 @@ void InputsPanel::update()
ExposlistWidget->addItem(itm); //(str); ExposlistWidget->addItem(itm); //(str);
} }
while(curDest<NUM_STICKS-1) { while (curDest<inputsCount-1) {
curDest++; curDest++;
QString str = getStickStr(curDest); QString str = getInputStr(model, curDest);
qba.clear(); qba.clear();
qba.append((quint8)-curDest-1); qba.append((quint8)-curDest-1);
QListWidgetItem *itm = new QListWidgetItem(str); QListWidgetItem *itm = new QListWidgetItem(str);
@ -154,12 +165,13 @@ void InputsPanel::gm_openExpo(int index)
emit modified(); emit modified();
update(); update();
ExpoDialog *g = new ExpoDialog(this, &mixd, generalSettings.stickMode); ExpoDialog *g = new ExpoDialog(this, model, &mixd, generalSettings.stickMode);
if(g->exec()) { if (g->exec()) {
model.expoData[index] = mixd; model.expoData[index] = mixd;
emit modified(); emit modified();
update(); update();
} else { }
else {
if (expoInserted) { if (expoInserted) {
gm_deleteExpo(index); gm_deleteExpo(index);
} }

View file

@ -19,76 +19,32 @@ MixerDialog::MixerDialog(QWidget *parent, MixData *mixdata, int stickMode) :
else else
this->setWindowTitle(tr("DEST -> CH%1%2").arg(md->destCh/10).arg(md->destCh%10)); this->setWindowTitle(tr("DEST -> CH%1%2").arg(md->destCh/10).arg(md->destCh%10));
populateSourceCB(ui->sourceCB, md->srcRaw, POPULATE_SOURCES | POPULATE_SWITCHES | (GetEepromInterface()->getCapability(ExtraTrims) ? POPULATE_TRIMS : 0) | (GetEepromInterface()->getCapability(GvarsAsSources) ? POPULATE_GVARS : 0)); populateSourceCB(ui->sourceCB, md->srcRaw, POPULATE_SOURCES | POPULATE_SWITCHES | POPULATE_TRIMS | (GetEepromInterface()->getCapability(GvarsAsSources) ? POPULATE_GVARS : 0));
ui->sourceCB->removeItem(0); ui->sourceCB->removeItem(0);
int limit=GetEepromInterface()->getCapability(OffsetWeight);
int gvars=0;
if (GetEepromInterface()->getCapability(HasVariants)) {
if ((GetCurrentFirmwareVariant() & GVARS_VARIANT)) {
gvars=1;
}
} else {
gvars=1;
}
if (gvars==0) {
ui->offsetGV->setDisabled(true);
ui->weightGV->setDisabled(true);
if (md->weight>limit || md->weight<-limit) {
md->weight=100;
}
if (md->sOffset>limit || md->sOffset<-limit) {
md->sOffset=0;
}
}
populateGVCB(ui->offsetCB,md->sOffset);
populateGVCB(ui->weightCB,md->weight);
ui->weightSB->setMinimum(-limit);
ui->weightSB->setMaximum(limit);
if (md->weight>limit || md->weight<-limit) {
ui->weightGV->setChecked(true);
ui->weightSB->hide();
ui->weightCB->show();
}
else {
ui->weightGV->setChecked(false);
ui->weightSB->setValue(md->weight);
ui->weightSB->show();
ui->weightCB->hide();
}
ui->offsetSB->setMinimum(-limit); int limit = GetEepromInterface()->getCapability(OffsetWeight);
ui->offsetSB->setMaximum(limit);
if (md->sOffset>limit || md->sOffset<-limit) { gvWeightGroup = new GVarGroup(ui->weightGV, ui->weightSB, ui->weightCB, md->weight, 100, -limit, limit);
ui->offsetGV->setChecked(true); gvOffsetGroup = new GVarGroup(ui->offsetGV, ui->offsetSB, ui->offsetCB, md->sOffset, 0, -limit, limit);
ui->offsetSB->hide();
ui->offsetCB->show();
}
else {
ui->offsetGV->setChecked(false);
ui->offsetSB->setValue(md->sOffset);
ui->offsetSB->show();
ui->offsetCB->hide();
}
if (GetEepromInterface()->getCapability(VirtualInputs)) { if (GetEepromInterface()->getCapability(VirtualInputs)) {
ui->trimLabel->hide(); ui->trimLabel->hide();
ui->trimCB->hide(); ui->trimCB->hide();
} }
CurveGroup * curveGroup = new CurveGroup(ui->curveTypeCB, ui->curveGVarCB, ui->curveValueCB, ui->curveValueSB, md->curve); curveGroup = new CurveGroup(ui->curveTypeCB, ui->curveGVarCB, ui->curveValueCB, ui->curveValueSB, md->curve);
ui->MixDR_CB->setChecked(md->noExpo==0); ui->MixDR_CB->setChecked(md->noExpo==0);
if (!GetEepromInterface()->getCapability(MixesWithoutExpo)) { if (!GetEepromInterface()->getCapability(MixesWithoutExpo)) {
ui->MixDR_CB->hide(); ui->MixDR_CB->hide();
ui->label_MixDR->hide(); ui->label_MixDR->hide();
} }
if (GetEepromInterface()->getCapability(ExtraTrims)) {
ui->trimCB->addItem(tr("Rud"),1); ui->trimCB->addItem(tr("Rud"), 1);
ui->trimCB->addItem(tr("Ele"),2); ui->trimCB->addItem(tr("Ele"), 2);
ui->trimCB->addItem(tr("Thr"),3); ui->trimCB->addItem(tr("Thr"), 3);
ui->trimCB->addItem(tr("Ail"),4); ui->trimCB->addItem(tr("Ail"), 4);
}
ui->trimCB->setCurrentIndex((-md->carryTrim)+1); ui->trimCB->setCurrentIndex((-md->carryTrim)+1);
int namelength=GetEepromInterface()->getCapability(HasMixerNames); int namelength=GetEepromInterface()->getCapability(HasMixerNames);
if (!namelength) { if (!namelength) {
@ -147,12 +103,6 @@ MixerDialog::MixerDialog(QWidget *parent, MixData *mixdata, int stickMode) :
valuesChanged(); valuesChanged();
connect(ui->mixerName,SIGNAL(editingFinished()),this,SLOT(valuesChanged())); connect(ui->mixerName,SIGNAL(editingFinished()),this,SLOT(valuesChanged()));
connect(ui->sourceCB,SIGNAL(currentIndexChanged(int)),this,SLOT(valuesChanged())); connect(ui->sourceCB,SIGNAL(currentIndexChanged(int)),this,SLOT(valuesChanged()));
connect(ui->weightCB,SIGNAL(currentIndexChanged(int)),this,SLOT(valuesChanged()));
connect(ui->offsetCB,SIGNAL(currentIndexChanged(int)),this,SLOT(valuesChanged()));
connect(ui->weightSB,SIGNAL(editingFinished()),this,SLOT(valuesChanged()));
connect(ui->offsetSB,SIGNAL(editingFinished()),this,SLOT(valuesChanged()));
connect(ui->weightGV,SIGNAL(stateChanged(int)),this,SLOT(widgetChanged())); // TODO why the same slot?
connect(ui->offsetGV,SIGNAL(stateChanged(int)),this,SLOT(widgetChanged()));
connect(ui->trimCB,SIGNAL(currentIndexChanged(int)),this,SLOT(valuesChanged())); connect(ui->trimCB,SIGNAL(currentIndexChanged(int)),this,SLOT(valuesChanged()));
connect(ui->MixDR_CB,SIGNAL(toggled(bool)),this,SLOT(valuesChanged())); connect(ui->MixDR_CB,SIGNAL(toggled(bool)),this,SLOT(valuesChanged()));
connect(ui->switchesCB,SIGNAL(currentIndexChanged(int)),this,SLOT(valuesChanged())); connect(ui->switchesCB,SIGNAL(currentIndexChanged(int)),this,SLOT(valuesChanged()));
@ -169,54 +119,23 @@ MixerDialog::MixerDialog(QWidget *parent, MixData *mixdata, int stickMode) :
MixerDialog::~MixerDialog() MixerDialog::~MixerDialog()
{ {
delete ui; delete gvWeightGroup;
delete gvOffsetGroup;
delete curveGroup;
delete ui;
} }
void MixerDialog::changeEvent(QEvent *e) void MixerDialog::changeEvent(QEvent *e)
{ {
QDialog::changeEvent(e); QDialog::changeEvent(e);
switch (e->type()) {
switch (e->type()) {
case QEvent::LanguageChange: case QEvent::LanguageChange:
ui->retranslateUi(this); ui->retranslateUi(this);
break; break;
default: default:
break; break;
}
}
void MixerDialog::widgetChanged()
{
int gvars = 0;
if (GetEepromInterface()->getCapability(HasVariants)) {
if ((GetCurrentFirmwareVariant() & GVARS_VARIANT)) {
gvars = 1;
}
} }
else {
gvars = 1;
}
if (gvars == 1) {
if (ui->weightGV->isChecked()) {
ui->weightCB->show();
ui->weightSB->hide();
}
else {
ui->weightCB->hide();
ui->weightSB->show();
}
if (ui->offsetGV->isChecked()) {
ui->offsetCB->show();
ui->offsetSB->hide();
}
else {
ui->offsetCB->hide();
ui->offsetSB->show();
}
}
valuesChanged();
QTimer::singleShot(0, this, SLOT(shrink()));
} }
void MixerDialog::valuesChanged() void MixerDialog::valuesChanged()
@ -237,16 +156,6 @@ void MixerDialog::valuesChanged()
ui->MixDR_CB->setHidden(true); ui->MixDR_CB->setHidden(true);
ui->label_MixDR->setHidden(true); ui->label_MixDR->setHidden(true);
} }
if (ui->weightGV->isChecked()) {
md->weight = ui->weightCB->itemData(ui->weightCB->currentIndex()).toInt();
} else {
md->weight = ui->weightSB->value();
}
if (ui->offsetGV->isChecked()) {
md->sOffset = ui->offsetCB->itemData(ui->offsetCB->currentIndex()).toInt();
} else {
md->sOffset = ui->offsetSB->value();
}
md->carryTrim = -(ui->trimCB->currentIndex()-1); md->carryTrim = -(ui->trimCB->currentIndex()-1);
md->noExpo = ui->MixDR_CB->checkState() ? 0 : 1; md->noExpo = ui->MixDR_CB->checkState() ? 0 : 1;
md->swtch = RawSwitch(ui->switchesCB->itemData(ui->switchesCB->currentIndex()).toInt()); md->swtch = RawSwitch(ui->switchesCB->itemData(ui->switchesCB->currentIndex()).toInt());
@ -276,6 +185,7 @@ void MixerDialog::valuesChanged()
} }
} }
void MixerDialog::shrink() { void MixerDialog::shrink()
resize(0,0); {
resize(0, 0);
} }

View file

@ -4,29 +4,33 @@
#include <QDialog> #include <QDialog>
#include "eeprominterface.h" #include "eeprominterface.h"
class GVarGroup;
class CurveGroup;
namespace Ui { namespace Ui {
class MixerDialog; class MixerDialog;
} }
class MixerDialog : public QDialog { class MixerDialog : public QDialog {
Q_OBJECT Q_OBJECT
public: public:
MixerDialog(QWidget *parent, MixData *mixdata, int stickMode); MixerDialog(QWidget *parent, MixData *mixdata, int stickMode);
~MixerDialog(); ~MixerDialog();
protected: protected:
void changeEvent(QEvent *e); void changeEvent(QEvent *e);
private slots: private slots:
void widgetChanged();
void valuesChanged(); void valuesChanged();
void shrink(); void shrink();
private:
private:
Ui::MixerDialog *ui; Ui::MixerDialog *ui;
MixData *md; MixData *md;
bool lock; bool lock;
GVarGroup * gvWeightGroup;
GVarGroup * gvOffsetGroup;
CurveGroup * curveGroup;
}; };
#endif // MIXERDIALOG_H #endif // MIXERDIALOG_H

View file

@ -176,7 +176,7 @@ QString printDialog::printPhases()
str.append("<td rowspan=2 align=\"center\" valign=\"bottom\"><b>"+tr("Switch")+"</b></td></tr><tr><td align=center width=\"90\"><b>"+tr("Flight mode name")); str.append("<td rowspan=2 align=\"center\" valign=\"bottom\"><b>"+tr("Switch")+"</b></td></tr><tr><td align=center width=\"90\"><b>"+tr("Flight mode name"));
str.append("</b></td><td align=center width=\"30\"><b>"+tr("IN")+"</b></td><td align=center width=\"30\"><b>"+tr("OUT")+"</b></td>"); str.append("</b></td><td align=center width=\"30\"><b>"+tr("IN")+"</b></td><td align=center width=\"30\"><b>"+tr("OUT")+"</b></td>");
for (int i=0; i<4; i++) { for (int i=0; i<4; i++) {
str.append(QString("<td width=\"40\" align=\"center\"><b>%1</b></td>").arg(getStickStr(i))); str.append(QString("<td width=\"40\" align=\"center\"><b>%1</b></td>").arg(getInputStr(*g_model, i)));
} }
if (gvars==1) { if (gvars==1) {
for (int i=0; i<gvarnum; i++) { for (int i=0; i<gvarnum; i++) {
@ -241,7 +241,7 @@ void printDialog::printExpo()
str.append("<tr><td><font size=+1 face='Courier New'>"); str.append("<tr><td><font size=+1 face='Courier New'>");
if(lastCHN!=ed->chn) { if(lastCHN!=ed->chn) {
lastCHN=ed->chn; lastCHN=ed->chn;
str.append("<b>"+getStickStr(ed->chn)+"</b>"); str.append("<b>"+getInputStr(*g_model, ed->chn)+"</b>");
} }
else else
str.append("<b>&nbsp;</b>"); str.append("<b>&nbsp;</b>");