Companion enhancements for checklist editor, model print and compare (2 3 branch) (#6434)

* Model print and compare include GFs enhancement

* Model print and compare include checklist contents

* Add missing brackets and code tidy up

* Print message if cannot open or read checklist file

* Missing GV label translation
Move some checklist code to helpers

* Refactor to use helpers and add cursor position

* Move improved version of removeAccents to helpers and apply to checklist

* Force fixed width font for edit window
This commit is contained in:
Neil Horne
2019-05-20 18:56:23 +02:00
committed by Bertrand Songis
parent 0544846dc3
commit b4175eade3
11 changed files with 181 additions and 50 deletions
+61 -1
View File
@@ -272,6 +272,8 @@ QString MultiModelPrinter::print(QTextDocument * document)
document->setDefaultStyleSheet(css.text());
QString str = "<table cellspacing='0' cellpadding='3' width='100%'>"; // attributes not settable via QT stylesheet
str.append(printSetup());
if (firmware->getCapability(HasDisplayText))
str.append(printChecklist());
if (firmware->getCapability(Timers)) {
str.append(printTimers());
}
@@ -283,10 +285,12 @@ QString MultiModelPrinter::print(QTextDocument * document)
str.append(printInputs());
str.append(printMixers());
str.append(printOutputs());
str += printCurves(document);
str.append(printCurves(document));
if (firmware->getCapability(Gvars) && !firmware->getCapability(GvarsFlightModes))
str.append(printGvars());
str.append(printLogicalSwitches());
if (firmware->getCapability(GlobalFunctions))
str.append(printGlobalFunctions());
str.append(printSpecialFunctions());
if (firmware->getCapability(Telemetry) & TM_HASTELEMETRY) {
str.append(printTelemetry());
@@ -917,3 +921,59 @@ QString MultiModelPrinter::printTelemetryScreens()
}
return str;
}
QString MultiModelPrinter::printGlobalFunctions()
{
QString str;
QString txt;
int count = 0;
int idx = -1;
MultiColumns columns(modelPrinterMap.size());
columns.appendSectionTableStart();
for (int k=0; k < modelPrinterMap.size(); k++) {
if (!modelPrinterMap.value(k).first->noGlobalFunctions) {
idx = k;
break;
}
}
if (idx > -1) {
ModelPrinter * modelPrinter = modelPrinterMap.value(idx).second;
(void)(modelPrinter);
for (int i=0; i < firmware->getCapability(GlobalFunctions); i++) {
txt = modelPrinter->printCustomFunctionLine(i, true);
if (!txt.isEmpty()) {
count++;
ROWLABELCOMPARECELL(tr("GF%1").arg(i+1), 20, modelPrinter->printCustomFunctionLine(i, true), 80);
}
}
columns.appendTableEnd();
if (count > 0) {
str.append(printTitle(tr("Global Functions")));
str.append(columns.print());
}
}
return str;
}
QString MultiModelPrinter::printChecklist()
{
QString str;
MultiColumns columns(modelPrinterMap.size());
bool isChecklist = false;
for (int k=0; k < modelPrinterMap.size(); k++) {
if (modelPrinterMap.value(k).first->displayChecklist) {
isChecklist = true;
break;
}
}
if (isChecklist) {
columns.appendSectionTableStart();
ROWLABELCOMPARECELL(tr("Checklist"), 20, modelPrinter->printChecklist(), 80);
columns.appendTableEnd();
str.append(columns.print());
}
return str;
}