[Companion] Show custom channel, G-Var, and Curve names throughout UI. (#4874)

* [Companion] Move RadioData constructor.

* [Companion] Move getCapability(SwitchPositions) to Boards class.

* [Companion] Show custom channel, g-var, & curve names throughout UI; Remove redundant name formatting and other unused functions in ModelPrinter and Helpers; Add CustomFunctionData::isEmpty().

* [Companion] Add LogicalSwitchData::isEmpty().

* [Companion] Fix small bug in HardwarePanel.

* [Companion] Rename logical switches to "LSw##" in selections lists to avoid confusion with "L#" and "LS" hardware controls; remove unused RotaryEncoderString().
This commit is contained in:
Max Paperno
2017-04-29 09:03:53 +02:00
committed by Bertrand Songis
parent 04bcc70422
commit 72b1ad085f
19 changed files with 180 additions and 199 deletions
+18 -38
View File
@@ -76,18 +76,12 @@ QString ModelPrinter::printEEpromSize()
QString ModelPrinter::printChannelName(int idx)
{
return tr("CH%1").arg(idx+1, 2, 10, QChar('0'));
}
QString ModelPrinter::printOutputName(int idx)
{
QString name = QString(model.limitData[idx].name).trimmed();
if (firmware->getCapability(ChannelsName) > 0 && !name.isEmpty()) {
return name;
}
else {
return "";
QString str = RawSource(SOURCE_TYPE_CH, idx).toString(&model, &generalSettings);
if (firmware->getCapability(ChannelsName)) {
str = str.leftJustified(firmware->getCapability(ChannelsName) + 5, ' ', false);
}
str.append(' ');
return str.toHtmlEscaped();
}
QString ModelPrinter::printTrimIncrementMode()
@@ -368,9 +362,9 @@ QString ModelPrinter::printInputLine(const ExpoData & input)
str += input.srcRaw.toString(&model, &generalSettings).toHtmlEscaped();
}
str += " " + tr("Weight").toHtmlEscaped() + QString("(%1)").arg(getGVarString(input.weight,true).toHtmlEscaped());
str += " " + tr("Weight").toHtmlEscaped() + QString("(%1)").arg(Helpers::getAdjustmentString(input.weight, &model, true).toHtmlEscaped());
if (input.curve.value)
str += " " + input.curve.toString().toHtmlEscaped();
str += " " + input.curve.toString(&model).toHtmlEscaped();
QString flightModesStr = printFlightModes(input.flightModes);
if (!flightModesStr.isEmpty())
@@ -388,7 +382,7 @@ QString ModelPrinter::printInputLine(const ExpoData & input)
}
if (input.offset)
str += " " + tr("Offset(%1)").arg(getGVarString(input.offset)).toHtmlEscaped();
str += " " + tr("Offset(%1)").arg(Helpers::getAdjustmentString(input.offset, &model)).toHtmlEscaped();
if (firmware->getCapability(HasExpoNames) && input.name[0])
str += QString(" [%1]").arg(input.name).toHtmlEscaped();
@@ -396,25 +390,6 @@ QString ModelPrinter::printInputLine(const ExpoData & input)
return str;
}
QString ModelPrinter::printMixerName(int curDest)
{
QString str = printChannelName(curDest-1) + " ";
if (firmware->getCapability(ChannelsName) > 0) {
QString name = model.limitData[curDest-1].name;
if (!name.isEmpty()) {
name = QString("(") + name + QString(")");
}
name.append(" ");
str += name.left(8);
}
return str.toHtmlEscaped();
}
QString ModelPrinter::printMixerLine(int idx, bool showMultiplex, int highlightedSource)
{
return printMixerLine(model.mixData[idx], highlightedSource, showMultiplex);
}
QString ModelPrinter::printMixerLine(const MixData & mix, bool showMultiplex, int highlightedSource)
{
QString str = " ";
@@ -439,7 +414,7 @@ QString ModelPrinter::printMixerLine(const MixData & mix, bool showMultiplex, in
if (mix.mltpx == MLTPX_MUL && !showMultiplex)
str += " " + QString("MULT!").toHtmlEscaped();
else
str += " " + tr("Weight(%1)").arg(getGVarString(mix.weight, true)).toHtmlEscaped();
str += " " + tr("Weight(%1)").arg(Helpers::getAdjustmentString(mix.weight, &model, true)).toHtmlEscaped();
QString flightModesStr = printFlightModes(mix.flightModes);
if (!flightModesStr.isEmpty())
@@ -456,9 +431,9 @@ QString ModelPrinter::printMixerLine(const MixData & mix, bool showMultiplex, in
if (firmware->getCapability(HasNoExpo) && mix.noExpo)
str += " " + tr("No DR/Expo").toHtmlEscaped();
if (mix.sOffset)
str += " " + tr("Offset(%1)").arg(getGVarString(mix.sOffset)).toHtmlEscaped();
str += " " + tr("Offset(%1)").arg(Helpers::getAdjustmentString(mix.sOffset, &model)).toHtmlEscaped();
if (mix.curve.value)
str += " " + mix.curve.toString().toHtmlEscaped();
str += " " + mix.curve.toString(&model).toHtmlEscaped();
int scale = firmware->getCapability(SlowScale);
if (scale == 0)
scale = 1;
@@ -519,7 +494,7 @@ QString ModelPrinter::printLogicalSwitchLine(int idx)
const QString sw1Name = RawSwitch(ls.val1).toString(getCurrentBoard(), &generalSettings);
const QString sw2Name = RawSwitch(ls.val2).toString(getCurrentBoard(), &generalSettings);
if (!ls.func)
if (ls.isEmpty())
return result;
if (ls.andsw!=0) {
@@ -642,7 +617,7 @@ QString ModelPrinter::printCustomFunctionLine(int idx)
return result;
result += cf.swtch.toString(getCurrentBoard(), &generalSettings) + " - ";
result += cf.funcToString() + "(";
result += cf.funcToString(&model) + " (";
result += cf.paramToString(&model) + ")";
if (!cf.repeatToString().isEmpty())
result += " " + cf.repeatToString();
@@ -651,6 +626,11 @@ QString ModelPrinter::printCustomFunctionLine(int idx)
return result;
}
QString ModelPrinter::printCurveName(int idx)
{
return model.curves[idx].nameToString(idx).toHtmlEscaped();
}
QString ModelPrinter::printCurve(int idx)
{
QString result;