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:
committed by
Bertrand Songis
parent
0544846dc3
commit
b4175eade3
@@ -24,11 +24,15 @@
|
||||
#include "boards.h"
|
||||
#include "helpers_html.h"
|
||||
#include "multiprotocols.h"
|
||||
#include "appdata.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QPainter>
|
||||
#include <QFile>
|
||||
#include <QUrl>
|
||||
#include <QTextStream>
|
||||
|
||||
extern AppData g;
|
||||
|
||||
QString changeColor(const QString & input, const QString & to, const QString & from)
|
||||
{
|
||||
@@ -649,10 +653,17 @@ QString ModelPrinter::printLogicalSwitchLine(int idx)
|
||||
return result;
|
||||
}
|
||||
|
||||
QString ModelPrinter::printCustomFunctionLine(int idx)
|
||||
QString ModelPrinter::printCustomFunctionLine(int idx, bool gfunc)
|
||||
{
|
||||
QString result;
|
||||
const CustomFunctionData & cf = model.customFn[idx];
|
||||
CustomFunctionData cf;
|
||||
if (gfunc) {
|
||||
if (model.noGlobalFunctions)
|
||||
return result;
|
||||
cf = generalSettings.customFn[idx];
|
||||
}
|
||||
else
|
||||
cf = model.customFn[idx];
|
||||
if (cf.swtch.type == SWITCH_TYPE_NONE)
|
||||
return result;
|
||||
|
||||
@@ -1445,3 +1456,21 @@ QString ModelPrinter::printTelemetryScreen(unsigned int idx, unsigned int line,
|
||||
}
|
||||
return (hd.count() > 1 ? doTableRow(hd, width / hd.count(), "left", "", true) : "" ) + doTableRow(strl, width / strl.count());
|
||||
}
|
||||
|
||||
QString ModelPrinter::printChecklist()
|
||||
{
|
||||
if (!model.displayChecklist)
|
||||
return "";
|
||||
QString str = tr("Error: Unable to open or read file!");
|
||||
QFile file(Helpers::getChecklistFilePath(&model));
|
||||
if (file.open(QFile::ReadOnly | QFile::Text)) {
|
||||
QTextStream in(&file);
|
||||
if (in.status() == QTextStream::Ok) {
|
||||
str = in.readAll();
|
||||
str.replace("\n", "<br />");
|
||||
str.remove("\r");
|
||||
}
|
||||
file.close();
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user