Fixes in ExpoDialog. Some more code refactoring

This commit is contained in:
Bertrand Songis
2014-01-15 14:05:33 +01:00
parent 888895b60b
commit 691b52572f
9 changed files with 134 additions and 211 deletions
+9 -40
View File
@@ -105,49 +105,18 @@ void MixesPanel::update()
};
str += md->srcRaw.toString();
str += " " + tr("Weight(%1)").arg(getGVarString(md->weight, true));
unsigned int fpCount = GetEepromInterface()->getCapability(FlightPhases);
if (GetEepromInterface()->getCapability(FlightPhases)) {
if(md->phases) {
if (md->phases!=(unsigned int)(1<<fpCount)-1) {
int mask=1;
int first=0;
for (unsigned int i=0; i<fpCount; i++) {
if (!(md->phases & mask)) {
first++;
}
mask <<=1;
}
if (first>1) {
str += " " + tr("Flight modes") + QString("(");
} else {
str += " " + tr("Flight mode") + QString("(");
}
mask=1;
first=1;
for (unsigned int i=0; i<fpCount; i++) {
if (!(md->phases & mask)) {
if (!first) {
str += QString(", ")+ QString("%1").arg(getPhaseName(i+1, model.phaseData[i].name));
}
else {
str += QString("%1").arg(getPhaseName(i+1,model.phaseData[i].name));
first=0;
}
}
mask <<=1;
}
str += QString(")");
} else {
str += tr("DISABLED")+QString(" !!!");
}
}
QString phasesStr = getPhasesStr(md->phases, model);
if (!phasesStr.isEmpty()) str += " " + phasesStr;
if (md->swtch.type != SWITCH_TYPE_NONE) str += " " + tr("Switch(%1)").arg(md->swtch.toString());
if (md->carryTrim>0) {
str += " " + tr("No Trim");
}
if(md->swtch.type != SWITCH_TYPE_NONE) str += " " + tr("Switch") + QString("(%1)").arg(md->swtch.toString());
if(md->carryTrim>0) {
str += " " +tr("No Trim");
} else if (md->carryTrim<0) {
else if (md->carryTrim<0) {
str += " " + RawSource(SOURCE_TYPE_TRIM, (-(md->carryTrim)-1)).toString();
}