[companion] Adjust GVAR not possible in global functions (fix #5425)
[opentx.git] / companion / src / multimodelprinter.h
bloba896f9d6e689daf9498965b190131450cf4a1acc
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(const QString & color = "grey");
55 private:
56 int count;
57 QString * columns;
58 QString * compareColumns;
61 Firmware * firmware;
62 GeneralSettings defaultSettings;
63 QMap<int, QPair<const ModelData *, ModelPrinter *> > modelPrinterMap;
65 QString printTitle(const QString & label);
66 QString printSetup();
67 QString printHeliSetup();
68 QString printFlightModes();
69 QString printLimits();
70 QString printInputs();
71 QString printMixers();
72 QString printCurves(QTextDocument * document);
73 QString printGvars();
74 QString printLogicalSwitches();
75 QString printCustomFunctions();
76 QString printTelemetry();
79 #endif // _MULTIMODELPRINTER_H_