Make TX volatge for simu more flexible (#7124)
[opentx.git] / companion / src / multimodelprinter.h
blob4214bc45b32c225a1d2185fbdba11a916a3db9c2
1 /*
2 * Copyright (C) OpenTX
4 * Based on code named
5 * th9x - http://code.google.com/p/th9x
6 * er9x - http://code.google.com/p/er9x
7 * gruvin9x - http://code.google.com/p/gruvin9x
9 * License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
21 #ifndef _MULTIMODELPRINTER_H_
22 #define _MULTIMODELPRINTER_H_
24 #include <QObject>
25 #include <QTextDocument>
26 #include "eeprominterface.h"
27 #include "modelprinter.h"
29 class MultiModelPrinter: public QObject
31 Q_OBJECT
33 public:
34 MultiModelPrinter(Firmware * firmware);
35 virtual ~MultiModelPrinter();
37 void setModel(int idx, const ModelData * model, const GeneralSettings * generalSettings);
38 void setModel(int idx, const ModelData * model);
39 void clearModels();
40 QString print(QTextDocument * document);
42 protected:
43 class MultiColumns {
44 public:
45 MultiColumns(int count);
46 ~MultiColumns();
47 bool isEmpty();
48 QString print();
49 void append(const QString & str);
50 void appendTitle(const QString & name);
51 void append(int idx, const QString & str);
52 template <class T> void append(int idx, T val);
53 void beginCompare();
54 void endCompare();
55 void appendLineBreak();
56 void appendSectionTableStart();
57 void appendTableEnd();
58 void appendRowStart(const QString & title = "", const unsigned int titlewidth = 0);
59 void appendRowEnd();
60 void appendCellStart(const unsigned int width = 0, const bool bold = false);
61 void appendCellEnd(const bool bold = false);
62 void appendLabelCell(const QString & str, const unsigned int width = 0, const QString & align = "left", const QString & color = "");
63 void appendValueCell(const QString & str, const unsigned int width = 0, const QString & align = "left", const QString & color = "");
64 void appendRow(const QStringList & strl, const unsigned int width = 0, const QString & align = "left", const QString & color = "");
65 void appendRowHeader(const QStringList & strl, const unsigned int width = 0, const QString & align = "left", const QString & color = "");
66 void appendRowBlank();
67 void appendFieldLabel(const QString & lbl = "");
68 void appendFieldSeparator(const bool sep = false);
70 private:
71 int count;
72 QString * columns;
73 QString * compareColumns;
76 Firmware * firmware;
77 GeneralSettings defaultSettings;
78 QMap<int, QPair<const ModelData *, ModelPrinter *> > modelPrinterMap;
80 QString printTitle(const QString & label);
81 QString printSetup();
82 QString printModules();
83 QString printHeliSetup();
84 QString printFlightModes();
85 QString printOutputs();
86 QString printInputs();
87 QString printMixers();
88 QString printCurves(QTextDocument * document);
89 QString printGvars();
90 QString printLogicalSwitches();
91 QString printSpecialFunctions();
92 QString printTelemetry();
93 QString printTimers();
94 QString printSensors();
95 QString printTelemetryScreens();
96 QString printGlobalFunctions();
97 QString printChecklist();
100 #endif // _MULTIMODELPRINTER_H_