1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-30 15:52:12 +01:00

Merge branch 'MikeL_MixerCurve' of ssh://git.openpilot.org/OpenPilot into pt/CC3D_Release

Conflicts:
	ground/openpilotgcs/src/plugins/config/airframe.ui
	ground/openpilotgcs/src/plugins/config/config_cc_hw_widget.cpp
	ground/openpilotgcs/src/plugins/uploader/runningdevicewidget.cpp
This commit is contained in:
PT_Dreamer 2012-07-24 16:02:07 +01:00
commit 76f45b5218
32 changed files with 4587 additions and 4110 deletions

View File

@ -6,17 +6,14 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>839</width> <width>939</width>
<height>1007</height> <height>657</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_18"> <layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>12</number>
</property>
<item> <item>
<widget class="QTabWidget" name="tabWidget"> <widget class="QTabWidget" name="tabWidget">
<property name="currentIndex"> <property name="currentIndex">
@ -26,92 +23,10 @@
<attribute name="title"> <attribute name="title">
<string>Mixer Settings</string> <string>Mixer Settings</string>
</attribute> </attribute>
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="0"> <layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,0,0">
<property name="margin"> <property name="margin">
<number>0</number> <number>5</number>
</property> </property>
<item>
<widget class="QScrollArea" name="scrollArea">
<property name="palette">
<palette>
<active>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="0">
<red>232</red>
<green>232</green>
<blue>232</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="0">
<red>232</red>
<green>232</green>
<blue>232</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="0">
<red>232</red>
<green>232</green>
<blue>232</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="0">
<red>232</red>
<green>232</green>
<blue>232</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>809</width>
<height>874</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_12">
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
@ -141,7 +56,7 @@
</property> </property>
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>20</width> <width>40</width>
<height>20</height> <height>20</height>
</size> </size>
</property> </property>
@ -159,7 +74,7 @@
<item> <item>
<widget class="QStackedWidget" name="airframesWidget"> <widget class="QStackedWidget" name="airframesWidget">
<property name="currentIndex"> <property name="currentIndex">
<number>1</number> <number>0</number>
</property> </property>
<widget class="QWidget" name="fixedWing"> <widget class="QWidget" name="fixedWing">
<property name="enabled"> <property name="enabled">
@ -202,7 +117,7 @@
</property> </property>
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>20</width> <width>40</width>
<height>20</height> <height>20</height>
</size> </size>
</property> </property>
@ -537,7 +452,7 @@ margin:1px;</string>
</property> </property>
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>20</width> <width>40</width>
<height>20</height> <height>20</height>
</size> </size>
</property> </property>
@ -556,39 +471,23 @@ margin:1px;</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_16"> <layout class="QVBoxLayout" name="verticalLayout_16">
<item> <item>
<spacer name="verticalSpacer_6"> <widget class="MixerCurve" name="fixedWingThrottle" native="true">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="MixerCurveWidget" name="fixedWingThrottle" native="true">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch> <horstretch>1</horstretch>
<verstretch>0</verstretch> <verstretch>1</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>100</width> <width>0</width>
<height>100</height> <height>0</height>
</size> </size>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>200</width> <width>500</width>
<height>200</height> <height>500</height>
</size> </size>
</property> </property>
<property name="sizeIncrement"> <property name="sizeIncrement">
@ -597,26 +496,12 @@ margin:1px;</string>
<height>10</height> <height>10</height>
</size> </size>
</property> </property>
</widget> <property name="baseSize">
</item>
<item>
<widget class="QPushButton" name="fwThrottleReset">
<property name="maximumSize">
<size> <size>
<width>200</width> <width>300</width>
<height>16777215</height> <height>350</height>
</size> </size>
</property> </property>
<property name="text">
<string>Reset</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="fwThrottleCurveItemValue">
<property name="text">
<string>Val: 0.00</string>
</property>
</widget> </widget>
</item> </item>
</layout> </layout>
@ -676,7 +561,7 @@ margin:1px;</string>
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout_8" stretch="0,0,0"> <layout class="QVBoxLayout" name="verticalLayout_8" stretch="0,0,0">
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_7" stretch="0,0,0"> <layout class="QHBoxLayout" name="horizontalLayout_7" stretch="0,0">
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout_24"> <layout class="QVBoxLayout" name="verticalLayout_24">
<item> <item>
@ -706,12 +591,9 @@ margin:1px;</string>
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<property name="sizeType">
<enum>QSizePolicy::MinimumExpanding</enum>
</property>
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>20</width> <width>40</width>
<height>20</height> <height>20</height>
</size> </size>
</property> </property>
@ -955,8 +837,8 @@ margin:1px;</string>
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>80</width> <width>110</width>
<height>80</height> <height>110</height>
</size> </size>
</property> </property>
<property name="styleSheet"> <property name="styleSheet">
@ -974,52 +856,14 @@ margin:1px;</string>
</item> </item>
</layout> </layout>
</item> </item>
<item>
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::MinimumExpanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item> <item>
<widget class="QGroupBox" name="groupBox_6"> <widget class="QGroupBox" name="groupBox_6">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title"> <property name="title">
<string>Throtte Curve</string> <string>Throttle Curve</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_9"> <layout class="QVBoxLayout" name="verticalLayout_9">
<item> <item>
<spacer name="verticalSpacer_7"> <widget class="MixerCurve" name="multiThrottleCurve" native="true">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="MixerCurveWidget" name="multiThrottleCurve" native="true">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -1028,8 +872,20 @@ margin:1px;</string>
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>80</width> <width>0</width>
<height>80</height> <height>0</height>
</size>
</property>
<property name="sizeIncrement">
<size>
<width>10</width>
<height>10</height>
</size>
</property>
<property name="baseSize">
<size>
<width>300</width>
<height>350</height>
</size> </size>
</property> </property>
<property name="styleSheet"> <property name="styleSheet">
@ -1037,32 +893,6 @@ margin:1px;</string>
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QPushButton" name="mrThrottleCurveReset">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>200</width>
<height>16777215</height>
</size>
</property>
<property name="text">
<string>Reset</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="mrThrottleCurveItemValue">
<property name="text">
<string>Val: 0.00</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>
@ -1415,12 +1245,9 @@ margin:1px;</string>
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<property name="sizeType">
<enum>QSizePolicy::MinimumExpanding</enum>
</property>
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>20</width> <width>40</width>
<height>20</height> <height>20</height>
</size> </size>
</property> </property>
@ -1809,19 +1636,6 @@ margin:1px;</string>
</layout> </layout>
</widget> </widget>
</item> </item>
<item>
<spacer name="horizontalSpacer_24">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item> <item>
<widget class="QGroupBox" name="gvThrottleCurve1GroupBox"> <widget class="QGroupBox" name="gvThrottleCurve1GroupBox">
<property name="sizePolicy"> <property name="sizePolicy">
@ -1835,7 +1649,7 @@ margin:1px;</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_36"> <layout class="QVBoxLayout" name="verticalLayout_36">
<item> <item>
<widget class="MixerCurveWidget" name="groundVehicleThrottle1" native="true"> <widget class="MixerCurve" name="groundVehicleThrottle1" native="true">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -1844,14 +1658,14 @@ margin:1px;</string>
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>100</width> <width>0</width>
<height>100</height> <height>0</height>
</size> </size>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>200</width> <width>500</width>
<height>200</height> <height>500</height>
</size> </size>
</property> </property>
<property name="sizeIncrement"> <property name="sizeIncrement">
@ -1860,26 +1674,12 @@ margin:1px;</string>
<height>10</height> <height>10</height>
</size> </size>
</property> </property>
</widget> <property name="baseSize">
</item>
<item>
<widget class="QPushButton" name="gvThrottleCurve1Reset">
<property name="maximumSize">
<size> <size>
<width>200</width> <width>300</width>
<height>16777215</height> <height>350</height>
</size> </size>
</property> </property>
<property name="text">
<string>Reset</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="gvThrottleCurve1ItemValue">
<property name="text">
<string>Val: 0.00</string>
</property>
</widget> </widget>
</item> </item>
</layout> </layout>
@ -1887,12 +1687,18 @@ margin:1px;</string>
</item> </item>
<item> <item>
<widget class="QGroupBox" name="gvThrottleCurve2GroupBox"> <widget class="QGroupBox" name="gvThrottleCurve2GroupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title"> <property name="title">
<string>Rear throttle curve</string> <string>Rear throttle curve</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_37"> <layout class="QVBoxLayout" name="verticalLayout_37">
<item> <item>
<widget class="MixerCurveWidget" name="groundVehicleThrottle2" native="true"> <widget class="MixerCurve" name="groundVehicleThrottle2" native="true">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -1901,29 +1707,27 @@ margin:1px;</string>
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>100</width> <width>0</width>
<height>100</height> <height>0</height>
</size> </size>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>200</width> <width>500</width>
<height>200</height> <height>500</height>
</size> </size>
</property> </property>
</widget> <property name="sizeIncrement">
</item> <size>
<item> <width>10</width>
<widget class="QPushButton" name="gvThrottleCurve2Reset"> <height>10</height>
<property name="text"> </size>
<string>Reset</string>
</property> </property>
</widget> <property name="baseSize">
</item> <size>
<item> <width>300</width>
<widget class="QLabel" name="gvThrottleCurve2ItemValue"> <height>350</height>
<property name="text"> </size>
<string>Val: 0.00</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -1987,74 +1791,53 @@ margin:1px;</string>
<layout class="QHBoxLayout" name="horizontalLayout_14"> <layout class="QHBoxLayout" name="horizontalLayout_14">
<item> <item>
<widget class="QGroupBox" name="groupBox_4"> <widget class="QGroupBox" name="groupBox_4">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title"> <property name="title">
<string>Curve 1</string> <string>Curve 1</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_7"> <layout class="QVBoxLayout" name="verticalLayout_7">
<item> <item>
<widget class="MixerCurveWidget" name="customThrottle1Curve" native="true"> <widget class="MixerCurve" name="customThrottle1Curve" native="true">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch> <horstretch>1</horstretch>
<verstretch>0</verstretch> <verstretch>1</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>100</width> <width>50</width>
<height>100</height> <height>50</height>
</size> </size>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>200</width> <width>1000</width>
<height>200</height> <height>1000</height>
</size> </size>
</property> </property>
</widget> <property name="sizeIncrement">
</item>
<item>
<widget class="QPushButton" name="customReset1">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size> <size>
<width>0</width> <width>10</width>
<height>0</height> <height>10</height>
</size> </size>
</property> </property>
<property name="text"> <property name="baseSize">
<string>Reset</string> <size>
</property> <width>300</width>
</widget> <height>350</height>
</item> </size>
<item>
<widget class="QLabel" name="customThrottleCurve1Value">
<property name="text">
<string>Val: 0.00</string>
</property> </property>
</widget> </widget>
</item> </item>
</layout> </layout>
</widget> </widget>
</item> </item>
<item>
<spacer name="horizontalSpacer_9">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item> <item>
<widget class="QGroupBox" name="groupBox_5"> <widget class="QGroupBox" name="groupBox_5">
<property name="title"> <property name="title">
@ -2062,38 +1845,36 @@ margin:1px;</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout_17"> <layout class="QVBoxLayout" name="verticalLayout_17">
<item> <item>
<widget class="MixerCurveWidget" name="customThrottle2Curve" native="true"> <widget class="MixerCurve" name="customThrottle2Curve" native="true">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch> <horstretch>1</horstretch>
<verstretch>0</verstretch> <verstretch>1</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>100</width> <width>50</width>
<height>100</height> <height>50</height>
</size> </size>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>200</width> <width>1000</width>
<height>200</height> <height>1000</height>
</size> </size>
</property> </property>
</widget> <property name="sizeIncrement">
</item> <size>
<item> <width>10</width>
<widget class="QPushButton" name="customReset2"> <height>10</height>
<property name="text"> </size>
<string>Reset</string>
</property> </property>
</widget> <property name="baseSize">
</item> <size>
<item> <width>300</width>
<widget class="QLabel" name="customThrottleCurve2Value"> <height>350</height>
<property name="text"> </size>
<string>Val: 0.00</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -2189,6 +1970,16 @@ margin:1px;</string>
<string>Ch 8</string> <string>Ch 8</string>
</property> </property>
</column> </column>
<column>
<property name="text">
<string>Ch 9</string>
</property>
</column>
<column>
<property name="text">
<string>Ch 10</string>
</property>
</column>
<item row="0" column="0"> <item row="0" column="0">
<property name="text"> <property name="text">
<string>-</string> <string>-</string>
@ -2253,6 +2044,22 @@ margin:1px;</string>
<set>AlignHCenter|AlignVCenter|AlignCenter</set> <set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property> </property>
</item> </item>
<item row="0" column="8">
<property name="text">
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="0" column="9">
<property name="text">
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="1" column="0"> <item row="1" column="0">
<property name="text"> <property name="text">
<string>-</string> <string>-</string>
@ -2317,6 +2124,22 @@ margin:1px;</string>
<set>AlignHCenter|AlignVCenter|AlignCenter</set> <set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property> </property>
</item> </item>
<item row="1" column="8">
<property name="text">
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="1" column="9">
<property name="text">
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="2" column="0"> <item row="2" column="0">
<property name="text"> <property name="text">
<string>-</string> <string>-</string>
@ -2381,6 +2204,22 @@ margin:1px;</string>
<set>AlignHCenter|AlignVCenter|AlignCenter</set> <set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property> </property>
</item> </item>
<item row="2" column="8">
<property name="text">
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="2" column="9">
<property name="text">
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="3" column="0"> <item row="3" column="0">
<property name="text"> <property name="text">
<string>-</string> <string>-</string>
@ -2445,6 +2284,22 @@ margin:1px;</string>
<set>AlignHCenter|AlignVCenter|AlignCenter</set> <set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property> </property>
</item> </item>
<item row="3" column="8">
<property name="text">
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="3" column="9">
<property name="text">
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="4" column="0"> <item row="4" column="0">
<property name="text"> <property name="text">
<string>-</string> <string>-</string>
@ -2509,6 +2364,22 @@ margin:1px;</string>
<set>AlignHCenter|AlignVCenter|AlignCenter</set> <set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property> </property>
</item> </item>
<item row="4" column="8">
<property name="text">
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="4" column="9">
<property name="text">
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="5" column="0"> <item row="5" column="0">
<property name="text"> <property name="text">
<string>-</string> <string>-</string>
@ -2573,6 +2444,22 @@ margin:1px;</string>
<set>AlignHCenter|AlignVCenter|AlignCenter</set> <set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property> </property>
</item> </item>
<item row="5" column="8">
<property name="text">
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="5" column="9">
<property name="text">
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
</widget> </widget>
</item> </item>
</layout> </layout>
@ -2583,99 +2470,10 @@ margin:1px;</string>
</item> </item>
</layout> </layout>
</widget> </widget>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab"> <widget class="QWidget" name="tab">
<attribute name="title"> <attribute name="title">
<string>Advanced Settings</string> <string>Advanced Settings</string>
</attribute> </attribute>
<layout class="QVBoxLayout" name="verticalLayout_26">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QScrollArea" name="scrollArea_2">
<property name="palette">
<palette>
<active>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="0">
<red>232</red>
<green>232</green>
<blue>232</blue>
</color>
</brush>
</colorrole>
</active>
<inactive>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="255">
<red>255</red>
<green>255</green>
<blue>255</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="0">
<red>232</red>
<green>232</green>
<blue>232</blue>
</color>
</brush>
</colorrole>
</inactive>
<disabled>
<colorrole role="Base">
<brush brushstyle="SolidPattern">
<color alpha="0">
<red>232</red>
<green>232</green>
<blue>232</blue>
</color>
</brush>
</colorrole>
<colorrole role="Window">
<brush brushstyle="SolidPattern">
<color alpha="0">
<red>232</red>
<green>232</green>
<blue>232</blue>
</color>
</brush>
</colorrole>
</disabled>
</palette>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents_2">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>809</width>
<height>874</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_25"> <layout class="QVBoxLayout" name="verticalLayout_25">
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout_11" stretch="0,1,0,0,0"> <layout class="QVBoxLayout" name="verticalLayout_11" stretch="0,1,0,0,0">
@ -2973,14 +2771,14 @@ p, li { white-space: pre-wrap; }
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt; <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt; &lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; } p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Lucida Grande'; font-size:13pt; font-weight:400; font-style:normal;&quot;&gt; &lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;table border=&quot;0&quot; style=&quot;-qt-table-type: root; margin-top:4px; margin-bottom:4px; margin-left:4px; margin-right:4px;&quot;&gt; &lt;table border=&quot;0&quot; style=&quot;-qt-table-type: root; margin-top:4px; margin-bottom:4px; margin-left:4px; margin-right:4px;&quot;&gt;
&lt;tr&gt; &lt;tr&gt;
&lt;td style=&quot;border: none;&quot;&gt; &lt;td style=&quot;border: none;&quot;&gt;
&lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Ubuntu'; font-size:14pt; font-weight:600; color:#ff0000;&quot;&gt;SETTING UP FEED FORWARD REQUIRES CAUTION&lt;/span&gt;&lt;/p&gt; &lt;p align=&quot;center&quot; style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Ubuntu'; font-size:14pt; font-weight:600; color:#ff0000;&quot;&gt;SETTING UP FEED FORWARD IS DANGEROUS&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu'; font-size:11pt;&quot;&gt;&lt;br /&gt;&lt;/p&gt; &lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu'; font-size:11pt;&quot;&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Beware: Feed Forward Tuning will launch all engines around mid-throttle, you have been warned!&lt;/p&gt; &lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Lucida Grande'; font-size:13pt;&quot;&gt;Beware: Feed Forward Tuning will launch all engines around mid-throttle, you have been warned!&lt;/span&gt;&lt;/p&gt;
&lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Remove your props initially, and for fine-tuning, make sure your airframe is safely held in place. Wear glasses and protect your face and body.&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/body&gt;&lt;/html&gt;</string> &lt;p style=&quot; margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Lucida Grande'; font-size:13pt;&quot;&gt;Remove your props initially, and for fine-tuning, make sure your airframe is safely held in place. Wear glasses and protect your face and body.&lt;/span&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
</widget> </widget>
</item> </item>
@ -3003,44 +2801,16 @@ p, li { white-space: pre-wrap; }
</widget> </widget>
</widget> </widget>
</item> </item>
</layout>
</widget>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_8">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>75</height>
</size>
</property>
<property name="title">
<string/>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="spacing">
<number>4</number>
</property>
<item> <item>
<spacer name="horizontalSpacer"> <spacer name="horizontalSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<property name="sizeType">
<enum>QSizePolicy::MinimumExpanding</enum>
</property>
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>20</width> <width>40</width>
<height>20</height> <height>20</height>
</size> </size>
</property> </property>
@ -3080,18 +2850,9 @@ p, li { white-space: pre-wrap; }
</item> </item>
<item> <item>
<widget class="QPushButton" name="saveAircraftToRAM"> <widget class="QPushButton" name="saveAircraftToRAM">
<property name="minimumSize">
<size>
<width>60</width>
<height>28</height>
</size>
</property>
<property name="toolTip"> <property name="toolTip">
<string>Send to board, but don't save permanently (flash or SD).</string> <string>Send to board, but don't save permanently (flash or SD).</string>
</property> </property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text"> <property name="text">
<string>Apply</string> <string>Apply</string>
</property> </property>
@ -3099,18 +2860,9 @@ p, li { white-space: pre-wrap; }
</item> </item>
<item> <item>
<widget class="QPushButton" name="saveAircraftToSD"> <widget class="QPushButton" name="saveAircraftToSD">
<property name="minimumSize">
<size>
<width>60</width>
<height>28</height>
</size>
</property>
<property name="toolTip"> <property name="toolTip">
<string>Applies and Saves all settings to flash or SD depending on board.</string> <string>Applies and Saves all settings to flash or SD depending on board.</string>
</property> </property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="text"> <property name="text">
<string>Save</string> <string>Save</string>
</property> </property>
@ -3120,22 +2872,19 @@ p, li { white-space: pre-wrap; }
</item> </item>
</layout> </layout>
</widget> </widget>
</item>
</layout>
</widget>
<customwidgets> <customwidgets>
<customwidget>
<class>MixerCurveWidget</class>
<extends>QWidget</extends>
<header>mixercurvewidget.h</header>
<container>1</container>
</customwidget>
<customwidget> <customwidget>
<class>ConfigCcpmWidget</class> <class>ConfigCcpmWidget</class>
<extends>QWidget</extends> <extends>QWidget</extends>
<header>cfg_vehicletypes/configccpmwidget.h</header> <header>cfg_vehicletypes/configccpmwidget.h</header>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
<customwidget>
<class>MixerCurve</class>
<extends>QWidget</extends>
<header location="global">mixercurve.h</header>
<container>1</container>
</customwidget>
</customwidgets> </customwidgets>
<resources> <resources>
<include location="../coreplugin/core.qrc"/> <include location="../coreplugin/core.qrc"/>

