mirror of
https://github.com/opentx/opentx.git
synced 2025-07-16 21:05:26 +03:00
renamed printExpo() to printInputs() and compacted code, output is the same.
This commit is contained in:
parent
809a3cfd60
commit
b9b4e441e7
4 changed files with 27 additions and 37 deletions
|
@ -40,7 +40,7 @@ const QColor colors[C9X_MAX_CURVES] = {
|
||||||
QColor(255,127,0),
|
QColor(255,127,0),
|
||||||
};
|
};
|
||||||
|
|
||||||
QString getPhaseName(int val, char * phasename)
|
QString getPhaseName(int val, const char * phasename)
|
||||||
{
|
{
|
||||||
if (!val) return "---";
|
if (!val) return "---";
|
||||||
if (!phasename) {
|
if (!phasename) {
|
||||||
|
|
|
@ -107,7 +107,7 @@ QString getPhasesStr(unsigned int phases, ModelData & model);
|
||||||
void populateGVCB(QComboBox *b, int value);
|
void populateGVCB(QComboBox *b, int value);
|
||||||
void populateSourceCB(QComboBox *b, const RawSource &source, const ModelData & model, unsigned int flags);
|
void populateSourceCB(QComboBox *b, const RawSource &source, const ModelData & model, unsigned int flags);
|
||||||
void populateCSWCB(QComboBox *b, int value);
|
void populateCSWCB(QComboBox *b, int value);
|
||||||
QString getPhaseName(int val, char * phasename=NULL);
|
QString getPhaseName(int val, const char * phasename=NULL);
|
||||||
QString getInputStr(ModelData & model, int index);
|
QString getInputStr(ModelData & model, int index);
|
||||||
QString image2qstring(QImage image);
|
QString image2qstring(QImage image);
|
||||||
QImage qstring2image(QString imagestr);
|
QImage qstring2image(QString imagestr);
|
||||||
|
|
|
@ -47,7 +47,7 @@ PrintDialog::PrintDialog(QWidget *parent, FirmwareInterface * firmware, GeneralS
|
||||||
if (gvars) {
|
if (gvars) {
|
||||||
te->append(printPhases()+"<br>");
|
te->append(printPhases()+"<br>");
|
||||||
}
|
}
|
||||||
printExpo();
|
printInputs();
|
||||||
printMixes();
|
printMixes();
|
||||||
printLimits();
|
printLimits();
|
||||||
printCurves();
|
printCurves();
|
||||||
|
@ -208,7 +208,7 @@ QString PrintDialog::printPhases()
|
||||||
return(str);
|
return(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintDialog::printExpo()
|
void PrintDialog::printInputs()
|
||||||
{
|
{
|
||||||
QString str = "<table border=1 cellspacing=0 cellpadding=3 width=\"100%\"><tr><td><h2>";
|
QString str = "<table border=1 cellspacing=0 cellpadding=3 width=\"100%\"><tr><td><h2>";
|
||||||
str.append(tr("Inputs"));
|
str.append(tr("Inputs"));
|
||||||
|
@ -225,27 +225,25 @@ void PrintDialog::printExpo()
|
||||||
lastCHN=ed->chn;
|
lastCHN=ed->chn;
|
||||||
str.append("<b>"+getInputStr(*g_model, ed->chn)+"</b>");
|
str.append("<b>"+getInputStr(*g_model, ed->chn)+"</b>");
|
||||||
}
|
}
|
||||||
else
|
|
||||||
str.append("<b> </b>");
|
|
||||||
str.append("</font></td>");
|
str.append("</font></td>");
|
||||||
str.append("<td><font size=+1 face='Courier New' color=green>");
|
str.append("<td><font size=+1 face='Courier New' color=green>");
|
||||||
|
|
||||||
switch(ed->mode) {
|
switch(ed->mode) {
|
||||||
case (1):
|
case (1):
|
||||||
str += "<- ";
|
str += "<-";
|
||||||
break;
|
break;
|
||||||
case (2):
|
case (2):
|
||||||
str += "-> ";
|
str += "->";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
str += " ";
|
str += " ";
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
|
|
||||||
str += tr("Weight(") + QString("%1").arg(getGVarString(ed->weight,true)) + ")";
|
str += " " + tr("Weight") + QString("(%1)").arg(getGVarString(ed->weight,true));
|
||||||
|
|
||||||
if (firmware->getCapability(VirtualInputs)) {
|
if (firmware->getCapability(VirtualInputs)) {
|
||||||
str += " " + tr("Source(%1)").arg(ed->srcRaw.toString());
|
str += " " + tr("Source") + QString("(%1)").arg(ed->srcRaw.toString());
|
||||||
if (ed->carryTrim>0) {
|
if (ed->carryTrim>0) {
|
||||||
str += " " + tr("NoTrim");
|
str += " " + tr("NoTrim");
|
||||||
}
|
}
|
||||||
|
@ -259,33 +257,26 @@ void PrintDialog::printExpo()
|
||||||
if(ed->phases) {
|
if(ed->phases) {
|
||||||
if (ed->phases!=(unsigned int)(1<<firmware->getCapability(FlightPhases))-1) {
|
if (ed->phases!=(unsigned int)(1<<firmware->getCapability(FlightPhases))-1) {
|
||||||
int mask=1;
|
int mask=1;
|
||||||
int first=0;
|
bool first = true;
|
||||||
for (int i=0; i<firmware->getCapability(FlightPhases);i++) {
|
QString strPhases;
|
||||||
if (!(ed->phases & mask)) {
|
bool multiple = false;
|
||||||
first++;
|
|
||||||
}
|
|
||||||
mask <<=1;
|
|
||||||
}
|
|
||||||
if (first>1) {
|
|
||||||
str += " " + tr("Flight modes") + QString("(");
|
|
||||||
} else {
|
|
||||||
str += " " + tr("Flight mode") + QString("(");
|
|
||||||
}
|
|
||||||
mask=1;
|
|
||||||
first=1;
|
|
||||||
for (int j=0; j<firmware->getCapability(FlightPhases);j++) {
|
for (int j=0; j<firmware->getCapability(FlightPhases);j++) {
|
||||||
if (!(ed->phases & mask)) {
|
if (!(ed->phases & mask)) {
|
||||||
PhaseData *pd = &g_model->phaseData[j];
|
//PhaseData *pd = &g_model->phaseData[j];
|
||||||
if (!first) {
|
const char * pdName = g_model->phaseData[j].name;
|
||||||
str += QString(", ")+ QString("%1").arg(getPhaseName(j+1, pd->name));
|
if (first) {
|
||||||
|
strPhases += QString("%1").arg(getPhaseName(j+1,pdName));
|
||||||
|
first = false;
|
||||||
} else {
|
} else {
|
||||||
str += QString("%1").arg(getPhaseName(j+1,pd->name));
|
strPhases += QString(", %1").arg(getPhaseName(j+1, pdName));
|
||||||
first=0;
|
multiple = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mask <<= 1;
|
mask <<= 1;
|
||||||
}
|
}
|
||||||
str += QString(")");
|
if (!strPhases.isEmpty()) {
|
||||||
|
str += " " + tr(multiple?"Flight modes":"Flight mode") + "(" + strPhases + ")";
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
str += tr("DISABLED")+QString(" !!!");
|
str += tr("DISABLED")+QString(" !!!");
|
||||||
}
|
}
|
||||||
|
@ -294,10 +285,9 @@ void PrintDialog::printExpo()
|
||||||
if (ed->swtch.type)
|
if (ed->swtch.type)
|
||||||
str += " " + tr("Switch") + QString("(%1)").arg(ed->swtch.toString());
|
str += " " + tr("Switch") + QString("(%1)").arg(ed->swtch.toString());
|
||||||
if (firmware->getCapability(HasExpoNames)) {
|
if (firmware->getCapability(HasExpoNames)) {
|
||||||
QString ExpoName;
|
QString ExpoName(ed->name);
|
||||||
ExpoName.append(ed->name);
|
if (ed->name[0]) {
|
||||||
if (!ExpoName.isEmpty()) {
|
str += QString(" [%1]").arg(ed->name);
|
||||||
str+= " " + QString(" [%1]").arg(ExpoName);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
str += "</font></td></tr>";
|
str += "</font></td></tr>";
|
||||||
|
|
|
@ -33,7 +33,7 @@ private:
|
||||||
|
|
||||||
void printSetup();
|
void printSetup();
|
||||||
QString printPhases();
|
QString printPhases();
|
||||||
void printExpo();
|
void printInputs();
|
||||||
void printMixes();
|
void printMixes();
|
||||||
void printLimits();
|
void printLimits();
|
||||||
void printCurves();
|
void printCurves();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue