[companion] Adjust GVAR not possible in global functions (fix #5425)
[opentx.git] / companion / src / modelprinter.h
blobd3d604081e5c71a9c76cceb248ab5db17bb35679
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 _MODELPRINTER_H_
22 #define _MODELPRINTER_H_
24 #include <QString>
25 #include <QStringList>
26 #include <QPainter>
27 #include <QTextDocument>
28 #include "eeprominterface.h"
30 QString changeColor(const QString & input, const QString & to, const QString & from = "grey");
32 QString addFont(const QString & input, const QString & color = "", const QString & size = "", const QString & face = "");
34 void debugHtml(const QString & html);
36 class CurveImage
38 public:
39 CurveImage();
40 void drawCurve(const CurveData & curve, QColor color);
41 const QImage & get() const { return image; };
43 protected:
44 int size;
45 QImage image;
46 QPainter painter;
49 class ModelPrinter: public QObject
51 Q_OBJECT
53 public:
54 ModelPrinter(Firmware * firmware, const GeneralSettings & generalSettings, const ModelData & model);
55 virtual ~ModelPrinter();
57 QString printEEpromSize();
58 QString printTrimIncrementMode();
59 QString printThrottleTrimMode();
60 static QString printModuleProtocol(unsigned int protocol);
61 static QString printMultiRfProtocol(int rfProtocol, bool custom);
62 static QString printMultiSubType(int rfProtocol, bool custom, unsigned int subType);
63 QString printFlightModeSwitch(const RawSwitch & swtch);
64 QString printFlightModeName(int index);
65 QString printFlightModes(unsigned int flightModes);
66 QString printModule(int idx);
67 QString printTrainerMode();
68 QString printCenterBeep();
69 QString printHeliSwashType();
70 QString printTrim(int flightModeIndex, int stickIndex);
71 QString printGlobalVar(int flightModeIndex, int gvarIndex);
72 QString printRotaryEncoder(int flightModeIndex, int reIndex);
73 QString printTimer(int idx);
74 QString printTimer(const TimerData & timer);
75 QString printInputName(int idx);
76 QString printInputLine(int idx);
77 QString printInputLine(const ExpoData & ed);
78 QString printMixerLine(const MixData & md, bool showMultiplex, int highlightedSource = 0);
79 QString printLogicalSwitchLine(int idx);
80 QString printCustomFunctionLine(int idx);
81 QString printChannelName(int idx);
82 QString printCurveName(int idx);
83 QString printCurve(int idx);
84 QString createCurveImage(int idx, QTextDocument * document);
85 QString printGlobalVarUnit(int idx);
86 QString printGlobalVarPrec(int idx);
87 QString printGlobalVarMin(int idx);
88 QString printGlobalVarMax(int idx);
89 QString printGlobalVarPopup(int idx);
91 private:
92 Firmware * firmware;
93 const GeneralSettings & generalSettings;
94 const ModelData & model;
98 #endif // _MODELPRINTER_H_