View File

@ -2770,537 +2770,13 @@ margin:1px;</string>
<number>3</number> <number>3</number>
</property> </property>
<item row="0" column="0"> <item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_5"> <layout class="QHBoxLayout" name="horizontalLayout_6"/>
<item>
<widget class="QComboBox" name="CurveType">
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="toolTip">
<string>Select aircraft type here</string>
</property>
<item>
<property name="text">
<string>Linear</string>
</property>
</item>
<item>
<property name="text">
<string>Flat</string>
</property>
</item>
<item>
<property name="text">
<string>Step</string>
</property>
</item>
<item>
<property name="text">
<string>Exp</string>
</property>
</item>
<item>
<property name="text">
<string>Log</string>
</property>
</item>
<item>
<property name="text">
<string>Custom</string>
</property>
</item>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Number of points</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="NumCurvePoints">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum">
<number>2</number>
</property>
<property name="maximum">
<number>10</number>
</property>
<property name="value">
<number>5</number>
</property>
</widget>
</item>
</layout>
</item> </item>
<item row="1" column="0"> <item row="1" column="0">
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="CurveLabel1">
<property name="styleSheet">
<string notr="true">background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255));
color: rgb(255, 255, 255);
border-radius: 5;
font: bold 12px;
margin:1px;</string>
</property>
<property name="text">
<string>Min</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="CurveLabel2">
<property name="styleSheet">
<string notr="true">background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255));
color: rgb(255, 255, 255);
border-radius: 5;
font: bold 12px;
margin:1px;</string>
</property>
<property name="text">
<string>Max</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="CurveLabel3">
<property name="styleSheet">
<string notr="true">background-color: qlineargradient(spread:reflect, x1:0.507, y1:0, x2:0.507, y2:0.772, stop:0.208955 rgba(74, 74, 74, 255), stop:0.78607 rgba(36, 36, 36, 255));
color: rgb(255, 255, 255);
border-radius: 5;
font: bold 12px;
margin:1px;</string>
</property>
<property name="text">
<string>Step point</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QDoubleSpinBox" name="CurveValue1">
<property name="decimals">
<number>1</number>
</property>
<property name="maximum">
<double>10.000000000000000</double>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QDoubleSpinBox" name="CurveValue2">
<property name="decimals">
<number>1</number>
</property>
<property name="maximum">
<double>10.000000000000000</double>
</property>
<property name="value">
<double>1.000000000000000</double>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QDoubleSpinBox" name="CurveValue3">
<property name="decimals">
<number>1</number>
</property>
<property name="maximum">
<double>100.000000000000000</double>
</property>
<property name="value">
<double>50.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QComboBox" name="CurveToGenerate">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
<property name="toolTip">
<string>Select aircraft type here</string>
</property>
<item>
<property name="text">
<string>Throttle</string>
</property>
</item>
<item>
<property name="text">
<string>Pitch</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QPushButton" name="ccpmGenerateCurve">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Generate curves based on settings</string>
</property>
<property name="text">
<string>&lt;-- Generate Curve</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="3" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_3"> <layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="spacing"> <property name="spacing">
<number>3</number> <number>3</number>
</property> </property>
<item>
<widget class="QTableWidget" name="CurveSettings">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>250</width>
<height>200</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>250</width>
<height>273</height>
</size>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAsNeeded</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAsNeeded</enum>
</property>
<property name="autoScroll">
<bool>true</bool>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="cornerButtonEnabled">
<bool>true</bool>
</property>
<attribute name="horizontalHeaderCascadingSectionResizes">
<bool>true</bool>
</attribute>
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
</attribute>
<attribute name="verticalHeaderDefaultSectionSize">
<number>25</number>
</attribute>
<attribute name="verticalHeaderMinimumSectionSize">
<number>25</number>
</attribute>
<row>
<property name="text">
<string>0%</string>
</property>
</row>
<row>
<property name="text">
<string>25%</string>
</property>
</row>
<row>
<property name="text">
<string>50%</string>
</property>
</row>
<row>
<property name="text">
<string>75%</string>
</property>
</row>
<row>
<property name="text">
<string>100%</string>
</property>
</row>
<row>
<property name="text">
<string>none</string>
</property>
</row>
<row>
<property name="text">
<string>none</string>
</property>
</row>
<row>
<property name="text">
<string>none</string>
</property>
</row>
<row>
<property name="text">
<string>none</string>
</property>
</row>
<row>
<property name="text">
<string>none</string>
</property>
</row>
<column>
<property name="text">
<string>Throttle Curve</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</column>
<column>
<property name="text">
<string>Blade Pitch Curve</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</column>
<item row="0" column="0">
<property name="text">
<string>0.000</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="0" column="1">
<property name="text">
<string>0.000</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="1" column="0">
<property name="text">
<string>0.250</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="1" column="1">
<property name="text">
<string>0.250</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="2" column="0">
<property name="text">
<string>0.500</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="2" column="1">
<property name="text">
<string>0.500</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="3" column="0">
<property name="text">
<string>0.750</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="3" column="1">
<property name="text">
<string>0.750</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="4" column="0">
<property name="text">
<string>1.000</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="4" column="1">
<property name="text">
<string>1.000</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="5" column="0">
<property name="text">
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="5" column="1">
<property name="text">
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="6" column="0">
<property name="text">
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="6" column="1">
<property name="text">
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="7" column="0">
<property name="text">
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="7" column="1">
<property name="text">
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="8" column="0">
<property name="text">
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="8" column="1">
<property name="text">
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="9" column="0">
<property name="text">
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
<item row="9" column="1">
<property name="text">
<string>-</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
</item>
</widget>
</item>
<item> <item>
<widget class="QGroupBox" name="ThrottleCurveBox"> <widget class="QGroupBox" name="ThrottleCurveBox">
<property name="sizePolicy"> <property name="sizePolicy">
@ -3331,7 +2807,7 @@ margin:1px;</string>
<enum>Qt::LeftToRight</enum> <enum>Qt::LeftToRight</enum>
</property> </property>
<property name="title"> <property name="title">
<string>Throttle Curve</string> <string/>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set> <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
@ -3347,7 +2823,7 @@ margin:1px;</string>
<number>0</number> <number>0</number>
</property> </property>
<item row="0" column="0"> <item row="0" column="0">
<widget class="MixerCurveWidget" name="ThrottleCurve" native="true"> <widget class="MixerCurve" name="ThrottleCurve" native="true">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>1</horstretch> <horstretch>1</horstretch>
@ -3410,7 +2886,7 @@ margin:1px;</string>
</size> </size>
</property> </property>
<property name="title"> <property name="title">
<string>Pitch Curve</string> <string/>
</property> </property>
<layout class="QGridLayout" name="gridLayout_5"> <layout class="QGridLayout" name="gridLayout_5">
<property name="margin"> <property name="margin">
@ -3420,7 +2896,7 @@ margin:1px;</string>
<number>0</number> <number>0</number>
</property> </property>
<item row="0" column="0"> <item row="0" column="0">
<widget class="MixerCurveWidget" name="PitchCurve" native="true"> <widget class="MixerCurve" name="PitchCurve" native="true">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Expanding"> <sizepolicy hsizetype="Fixed" vsizetype="Expanding">
<horstretch>1</horstretch> <horstretch>1</horstretch>
@ -3458,7 +2934,7 @@ margin:1px;</string>
</item> </item>
</layout> </layout>
</item> </item>
<item row="4" column="0"> <item row="2" column="0">
<spacer name="verticalSpacer_2"> <spacer name="verticalSpacer_2">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
@ -3910,9 +3386,9 @@ margin:1px;</string>
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget> <customwidget>
<class>MixerCurveWidget</class> <class>MixerCurve</class>
<extends>QWidget</extends> <extends>QWidget</extends>
<header>mixercurvewidget.h</header> <header location="global">mixercurve.h</header>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
</customwidgets> </customwidgets>
@ -3945,14 +3421,6 @@ margin:1px;</string>
<tabstop>SwashLvlPositionSlider</tabstop> <tabstop>SwashLvlPositionSlider</tabstop>
<tabstop>SwashLvlPositionSpinBox</tabstop> <tabstop>SwashLvlPositionSpinBox</tabstop>
<tabstop>SwashLvlSwashplateImage</tabstop> <tabstop>SwashLvlSwashplateImage</tabstop>
<tabstop>CurveType</tabstop>
<tabstop>NumCurvePoints</tabstop>
<tabstop>CurveValue1</tabstop>
<tabstop>CurveValue2</tabstop>
<tabstop>CurveValue3</tabstop>
<tabstop>CurveToGenerate</tabstop>
<tabstop>ccpmGenerateCurve</tabstop>
<tabstop>CurveSettings</tabstop>
<tabstop>ccpmAdvancedSettingsTable</tabstop> <tabstop>ccpmAdvancedSettingsTable</tabstop>
</tabstops> </tabstops>
<resources/> <resources/>

View File

