Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
c54da926
Commit
c54da926
authored
Apr 11, 2013
by
Michael Carpenter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New ComboBox param configuration UI element, and qgw widgets for general
APM configuration, battery and extra sensors
parent
87de0f5b
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
1154 additions
and
128 deletions
+1154
-128
ardupilot-heading-pid.qgw
...s/ardupilotmega/general/widgets/ardupilot-heading-pid.qgw
+26
-0
battery_monitoring.qgw
files/ardupilotmega/general/widgets/battery_monitoring.qgw
+67
-0
extra_sensors.qgw
files/ardupilotmega/general/widgets/extra_sensors.qgw
+59
-0
qgroundcontrol.pro
qgroundcontrol.pro
+7
-3
QGCVehicleConfig.cc
src/ui/QGCVehicleConfig.cc
+23
-4
QGCVehicleConfig.ui
src/ui/QGCVehicleConfig.ui
+205
-121
QGCComboBox.cc
src/ui/designer/QGCComboBox.cc
+404
-0
QGCComboBox.h
src/ui/designer/QGCComboBox.h
+65
-0
QGCComboBox.ui
src/ui/designer/QGCComboBox.ui
+292
-0
QGCToolWidget.cc
src/ui/designer/QGCToolWidget.cc
+6
-0
No files found.
files/ardupilotmega/general/widgets/ardupilot-heading-pid.qgw
0 → 100644
View file @
c54da926
[Heading%20PID%20Tuning]
QGC_TOOL_WIDGET_ITEMS\1\TYPE=SLIDER
QGC_TOOL_WIDGET_ITEMS\1\QGC_PARAM_SLIDER_DESCRIPTION=Heading D Gain
QGC_TOOL_WIDGET_ITEMS\1\QGC_PARAM_SLIDER_PARAMID=HDNG2RLL_D
QGC_TOOL_WIDGET_ITEMS\1\QGC_PARAM_SLIDER_COMPONENTID=200
QGC_TOOL_WIDGET_ITEMS\1\QGC_PARAM_SLIDER_MIN=0
QGC_TOOL_WIDGET_ITEMS\1\QGC_PARAM_SLIDER_MAX=1
QGC_TOOL_WIDGET_ITEMS\2\TYPE=SLIDER
QGC_TOOL_WIDGET_ITEMS\2\QGC_PARAM_SLIDER_DESCRIPTION=Heading P Gain
QGC_TOOL_WIDGET_ITEMS\2\QGC_PARAM_SLIDER_PARAMID=HDNG2RLL_P
QGC_TOOL_WIDGET_ITEMS\2\QGC_PARAM_SLIDER_COMPONENTID=200
QGC_TOOL_WIDGET_ITEMS\2\QGC_PARAM_SLIDER_MIN=0
QGC_TOOL_WIDGET_ITEMS\2\QGC_PARAM_SLIDER_MAX=5
QGC_TOOL_WIDGET_ITEMS\3\TYPE=SLIDER
QGC_TOOL_WIDGET_ITEMS\3\QGC_PARAM_SLIDER_DESCRIPTION=Heading I Gain
QGC_TOOL_WIDGET_ITEMS\3\QGC_PARAM_SLIDER_PARAMID=HDNG2RLL_I
QGC_TOOL_WIDGET_ITEMS\3\QGC_PARAM_SLIDER_COMPONENTID=200
QGC_TOOL_WIDGET_ITEMS\3\QGC_PARAM_SLIDER_MIN=0
QGC_TOOL_WIDGET_ITEMS\3\QGC_PARAM_SLIDER_MAX=1
QGC_TOOL_WIDGET_ITEMS\4\TYPE=SLIDER
QGC_TOOL_WIDGET_ITEMS\4\QGC_PARAM_SLIDER_DESCRIPTION=Heading I Limit
QGC_TOOL_WIDGET_ITEMS\4\QGC_PARAM_SLIDER_PARAMID=HDNG2RLL_IMAX
QGC_TOOL_WIDGET_ITEMS\4\QGC_PARAM_SLIDER_COMPONENTID=200
QGC_TOOL_WIDGET_ITEMS\4\QGC_PARAM_SLIDER_MIN=0
QGC_TOOL_WIDGET_ITEMS\4\QGC_PARAM_SLIDER_MAX=3000
QGC_TOOL_WIDGET_ITEMS\size=4
files/ardupilotmega/general/widgets/battery_monitoring.qgw
0 → 100644
View file @
c54da926
[Battery%20Monitor]
QGC_TOOL_WIDGET_ITEMS\1\TYPE=COMBO
QGC_TOOL_WIDGET_ITEMS\1\QGC_PARAM_COMBOBOX_DESCRIPTION=Battery Monitor
QGC_TOOL_WIDGET_ITEMS\1\QGC_PARAM_COMBOBOX_PARAMID=BATT_MONITOR
QGC_TOOL_WIDGET_ITEMS\1\QGC_PARAM_COMBOBOX_COMPONENTID=1
QGC_TOOL_WIDGET_ITEMS\1\QGC_PARAM_COMBOBOX_MIN=0
QGC_TOOL_WIDGET_ITEMS\1\QGC_PARAM_COMBOBOX_MAX=4
QGC_TOOL_WIDGET_ITEMS\1\QGC_PARAM_COMBOBOX_COUNT=3
QGC_TOOL_WIDGET_ITEMS\1\QGC_PARAM_COMBOBOX_ITEM_0_TEXT=Disabled
QGC_TOOL_WIDGET_ITEMS\1\QGC_PARAM_COMBOBOX_ITEM_0_VAL=0
QGC_TOOL_WIDGET_ITEMS\1\QGC_PARAM_COMBOBOX_ITEM_1_TEXT=Voltage Only
QGC_TOOL_WIDGET_ITEMS\1\QGC_PARAM_COMBOBOX_ITEM_1_VAL=3
QGC_TOOL_WIDGET_ITEMS\1\QGC_PARAM_COMBOBOX_ITEM_2_TEXT=Voltage And Current
QGC_TOOL_WIDGET_ITEMS\1\QGC_PARAM_COMBOBOX_ITEM_2_VAL=4
QGC_TOOL_WIDGET_ITEMS\4\TYPE=SLIDER
QGC_TOOL_WIDGET_ITEMS\4\QGC_PARAM_SLIDER_DESCRIPTION=APM Input Voltage
QGC_TOOL_WIDGET_ITEMS\4\QGC_PARAM_SLIDER_PARAMID=INPUT_VOLTS
QGC_TOOL_WIDGET_ITEMS\4\QGC_PARAM_SLIDER_COMPONENTID=1
QGC_TOOL_WIDGET_ITEMS\4\QGC_PARAM_SLIDER_MIN=0
QGC_TOOL_WIDGET_ITEMS\4\QGC_PARAM_SLIDER_MAX=24
QGC_TOOL_WIDGET_ITEMS\2\TYPE=SLIDER
QGC_TOOL_WIDGET_ITEMS\2\QGC_PARAM_SLIDER_DESCRIPTION=Sensor Type
QGC_TOOL_WIDGET_ITEMS\2\QGC_PARAM_SLIDER_PARAMID=CMB_batmon
QGC_TOOL_WIDGET_ITEMS\2\QGC_PARAM_SLIDER_COMPONENTID=1
QGC_TOOL_WIDGET_ITEMS\2\QGC_PARAM_SLIDER_MIN=0
QGC_TOOL_WIDGET_ITEMS\2\QGC_PARAM_SLIDER_MAX=4
QGC_TOOL_WIDGET_ITEMS\5\TYPE=SLIDER
QGC_TOOL_WIDGET_ITEMS\5\QGC_PARAM_SLIDER_DESCRIPTION=Measured Volts
QGC_TOOL_WIDGET_ITEMS\5\QGC_PARAM_SLIDER_PARAMID=INPUT_VOLTS
QGC_TOOL_WIDGET_ITEMS\5\QGC_PARAM_SLIDER_COMPONENTID=1
QGC_TOOL_WIDGET_ITEMS\5\QGC_PARAM_SLIDER_MIN=0
QGC_TOOL_WIDGET_ITEMS\5\QGC_PARAM_SLIDER_MAX=24
QGC_TOOL_WIDGET_ITEMS\3\TYPE=SLIDER
QGC_TOOL_WIDGET_ITEMS\3\QGC_PARAM_SLIDER_DESCRIPTION=APM Version
QGC_TOOL_WIDGET_ITEMS\3\QGC_PARAM_SLIDER_PARAMID=CMB_apmversion
QGC_TOOL_WIDGET_ITEMS\3\QGC_PARAM_SLIDER_COMPONENTID=1
QGC_TOOL_WIDGET_ITEMS\3\QGC_PARAM_SLIDER_MIN=0
QGC_TOOL_WIDGET_ITEMS\3\QGC_PARAM_SLIDER_MAX=2
QGC_TOOL_WIDGET_ITEMS\6\TYPE=SLIDER
QGC_TOOL_WIDGET_ITEMS\6\QGC_PARAM_SLIDER_DESCRIPTION=Battery Capacity
QGC_TOOL_WIDGET_ITEMS\6\QGC_PARAM_SLIDER_PARAMID=BATT_CAPACITY
QGC_TOOL_WIDGET_ITEMS\6\QGC_PARAM_SLIDER_COMPONENTID=1
QGC_TOOL_WIDGET_ITEMS\6\QGC_PARAM_SLIDER_MIN=0
QGC_TOOL_WIDGET_ITEMS\6\QGC_PARAM_SLIDER_MAX=10000
QGC_TOOL_WIDGET_ITEMS\7\TYPE=SLIDER
QGC_TOOL_WIDGET_ITEMS\7\QGC_PARAM_SLIDER_DESCRIPTION=Voltage Divider
QGC_TOOL_WIDGET_ITEMS\7\QGC_PARAM_SLIDER_PARAMID=VOLT_DIVIDER
QGC_TOOL_WIDGET_ITEMS\7\QGC_PARAM_SLIDER_COMPONENTID=1
QGC_TOOL_WIDGET_ITEMS\7\QGC_PARAM_SLIDER_MIN=0
QGC_TOOL_WIDGET_ITEMS\7\QGC_PARAM_SLIDER_MAX=10
QGC_TOOL_WIDGET_ITEMS\8\TYPE=SLIDER
QGC_TOOL_WIDGET_ITEMS\8\QGC_PARAM_SLIDER_DESCRIPTION=Amps per Volt
QGC_TOOL_WIDGET_ITEMS\8\QGC_PARAM_SLIDER_PARAMID=AMP_PER_VOLT
QGC_TOOL_WIDGET_ITEMS\8\QGC_PARAM_SLIDER_COMPONENTID=1
QGC_TOOL_WIDGET_ITEMS\8\QGC_PARAM_SLIDER_MIN=0
QGC_TOOL_WIDGET_ITEMS\8\QGC_PARAM_SLIDER_MAX=100
QGC_TOOL_WIDGET_ITEMS\size=8
files/ardupilotmega/general/widgets/extra_sensors.qgw
0 → 100644
View file @
c54da926
[Extra%20Sensors]
QGC_TOOL_WIDGET_ITEMS\1\TYPE=SLIDER
QGC_TOOL_WIDGET_ITEMS\1\QGC_PARAM_SLIDER_DESCRIPTION=Compass Enable
QGC_TOOL_WIDGET_ITEMS\1\QGC_PARAM_SLIDER_PARAMID=MAG_ENABLE
QGC_TOOL_WIDGET_ITEMS\1\QGC_PARAM_SLIDER_COMPONENTID=1
QGC_TOOL_WIDGET_ITEMS\1\QGC_PARAM_SLIDER_MIN=0
QGC_TOOL_WIDGET_ITEMS\1\QGC_PARAM_SLIDER_MAX=1
QGC_TOOL_WIDGET_ITEMS\2\TYPE=SLIDER
QGC_TOOL_WIDGET_ITEMS\2\QGC_PARAM_SLIDER_DESCRIPTION=Auto Declination
QGC_TOOL_WIDGET_ITEMS\2\QGC_PARAM_SLIDER_PARAMID=COMPASS_AUTODEC
QGC_TOOL_WIDGET_ITEMS\2\QGC_PARAM_SLIDER_COMPONENTID=1
QGC_TOOL_WIDGET_ITEMS\2\QGC_PARAM_SLIDER_MIN=0
QGC_TOOL_WIDGET_ITEMS\2\QGC_PARAM_SLIDER_MAX=1
QGC_TOOL_WIDGET_ITEMS\3\TYPE=SLIDER
QGC_TOOL_WIDGET_ITEMS\3\QGC_PARAM_SLIDER_DESCRIPTION=Compass Declination
QGC_TOOL_WIDGET_ITEMS\3\QGC_PARAM_SLIDER_PARAMID=COMPASS_DEC
QGC_TOOL_WIDGET_ITEMS\3\QGC_PARAM_SLIDER_COMPONENTID=1
QGC_TOOL_WIDGET_ITEMS\3\QGC_PARAM_SLIDER_MIN=0
QGC_TOOL_WIDGET_ITEMS\3\QGC_PARAM_SLIDER_MAX=100
QGC_TOOL_WIDGET_ITEMS\4\TYPE=SLIDER
QGC_TOOL_WIDGET_ITEMS\4\QGC_PARAM_SLIDER_DESCRIPTION=Sonar Enable
QGC_TOOL_WIDGET_ITEMS\4\QGC_PARAM_SLIDER_PARAMID=SONAR_ENABLE
QGC_TOOL_WIDGET_ITEMS\4\QGC_PARAM_SLIDER_COMPONENTID=1
QGC_TOOL_WIDGET_ITEMS\4\QGC_PARAM_SLIDER_MIN=0
QGC_TOOL_WIDGET_ITEMS\4\QGC_PARAM_SLIDER_MAX=1
QGC_TOOL_WIDGET_ITEMS\5\TYPE=SLIDER
QGC_TOOL_WIDGET_ITEMS\5\QGC_PARAM_SLIDER_DESCRIPTION=Sonar Type
QGC_TOOL_WIDGET_ITEMS\5\QGC_PARAM_SLIDER_PARAMID=SONAR_TYPE
QGC_TOOL_WIDGET_ITEMS\5\QGC_PARAM_SLIDER_COMPONENTID=1
QGC_TOOL_WIDGET_ITEMS\5\QGC_PARAM_SLIDER_MIN=0
QGC_TOOL_WIDGET_ITEMS\5\QGC_PARAM_SLIDER_MAX=5
QGC_TOOL_WIDGET_ITEMS\6\TYPE=SLIDER
QGC_TOOL_WIDGET_ITEMS\6\QGC_PARAM_SLIDER_DESCRIPTION=Air Speed Enable
QGC_TOOL_WIDGET_ITEMS\6\QGC_PARAM_SLIDER_PARAMID=ARSPD_ENABLE
QGC_TOOL_WIDGET_ITEMS\6\QGC_PARAM_SLIDER_COMPONENTID=1
QGC_TOOL_WIDGET_ITEMS\6\QGC_PARAM_SLIDER_MIN=0
QGC_TOOL_WIDGET_ITEMS\6\QGC_PARAM_SLIDER_MAX=2
QGC_TOOL_WIDGET_ITEMS\7\TYPE=SLIDER
QGC_TOOL_WIDGET_ITEMS\7\QGC_PARAM_SLIDER_DESCRIPTION=Use Air Speed
QGC_TOOL_WIDGET_ITEMS\7\QGC_PARAM_SLIDER_PARAMID=ARSPD_USE
QGC_TOOL_WIDGET_ITEMS\7\QGC_PARAM_SLIDER_COMPONENTID=1
QGC_TOOL_WIDGET_ITEMS\7\QGC_PARAM_SLIDER_MIN=0
QGC_TOOL_WIDGET_ITEMS\7\QGC_PARAM_SLIDER_MAX=1
QGC_TOOL_WIDGET_ITEMS\8\TYPE=SLIDER
QGC_TOOL_WIDGET_ITEMS\8\QGC_PARAM_SLIDER_DESCRIPTION=Optical Flow Enable
QGC_TOOL_WIDGET_ITEMS\8\QGC_PARAM_SLIDER_PARAMID=FLOW_ENABLE
QGC_TOOL_WIDGET_ITEMS\8\QGC_PARAM_SLIDER_COMPONENTID=1
QGC_TOOL_WIDGET_ITEMS\8\QGC_PARAM_SLIDER_MIN=0
QGC_TOOL_WIDGET_ITEMS\8\QGC_PARAM_SLIDER_MAX=1
QGC_TOOL_WIDGET_ITEMS\size=8
qgroundcontrol.pro
View file @
c54da926
...
...
@@ -227,7 +227,8 @@ FORMS += src/ui/MainWindow.ui \
src
/
ui
/
QGCHilConfiguration
.
ui
\
src
/
ui
/
QGCHilFlightGearConfiguration
.
ui
\
src
/
ui
/
QGCHilJSBSimConfiguration
.
ui
\
src
/
ui
/
QGCHilXPlaneConfiguration
.
ui
src
/
ui
/
QGCHilXPlaneConfiguration
.
ui
\
src
/
ui
/
designer
/
QGCComboBox
.
ui
INCLUDEPATH
+=
src
\
src
/
ui
\
src
/
ui
/
linechart
\
...
...
@@ -370,7 +371,8 @@ HEADERS += src/MG.h \
src
/
ui
/
QGCHilConfiguration
.
h
\
src
/
ui
/
QGCHilFlightGearConfiguration
.
h
\
src
/
ui
/
QGCHilJSBSimConfiguration
.
h
\
src
/
ui
/
QGCHilXPlaneConfiguration
.
h
src
/
ui
/
QGCHilXPlaneConfiguration
.
h
\
src
/
ui
/
designer
/
QGCComboBox
.
h
#
Google
Earth
is
only
supported
on
Mac
OS
and
Windows
with
Visual
Studio
Compiler
macx
|
macx
-
g
++
|
macx
-
g
++
42
|
win32
-
msvc2008
|
win32
-
msvc2010
::
HEADERS
+=
src
/
ui
/
map3D
/
QGCGoogleEarthView
.
h
...
...
@@ -532,7 +534,8 @@ SOURCES += src/main.cc \
src
/
ui
/
QGCHilConfiguration
.
cc
\
src
/
ui
/
QGCHilFlightGearConfiguration
.
cc
\
src
/
ui
/
QGCHilJSBSimConfiguration
.
cc
\
src
/
ui
/
QGCHilXPlaneConfiguration
.
cc
src
/
ui
/
QGCHilXPlaneConfiguration
.
cc
\
src
/
ui
/
designer
/
QGCComboBox
.
cc
#
Enable
Google
Earth
only
on
Mac
OS
and
Windows
with
Visual
Studio
compiler
macx
|
macx
-
g
++
|
macx
-
g
++
42
|
win32
-
msvc2008
|
win32
-
msvc2010
::
SOURCES
+=
src
/
ui
/
map3D
/
QGCGoogleEarthView
.
cc
...
...
@@ -666,3 +669,4 @@ win32-msvc2008|win32-msvc2010 {
}
unix
:
!
macx
:
!
symbian
:
LIBS
+=
-
losg
>>>>>>>
New
ComboBox
param
configuration
UI
element
,
and
qgw
widgets
for
general
src/ui/QGCVehicleConfig.cc
View file @
c54da926
...
...
@@ -205,7 +205,7 @@ void QGCVehicleConfig::setActiveUAS(UASInterface* active)
qDebug
()
<<
autopilotdir
.
absolutePath
();
qDebug
()
<<
generaldir
.
absolutePath
();
qDebug
()
<<
vehicledir
.
absolutePath
();
int
left
=
true
;
foreach
(
QString
file
,
generaldir
.
entryList
(
QDir
::
Files
|
QDir
::
NoDotAndDotDot
))
{
if
(
file
.
toLower
().
endsWith
(
".qgw"
))
{
...
...
@@ -218,13 +218,22 @@ void QGCVehicleConfig::setActiveUAS(UASInterface* active)
box
->
setTitle
(
tool
->
objectName
());
box
->
setLayout
(
new
QVBoxLayout
());
box
->
layout
()
->
addWidget
(
tool
);
ui
->
multiRotorAttitudeLayout
->
addWidget
(
box
);
if
(
left
)
{
left
=
false
;
ui
->
leftGeneralLayout
->
addWidget
(
box
);
}
else
{
left
=
true
;
ui
->
rightGeneralLayout
->
addWidget
(
box
);
}
}
else
{
delete
tool
;
}
}
}
left
=
true
;
foreach
(
QString
file
,
vehicledir
.
entryList
(
QDir
::
Files
|
QDir
::
NoDotAndDotDot
))
{
if
(
file
.
toLower
().
endsWith
(
".qgw"
))
{
...
...
@@ -237,7 +246,17 @@ void QGCVehicleConfig::setActiveUAS(UASInterface* active)
box
->
setTitle
(
tool
->
objectName
());
box
->
setLayout
(
new
QVBoxLayout
());
box
->
layout
()
->
addWidget
(
tool
);
ui
->
fixedWingAttitudeLayout
->
addWidget
(
box
);
if
(
left
)
{
left
=
false
;
ui
->
leftHWSpecificLayout
->
addWidget
(
box
);
}
else
{
left
=
true
;
ui
->
rightHWSpecificLayout
->
addWidget
(
box
);
}
}
else
{
delete
tool
;
}
...
...
src/ui/QGCVehicleConfig.ui
View file @
c54da926
...
...
@@ -40,7 +40,7 @@
<item
row=
"0"
column=
"0"
colspan=
"2"
>
<widget
class=
"QTabWidget"
name=
"tabWidget"
>
<property
name=
"currentIndex"
>
<number>
0
</number>
<number>
2
</number>
</property>
<widget
class=
"QWidget"
name=
"rcTab"
>
<attribute
name=
"title"
>
...
...
@@ -776,11 +776,10 @@ p, li { white-space: pre-wrap; }
<attribute
name=
"title"
>
<string>
General Config
</string>
</attribute>
<layout
class=
"QGridLayout"
name=
"gridLayout_3"
columnstretch=
"80,0,0"
>
<property
name=
"topMargin"
>
<number>
20
</number>
</property>
<item
row=
"0"
column=
"0"
>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout_6"
>
<item>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_7"
>
<item>
<spacer
name=
"horizontalSpacer_8"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
...
...
@@ -793,17 +792,21 @@ p, li { white-space: pre-wrap; }
</property>
</spacer>
</item>
<item
row=
"0"
column=
"2"
>
<item>
<widget
class=
"QComboBox"
name=
"multiRotorComboBox"
/>
</item>
<item>
<widget
class=
"QPushButton"
name=
"loadMultiRotorDefaultsButton"
>
<property
name=
"text"
>
<string>
Load Platform Defaults
</string>
</property>
</widget>
</item>
<item
row=
"0"
column=
"1"
>
<widget
class=
"QComboBox"
name=
"multiRotorComboBox"
/>
</layout>
</item>
<item
row=
"1"
column=
"0"
colspan=
"3"
>
<item>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_6"
>
<item>
<widget
class=
"QGroupBox"
name=
"multiRotorControlAttitudeGroupBox"
>
<property
name=
"title"
>
<string>
Configuration
</string>
...
...
@@ -822,8 +825,8 @@ p, li { white-space: pre-wrap; }
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
740
</width>
<height>
442
</height>
<width>
364
</width>
<height>
449
</height>
</rect>
</property>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_4"
>
...
...
@@ -831,7 +834,44 @@ p, li { white-space: pre-wrap; }
<number>
0
</number>
</property>
<item>
<layout
class=
"QVBoxLayout"
name=
"multiRotorAttitudeLayout"
/>
<layout
class=
"QVBoxLayout"
name=
"leftGeneralLayout"
/>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget
class=
"QGroupBox"
name=
"multiRotorControlAttitudeGroupBox_2"
>
<property
name=
"title"
>
<string>
Configuration
</string>
</property>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout_5"
>
<property
name=
"margin"
>
<number>
0
</number>
</property>
<item>
<widget
class=
"QScrollArea"
name=
"scrollArea_2"
>
<property
name=
"widgetResizable"
>
<bool>
true
</bool>
</property>
<widget
class=
"QWidget"
name=
"scrollAreaWidgetContents_2"
>
<property
name=
"geometry"
>
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
364
</width>
<height>
449
</height>
</rect>
</property>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_5"
>
<property
name=
"margin"
>
<number>
0
</number>
</property>
<item>
<layout
class=
"QVBoxLayout"
name=
"rightGeneralLayout"
/>
</item>
</layout>
</widget>
...
...
@@ -841,26 +881,17 @@ p, li { white-space: pre-wrap; }
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget
class=
"QWidget"
name=
"fixedWingTab"
>
<attribute
name=
"title"
>
<string>
Hardware Specific Config
</string>
</attribute>
<layout
class=
"QGridLayout"
name=
"gridLayout_4"
columnstretch=
"65,0,0,0"
>
<property
name=
"topMargin"
>
<number>
20
</number>
</property>
<item
row=
"0"
column=
"1"
>
<widget
class=
"QComboBox"
name=
"fixedWingComboBox"
/>
</item>
<item
row=
"0"
column=
"2"
colspan=
"2"
>
<widget
class=
"QPushButton"
name=
"loadFixedWingDefaultsButton"
>
<property
name=
"text"
>
<string>
Load Platform Defaults
</string>
</property>
</widget>
</item>
<item
row=
"0"
column=
"0"
>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout"
>
<item>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_2"
>
<item>
<spacer
name=
"horizontalSpacer_9"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
...
...
@@ -873,7 +904,21 @@ p, li { white-space: pre-wrap; }
</property>
</spacer>
</item>
<item
row=
"1"
column=
"0"
colspan=
"4"
>
<item>
<widget
class=
"QComboBox"
name=
"fixedWingComboBox"
/>
</item>
<item>
<widget
class=
"QPushButton"
name=
"loadFixedWingDefaultsButton"
>
<property
name=
"text"
>
<string>
Load Platform Defaults
</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_3"
>
<item>
<widget
class=
"QGroupBox"
name=
"fixedWingControlAttitudeGroupBox"
>
<property
name=
"title"
>
<string>
Configuration
</string>
...
...
@@ -892,8 +937,8 @@ p, li { white-space: pre-wrap; }
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
740
</width>
<height>
442
</height>
<width>
364
</width>
<height>
449
</height>
</rect>
</property>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout_7"
>
...
...
@@ -901,7 +946,44 @@ p, li { white-space: pre-wrap; }
<number>
0
</number>
</property>
<item>
<layout
class=
"QVBoxLayout"
name=
"fixedWingAttitudeLayout"
/>
<layout
class=
"QVBoxLayout"
name=
"leftHWSpecificLayout"
/>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget
class=
"QGroupBox"
name=
"fixedWingControlAttitudeGroupBox_2"
>
<property
name=
"title"
>
<string>
Configuration
</string>
</property>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout_4"
>
<property
name=
"margin"
>
<number>
0
</number>
</property>
<item>
<widget
class=
"QScrollArea"
name=
"scrollArea_5"
>
<property
name=
"widgetResizable"
>
<bool>
true
</bool>
</property>
<widget
class=
"QWidget"
name=
"scrollAreaWidgetContents_5"
>
<property
name=
"geometry"
>
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
364
</width>
<height>
449
</height>
</rect>
</property>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout_8"
>
<property
name=
"margin"
>
<number>
0
</number>
</property>
<item>
<layout
class=
"QVBoxLayout"
name=
"rightHWSpecificLayout"
/>
</item>
</layout>
</widget>
...
...
@@ -911,6 +993,8 @@ p, li { white-space: pre-wrap; }
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</widget>
</item>
...
...
src/ui/designer/QGCComboBox.cc
0 → 100644
View file @
c54da926
#include <QMenu>
#include <QContextMenuEvent>
#include <QSettings>
#include <QTimer>
#include <QToolTip>
#include "QGCComboBox.h"
#include "ui_QGCComboBox.h"
#include "UASInterface.h"
#include "UASManager.h"
QGCComboBox
::
QGCComboBox
(
QWidget
*
parent
)
:
QGCToolWidgetItem
(
"Slider"
,
parent
),
parameterName
(
""
),
parameterValue
(
0.0
f
),
parameterScalingFactor
(
0.0
),
parameterMin
(
0.0
f
),
parameterMax
(
0.0
f
),
component
(
0
),
ui
(
new
Ui
::
QGCComboBox
)
{
ui
->
setupUi
(
this
);
uas
=
NULL
;
ui
->
editInfoCheckBox
->
hide
();
ui
->
editDoneButton
->
hide
();
ui
->
editNameLabel
->
hide
();
ui
->
editRefreshParamsButton
->
hide
();
ui
->
editSelectParamComboBox
->
hide
();
ui
->
editSelectComponentComboBox
->
hide
();
ui
->
editStatusLabel
->
hide
();
ui
->
editLine1
->
hide
();
ui
->
editLine2
->
hide
();
ui
->
editAddItemButton
->
hide
();
ui
->
editRemoveItemButton
->
hide
();
ui
->
editItemValueSpinBox
->
hide
();
ui
->
editItemNameLabel
->
hide
();
ui
->
itemValueLabel
->
hide
();
ui
->
itemNameLabel
->
hide
();
ui
->
editLine1
->
setStyleSheet
(
"QWidget { border: 1px solid #66666B; border-radius: 3px; padding: 10px 0px 0px 0px; background: #111122; }"
);
ui
->
editLine2
->
setStyleSheet
(
"QWidget { border: 1px solid #66666B; border-radius: 3px; padding: 10px 0px 0px 0px; background: #111122; }"
);
connect
(
ui
->
editDoneButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
endEditMode
()));
connect
(
ui
->
editOptionComboBox
,
SIGNAL
(
currentIndexChanged
(
QString
)),
this
,
SLOT
(
comboBoxIndexChanged
(
QString
)));
connect
(
ui
->
editAddItemButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
addButtonClicked
()));
connect
(
ui
->
editRemoveItemButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
delButtonClicked
()));
// Sending actions
connect
(
ui
->
writeButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
sendParameter
()));
connect
(
ui
->
editSelectComponentComboBox
,
SIGNAL
(
currentIndexChanged
(
int
)),
this
,
SLOT
(
selectComponent
(
int
)));
connect
(
ui
->
editSelectParamComboBox
,
SIGNAL
(
currentIndexChanged
(
int
)),
this
,
SLOT
(
selectParameter
(
int
)));
//connect(ui->valueSlider, SIGNAL(valueChanged(int)), this, SLOT(setSliderValue(int)));
//connect(ui->doubleValueSpinBox, SIGNAL(valueChanged(double)), this, SLOT(setParamValue(double)));
//connect(ui->intValueSpinBox, SIGNAL(valueChanged(int)), this, SLOT(setParamValue(int)));
connect
(
ui
->
editNameLabel
,
SIGNAL
(
textChanged
(
QString
)),
ui
->
nameLabel
,
SLOT
(
setText
(
QString
)));
connect
(
ui
->
readButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
requestParameter
()));
connect
(
ui
->
editRefreshParamsButton
,
SIGNAL
(
clicked
()),
this
,
SLOT
(
refreshParamList
()));
connect
(
ui
->
editInfoCheckBox
,
SIGNAL
(
clicked
(
bool
)),
this
,
SLOT
(
showInfo
(
bool
)));
// connect to self
connect
(
ui
->
infoLabel
,
SIGNAL
(
released
()),
this
,
SLOT
(
showTooltip
()));
// Set the current UAS if present
connect
(
UASManager
::
instance
(),
SIGNAL
(
activeUASSet
(
UASInterface
*
)),
this
,
SLOT
(
setActiveUAS
(
UASInterface
*
)));
}
QGCComboBox
::~
QGCComboBox
()
{
delete
ui
;
}
void
QGCComboBox
::
showTooltip
()
{
QWidget
*
sender
=
dynamic_cast
<
QWidget
*>
(
QObject
::
sender
());
if
(
sender
)
{
QPoint
point
=
mapToGlobal
(
pos
());
QToolTip
::
showText
(
point
,
sender
->
toolTip
());
}
}
void
QGCComboBox
::
refreshParamList
()
{
ui
->
editSelectParamComboBox
->
setEnabled
(
true
);
ui
->
editSelectComponentComboBox
->
setEnabled
(
true
);
if
(
uas
)
{
uas
->
getParamManager
()
->
requestParameterList
();
ui
->
editStatusLabel
->
setText
(
tr
(
"Parameter list updating.."
));
}
}
void
QGCComboBox
::
setActiveUAS
(
UASInterface
*
activeUas
)
{
if
(
activeUas
)
{
if
(
uas
)
{
disconnect
(
uas
,
SIGNAL
(
parameterChanged
(
int
,
int
,
int
,
int
,
QString
,
QVariant
)),
this
,
SLOT
(
setParameterValue
(
int
,
int
,
int
,
int
,
QString
,
QVariant
)));
}
// Connect buttons and signals
connect
(
activeUas
,
SIGNAL
(
parameterChanged
(
int
,
int
,
int
,
int
,
QString
,
QVariant
)),
this
,
SLOT
(
setParameterValue
(
int
,
int
,
int
,
int
,
QString
,
QVariant
)),
Qt
::
UniqueConnection
);
uas
=
activeUas
;
// Update current param value
requestParameter
();
// Set param info
QString
text
=
uas
->
getParamManager
()
->
getParamInfo
(
parameterName
);
ui
->
infoLabel
->
setToolTip
(
text
);
// Force-uncheck and hide label if no description is available
if
(
ui
->
editInfoCheckBox
->
isChecked
())
{
showInfo
((
text
.
length
()
>
0
));
}
}
}
void
QGCComboBox
::
requestParameter
()
{
if
(
!
parameterName
.
isEmpty
()
&&
uas
)
{
uas
->
getParamManager
()
->
requestParameterUpdate
(
this
->
component
,
this
->
parameterName
);
}
}
void
QGCComboBox
::
showInfo
(
bool
enable
)
{
ui
->
editInfoCheckBox
->
setChecked
(
enable
);
ui
->
infoLabel
->
setVisible
(
enable
);
}
void
QGCComboBox
::
selectComponent
(
int
componentIndex
)
{
this
->
component
=
ui
->
editSelectComponentComboBox
->
itemData
(
componentIndex
).
toInt
();
}
void
QGCComboBox
::
selectParameter
(
int
paramIndex
)
{
// Set name
parameterName
=
ui
->
editSelectParamComboBox
->
itemText
(
paramIndex
);
// Update min and max values if available
if
(
uas
)
{
if
(
uas
->
getParamManager
())
{
// Current value
uas
->
getParamManager
()
->
requestParameterUpdate
(
component
,
parameterName
);
// Minimum
if
(
uas
->
getParamManager
()
->
isParamMinKnown
(
parameterName
))
{
parameterMin
=
uas
->
getParamManager
()
->
getParamMin
(
parameterName
);
}
// Maximum
if
(
uas
->
getParamManager
()
->
isParamMaxKnown
(
parameterName
))
{
parameterMax
=
uas
->
getParamManager
()
->
getParamMax
(
parameterName
);
}
// Description
QString
text
=
uas
->
getParamManager
()
->
getParamInfo
(
parameterName
);
ui
->
infoLabel
->
setText
(
text
);
showInfo
(
!
(
text
.
length
()
>
0
));
}
}
}
void
QGCComboBox
::
startEditMode
()
{
ui
->
nameLabel
->
hide
();
ui
->
writeButton
->
hide
();
ui
->
readButton
->
hide
();
ui
->
editInfoCheckBox
->
show
();
ui
->
editDoneButton
->
show
();
ui
->
editNameLabel
->
show
();
ui
->
editRefreshParamsButton
->
show
();
ui
->
editSelectParamComboBox
->
show
();
ui
->
editSelectComponentComboBox
->
show
();
ui
->
editStatusLabel
->
show
();
ui
->
writeButton
->
hide
();
ui
->
readButton
->
hide
();
ui
->
editLine1
->
show
();
ui
->
editLine2
->
show
();
ui
->
editAddItemButton
->
show
();
ui
->
editRemoveItemButton
->
show
();
ui
->
editItemValueSpinBox
->
show
();
ui
->
editItemNameLabel
->
show
();
ui
->
itemValueLabel
->
show
();
ui
->
itemNameLabel
->
show
();
isInEditMode
=
true
;
}
void
QGCComboBox
::
endEditMode
()
{
// Store component id
selectComponent
(
ui
->
editSelectComponentComboBox
->
currentIndex
());
// Store parameter name and id
selectParameter
(
ui
->
editSelectParamComboBox
->
currentIndex
());
// Min/max
ui
->
editInfoCheckBox
->
hide
();
ui
->
editDoneButton
->
hide
();
ui
->
editNameLabel
->
hide
();
ui
->
editRefreshParamsButton
->
hide
();
ui
->
editSelectParamComboBox
->
hide
();
ui
->
editSelectComponentComboBox
->
hide
();
ui
->
editStatusLabel
->
hide
();
ui
->
editLine1
->
hide
();
ui
->
editLine2
->
hide
();
ui
->
writeButton
->
show
();
ui
->
readButton
->
show
();
ui
->
editAddItemButton
->
hide
();
ui
->
editRemoveItemButton
->
hide
();
ui
->
editItemValueSpinBox
->
hide
();
ui
->
editItemNameLabel
->
hide
();
ui
->
itemValueLabel
->
hide
();
ui
->
itemNameLabel
->
hide
();
ui
->
nameLabel
->
show
();
isInEditMode
=
false
;
emit
editingFinished
();
}
void
QGCComboBox
::
sendParameter
()
{
if
(
uas
)
{
// Set value, param manager handles retransmission
if
(
uas
->
getParamManager
())
{
uas
->
getParamManager
()
->
setParameter
(
component
,
parameterName
,
parameterValue
);
}
else
{
qDebug
()
<<
"UAS HAS NO PARAM MANAGER, DOING NOTHING"
;
}
}
else
{
qDebug
()
<<
__FILE__
<<
__LINE__
<<
"NO UAS SET, DOING NOTHING"
;
}
}
/**
* @brief uas Unmanned system sending the parameter
* @brief component UAS component sending the parameter
* @brief parameterName Key/name of the parameter
* @brief value Value of the parameter
*/
void
QGCComboBox
::
setParameterValue
(
int
uas
,
int
component
,
int
paramCount
,
int
paramIndex
,
QString
parameterName
,
QVariant
value
)
{
Q_UNUSED
(
paramCount
);
// Check if this component and parameter are part of the list
bool
found
=
false
;
for
(
int
i
=
0
;
i
<
ui
->
editSelectComponentComboBox
->
count
();
++
i
)
{
if
(
component
==
ui
->
editSelectComponentComboBox
->
itemData
(
i
).
toInt
())
{
found
=
true
;
}
}
if
(
!
found
)
{
ui
->
editSelectComponentComboBox
->
addItem
(
tr
(
"Component #%1"
).
arg
(
component
),
component
);
}
// Parameter checking
found
=
false
;
for
(
int
i
=
0
;
i
<
ui
->
editSelectParamComboBox
->
count
();
++
i
)
{
if
(
parameterName
==
ui
->
editSelectParamComboBox
->
itemText
(
i
))
{
found
=
true
;
}
}
if
(
!
found
)
{
ui
->
editSelectParamComboBox
->
addItem
(
parameterName
,
paramIndex
);
}
Q_UNUSED
(
uas
);
//comboBoxTextToValMap[ui->editItemNameLabel->text()] = ui->editItemValueSpinBox->value();
if
(
component
==
this
->
component
&&
parameterName
==
this
->
parameterName
)
{
for
(
int
i
=
0
;
i
<
ui
->
editOptionComboBox
->
count
();
i
++
)
{
if
(
comboBoxTextToValMap
[
ui
->
editOptionComboBox
->
itemText
(
i
)]
==
value
.
toInt
())
{
ui
->
editOptionComboBox
->
setCurrentIndex
(
i
);
break
;
}
}
}
if
(
paramIndex
==
paramCount
-
1
)
{
ui
->
editStatusLabel
->
setText
(
tr
(
"Complete parameter list received."
));
}
}
void
QGCComboBox
::
changeEvent
(
QEvent
*
e
)
{
QWidget
::
changeEvent
(
e
);
switch
(
e
->
type
())
{
case
QEvent
:
:
LanguageChange
:
ui
->
retranslateUi
(
this
);
break
;
default:
break
;
}
}
void
QGCComboBox
::
writeSettings
(
QSettings
&
settings
)
{
settings
.
setValue
(
"TYPE"
,
"COMBOBOX"
);
settings
.
setValue
(
"QGC_PARAM_COMBOBOX_DESCRIPTION"
,
ui
->
nameLabel
->
text
());
//settings.setValue("QGC_PARAM_COMBOBOX_BUTTONTEXT", ui->actionButton->text());
settings
.
setValue
(
"QGC_PARAM_COMBOBOX_PARAMID"
,
parameterName
);
settings
.
setValue
(
"QGC_PARAM_COMBOBOX_COMPONENTID"
,
component
);
settings
.
setValue
(
"QGC_PARAM_COMBOBOX_DISPLAY_INFO"
,
ui
->
editInfoCheckBox
->
isChecked
());
settings
.
setValue
(
"QGC_PARAM_COMBOBOX_COUNT"
,
ui
->
editOptionComboBox
->
count
());
for
(
int
i
=
0
;
i
<
ui
->
editOptionComboBox
->
count
();
i
++
)
{
settings
.
setValue
(
"QGC_PARAM_COMBOBOX_ITEM_"
+
QString
::
number
(
i
)
+
"_TEXT"
,
ui
->
editOptionComboBox
->
itemText
(
i
));
settings
.
setValue
(
"QGC_PARAM_COMBOBOX_ITEM_"
+
QString
::
number
(
i
)
+
"_VAL"
,
comboBoxTextToValMap
[
ui
->
editOptionComboBox
->
itemText
(
i
)]);
}
settings
.
sync
();
}
void
QGCComboBox
::
readSettings
(
const
QSettings
&
settings
)
{
parameterName
=
settings
.
value
(
"QGC_PARAM_COMBOBOX_PARAMID"
).
toString
();
component
=
settings
.
value
(
"QGC_PARAM_COMBOBOX_COMPONENTID"
).
toInt
();
ui
->
nameLabel
->
setText
(
settings
.
value
(
"QGC_PARAM_COMBOBOX_DESCRIPTION"
).
toString
());
ui
->
editNameLabel
->
setText
(
settings
.
value
(
"QGC_PARAM_COMBOBOX_DESCRIPTION"
).
toString
());
//settings.setValue("QGC_PARAM_SLIDER_BUTTONTEXT", ui->actionButton->text());
ui
->
editSelectParamComboBox
->
addItem
(
settings
.
value
(
"QGC_PARAM_COMBOBOX_PARAMID"
).
toString
());
ui
->
editSelectParamComboBox
->
setCurrentIndex
(
ui
->
editSelectParamComboBox
->
count
()
-
1
);
ui
->
editSelectComponentComboBox
->
addItem
(
tr
(
"Component #%1"
).
arg
(
settings
.
value
(
"QGC_PARAM_COMBOBOX_COMPONENTID"
).
toInt
()),
settings
.
value
(
"QGC_PARAM_COMBOBOX_COMPONENTID"
).
toInt
());
showInfo
(
settings
.
value
(
"QGC_PARAM_COMBOBOX_DISPLAY_INFO"
,
true
).
toBool
());
ui
->
editSelectParamComboBox
->
setEnabled
(
true
);
ui
->
editSelectComponentComboBox
->
setEnabled
(
true
);
int
num
=
settings
.
value
(
"QGC_PARAM_COMBOBOX_COUNT"
).
toInt
();
for
(
int
i
=
0
;
i
<
num
;
i
++
)
{
ui
->
editOptionComboBox
->
addItem
(
settings
.
value
(
"QGC_PARAM_COMBOBOX_ITEM_"
+
QString
::
number
(
i
)
+
"_TEXT"
).
toString
());
qDebug
()
<<
"Adding val:"
<<
settings
.
value
(
"QGC_PARAM_COMBOBOX_ITEM_"
+
QString
::
number
(
i
)).
toString
()
<<
settings
.
value
(
"QGC_PARAM_COMBOBOX_ITEM_"
+
QString
::
number
(
i
)
+
"_VAL"
).
toInt
();
comboBoxTextToValMap
[
settings
.
value
(
"QGC_PARAM_COMBOBOX_ITEM_"
+
QString
::
number
(
i
)
+
"_TEXT"
).
toString
()]
=
settings
.
value
(
"QGC_PARAM_COMBOBOX_ITEM_"
+
QString
::
number
(
i
)
+
"_VAL"
).
toInt
();
}
setActiveUAS
(
UASManager
::
instance
()
->
getActiveUAS
());
// Get param value after settings have been loaded
requestParameter
();
}
void
QGCComboBox
::
addButtonClicked
()
{
ui
->
editOptionComboBox
->
addItem
(
ui
->
editItemNameLabel
->
text
());
comboBoxTextToValMap
[
ui
->
editItemNameLabel
->
text
()]
=
ui
->
editItemValueSpinBox
->
value
();
}
void
QGCComboBox
::
delButtonClicked
()
{
int
index
=
ui
->
editOptionComboBox
->
currentIndex
();
comboBoxTextToValMap
.
remove
(
ui
->
editOptionComboBox
->
currentText
());
ui
->
editOptionComboBox
->
removeItem
(
index
);
}
void
QGCComboBox
::
comboBoxIndexChanged
(
QString
val
)
{
qDebug
()
<<
"comboboxchanged:"
<<
comboBoxTextToValMap
[
val
]
<<
val
;
switch
(
parameterValue
.
type
())
{
case
QVariant
:
:
Char
:
parameterValue
=
QVariant
(
QChar
((
unsigned
char
)
comboBoxTextToValMap
[
val
]));
break
;
case
QVariant
:
:
Int
:
parameterValue
=
(
int
)
comboBoxTextToValMap
[
val
];
break
;
case
QVariant
:
:
UInt
:
parameterValue
=
(
unsigned
int
)
comboBoxTextToValMap
[
val
];
break
;
case
QMetaType
:
:
Float
:
parameterValue
=
(
float
)
comboBoxTextToValMap
[
val
];
break
;
default:
qCritical
()
<<
"ERROR: NO VALID PARAM TYPE"
;
return
;
}
}
src/ui/designer/QGCComboBox.h
0 → 100644
View file @
c54da926
#ifndef QGCCOMBOBOX_H
#define QGCCOMBOBOX_H
#include <QWidget>
#include <QAction>
#include <QtDesigner/QDesignerExportWidget>
#include "QGCToolWidgetItem.h"
namespace
Ui
{
class
QGCComboBox
;
}
class
QGCComboBox
:
public
QGCToolWidgetItem
{
Q_OBJECT
public:
explicit
QGCComboBox
(
QWidget
*
parent
=
0
);
~
QGCComboBox
();
public
slots
:
void
startEditMode
();
void
endEditMode
();
/** @brief Send the parameter to the MAV */
void
sendParameter
();
/** @brief Update the UI with the new parameter value */
void
setParameterValue
(
int
uas
,
int
component
,
int
paramCount
,
int
paramIndex
,
QString
parameterName
,
const
QVariant
value
);
void
writeSettings
(
QSettings
&
settings
);
void
readSettings
(
const
QSettings
&
settings
);
void
refreshParamList
();
void
setActiveUAS
(
UASInterface
*
uas
);
void
selectComponent
(
int
componentIndex
);
void
selectParameter
(
int
paramIndex
);
/** @brief Show descriptive text next to slider */
void
showInfo
(
bool
enable
);
/** @brief Show tool tip of calling element */
void
showTooltip
();
protected
slots
:
/** @brief Request the parameter of this widget from the MAV */
void
requestParameter
();
/** @brief Button click to add a new item to the combobox */
void
addButtonClicked
();
/** @brief Button click to remove the currently selected item from the combobox */
void
delButtonClicked
();
/** @brief Updates current parameter based on new combobox value */
void
comboBoxIndexChanged
(
QString
val
);
protected:
QMap
<
QString
,
int
>
comboBoxTextToValMap
;
///< Comboboxtext/parameter value map
QString
parameterName
;
///< Key/Name of the parameter
QVariant
parameterValue
;
///< Value of the parameter
double
parameterScalingFactor
;
///< Factor to scale the parameter between slider and true value
float
parameterMin
;
float
parameterMax
;
int
component
;
///< ID of the MAV component to address
//double scaledInt;
void
changeEvent
(
QEvent
*
e
);
private:
Ui
::
QGCComboBox
*
ui
;
};
#endif // QGCCOMBOBOX_H
src/ui/designer/QGCComboBox.ui
0 → 100644
View file @
c54da926
<?xml version="1.0" encoding="UTF-8"?>
<ui
version=
"4.0"
>
<class>
QGCComboBox
</class>
<widget
class=
"QWidget"
name=
"QGCComboBox"
>
<property
name=
"geometry"
>
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
789
</width>
<height>
244
</height>
</rect>
</property>
<property
name=
"windowTitle"
>
<string>
Form
</string>
</property>
<property
name=
"layoutDirection"
>
<enum>
Qt::LeftToRight
</enum>
</property>
<layout
class=
"QGridLayout"
name=
"gridLayout"
columnstretch=
"10,0,0,0,0,0,0,0,0,0,0,0"
>
<property
name=
"leftMargin"
>
<number>
6
</number>
</property>
<property
name=
"topMargin"
>
<number>
3
</number>
</property>
<property
name=
"rightMargin"
>
<number>
6
</number>
</property>
<property
name=
"bottomMargin"
>
<number>
3
</number>
</property>
<property
name=
"horizontalSpacing"
>
<number>
6
</number>
</property>
<property
name=
"verticalSpacing"
>
<number>
12
</number>
</property>
<item
row=
"0"
column=
"0"
colspan=
"12"
>
<widget
class=
"Line"
name=
"editLine1"
>
<property
name=
"minimumSize"
>
<size>
<width>
0
</width>
<height>
0
</height>
</size>
</property>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
</widget>
</item>
<item
row=
"7"
column=
"11"
>
<widget
class=
"QPushButton"
name=
"editDoneButton"
>
<property
name=
"text"
>
<string>
Done
</string>
</property>
</widget>
</item>
<item
row=
"9"
column=
"0"
colspan=
"12"
>
<widget
class=
"Line"
name=
"editLine2"
>
<property
name=
"minimumSize"
>
<size>
<width>
0
</width>
<height>
0
</height>
</size>
</property>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
</widget>
</item>
<item
row=
"2"
column=
"0"
colspan=
"3"
>
<spacer
name=
"horizontalSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Horizontal
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
0
</width>
<height>
20
</height>
</size>
</property>
</spacer>
</item>
<item
row=
"8"
column=
"2"
colspan=
"10"
>
<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>
<item
row=
"2"
column=
"11"
>
<widget
class=
"QPushButton"
name=
"readButton"
>
<property
name=
"minimumSize"
>
<size>
<width>
0
</width>
<height>
0
</height>
</size>
</property>
<property
name=
"toolTip"
>
<string>
Read the current parameter value on the system
</string>
</property>
<property
name=
"statusTip"
>
<string>
Read the current parameter value on the system
</string>
</property>
<property
name=
"text"
>
<string>
R
</string>
</property>
</widget>
</item>
<item
row=
"2"
column=
"10"
>
<widget
class=
"QPushButton"
name=
"writeButton"
>
<property
name=
"minimumSize"
>
<size>
<width>
0
</width>
<height>
0
</height>
</size>
</property>
<property
name=
"maximumSize"
>
<size>
<width>
16777215
</width>
<height>
16777215
</height>
</size>
</property>
<property
name=
"toolTip"
>
<string>
Transmit the current slider value to the system
</string>
</property>
<property
name=
"statusTip"
>
<string>
Transmit the current slider value to the system
</string>
</property>
<property
name=
"text"
>
<string>
W
</string>
</property>
</widget>
</item>
<item
row=
"4"
column=
"10"
>
<widget
class=
"QCheckBox"
name=
"editInfoCheckBox"
>
<property
name=
"text"
>
<string>
Show Info
</string>
</property>
<property
name=
"checked"
>
<bool>
true
</bool>
</property>
</widget>
</item>
<item
row=
"7"
column=
"3"
colspan=
"7"
>
<widget
class=
"QLabel"
name=
"editStatusLabel"
>
<property
name=
"text"
>
<string>
Please click first on refresh to update selection menus..
</string>
</property>
</widget>
</item>
<item
row=
"4"
column=
"11"
>
<widget
class=
"QPushButton"
name=
"editRefreshParamsButton"
>
<property
name=
"enabled"
>
<bool>
true
</bool>
</property>
<property
name=
"text"
>
<string>
Refresh
</string>
</property>
</widget>
</item>
<item
row=
"4"
column=
"9"
>
<widget
class=
"QComboBox"
name=
"editSelectParamComboBox"
>
<property
name=
"enabled"
>
<bool>
false
</bool>
</property>
<property
name=
"toolTip"
>
<string>
Select parameter
</string>
</property>
<property
name=
"statusTip"
>
<string>
Select parameter
</string>
</property>
</widget>
</item>
<item
row=
"2"
column=
"9"
>
<widget
class=
"QComboBox"
name=
"editOptionComboBox"
/>
</item>
<item
row=
"4"
column=
"8"
>
<widget
class=
"QComboBox"
name=
"editSelectComponentComboBox"
>
<property
name=
"enabled"
>
<bool>
false
</bool>
</property>
<property
name=
"toolTip"
>
<string>
Select component
</string>
</property>
<property
name=
"statusTip"
>
<string>
Select component
</string>
</property>
</widget>
</item>
<item
row=
"3"
column=
"11"
>
<widget
class=
"QPushButton"
name=
"editRemoveItemButton"
>
<property
name=
"text"
>
<string>
Delete Item
</string>
</property>
</widget>
</item>
<item
row=
"3"
column=
"10"
>
<widget
class=
"QPushButton"
name=
"editAddItemButton"
>
<property
name=
"text"
>
<string>
Add Item
</string>
</property>
</widget>
</item>
<item
row=
"3"
column=
"9"
>
<widget
class=
"QLineEdit"
name=
"editItemNameLabel"
/>
</item>
<item
row=
"3"
column=
"7"
>
<widget
class=
"QSpinBox"
name=
"editItemValueSpinBox"
/>
</item>
<item
row=
"3"
column=
"8"
>
<widget
class=
"QLabel"
name=
"itemNameLabel"
>
<property
name=
"text"
>
<string>
Name
</string>
</property>
<property
name=
"alignment"
>
<set>
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
</set>
</property>
</widget>
</item>
<item
row=
"3"
column=
"6"
>
<widget
class=
"QLabel"
name=
"itemValueLabel"
>
<property
name=
"text"
>
<string>
Value
</string>
</property>
<property
name=
"alignment"
>
<set>
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
</set>
</property>
</widget>
</item>
<item
row=
"1"
column=
"9"
>
<widget
class=
"QLineEdit"
name=
"editNameLabel"
>
<property
name=
"text"
>
<string>
<
Parameter Name / Label
>
</string>
</property>
</widget>
</item>
<item
row=
"2"
column=
"8"
>
<widget
class=
"QToolButton"
name=
"infoLabel"
>
<property
name=
"layoutDirection"
>
<enum>
Qt::LeftToRight
</enum>
</property>
<property
name=
"text"
>
<string/>
</property>
<property
name=
"icon"
>
<iconset
resource=
"../../../qgroundcontrol.qrc"
>
<normaloff>
:/files/images/status/dialog-information.svg
</normaloff>
:/files/images/status/dialog-information.svg
</iconset>
</property>
<property
name=
"popupMode"
>
<enum>
QToolButton::DelayedPopup
</enum>
</property>
<property
name=
"toolButtonStyle"
>
<enum>
Qt::ToolButtonIconOnly
</enum>
</property>
<property
name=
"autoRaise"
>
<bool>
false
</bool>
</property>
<property
name=
"arrowType"
>
<enum>
Qt::NoArrow
</enum>
</property>
</widget>
</item>
<item
row=
"2"
column=
"7"
>
<widget
class=
"QLabel"
name=
"nameLabel"
>
<property
name=
"minimumSize"
>
<size>
<width>
60
</width>
<height>
0
</height>
</size>
</property>
<property
name=
"text"
>
<string>
Name
</string>
</property>
<property
name=
"alignment"
>
<set>
Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources>
<include
location=
"../../../qgroundcontrol.qrc"
/>
</resources>
<connections/>
</ui>
src/ui/designer/QGCToolWidget.cc
View file @
c54da926
...
...
@@ -11,6 +11,7 @@
#include <QDesktopServices>
#include "QGCParamSlider.h"
#include "QGCComboBox.h"
#include "QGCCommandButton.h"
#include "UASManager.h"
...
...
@@ -193,6 +194,11 @@ void QGCToolWidget::loadSettings(QSettings& settings)
item
=
new
QGCParamSlider
(
this
);
//qDebug() << "CREATED PARAM SLIDER";
}
else
if
(
type
==
"COMBO"
)
{
item
=
new
QGCComboBox
(
this
);
qDebug
()
<<
"CREATED PARAM COMBOBOX"
;
}
if
(
item
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment