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 SIMULATEDUIWIDGET_H
22 #define SIMULATEDUIWIDGET_H
25 #include "constants.h"
26 #include "radiowidget.h"
27 #include "simulator.h"
28 #include "simulator_strings.h"
31 #include <QMouseEvent>
33 class SimulatorInterface
;
39 * This is a base class for the main hardware-specific radio user interface, including LCD screen and navigation buttons/widgets.
40 * It is responsible for hanlding all interactions with this part of the simulation (vs. common radio widgets like sticks/switches/knobs).
41 * Sub-classes are responsible for building the actual UI form they need for presentation.
42 * This base class should not be instantiated directly.
44 class SimulatedUIWidget
: public QWidget
50 explicit SimulatedUIWidget(SimulatorInterface
* simulator
, QWidget
* parent
= NULL
);
56 RadioWidget
* addRadioWidget(RadioWidget
* keyWidget
);
57 RadioUiAction
* addRadioAction(RadioUiAction
* act
);
59 QVector
<Simulator::keymapHelp_t
> getKeymapHelp() const;
61 static QPolygon
polyArc(int ctrX
, int ctrY
, int radius
, int startAngle
= 0, int endAngle
= 360, int step
= 10);
65 void captureScreenshot();
67 void wheelEvent(QWheelEvent
*event
);
68 void mousePressEvent(QMouseEvent
*event
);
69 void mouseReleaseEvent(QMouseEvent
*event
);
73 void controlValueChange(RadioWidget::RadioWidgetType type
, int index
, int value
);
74 void customStyleRequest(const QString
& style
);
75 void simulatorWheelEvent(qint8 steps
);
79 void setLcd(LcdWidget
* lcd
);
80 void connectScrollActions();
81 void onLcdChange(bool backlightEnable
);
82 virtual void setLightOn(bool enable
) { }
86 SimulatorInterface
* m_simulator
;
89 QVector
<QColor
> m_backlightColors
;
90 QList
<RadioUiAction
*> m_actions
;
91 QList
<RadioWidget
*> m_widgets
;
92 RadioUiAction
* m_scrollUpAction
;
93 RadioUiAction
* m_scrollDnAction
;
94 RadioUiAction
* m_mouseMidClickAction
;
95 RadioUiAction
* m_screenshotAction
;
97 unsigned int m_backLight
;
104 // Each subclass is responsible for its own Ui
106 class SimulatedUIWidget9X
;
107 class SimulatedUIWidgetX7
;
108 class SimulatedUIWidgetX9
;
109 class SimulatedUIWidgetX9E
;
110 class SimulatedUIWidgetX10
;
111 class SimulatedUIWidgetX12
;
114 class SimulatedUIWidget9X
: public SimulatedUIWidget
119 explicit SimulatedUIWidget9X(SimulatorInterface
* simulator
, QWidget
* parent
= NULL
);
120 virtual ~SimulatedUIWidget9X();
123 void setLightOn(bool enable
);
126 Ui::SimulatedUIWidget9X
* ui
;
130 class SimulatedUIWidgetX7
: public SimulatedUIWidget
135 explicit SimulatedUIWidgetX7(SimulatorInterface
* simulator
, QWidget
* parent
= NULL
);
136 virtual ~SimulatedUIWidgetX7();
139 Ui::SimulatedUIWidgetX7
* ui
;
142 class SimulatedUIWidgetX9
: public SimulatedUIWidget
147 explicit SimulatedUIWidgetX9(SimulatorInterface
* simulator
, QWidget
* parent
= NULL
);
148 virtual ~SimulatedUIWidgetX9();
151 Ui::SimulatedUIWidgetX9
* ui
;
154 class SimulatedUIWidgetX9E
: public SimulatedUIWidget
159 explicit SimulatedUIWidgetX9E(SimulatorInterface
* simulator
, QWidget
* parent
= NULL
);
160 virtual ~SimulatedUIWidgetX9E();
163 Ui::SimulatedUIWidgetX9E
* ui
;
166 class SimulatedUIWidgetX10
: public SimulatedUIWidget
171 explicit SimulatedUIWidgetX10(SimulatorInterface
* simulator
, QWidget
* parent
= NULL
);
172 virtual ~SimulatedUIWidgetX10();
175 Ui::SimulatedUIWidgetX10
* ui
;
178 class SimulatedUIWidgetX12
: public SimulatedUIWidget
183 explicit SimulatedUIWidgetX12(SimulatorInterface
* simulator
, QWidget
* parent
= NULL
);
184 virtual ~SimulatedUIWidgetX12();
187 Ui::SimulatedUIWidgetX12
* ui
;
190 #endif // SIMULATEDUIWIDGET_H