@ -133,8 +133,12 @@ ConfigCcpmWidget::ConfigCcpmWidget(QWidget *parent) : VehicleConfig(parent)
} }
//initialize our two mixer curves //initialize our two mixer curves
// mixercurve defaults to mixercurve_throttle
m_ccpm->ThrottleCurve->initLinearCurve(5, 1.0, 0.0);
// tell mixercurve this is a pitch curve
m_ccpm->PitchCurve->setMixerType(MixerCurve::MIXERCURVE_PITCH);
m_ccpm->PitchCurve->initLinearCurve(5, 1.0, -1.0); m_ccpm->PitchCurve->initLinearCurve(5, 1.0, -1.0);
m_ccpm->ThrottleCurve->initLinearCurve(5, 1.0);
//initialize channel names //initialize channel names
m_ccpm->ccpmEngineChannel->addItems(channelNames); m_ccpm->ccpmEngineChannel->addItems(channelNames);
@ -158,22 +162,10 @@ ConfigCcpmWidget::ConfigCcpmWidget(QWidget *parent) : VehicleConfig(parent)
m_ccpm->ccpmType->addItems(Types); m_ccpm->ccpmType->addItems(Types);
m_ccpm->ccpmType->setCurrentIndex(m_ccpm->ccpmType->count() - 1); m_ccpm->ccpmType->setCurrentIndex(m_ccpm->ccpmType->count() - 1);
UpdateCurveSettings();
//disable changing number of points in curves until UAVObjects have more than 5
m_ccpm->NumCurvePoints->setEnabled(0);
refreshWidgetsValues(QString("HeliCP")); refreshWidgetsValues(QString("HeliCP"));
UpdateType(); UpdateType();
//connect(m_ccpm->saveccpmToSD, SIGNAL(clicked()), this, SLOT(saveccpmUpdate()));
//connect(m_ccpm->saveccpmToRAM, SIGNAL(clicked()), this, SLOT(sendccpmUpdate()));
//connect(m_ccpm->getccpmCurrent, SIGNAL(clicked()), this, SLOT(requestccpmUpdate()));
connect(m_ccpm->ccpmGenerateCurve, SIGNAL(clicked()), this, SLOT(GenerateCurve()));
connect(m_ccpm->NumCurvePoints, SIGNAL(valueChanged(int)), this, SLOT(UpdateCurveSettings()));
connect(m_ccpm->CurveToGenerate, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateCurveSettings()));
connect(m_ccpm->CurveType, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateCurveSettings()));
connect(m_ccpm->ccpmAngleW, SIGNAL(valueChanged(double)), this, SLOT(ccpmSwashplateUpdate())); connect(m_ccpm->ccpmAngleW, SIGNAL(valueChanged(double)), this, SLOT(ccpmSwashplateUpdate()));
connect(m_ccpm->ccpmAngleX, SIGNAL(valueChanged(double)), this, SLOT(ccpmSwashplateUpdate())); connect(m_ccpm->ccpmAngleX, SIGNAL(valueChanged(double)), this, SLOT(ccpmSwashplateUpdate()));
connect(m_ccpm->ccpmAngleY, SIGNAL(valueChanged(double)), this, SLOT(ccpmSwashplateUpdate())); connect(m_ccpm->ccpmAngleY, SIGNAL(valueChanged(double)), this, SLOT(ccpmSwashplateUpdate()));
@ -191,12 +183,8 @@ ConfigCcpmWidget::ConfigCcpmWidget(QWidget *parent) : VehicleConfig(parent)
connect(m_ccpm->ccpmCollectivespinBox, SIGNAL(valueChanged(int)), this, SLOT(UpdateMixer())); connect(m_ccpm->ccpmCollectivespinBox, SIGNAL(valueChanged(int)), this, SLOT(UpdateMixer()));
connect(m_ccpm->ccpmType, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateType())); connect(m_ccpm->ccpmType, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateType()));
connect(m_ccpm->ccpmSingleServo, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateType())); connect(m_ccpm->ccpmSingleServo, SIGNAL(currentIndexChanged(int)), this, SLOT(UpdateType()));
connect(m_ccpm->CurveSettings, SIGNAL(cellChanged (int, int)), this, SLOT(UpdateCurveWidgets()));
connect(m_ccpm->TabObject, SIGNAL(currentChanged ( QWidget * )), this, SLOT(UpdateType())); connect(m_ccpm->TabObject, SIGNAL(currentChanged ( QWidget * )), this, SLOT(UpdateType()));
connect(m_ccpm->PitchCurve, SIGNAL(curveUpdated(QList<double>,double)), this, SLOT(updatePitchCurveValue(QList<double>,double)));
connect(m_ccpm->ThrottleCurve, SIGNAL(curveUpdated(QList<double>,double)), this, SLOT(updateThrottleCurveValue(QList<double>,double)));
connect(m_ccpm->SwashLvlStartButton, SIGNAL(clicked()), this, SLOT(SwashLvlStartButtonPressed())); connect(m_ccpm->SwashLvlStartButton, SIGNAL(clicked()), this, SLOT(SwashLvlStartButtonPressed()));
connect(m_ccpm->SwashLvlNextButton, SIGNAL(clicked()), this, SLOT(SwashLvlNextButtonPressed())); connect(m_ccpm->SwashLvlNextButton, SIGNAL(clicked()), this, SLOT(SwashLvlNextButtonPressed()));
connect(m_ccpm->SwashLvlCancelButton, SIGNAL(clicked()), this, SLOT(SwashLvlCancelButtonPressed())); connect(m_ccpm->SwashLvlCancelButton, SIGNAL(clicked()), this, SLOT(SwashLvlCancelButtonPressed()));
@ -332,8 +320,6 @@ void ConfigCcpmWidget::UpdateType()
AdjustmentAngle=SingleServoIndex*90; AdjustmentAngle=SingleServoIndex*90;
m_ccpm->CurveToGenerate->setEnabled(1);
m_ccpm->CurveSettings->setColumnHidden(1,0);
m_ccpm->PitchCurve->setVisible(1); m_ccpm->PitchCurve->setVisible(1);
//m_ccpm->customThrottleCurve2Value->setVisible(1); //m_ccpm->customThrottleCurve2Value->setVisible(1);
//m_ccpm->label_41->setVisible(1); //m_ccpm->label_41->setVisible(1);
@ -425,9 +411,6 @@ void ConfigCcpmWidget::UpdateType()
m_ccpm->ccpmCollectiveSlider->setEnabled(0); m_ccpm->ccpmCollectiveSlider->setEnabled(0);
m_ccpm->ccpmCollectivespinBox->setValue(0); m_ccpm->ccpmCollectivespinBox->setValue(0);
m_ccpm->ccpmCollectiveSlider->setValue(0); m_ccpm->ccpmCollectiveSlider->setValue(0);
m_ccpm->CurveToGenerate->setCurrentIndex(0);
m_ccpm->CurveToGenerate->setEnabled(0);
m_ccpm->CurveSettings->setColumnHidden(1,1);
m_ccpm->PitchCurve->setVisible(0); m_ccpm->PitchCurve->setVisible(0);
//m_ccpm->customThrottleCurve2Value->setVisible(0); //m_ccpm->customThrottleCurve2Value->setVisible(0);
//m_ccpm->label_41->setVisible(0); //m_ccpm->label_41->setVisible(0);
@ -469,271 +452,7 @@ void ConfigCcpmWidget::UpdateType()
} }
void ConfigCcpmWidget::UpdateCurveWidgets()
{
int NumCurvePoints,i,Changed;
QList<double> curveValues;
QList<double> OldCurveValues;
double ThisValue;
//get the user settings
NumCurvePoints=m_ccpm->NumCurvePoints->value();
curveValues.clear();
Changed=0;
OldCurveValues=m_ccpm->ThrottleCurve->getCurve();
for (i=0; i<NumCurvePoints; i++)
{
ThisValue=m_ccpm->CurveSettings->item(i, 0 )->text().toDouble();
curveValues.append(ThisValue);
if (ThisValue!=OldCurveValues.at(i))Changed=1;
}
// Setup all Throttle1 curves for all types of airframes
if (Changed==1)
m_ccpm->ThrottleCurve->setCurve(&curveValues);
curveValues.clear();
Changed=0;
OldCurveValues=m_ccpm->PitchCurve->getCurve();
for (i=0; i<NumCurvePoints; i++)
{
ThisValue=m_ccpm->CurveSettings->item(i, 1 )->text().toDouble();
curveValues.append(ThisValue);
if (ThisValue!=OldCurveValues.at(i))Changed=1;
}
// Setup all Throttle1 curves for all types of airframes
if (Changed==1)
m_ccpm->PitchCurve->setCurve(&curveValues);
}
void ConfigCcpmWidget::updatePitchCurveValue(QList<double> curveValues0,double Value0)
{
Q_UNUSED(curveValues0);
Q_UNUSED(Value0);
int NumCurvePoints,i;
double CurrentValue;
QList<double> internalCurveValues;
//get the user settings
NumCurvePoints=m_ccpm->NumCurvePoints->value();
internalCurveValues=m_ccpm->PitchCurve->getCurve();
for (i=0; i<internalCurveValues.length(); i++)
{
CurrentValue=m_ccpm->CurveSettings->item(i, 1 )->text().toDouble();
if (CurrentValue!=internalCurveValues[i])
{
m_ccpm->CurveSettings->item(i, 1)->setText(QString().sprintf("%.3f",internalCurveValues.at(i)));
}
}
}
void ConfigCcpmWidget::updateThrottleCurveValue(QList<double> curveValues0,double Value0)
{
Q_UNUSED(curveValues0);
Q_UNUSED(Value0);
int NumCurvePoints,i;
double CurrentValue;
QList<double> internalCurveValues;
//get the user settings
NumCurvePoints=m_ccpm->NumCurvePoints->value();
internalCurveValues=m_ccpm->ThrottleCurve->getCurve();
for (i=0; i<internalCurveValues.length(); i++)
{
CurrentValue=m_ccpm->CurveSettings->item(i, 0 )->text().toDouble();
if (CurrentValue!=internalCurveValues[i])
{
m_ccpm->CurveSettings->item(i, 0)->setText(QString().sprintf("%.3f",internalCurveValues.at(i)));
}
}
}
void ConfigCcpmWidget::UpdateCurveSettings()
{
int NumCurvePoints,i;
double scale;
QString CurveType;
QStringList vertHeaders;
//get the user settings
NumCurvePoints=m_ccpm->NumCurvePoints->value();
CurveType=m_ccpm->CurveType->currentText();
vertHeaders << "-" << "-" << "-" << "-" << "-" << "-" << "-" << "-" << "-" << "-" ;
for (i=0;i<NumCurvePoints;i++)
{
scale =((double)i/(double)(NumCurvePoints-1));
vertHeaders[i] = tr( "%1%" ).arg(100.00*scale, 0, 'f', 1);
}
m_ccpm->CurveSettings->setVerticalHeaderLabels( vertHeaders );
if (m_ccpm->CurveToGenerate->currentIndex()==0)
{
m_ccpm->CurveValue1->setMinimum(0.0);
m_ccpm->CurveValue2->setMinimum(0.0);
m_ccpm->CurveValue3->setMinimum(0.0);
}
else
{
m_ccpm->CurveValue1->setMinimum(-1.0);
m_ccpm->CurveValue2->setMinimum(-1.0);
m_ccpm->CurveValue3->setMinimum(0.0);
}
m_ccpm->CurveValue1->setMaximum(1.0);
m_ccpm->CurveValue2->setMaximum(1.0);
m_ccpm->CurveValue3->setMaximum(100.0);
m_ccpm->CurveValue1->setSingleStep(0.1);
m_ccpm->CurveValue2->setSingleStep(0.1);
m_ccpm->CurveValue3->setSingleStep(1.0);
m_ccpm->CurveValue1->setCorrectionMode(QAbstractSpinBox::CorrectToNearestValue);;
m_ccpm->CurveValue2->setCorrectionMode(QAbstractSpinBox::CorrectToNearestValue);
m_ccpm->CurveValue3->setCorrectionMode(QAbstractSpinBox::CorrectToNearestValue);
//set default visible
m_ccpm->CurveLabel1->setVisible(true);
m_ccpm->CurveValue1->setVisible(true);
m_ccpm->CurveLabel2->setVisible(false);
m_ccpm->CurveValue2->setVisible(false);
m_ccpm->CurveLabel3->setVisible(false);
m_ccpm->CurveValue3->setVisible(false);
m_ccpm->ccpmGenerateCurve->setVisible(true);
m_ccpm->CurveToGenerate->setVisible(true);
if ( CurveType.compare("Flat")==0)
{
m_ccpm->CurveLabel1->setText("Value");
}
if ( CurveType.compare("Linear")==0)
{
m_ccpm->CurveLabel1->setText("Min");
m_ccpm->CurveLabel2->setText("Max");
m_ccpm->CurveLabel2->setVisible(true);
m_ccpm->CurveValue2->setVisible(true);
}
if ( CurveType.compare("Step")==0)
{
m_ccpm->CurveLabel1->setText("Min");
m_ccpm->CurveLabel2->setText("Max");
m_ccpm->CurveLabel2->setVisible(true);
m_ccpm->CurveValue2->setVisible(true);
m_ccpm->CurveLabel3->setText("Step at");
m_ccpm->CurveLabel3->setVisible(true);
m_ccpm->CurveValue3->setVisible(true);
}
if ( CurveType.compare("Exp")==0)
{
m_ccpm->CurveLabel1->setText("Min");
m_ccpm->CurveLabel2->setText("Max");
m_ccpm->CurveLabel2->setVisible(true);
m_ccpm->CurveValue2->setVisible(true);
m_ccpm->CurveLabel3->setText("Strength");
m_ccpm->CurveLabel3->setVisible(true);
m_ccpm->CurveValue3->setVisible(true);
m_ccpm->CurveValue3->setMinimum(1.0);
m_ccpm->CurveValue3->setMaximum(100.0);
m_ccpm->CurveValue3->setSingleStep(1.0);
m_ccpm->CurveValue3->setCorrectionMode(QAbstractSpinBox::CorrectToNearestValue);;
}
if ( CurveType.compare("Log")==0)
{
m_ccpm->CurveLabel1->setText("Min");
m_ccpm->CurveLabel2->setText("Max");
m_ccpm->CurveLabel2->setVisible(true);
m_ccpm->CurveValue2->setVisible(true);
m_ccpm->CurveLabel3->setText("Strength");
m_ccpm->CurveLabel3->setVisible(true);
m_ccpm->CurveValue3->setVisible(true);
m_ccpm->CurveValue3->setMinimum(1.0);
m_ccpm->CurveValue3->setMaximum(100.0);
m_ccpm->CurveValue3->setSingleStep(1.0);
m_ccpm->CurveValue3->setCorrectionMode(QAbstractSpinBox::CorrectToNearestValue);
}
if ( CurveType.compare("Custom")==0)
{
m_ccpm->CurveLabel1->setVisible(false);
m_ccpm->CurveValue1->setVisible(false);
m_ccpm->ccpmGenerateCurve->setVisible(false);
m_ccpm->CurveToGenerate->setVisible(false);
}
UpdateCurveWidgets();
}
void ConfigCcpmWidget::GenerateCurve()
{
int NumCurvePoints,CurveToGenerate,i;
double value1, value2, value3, scale;
QString CurveType;
QTableWidgetItem *item;
double newValue;
//get the user settings
NumCurvePoints=m_ccpm->NumCurvePoints->value();
value1=m_ccpm->CurveValue1->value();
value2=m_ccpm->CurveValue2->value();
value3=m_ccpm->CurveValue3->value();
CurveToGenerate=m_ccpm->CurveToGenerate->currentIndex();
CurveType=m_ccpm->CurveType->currentText();
for (i=0;i<NumCurvePoints;i++)
{
scale =((double)i/(double)(NumCurvePoints-1));
item =m_ccpm->CurveSettings->item(i, CurveToGenerate );
if ( CurveType.compare("Flat")==0)
{
//item->setText( tr( "%1" ).arg( value1 ) );
item->setText(QString().sprintf("%.3f",value1));
}
if ( CurveType.compare("Linear")==0)
{
newValue =value1 +(scale*(value2-value1));
//item->setText( tr( "%1" ).arg(value1 +(scale*(value2-value1))) );
item->setText(QString().sprintf("%.3f",newValue));
}
if ( CurveType.compare("Step")==0)
{
if (scale*100<value3)
{
//item->setText( tr( "%1" ).arg(value1) );
item->setText(QString().sprintf("%.3f",value1));
}
else
{
//item->setText( tr( "%1" ).arg(value2) );
item->setText(QString().sprintf("%.3f",value2));
}
}
if ( CurveType.compare("Exp")==0)
{
newValue =value1 +(((exp(scale*(value3/10))-1))/(exp((value3/10))-1)*(value2-value1));
//item->setText( tr( "%1" ).arg(value1 +(((exp(scale*(value3/10))-1))/(exp((value3/10))-1)*(value2-value1))) );
item->setText(QString().sprintf("%.3f",newValue));
}
if ( CurveType.compare("Log")==0)
{
newValue = value1 +(((log(scale*(value3*2)+1))/(log(1+(value3*2))))*(value2-value1));
//item->setText( tr( "%1" ).arg(value1 +(((log(scale*(value3*2)+1))/(log(1+(value3*2))))*(value2-value1))) );
item->setText(QString().sprintf("%.3f",newValue));
}
}
for (i=NumCurvePoints;i<10;i++)
{
item =m_ccpm->CurveSettings->item(i, CurveToGenerate );
item->setText( tr( "" ) );
}
UpdateCurveWidgets();
}
void ConfigCcpmWidget::ccpmSwashplateRedraw() void ConfigCcpmWidget::ccpmSwashplateRedraw()
{ {
@ -1111,21 +830,33 @@ void ConfigCcpmWidget::getMixer()
{ {
if (SwashLvlConfigurationInProgress)return; if (SwashLvlConfigurationInProgress)return;
if (updatingToHardware)return; if (updatingToHardware)return;
updatingFromHardware=TRUE; updatingFromHardware=TRUE;
int i; UAVDataObject* mixer = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
Q_ASSERT(mixer);
// Get existing mixer settings QPointer<VehicleConfig> vconfig = new VehicleConfig();
MixerSettings * mixerSettings = MixerSettings::GetInstance(getObjectManager());
MixerSettings::DataFields mixerSettingsData = mixerSettings->getData();
//get the settings for the curve from the mixer settings QList<double> curveValues;
for (i=0;i<5;i++) vconfig->getThrottleCurve(mixer, VehicleConfig::MIXER_THROTTLECURVE1, &curveValues);
{
m_ccpm->CurveSettings->item(i, 0)->setText(QString().sprintf("%.3f", // is at least one of the curve values != 0?
mixerSettingsData.ThrottleCurve1[i])); if (vconfig->isValidThrottleCurve(&curveValues)) {
m_ccpm->CurveSettings->item(i, 1)->setText(QString().sprintf("%.3f", m_ccpm->ThrottleCurve->setCurve(&curveValues);
mixerSettingsData.ThrottleCurve2[i])); }
else {
m_ccpm->ThrottleCurve->ResetCurve();
}
vconfig->getThrottleCurve(mixer, VehicleConfig::MIXER_THROTTLECURVE2, &curveValues);
// is at least one of the curve values != 0?
if (vconfig->isValidThrottleCurve(&curveValues)) {
m_ccpm->PitchCurve->setCurve(&curveValues);
}
else {
m_ccpm->PitchCurve->ResetCurve();
} }
updatingFromHardware=FALSE; updatingFromHardware=FALSE;
@ -1195,9 +926,11 @@ void ConfigCcpmWidget::setMixer()
} }
//get the user data for the curve into the mixer settings //get the user data for the curve into the mixer settings
QList<double> curve1 = m_ccpm->ThrottleCurve->getCurve();
QList<double> curve2 = m_ccpm->PitchCurve->getCurve();
for (i=0;i<5;i++) { for (i=0;i<5;i++) {
mixerSettingsData.ThrottleCurve1[i] = m_ccpm->CurveSettings->item(i, 0)->text().toDouble(); mixerSettingsData.ThrottleCurve1[i] = curve1.at(i);
mixerSettingsData.ThrottleCurve2[i] = m_ccpm->CurveSettings->item(i, 1)->text().toDouble(); mixerSettingsData.ThrottleCurve2[i] = curve2.at(i);
} }
//mapping of collective input to curve 2... //mapping of collective input to curve 2...

View File

@ -88,7 +88,7 @@ private:
bool updatingToHardware; bool updatingToHardware;
virtual void ResetActuators(GUIConfigDataUnion* configData); virtual void ResetActuators(GUIConfigDataUnion* configData);
virtual QStringList getChannelDescriptions(); static QStringList getChannelDescriptions();
QString updateConfigObjects(); QString updateConfigObjects();
private slots: private slots:
@ -99,13 +99,8 @@ private:
void ccpmSwashplateUpdate(); void ccpmSwashplateUpdate();
void ccpmSwashplateRedraw(); void ccpmSwashplateRedraw();
void UpdateCurveSettings();
void GenerateCurve();
void UpdateMixer(); void UpdateMixer();
void UpdateType(); void UpdateType();
void UpdateCurveWidgets();
void updatePitchCurveValue(QList<double>,double);
void updateThrottleCurveValue(QList<double>,double);
void SwashLvlStartButtonPressed(); void SwashLvlStartButtonPressed();
void SwashLvlNextButtonPressed(); void SwashLvlNextButtonPressed();

View File

@ -186,8 +186,7 @@ QString ConfigFixedWingWidget::updateConfigObjectsFromWidgets()
Q_ASSERT(mixer); Q_ASSERT(mixer);
// Remove Feed Forward, it is pointless on a plane: // Remove Feed Forward, it is pointless on a plane:
UAVObjectField* field = mixer->getField(QString("FeedForward")); setMixerValue(mixer, "FeedForward", 0.0);
field->setDouble(0);
// Set the throttle curve // Set the throttle curve
setThrottleCurve(mixer,VehicleConfig::MIXER_THROTTLECURVE1, m_aircraft->fixedWingThrottle->getCurve()); setThrottleCurve(mixer,VehicleConfig::MIXER_THROTTLECURVE1, m_aircraft->fixedWingThrottle->getCurve());
@ -291,7 +290,7 @@ bool ConfigFixedWingWidget::setupFrameFixedWing(QString airframeType)
int channel; int channel;
//disable all //disable all
for (channel=0; channel<VehicleConfig::CHANNEL_NUMELEM; channel++) for (channel=0; channel<(int)VehicleConfig::CHANNEL_NUMELEM; channel++)
{ {
setMixerType(mixer,channel,VehicleConfig::MIXERTYPE_DISABLED); setMixerType(mixer,channel,VehicleConfig::MIXERTYPE_DISABLED);
resetMixerVector(mixer, channel); resetMixerVector(mixer, channel);
@ -371,7 +370,7 @@ bool ConfigFixedWingWidget::setupFrameElevon(QString airframeType)
int channel; int channel;
double value; double value;
//disable all //disable all
for (channel=0; channel<VehicleConfig::CHANNEL_NUMELEM; channel++) for (channel=0; channel<(int)VehicleConfig::CHANNEL_NUMELEM; channel++)
{ {
setMixerType(mixer,channel,VehicleConfig::MIXERTYPE_DISABLED); setMixerType(mixer,channel,VehicleConfig::MIXERTYPE_DISABLED);
resetMixerVector(mixer, channel); resetMixerVector(mixer, channel);
@ -449,7 +448,7 @@ bool ConfigFixedWingWidget::setupFrameVtail(QString airframeType)
int channel; int channel;
double value; double value;
//disable all //disable all
for (channel=0; channel<VehicleConfig::CHANNEL_NUMELEM; channel++) for (channel=0; channel<(int)VehicleConfig::CHANNEL_NUMELEM; channel++)
{ {
setMixerType(mixer,channel,VehicleConfig::MIXERTYPE_DISABLED); setMixerType(mixer,channel,VehicleConfig::MIXERTYPE_DISABLED);
resetMixerVector(mixer, channel); resetMixerVector(mixer, channel);

View File

@ -57,7 +57,7 @@ private:
bool setupFrameVtail(QString airframeType); bool setupFrameVtail(QString airframeType);
virtual void ResetActuators(GUIConfigDataUnion* configData); virtual void ResetActuators(GUIConfigDataUnion* configData);
virtual QStringList getChannelDescriptions(); static QStringList getChannelDescriptions();
private slots: private slots:
virtual void setupUI(QString airframeType); virtual void setupUI(QString airframeType);

View File

@ -198,23 +198,14 @@ QString ConfigGroundVehicleWidget::updateConfigObjectsFromWidgets()
QString airframeType = "GroundVehicleCar"; QString airframeType = "GroundVehicleCar";
// Save the curve (common to all ground vehicle frames) // Save the curve (common to all ground vehicle frames)
UAVDataObject *obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings"))); UAVDataObject *mixer = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
// Remove Feed Forward, it is pointless on a ground vehicle: // Remove Feed Forward, it is pointless on a ground vehicle:
UAVObjectField* field = obj->getField(QString("FeedForward")); setMixerValue(mixer, "FeedForward", 0.0);
field->setDouble(0);
field = obj->getField("ThrottleCurve1"); // set the throttle curves
QList<double> curve = m_aircraft->groundVehicleThrottle1->getCurve(); setThrottleCurve(mixer, VehicleConfig::MIXER_THROTTLECURVE1, m_aircraft->groundVehicleThrottle1->getCurve() );
for (int i=0;i<curve.length();i++) { setThrottleCurve(mixer, VehicleConfig::MIXER_THROTTLECURVE2, m_aircraft->groundVehicleThrottle2->getCurve() );
field->setValue(curve.at(i),i);
}
field = obj->getField("ThrottleCurve2");
curve = m_aircraft->groundVehicleThrottle2->getCurve();
for (int i=0;i<curve.length();i++) {
field->setValue(curve.at(i),i);
}
//All airframe types must start with "GroundVehicle" //All airframe types must start with "GroundVehicle"
if (m_aircraft->groundVehicleType->currentText() == "Turnable (car)" ) { if (m_aircraft->groundVehicleType->currentText() == "Turnable (car)" ) {
@ -307,7 +298,7 @@ bool ConfigGroundVehicleWidget::setupGroundVehicleMotorcycle(QString airframeTyp
int channel; int channel;
//disable all //disable all
for (channel=0; channel<VehicleConfig::CHANNEL_NUMELEM; channel++) { for (channel=0; channel<(int)VehicleConfig::CHANNEL_NUMELEM; channel++) {
setMixerType(mixer,channel,VehicleConfig::MIXERTYPE_DISABLED); setMixerType(mixer,channel,VehicleConfig::MIXERTYPE_DISABLED);
resetMixerVector(mixer, channel); resetMixerVector(mixer, channel);
} }
@ -364,7 +355,7 @@ bool ConfigGroundVehicleWidget::setupGroundVehicleDifferential(QString airframeT
int channel; int channel;
//disable all //disable all
for (channel=0; channel<VehicleConfig::CHANNEL_NUMELEM; channel++) { for (channel=0; channel<(int)VehicleConfig::CHANNEL_NUMELEM; channel++) {
setMixerType(mixer,channel,VehicleConfig::MIXERTYPE_DISABLED); setMixerType(mixer,channel,VehicleConfig::MIXERTYPE_DISABLED);
resetMixerVector(mixer, channel); resetMixerVector(mixer, channel);
} }
@ -419,7 +410,7 @@ bool ConfigGroundVehicleWidget::setupGroundVehicleCar(QString airframeType)
int channel; int channel;
//disable all //disable all
for (channel=0; channel<VehicleConfig::CHANNEL_NUMELEM; channel++) { for (channel=0; channel<(int)VehicleConfig::CHANNEL_NUMELEM; channel++) {
setMixerType(mixer,channel,VehicleConfig::MIXERTYPE_DISABLED); setMixerType(mixer,channel,VehicleConfig::MIXERTYPE_DISABLED);
resetMixerVector(mixer, channel); resetMixerVector(mixer, channel);
} }

View File

@ -57,7 +57,7 @@ private:
bool setupGroundVehicleMotorcycle(QString airframeType); bool setupGroundVehicleMotorcycle(QString airframeType);
virtual void ResetActuators(GUIConfigDataUnion* configData); virtual void ResetActuators(GUIConfigDataUnion* configData);
virtual QStringList getChannelDescriptions(); static QStringList getChannelDescriptions();
private slots: private slots:
virtual void setupUI(QString airframeType); virtual void setupUI(QString airframeType);

View File

@ -42,7 +42,8 @@
#include "actuatorsettings.h" #include "actuatorsettings.h"
#include "actuatorcommand.h" #include "actuatorcommand.h"
//#define Pi 3.14159265358979323846
const QString ConfigMultiRotorWidget::CHANNELBOXNAME = QString("multiMotorChannelBox");
/** /**
@ -89,9 +90,7 @@ void ConfigMultiRotorWidget::setupUI(QString frameType)
quad->setElementId("tri"); quad->setElementId("tri");
//Enable all necessary motor channel boxes... //Enable all necessary motor channel boxes...
for (i=1; i <=3; i++) { enableComboBoxes(uiowner, CHANNELBOXNAME, 3, true);
enableComboBox(uiowner, QString("multiMotorChannelBox%0").arg(i), true);
}
m_aircraft->mrRollMixLevel->setValue(100); m_aircraft->mrRollMixLevel->setValue(100);
m_aircraft->mrPitchMixLevel->setValue(100); m_aircraft->mrPitchMixLevel->setValue(100);
@ -104,9 +103,7 @@ void ConfigMultiRotorWidget::setupUI(QString frameType)
quad->setElementId("quad-x"); quad->setElementId("quad-x");
//Enable all necessary motor channel boxes... //Enable all necessary motor channel boxes...
for (i=1; i <=4; i++) { enableComboBoxes(uiowner, CHANNELBOXNAME, 4, true);
enableComboBox(uiowner, QString("multiMotorChannelBox%0").arg(i), true);
}
// init mixer levels // init mixer levels
m_aircraft->mrRollMixLevel->setValue(50); m_aircraft->mrRollMixLevel->setValue(50);
@ -118,9 +115,7 @@ void ConfigMultiRotorWidget::setupUI(QString frameType)
quad->setElementId("quad-plus"); quad->setElementId("quad-plus");
//Enable all necessary motor channel boxes... //Enable all necessary motor channel boxes...
for (i=1; i <=4; i++) { enableComboBoxes(uiowner, CHANNELBOXNAME, 4, true);
enableComboBox(uiowner, QString("multiMotorChannelBox%0").arg(i), true);
}
m_aircraft->mrRollMixLevel->setValue(100); m_aircraft->mrRollMixLevel->setValue(100);
m_aircraft->mrPitchMixLevel->setValue(100); m_aircraft->mrPitchMixLevel->setValue(100);
@ -132,9 +127,7 @@ void ConfigMultiRotorWidget::setupUI(QString frameType)
quad->setElementId("quad-hexa"); quad->setElementId("quad-hexa");
//Enable all necessary motor channel boxes... //Enable all necessary motor channel boxes...
for (i=1; i <=6; i++) { enableComboBoxes(uiowner, CHANNELBOXNAME, 6, true);
enableComboBox(uiowner, QString("multiMotorChannelBox%0").arg(i), true);
}
m_aircraft->mrRollMixLevel->setValue(50); m_aircraft->mrRollMixLevel->setValue(50);
m_aircraft->mrPitchMixLevel->setValue(33); m_aircraft->mrPitchMixLevel->setValue(33);
@ -145,9 +138,7 @@ void ConfigMultiRotorWidget::setupUI(QString frameType)
quad->setElementId("quad-hexa-H"); quad->setElementId("quad-hexa-H");
//Enable all necessary motor channel boxes... //Enable all necessary motor channel boxes...
for (i=1; i <=6; i++) { enableComboBoxes(uiowner, CHANNELBOXNAME, 6, true);
enableComboBox(uiowner, QString("multiMotorChannelBox%0").arg(i), true);
}
m_aircraft->mrRollMixLevel->setValue(33); m_aircraft->mrRollMixLevel->setValue(33);
m_aircraft->mrPitchMixLevel->setValue(50); m_aircraft->mrPitchMixLevel->setValue(50);
@ -160,9 +151,7 @@ void ConfigMultiRotorWidget::setupUI(QString frameType)
quad->setElementId("hexa-coax"); quad->setElementId("hexa-coax");
//Enable all necessary motor channel boxes... //Enable all necessary motor channel boxes...
for (i=1; i <=6; i++) { enableComboBoxes(uiowner, CHANNELBOXNAME, 6, true);
enableComboBox(uiowner, QString("multiMotorChannelBox%0").arg(i), true);
}
m_aircraft->mrRollMixLevel->setValue(100); m_aircraft->mrRollMixLevel->setValue(100);
m_aircraft->mrPitchMixLevel->setValue(50); m_aircraft->mrPitchMixLevel->setValue(50);
@ -175,9 +164,7 @@ void ConfigMultiRotorWidget::setupUI(QString frameType)
quad->setElementId("quad-octo"); quad->setElementId("quad-octo");
//Enable all necessary motor channel boxes //Enable all necessary motor channel boxes
for (i=1; i <=8; i++) { enableComboBoxes(uiowner, CHANNELBOXNAME, 8, true);
enableComboBox(uiowner, QString("multiMotorChannelBox%0").arg(i), true);
}
m_aircraft->mrRollMixLevel->setValue(33); m_aircraft->mrRollMixLevel->setValue(33);
m_aircraft->mrPitchMixLevel->setValue(33); m_aircraft->mrPitchMixLevel->setValue(33);
@ -189,9 +176,7 @@ void ConfigMultiRotorWidget::setupUI(QString frameType)
quad->setElementId("quad-octo-v"); quad->setElementId("quad-octo-v");
//Enable all necessary motor channel boxes //Enable all necessary motor channel boxes
for (i=1; i <=8; i++) { enableComboBoxes(uiowner, CHANNELBOXNAME, 8, true);
enableComboBox(uiowner, QString("multiMotorChannelBox%0").arg(i), true);
}
m_aircraft->mrRollMixLevel->setValue(25); m_aircraft->mrRollMixLevel->setValue(25);
m_aircraft->mrPitchMixLevel->setValue(25); m_aircraft->mrPitchMixLevel->setValue(25);
@ -204,9 +189,7 @@ void ConfigMultiRotorWidget::setupUI(QString frameType)
quad->setElementId("octo-coax-P"); quad->setElementId("octo-coax-P");
//Enable all necessary motor channel boxes //Enable all necessary motor channel boxes
for (int i=1; i <=8; i++) { enableComboBoxes(uiowner, CHANNELBOXNAME, 8, true);
enableComboBox(uiowner, QString("multiMotorChannelBox%0").arg(i), true);
}
m_aircraft->mrRollMixLevel->setValue(100); m_aircraft->mrRollMixLevel->setValue(100);
m_aircraft->mrPitchMixLevel->setValue(100); m_aircraft->mrPitchMixLevel->setValue(100);
@ -218,10 +201,7 @@ void ConfigMultiRotorWidget::setupUI(QString frameType)
setComboCurrentIndex( m_aircraft->multirotorFrameType, m_aircraft->multirotorFrameType->findText("Octo Coax X")); setComboCurrentIndex( m_aircraft->multirotorFrameType, m_aircraft->multirotorFrameType->findText("Octo Coax X"));
quad->setElementId("octo-coax-X"); quad->setElementId("octo-coax-X");
//Enable all necessary motor channel boxes enableComboBoxes(uiowner, CHANNELBOXNAME, 8, true);
for (int i=1; i <=8; i++) {
enableComboBox(uiowner, QString("multiMotorChannelBox%0").arg(i), true);
}
m_aircraft->mrRollMixLevel->setValue(50); m_aircraft->mrRollMixLevel->setValue(50);
m_aircraft->mrPitchMixLevel->setValue(50); m_aircraft->mrPitchMixLevel->setValue(50);
@ -245,11 +225,10 @@ void ConfigMultiRotorWidget::ResetActuators(GUIConfigDataUnion* configData)
QStringList ConfigMultiRotorWidget::getChannelDescriptions() QStringList ConfigMultiRotorWidget::getChannelDescriptions()
{ {
int i;
QStringList channelDesc; QStringList channelDesc;
// init a channel_numelem list of channel desc defaults // init a channel_numelem list of channel desc defaults
for (i=0; i < (int)(ConfigMultiRotorWidget::CHANNEL_NUMELEM); i++) for (int i=0; i < (int)(ConfigMultiRotorWidget::CHANNEL_NUMELEM); i++)
{ {
channelDesc.append(QString("-")); channelDesc.append(QString("-"));
} }
@ -258,22 +237,24 @@ QStringList ConfigMultiRotorWidget::getChannelDescriptions()
GUIConfigDataUnion configData = GetConfigData(); GUIConfigDataUnion configData = GetConfigData();
multiGUISettingsStruct multi = configData.multi; multiGUISettingsStruct multi = configData.multi;
if (multi.VTOLMotorN > 0 && multi.VTOLMotorN < ConfigMultiRotorWidget::CHANNEL_NUMELEM) if (multi.VTOLMotorN > 0 && multi.VTOLMotorN <= ConfigMultiRotorWidget::CHANNEL_NUMELEM)
channelDesc[multi.VTOLMotorN-1] = QString("VTOLMotorN"); channelDesc[multi.VTOLMotorN-1] = QString("VTOLMotorN");
if (multi.VTOLMotorNE > 0 && multi.VTOLMotorNE < ConfigMultiRotorWidget::CHANNEL_NUMELEM) if (multi.VTOLMotorNE > 0 && multi.VTOLMotorNE <= ConfigMultiRotorWidget::CHANNEL_NUMELEM)
channelDesc[multi.VTOLMotorNE-1] = QString("VTOLMotorNE"); channelDesc[multi.VTOLMotorNE-1] = QString("VTOLMotorNE");
if (multi.VTOLMotorNW > 0 && multi.VTOLMotorNW < ConfigMultiRotorWidget::CHANNEL_NUMELEM) if (multi.VTOLMotorNW > 0 && multi.VTOLMotorNW <= ConfigMultiRotorWidget::CHANNEL_NUMELEM)
channelDesc[multi.VTOLMotorNW-1] = QString("VTOLMotorNW"); channelDesc[multi.VTOLMotorNW-1] = QString("VTOLMotorNW");
if (multi.VTOLMotorS > 0 && multi.VTOLMotorS < ConfigMultiRotorWidget::CHANNEL_NUMELEM) if (multi.VTOLMotorS > 0 && multi.VTOLMotorS <= ConfigMultiRotorWidget::CHANNEL_NUMELEM)
channelDesc[multi.VTOLMotorS-1] = QString("VTOLMotorS"); channelDesc[multi.VTOLMotorS-1] = QString("VTOLMotorS");
if (multi.VTOLMotorSE > 0 && multi.VTOLMotorSE < ConfigMultiRotorWidget::CHANNEL_NUMELEM) if (multi.VTOLMotorSE > 0 && multi.VTOLMotorSE <= ConfigMultiRotorWidget::CHANNEL_NUMELEM)
channelDesc[multi.VTOLMotorSE-1] = QString("VTOLMotorSE"); channelDesc[multi.VTOLMotorSE-1] = QString("VTOLMotorSE");
if (multi.VTOLMotorSW > 0 && multi.VTOLMotorSW < ConfigMultiRotorWidget::CHANNEL_NUMELEM) if (multi.VTOLMotorSW > 0 && multi.VTOLMotorSW <= ConfigMultiRotorWidget::CHANNEL_NUMELEM)
channelDesc[multi.VTOLMotorSW-1] = QString("VTOLMotorSW"); channelDesc[multi.VTOLMotorSW-1] = QString("VTOLMotorSW");
if (multi.VTOLMotorW > 0 && multi.VTOLMotorW < ConfigMultiRotorWidget::CHANNEL_NUMELEM) if (multi.VTOLMotorW > 0 && multi.VTOLMotorW <= ConfigMultiRotorWidget::CHANNEL_NUMELEM)
channelDesc[multi.VTOLMotorW-1] = QString("VTOLMotorW"); channelDesc[multi.VTOLMotorW-1] = QString("VTOLMotorW");
if (multi.VTOLMotorE > 0 && multi.VTOLMotorE < ConfigMultiRotorWidget::CHANNEL_NUMELEM) if (multi.VTOLMotorE > 0 && multi.VTOLMotorE <= ConfigMultiRotorWidget::CHANNEL_NUMELEM)
channelDesc[multi.VTOLMotorE-1] = QString("VTOLMotorE"); channelDesc[multi.VTOLMotorE-1] = QString("VTOLMotorE");
if (multi.TRIYaw > 0 && multi.TRIYaw <= ConfigMultiRotorWidget::CHANNEL_NUMELEM)
channelDesc[multi.TRIYaw-1] = QString("Tri-Yaw");
return channelDesc; return channelDesc;
} }
@ -500,7 +481,8 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType)
UAVDataObject* mixer = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings"))); UAVDataObject* mixer = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
Q_ASSERT(mixer); Q_ASSERT(mixer);
if (frameType == "QuadP") { if (frameType == "QuadP")
{
// Motors 1/2/3/4 are: N / E / S / W // Motors 1/2/3/4 are: N / E / S / W
setComboCurrentIndex(m_aircraft->multiMotorChannelBox1,multi.VTOLMotorN); setComboCurrentIndex(m_aircraft->multiMotorChannelBox1,multi.VTOLMotorN);
setComboCurrentIndex(m_aircraft->multiMotorChannelBox2,multi.VTOLMotorE); setComboCurrentIndex(m_aircraft->multiMotorChannelBox2,multi.VTOLMotorE);
@ -525,7 +507,9 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType)
m_aircraft->mrRollMixLevel->setValue( -value/1.27); m_aircraft->mrRollMixLevel->setValue( -value/1.27);
} }
} else if (frameType == "QuadX") { }
else if (frameType == "QuadX")
{
// Motors 1/2/3/4 are: NW / NE / SE / SW // Motors 1/2/3/4 are: NW / NE / SE / SW
setComboCurrentIndex(m_aircraft->multiMotorChannelBox1,multi.VTOLMotorNW); setComboCurrentIndex(m_aircraft->multiMotorChannelBox1,multi.VTOLMotorNW);
setComboCurrentIndex(m_aircraft->multiMotorChannelBox2,multi.VTOLMotorNE); setComboCurrentIndex(m_aircraft->multiMotorChannelBox2,multi.VTOLMotorNE);
@ -549,7 +533,9 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType)
} }
} else if (frameType == "Hexa") { }
else if (frameType == "Hexa")
{
// Motors 1/2/3 4/5/6 are: N / NE / SE / S / SW / NW // Motors 1/2/3 4/5/6 are: N / NE / SE / S / SW / NW
setComboCurrentIndex(m_aircraft->multiMotorChannelBox1,multi.VTOLMotorN); setComboCurrentIndex(m_aircraft->multiMotorChannelBox1,multi.VTOLMotorN);
@ -580,7 +566,9 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType)
} }
} else if (frameType == "HexaX") { }
else if (frameType == "HexaX")
{
// Motors 1/2/3 4/5/6 are: NE / E / SE / SW / W / NW // Motors 1/2/3 4/5/6 are: NE / E / SE / SW / W / NW
setComboCurrentIndex(m_aircraft->multiMotorChannelBox1,multi.VTOLMotorNE); setComboCurrentIndex(m_aircraft->multiMotorChannelBox1,multi.VTOLMotorNE);
@ -607,7 +595,9 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType)
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL); value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL);
m_aircraft->mrRollMixLevel->setValue( floor(1-value/1.27) ); m_aircraft->mrRollMixLevel->setValue( floor(1-value/1.27) );
} }
} else if (frameType == "HexaCoax") { }
else if (frameType == "HexaCoax")
{
// Motors 1/2/3 4/5/6 are: NW/W NE/E S/SE // Motors 1/2/3 4/5/6 are: NW/W NE/E S/SE
setComboCurrentIndex(m_aircraft->multiMotorChannelBox1,multi.VTOLMotorNW); setComboCurrentIndex(m_aircraft->multiMotorChannelBox1,multi.VTOLMotorNW);
@ -633,8 +623,9 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType)
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL); value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL);
m_aircraft->mrRollMixLevel->setValue( value/1.27); m_aircraft->mrRollMixLevel->setValue( value/1.27);
} }
} else if (frameType == "Octo" || frameType == "OctoV" || }
frameType == "OctoCoaxP") { else if (frameType == "Octo" || frameType == "OctoV" || frameType == "OctoCoaxP")
{
// Motors 1 to 8 are N / NE / E / etc // Motors 1 to 8 are N / NE / E / etc
setComboCurrentIndex(m_aircraft->multiMotorChannelBox1,multi.VTOLMotorN); setComboCurrentIndex(m_aircraft->multiMotorChannelBox1,multi.VTOLMotorN);
@ -690,7 +681,9 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType)
} }
} }
} else if (frameType == "OctoCoaxX") { }
else if (frameType == "OctoCoaxX")
{
// Motors 1 to 8 are N / NE / E / etc // Motors 1 to 8 are N / NE / E / etc
setComboCurrentIndex(m_aircraft->multiMotorChannelBox1,multi.VTOLMotorNW); setComboCurrentIndex(m_aircraft->multiMotorChannelBox1,multi.VTOLMotorNW);
@ -717,7 +710,9 @@ void ConfigMultiRotorWidget::refreshWidgetsValues(QString frameType)
value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL); value = getMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_ROLL);
m_aircraft->mrRollMixLevel->setValue( floor(value/1.27) ); m_aircraft->mrRollMixLevel->setValue( floor(value/1.27) );
} }
} else if (frameType == "Tri") { }
else if (frameType == "Tri")
{
// Motors 1 to 8 are N / NE / E / etc // Motors 1 to 8 are N / NE / E / etc
setComboCurrentIndex(m_aircraft->multiMotorChannelBox1,multi.VTOLMotorNW); setComboCurrentIndex(m_aircraft->multiMotorChannelBox1,multi.VTOLMotorNW);
@ -969,7 +964,7 @@ bool ConfigMultiRotorWidget::setupMultiRotorMixer(double mixerFactors[8][3])
Q_ASSERT(mixer); Q_ASSERT(mixer);
//disable all //disable all
for (int channel=0; channel<VehicleConfig::CHANNEL_NUMELEM; channel++) for (int channel=0; channel<(int)VehicleConfig::CHANNEL_NUMELEM; channel++)
{ {
setMixerType(mixer,channel,VehicleConfig::MIXERTYPE_DISABLED); setMixerType(mixer,channel,VehicleConfig::MIXERTYPE_DISABLED);
resetMixerVector(mixer, channel); resetMixerVector(mixer, channel);

View File

@ -65,7 +65,8 @@ private:
void setupQuadMotor(int channel, double roll, double pitch, double yaw); void setupQuadMotor(int channel, double roll, double pitch, double yaw);
virtual void ResetActuators(GUIConfigDataUnion* configData); virtual void ResetActuators(GUIConfigDataUnion* configData);
virtual QStringList getChannelDescriptions(); static QStringList getChannelDescriptions();
static const QString CHANNELBOXNAME;
private slots: private slots:
virtual void setupUI(QString airframeType); virtual void setupUI(QString airframeType);

View File

@ -113,17 +113,6 @@ void VehicleConfig::SetConfigData(GUIConfigDataUnion configData) {
void VehicleConfig::ResetActuators(GUIConfigDataUnion* configData) void VehicleConfig::ResetActuators(GUIConfigDataUnion* configData)
{ {
} }
QStringList VehicleConfig::getChannelDescriptions()
{
QStringList channelDesc;
// init a channel_numelem list of channel desc defaults
for (int i=0; i < (int)(VehicleConfig::CHANNEL_NUMELEM); i++)
{
channelDesc.append(QString("-"));
}
return channelDesc;
}
/** /**
Helper function: Helper function:
@ -140,15 +129,16 @@ void VehicleConfig::setComboCurrentIndex(QComboBox* box, int index)
/** /**
Helper function: Helper function:
enables/disables the named combobox within supplied uiowner enables/disables the named comboboxes within supplied uiowner
*/ */
void VehicleConfig::enableComboBox(QWidget* owner, QString boxName, bool enable) void VehicleConfig::enableComboBoxes(QWidget* owner, QString boxName, int boxCount, bool enable)
{ {
QComboBox* box = qFindChild<QComboBox*>(owner, boxName); for (int i = 1; i <= boxCount; i++) {
QComboBox* box = qFindChild<QComboBox*>(owner, QString("%0%1").arg(boxName).arg(i));
if (box) if (box)
box->setEnabled(enable); box->setEnabled(enable);
} }
}
QString VehicleConfig::getMixerType(UAVDataObject* mixer, int channel) QString VehicleConfig::getMixerType(UAVDataObject* mixer, int channel)
{ {
Q_ASSERT(mixer); Q_ASSERT(mixer);

View File

@ -123,8 +123,7 @@ class VehicleConfig: public ConfigTaskWidget
static void SetConfigData(GUIConfigDataUnion configData); static void SetConfigData(GUIConfigDataUnion configData);
static void resetField(UAVObjectField * field); static void resetField(UAVObjectField * field);
static void setComboCurrentIndex(QComboBox* box, int index); static void setComboCurrentIndex(QComboBox* box, int index);
static void enableComboBox(QWidget* owner, QString boxName, bool enable); static void enableComboBoxes(QWidget* owner, QString boxName, int boxCount, bool enable);
double getMixerVectorValue(UAVDataObject* mixer, int channel, MixerVectorElem elementName); double getMixerVectorValue(UAVDataObject* mixer, int channel, MixerVectorElem elementName);
void setMixerVectorValue(UAVDataObject* mixer, int channel, MixerVectorElem elementName, double value); void setMixerVectorValue(UAVDataObject* mixer, int channel, MixerVectorElem elementName, double value);
void resetMixerVector(UAVDataObject* mixer, int channel); void resetMixerVector(UAVDataObject* mixer, int channel);
@ -138,7 +137,6 @@ class VehicleConfig: public ConfigTaskWidget
double getCurveMin(QList<double>* curve); double getCurveMin(QList<double>* curve);
double getCurveMax(QList<double>* curve); double getCurveMax(QList<double>* curve);
virtual void ResetActuators(GUIConfigDataUnion* configData); virtual void ResetActuators(GUIConfigDataUnion* configData);
virtual QStringList getChannelDescriptions();
QStringList channelNames; QStringList channelNames;
QStringList mixerTypes; QStringList mixerTypes;

View File

@ -36,7 +36,9 @@ HEADERS += configplugin.h \
cfg_vehicletypes/configfixedwingwidget.h \ cfg_vehicletypes/configfixedwingwidget.h \
cfg_vehicletypes/vehicleconfig.h \ cfg_vehicletypes/vehicleconfig.h \
configrevowidget.h \ configrevowidget.h \
config_global.h config_global.h \
mixercurve.h \
dblspindelegate.h
SOURCES += configplugin.cpp \ SOURCES += configplugin.cpp \
configgadgetconfiguration.cpp \ configgadgetconfiguration.cpp \
configgadgetwidget.cpp \ configgadgetwidget.cpp \
@ -67,7 +69,9 @@ SOURCES += configplugin.cpp \
cfg_vehicletypes/configfixedwingwidget.cpp \ cfg_vehicletypes/configfixedwingwidget.cpp \
cfg_vehicletypes/configccpmwidget.cpp \ cfg_vehicletypes/configccpmwidget.cpp \
outputchannelform.cpp \ outputchannelform.cpp \
cfg_vehicletypes/vehicleconfig.cpp cfg_vehicletypes/vehicleconfig.cpp \
mixercurve.cpp \
dblspindelegate.cpp
FORMS += airframe.ui \ FORMS += airframe.ui \
cc_hw_settings.ui \ cc_hw_settings.ui \
pro_hw_settings.ui \ pro_hw_settings.ui \
@ -83,5 +87,6 @@ FORMS += airframe.ui \
outputchannelform.ui \ outputchannelform.ui \
revosensors.ui \ revosensors.ui \
txpid.ui \ txpid.ui \
pipxtreme.ui pipxtreme.ui \
mixercurve.ui
RESOURCES += configgadget.qrc RESOURCES += configgadget.qrc

View File

@ -44,15 +44,35 @@ ConfigCCHWWidget::ConfigCCHWWidget(QWidget *parent) : ConfigTaskWidget(parent)
m_telemetry = new Ui_CC_HW_Widget(); m_telemetry = new Ui_CC_HW_Widget();
m_telemetry->setupUi(this); m_telemetry->setupUi(this);
m_telemetry->label_2->setPixmap(QPixmap(":/configgadget/images/coptercontrol.svg"));
ExtensionSystem::PluginManager *pm=ExtensionSystem::PluginManager::instance(); ExtensionSystem::PluginManager *pm=ExtensionSystem::PluginManager::instance();
Core::Internal::GeneralSettings * settings=pm->getObject<Core::Internal::GeneralSettings>(); Core::Internal::GeneralSettings * settings=pm->getObject<Core::Internal::GeneralSettings>();
if(!settings->useExpertMode()) if(!settings->useExpertMode())
m_telemetry->saveTelemetryToRAM->setVisible(false); m_telemetry->saveTelemetryToRAM->setVisible(false);
UAVObjectUtilManager* utilMngr = pm->getObject<UAVObjectUtilManager>();
int id = utilMngr->getBoardModel();
switch (id) {
case 0x0101:
m_telemetry->label_2->setPixmap(QPixmap(":/uploader/images/deviceID-0101.svg"));
break;
case 0x0301:
m_telemetry->label_2->setPixmap(QPixmap(":/uploader/images/deviceID-0301.svg"));
break;
case 0x0401:
m_telemetry->label_2->setPixmap(QPixmap(":/uploader/images/deviceID-0401.svg"));
break;
case 0x0402:
m_telemetry->label_2->setPixmap(QPixmap(":/uploader/images/deviceID-0402.svg"));
break;
case 0x0201:
m_telemetry->label_2->setPixmap(QPixmap(":/uploader/images/deviceID-0201.svg"));
break;
default:
m_telemetry->label_2->setPixmap(QPixmap(":/configgadget/images/coptercontrol.svg"));
break;
}
addApplySaveButtons(m_telemetry->saveTelemetryToRAM,m_telemetry->saveTelemetryToSD); addApplySaveButtons(m_telemetry->saveTelemetryToRAM,m_telemetry->saveTelemetryToSD);
addUAVObjectToWidgetRelation("HwSettings","CC_FlexiPort",m_telemetry->cbFlexi); addUAVObjectToWidgetRelation("HwSettings","CC_FlexiPort",m_telemetry->cbFlexi);
addUAVObjectToWidgetRelation("HwSettings","CC_MainPort",m_telemetry->cbTele); addUAVObjectToWidgetRelation("HwSettings","CC_MainPort",m_telemetry->cbTele);

View File

@ -93,12 +93,12 @@ ConfigInputWidget::ConfigInputWidget(QWidget *parent) : ConfigTaskWidget(parent)
connect(m_config->wzBack,SIGNAL(clicked()),this,SLOT(wzBack())); connect(m_config->wzBack,SIGNAL(clicked()),this,SLOT(wzBack()));
m_config->stackedWidget->setCurrentIndex(0); m_config->stackedWidget->setCurrentIndex(0);
addUAVObjectToWidgetRelation("ManualControlSettings","FlightModePosition",m_config->fmsModePos1,0); addUAVObjectToWidgetRelation("ManualControlSettings","FlightModePosition",m_config->fmsModePos1,1);
addUAVObjectToWidgetRelation("ManualControlSettings","FlightModePosition",m_config->fmsModePos2,1); addUAVObjectToWidgetRelation("ManualControlSettings","FlightModePosition",m_config->fmsModePos2,2);
addUAVObjectToWidgetRelation("ManualControlSettings","FlightModePosition",m_config->fmsModePos3,2); addUAVObjectToWidgetRelation("ManualControlSettings","FlightModePosition",m_config->fmsModePos3,3);
addUAVObjectToWidgetRelation("ManualControlSettings","FlightModePosition",m_config->fmsModePos4,3); addUAVObjectToWidgetRelation("ManualControlSettings","FlightModePosition",m_config->fmsModePos4,1);
addUAVObjectToWidgetRelation("ManualControlSettings","FlightModePosition",m_config->fmsModePos5,4); addUAVObjectToWidgetRelation("ManualControlSettings","FlightModePosition",m_config->fmsModePos5,2);
addUAVObjectToWidgetRelation("ManualControlSettings","FlightModePosition",m_config->fmsModePos6,5); addUAVObjectToWidgetRelation("ManualControlSettings","FlightModePosition",m_config->fmsModePos6,3);
addUAVObjectToWidgetRelation("ManualControlSettings","FlightModeNumber",m_config->fmsPosNum); addUAVObjectToWidgetRelation("ManualControlSettings","FlightModeNumber",m_config->fmsPosNum);
addUAVObjectToWidgetRelation("ManualControlSettings","Stabilization1Settings",m_config->fmsSsPos1Roll,"Roll"); addUAVObjectToWidgetRelation("ManualControlSettings","Stabilization1Settings",m_config->fmsSsPos1Roll,"Roll");

View File

@ -239,8 +239,6 @@ void ConfigOutputWidget::refreshWidgetsValues(UAVObject * obj)
{ {
Q_UNUSED(obj); Q_UNUSED(obj);
bool dirty=isDirty();
// Get Actuator Settings // Get Actuator Settings
ActuatorSettings *actuatorSettings = ActuatorSettings::GetInstance(getObjectManager()); ActuatorSettings *actuatorSettings = ActuatorSettings::GetInstance(getObjectManager());
Q_ASSERT(actuatorSettings); Q_ASSERT(actuatorSettings);

View File

@ -117,7 +117,7 @@ ConfigVehicleTypeWidget::ConfigVehicleTypeWidget(QWidget *parent) : ConfigTaskWi
//Generate lists of mixerTypeNames, mixerVectorNames, channelNames //Generate lists of mixerTypeNames, mixerVectorNames, channelNames
channelNames << "None"; channelNames << "None";
for (int i = 0; i < ActuatorSettings::CHANNELADDR_NUMELEM; i++) { for (int i = 0; i < (int)ActuatorSettings::CHANNELADDR_NUMELEM; i++) {
mixerTypes << QString("Mixer%1Type").arg(i+1); mixerTypes << QString("Mixer%1Type").arg(i+1);
mixerVectors << QString("Mixer%1Vector").arg(i+1); mixerVectors << QString("Mixer%1Vector").arg(i+1);
@ -172,14 +172,14 @@ ConfigVehicleTypeWidget::ConfigVehicleTypeWidget(QWidget *parent) : ConfigTaskWi
UAVDataObject* obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings"))); UAVDataObject* obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
UAVObjectField* field = obj->getField(QString("Mixer1Type")); UAVObjectField* field = obj->getField(QString("Mixer1Type"));
QStringList list = field->getOptions(); QStringList list = field->getOptions();
for (int i=0;i<8;i++) { for (int i=0; i<(int)(VehicleConfig::CHANNEL_NUMELEM); i++) {
QComboBox* qb = new QComboBox(m_aircraft->customMixerTable); QComboBox* qb = new QComboBox(m_aircraft->customMixerTable);
qb->addItems(list); qb->addItems(list);
m_aircraft->customMixerTable->setCellWidget(0,i,qb); m_aircraft->customMixerTable->setCellWidget(0,i,qb);
} }
SpinBoxDelegate *sbd = new SpinBoxDelegate(); SpinBoxDelegate *sbd = new SpinBoxDelegate();
for (int i=1;i<8; i++) { for (int i=1; i<(int)(VehicleConfig::CHANNEL_NUMELEM); i++) {
m_aircraft->customMixerTable->setItemDelegateForRow(i, sbd); m_aircraft->customMixerTable->setItemDelegateForRow(i, sbd);
} }
@ -201,9 +201,6 @@ ConfigVehicleTypeWidget::ConfigVehicleTypeWidget(QWidget *parent) : ConfigTaskWi
m_heli = m_aircraft->widget_3; m_heli = m_aircraft->widget_3;
m_heli->setupUI(QString("HeliCP")); m_heli->setupUI(QString("HeliCP"));
// initialize the ui to show the mixersettings tab
//mdl m_aircraft->tabWidget->setCurrentIndex(0);
//Connect aircraft type selection dropbox to callback function //Connect aircraft type selection dropbox to callback function
connect(m_aircraft->aircraftType, SIGNAL(currentIndexChanged(int)), this, SLOT(switchAirframeType(int))); connect(m_aircraft->aircraftType, SIGNAL(currentIndexChanged(int)), this, SLOT(switchAirframeType(int)));
@ -213,25 +210,6 @@ ConfigVehicleTypeWidget::ConfigVehicleTypeWidget(QWidget *parent) : ConfigTaskWi
connect(m_aircraft->groundVehicleType, SIGNAL(currentIndexChanged(QString)), this, SLOT(setupAirframeUI(QString))); connect(m_aircraft->groundVehicleType, SIGNAL(currentIndexChanged(QString)), this, SLOT(setupAirframeUI(QString)));
//mdl connect(m_heli->m_ccpm->ccpmType, SIGNAL(currentIndexChanged(QString)), this, SLOT(setupAirframeUI(QString))); //mdl connect(m_heli->m_ccpm->ccpmType, SIGNAL(currentIndexChanged(QString)), this, SLOT(setupAirframeUI(QString)));
//Connect throttle curve reset pushbuttons to reset functions
connect(m_aircraft->fwThrottleReset, SIGNAL(clicked()), this, SLOT(resetFwMixer()));
connect(m_aircraft->mrThrottleCurveReset, SIGNAL(clicked()), this, SLOT(resetMrMixer()));
connect(m_aircraft->gvThrottleCurve1Reset, SIGNAL(clicked()), this, SLOT(resetGvFrontMixer()));
connect(m_aircraft->gvThrottleCurve2Reset, SIGNAL(clicked()), this, SLOT(resetGvRearMixer()));
connect(m_aircraft->customReset1, SIGNAL(clicked()), this, SLOT(resetCt1Mixer()));
connect(m_aircraft->customReset2, SIGNAL(clicked()), this, SLOT(resetCt2Mixer()));
//Connect throttle curve manipulation points to output text
connect(m_aircraft->fixedWingThrottle, SIGNAL(curveUpdated(QList<double>,double)), this, SLOT(updateFwThrottleCurveValue(QList<double>,double)));
connect(m_aircraft->multiThrottleCurve, SIGNAL(curveUpdated(QList<double>,double)), this, SLOT(updateMrThrottleCurveValue(QList<double>,double)));
connect(m_aircraft->groundVehicleThrottle1, SIGNAL(curveUpdated(QList<double>,double)), this, SLOT(updateGvThrottle1CurveValue(QList<double>,double)));
connect(m_aircraft->groundVehicleThrottle2, SIGNAL(curveUpdated(QList<double>,double)), this, SLOT(updateGvThrottle2CurveValue(QList<double>,double)));
connect(m_aircraft->customThrottle1Curve, SIGNAL(curveUpdated(QList<double>,double)), this, SLOT(updateCustomThrottle1CurveValue(QList<double>,double)));
connect(m_aircraft->customThrottle2Curve, SIGNAL(curveUpdated(QList<double>,double)), this, SLOT(updateCustomThrottle2CurveValue(QList<double>,double)));
// connect(m_aircraft->fwAileron1Channel, SIGNAL(currentIndexChanged(int)), this, SLOT(toggleAileron2(int)));
// connect(m_aircraft->fwElevator1Channel, SIGNAL(currentIndexChanged(int)), this, SLOT(toggleElevator2(int)));
//Connect the three feed forward test checkboxes //Connect the three feed forward test checkboxes
connect(m_aircraft->ffTestBox1, SIGNAL(clicked(bool)), this, SLOT(enableFFTest())); connect(m_aircraft->ffTestBox1, SIGNAL(clicked(bool)), this, SLOT(enableFFTest()));
connect(m_aircraft->ffTestBox2, SIGNAL(clicked(bool)), this, SLOT(enableFFTest())); connect(m_aircraft->ffTestBox2, SIGNAL(clicked(bool)), this, SLOT(enableFFTest()));
@ -281,16 +259,14 @@ QStringList ConfigVehicleTypeWidget::getChannelDescriptions()
case SystemSettings::AIRFRAMETYPE_FIXEDWINGELEVON: case SystemSettings::AIRFRAMETYPE_FIXEDWINGELEVON:
case SystemSettings::AIRFRAMETYPE_FIXEDWINGVTAIL: case SystemSettings::AIRFRAMETYPE_FIXEDWINGVTAIL:
{ {
QPointer<ConfigFixedWingWidget> fixedwing = new ConfigFixedWingWidget(); channelDesc = ConfigFixedWingWidget::getChannelDescriptions();
channelDesc = fixedwing->getChannelDescriptions();
} }
break; break;
// helicp // helicp
case SystemSettings::AIRFRAMETYPE_HELICP: case SystemSettings::AIRFRAMETYPE_HELICP:
{ {
QPointer<ConfigCcpmWidget> heli = new ConfigCcpmWidget(); channelDesc = ConfigCcpmWidget::getChannelDescriptions();
channelDesc = heli->getChannelDescriptions();
} }
break; break;
@ -307,8 +283,7 @@ QStringList ConfigVehicleTypeWidget::getChannelDescriptions()
case SystemSettings::AIRFRAMETYPE_HEXACOAX: case SystemSettings::AIRFRAMETYPE_HEXACOAX:
case SystemSettings::AIRFRAMETYPE_HEXA: case SystemSettings::AIRFRAMETYPE_HEXA:
{ {
QPointer<ConfigMultiRotorWidget> multi = new ConfigMultiRotorWidget(); channelDesc = ConfigMultiRotorWidget::getChannelDescriptions();
channelDesc = multi->getChannelDescriptions();
} }
break; break;
@ -317,8 +292,7 @@ QStringList ConfigVehicleTypeWidget::getChannelDescriptions()
case SystemSettings::AIRFRAMETYPE_GROUNDVEHICLEDIFFERENTIAL: case SystemSettings::AIRFRAMETYPE_GROUNDVEHICLEDIFFERENTIAL:
case SystemSettings::AIRFRAMETYPE_GROUNDVEHICLEMOTORCYCLE: case SystemSettings::AIRFRAMETYPE_GROUNDVEHICLEMOTORCYCLE:
{ {
QPointer<ConfigGroundVehicleWidget> ground = new ConfigGroundVehicleWidget(); channelDesc = ConfigGroundVehicleWidget::getChannelDescriptions();
channelDesc = ground->getChannelDescriptions();
} }
break; break;
@ -349,9 +323,9 @@ void ConfigVehicleTypeWidget::switchAirframeType(int index)
m_aircraft->quadShape->fitInView(quad, Qt::KeepAspectRatio); m_aircraft->quadShape->fitInView(quad, Qt::KeepAspectRatio);
if (m_aircraft->aircraftType->findText("Custom")) { if (m_aircraft->aircraftType->findText("Custom")) {
m_aircraft->customMixerTable->resizeColumnsToContents(); m_aircraft->customMixerTable->resizeColumnsToContents();
for (int i=0;i<8;i++) { for (int i=0;i<(int)(VehicleConfig::CHANNEL_NUMELEM);i++) {
m_aircraft->customMixerTable->setColumnWidth(i,(m_aircraft->customMixerTable->width()- m_aircraft->customMixerTable->setColumnWidth(i,(m_aircraft->customMixerTable->width()-
m_aircraft->customMixerTable->verticalHeader()->width())/8); m_aircraft->customMixerTable->verticalHeader()->width())/10);
} }
} }
} }
@ -368,9 +342,9 @@ void ConfigVehicleTypeWidget::showEvent(QShowEvent *event)
// the result is usually a ahrsbargraph that is way too small. // the result is usually a ahrsbargraph that is way too small.
m_aircraft->quadShape->fitInView(quad, Qt::KeepAspectRatio); m_aircraft->quadShape->fitInView(quad, Qt::KeepAspectRatio);
m_aircraft->customMixerTable->resizeColumnsToContents(); m_aircraft->customMixerTable->resizeColumnsToContents();
for (int i=0;i<8;i++) { for (int i=0;i<(int)(VehicleConfig::CHANNEL_NUMELEM);i++) {
m_aircraft->customMixerTable->setColumnWidth(i,(m_aircraft->customMixerTable->width()- m_aircraft->customMixerTable->setColumnWidth(i,(m_aircraft->customMixerTable->width()-
m_aircraft->customMixerTable->verticalHeader()->width())/8); m_aircraft->customMixerTable->verticalHeader()->width())/ 10);
} }
} }
@ -383,9 +357,9 @@ void ConfigVehicleTypeWidget::resizeEvent(QResizeEvent* event)
m_aircraft->quadShape->fitInView(quad, Qt::KeepAspectRatio); m_aircraft->quadShape->fitInView(quad, Qt::KeepAspectRatio);
// Make the custom table columns autostretch: // Make the custom table columns autostretch:
m_aircraft->customMixerTable->resizeColumnsToContents(); m_aircraft->customMixerTable->resizeColumnsToContents();
for (int i=0;i<8;i++) { for (int i=0;i<(int)(VehicleConfig::CHANNEL_NUMELEM);i++) {
m_aircraft->customMixerTable->setColumnWidth(i,(m_aircraft->customMixerTable->width()- m_aircraft->customMixerTable->setColumnWidth(i,(m_aircraft->customMixerTable->width()-
m_aircraft->customMixerTable->verticalHeader()->width())/8); m_aircraft->customMixerTable->verticalHeader()->width())/ 10);
} }
} }
@ -486,132 +460,6 @@ void ConfigVehicleTypeWidget::enableFFTest()
} }
} }
/**
Resets Fixed wing throttle mixer
*/
void ConfigVehicleTypeWidget::resetFwMixer()
{
UAVDataObject* obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
UAVObjectField* field = obj->getField(QString("ThrottleCurve1"));
resetMixer(m_aircraft->fixedWingThrottle, field->getNumElements(),1);
}
/**
Resets Multirotor throttle mixer
*/
void ConfigVehicleTypeWidget::resetMrMixer()
{
UAVDataObject* obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
UAVObjectField* field = obj->getField(QString("ThrottleCurve1"));
resetMixer(m_aircraft->multiThrottleCurve, field->getNumElements(),0.9);
}
/**
Resets Ground vehicle front throttle mixer
*/
void ConfigVehicleTypeWidget::resetGvFrontMixer()
{
UAVDataObject* obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
UAVObjectField* field = obj->getField(QString("ThrottleCurve1"));
resetMixer(m_aircraft->groundVehicleThrottle1, field->getNumElements(),1);
}
/**
Resets Ground vehicle rear throttle mixer
*/
void ConfigVehicleTypeWidget::resetGvRearMixer()
{
UAVDataObject* obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
UAVObjectField* field = obj->getField(QString("ThrottleCurve2"));
resetMixer(m_aircraft->groundVehicleThrottle2, field->getNumElements(),1);
}
/**
Resets Custom throttle 1 mixer
*/
void ConfigVehicleTypeWidget::resetCt1Mixer()
{
UAVDataObject* obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
UAVObjectField* field = obj->getField(QString("ThrottleCurve1"));
resetMixer(m_aircraft->customThrottle1Curve, field->getNumElements(),1);
}
/**
Resets Custom throttle 2 mixer
*/
void ConfigVehicleTypeWidget::resetCt2Mixer()
{
UAVDataObject* obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
UAVObjectField* field = obj->getField(QString("ThrottleCurve2"));
resetMixer(m_aircraft->customThrottle2Curve, field->getNumElements(),1);
}
/**
Resets a mixer curve
*/
void ConfigVehicleTypeWidget::resetMixer(MixerCurveWidget *mixer, int numElements, double maxvalue)
{
// Setup all Throttle1 curves for all types of airframes
mixer->initLinearCurve((quint32)numElements,maxvalue);
}
/**
Updates the currently moved fixed wing throttle curve item value
*/
void ConfigVehicleTypeWidget::updateFwThrottleCurveValue(QList<double> list, double value)
{
Q_UNUSED(list);
m_aircraft->fwThrottleCurveItemValue->setText(QString().sprintf("Val: %.2f",value));
}
/**
Updates the currently moved multi-rotor throttle curve item value
*/
void ConfigVehicleTypeWidget::updateMrThrottleCurveValue(QList<double> list, double value)
{
Q_UNUSED(list);
m_aircraft->mrThrottleCurveItemValue->setText(QString().sprintf("Val: %.2f",value));
}
/**
Updates the moved ground vehicle front throttle curve item value
*/
void ConfigVehicleTypeWidget::updateGvThrottle1CurveValue(QList<double> list, double value)
{
Q_UNUSED(list);
m_aircraft->gvThrottleCurve1ItemValue->setText(QString().sprintf("Val: %.2f",value));
}
/**
Updates the moved ground vehicle rear throttle curve item value
*/
void ConfigVehicleTypeWidget::updateGvThrottle2CurveValue(QList<double> list, double value)
{
Q_UNUSED(list);
m_aircraft->gvThrottleCurve2ItemValue->setText(QString().sprintf("Val: %.2f",value));
}
/**
Updates the currently moved custom throttle curve item value (Custom throttle 1)
*/
void ConfigVehicleTypeWidget::updateCustomThrottle1CurveValue(QList<double> list, double value)
{
Q_UNUSED(list);
m_aircraft->customThrottleCurve1Value->setText(QString().sprintf("Val: %.2f",value));
}
/**
Updates the currently moved custom throttle curve item value (Custom throttle 2)
*/
void ConfigVehicleTypeWidget::updateCustomThrottle2CurveValue(QList<double> list, double value)
{
Q_UNUSED(list);
m_aircraft->customThrottleCurve2Value->setText(QString().sprintf("Val: %.2f",value));
}
/************************** /**************************
* Aircraft settings * Aircraft settings
**************************/ **************************/
@ -771,30 +619,34 @@ void ConfigVehicleTypeWidget::updateCustomAirframeUI()
// is at least one of the curve values != 0? // is at least one of the curve values != 0?
if (vconfig->isValidThrottleCurve(&curveValues)) { if (vconfig->isValidThrottleCurve(&curveValues)) {
// yes, use the curve we just read from mixersettings
m_aircraft->customThrottle1Curve->setMin(vconfig->getCurveMin(&curveValues));
m_aircraft->customThrottle1Curve->setMax(vconfig->getCurveMax(&curveValues));
m_aircraft->customThrottle1Curve->initCurve(&curveValues); m_aircraft->customThrottle1Curve->initCurve(&curveValues);
} }
else { else {
// no, init a straight curve // no, init a straight curve
m_aircraft->customThrottle1Curve->initLinearCurve(curveValues.count(),(double)1); m_aircraft->customThrottle1Curve->initLinearCurve(curveValues.count(), 1.0);
} }
// Setup all Throttle2 curves for all types of airframes //AT THIS MOMENT, THAT MEANS ONLY GROUND VEHICLES if (MixerSettings* mxr = qobject_cast<MixerSettings *>(mixer)) {
MixerSettings::DataFields mixerSettingsData = mxr->getData();
if (mixerSettingsData.Curve2Source == MixerSettings::CURVE2SOURCE_THROTTLE)
m_aircraft->customThrottle2Curve->setMixerType(MixerCurve::MIXERCURVE_THROTTLE);
else {
m_aircraft->customThrottle2Curve->setMixerType(MixerCurve::MIXERCURVE_PITCH);
}
}
// Setup all Throttle2 curves for all types of airframes
vconfig->getThrottleCurve(mixer, VehicleConfig::MIXER_THROTTLECURVE2, &curveValues); vconfig->getThrottleCurve(mixer, VehicleConfig::MIXER_THROTTLECURVE2, &curveValues);
if (vconfig->isValidThrottleCurve(&curveValues)) { if (vconfig->isValidThrottleCurve(&curveValues)) {
m_aircraft->customThrottle2Curve->setMin(vconfig->getCurveMin(&curveValues));
m_aircraft->customThrottle2Curve->setMax(vconfig->getCurveMax(&curveValues));
m_aircraft->customThrottle2Curve->initCurve(&curveValues); m_aircraft->customThrottle2Curve->initCurve(&curveValues);
} }
else { else {
m_aircraft->customThrottle2Curve->initLinearCurve(curveValues.count(),(double)1); m_aircraft->customThrottle2Curve->initLinearCurve(curveValues.count(), 1.0, m_aircraft->customThrottle2Curve->getMin());
} }
// Update the mixer table: // Update the mixer table:
for (int channel=0; channel<8; channel++) { for (int channel=0; channel<(int)(VehicleConfig::CHANNEL_NUMELEM); channel++) {
UAVObjectField* field = mixer->getField(mixerTypes.at(channel)); UAVObjectField* field = mixer->getField(mixerTypes.at(channel));
if (field) if (field)
{ {
@ -864,7 +716,7 @@ void ConfigVehicleTypeWidget::updateObjectsFromWidgets()
vconfig->setThrottleCurve(mixer, VehicleConfig::MIXER_THROTTLECURVE2, m_aircraft->customThrottle2Curve->getCurve()); vconfig->setThrottleCurve(mixer, VehicleConfig::MIXER_THROTTLECURVE2, m_aircraft->customThrottle2Curve->getCurve());
// Update the table: // Update the table:
for (int channel=0; channel<8; channel++) { for (int channel=0; channel<(int)(VehicleConfig::CHANNEL_NUMELEM); channel++) {
QComboBox* q = (QComboBox*)m_aircraft->customMixerTable->cellWidget(0,channel); QComboBox* q = (QComboBox*)m_aircraft->customMixerTable->cellWidget(0,channel);
vconfig->setMixerType(mixer,channel, vconfig->setMixerType(mixer,channel,
@ -920,13 +772,13 @@ void ConfigVehicleTypeWidget::setComboCurrentIndex(QComboBox* box, int index)
void ConfigVehicleTypeWidget::addToDirtyMonitor() void ConfigVehicleTypeWidget::addToDirtyMonitor()
{ {
addWidget(m_aircraft->customMixerTable); addWidget(m_aircraft->customMixerTable);
addWidget(m_aircraft->customThrottle1Curve); addWidget(m_aircraft->customThrottle1Curve->getCurveWidget());
addWidget(m_aircraft->customThrottle2Curve); addWidget(m_aircraft->customThrottle2Curve->getCurveWidget());
addWidget(m_aircraft->multiThrottleCurve); addWidget(m_aircraft->multiThrottleCurve->getCurveWidget());
addWidget(m_aircraft->fixedWingThrottle); addWidget(m_aircraft->fixedWingThrottle->getCurveWidget());
addWidget(m_aircraft->fixedWingType); addWidget(m_aircraft->fixedWingType);
addWidget(m_aircraft->groundVehicleThrottle1); addWidget(m_aircraft->groundVehicleThrottle1->getCurveWidget());
addWidget(m_aircraft->groundVehicleThrottle2); addWidget(m_aircraft->groundVehicleThrottle2->getCurveWidget());
addWidget(m_aircraft->groundVehicleType); addWidget(m_aircraft->groundVehicleType);
addWidget(m_aircraft->feedForwardSlider); addWidget(m_aircraft->feedForwardSlider);
addWidget(m_aircraft->accelTime); addWidget(m_aircraft->accelTime);
@ -984,15 +836,8 @@ void ConfigVehicleTypeWidget::addToDirtyMonitor()
addWidget(m_heli->m_ccpm->ccpmRollScaleBox); addWidget(m_heli->m_ccpm->ccpmRollScaleBox);
addWidget(m_heli->m_ccpm->SwashLvlPositionSlider); addWidget(m_heli->m_ccpm->SwashLvlPositionSlider);
addWidget(m_heli->m_ccpm->SwashLvlPositionSpinBox); addWidget(m_heli->m_ccpm->SwashLvlPositionSpinBox);
addWidget(m_heli->m_ccpm->CurveType); addWidget(m_heli->m_ccpm->ThrottleCurve->getCurveWidget());
addWidget(m_heli->m_ccpm->NumCurvePoints); addWidget(m_heli->m_ccpm->PitchCurve->getCurveWidget());
addWidget(m_heli->m_ccpm->CurveValue1);
addWidget(m_heli->m_ccpm->CurveValue2);
addWidget(m_heli->m_ccpm->CurveValue3);
addWidget(m_heli->m_ccpm->CurveToGenerate);
addWidget(m_heli->m_ccpm->CurveSettings);
addWidget(m_heli->m_ccpm->ThrottleCurve);
addWidget(m_heli->m_ccpm->PitchCurve);
addWidget(m_heli->m_ccpm->ccpmAdvancedSettingsTable); addWidget(m_heli->m_ccpm->ccpmAdvancedSettingsTable);
} }

View File

@ -67,7 +67,6 @@ private:
void updateCustomAirframeUI(); void updateCustomAirframeUI();
void addToDirtyMonitor(); void addToDirtyMonitor();
void resetField(UAVObjectField * field); void resetField(UAVObjectField * field);
void resetMixer (MixerCurveWidget *mixer, int numElements, double maxvalue);
//void setMixerChannel(int channelNumber, bool channelIsMotor, QList<double> vector); //void setMixerChannel(int channelNumber, bool channelIsMotor, QList<double> vector);
@ -93,18 +92,7 @@ private slots:
void toggleElevator2(int index); void toggleElevator2(int index);
void toggleRudder2(int index); void toggleRudder2(int index);
void switchAirframeType(int index); void switchAirframeType(int index);
void resetFwMixer();
void resetMrMixer();
void resetGvFrontMixer();
void resetGvRearMixer();
void resetCt1Mixer();
void resetCt2Mixer();
void updateFwThrottleCurveValue(QList<double> list, double value);
void updateMrThrottleCurveValue(QList<double> list, double value);
void updateGvThrottle1CurveValue(QList<double> list, double value);
void updateGvThrottle2CurveValue(QList<double> list, double value);
void updateCustomThrottle1CurveValue(QList<double> list, double value);
void updateCustomThrottle2CurveValue(QList<double> list, double value);
void enableFFTest(); void enableFFTest();
void openHelp(); void openHelp();

View File

@ -0,0 +1,86 @@
/**
******************************************************************************
*
* @file doublespindelegate.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup ConfigPlugin Config Plugin
* @{
* @brief A double spinbox delegate
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include "dblspindelegate.h"
/**
Helper delegate for the custom mixer editor table.
*/
DoubleSpinDelegate::DoubleSpinDelegate(QObject *parent)
: QItemDelegate(parent)
{
m_min = 0.0;
m_max = 1.0;
m_decimals = 2;
m_step = 0.01;
}
QWidget *DoubleSpinDelegate::createEditor(QWidget *parent,
const QStyleOptionViewItem &/* option */,
const QModelIndex &/* index */) const
{
QDoubleSpinBox *editor = new QDoubleSpinBox(parent);
editor->setMinimum(m_min);
editor->setMaximum(m_max);
editor->setDecimals(m_decimals);
editor->setSingleStep(m_step);
connect(editor,SIGNAL(valueChanged(double)), this, SLOT(valueChanged()));
return editor;
}
void DoubleSpinDelegate::setEditorData(QWidget *editor,
const QModelIndex &index) const
{
double value = index.model()->data(index, Qt::EditRole).toDouble();
QDoubleSpinBox *spinBox = static_cast<QDoubleSpinBox*>(editor);
spinBox->setValue(value);
}
void DoubleSpinDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
const QModelIndex &index) const
{
QDoubleSpinBox *spinBox = static_cast<QDoubleSpinBox*>(editor);
spinBox->interpretText();
double value = spinBox->value();
model->setData(index, value, Qt::EditRole);
}
void DoubleSpinDelegate::updateEditorGeometry(QWidget *editor,
const QStyleOptionViewItem &option, const QModelIndex &/* index */) const
{
editor->setGeometry(option.rect);
}
void DoubleSpinDelegate::valueChanged()
{
emit ValueChanged();
}

View File

@ -0,0 +1,73 @@
/**
******************************************************************************
*
* @file doublespindelegate.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup ConfigPlugin Config Plugin
* @{
* @brief A double spinbox delegate
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef DOUBLESPINDELEGATE_H
#define DOUBLESPINDELEGATE_H
#include <QDoubleSpinBox>
#include <QItemDelegate>
namespace Ui {
class DoubleSpinDelegate;
}
class DoubleSpinDelegate : public QItemDelegate
{
Q_OBJECT
public:
DoubleSpinDelegate(QObject *parent = 0);
QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
const QModelIndex &index) const;
void setEditorData(QWidget *editor, const QModelIndex &index) const;
void setModelData(QWidget *editor, QAbstractItemModel *model,
const QModelIndex &index) const;
void updateEditorGeometry(QWidget *editor,
const QStyleOptionViewItem &option, const QModelIndex &index) const;
void setMin(double min) { m_min = min; }
void setMax(double max) { m_max = max; }
void setRange(double min, double max) { m_min = min; m_max = max; }
void setStep(double step) { m_step = step; }
void setDecimals(int decimals) { m_decimals = decimals; }
private:
double m_min;
double m_max;
double m_step;
int m_decimals;
signals:
void ValueChanged();
private slots:
void valueChanged();
};
#endif // DOUBLESPINDELEGATE_H

View File

@ -0,0 +1,474 @@
/**
******************************************************************************
*
* @file mixercurve.cpp
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup ConfigPlugin Config Plugin
* @{
* @brief A MixerCurve Gadget used to update settings in the firmware
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <QtGui/QWidget>
#include <QResizeEvent>
#include <math.h>
#include "mixercurve.h"
#include "dblspindelegate.h"
MixerCurve::MixerCurve(QWidget *parent) :
QFrame(parent),
m_mixerUI(new Ui::MixerCurve)
{
m_mixerUI->setupUi(this);
// setup some convienence pointers
m_curve = m_mixerUI->CurveWidget;
m_settings = m_mixerUI->CurveSettings;
m_mixerUI->SettingsGroup->hide();
m_curve->showCommands(false);
m_curve->showCommand("Reset", false);
m_curve->showCommand("Popup", false);
m_curve->showCommand("Commands", false);
// create our spin delegate
m_spinDelegate = new DoubleSpinDelegate();
// set the default mixer type
setMixerType(MixerCurve::MIXERCURVE_THROTTLE);
// setup and turn off advanced mode
CommandActivated();
// paint the ui
UpdateCurveUI();
// wire up our signals
connect(m_mixerUI->CurveType, SIGNAL(currentIndexChanged(int)), this, SLOT(CurveTypeChanged()));
connect(m_mixerUI->ResetCurve, SIGNAL(clicked()), this, SLOT(ResetCurve()));
connect(m_mixerUI->PopupCurve, SIGNAL(clicked()),this,SLOT(PopupCurve()));
connect(m_mixerUI->GenerateCurve, SIGNAL(clicked()), this, SLOT(GenerateCurve()));
connect(m_curve, SIGNAL(curveUpdated()), this, SLOT(UpdateSettingsTable()));
connect(m_curve, SIGNAL(commandActivated(Node*)),this, SLOT(CommandActivated(Node*)));
connect(m_settings, SIGNAL(cellChanged(int,int)), this, SLOT(SettingsTableChanged()));
connect(m_mixerUI->CurveMin, SIGNAL(valueChanged(double)), this, SLOT(CurveMinChanged(double)));
connect(m_mixerUI->CurveMax, SIGNAL(valueChanged(double)), this, SLOT(CurveMaxChanged(double)));
connect(m_mixerUI->CurveStep, SIGNAL(valueChanged(double)), this, SLOT(GenerateCurve()));
}
MixerCurve::~MixerCurve()
{
delete m_mixerUI;
delete m_spinDelegate;
}
void MixerCurve::setMixerType(MixerCurveType curveType)
{
m_curveType = curveType;
m_mixerUI->CurveMin->setMaximum(1.0);
m_mixerUI->CurveMax->setMaximum(1.0);
switch (m_curveType) {
case MixerCurve::MIXERCURVE_THROTTLE:
{
m_mixerUI->SettingsGroup->setTitle("Throttle Curve");
m_curve->setRange(0.0, 1.0);
m_mixerUI->CurveMin->setMinimum(0.0);
m_mixerUI->CurveMax->setMinimum(0.0);
break;
}
case MixerCurve::MIXERCURVE_PITCH:
{
m_mixerUI->SettingsGroup->setTitle("Pitch Curve");
m_curve->setRange(-1.0, 1.0);
m_curve->setPositiveColor("#0000aa", "#0000aa");
m_mixerUI->CurveMin->setMinimum(-1.0);
m_mixerUI->CurveMax->setMinimum(-1.0);
break;
}
}
m_spinDelegate->setRange(m_mixerUI->CurveMin->minimum(), m_mixerUI->CurveMax->maximum());
for (int i=0; i<MixerCurveWidget::NODE_NUMELEM; i++) {
m_settings->setItemDelegateForRow(i, m_spinDelegate);
}
ResetCurve();
}
void MixerCurve::ResetCurve()
{
m_mixerUI->CurveMin->setValue(m_mixerUI->CurveMin->minimum());
m_mixerUI->CurveMax->setValue(m_mixerUI->CurveMax->maximum());
m_mixerUI->CurveType->setCurrentIndex(m_mixerUI->CurveType->findText("Linear"));
initLinearCurve(MixerCurveWidget::NODE_NUMELEM, getCurveMax(), getCurveMin());
m_curve->activateCommand("Linear");
UpdateSettingsTable();
}
void MixerCurve::PopupCurve()
{
if (!m_curve->isCommandActive("Popup")) {
m_mixerUI->SettingsGroup->show();
m_mixerUI->PopupCurve->hide();
PopupWidget* popup = new PopupWidget();
popup->popUp(this);
m_mixerUI->SettingsGroup->hide();
m_mixerUI->PopupCurve->show();
m_curve->showCommands(false);
}
}
void MixerCurve::UpdateCurveUI()
{
//get the user settings
QString curveType = m_mixerUI->CurveType->currentText();
m_curve->activateCommand(curveType);
bool cmdsActive = m_curve->isCommandActive("Commands");
m_curve->showCommand("StepPlus", cmdsActive && curveType != "Linear");
m_curve->showCommand("StepMinus", cmdsActive && curveType != "Linear");
m_curve->showCommand("StepValue", cmdsActive && curveType != "Linear");
m_mixerUI->CurveStep->setMinimum(0.0);
m_mixerUI->CurveStep->setMaximum(100.0);
m_mixerUI->CurveStep->setSingleStep(1.00);
//set default visible
m_mixerUI->minLabel->setVisible(true);
m_mixerUI->CurveMin->setVisible(true);
m_mixerUI->maxLabel->setVisible(false);
m_mixerUI->CurveMax->setVisible(false);
m_mixerUI->stepLabel->setVisible(false);
m_mixerUI->CurveStep->setVisible(false);
if ( curveType.compare("Flat")==0)
{
m_mixerUI->minLabel->setVisible(false);
m_mixerUI->CurveMin->setVisible(false);
m_mixerUI->stepLabel->setVisible(true);
m_mixerUI->CurveStep->setVisible(true);
m_mixerUI->CurveStep->setMinimum(m_mixerUI->CurveMin->minimum());
m_mixerUI->CurveStep->setMaximum(m_mixerUI->CurveMax->maximum());
m_mixerUI->CurveStep->setSingleStep(0.01);
m_mixerUI->CurveStep->setValue(m_mixerUI->CurveMax->value() / 2);
}
if ( curveType.compare("Linear")==0)
{
m_mixerUI->maxLabel->setVisible(true);
m_mixerUI->CurveMax->setVisible(true);
}
if ( curveType.compare("Step")==0)
{
m_mixerUI->maxLabel->setVisible(true);
m_mixerUI->CurveMax->setVisible(true);
m_mixerUI->stepLabel->setText("Step at");
m_mixerUI->stepLabel->setVisible(true);
m_mixerUI->CurveStep->setVisible(true);
m_mixerUI->CurveStep->setMinimum(1.0);
}
if ( curveType.compare("Exp")==0)
{
m_mixerUI->maxLabel->setVisible(true);
m_mixerUI->CurveMax->setVisible(true);
m_mixerUI->stepLabel->setText("Power");
m_mixerUI->stepLabel->setVisible(true);
m_mixerUI->CurveStep->setVisible(true);
m_mixerUI->CurveStep->setMinimum(1.0);
}
if ( curveType.compare("Log")==0)
{
m_mixerUI->maxLabel->setVisible(true);
m_mixerUI->CurveMax->setVisible(true);
m_mixerUI->stepLabel->setText("Power");
m_mixerUI->stepLabel->setVisible(true);
m_mixerUI->CurveStep->setVisible(true);
m_mixerUI->CurveStep->setMinimum(1.0);
}
GenerateCurve();
}
void MixerCurve::GenerateCurve()
{
double scale;
double newValue;
//get the user settings
double value1 = getCurveMin();
double value2 = getCurveMax();
double value3 = getCurveStep();
m_curve->setCommandText("StepValue", QString("%0").arg(value3));
QString CurveType = m_mixerUI->CurveType->currentText();
QList<double> points;
for (int i=0; i<MixerCurveWidget::NODE_NUMELEM; i++)
{
scale =((double)i/(double)(MixerCurveWidget::NODE_NUMELEM - 1));
if ( CurveType.compare("Flat")==0)
{
points.append(value3);
}
if ( CurveType.compare("Linear")==0)
{
newValue =value1 +(scale*(value2-value1));
points.append(newValue);
}
if ( CurveType.compare("Step")==0)
{
if (scale*100<value3)
{
points.append(value1);
}
else
{
points.append(value2);
}
}
if ( CurveType.compare("Exp")==0)
{
newValue =value1 +(((exp(scale*(value3/10))-1))/(exp((value3/10))-1)*(value2-value1));
points.append(newValue);
}
if ( CurveType.compare("Log")==0)
{
newValue = value1 +(((log(scale*(value3*2)+1))/(log(1+(value3*2))))*(value2-value1));
points.append(newValue);
}
}
setCurve(&points);
}
/**
Wrappers for mixercurvewidget.
*/
void MixerCurve::initCurve (const QList<double>* points)
{
m_curve->setCurve(points);
UpdateSettingsTable();
}
QList<double> MixerCurve::getCurve()
{
return m_curve->getCurve();
}
void MixerCurve::initLinearCurve(int numPoints, double maxValue, double minValue)
{
setMin(minValue);
setMax(maxValue);
m_curve->initLinearCurve(numPoints, maxValue, minValue);
if (m_spinDelegate)
m_spinDelegate->setRange(minValue, maxValue);
}
void MixerCurve::setCurve(const QList<double>* points)
{
m_curve->setCurve(points);
UpdateSettingsTable();
}
void MixerCurve::setMin(double value)
{
//m_curve->setMin(value);
m_mixerUI->CurveMin->setMinimum(value);
}
double MixerCurve::getMin()
{
return m_curve->getMin();
}
void MixerCurve::setMax(double value)
{
//m_curve->setMax(value);
m_mixerUI->CurveMax->setMaximum(value);
}
double MixerCurve::getMax()
{
return m_curve->getMax();
}
double MixerCurve::setRange(double min, double max)
{
return m_curve->setRange(min, max);
}
double MixerCurve::getCurveMin()
{
return m_mixerUI->CurveMin->value();
}
double MixerCurve::getCurveMax()
{
return m_mixerUI->CurveMax->value();
}
double MixerCurve::getCurveStep()
{
return m_mixerUI->CurveStep->value();
}
void MixerCurve::UpdateSettingsTable()
{
QList<double> points = m_curve->getCurve();
int ptCnt = points.count();
for (int i=0; i<ptCnt; i++)
{
QTableWidgetItem* item = m_settings->item(i, 0);
if (item)
item->setText(QString().sprintf("%.2f",points.at( (ptCnt - 1) - i )));
}
}
void MixerCurve::SettingsTableChanged()
{
QList<double> points;
for (int i=0; i < m_settings->rowCount(); i++)
{
QTableWidgetItem* item = m_settings->item(i, 0);
if (item)
points.push_front(item->text().toDouble());
}
m_mixerUI->CurveMin->setValue(points.first());
m_mixerUI->CurveMax->setValue(points.last());
m_curve->setCurve(&points);
}
void MixerCurve::CommandActivated(Node* node)
{
QString name = (node) ? node->getName() : "Reset";
if (name == "Reset") {
ResetCurve();
m_curve->showCommands(false);
}
else if (name == "Commands") {
}
else if (name == "Popup" ) {
PopupCurve();
}
else if (name == "Linear") {
m_mixerUI->CurveType->setCurrentIndex(m_mixerUI->CurveType->findText("Linear"));
}
else if (name == "Log") {
m_mixerUI->CurveType->setCurrentIndex(m_mixerUI->CurveType->findText("Log"));
}
else if (name == "Exp") {
m_mixerUI->CurveType->setCurrentIndex(m_mixerUI->CurveType->findText("Exp"));
}
else if (name == "Flat") {
m_mixerUI->CurveType->setCurrentIndex(m_mixerUI->CurveType->findText("Flat"));
}
else if (name == "Step") {
m_mixerUI->CurveType->setCurrentIndex(m_mixerUI->CurveType->findText("Step"));
}
else if (name == "MinPlus") {
m_mixerUI->CurveMin->stepUp();
}
else if (name == "MinMinus") {
m_mixerUI->CurveMin->stepDown();
}
else if (name == "MaxPlus") {
m_mixerUI->CurveMax->stepUp();
}
else if (name == "MaxMinus"){
m_mixerUI->CurveMax->stepDown();
}
else if (name == "StepPlus") {
m_mixerUI->CurveStep->stepUp();
m_curve->setCommandText("StepValue", QString("%0").arg(getCurveStep()));
}
else if (name == "StepMinus") {
m_mixerUI->CurveStep->stepDown();
m_curve->setCommandText("StepValue", QString("%0").arg(getCurveStep()));
}
GenerateCurve();
}
void MixerCurve::CurveTypeChanged()
{
// setup the ui for this curvetype
UpdateCurveUI();
}
void MixerCurve::CurveMinChanged(double value)
{
QList<double> points = m_curve->getCurve();
points.removeFirst();
points.push_front(value);
setCurve(&points);
}
void MixerCurve::CurveMaxChanged(double value)
{
// the max changed so redraw the curve
// mixercurvewidget::setCurve will trim any points above max
QList<double> points = m_curve->getCurve();
points.removeLast();
points.append(value);
setCurve(&points);
}
void MixerCurve::showEvent(QShowEvent *event)
{
Q_UNUSED(event);
m_settings->resizeColumnsToContents();
m_settings->setColumnWidth(0,(m_settings->width()- m_settings->verticalHeader()->width()));
int h = (m_settings->height() - m_settings->horizontalHeader()->height()) / m_settings->rowCount();
for (int i=0; i<m_settings->rowCount(); i++)
m_settings->setRowHeight(i, h);
m_curve->showEvent(event);
}
void MixerCurve::resizeEvent(QResizeEvent* event)
{
m_settings->resizeColumnsToContents();
m_settings->setColumnWidth(0,(m_settings->width() - m_settings->verticalHeader()->width()));
int h = (m_settings->height() - m_settings->horizontalHeader()->height()) / m_settings->rowCount();
for (int i=0; i<m_settings->rowCount(); i++)
m_settings->setRowHeight(i, h);
m_curve->resizeEvent(event);
}

View File

@ -0,0 +1,103 @@
/**
******************************************************************************
*
* @file mixercurve.h
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
* @addtogroup GCSPlugins GCS Plugins
* @{
* @addtogroup ConfigPlugin Config Plugin
* @{
* @brief A MixerCurve Gadget used to update settings in the firmware
*****************************************************************************/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef MIXERCURVE_H
#define MIXERCURVE_H
#include <QFrame>
#include <QtGui/QWidget>
#include <QList>
#include <QTableWidget>
#include "ui_mixercurve.h"
#include "mixercurvewidget.h"
#include "dblspindelegate.h"
#include "uavobjectwidgetutils_global.h"
#include "uavobjectwidgetutils/popupwidget.h"
namespace Ui {
class MixerCurve;
}
class MixerCurve : public QFrame
{
Q_OBJECT
public:
explicit MixerCurve(QWidget *parent = 0);
~MixerCurve();
/* Enumeration options for ThrottleCurves */
typedef enum { MIXERCURVE_THROTTLE=0, MIXERCURVE_PITCH=1 } MixerCurveType;
void setMixerType(MixerCurveType curveType);
void initCurve (const QList<double>* points);
QList<double> getCurve();
void initLinearCurve(int numPoints, double maxValue = 1, double minValue = 0);
void setCurve(const QList<double>* points);
void setMin(double value);
double getMin();
void setMax(double value);
double getMax();
double getCurveMin();
double getCurveMax();
double getCurveStep();
double setRange(double min, double max);
MixerCurveWidget* getCurveWidget() { return m_curve; }
signals:
protected:
void showEvent(QShowEvent *event);
void resizeEvent(QResizeEvent *event);
public slots:
void ResetCurve();
void PopupCurve();
void GenerateCurve();
void UpdateSettingsTable();
private slots:
void CommandActivated(Node* node = 0);
void SettingsTableChanged();
void CurveTypeChanged();
void CurveMinChanged(double value);
void CurveMaxChanged(double value);
void UpdateCurveUI();
private:
Ui::MixerCurve* m_mixerUI;
MixerCurveWidget* m_curve;
QTableWidget* m_settings;
MixerCurveType m_curveType;
DoubleSpinDelegate* m_spinDelegate;
};
#endif // MIXERCURVE_H

View File

@ -0,0 +1,369 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MixerCurve</class>
<widget class="QFrame" name="MixerCurve">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>543</width>
<height>467</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>1</horstretch>
<verstretch>1</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>441</width>
<height>321</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>1000</width>
<height>1000</height>
</size>
</property>
<property name="baseSize">
<size>
<width>300</width>
<height>300</height>
</size>
</property>
<property name="windowTitle">
<string>MixerCurve</string>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" rowspan="2">
<widget class="QGroupBox" name="SettingsGroup">
<property name="maximumSize">
<size>
<width>150</width>
<height>16777215</height>
</size>
</property>
<property name="title">
<string>Throttle Curve</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTableWidget" name="CurveSettings">
<property name="maximumSize">
<size>
<width>100</width>
<height>200</height>
</size>
</property>
<property name="font">
<font>
<pointsize>8</pointsize>
</font>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="autoScroll">
<bool>false</bool>
</property>
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="rowCount">
<number>5</number>
</property>
<property name="columnCount">
<number>1</number>
</property>
<row>
<property name="text">
<string>Max</string>
</property>
</row>
<row>
<property name="text">
<string>4</string>
</property>
</row>
<row>
<property name="text">
<string>3</string>
</property>
</row>
<row>
<property name="text">
<string>2</string>
</property>
</row>
<row>
<property name="text">
<string>Min</string>
</property>
</row>
<column>
<property name="text">
<string>Value</string>
</property>
<property name="textAlignment">
<set>AlignJustify|AlignVCenter</set>
</property>
</column>
<item row="0" column="0">
<property name="text">
<string>1.0</string>
</property>
</item>
<item row="1" column="0">
<property name="text">
<string>.75</string>
</property>
</item>
<item row="2" column="0">
<property name="text">
<string>.50</string>
</property>
</item>
<item row="3" column="0">
<property name="text">
<string>.25</string>
</property>
</item>
<item row="4" column="0">
<property name="text">
<string>.00</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QComboBox" name="CurveType">
<item>
<property name="text">
<string>Linear</string>
</property>
</item>
<item>
<property name="text">
<string>Log</string>
</property>
</item>
<item>
<property name="text">
<string>Exp</string>
</property>
</item>
<item>
<property name="text">
<string>Flat</string>
</property>
</item>
<item>
<property name="text">
<string>Step</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QPushButton" name="GenerateCurve">
<property name="text">
<string>Generate</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="minLabel">
<property name="text">
<string>Min</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="CurveMin">
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
<property name="correctionMode">
<enum>QAbstractSpinBox::CorrectToNearestValue</enum>
</property>
<property name="minimum">
<double>-1.000000000000000</double>
</property>
<property name="maximum">
<double>1.000000000000000</double>
</property>
<property name="singleStep">
<double>0.010000000000000</double>
</property>
<property name="value">
<double>0.000000000000000</double>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="maxLabel">
<property name="text">
<string>Max</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="CurveMax">
<property name="correctionMode">
<enum>QAbstractSpinBox::CorrectToNearestValue</enum>
</property>
<property name="minimum">
<double>0.000000000000000</double>
</property>
<property name="maximum">
<double>1.000000000000000</double>
</property>
<property name="singleStep">
<double>0.010000000000000</double>
</property>
<property name="value">
<double>1.000000000000000</double>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="stepLabel">
<property name="text">
<string>Step</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="CurveStep">
<property name="correctionMode">
<enum>QAbstractSpinBox::CorrectToNearestValue</enum>
</property>
<property name="value">
<double>50.000000000000000</double>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
<zorder>GenerateCurve</zorder>
<zorder>CurveSettings</zorder>
<zorder>CurveType</zorder>
<zorder>CurveMin</zorder>
<zorder>minLabel</zorder>
<zorder>CurveMax</zorder>
<zorder>maxLabel</zorder>
<zorder>CurveStep</zorder>
<zorder>stepLabel</zorder>
<zorder>verticalSpacer</zorder>
</widget>
</item>
<item row="0" column="1">
<widget class="MixerCurveWidget" name="CurveWidget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>5</horstretch>
<verstretch>5</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>50</width>
<height>50</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>1000</width>
<height>1000</height>
</size>
</property>
<property name="sizeIncrement">
<size>
<width>10</width>
<height>10</height>
</size>
</property>
<property name="baseSize">
<size>
<width>200</width>
<height>200</height>
</size>
</property>
<property name="font">
<font>
<pointsize>7</pointsize>
</font>
</property>
</widget>
</item>
<item row="1" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="ResetCurve">
<property name="text">
<string>Reset</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="PopupCurve">
<property name="text">
<string>Advanced...</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>MixerCurveWidget</class>
<extends>QWidget</extends>
<header location="global">uavobjectwidgetutils/mixercurvewidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View File

@ -843,7 +843,7 @@ void ConfigTaskWidget::connectWidgetUpdatesToSlot(QWidget * widget,const char* f
} }
else if(MixerCurveWidget * cb=qobject_cast<MixerCurveWidget *>(widget)) else if(MixerCurveWidget * cb=qobject_cast<MixerCurveWidget *>(widget))
{ {
connect(cb,SIGNAL(curveUpdated(QList<double>,double)),this,function); connect(cb,SIGNAL(curveUpdated()),this,function);
} }
else if(QTableWidget * cb=qobject_cast<QTableWidget *>(widget)) else if(QTableWidget * cb=qobject_cast<QTableWidget *>(widget))
{ {
@ -886,7 +886,7 @@ void ConfigTaskWidget::disconnectWidgetUpdatesToSlot(QWidget * widget,const char
} }
else if(MixerCurveWidget * cb=qobject_cast<MixerCurveWidget *>(widget)) else if(MixerCurveWidget * cb=qobject_cast<MixerCurveWidget *>(widget))
{ {
disconnect(cb,SIGNAL(curveUpdated(QList<double>,double)),this,function); disconnect(cb,SIGNAL(curveUpdated()),this,function);
} }
else if(QTableWidget * cb=qobject_cast<QTableWidget *>(widget)) else if(QTableWidget * cb=qobject_cast<QTableWidget *>(widget))
{ {

View File

@ -83,7 +83,7 @@ void Edge::adjust()
prepareGeometryChange(); prepareGeometryChange();
if (length > qreal(20.)) { if (length > qreal(20.)) {
QPointF edgeOffset((line.dx() * 10) / length, (line.dy() * 10) / length); QPointF edgeOffset((line.dx() * 13) / length, (line.dy() * 13) / length);
sourcePoint = line.p1() + edgeOffset; sourcePoint = line.p1() + edgeOffset;
destPoint = line.p2() - edgeOffset; destPoint = line.p2() - edgeOffset;
} else { } else {

View File

@ -29,6 +29,7 @@
#include <QGraphicsSceneMouseEvent> #include <QGraphicsSceneMouseEvent>
#include <QPainter> #include <QPainter>
#include <QStyleOption> #include <QStyleOption>
#include <QColor>
#include <QDebug> #include <QDebug>
#include "mixercurveline.h" #include "mixercurveline.h"
@ -42,7 +43,18 @@ Node::Node(MixerCurveWidget *graphWidget)
setFlag(ItemSendsGeometryChanges); setFlag(ItemSendsGeometryChanges);
setCacheMode(DeviceCoordinateCache); setCacheMode(DeviceCoordinateCache);
setZValue(-1); setZValue(-1);
cmdActive = false;
vertical = false; vertical = false;
cmdNode = false;
cmdToggle = true;
drawNode = true;
drawText = true;
posColor0 = "#1c870b"; //greenish?
posColor1 = "#116703"; //greenish?
negColor0 = "#aa0000"; //red
negColor1 = "#aa0000"; //red
} }
void Node::addEdge(Edge *edge) void Node::addEdge(Edge *edge)
@ -59,48 +71,74 @@ QList<Edge *> Node::edges() const
QRectF Node::boundingRect() const QRectF Node::boundingRect() const
{ {
qreal adjust = 2; return cmdNode ? QRectF(-4, -4, 15, 10) : QRectF(-13, -13, 26, 26);
return QRectF(-12 - adjust, -12 - adjust,
28 + adjust, 28 + adjust);
} }
QPainterPath Node::shape() const QPainterPath Node::shape() const
{ {
QPainterPath path; QPainterPath path;
path.addEllipse(-12, -12, 25, 25); path.addEllipse(boundingRect());
return path; return path;
} }
void Node::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *) void Node::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *)
{ {
/* QString text = cmdNode ? cmdText : QString().sprintf("%.2f", value());
painter->setPen(Qt::NoPen);
painter->setBrush(Qt::darkGray);
painter->drawEllipse(-7, -7, 20, 20);
*/
if (drawNode) {
QRadialGradient gradient(-3, -3, 10); QRadialGradient gradient(-3, -3, 10);
if (option->state & QStyle::State_Sunken) { if (option->state & QStyle::State_Sunken) {
gradient.setCenter(3, 3); gradient.setCenter(3, 3);
gradient.setFocalPoint(3, 3); gradient.setFocalPoint(3, 3);
gradient.setColorAt(1, QColor("#1c870b").light(120));
gradient.setColorAt(0, QColor("#116703").light(120)); gradient.setColorAt(1, Qt::darkBlue);
gradient.setColorAt(0, Qt::darkBlue);
} else { } else {
gradient.setColorAt(0, "#1c870b"); if (cmdNode) {
gradient.setColorAt(1, "#116703"); gradient.setColorAt(0, cmdActive ? posColor0 : negColor0);
gradient.setColorAt(1, cmdActive ? posColor1 : negColor1);
}
else {
if (value() < 0) {
gradient.setColorAt(0, negColor0);
gradient.setColorAt(1, negColor1);
}
else {
gradient.setColorAt(0, posColor0);
gradient.setColorAt(1, posColor1);
}
}
} }
painter->setBrush(gradient); painter->setBrush(gradient);
painter->setPen(QPen(Qt::black, 0)); painter->setPen(QPen(Qt::black, 0));
painter->drawEllipse(-12, -12, 25, 25); painter->drawEllipse(boundingRect());
painter->setPen(QPen(Qt::white, 0)); if (!image.isNull())
painter->drawText(-10, 3, QString().sprintf("%.2f", value())); painter->drawImage(boundingRect().adjusted(1,1,-1,-1), image);
}
if (drawText) {
painter->setPen(QPen(drawNode ? Qt::white : Qt::black, 0));
if (cmdNode) {
painter->drawText(0,4,text);
}
else {
painter->drawText( (value() < 0) ? -13 : -11, 4, text);
}
}
} }
void Node::verticalMove(bool flag){ void Node::verticalMove(bool flag){
vertical = flag; vertical = flag;
} }
void Node::commandNode(bool enable){
cmdNode = enable;
}
void Node::commandText(QString text){
cmdText = text;
}
double Node::value() { double Node::value() {
double h = graph->sceneRect().height(); double h = graph->sceneRect().height();
double ratio = (h - pos().y()) / h; double ratio = (h - pos().y()) / h;
@ -149,6 +187,10 @@ QVariant Node::itemChange(GraphicsItemChange change, const QVariant &val)
void Node::mousePressEvent(QGraphicsSceneMouseEvent *event) void Node::mousePressEvent(QGraphicsSceneMouseEvent *event)
{ {
if (cmdNode) {
graph->cmdActivated(this);
//return;
}
update(); update();
QGraphicsItem::mousePressEvent(event); QGraphicsItem::mousePressEvent(event);
} }

View File

@ -29,6 +29,7 @@
#define MIXERCURVEPOINT_H #define MIXERCURVEPOINT_H
#include <QGraphicsItem> #include <QGraphicsItem>
#include <QColor>
#include <QList> #include <QList>
class Edge; class Edge;
@ -48,8 +49,25 @@ public:
enum { Type = UserType + 1 }; enum { Type = UserType + 1 };
int type() const { return Type; } int type() const { return Type; }
void setName(QString name) { cmdName = name; }
const QString& getName() { return cmdName; }
void verticalMove(bool flag); void verticalMove(bool flag);
void commandNode(bool enable);
void commandText(QString text);
int getCommandIndex() { return index; }
void setCommandIndex(int idx) { index = idx; }
bool getCommandActive() { return cmdActive; }
void setCommandActive(bool enable) { cmdActive = enable; }
void setToggle(bool enable) { cmdToggle = enable; }
bool getToggle() { return cmdToggle; }
void setPositiveColor(QString color0 = "#00ff00", QString color1 = "#00ff00") { posColor0 = color0; posColor1 = color1; }
void setNegativeColor(QString color0 = "#ff0000", QString color1 = "#ff0000") { negColor0 = color0; negColor1 = color1; }
void setImage(QImage img) { image = img; }
void setDrawNode(bool draw) { drawNode = draw; }
void setDrawText(bool draw) { drawText = draw; }
QRectF boundingRect() const; QRectF boundingRect() const;
QPainterPath shape() const; QPainterPath shape() const;
@ -57,6 +75,9 @@ public:
double value(); double value();
signals:
void commandActivated(QString text);
protected: protected:
QVariant itemChange(GraphicsItemChange change, const QVariant &val); QVariant itemChange(GraphicsItemChange change, const QVariant &val);
@ -64,11 +85,24 @@ protected:
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
private: private:
QList<Edge *> edgeList; QList<Edge *> edgeList;
QPointF newPos; QPointF newPos;
MixerCurveWidget* graph; MixerCurveWidget* graph;
QString posColor0;
QString posColor1;
QString negColor0;
QString negColor1;
QImage image;
bool vertical; bool vertical;
QString cmdName;
bool cmdActive;
bool cmdNode;
bool cmdToggle;
QString cmdText;
bool drawNode;
bool drawText;
int index;
}; };

View File

@ -29,6 +29,7 @@
#include "mixercurveline.h" #include "mixercurveline.h"
#include "mixercurvepoint.h" #include "mixercurvepoint.h"
#include <QObject>
#include <QtGui> #include <QtGui>
#include <QDebug> #include <QDebug>
@ -57,7 +58,6 @@ MixerCurveWidget::MixerCurveWidget(QWidget *parent) : QGraphicsView(parent)
curveMin=0.0; curveMin=0.0;
curveMax=1.0; curveMax=1.0;
setFrameStyle(QFrame::NoFrame); setFrameStyle(QFrame::NoFrame);
setStyleSheet("background:transparent"); setStyleSheet("background:transparent");
@ -73,7 +73,193 @@ MixerCurveWidget::MixerCurveWidget(QWidget *parent) : QGraphicsView(parent)
scene->setSceneRect(plot->boundingRect()); scene->setSceneRect(plot->boundingRect());
setScene(scene); setScene(scene);
posColor0 = "#1c870b"; //greenish?
posColor1 = "#116703"; //greenish?
negColor0 = "#ff0000"; //red
negColor1 = "#ff0000"; //red
// commmand nodes
// reset
Node* node = getCommandNode(0);
node->setName("Reset");
node->setToolTip("Reset Curve to Defaults");
node->setToggle(false);
node->setPositiveColor("#ffffff", "#ffffff"); //white
node->setNegativeColor("#ffffff", "#ffffff");
scene->addItem(node);
// linear
node = getCommandNode(1);
node->setName("Linear");
node->setToolTip("Generate a Linear Curve");
QImage img = QImage(":/core/images/curve_linear.png");
if (!img.isNull())
node->setImage(img);
else
node->commandText("/");
scene->addItem(node);
// log
node = getCommandNode(2);
node->setName("Log");
node->setToolTip("Generate a Logarithmic Curve");
img = QImage(":/core/images/curve_log.png");
if (!img.isNull())
node->setImage(img);
else
node->commandText("(");
scene->addItem(node);
// exp
node = getCommandNode(3);
node->setName("Exp");
node->setToolTip("Generate an Exponential Curve");
img = QImage(":/core/images/curve_exp.png");
if (!img.isNull())
node->setImage(img);
else
node->commandText(")");
scene->addItem(node);
// flat
node = getCommandNode(4);
node->setName("Flat");
node->setToolTip("Generate a Flat Curve");
img = QImage(":/core/images/curve_flat.png");
if (!img.isNull())
node->setImage(img);
else
node->commandText("--");
scene->addItem(node);
// step
node = getCommandNode(5);
node->setName("Step");
node->setToolTip("Generate a Stepped Curve");
img = QImage(":/core/images/curve_step.png");
if (!img.isNull())
node->setImage(img);
else
node->commandText("z");
scene->addItem(node);
// curve min/max nodes
node = getCommandNode(6);
node->setName("MinPlus");
node->setToolTip("Increase Curve Minimum");
img = QImage(":/core/images/curve_plus.png");
if (!img.isNull())
node->setImage(img);
else
node->commandText("+");
node->setToggle(false);
node->setPositiveColor("#00aa00", "#00aa00"); //green
node->setNegativeColor("#00aa00", "#00aa00");
scene->addItem(node);
node = getCommandNode(7);
node->setName("MinMinus");
node->setToolTip("Decrease Curve Minimum");
img = QImage(":/core/images/curve_minus.png");
if (!img.isNull())
node->setImage(img);
else
node->commandText("-");
node->setToggle(false);
node->setPositiveColor("#aa0000", "#aa0000"); //red
node->setNegativeColor("#aa0000", "#aa0000");
scene->addItem(node);
node = getCommandNode(8);
node->setName("MaxPlus");
node->setToolTip("Increase Curve Maximum");
img = QImage(":/core/images/curve_plus.png");
if (!img.isNull())
node->setImage(img);
else
node->commandText("+");
node->setToggle(false);
node->setPositiveColor("#00aa00", "#00aa00"); //green
node->setNegativeColor("#00aa00", "#00aa00");
scene->addItem(node);
node = getCommandNode(9);
node->setName("MaxMinus");
node->setToolTip("Decrease Curve Maximum");
img = QImage(":/core/images/curve_plus.png");
if (!img.isNull())
node->setImage(img);
else
node->commandText("-");
node->setToggle(false);
node->setPositiveColor("#aa0000", "#aa0000"); //red
node->setNegativeColor("#aa0000", "#aa0000");
scene->addItem(node);
node = getCommandNode(10);
node->setName("StepPlus");
node->setToolTip("Increase Step/Power Value");
img = QImage(":/core/images/curve_plus.png");
if (!img.isNull())
node->setImage(img);
else
node->commandText("+");
node->setToggle(false);
node->setPositiveColor("#00aa00", "#00aa00"); //green
node->setNegativeColor("#00aa00", "#00aa00");
scene->addItem(node);
node = getCommandNode(11);
node->setName("StepMinus");
node->setToolTip("Decrease Step/Power Value");
img = QImage(":/core/images/curve_minus.png");
if (!img.isNull())
node->setImage(img);
else
node->commandText("-");
node->setToggle(false);
node->setPositiveColor("#aa0000", "#aa0000"); //red
node->setNegativeColor("#aa0000", "#aa0000");
scene->addItem(node);
node = getCommandNode(12);
node->setName("StepValue");
node->setDrawNode(false);
node->setToolTip("Current Step/Power Value");
node->setToggle(false);
node->setPositiveColor("#0000aa", "#0000aa"); //blue
node->setNegativeColor("#0000aa", "#0000aa");
scene->addItem(node);
// commands toggle
node = getCommandNode(13);
node->setName("Commands");
node->setToolTip("Toggle Command Buttons On/Off");
node->setToggle(true);
node->setPositiveColor("#00aa00", "#00aa00"); //greenish
node->setNegativeColor("#000000", "#000000");
scene->addItem(node);
// popup
node = getCommandNode(14);
node->setName("Popup");
node->setToolTip("Advanced Mode...");
node->commandText("");
node->setToggle(false);
node->setPositiveColor("#ff0000", "#ff0000"); //red
node->setNegativeColor("#ff0000", "#ff0000");
scene->addItem(node);
resizeCommands();
initNodes(MixerCurveWidget::NODE_NUMELEM); initNodes(MixerCurveWidget::NODE_NUMELEM);
} }
MixerCurveWidget::~MixerCurveWidget() MixerCurveWidget::~MixerCurveWidget()
@ -83,6 +269,31 @@ MixerCurveWidget::~MixerCurveWidget()
while (!edgePool.isEmpty()) while (!edgePool.isEmpty())
delete edgePool.takeFirst(); delete edgePool.takeFirst();
while (!cmdNodePool.isEmpty())
delete cmdNodePool.takeFirst();
}
Node* MixerCurveWidget::getCommandNode(int index)
{
Node* node;
if (index >= 0 && index < cmdNodePool.count())
{
node = cmdNodePool.at(index);
}
else {
node = new Node(this);
node->commandNode(true);
node->commandText("");
node->setCommandIndex(index);
node->setActive(false);
node->setPositiveColor("#aaaa00", "#aaaa00");
node->setNegativeColor("#1c870b", "#116703");
cmdNodePool.append(node);
}
return node;
} }
Node* MixerCurveWidget::getNode(int index) Node* MixerCurveWidget::getNode(int index)
@ -99,7 +310,6 @@ Node* MixerCurveWidget::getNode(int index)
} }
return node; return node;
} }
Edge* MixerCurveWidget::getEdge(int index, Node* sourceNode, Node* destNode) Edge* MixerCurveWidget::getEdge(int index, Node* sourceNode, Node* destNode)
{ {
Edge* edge; Edge* edge;
@ -117,6 +327,26 @@ Edge* MixerCurveWidget::getEdge(int index, Node* sourceNode, Node* destNode)
return edge; return edge;
} }
void MixerCurveWidget::setPositiveColor(QString color0, QString color1)
{
posColor0 = color0;
posColor1 = color1;
for (int i=0; i<nodePool.count(); i++) {
Node* node = nodePool.at(i);
node->setPositiveColor(color0, color1);
}
}
void MixerCurveWidget::setNegativeColor(QString color0, QString color1)
{
negColor0 = color0;
negColor1 = color1;
for (int i=0; i<nodePool.count(); i++) {
Node* node = nodePool.at(i);
node->setNegativeColor(color0, color1);
}
}
/** /**
Init curve: create a (flat) curve with a specified number of points. Init curve: create a (flat) curve with a specified number of points.
@ -185,7 +415,7 @@ QList<double> MixerCurveWidget::getCurve() {
*/ */
void MixerCurveWidget::initLinearCurve(int numPoints, double maxValue, double minValue) void MixerCurveWidget::initLinearCurve(int numPoints, double maxValue, double minValue)
{ {
double range = setRange(minValue, maxValue); double range = maxValue - minValue; // setRange(minValue, maxValue);
QList<double> points; QList<double> points;
for (double i=0; i < (double)numPoints; i++) { for (double i=0; i < (double)numPoints; i++) {
@ -220,12 +450,14 @@ void MixerCurveWidget::setCurve(const QList<double>* points)
Node* node = nodeList.at(i); Node* node = nodeList.at(i);
node->setPos(w*i, h - (val*h)); node->setPos(w*i, h - (val*h));
node->verticalMove(true); node->verticalMove(true);
node->update();
} }
curveUpdating = false; curveUpdating = false;
update(); update();
emit curveUpdated(points, (double)0); emit curveUpdated();
} }
@ -235,32 +467,99 @@ void MixerCurveWidget::showEvent(QShowEvent *event)
// Thit fitInView method should only be called now, once the // Thit fitInView method should only be called now, once the
// widget is shown, otherwise it cannot compute its values and // widget is shown, otherwise it cannot compute its values and
// the result is usually a ahrsbargraph that is way too small. // the result is usually a ahrsbargraph that is way too small.
fitInView(plot, Qt::KeepAspectRatio);
QRectF rect = plot->boundingRect();
resizeCommands();
fitInView(rect.adjusted(-15,-15,15,15), Qt::KeepAspectRatio);
} }
void MixerCurveWidget::resizeEvent(QResizeEvent* event) void MixerCurveWidget::resizeEvent(QResizeEvent* event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
fitInView(plot, Qt::KeepAspectRatio);
QRectF rect = plot->boundingRect();
resizeCommands();
fitInView(rect.adjusted(-15,-15,15,15), Qt::KeepAspectRatio);
}
void MixerCurveWidget::resizeCommands()
{
QRectF rect = plot->boundingRect();
Node* node;
//popup
node = getCommandNode(14);
node->setPos((rect.left() + rect.width() / 2) - 20, rect.height() + 10);
//reset
node = getCommandNode(0);
node->setPos((rect.left() + rect.width() / 2) + 20, rect.height() + 10);
//commands on/off
node = getCommandNode(13);
node->setPos(rect.right() - 15, rect.bottomRight().x() - 14);
for (int i = 1; i<6; i++) {
node = getCommandNode(i);
//bottom right of widget
node->setPos(rect.right() - 130 + (i * 18), rect.bottomRight().x() - 14);
}
//curveminplus
node = getCommandNode(6);
node->setPos(rect.bottomLeft().x() + 15, rect.bottomLeft().y() - 10);
//curveminminus
node = getCommandNode(7);
node->setPos(rect.bottomLeft().x() + 15, rect.bottomLeft().y() + 5);
//curvemaxplus
node = getCommandNode(8);
node->setPos(rect.topRight().x() - 20, rect.topRight().y() - 7);
//curvemaxminus
node = getCommandNode(9);
node->setPos(rect.topRight().x() - 20, rect.topRight().y() + 8);
//stepplus
node = getCommandNode(10);
node->setPos(rect.bottomRight().x() - 40, rect.bottomRight().y() + 5);
//stepminus
node = getCommandNode(11);
node->setPos(rect.bottomRight().x() - 40, rect.bottomRight().y() + 15);
//step
node = getCommandNode(12);
node->setPos(rect.bottomRight().x() - 22, rect.bottomRight().y() + 9);
} }
void MixerCurveWidget::itemMoved(double itemValue) void MixerCurveWidget::itemMoved(double itemValue)
{ {
Q_UNUSED(itemValue);
if (!curveUpdating) { if (!curveUpdating) {
QList<double> curve = getCurve(); emit curveUpdated();
emit curveUpdated(&curve, itemValue);
} }
} }
void MixerCurveWidget::setMin(double value) void MixerCurveWidget::setMin(double value)
{ {
if (curveMin != value)
emit curveMinChanged(value);
curveMin = value; curveMin = value;
} }
void MixerCurveWidget::setMax(double value) void MixerCurveWidget::setMax(double value)
{ {
if (curveMax != value)
emit curveMaxChanged(value);
curveMax = value; curveMax = value;
} }
double MixerCurveWidget::getMin() double MixerCurveWidget::getMin()
{ {
return curveMin; return curveMin;
@ -275,3 +574,88 @@ double MixerCurveWidget::setRange(double min, double max)
curveMax = max; curveMax = max;
return curveMax - curveMin; return curveMax - curveMin;
} }
Node* MixerCurveWidget::getCmdNode(const QString& name)
{
Node* node = 0;
for (int i=0; i<cmdNodePool.count(); i++) {
Node* n = cmdNodePool.at(i);
if (n->getName() == name)
node = n;
}
return node;
}
void MixerCurveWidget::setCommandText(const QString& name, const QString& text)
{
for (int i=0; i<cmdNodePool.count(); i++) {
Node* n = cmdNodePool.at(i);
if (n->getName() == name) {
n->commandText(text);
n->update();
}
}
}
void MixerCurveWidget::activateCommand(const QString& name)
{
for (int i=1; i<cmdNodePool.count()-2; i++) {
Node* node = cmdNodePool.at(i);
node->setCommandActive(node->getName() == name);
node->update();
}
}
void MixerCurveWidget::showCommand(const QString& name, bool show)
{
Node* node = getCmdNode(name);
if (node) {
if (show)
node->show();
else
node->hide();
}
}
void MixerCurveWidget::showCommands(bool show)
{
for (int i=1; i<cmdNodePool.count()-2; i++) {
Node* node = cmdNodePool.at(i);
if (show)
node->show();
else
node->hide();
node->update();
}
}
bool MixerCurveWidget::isCommandActive(const QString& name)
{
bool active = false;
Node* node = getCmdNode(name);
if (node) {
active = node->getCommandActive();
}
return active;
}
void MixerCurveWidget::cmdActivated(Node* node)
{
if (node->getToggle()) {
if (node->getName() == "Commands") {
node->setCommandActive(!node->getCommandActive());
showCommands(node->getCommandActive());
}
else {
for (int i=1; i<cmdNodePool.count()-2; i++) {
Node* n = cmdNodePool.at(i);
n->setCommandActive(false);
n->update();
}
node->setCommandActive(true);
}
}
node->update();
emit commandActivated(node);
}

View File

@ -28,6 +28,7 @@
#ifndef MIXERCURVEWIDGET_H_ #ifndef MIXERCURVEWIDGET_H_
#define MIXERCURVEWIDGET_H_ #define MIXERCURVEWIDGET_H_
#include <QObject>
#include <QGraphicsView> #include <QGraphicsView>
#include <QtSvg/QSvgRenderer> #include <QtSvg/QSvgRenderer>
#include <QtSvg/QGraphicsSvgItem> #include <QtSvg/QGraphicsSvgItem>
@ -43,6 +44,9 @@ class UAVOBJECTWIDGETUTILS_EXPORT MixerCurveWidget : public QGraphicsView
public: public:
MixerCurveWidget(QWidget *parent = 0); MixerCurveWidget(QWidget *parent = 0);
~MixerCurveWidget(); ~MixerCurveWidget();
friend class MixerCurve;
void itemMoved(double itemValue); // Callback when a point is moved, to be updated void itemMoved(double itemValue); // Callback when a point is moved, to be updated
void initCurve (const QList<double>* points); void initCurve (const QList<double>* points);
QList<double> getCurve(); QList<double> getCurve();
@ -54,10 +58,22 @@ public:
double getMax(); double getMax();
double setRange(double min, double max); double setRange(double min, double max);
void cmdActivated(Node* node);
void activateCommand(const QString& name);
bool isCommandActive(const QString& name);
void showCommand(const QString& name, bool show);
void showCommands(bool show);
Node* getCmdNode(const QString& name);
void setCommandText(const QString& name, const QString& text);
static const int NODE_NUMELEM = 5; static const int NODE_NUMELEM = 5;
signals: signals:
void curveUpdated(const QList<double>* points, const double value); void curveUpdated();
void curveMinChanged(double value);
void curveMaxChanged(double value);
void commandActivated(Node* node);
private slots: private slots:
@ -65,17 +81,27 @@ private:
QGraphicsSvgItem *plot; QGraphicsSvgItem *plot;
QList<Node*> nodePool; QList<Node*> nodePool;
QList<Node*> cmdNodePool;
QList<Edge*> edgePool; QList<Edge*> edgePool;
QList<Node*> nodeList; QList<Node*> nodeList;
QList<double> points;
double curveMin; double curveMin;
double curveMax; double curveMax;
bool curveUpdating; bool curveUpdating;
QString posColor0;
QString posColor1;
QString negColor0;
QString negColor1;
void initNodes(int numPoints); void initNodes(int numPoints);
Node* getNode(int index); Node* getNode(int index);
Node* getCommandNode(int index);
Edge* getEdge(int index, Node* sourceNode, Node* destNode); Edge* getEdge(int index, Node* sourceNode, Node* destNode);
void setPositiveColor(QString color0 = "#00ff00", QString color1 = "#00ff00");
void setNegativeColor(QString color0 = "#ff0000", QString color1 = "#ff0000");
void resizeCommands();
protected: protected:
void showEvent(QShowEvent *event); void showEvent(QShowEvent *event);

View File

@ -0,0 +1,65 @@
#include "popupwidget.h"
#include <QtGui>
PopupWidget::PopupWidget(QWidget *parent) :
QDialog(parent)
{
m_widget = 0;
QVBoxLayout* mainLayout = new QVBoxLayout();
m_layout = new QHBoxLayout();
mainLayout->addLayout(m_layout);
QHBoxLayout* buttonLayout = new QHBoxLayout();
m_closeButton = new QPushButton(tr("Close"));
buttonLayout->addWidget(m_closeButton);
mainLayout->addLayout(buttonLayout);
setLayout(mainLayout);
connect(m_closeButton,SIGNAL(clicked()), this, SLOT(close()));
connect(this, SIGNAL(accepted()),this,SLOT(close()));
connect(this,SIGNAL(rejected()), this, SLOT(close()));
}
void PopupWidget::popUp(QWidget* widget)
{
setWidget(widget);
exec();
}
void PopupWidget::setWidget(QWidget* widget)
{
m_widget = widget;
m_widgetParent = widget->parentWidget();
m_layout->addWidget(m_widget);
}
bool PopupWidget::close()
{
closePopup();
return QDialog::close();
}
void PopupWidget::done(int result)
{
closePopup();
QDialog::done(result);
}
void PopupWidget::closePopup()
{
if (m_widget && m_widgetParent) {
if(QGroupBox * w =qobject_cast<QGroupBox *>(m_widgetParent))
{
w->layout()->addWidget(m_widget);
}
}
}

View File

@ -0,0 +1,42 @@
#ifndef POPUPWIDGET_H
#define POPUPWIDGET_H
#include <QtGui>
#include <QWidget>
#include <QDialog>
#include "uavobjectwidgetutils_global.h"
namespace Ui {
class PopupWidget;
}
class UAVOBJECTWIDGETUTILS_EXPORT PopupWidget : public QDialog
{
Q_OBJECT
public:
explicit PopupWidget(QWidget *parent = 0);
void popUp(QWidget* widget = 0);
void setWidget(QWidget* widget);
QWidget* getWidget() { return m_widget; }
QHBoxLayout* getLayout() { return m_layout; }
signals:
public slots:
bool close();
void done(int result);
private slots:
void closePopup();
private:
QHBoxLayout* m_layout;
QWidget* m_widget;
QWidget* m_widgetParent;
QPushButton* m_closeButton;
};
#endif // POPUPWIDGET_H

View File

@ -10,13 +10,17 @@ HEADERS += uavobjectwidgetutils_global.h \
mixercurvewidget.h \ mixercurvewidget.h \
mixercurvepoint.h \ mixercurvepoint.h \
mixercurveline.h \ mixercurveline.h \
smartsavebutton.h smartsavebutton.h \
popupwidget.h
SOURCES += uavobjectwidgetutilsplugin.cpp \ SOURCES += uavobjectwidgetutilsplugin.cpp \
configtaskwidget.cpp \ configtaskwidget.cpp \
mixercurvewidget.cpp \ mixercurvewidget.cpp \
mixercurvepoint.cpp \ mixercurvepoint.cpp \
mixercurveline.cpp \ mixercurveline.cpp \
smartsavebutton.cpp smartsavebutton.cpp \
popupwidget.cpp
OTHER_FILES += UAVObjectWidgetUtils.pluginspec OTHER_FILES += UAVObjectWidgetUtils.pluginspec
FORMS +=