1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-21 11:54:15 +01:00

FlightMode GUI: replace numeric value by slider

This commit is contained in:
Oleg Semyonov 2012-07-03 17:20:10 +03:00
parent 3cd293a5e6
commit 12106c5549
2 changed files with 58 additions and 37 deletions

View File

@ -1123,7 +1123,7 @@ void ConfigInputWidget::invertControls()
void ConfigInputWidget::moveFMSlider() void ConfigInputWidget::moveFMSlider()
{ {
ManualControlSettings::DataFields manualSettingsDataPriv = manualSettingsObj->getData(); ManualControlSettings::DataFields manualSettingsDataPriv = manualSettingsObj->getData();
ManualControlCommand::DataFields manualCommandDataPriv=manualCommandObj->getData(); ManualControlCommand::DataFields manualCommandDataPriv = manualCommandObj->getData();
float valueScaled; float valueScaled;
int chMin = manualSettingsDataPriv.ChannelMin[ManualControlSettings::CHANNELMIN_FLIGHTMODE]; int chMin = manualSettingsDataPriv.ChannelMin[ManualControlSettings::CHANNELMIN_FLIGHTMODE];
@ -1155,7 +1155,10 @@ void ConfigInputWidget::moveFMSlider()
// Display current channel value for tuning (in percents) // Display current channel value for tuning (in percents)
float scaledFlightMode = (valueScaled + 1.0) / 2.0; float scaledFlightMode = (valueScaled + 1.0) / 2.0;
m_config->fmsValue->setText(QString::number(scaledFlightMode * 100.0, 'f', 0)); m_config->fmsChannelSlider->setValue(scaledFlightMode * 100.0
/ ManualControlSettings::FLIGHTMODEPOSITION_NUMELEM * manualSettingsDataPriv.FlightModeNumber);
m_config->fmsChannelSlider->setToolTip(
"Current flight mode channel value: " + QString::number(scaledFlightMode * 100.0, 'f', 0) + '%');
// Convert flightMode value into the switch position in the range [0..N-1] // Convert flightMode value into the switch position in the range [0..N-1]
// This uses the same optimized computation as flight code to be consistent // This uses the same optimized computation as flight code to be consistent

View File

@ -516,8 +516,9 @@ margin:1px;</string>
</property> </property>
<property name="toolTip"> <property name="toolTip">
<string>This slider moves when you move the flight mode switch <string>This slider moves when you move the flight mode switch
on your remote. Setup the flightmode channel on the RC Input tab on your remote. It shows currently active flight mode.
if you have not done so already.</string>
Setup the flight mode channel on the RC Input tab if you have not done so already.</string>
</property> </property>
<property name="minimum"> <property name="minimum">
<number>0</number> <number>0</number>
@ -631,7 +632,7 @@ if you have not done so already.</string>
<widget class="QSpinBox" name="fmsPosNum"> <widget class="QSpinBox" name="fmsPosNum">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>410</x> <x>464</x>
<y>20</y> <y>20</y>
<width>61</width> <width>61</width>
<height>20</height> <height>20</height>
@ -660,8 +661,8 @@ channel value for each flight mode.</string>
<widget class="QLabel" name="label"> <widget class="QLabel" name="label">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>270</x> <x>305</x>
<y>20</y> <y>22</y>
<width>141</width> <width>141</width>
<height>16</height> <height>16</height>
</rect> </rect>
@ -670,24 +671,11 @@ channel value for each flight mode.</string>
<string>Number of switch positions:</string> <string>Number of switch positions:</string>
</property> </property>
</widget> </widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>270</x>
<y>50</y>
<width>141</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>Channel value (0..100):</string>
</property>
</widget>
<widget class="QLabel" name="label_15"> <widget class="QLabel" name="label_15">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>300</x> <x>310</x>
<y>130</y> <y>90</y>
<width>191</width> <width>191</width>
<height>30</height> <height>30</height>
</rect> </rect>
@ -705,26 +693,56 @@ channel value for each flight mode.</string>
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> </widget>
<widget class="QLabel" name="fmsValue"> <widget class="QSlider" name="fmsChannelSlider">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>410</x> <x>265</x>
<y>51</y> <y>16</y>
<width>46</width> <width>20</width>
<height>13</height> <height>181</height>
</rect> </rect>
</property> </property>
<property name="toolTip"> <property name="focusPolicy">
<string>FlightMode channel value is shown here for reference. <enum>Qt::StrongFocus</enum>
Whole range [0..100] in spit into number of intervals - one per
FlightMode (switch position).
Hint: make sure that you have the FlightMode channel neutral
value defined.</string>
</property> </property>
<property name="text"> <property name="toolTip">
<string>0</string> <string>This slider shows the real value of your remote channel.</string>
</property>
<property name="minimum">
<number>0</number>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="singleStep">
<number>1</number>
</property>
<property name="pageStep">
<number>10</number>
</property>
<property name="value">
<number>0</number>
</property>
<property name="sliderPosition">
<number>0</number>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="invertedAppearance">
<bool>true</bool>
</property>
<property name="invertedControls">
<bool>false</bool>
</property>
<property name="tickPosition">
<enum>QSlider::NoTicks</enum>
</property>
<property name="tickInterval">
<number>1</number>
</property> </property>
</widget> </widget>
</widget> </widget>