Merge pull request #2813 from opentx/projectkk2glider/issue_2808_multiplex_format

Fixes #2808: Mixes multiplex representation now the same as on the radio
This commit is contained in:
Damjan Adamic
2015-08-30 21:39:05 +02:00
5 changed files with 22 additions and 16 deletions
+1
View File
@@ -10,6 +10,7 @@
<li>Model Print and Model Compare improvements and fixes (<a href=https://github.com/opentx/opentx/issues/2734>#2734</a>, <a href=https://github.com/opentx/opentx/issues/2737>#2737</a>, <a href=https://github.com/opentx/opentx/issues/2576>#2576</a>)</li>
<li>Negative telemetry offset value was reset when writing back to radio (<a href=https://github.com/opentx/opentx/issues/2738>#2738</a>)</li>
<li>Telemetry sensor names were not displayed (<a href=https://github.com/opentx/opentx/issues/2807>#2807</a>)</li>
<li>Mixes multiplex representation now the same as on the radio (<a href=https://github.com/opentx/opentx/issues/2808>#2808</a>)</li>
</ul>
+5 -4
View File
@@ -121,14 +121,14 @@ bool MixesPanel::AddMixerLine(int dest)
QString MixesPanel::getMixerText(int dest, bool * new_ch)
{
QString str;
if (new_ch) *new_ch = 0;
bool newChannel = false;
if (dest < 0) {
str = modelPrinter.printMixerName(-dest);
//highlight channel if needed
if (-dest == (int)highlightedSource) {
str = "<b>" + str + "</b>";
}
if (new_ch) *new_ch = 1;
newChannel = true;
}
else {
MixData & mix = model->mixData[dest];
@@ -136,7 +136,7 @@ QString MixesPanel::getMixerText(int dest, bool * new_ch)
str = modelPrinter.printMixerName(mix.destCh);
if ((dest == 0) || (model->mixData[dest-1].destCh != mix.destCh)) {
if (new_ch) *new_ch = 1;
newChannel = true;
//highlight channel if needed
if (mix.destCh == highlightedSource) {
str = "<b>" + str + "</b>";
@@ -146,8 +146,9 @@ QString MixesPanel::getMixerText(int dest, bool * new_ch)
str.fill(' ');
}
str += modelPrinter.printMixerLine(mix, highlightedSource);
str += modelPrinter.printMixerLine(mix, !newChannel, highlightedSource);
}
if (new_ch) *new_ch = newChannel;
return str.replace(" ", "&nbsp;");
}
+13 -9
View File
@@ -327,21 +327,25 @@ QString ModelPrinter::printMixerName(int curDest)
return Qt::escape(str);
}
QString ModelPrinter::printMixerLine(int idx, int highlightedSource)
QString ModelPrinter::printMixerLine(int idx, bool showMultiplex, int highlightedSource)
{
return printMixerLine(model.mixData[idx], highlightedSource);
return printMixerLine(model.mixData[idx], highlightedSource, showMultiplex);
}
QString ModelPrinter::printMixerLine(const MixData & mix, int highlightedSource)
QString ModelPrinter::printMixerLine(const MixData & mix, bool showMultiplex, int highlightedSource)
{
QString str = "&nbsp;";
switch(mix.mltpx) {
case (1): str += "*"; break;
case (2): str += "R"; break;
default: str += "&nbsp;"; break;
};
if (showMultiplex) {
switch(mix.mltpx) {
case (1): str += "*="; break;
case (2): str += ":="; break;
default: str += "+="; break;
}
}
else {
str += "&nbsp;&nbsp;";
}
// highlight source if needed
QString source = Qt::escape(mix.srcRaw.toString(&model));
if ( (mix.srcRaw.type == SOURCE_TYPE_CH) && (mix.srcRaw.index+1 == (int)highlightedSource) ) {
+2 -2
View File
@@ -50,8 +50,8 @@ class ModelPrinter: public QObject
QString printInputLine(int idx);
QString printInputLine(const ExpoData & ed);
QString printMixerName(int curDest);
QString printMixerLine(int idx, int highlightedSource = 0);
QString printMixerLine(const MixData & md, int highlightedSource = 0);
QString printMixerLine(int idx, bool showMultiplex, int highlightedSource = 0);
QString printMixerLine(const MixData & md, bool showMultiplex, int highlightedSource = 0);
QString printLogicalSwitchLine(int idx);
QString printCustomFunctionLine(int idx);
static QString printChannelName(int idx);
+1 -1
View File
@@ -357,7 +357,7 @@ QString MultiModelPrinter::printMixers()
for (int j=0; j<count; j++) {
if (j > 0)
columns.append("<br/>");
COMPARE((j < model->mixes(i).size()) ? modelPrinter->printMixerLine(*model->mixes(i)[j]) : "&nbsp;");
COMPARE((j < model->mixes(i).size()) ? modelPrinter->printMixerLine(*model->mixes(i)[j], (j>0)) : "&nbsp;");
}
columns.append("</td></tr>");
}