mirror of
https://github.com/opentx/opentx.git
synced 2025-07-15 20:35:17 +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),
|
||||
};
|
||||
|
||||
QString getPhaseName(int val, char * phasename)
|
||||
QString getPhaseName(int val, const char * phasename)
|
||||
{
|
||||
if (!val) return "---";
|
||||
if (!phasename) {
|
||||
|
|
|
@ -107,7 +107,7 @@ QString getPhasesStr(unsigned int phases, ModelData & model);
|
|||
void populateGVCB(QComboBox *b, int value);
|
||||
void populateSourceCB(QComboBox *b, const RawSource &source, const ModelData & model, unsigned int flags);
|
||||
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 image2qstring(QImage image);
|
||||
QImage qstring2image(QString imagestr);
|
||||
|
|
|
@ -47,7 +47,7 @@ PrintDialog::PrintDialog(QWidget *parent, FirmwareInterface * firmware, GeneralS
|
|||
if (gvars) {
|
||||
te->append(printPhases()+"<br>");
|
||||
}
|
||||
printExpo();
|
||||
printInputs();
|
||||
printMixes();
|
||||
printLimits();
|
||||
printCurves();
|
||||
|
@ -208,7 +208,7 @@ QString PrintDialog::printPhases()
|
|||
return(str);
|
||||
}
|
||||
|
||||
void PrintDialog::printExpo()
|
||||
void PrintDialog::printInputs()
|
||||
{
|
||||
QString str = "<table border=1 cellspacing=0 cellpadding=3 width=\"100%\"><tr><td><h2>";
|
||||
str.append(tr("Inputs"));
|
||||
|
@ -225,27 +225,25 @@ void PrintDialog::printExpo()
|
|||
lastCHN=ed->chn;
|
||||
str.append("<b>"+getInputStr(*g_model, ed->chn)+"</b>");
|
||||
}
|
||||
else
|
||||
str.append("<b> </b>");
|
||||
str.append("</font></td>");
|
||||
str.append("<td><font size=+1 face='Courier New' color=green>");
|
||||
|
||||
switch(ed->mode) {
|
||||
case (1):
|
||||
str += "<- ";
|
||||
str += "<-";
|
||||
break;
|
||||
case (2):
|
||||
str += "-> ";
|
||||
str += "->";
|
||||
break;
|
||||
default:
|
||||
str += " ";
|
||||
str += " ";
|
||||
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)) {
|
||||
str += " " + tr("Source(%1)").arg(ed->srcRaw.toString());
|
||||
str += " " + tr("Source") + QString("(%1)").arg(ed->srcRaw.toString());
|
||||
if (ed->carryTrim>0) {
|
||||
str += " " + tr("NoTrim");
|
||||
}
|
||||
|
@ -259,33 +257,26 @@ void PrintDialog::printExpo()
|
|||
if(ed->phases) {
|
||||
if (ed->phases!=(unsigned int)(1<<firmware->getCapability(FlightPhases))-1) {
|
||||
int mask=1;
|
||||
int first=0;
|
||||
for (int i=0; i<firmware->getCapability(FlightPhases);i++) {
|
||||
if (!(ed->phases & mask)) {
|
||||
first++;
|
||||
}
|
||||
mask <<=1;
|
||||
}
|
||||
if (first>1) {
|
||||
str += " " + tr("Flight modes") + QString("(");
|
||||
} else {
|
||||
str += " " + tr("Flight mode") + QString("(");
|
||||
}
|
||||
mask=1;
|
||||
first=1;
|
||||
bool first = true;
|
||||
QString strPhases;
|
||||
bool multiple = false;
|
||||
for (int j=0; j<firmware->getCapability(FlightPhases);j++) {
|
||||
if (!(ed->phases & mask)) {
|
||||
PhaseData *pd = &g_model->phaseData[j];
|
||||
if (!first) {
|
||||
str += QString(", ")+ QString("%1").arg(getPhaseName(j+1, pd->name));
|
||||
//PhaseData *pd = &g_model->phaseData[j];
|
||||
const char * pdName = g_model->phaseData[j].name;
|
||||
if (first) {
|
||||
strPhases += QString("%1").arg(getPhaseName(j+1,pdName));
|
||||
first = false;
|
||||
} else {
|
||||
str += QString("%1").arg(getPhaseName(j+1,pd->name));
|
||||
first=0;
|
||||
strPhases += QString(", %1").arg(getPhaseName(j+1, pdName));
|
||||
multiple = true;
|
||||
}
|
||||
}
|
||||
mask <<=1;
|
||||
mask <<= 1;
|
||||
}
|
||||
if (!strPhases.isEmpty()) {
|
||||
str += " " + tr(multiple?"Flight modes":"Flight mode") + "(" + strPhases + ")";
|
||||
}
|
||||
str += QString(")");
|
||||
} else {
|
||||
str += tr("DISABLED")+QString(" !!!");
|
||||
}
|
||||
|
@ -294,10 +285,9 @@ void PrintDialog::printExpo()
|
|||
if (ed->swtch.type)
|
||||
str += " " + tr("Switch") + QString("(%1)").arg(ed->swtch.toString());
|
||||
if (firmware->getCapability(HasExpoNames)) {
|
||||
QString ExpoName;
|
||||
ExpoName.append(ed->name);
|
||||
if (!ExpoName.isEmpty()) {
|
||||
str+= " " + QString(" [%1]").arg(ExpoName);
|
||||
QString ExpoName(ed->name);
|
||||
if (ed->name[0]) {
|
||||
str += QString(" [%1]").arg(ed->name);
|
||||
}
|
||||
}
|
||||
str += "</font></td></tr>";
|
||||
|
|
|
@ -33,7 +33,7 @@ private:
|
|||
|
||||
void printSetup();
|
||||
QString printPhases();
|
||||
void printExpo();
|
||||
void printInputs();
|
||||
void printMixes();
|
||||
void printLimits();
|
||||
void printCurves();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue