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.
24 #include "modeledit.h"
25 #include "eeprominterface.h"
27 class RawSwitchFilterItemModel
;
35 class TimerPanel
: public ModelPanel
40 TimerPanel(QWidget
*parent
, ModelData
& model
, TimerData
& timer
, GeneralSettings
& generalSettings
, Firmware
* firmware
, QWidget
*prevFocus
);
41 virtual ~TimerPanel();
43 virtual void update();
44 QWidget
* getLastFocus();
47 void on_mode_currentIndexChanged(int index
);
48 void on_value_editingFinished();
49 void on_minuteBeep_toggled(bool checked
);
50 void on_name_editingFinished();
55 RawSwitchFilterItemModel
* rawSwitchItemModel
;
58 class ModulePanel
: public ModelPanel
63 ModulePanel(QWidget
*parent
, ModelData
& model
, ModuleData
& module
, GeneralSettings
& generalSettings
, Firmware
* firmware
, int moduleIdx
);
64 virtual ~ModulePanel();
65 virtual void update();
66 bool moduleHasFailsafes();
69 void onExtendedLimitsToggled();
72 void channelsRangeChanged();
75 void setupFailsafes();
76 void on_trainerMode_currentIndexChanged(int index
);
77 void onProtocolChanged(int index
);
78 void on_ppmDelay_editingFinished();
79 void on_channelsCount_editingFinished();
80 void on_channelsStart_editingFinished();
81 void on_ppmPolarity_currentIndexChanged(int index
);
82 void on_ppmOutputType_currentIndexChanged(int index
);
83 void on_ppmFrameLength_editingFinished();
84 void on_antennaMode_currentIndexChanged(int index
);
85 void on_rxNumber_editingFinished();
86 void on_failsafeMode_currentIndexChanged(int value
);
87 void onMultiProtocolChanged(int index
);
88 void on_multiSubType_currentIndexChanged(int index
);
89 void on_autoBind_stateChanged(int state
);
90 void on_lowPower_stateChanged(int state
);
91 void on_sportOut_currentIndexChanged(int index
);
92 void on_r9mPower_currentIndexChanged(int index
);
93 void setChannelFailsafeValue(const int channel
, const int value
, quint8 updtSb
= 0);
94 void onFailsafeComboIndexChanged(int index
);
95 void onFailsafeUsecChanged(int value
);
96 void onFailsafePercentChanged(double value
);
97 void onFailsafesDisplayValueTypeChanged(int type
);
98 void updateFailsafe(int channel
);
99 void on_optionValue_editingFinished();
102 enum FailsafeValueDisplayTypes
{ FAILSAFE_DISPLAY_PERCENT
= 1, FAILSAFE_DISPLAY_USEC
= 2 };
104 struct ChannelFailsafeWidgetsGroup
{
108 QDoubleSpinBox
* sbPercent
;
114 QMap
<int, ChannelFailsafeWidgetsGroup
> failsafeGroupsMap
;
115 static quint8 failsafesValueDisplayType
; // FailsafeValueDisplayTypes
118 class SetupPanel
: public ModelPanel
123 SetupPanel(QWidget
*parent
, ModelData
& model
, GeneralSettings
& generalSettings
, Firmware
* firmware
);
124 virtual ~SetupPanel();
126 virtual void update();
129 void extendedLimitsToggled();
132 void on_name_editingFinished();
133 void on_throttleSource_currentIndexChanged(int index
);
134 void on_throttleTrim_toggled(bool checked
);
135 void on_extendedLimits_toggled(bool checked
);
136 void on_extendedTrims_toggled(bool checked
);
137 void on_throttleWarning_toggled(bool checked
);
138 void on_throttleReverse_toggled(bool checked
);
139 void on_displayText_toggled(bool checked
);
140 void on_gfEnabled_toggled(bool checked
);
141 void on_image_currentIndexChanged(int index
);
142 void on_trimIncrement_currentIndexChanged(int index
);
143 void onBeepCenterToggled(bool checked
);
144 void startupSwitchEdited(int value
);
145 void startupSwitchToggled(bool checked
);
146 void potWarningToggled(bool checked
);
147 void on_potWarningMode_currentIndexChanged(int index
);
148 void on_editText_clicked();
152 QVector
<QSlider
*> startupSwitchesSliders
;
153 QVector
<QCheckBox
*> startupSwitchesCheckboxes
;
154 QVector
<QCheckBox
*> potWarningCheckboxes
;
155 QVector
<QCheckBox
*> centerBeepCheckboxes
;
156 ModulePanel
* modules
[CPN_MAX_MODULES
+1];
157 TimerPanel
* timers
[CPN_MAX_TIMERS
];
158 void updateStartupSwitches();
159 void updatePotWarnings();
160 void updateBeepCenter();
161 void populateThrottleSourceCB();