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
57c34c1c
Commit
57c34c1c
authored
Oct 15, 2015
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Convert all ui to a single Qml container
parent
5795e64c
Changes
33
Hide whitespace changes
Inline
Side-by-side
Showing
33 changed files
with
625 additions
and
1115 deletions
+625
-1115
QGCApplication.pro
QGCApplication.pro
+6
-8
qgroundcontrol.qrc
qgroundcontrol.qrc
+5
-0
AutoPilotPlugin.cc
src/AutoPilotPlugins/AutoPilotPlugin.cc
+1
-3
FlightDisplayView.qml
src/FlightDisplay/FlightDisplayView.qml
+58
-29
FlightDisplayViewController.cc
src/FlightDisplay/FlightDisplayViewController.cc
+10
-29
FlightDisplayViewController.h
src/FlightDisplay/FlightDisplayViewController.h
+16
-12
FlightMap.qml
src/FlightMap/FlightMap.qml
+6
-0
MissionEditor.qml
src/MissionEditor/MissionEditor.qml
+139
-123
MissionEditorController.cc
src/MissionEditor/MissionEditorController.cc
+36
-46
MissionEditorController.h
src/MissionEditor/MissionEditorController.h
+7
-6
QGCApplication.cc
src/QGCApplication.cc
+16
-5
QGCFileDialog.cc
src/QGCFileDialog.cc
+1
-0
QGCMessageBox.h
src/QGCMessageBox.h
+2
-0
QGCQmlWidgetHolder.cpp
src/QGCQmlWidgetHolder.cpp
+3
-1
QGroundControl.Controls.qmldir
src/QmlControls/QGroundControl.Controls.qmldir
+3
-0
SetupView.cc
src/VehicleSetup/SetupView.cc
+0
-97
SetupView.h
src/VehicleSetup/SetupView.h
+0
-54
SetupView.qml
src/VehicleSetup/SetupView.qml
+1
-0
SetupViewTest.cc
src/VehicleSetup/SetupViewTest.cc
+9
-18
SetupViewTest.h
src/VehicleSetup/SetupViewTest.h
+0
-2
MainWindowTest.cc
src/qgcunittest/MainWindowTest.cc
+5
-8
MainWindowTest.h
src/qgcunittest/MainWindowTest.h
+0
-2
MainWindow.cc
src/ui/MainWindow.cc
+31
-222
MainWindow.h
src/ui/MainWindow.h
+19
-59
MainWindow.qml
src/ui/MainWindow.qml
+106
-0
QGCHilFlightGearConfiguration.cc
src/ui/QGCHilFlightGearConfiguration.cc
+2
-1
SettingsDialog.cc
src/ui/SettingsDialog.cc
+1
-35
SettingsDialog.h
src/ui/SettingsDialog.h
+0
-7
SettingsDialog.ui
src/ui/SettingsDialog.ui
+0
-74
MainToolBar.qml
src/ui/toolbar/MainToolBar.qml
+84
-88
MainToolBarController.cc
src/ui/toolbar/MainToolBarController.cc
+47
-141
MainToolBarController.h
src/ui/toolbar/MainToolBarController.h
+11
-44
UASMessageView.cc
src/ui/uas/UASMessageView.cc
+0
-1
No files found.
QGCApplication.pro
View file @
57c34c1c
...
@@ -216,7 +216,7 @@ HEADERS += \
...
@@ -216,7 +216,7 @@ HEADERS += \
src
/
comm
/
TCPLink
.
h
\
src
/
comm
/
TCPLink
.
h
\
src
/
comm
/
UDPLink
.
h
\
src
/
comm
/
UDPLink
.
h
\
src
/
FlightDisplay
/
FlightDisplayWidget
.
h
\
src
/
FlightDisplay
/
FlightDisplayWidget
.
h
\
src
/
FlightDisplay
/
FlightDisplayView
.
h
\
src
/
FlightDisplay
/
FlightDisplayView
Controller
.
h
\
src
/
FlightMap
/
FlightMapSettings
.
h
\
src
/
FlightMap
/
FlightMapSettings
.
h
\
src
/
GAudioOutput
.
h
\
src
/
GAudioOutput
.
h
\
src
/
HomePositionManager
.
h
\
src
/
HomePositionManager
.
h
\
...
@@ -224,7 +224,7 @@ HEADERS += \
...
@@ -224,7 +224,7 @@ HEADERS += \
src
/
Joystick
/
JoystickManager
.
h
\
src
/
Joystick
/
JoystickManager
.
h
\
src
/
LogCompressor
.
h
\
src
/
LogCompressor
.
h
\
src
/
MG
.
h
\
src
/
MG
.
h
\
src
/
MissionEditor
/
MissionEditor
.
h
\
src
/
MissionEditor
/
MissionEditor
Controller
.
h
\
src
/
MissionManager
/
MissionManager
.
h
\
src
/
MissionManager
/
MissionManager
.
h
\
src
/
QGC
.
h
\
src
/
QGC
.
h
\
src
/
QGCApplication
.
h
\
src
/
QGCApplication
.
h
\
...
@@ -264,7 +264,7 @@ HEADERS += \
...
@@ -264,7 +264,7 @@ HEADERS += \
src
/
ui
/
QGCTCPLinkConfiguration
.
h
\
src
/
ui
/
QGCTCPLinkConfiguration
.
h
\
src
/
ui
/
QGCUDPLinkConfiguration
.
h
\
src
/
ui
/
QGCUDPLinkConfiguration
.
h
\
src
/
ui
/
SettingsDialog
.
h
\
src
/
ui
/
SettingsDialog
.
h
\
src
/
ui
/
toolbar
/
MainToolBar
.
h
\
src
/
ui
/
toolbar
/
MainToolBar
Controller
.
h
\
src
/
ui
/
uas
/
QGCUnconnectedInfoWidget
.
h
\
src
/
ui
/
uas
/
QGCUnconnectedInfoWidget
.
h
\
src
/
ui
/
uas
/
UASMessageView
.
h
\
src
/
ui
/
uas
/
UASMessageView
.
h
\
src
/
MissionItem
.
h
\
src
/
MissionItem
.
h
\
...
@@ -327,7 +327,7 @@ SOURCES += \
...
@@ -327,7 +327,7 @@ SOURCES += \
src
/
comm
/
TCPLink
.
cc
\
src
/
comm
/
TCPLink
.
cc
\
src
/
comm
/
UDPLink
.
cc
\
src
/
comm
/
UDPLink
.
cc
\
src
/
FlightDisplay
/
FlightDisplayWidget
.
cc
\
src
/
FlightDisplay
/
FlightDisplayWidget
.
cc
\
src
/
FlightDisplay
/
FlightDisplayView
.
cc
\
src
/
FlightDisplay
/
FlightDisplayView
Controller
.
cc
\
src
/
FlightMap
/
FlightMapSettings
.
cc
\
src
/
FlightMap
/
FlightMapSettings
.
cc
\
src
/
GAudioOutput
.
cc
\
src
/
GAudioOutput
.
cc
\
src
/
HomePositionManager
.
cc
\
src
/
HomePositionManager
.
cc
\
...
@@ -335,7 +335,7 @@ SOURCES += \
...
@@ -335,7 +335,7 @@ SOURCES += \
src
/
Joystick
/
JoystickManager
.
cc
\
src
/
Joystick
/
JoystickManager
.
cc
\
src
/
LogCompressor
.
cc
\
src
/
LogCompressor
.
cc
\
src
/
main
.
cc
\
src
/
main
.
cc
\
src
/
MissionEditor
/
MissionEditor
.
cc
\
src
/
MissionEditor
/
MissionEditor
Controller
.
cc
\
src
/
MissionManager
/
MissionManager
.
cc
\
src
/
MissionManager
/
MissionManager
.
cc
\
src
/
QGC
.
cc
\
src
/
QGC
.
cc
\
src
/
QGCApplication
.
cc
\
src
/
QGCApplication
.
cc
\
...
@@ -369,7 +369,7 @@ SOURCES += \
...
@@ -369,7 +369,7 @@ SOURCES += \
src
/
ui
/
QGCTCPLinkConfiguration
.
cc
\
src
/
ui
/
QGCTCPLinkConfiguration
.
cc
\
src
/
ui
/
QGCUDPLinkConfiguration
.
cc
\
src
/
ui
/
QGCUDPLinkConfiguration
.
cc
\
src
/
ui
/
SettingsDialog
.
cc
\
src
/
ui
/
SettingsDialog
.
cc
\
src
/
ui
/
toolbar
/
MainToolBar
.
cc
\
src
/
ui
/
toolbar
/
MainToolBar
Controller
.
cc
\
src
/
ui
/
uas
/
QGCUnconnectedInfoWidget
.
cc
\
src
/
ui
/
uas
/
QGCUnconnectedInfoWidget
.
cc
\
src
/
ui
/
uas
/
UASMessageView
.
cc
\
src
/
ui
/
uas
/
UASMessageView
.
cc
\
src
/
MissionItem
.
cc
\
src
/
MissionItem
.
cc
\
...
@@ -518,7 +518,6 @@ HEADERS+= \
...
@@ -518,7 +518,6 @@ HEADERS+= \
src
/
FirmwarePlugin
/
PX4
/
PX4FirmwarePlugin
.
h
\
src
/
FirmwarePlugin
/
PX4
/
PX4FirmwarePlugin
.
h
\
src
/
Vehicle
/
MultiVehicleManager
.
h
\
src
/
Vehicle
/
MultiVehicleManager
.
h
\
src
/
Vehicle
/
Vehicle
.
h
\
src
/
Vehicle
/
Vehicle
.
h
\
src
/
VehicleSetup
/
SetupView
.
h
\
src
/
VehicleSetup
/
VehicleComponent
.
h
\
src
/
VehicleSetup
/
VehicleComponent
.
h
\
!
MobileBuild
{
!
MobileBuild
{
...
@@ -557,7 +556,6 @@ SOURCES += \
...
@@ -557,7 +556,6 @@ SOURCES += \
src
/
FirmwarePlugin
/
PX4
/
PX4FirmwarePlugin
.
cc
\
src
/
FirmwarePlugin
/
PX4
/
PX4FirmwarePlugin
.
cc
\
src
/
Vehicle
/
MultiVehicleManager
.
cc
\
src
/
Vehicle
/
MultiVehicleManager
.
cc
\
src
/
Vehicle
/
Vehicle
.
cc
\
src
/
Vehicle
/
Vehicle
.
cc
\
src
/
VehicleSetup
/
SetupView
.
cc
\
src
/
VehicleSetup
/
VehicleComponent
.
cc
\
src
/
VehicleSetup
/
VehicleComponent
.
cc
\
!
MobileBuild
{
!
MobileBuild
{
...
...
qgroundcontrol.qrc
View file @
57c34c1c
...
@@ -119,6 +119,11 @@
...
@@ -119,6 +119,11 @@
<file alias="QGroundControl/Controls/QGCCanvas.qml">src/QmlControls/QGCCanvas.qml</file>
<file alias="QGroundControl/Controls/QGCCanvas.qml">src/QmlControls/QGCCanvas.qml</file>
<file alias="QGroundControl/Controls/ExclusiveGroupItem.qml">src/QmlControls/ExclusiveGroupItem.qml</file>
<file alias="QGroundControl/Controls/ExclusiveGroupItem.qml">src/QmlControls/ExclusiveGroupItem.qml</file>
<!-- Main Window -->
<file alias="MainWindow.qml">src/ui/MainWindow.qml</file>
<file alias="QGroundControl/Controls/MainToolBar.qml">src/ui/toolbar/MainToolBar.qml</file>
<file alias="QGroundControl/Controls/FlightDisplayView.qml">src/FlightDisplay/FlightDisplayView.qml</file>
<!-- Vehicle Setup -->
<!-- Vehicle Setup -->
<file alias="SetupView.qml">src/VehicleSetup/SetupView.qml</file>
<file alias="SetupView.qml">src/VehicleSetup/SetupView.qml</file>
<file alias="VehicleSummary.qml">src/VehicleSetup/VehicleSummary.qml</file>
<file alias="VehicleSummary.qml">src/VehicleSetup/VehicleSummary.qml</file>
...
...
src/AutoPilotPlugins/AutoPilotPlugin.cc
View file @
57c34c1c
...
@@ -64,9 +64,7 @@ void AutoPilotPlugin::_parametersReadyChanged(bool parametersReady)
...
@@ -64,9 +64,7 @@ void AutoPilotPlugin::_parametersReadyChanged(bool parametersReady)
QGCMessageBox
::
warning
(
"Setup"
,
"One or more vehicle components require setup prior to flight."
);
QGCMessageBox
::
warning
(
"Setup"
,
"One or more vehicle components require setup prior to flight."
);
// Take the user to Vehicle Summary
// Take the user to Vehicle Summary
MainWindow
*
mainWindow
=
MainWindow
::
instance
();
MainWindow
::
instance
()
->
showSetupView
();
Q_ASSERT
(
mainWindow
);
mainWindow
->
getMainToolBar
()
->
onSetupView
();
qgcApp
()
->
processEvents
(
QEventLoop
::
ExcludeUserInputEvents
);
qgcApp
()
->
processEvents
(
QEventLoop
::
ExcludeUserInputEvents
);
}
}
}
}
...
...
src/FlightDisplay/FlightDisplayView.qml
View file @
57c34c1c
...
@@ -34,11 +34,23 @@ import QGroundControl.ScreenTools 1.0
...
@@ -34,11 +34,23 @@ import QGroundControl.ScreenTools 1.0
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
Palette
1.0
import
QGroundControl
.
Palette
1.0
import
QGroundControl
.
Vehicle
1.0
import
QGroundControl
.
Vehicle
1.0
import
QGroundControl
.
Controllers
1.0
/// Flight Display View
/// Flight Display View
Item
{
Item
{
id
:
root
id
:
root
// Top margin for all widgets. Used to prevent overlap with the toolbar
property
real
topMargin
:
0
// Used by parent to hide widgets when it displays something above in the z order.
// Prevents z order drawing problems.
property
bool
hideWidgets
:
false
readonly
property
alias
zOrderTopMost
:
flightMap
.
zOrderTopMost
readonly
property
alias
zOrderWidgets
:
flightMap
.
zOrderWidgets
readonly
property
alias
zOrderMapItems
:
flightMap
.
zOrderMapItems
property
var
__qgcPal
:
QGCPalette
{
colorGroupEnabled
:
enabled
}
property
var
__qgcPal
:
QGCPalette
{
colorGroupEnabled
:
enabled
}
property
var
_activeVehicle
:
multiVehicleManager
.
activeVehicle
property
var
_activeVehicle
:
multiVehicleManager
.
activeVehicle
...
@@ -70,6 +82,8 @@ Item {
...
@@ -70,6 +82,8 @@ Item {
property
bool
_showMap
:
getBool
(
QGroundControl
.
flightMapSettings
.
loadMapSetting
(
flightMap
.
mapName
,
_showMapBackgroundKey
,
"
1
"
))
property
bool
_showMap
:
getBool
(
QGroundControl
.
flightMapSettings
.
loadMapSetting
(
flightMap
.
mapName
,
_showMapBackgroundKey
,
"
1
"
))
FlightDisplayViewController
{
id
:
_controller
;
}
ExclusiveGroup
{
ExclusiveGroup
{
id
:
_dropButtonsExclusiveGroup
id
:
_dropButtonsExclusiveGroup
}
}
...
@@ -86,7 +100,7 @@ Item {
...
@@ -86,7 +100,7 @@ Item {
}
}
function
_setShowMap
(
showMap
)
{
function
_setShowMap
(
showMap
)
{
_showMap
=
flightDisplay
.
hasVideo
?
showMap
:
true
_showMap
=
_controller
.
hasVideo
?
showMap
:
true
QGroundControl
.
flightMapSettings
.
saveMapSetting
(
flightMap
.
mapName
,
_showMapBackgroundKey
,
setBool
(
_showMap
))
QGroundControl
.
flightMapSettings
.
saveMapSetting
(
flightMap
.
mapName
,
_showMapBackgroundKey
,
setBool
(
_showMap
))
}
}
...
@@ -118,6 +132,7 @@ Item {
...
@@ -118,6 +132,7 @@ Item {
label
:
"
H
"
label
:
"
H
"
coordinate
:
(
_activeVehicle
&&
_activeVehicle
.
homePositionAvailable
)
?
_activeVehicle
.
homePosition
:
QtPositioning
.
coordinate
(
0
,
0
)
coordinate
:
(
_activeVehicle
&&
_activeVehicle
.
homePositionAvailable
)
?
_activeVehicle
.
homePosition
:
QtPositioning
.
coordinate
(
0
,
0
)
visible
:
_activeVehicle
?
_activeVehicle
.
homePositionAvailable
:
false
visible
:
_activeVehicle
?
_activeVehicle
.
homePositionAvailable
:
false
z
:
flightMap
.
zOrderMapItems
}
}
// Add trajectory points to the map
// Add trajectory points to the map
...
@@ -128,6 +143,8 @@ Item {
...
@@ -128,6 +143,8 @@ Item {
MapPolyline
{
MapPolyline
{
line.width
:
3
line.width
:
3
line.color
:
"
orange
"
line.color
:
"
orange
"
z
:
flightMap
.
zOrderMapItems
-
1
path
:
[
path
:
[
{
latitude
:
object
.
coordinate1
.
latitude
,
longitude
:
object
.
coordinate1
.
longitude
},
{
latitude
:
object
.
coordinate1
.
latitude
,
longitude
:
object
.
coordinate1
.
longitude
},
...
@@ -145,6 +162,7 @@ Item {
...
@@ -145,6 +162,7 @@ Item {
vehicle
:
object
vehicle
:
object
coordinate
:
object
.
coordinate
coordinate
:
object
.
coordinate
isSatellite
:
flightMap
.
isSatelliteMap
isSatellite
:
flightMap
.
isSatelliteMap
z
:
flightMap
.
zOrderMapItems
}
}
}
}
...
@@ -157,6 +175,7 @@ Item {
...
@@ -157,6 +175,7 @@ Item {
label
:
object
.
sequenceNumber
label
:
object
.
sequenceNumber
isCurrentItem
:
object
.
isCurrentItem
isCurrentItem
:
object
.
isCurrentItem
coordinate
:
object
.
coordinate
coordinate
:
object
.
coordinate
z
:
flightMap
.
zOrderMapItems
}
}
}
}
...
@@ -175,17 +194,20 @@ Item {
...
@@ -175,17 +194,20 @@ Item {
horizontalAlignment
:
Text
.
AlignHCenter
horizontalAlignment
:
Text
.
AlignHCenter
visible
:
object
.
satelliteLock
<
2
visible
:
object
.
satelliteLock
<
2
text
:
"
No GPS Lock for Vehicle #
"
+
object
.
id
text
:
"
No GPS Lock for Vehicle #
"
+
object
.
id
z
:
flightMap
.
zOrderMapItems
-
2
}
}
}
}
}
}
QGCCompassWidget
{
QGCCompassWidget
{
anchors.margins
:
ScreenTools
.
defaultFontPixelHeight
anchors.leftMargin
:
ScreenTools
.
defaultFontPixelHeight
anchors.topMargin
:
topMargin
anchors.left
:
parent
.
left
anchors.left
:
parent
.
left
anchors.top
:
parent
.
top
anchors.top
:
parent
.
top
size
:
ScreenTools
.
defaultFontPixelSize
*
(
13.3
)
size
:
ScreenTools
.
defaultFontPixelSize
*
(
13.3
)
heading
:
_heading
heading
:
_heading
active
:
multiVehicleManager
.
activeVehicleAvailable
active
:
multiVehicleManager
.
activeVehicleAvailable
z
:
flightMap
.
zOrderWidgets
}
}
QGCAttitudeWidget
{
QGCAttitudeWidget
{
...
@@ -196,6 +218,7 @@ Item {
...
@@ -196,6 +218,7 @@ Item {
rollAngle
:
_roll
rollAngle
:
_roll
pitchAngle
:
_pitch
pitchAngle
:
_pitch
active
:
multiVehicleManager
.
activeVehicleAvailable
active
:
multiVehicleManager
.
activeVehicleAvailable
z
:
flightMap
.
zOrderWidgets
}
}
DropButton
{
DropButton
{
...
@@ -207,6 +230,7 @@ Item {
...
@@ -207,6 +230,7 @@ Item {
buttonImage
:
"
/qmlimages/MapCenter.svg
"
buttonImage
:
"
/qmlimages/MapCenter.svg
"
viewportMargins
:
ScreenTools
.
defaultFontPixelWidth
/
2
viewportMargins
:
ScreenTools
.
defaultFontPixelWidth
/
2
exclusiveGroup
:
_dropButtonsExclusiveGroup
exclusiveGroup
:
_dropButtonsExclusiveGroup
z
:
flightMap
.
zOrderWidgets
dropDownComponent
:
Component
{
dropDownComponent
:
Component
{
Row
{
Row
{
...
@@ -242,14 +266,16 @@ Item {
...
@@ -242,14 +266,16 @@ Item {
}
}
DropButton
{
DropButton
{
id
:
mapTypeButton
id
:
mapTypeButton
anchors.margins
:
ScreenTools
.
defaultFontPixelHeight
anchors.topMargin
:
topMargin
anchors.top
:
parent
.
top
anchors.rightMargin
:
ScreenTools
.
defaultFontPixelHeight
anchors.right
:
parent
.
right
anchors.top
:
parent
.
top
dropDirection
:
dropDown
anchors.right
:
parent
.
right
buttonImage
:
"
/qmlimages/MapType.svg
"
dropDirection
:
dropDown
viewportMargins
:
ScreenTools
.
defaultFontPixelWidth
/
2
buttonImage
:
"
/qmlimages/MapType.svg
"
exclusiveGroup
:
_dropButtonsExclusiveGroup
viewportMargins
:
ScreenTools
.
defaultFontPixelWidth
/
2
exclusiveGroup
:
_dropButtonsExclusiveGroup
z
:
flightMap
.
zOrderWidgets
dropDownComponent
:
Component
{
dropDownComponent
:
Component
{
Row
{
Row
{
...
@@ -277,8 +303,8 @@ Item {
...
@@ -277,8 +303,8 @@ Item {
QGCVideoBackground
{
QGCVideoBackground
{
anchors.fill
:
parent
anchors.fill
:
parent
display
:
videoDisplay
display
:
_controller
.
videoSurface
receiver
:
videoReceiver
receiver
:
_controller
.
videoReceiver
visible
:
!
_showMap
visible
:
!
_showMap
QGCCompassHUD
{
QGCCompassHUD
{
...
@@ -289,7 +315,7 @@ Item {
...
@@ -289,7 +315,7 @@ Item {
height
:
ScreenTools
.
defaultFontPixelSize
*
(
10
)
height
:
ScreenTools
.
defaultFontPixelSize
*
(
10
)
heading
:
_heading
heading
:
_heading
active
:
multiVehicleManager
.
activeVehicleAvailable
active
:
multiVehicleManager
.
activeVehicleAvailable
z
:
70
z
:
flightMap
.
zOrderWidgets
}
}
QGCAttitudeHUD
{
QGCAttitudeHUD
{
...
@@ -299,6 +325,7 @@ Item {
...
@@ -299,6 +325,7 @@ Item {
width
:
ScreenTools
.
defaultFontPixelSize
*
(
30
)
width
:
ScreenTools
.
defaultFontPixelSize
*
(
30
)
height
:
ScreenTools
.
defaultFontPixelSize
*
(
30
)
height
:
ScreenTools
.
defaultFontPixelSize
*
(
30
)
active
:
multiVehicleManager
.
activeVehicleAvailable
active
:
multiVehicleManager
.
activeVehicleAvailable
z
:
flightMap
.
zOrderWidgets
}
}
}
}
...
@@ -307,7 +334,8 @@ Item {
...
@@ -307,7 +334,8 @@ Item {
height
:
parent
.
height
*
0.65
>
ScreenTools
.
defaultFontPixelSize
*
(
23.4
)
?
ScreenTools
.
defaultFontPixelSize
*
(
23.4
)
:
parent
.
height
*
0.65
height
:
parent
.
height
*
0.65
>
ScreenTools
.
defaultFontPixelSize
*
(
23.4
)
?
ScreenTools
.
defaultFontPixelSize
*
(
23.4
)
:
parent
.
height
*
0.65
width
:
ScreenTools
.
defaultFontPixelSize
*
(
5
)
width
:
ScreenTools
.
defaultFontPixelSize
*
(
5
)
altitude
:
_altitudeWGS84
altitude
:
_altitudeWGS84
z
:
30
z
:
flightMap
.
zOrderWidgets
visible
:
!
hideWidgets
}
}
QGCSpeedWidget
{
QGCSpeedWidget
{
...
@@ -315,7 +343,8 @@ Item {
...
@@ -315,7 +343,8 @@ Item {
width
:
ScreenTools
.
defaultFontPixelSize
*
(
5
)
width
:
ScreenTools
.
defaultFontPixelSize
*
(
5
)
height
:
parent
.
height
*
0.65
>
ScreenTools
.
defaultFontPixelSize
*
(
23.4
)
?
ScreenTools
.
defaultFontPixelSize
*
(
23.4
)
:
parent
.
height
*
0.65
height
:
parent
.
height
*
0.65
>
ScreenTools
.
defaultFontPixelSize
*
(
23.4
)
?
ScreenTools
.
defaultFontPixelSize
*
(
23.4
)
:
parent
.
height
*
0.65
speed
:
_groundSpeed
speed
:
_groundSpeed
z
:
40
z
:
flightMap
.
zOrderWidgets
visible
:
!
hideWidgets
}
}
QGCCurrentSpeed
{
QGCCurrentSpeed
{
...
@@ -324,7 +353,8 @@ Item {
...
@@ -324,7 +353,8 @@ Item {
airspeed
:
_airSpeed
airspeed
:
_airSpeed
groundspeed
:
_groundSpeed
groundspeed
:
_groundSpeed
active
:
multiVehicleManager
.
activeVehicleAvailable
active
:
multiVehicleManager
.
activeVehicleAvailable
z
:
50
z
:
flightMap
.
zOrderWidgets
visible
:
!
hideWidgets
}
}
QGCCurrentAltitude
{
QGCCurrentAltitude
{
...
@@ -333,7 +363,8 @@ Item {
...
@@ -333,7 +363,8 @@ Item {
altitude
:
_altitudeWGS84
altitude
:
_altitudeWGS84
vertZ
:
_climbRate
vertZ
:
_climbRate
active
:
multiVehicleManager
.
activeVehicleAvailable
active
:
multiVehicleManager
.
activeVehicleAvailable
z
:
60
z
:
flightMap
.
zOrderWidgets
visible
:
!
hideWidgets
}
}
// Mission item list
// Mission item list
...
@@ -348,6 +379,8 @@ Item {
...
@@ -348,6 +379,8 @@ Item {
opacity
:
0.75
opacity
:
0.75
orientation
:
ListView
.
Horizontal
orientation
:
ListView
.
Horizontal
model
:
multiVehicleManager
.
activeVehicle
?
multiVehicleManager
.
activeVehicle
.
missionItems
:
0
model
:
multiVehicleManager
.
activeVehicle
?
multiVehicleManager
.
activeVehicle
.
missionItems
:
0
z
:
flightMap
.
zOrderWidgets
visible
:
!
hideWidgets
property
real
_maxItemHeight
:
0
property
real
_maxItemHeight
:
0
...
@@ -360,12 +393,14 @@ Item {
...
@@ -360,12 +393,14 @@ Item {
QGCButton
{
QGCButton
{
id
:
optionsButton
id
:
optionsButton
x
:
flightMap
.
mapWidgets
.
x
x
:
flightMap
.
mapWidgets
.
x
y
:
flightMap
.
mapWidgets
.
y
-
height
-
(
ScreenTools
.
defaultFontPixelHeight
/
2
)
y
:
flightMap
.
mapWidgets
.
y
-
height
-
(
ScreenTools
.
defaultFontPixelHeight
/
2
)
width
:
flightMap
.
mapWidgets
.
width
z
:
flightMap
.
zOrderWidgets
text
:
"
Options
"
width
:
flightMap
.
mapWidgets
.
width
menu
:
optionsMenu
text
:
"
Options
"
menu
:
optionsMenu
visible
:
_controller
.
hasVideo
&&
!
hideWidgets
ExclusiveGroup
{
ExclusiveGroup
{
id
:
backgroundTypeGroup
id
:
backgroundTypeGroup
...
@@ -380,7 +415,6 @@ Item {
...
@@ -380,7 +415,6 @@ Item {
checkable
:
true
checkable
:
true
checked
:
_showMap
checked
:
_showMap
text
:
"
Show map as background
"
text
:
"
Show map as background
"
visible
:
flightDisplay
.
hasVideo
onTriggered
:
_setShowMap
(
true
)
onTriggered
:
_setShowMap
(
true
)
}
}
...
@@ -391,14 +425,9 @@ Item {
...
@@ -391,14 +425,9 @@ Item {
checkable
:
true
checkable
:
true
checked
:
!
_showMap
checked
:
!
_showMap
text
:
"
Show video as background
"
text
:
"
Show video as background
"
visible
:
flightDisplay
.
hasVideo
onTriggered
:
_setShowMap
(
false
)
onTriggered
:
_setShowMap
(
false
)
}
}
MenuSeparator
{
visible
:
flightDisplay
.
hasVideo
&&
_showMap
}
}
}
}
}
}
}
src/FlightDisplay/FlightDisplayView.cc
→
src/FlightDisplay/FlightDisplayView
Controller
.cc
View file @
57c34c1c
...
@@ -26,30 +26,15 @@ This file is part of the QGROUNDCONTROL project
...
@@ -26,30 +26,15 @@ This file is part of the QGROUNDCONTROL project
#include <QSettings>
#include <QSettings>
#include <VideoItem.h>
#include <VideoItem.h>
#include <VideoSurface.h>
#include "VideoReceiver.h"
#include "ScreenToolsController.h"
#include "ScreenToolsController.h"
#include "FlightDisplayView.h"
#include "FlightDisplayView
Controller
.h"
const
char
*
kMainFlightDisplayView
Group
=
"FlightDisplayView
"
;
const
char
*
kMainFlightDisplayView
ControllerGroup
=
"FlightDisplayViewController
"
;
FlightDisplayView
::
FlightDisplayView
(
QWidge
t
*
parent
)
FlightDisplayView
Controller
::
FlightDisplayViewController
(
QObjec
t
*
parent
)
:
Q
GCQmlWidgetHolder
(
QString
(),
NULL
,
parent
)
:
Q
Object
(
parent
)
{
{
setSizePolicy
(
QSizePolicy
::
MinimumExpanding
,
QSizePolicy
::
MinimumExpanding
);
setObjectName
(
"FlightDisplayView"
);
// Get rid of layout default margins
QLayout
*
pl
=
layout
();
if
(
pl
)
{
pl
->
setContentsMargins
(
0
,
0
,
0
,
0
);
}
#ifndef __android__
setMinimumWidth
(
31
*
ScreenToolsController
::
defaultFontPixelSize_s
());
setMinimumHeight
(
33
*
ScreenToolsController
::
defaultFontPixelSize_s
());
#endif
setContextPropertyObject
(
"flightDisplay"
,
this
);
/*
/*
* This is the receiving end of an UDP RTP stream. The sender can be setup with this command:
* This is the receiving end of an UDP RTP stream. The sender can be setup with this command:
*
*
...
@@ -75,19 +60,15 @@ FlightDisplayView::FlightDisplayView(QWidget *parent)
...
@@ -75,19 +60,15 @@ FlightDisplayView::FlightDisplayView(QWidget *parent)
* Do not change anything else unless you know what you are doing. Any other change will require a matching change on the receiving end.
* Do not change anything else unless you know what you are doing. Any other change will require a matching change on the receiving end.
*
*
*/
*/
VideoSurface
*
pSurface
=
new
VideoSurface
;
_videoSurface
=
new
VideoSurface
;
setContextPropertyObject
(
"videoDisplay"
,
pSurface
);
_videoReceiver
=
new
VideoReceiver
(
this
);
VideoReceiver
*
pReceiver
=
new
VideoReceiver
(
this
);
_videoReceiver
->
setUri
(
QLatin1Literal
(
"udp://0.0.0.0:5000"
));
pReceiver
->
setUri
(
QLatin1Literal
(
"udp://0.0.0.0:5000"
));
#if defined(QGC_GST_STREAMING)
#if defined(QGC_GST_STREAMING)
pReceiver
->
setVideoSink
(
p
Surface
->
videoSink
());
_videoReceiver
->
setVideoSink
(
_video
Surface
->
videoSink
());
#endif
#endif
setContextPropertyObject
(
"videoReceiver"
,
pReceiver
);
setSource
(
QUrl
::
fromUserInput
(
"qrc:/qml/FlightDisplayView.qml"
));
setVisible
(
true
);
}
}
FlightDisplayView
::~
FlightDisplayView
()
FlightDisplayView
Controller
::~
FlightDisplayViewController
()
{
{
}
}
src/FlightDisplay/FlightDisplayView.h
→
src/FlightDisplay/FlightDisplayView
Controller
.h
View file @
57c34c1c
...
@@ -21,32 +21,36 @@ This file is part of the QGROUNDCONTROL project
...
@@ -21,32 +21,36 @@ This file is part of the QGROUNDCONTROL project
======================================================================*/
======================================================================*/
#ifndef FlightDisplayView_H
#ifndef FlightDisplayView
Controller
_H
#define FlightDisplayView_H
#define FlightDisplayView
Controller
_H
#include
"QGCQmlWidgetHolder.h"
#include
<QObject>
class
FlightDisplayView
:
public
QGCQmlWidgetHolder
#include "VideoSurface.h"
#include "VideoReceiver.h"
class
FlightDisplayViewController
:
public
QObject
{
{
Q_OBJECT
Q_OBJECT
public:
FlightDisplayView
(
QWidget
*
parent
=
NULL
);
~
FlightDisplayView
();
/// @brief Invokes the Flight Display Options menu
public:
void
showOptionsMenu
()
{
emit
showOptionsMenuChanged
();
}
FlightDisplayViewController
(
QObject
*
parent
=
NULL
);
~
FlightDisplayViewController
();
Q_PROPERTY
(
bool
hasVideo
READ
hasVideo
CONSTANT
)
Q_PROPERTY
(
bool
hasVideo
READ
hasVideo
CONSTANT
)
Q_PROPERTY
(
VideoSurface
*
videoSurface
MEMBER
_videoSurface
CONSTANT
);
Q_PROPERTY
(
VideoReceiver
*
videoReceiver
MEMBER
_videoReceiver
CONSTANT
);
#if defined(QGC_GST_STREAMING)
#if defined(QGC_GST_STREAMING)
bool
hasVideo
()
{
return
true
;
}
bool
hasVideo
()
{
return
true
;
}
#else
#else
bool
hasVideo
()
{
return
false
;
}
bool
hasVideo
()
{
return
false
;
}
#endif
#endif
signals
:
private
:
void
showOptionsMenuChanged
()
;
VideoSurface
*
_videoSurface
;
VideoReceiver
*
_videoReceiver
;
};
};
#endif
#endif
src/FlightMap/FlightMap.qml
View file @
57c34c1c
...
@@ -55,6 +55,10 @@ Map {
...
@@ -55,6 +55,10 @@ Map {
property
real
lon
:
(
longitude
>=
-
180
&&
longitude
<=
180
)
?
longitude
:
0
property
real
lon
:
(
longitude
>=
-
180
&&
longitude
<=
180
)
?
longitude
:
0
property
real
lat
:
(
latitude
>=
-
90
&&
latitude
<=
90
)
?
latitude
:
0
property
real
lat
:
(
latitude
>=
-
90
&&
latitude
<=
90
)
?
latitude
:
0
readonly
property
real
zOrderTopMost
:
1000
///< z order for top most items, toolbar, main window sub view
readonly
property
real
zOrderWidgets
:
100
///< z order value to widgets, for example: zoom controls, hud widgetss
readonly
property
real
zOrderMapItems
:
50
///< z order value for map items, for example: mission item indicators
zoomLevel
:
18
zoomLevel
:
18
center
:
QtPositioning
.
coordinate
(
lat
,
lon
)
center
:
QtPositioning
.
coordinate
(
lat
,
lon
)
gesture.flickDeceleration
:
3000
gesture.flickDeceleration
:
3000
...
@@ -115,6 +119,7 @@ Map {
...
@@ -115,6 +119,7 @@ Map {
QGCButton
{
QGCButton
{
width
:
parent
.
_buttonWidth
width
:
parent
.
_buttonWidth
z
:
zOrderWidgets
//iconSource: "/qmlimages/ZoomPlus.svg"
//iconSource: "/qmlimages/ZoomPlus.svg"
text
:
"
+
"
text
:
"
+
"
...
@@ -131,6 +136,7 @@ Map {
...
@@ -131,6 +136,7 @@ Map {
QGCButton
{
QGCButton
{
width
:
parent
.
_buttonWidth
width
:
parent
.
_buttonWidth
z
:
zOrderWidgets
//iconSource: "/qmlimages/ZoomMinus.svg"
//iconSource: "/qmlimages/ZoomMinus.svg"
text
:
"
-
"
text
:
"
-
"
...
...
src/MissionEditor/MissionEditor.qml
View file @
57c34c1c
...
@@ -33,28 +33,34 @@ import QGroundControl.ScreenTools 1.0
...
@@ -33,28 +33,34 @@ import QGroundControl.ScreenTools 1.0
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
Palette
1.0
import
QGroundControl
.
Palette
1.0
import
QGroundControl
.
Mavlink
1.0
import
QGroundControl
.
Mavlink
1.0
import
QGroundControl
.
Controllers
1.0
/// Mission Editor
/// Mission Editor
QGCView
{
QGCView
{
viewPanel
:
panel
viewPanel
:
panel
// zOrder comes from the Loader in MainWindow.qml
z
:
zOrder
readonly
property
int
_decimalPlaces
:
7
readonly
property
int
_decimalPlaces
:
7
readonly
property
real
_horizontalMargin
:
ScreenTools
.
defaultFontPixelWidth
/
2
readonly
property
real
_horizontalMargin
:
ScreenTools
.
defaultFontPixelWidth
/
2
readonly
property
real
_verticalMargin
:
ScreenTools
.
defaultFontPixelHeight
/
2
readonly
property
real
_verticalMargin
:
ScreenTools
.
defaultFontPixelHeight
/
2
readonly
property
var
_activeVehicle
:
multiVehicleManager
.
activeVehicle
readonly
property
var
_activeVehicle
:
multiVehicleManager
.
activeVehicle
readonly
property
real
_editFieldWidth
:
ScreenTools
.
defaultFontPixelWidth
*
16
readonly
property
real
_editFieldWidth
:
ScreenTools
.
defaultFontPixelWidth
*
16
property
var
_missionItems
:
controller
.
missionItems
property
var
_missionItems
:
_
controller
.
missionItems
property
var
_homePositionManager
:
QGroundControl
.
homePositionManager
property
var
_homePositionManager
:
QGroundControl
.
homePositionManager
property
string
_homePositionName
:
_homePositionManager
.
homePositions
.
get
(
0
).
name
property
string
_homePositionName
:
_homePositionManager
.
homePositions
.
get
(
0
).
name
property
var
offlineHomePosition
:
_homePositionManager
.
homePositions
.
get
(
0
).
coordinate
property
var
offlineHomePosition
:
_homePositionManager
.
homePositions
.
get
(
0
).
coordinate
property
var
liveHomePosition
:
controller
.
liveHomePosition
property
var
liveHomePosition
:
_
controller
.
liveHomePosition
property
var
liveHomePositionAvailable
:
controller
.
liveHomePositionAvailable
property
var
liveHomePositionAvailable
:
_
controller
.
liveHomePositionAvailable
property
var
homePosition
:
offlineHomePosition
// live or offline depending on state
property
var
homePosition
:
offlineHomePosition
// live or offline depending on state
MissionEditorController
{
id
:
_controller
}
QGCPalette
{
id
:
_qgcPal
;
colorGroupEnabled
:
enabled
}
QGCPalette
{
id
:
_qgcPal
;
colorGroupEnabled
:
enabled
}
ExclusiveGroup
{
ExclusiveGroup
{
...
@@ -86,7 +92,7 @@ QGCView {
...
@@ -86,7 +92,7 @@ QGCView {
onLiveHomePositionChanged
:
updateHomePosition
()
onLiveHomePositionChanged
:
updateHomePosition
()
Connections
{
Connections
{
target
:
controller
target
:
_
controller
// When the mission items change _missionsItems[0] changes as well so we need to reset it to home
// When the mission items change _missionsItems[0] changes as well so we need to reset it to home
onMissionItemsChanged
:
updateHomePosition
onMissionItemsChanged
:
updateHomePosition
...
@@ -123,7 +129,7 @@ QGCView {
...
@@ -123,7 +129,7 @@ QGCView {
if
(
homePositionManagerButton
.
checked
)
{
if
(
homePositionManagerButton
.
checked
)
{
offlineHomePosition
=
coordinate
offlineHomePosition
=
coordinate
}
else
if
(
addMissionItemsButton
.
checked
)
{
}
else
if
(
addMissionItemsButton
.
checked
)
{
var
index
=
controller
.
addMissionItem
(
coordinate
)
var
index
=
_
controller
.
addMissionItem
(
coordinate
)
setCurrentItem
(
index
)
setCurrentItem
(
index
)
}
}
}
}
...
@@ -138,7 +144,7 @@ QGCView {
...
@@ -138,7 +144,7 @@ QGCView {
border.color
:
"
white
"
border.color
:
"
white
"
color
:
"
black
"
color
:
"
black
"
opacity
:
0.75
opacity
:
0.75
visible
:
controller
.
missionItems
.
dirty
visible
:
_
controller
.
missionItems
.
dirty
QGCLabel
{
QGCLabel
{
id
:
syncNeededText
id
:
syncNeededText
...
@@ -154,58 +160,61 @@ QGCView {
...
@@ -154,58 +160,61 @@ QGCView {
}
}
}
}
Row
{
RoundButton
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
id
:
addMissionItemsButton
anchors.top
:
parent
.
top
anchors.rightMargin
:
ScreenTools
.
defaultFontPixelWidth
anchors.right
:
parent
.
right
anchors.right
:
homePositionManagerButton
.
left
anchors.margins
:
ScreenTools
.
defaultFontPixelWidth
anchors.top
:
helpButton
.
top
buttonImage
:
"
/qmlimages/MapAddMission.svg
"
RoundButton
{
exclusiveGroup
:
_dropButtonsExclusiveGroup
id
:
addMissionItemsButton
}
buttonImage
:
"
/qmlimages/MapAddMission.svg
"
exclusiveGroup
:
_dropButtonsExclusiveGroup
}
RoundButton
{
id
:
homePositionManagerButton
buttonImage
:
"
/qmlimages/MapHome.svg
"
exclusiveGroup
:
_dropButtonsExclusiveGroup
}
DropButton
{
id
:
centerMapButton
dropDirection
:
dropDown
buttonImage
:
"
/qmlimages/MapCenter.svg
"
viewportMargins
:
ScreenTools
.
defaultFontPixelWidth
/
2
exclusiveGroup
:
_dropButtonsExclusiveGroup
dropDownComponent
:
Component
{
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
QGCButton
{
RoundButton
{
text
:
"
Home
"
id
:
homePositionManagerButton
anchors.rightMargin
:
ScreenTools
.
defaultFontPixelWidth
anchors.right
:
centerMapButton
.
left
anchors.top
:
helpButton
.
top
buttonImage
:
"
/qmlimages/MapHome.svg
"
exclusiveGroup
:
_dropButtonsExclusiveGroup
}
onClicked
:
{
DropButton
{
centerMapButton
.
hideDropDown
()
id
:
centerMapButton
editorMap
.
center
=
QtPositioning
.
coordinate
(
homePosition
.
latitude
,
homePosition
.
longitude
)
anchors.rightMargin
:
ScreenTools
.
defaultFontPixelWidth
}
anchors.right
:
syncButton
.
left
anchors.top
:
helpButton
.
top
dropDirection
:
dropDown
buttonImage
:
"
/qmlimages/MapCenter.svg
"
viewportMargins
:
ScreenTools
.
defaultFontPixelWidth
/
2
exclusiveGroup
:
_dropButtonsExclusiveGroup
dropDownComponent
:
Component
{
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
QGCButton
{
text
:
"
Home
"
onClicked
:
{
centerMapButton
.
hideDropDown
()
editorMap
.
center
=
QtPositioning
.
coordinate
(
homePosition
.
latitude
,
homePosition
.
longitude
)
}
}
}
QGCButton
{
QGCButton
{
text
:
"
Vehicle
"
text
:
"
Vehicle
"
enabled
:
activeVehicle
&&
activeVehicle
.
latitude
!=
0
&&
activeVehicle
.
longitude
!=
0
enabled
:
activeVehicle
&&
activeVehicle
.
latitude
!=
0
&&
activeVehicle
.
longitude
!=
0
property
var
activeVehicle
:
multiVehicleManager
.
activeVehicle
property
var
activeVehicle
:
multiVehicleManager
.
activeVehicle
onClicked
:
{
onClicked
:
{
centerMapButton
.
hideDropDown
()
centerMapButton
.
hideDropDown
()
editorMap
.
latitude
=
activeVehicle
.
latitude
editorMap
.
latitude
=
activeVehicle
.
latitude
editorMap
.
longitude
=
activeVehicle
.
longitude
editorMap
.
longitude
=
activeVehicle
.
longitude
}
}
}
}
/*
/*
This code will need to wait for Qml 5.5 support since Map.visibleRegion is only in Qt 5.5
This code will need to wait for Qml 5.5 support since Map.visibleRegion is only in Qt 5.5
...
@@ -240,104 +249,111 @@ QGCView {
...
@@ -240,104 +249,111 @@ QGCView {
}
}
}
}
*/
*/
}
}
}
}
}
}
DropButton
{
DropButton
{
id
:
syncButton
id
:
syncButton
dropDirection
:
dropDown
anchors.rightMargin
:
ScreenTools
.
defaultFontPixelWidth
buttonImage
:
"
/qmlimages/MapSync.svg
"
anchors.right
:
mapTypeButton
.
left
viewportMargins
:
ScreenTools
.
defaultFontPixelWidth
/
2
anchors.top
:
helpButton
.
top
exclusiveGroup
:
_dropButtonsExclusiveGroup
dropDirection
:
dropDown
buttonImage
:
"
/qmlimages/MapSync.svg
"
dropDownComponent
:
Component
{
viewportMargins
:
ScreenTools
.
defaultFontPixelWidth
/
2
Row
{
exclusiveGroup
:
_dropButtonsExclusiveGroup
spacing
:
ScreenTools
.
defaultFontPixelWidth
dropDownComponent
:
Component
{
QGCButton
{
Row
{
text
:
"
Load from vehicle
"
spacing
:
ScreenTools
.
defaultFontPixelWidth
enabled
:
_activeVehicle
&&
!
_activeVehicle
.
missionManager
.
inProgress
QGCButton
{
onClicked
:
{
text
:
"
Load from vehicle
"
syncButton
.
hideDropDown
()
enabled
:
_activeVehicle
&&
!
_activeVehicle
.
missionManager
.
inProgress
controller
.
getMissionItems
()
}
onClicked
:
{
syncButton
.
hideDropDown
()
_controller
.
getMissionItems
()
}
}
}
QGCButton
{
QGCButton
{
text
:
"
Save to vehicle
"
text
:
"
Save to vehicle
"
enabled
:
_activeVehicle
&&
!
_activeVehicle
.
missionManager
.
inProgress
enabled
:
_activeVehicle
&&
!
_activeVehicle
.
missionManager
.
inProgress
onClicked
:
{
onClicked
:
{
syncButton
.
hideDropDown
()
syncButton
.
hideDropDown
()
controller
.
setMissionItems
()
_controller
.
setMissionItems
()
}
}
}
}
QGCButton
{
QGCButton
{
text
:
"
Load from file...
"
text
:
"
Load from file...
"
onClicked
:
{
onClicked
:
{
syncButton
.
hideDropDown
()
syncButton
.
hideDropDown
()
controller
.
loadMissionFromFile
()
_controller
.
loadMissionFromFile
()
}
}
}
}
QGCButton
{
QGCButton
{
text
:
"
Save to file...
"
text
:
"
Save to file...
"
onClicked
:
{
onClicked
:
{
syncButton
.
hideDropDown
()
syncButton
.
hideDropDown
()
controller
.
saveMissionToFile
()
_controller
.
saveMissionToFile
()
}
}
}
}
}
}
}
}
}
}
DropButton
{
DropButton
{
id
:
mapTypeButton
id
:
mapTypeButton
dropDirection
:
dropDown
anchors.rightMargin
:
ScreenTools
.
defaultFontPixelWidth
buttonImage
:
"
/qmlimages/MapType.svg
"
anchors.right
:
helpButton
.
left
viewportMargins
:
ScreenTools
.
defaultFontPixelWidth
/
2
anchors.top
:
helpButton
.
top
exclusiveGroup
:
_dropButtonsExclusiveGroup
dropDirection
:
dropDown
buttonImage
:
"
/qmlimages/MapType.svg
"
viewportMargins
:
ScreenTools
.
defaultFontPixelWidth
/
2
exclusiveGroup
:
_dropButtonsExclusiveGroup
dropDownComponent
:
Component
{
dropDownComponent
:
Component
{
Row
{
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
spacing
:
ScreenTools
.
defaultFontPixelWidth
Repeater
{
Repeater
{
model
:
QGroundControl
.
flightMapSettings
.
mapTypes
model
:
QGroundControl
.
flightMapSettings
.
mapTypes
QGCButton
{
QGCButton
{
checkable
:
true
checkable
:
true
checked
:
editorMap
.
mapType
==
text
checked
:
editorMap
.
mapType
==
text
text
:
modelData
text
:
modelData
exclusiveGroup
:
_mapTypeButtonsExclusiveGroup
exclusiveGroup
:
_mapTypeButtonsExclusiveGroup
onClicked
:
{
onClicked
:
{
editorMap
.
mapType
=
text
editorMap
.
mapType
=
text
checked
=
true
checked
=
true
mapTypeButton
.
hideDropDown
()
mapTypeButton
.
hideDropDown
()
}
}
}
}
}
}
}
}
}
}
}
}
RoundButton
{
RoundButton
{
id
:
helpButton
id
:
helpButton
buttonImage
:
"
/qmlimages/Help.svg
"
anchors.margins
:
ScreenTools
.
defaultFontPixelWidth
exclusiveGroup
:
_dropButtonsExclusiveGroup
anchors.right
:
parent
.
right
}
anchors.top
:
parent
.
top
buttonImage
:
"
/qmlimages/Help.svg
"
exclusiveGroup
:
_dropButtonsExclusiveGroup
}
}
// Add the mission items to the map
// Add the mission items to the map
MapItemView
{
MapItemView
{
model
:
controller
.
missionItems
model
:
_
controller
.
missionItems
delegate
:
delegate
:
MissionItemIndicator
{
MissionItemIndicator
{
...
@@ -379,7 +395,7 @@ QGCView {
...
@@ -379,7 +395,7 @@ QGCView {
// Add lines between waypoints
// Add lines between waypoints
MapItemView
{
MapItemView
{
model
:
controller
.
waypointLines
model
:
_
controller
.
waypointLines
delegate
:
delegate
:
MapPolyline
{
MapPolyline
{
...
@@ -432,7 +448,7 @@ QGCView {
...
@@ -432,7 +448,7 @@ QGCView {
anchors.fill
:
parent
anchors.fill
:
parent
spacing
:
_verticalMargin
spacing
:
_verticalMargin
orientation
:
ListView
.
Vertical
orientation
:
ListView
.
Vertical
model
:
controller
.
canEdit
?
controller
.
missionItems
:
0
model
:
_controller
.
canEdit
?
_
controller
.
missionItems
:
0
property
real
_maxItemHeight
:
0
property
real
_maxItemHeight
:
0
...
@@ -446,7 +462,7 @@ QGCView {
...
@@ -446,7 +462,7 @@ QGCView {
onRemove
:
{
onRemove
:
{
var
newCurrentItem
=
object
.
sequenceNumber
-
1
var
newCurrentItem
=
object
.
sequenceNumber
-
1
controller
.
removeMissionItem
(
object
.
sequenceNumber
)
_
controller
.
removeMissionItem
(
object
.
sequenceNumber
)
if
(
_missionItems
.
count
>
1
)
{
if
(
_missionItems
.
count
>
1
)
{
newCurrentItem
=
Math
.
min
(
_missionItems
.
count
-
1
,
newCurrentItem
)
newCurrentItem
=
Math
.
min
(
_missionItems
.
count
-
1
,
newCurrentItem
)
setCurrentItem
(
newCurrentItem
)
setCurrentItem
(
newCurrentItem
)
...
@@ -457,7 +473,7 @@ QGCView {
...
@@ -457,7 +473,7 @@ QGCView {
QGCLabel
{
QGCLabel
{
anchors.fill
:
parent
anchors.fill
:
parent
visible
:
!
controller
.
canEdit
visible
:
!
_
controller
.
canEdit
wrapMode
:
Text
.
WordWrap
wrapMode
:
Text
.
WordWrap
text
:
"
The set of mission items you have loaded cannot be edited by QGroundControl.
"
+
text
:
"
The set of mission items you have loaded cannot be edited by QGroundControl.
"
+
"
You will only be able to save these to a file, or send them to a vehicle.
"
"
You will only be able to save these to a file, or send them to a vehicle.
"
...
...
src/MissionEditor/MissionEditor.cc
→
src/MissionEditor/MissionEditor
Controller
.cc
View file @
57c34c1c
...
@@ -21,7 +21,7 @@ This file is part of the QGROUNDCONTROL project
...
@@ -21,7 +21,7 @@ This file is part of the QGROUNDCONTROL project
======================================================================*/
======================================================================*/
#include "MissionEditor.h"
#include "MissionEditor
Controller
.h"
#include "ScreenToolsController.h"
#include "ScreenToolsController.h"
#include "MultiVehicleManager.h"
#include "MultiVehicleManager.h"
#include "MissionManager.h"
#include "MissionManager.h"
...
@@ -32,46 +32,36 @@ This file is part of the QGROUNDCONTROL project
...
@@ -32,46 +32,36 @@ This file is part of the QGROUNDCONTROL project
#include <QQmlEngine>
#include <QQmlEngine>
#include <QSettings>
#include <QSettings>
const
char
*
MissionEditor
::
_settingsGroup
=
"MissionEdito
r"
;
const
char
*
MissionEditor
Controller
::
_settingsGroup
=
"MissionEditorControlle
r"
;
MissionEditor
::
MissionEdito
r
(
QWidget
*
parent
)
MissionEditor
Controller
::
MissionEditorControlle
r
(
QWidget
*
parent
)
:
Q
GCQmlWidgetHolder
(
QString
(),
NULL
,
parent
)
:
Q
Object
(
parent
)
,
_missionItems
(
NULL
)
,
_missionItems
(
NULL
)
,
_canEdit
(
true
)
,
_canEdit
(
true
)
,
_activeVehicle
(
NULL
)
,
_activeVehicle
(
NULL
)
,
_liveHomePositionAvailable
(
false
)
,
_liveHomePositionAvailable
(
false
)
{
{
// Get rid of layout default margins
QLayout
*
pl
=
layout
();
if
(
pl
)
{
pl
->
setContentsMargins
(
0
,
0
,
0
,
0
);
}
MultiVehicleManager
*
multiVehicleMgr
=
MultiVehicleManager
::
instance
();
MultiVehicleManager
*
multiVehicleMgr
=
MultiVehicleManager
::
instance
();
connect
(
multiVehicleMgr
,
&
MultiVehicleManager
::
activeVehicleChanged
,
this
,
&
MissionEditor
::
_activeVehicleChanged
);
connect
(
multiVehicleMgr
,
&
MultiVehicleManager
::
activeVehicleChanged
,
this
,
&
MissionEditor
Controller
::
_activeVehicleChanged
);
Vehicle
*
activeVehicle
=
multiVehicleMgr
->
activeVehicle
();
Vehicle
*
activeVehicle
=
multiVehicleMgr
->
activeVehicle
();
if
(
activeVehicle
)
{
if
(
activeVehicle
)
{
MissionManager
*
missionManager
=
activeVehicle
->
missionManager
();
MissionManager
*
missionManager
=
activeVehicle
->
missionManager
();
connect
(
missionManager
,
&
MissionManager
::
newMissionItemsAvailable
,
this
,
&
MissionEditor
::
_newMissionItemsAvailable
);
connect
(
missionManager
,
&
MissionManager
::
newMissionItemsAvailable
,
this
,
&
MissionEditor
Controller
::
_newMissionItemsAvailable
);
_newMissionItemsAvailable
();
_newMissionItemsAvailable
();
_activeVehicleChanged
(
activeVehicle
);
_activeVehicleChanged
(
activeVehicle
);
}
else
{
}
else
{
_missionItems
=
new
QmlObjectListModel
(
this
);
_missionItems
=
new
QmlObjectListModel
(
this
);
_initAllMissionItems
();
_initAllMissionItems
();
}
}
setContextPropertyObject
(
"controller"
,
this
);
setSource
(
QUrl
::
fromUserInput
(
"qrc:/qml/MissionEditor.qml"
));
}
}
MissionEditor
::~
MissionEdito
r
()
MissionEditor
Controller
::~
MissionEditorControlle
r
()
{
{
}
}
void
MissionEditor
::
_newMissionItemsAvailable
(
void
)
void
MissionEditor
Controller
::
_newMissionItemsAvailable
(
void
)
{
{
if
(
_missionItems
)
{
if
(
_missionItems
)
{
_deinitAllMissionItems
();
_deinitAllMissionItems
();
...
@@ -86,18 +76,18 @@ void MissionEditor::_newMissionItemsAvailable(void)
...
@@ -86,18 +76,18 @@ void MissionEditor::_newMissionItemsAvailable(void)
_initAllMissionItems
();
_initAllMissionItems
();
}
}
void
MissionEditor
::
getMissionItems
(
void
)
void
MissionEditor
Controller
::
getMissionItems
(
void
)
{
{
Vehicle
*
activeVehicle
=
MultiVehicleManager
::
instance
()
->
activeVehicle
();
Vehicle
*
activeVehicle
=
MultiVehicleManager
::
instance
()
->
activeVehicle
();
if
(
activeVehicle
)
{
if
(
activeVehicle
)
{
MissionManager
*
missionManager
=
activeVehicle
->
missionManager
();
MissionManager
*
missionManager
=
activeVehicle
->
missionManager
();
connect
(
missionManager
,
&
MissionManager
::
newMissionItemsAvailable
,
this
,
&
MissionEditor
::
_newMissionItemsAvailable
);
connect
(
missionManager
,
&
MissionManager
::
newMissionItemsAvailable
,
this
,
&
MissionEditor
Controller
::
_newMissionItemsAvailable
);
activeVehicle
->
missionManager
()
->
requestMissionItems
();
activeVehicle
->
missionManager
()
->
requestMissionItems
();
}
}
}
}
void
MissionEditor
::
setMissionItems
(
void
)
void
MissionEditor
Controller
::
setMissionItems
(
void
)
{
{
// FIXME: Need to pull out home position
// FIXME: Need to pull out home position
Vehicle
*
activeVehicle
=
MultiVehicleManager
::
instance
()
->
activeVehicle
();
Vehicle
*
activeVehicle
=
MultiVehicleManager
::
instance
()
->
activeVehicle
();
...
@@ -108,7 +98,7 @@ void MissionEditor::setMissionItems(void)
...
@@ -108,7 +98,7 @@ void MissionEditor::setMissionItems(void)
}
}
}
}
int
MissionEditor
::
addMissionItem
(
QGeoCoordinate
coordinate
)
int
MissionEditor
Controller
::
addMissionItem
(
QGeoCoordinate
coordinate
)
{
{
if
(
!
_canEdit
)
{
if
(
!
_canEdit
)
{
qWarning
()
<<
"addMissionItem called with _canEdit == false"
;
qWarning
()
<<
"addMissionItem called with _canEdit == false"
;
...
@@ -128,7 +118,7 @@ int MissionEditor::addMissionItem(QGeoCoordinate coordinate)
...
@@ -128,7 +118,7 @@ int MissionEditor::addMissionItem(QGeoCoordinate coordinate)
return
_missionItems
->
count
()
-
1
;
return
_missionItems
->
count
()
-
1
;
}
}
void
MissionEditor
::
removeMissionItem
(
int
index
)
void
MissionEditor
Controller
::
removeMissionItem
(
int
index
)
{
{
if
(
!
_canEdit
)
{
if
(
!
_canEdit
)
{
qWarning
()
<<
"addMissionItem called with _canEdit == false"
;
qWarning
()
<<
"addMissionItem called with _canEdit == false"
;
...
@@ -142,7 +132,7 @@ void MissionEditor::removeMissionItem(int index)
...
@@ -142,7 +132,7 @@ void MissionEditor::removeMissionItem(int index)
_recalcAll
();
_recalcAll
();
}
}
void
MissionEditor
::
loadMissionFromFile
(
void
)
void
MissionEditor
Controller
::
loadMissionFromFile
(
void
)
{
{
QString
errorString
;
QString
errorString
;
QString
filename
=
QGCFileDialog
::
getOpenFileName
(
NULL
,
"Select Mission File to load"
);
QString
filename
=
QGCFileDialog
::
getOpenFileName
(
NULL
,
"Select Mission File to load"
);
...
@@ -196,7 +186,7 @@ void MissionEditor::loadMissionFromFile(void)
...
@@ -196,7 +186,7 @@ void MissionEditor::loadMissionFromFile(void)
_initAllMissionItems
();
_initAllMissionItems
();
}
}
void
MissionEditor
::
saveMissionToFile
(
void
)
void
MissionEditor
Controller
::
saveMissionToFile
(
void
)
{
{
QString
errorString
;
QString
errorString
;
QString
filename
=
QGCFileDialog
::
getSaveFileName
(
NULL
,
"Select file to save mission to"
);
QString
filename
=
QGCFileDialog
::
getSaveFileName
(
NULL
,
"Select file to save mission to"
);
...
@@ -222,7 +212,7 @@ void MissionEditor::saveMissionToFile(void)
...
@@ -222,7 +212,7 @@ void MissionEditor::saveMissionToFile(void)
_missionItems
->
setDirty
(
false
);
_missionItems
->
setDirty
(
false
);
}
}
void
MissionEditor
::
_recalcWaypointLines
(
void
)
void
MissionEditor
Controller
::
_recalcWaypointLines
(
void
)
{
{
bool
firstCoordinateItem
=
true
;
bool
firstCoordinateItem
=
true
;
MissionItem
*
lastCoordinateItem
=
qobject_cast
<
MissionItem
*>
(
_missionItems
->
get
(
0
));
MissionItem
*
lastCoordinateItem
=
qobject_cast
<
MissionItem
*>
(
_missionItems
->
get
(
0
));
...
@@ -253,7 +243,7 @@ void MissionEditor::_recalcWaypointLines(void)
...
@@ -253,7 +243,7 @@ void MissionEditor::_recalcWaypointLines(void)
}
}
// This will update the sequence numbers to be sequential starting from 0
// This will update the sequence numbers to be sequential starting from 0
void
MissionEditor
::
_recalcSequence
(
void
)
void
MissionEditor
Controller
::
_recalcSequence
(
void
)
{
{
MissionItem
*
currentParentItem
=
qobject_cast
<
MissionItem
*>
(
_missionItems
->
get
(
0
));
MissionItem
*
currentParentItem
=
qobject_cast
<
MissionItem
*>
(
_missionItems
->
get
(
0
));
...
@@ -268,7 +258,7 @@ void MissionEditor::_recalcSequence(void)
...
@@ -268,7 +258,7 @@ void MissionEditor::_recalcSequence(void)
}
}
// This will update the child item hierarchy
// This will update the child item hierarchy
void
MissionEditor
::
_recalcChildItems
(
void
)
void
MissionEditor
Controller
::
_recalcChildItems
(
void
)
{
{
MissionItem
*
currentParentItem
=
qobject_cast
<
MissionItem
*>
(
_missionItems
->
get
(
0
));
MissionItem
*
currentParentItem
=
qobject_cast
<
MissionItem
*>
(
_missionItems
->
get
(
0
));
...
@@ -287,7 +277,7 @@ void MissionEditor::_recalcChildItems(void)
...
@@ -287,7 +277,7 @@ void MissionEditor::_recalcChildItems(void)
}
}
}
}
void
MissionEditor
::
_recalcAll
(
void
)
void
MissionEditor
Controller
::
_recalcAll
(
void
)
{
{
_recalcSequence
();
_recalcSequence
();
_recalcChildItems
();
_recalcChildItems
();
...
@@ -295,7 +285,7 @@ void MissionEditor::_recalcAll(void)
...
@@ -295,7 +285,7 @@ void MissionEditor::_recalcAll(void)
}
}
/// Initializes a new set of mission items which may have come from the vehicle or have been loaded from a file
/// Initializes a new set of mission items which may have come from the vehicle or have been loaded from a file
void
MissionEditor
::
_initAllMissionItems
(
void
)
void
MissionEditor
Controller
::
_initAllMissionItems
(
void
)
{
{
// Add the home position item to the front
// Add the home position item to the front
MissionItem
*
homeItem
=
new
MissionItem
(
this
);
MissionItem
*
homeItem
=
new
MissionItem
(
this
);
...
@@ -317,45 +307,45 @@ void MissionEditor::_initAllMissionItems(void)
...
@@ -317,45 +307,45 @@ void MissionEditor::_initAllMissionItems(void)
_missionItems
->
setDirty
(
false
);
_missionItems
->
setDirty
(
false
);
}
}
void
MissionEditor
::
_deinitAllMissionItems
(
void
)
void
MissionEditor
Controller
::
_deinitAllMissionItems
(
void
)
{
{
for
(
int
i
=
0
;
i
<
_missionItems
->
count
();
i
++
)
{
for
(
int
i
=
0
;
i
<
_missionItems
->
count
();
i
++
)
{
_deinitMissionItem
(
qobject_cast
<
MissionItem
*>
(
_missionItems
->
get
(
i
)));
_deinitMissionItem
(
qobject_cast
<
MissionItem
*>
(
_missionItems
->
get
(
i
)));
}
}
}
}
void
MissionEditor
::
_initMissionItem
(
MissionItem
*
item
)
void
MissionEditor
Controller
::
_initMissionItem
(
MissionItem
*
item
)
{
{
_missionItems
->
setDirty
(
false
);
_missionItems
->
setDirty
(
false
);
connect
(
item
,
&
MissionItem
::
commandChanged
,
this
,
&
MissionEditor
::
_itemCommandChanged
);
connect
(
item
,
&
MissionItem
::
commandChanged
,
this
,
&
MissionEditor
Controller
::
_itemCommandChanged
);
connect
(
item
,
&
MissionItem
::
coordinateChanged
,
this
,
&
MissionEditor
::
_itemCoordinateChanged
);
connect
(
item
,
&
MissionItem
::
coordinateChanged
,
this
,
&
MissionEditor
Controller
::
_itemCoordinateChanged
);
}
}
void
MissionEditor
::
_deinitMissionItem
(
MissionItem
*
item
)
void
MissionEditor
Controller
::
_deinitMissionItem
(
MissionItem
*
item
)
{
{
disconnect
(
item
,
&
MissionItem
::
commandChanged
,
this
,
&
MissionEditor
::
_itemCommandChanged
);
disconnect
(
item
,
&
MissionItem
::
commandChanged
,
this
,
&
MissionEditor
Controller
::
_itemCommandChanged
);
disconnect
(
item
,
&
MissionItem
::
coordinateChanged
,
this
,
&
MissionEditor
::
_itemCoordinateChanged
);
disconnect
(
item
,
&
MissionItem
::
coordinateChanged
,
this
,
&
MissionEditor
Controller
::
_itemCoordinateChanged
);
}
}
void
MissionEditor
::
_itemCoordinateChanged
(
const
QGeoCoordinate
&
coordinate
)
void
MissionEditor
Controller
::
_itemCoordinateChanged
(
const
QGeoCoordinate
&
coordinate
)
{
{
Q_UNUSED
(
coordinate
);
Q_UNUSED
(
coordinate
);
_recalcWaypointLines
();
_recalcWaypointLines
();
}
}
void
MissionEditor
::
_itemCommandChanged
(
MavlinkQmlSingleton
::
Qml_MAV_CMD
command
)
void
MissionEditor
Controller
::
_itemCommandChanged
(
MavlinkQmlSingleton
::
Qml_MAV_CMD
command
)
{
{
Q_UNUSED
(
command
);;
Q_UNUSED
(
command
);;
_recalcChildItems
();
_recalcChildItems
();
_recalcWaypointLines
();
_recalcWaypointLines
();
}
}
void
MissionEditor
::
_activeVehicleChanged
(
Vehicle
*
activeVehicle
)
void
MissionEditor
Controller
::
_activeVehicleChanged
(
Vehicle
*
activeVehicle
)
{
{
if
(
_activeVehicle
)
{
if
(
_activeVehicle
)
{
disconnect
(
_activeVehicle
,
&
Vehicle
::
homePositionAvailableChanged
,
this
,
&
MissionEditor
::
_activeVehicleHomePositionAvailableChanged
);
disconnect
(
_activeVehicle
,
&
Vehicle
::
homePositionAvailableChanged
,
this
,
&
MissionEditor
Controller
::
_activeVehicleHomePositionAvailableChanged
);
disconnect
(
_activeVehicle
,
&
Vehicle
::
homePositionChanged
,
this
,
&
MissionEditor
::
_activeVehicleHomePositionChanged
);
disconnect
(
_activeVehicle
,
&
Vehicle
::
homePositionChanged
,
this
,
&
MissionEditor
Controller
::
_activeVehicleHomePositionChanged
);
_activeVehicle
=
NULL
;
_activeVehicle
=
NULL
;
_activeVehicleHomePositionAvailableChanged
(
false
);
_activeVehicleHomePositionAvailableChanged
(
false
);
}
}
...
@@ -363,20 +353,20 @@ void MissionEditor::_activeVehicleChanged(Vehicle* activeVehicle)
...
@@ -363,20 +353,20 @@ void MissionEditor::_activeVehicleChanged(Vehicle* activeVehicle)
_activeVehicle
=
activeVehicle
;
_activeVehicle
=
activeVehicle
;
if
(
_activeVehicle
)
{
if
(
_activeVehicle
)
{
connect
(
_activeVehicle
,
&
Vehicle
::
homePositionAvailableChanged
,
this
,
&
MissionEditor
::
_activeVehicleHomePositionAvailableChanged
);
connect
(
_activeVehicle
,
&
Vehicle
::
homePositionAvailableChanged
,
this
,
&
MissionEditor
Controller
::
_activeVehicleHomePositionAvailableChanged
);
connect
(
_activeVehicle
,
&
Vehicle
::
homePositionChanged
,
this
,
&
MissionEditor
::
_activeVehicleHomePositionChanged
);
connect
(
_activeVehicle
,
&
Vehicle
::
homePositionChanged
,
this
,
&
MissionEditor
Controller
::
_activeVehicleHomePositionChanged
);
_activeVehicleHomePositionChanged
(
_activeVehicle
->
homePosition
());
_activeVehicleHomePositionChanged
(
_activeVehicle
->
homePosition
());
_activeVehicleHomePositionAvailableChanged
(
_activeVehicle
->
homePositionAvailable
());
_activeVehicleHomePositionAvailableChanged
(
_activeVehicle
->
homePositionAvailable
());
}
}
}
}
void
MissionEditor
::
_activeVehicleHomePositionAvailableChanged
(
bool
homePositionAvailable
)
void
MissionEditor
Controller
::
_activeVehicleHomePositionAvailableChanged
(
bool
homePositionAvailable
)
{
{
_liveHomePositionAvailable
=
homePositionAvailable
;
_liveHomePositionAvailable
=
homePositionAvailable
;
emit
liveHomePositionAvailableChanged
(
_liveHomePositionAvailable
);
emit
liveHomePositionAvailableChanged
(
_liveHomePositionAvailable
);
}
}
void
MissionEditor
::
_activeVehicleHomePositionChanged
(
const
QGeoCoordinate
&
homePosition
)
void
MissionEditor
Controller
::
_activeVehicleHomePositionChanged
(
const
QGeoCoordinate
&
homePosition
)
{
{
_liveHomePosition
=
homePosition
;
_liveHomePosition
=
homePosition
;
emit
liveHomePositionChanged
(
_liveHomePosition
);
emit
liveHomePositionChanged
(
_liveHomePosition
);
...
...
src/MissionEditor/MissionEditor.h
→
src/MissionEditor/MissionEditor
Controller
.h
View file @
57c34c1c
...
@@ -21,20 +21,21 @@ This file is part of the QGROUNDCONTROL project
...
@@ -21,20 +21,21 @@ This file is part of the QGROUNDCONTROL project
======================================================================*/
======================================================================*/
#ifndef MissionEditor_H
#ifndef MissionEditorController_H
#define MissionEditor_H
#define MissionEditorController_H
#include <QObject>
#include "QGCQmlWidgetHolder.h"
#include "QmlObjectListModel.h"
#include "QmlObjectListModel.h"
#include "Vehicle.h"
#include "Vehicle.h"
class
MissionEditor
:
public
QGCQmlWidgetHolder
class
MissionEditor
Controller
:
public
QObject
{
{
Q_OBJECT
Q_OBJECT
public:
public:
MissionEditor
(
QWidget
*
parent
=
NULL
);
MissionEditor
Controller
(
QWidget
*
parent
=
NULL
);
~
MissionEditor
();
~
MissionEditor
Controller
();
Q_PROPERTY
(
QmlObjectListModel
*
missionItems
READ
missionItems
NOTIFY
missionItemsChanged
)
Q_PROPERTY
(
QmlObjectListModel
*
missionItems
READ
missionItems
NOTIFY
missionItemsChanged
)
Q_PROPERTY
(
QmlObjectListModel
*
waypointLines
READ
waypointLines
NOTIFY
waypointLinesChanged
)
Q_PROPERTY
(
QmlObjectListModel
*
waypointLines
READ
waypointLines
NOTIFY
waypointLinesChanged
)
...
...
src/QGCApplication.cc
View file @
57c34c1c
...
@@ -85,6 +85,11 @@
...
@@ -85,6 +85,11 @@
#include "FlightMapSettings.h"
#include "FlightMapSettings.h"
#include "QGCQGeoCoordinate.h"
#include "QGCQGeoCoordinate.h"
#include "CoordinateVector.h"
#include "CoordinateVector.h"
#include "MainToolBarController.h"
#include "MissionEditorController.h"
#include "FlightDisplayViewController.h"
#include "VideoSurface.h"
#include "VideoReceiver.h"
#ifndef __ios__
#ifndef __ios__
#include "SerialLink.h"
#include "SerialLink.h"
...
@@ -333,7 +338,9 @@ void QGCApplication::_initCommon(void)
...
@@ -333,7 +338,9 @@ void QGCApplication::_initCommon(void)
qmlRegisterUncreatableType
<
QmlObjectListModel
>
(
"QGroundControl"
,
1
,
0
,
"QmlObjectListModel"
,
"Reference only"
);
qmlRegisterUncreatableType
<
QmlObjectListModel
>
(
"QGroundControl"
,
1
,
0
,
"QmlObjectListModel"
,
"Reference only"
);
qmlRegisterUncreatableType
<
QGCQGeoCoordinate
>
(
"QGroundControl"
,
1
,
0
,
"QGCQGeoCoordinate"
,
"Reference only"
);
qmlRegisterUncreatableType
<
QGCQGeoCoordinate
>
(
"QGroundControl"
,
1
,
0
,
"QGCQGeoCoordinate"
,
"Reference only"
);
qmlRegisterUncreatableType
<
CoordinateVector
>
(
"QGroundControl"
,
1
,
0
,
"CoordinateVector"
,
"Reference only"
);
qmlRegisterUncreatableType
<
CoordinateVector
>
(
"QGroundControl"
,
1
,
0
,
"CoordinateVector"
,
"Reference only"
);
qmlRegisterUncreatableType
<
VideoSurface
>
(
"QGroundControl"
,
1
,
0
,
"VideoSurface"
,
"Reference only"
);
qmlRegisterUncreatableType
<
VideoReceiver
>
(
"QGroundControl"
,
1
,
0
,
"VideoReceiver"
,
"Reference only"
);
qmlRegisterType
<
ParameterEditorController
>
(
"QGroundControl.Controllers"
,
1
,
0
,
"ParameterEditorController"
);
qmlRegisterType
<
ParameterEditorController
>
(
"QGroundControl.Controllers"
,
1
,
0
,
"ParameterEditorController"
);
qmlRegisterType
<
FlightModesComponentController
>
(
"QGroundControl.Controllers"
,
1
,
0
,
"FlightModesComponentController"
);
qmlRegisterType
<
FlightModesComponentController
>
(
"QGroundControl.Controllers"
,
1
,
0
,
"FlightModesComponentController"
);
qmlRegisterType
<
AirframeComponentController
>
(
"QGroundControl.Controllers"
,
1
,
0
,
"AirframeComponentController"
);
qmlRegisterType
<
AirframeComponentController
>
(
"QGroundControl.Controllers"
,
1
,
0
,
"AirframeComponentController"
);
...
@@ -341,7 +348,10 @@ void QGCApplication::_initCommon(void)
...
@@ -341,7 +348,10 @@ void QGCApplication::_initCommon(void)
qmlRegisterType
<
PowerComponentController
>
(
"QGroundControl.Controllers"
,
1
,
0
,
"PowerComponentController"
);
qmlRegisterType
<
PowerComponentController
>
(
"QGroundControl.Controllers"
,
1
,
0
,
"PowerComponentController"
);
qmlRegisterType
<
RadioComponentController
>
(
"QGroundControl.Controllers"
,
1
,
0
,
"RadioComponentController"
);
qmlRegisterType
<
RadioComponentController
>
(
"QGroundControl.Controllers"
,
1
,
0
,
"RadioComponentController"
);
qmlRegisterType
<
ScreenToolsController
>
(
"QGroundControl.Controllers"
,
1
,
0
,
"ScreenToolsController"
);
qmlRegisterType
<
ScreenToolsController
>
(
"QGroundControl.Controllers"
,
1
,
0
,
"ScreenToolsController"
);
qmlRegisterType
<
MainToolBarController
>
(
"QGroundControl.Controllers"
,
1
,
0
,
"MainToolBarController"
);
qmlRegisterType
<
MissionEditorController
>
(
"QGroundControl.Controllers"
,
1
,
0
,
"MissionEditorController"
);
qmlRegisterType
<
FlightDisplayViewController
>
(
"QGroundControl.Controllers"
,
1
,
0
,
"FlightDisplayViewController"
);
#ifndef __mobile__
#ifndef __mobile__
qmlRegisterType
<
ViewWidgetController
>
(
"QGroundControl.Controllers"
,
1
,
0
,
"ViewWidgetController"
);
qmlRegisterType
<
ViewWidgetController
>
(
"QGroundControl.Controllers"
,
1
,
0
,
"ViewWidgetController"
);
qmlRegisterType
<
CustomCommandWidgetController
>
(
"QGroundControl.Controllers"
,
1
,
0
,
"CustomCommandWidgetController"
);
qmlRegisterType
<
CustomCommandWidgetController
>
(
"QGroundControl.Controllers"
,
1
,
0
,
"CustomCommandWidgetController"
);
...
@@ -636,8 +646,9 @@ void QGCApplication::_createSingletons(void)
...
@@ -636,8 +646,9 @@ void QGCApplication::_createSingletons(void)
void
QGCApplication
::
_destroySingletons
(
void
)
void
QGCApplication
::
_destroySingletons
(
void
)
{
{
if
(
MainWindow
::
instance
())
{
MainWindow
*
mainWindow
=
MainWindow
::
instance
();
delete
MainWindow
::
instance
();
if
(
mainWindow
)
{
delete
mainWindow
;
}
}
if
(
LinkManager
::
instance
(
true
/* nullOk */
))
{
if
(
LinkManager
::
instance
(
true
/* nullOk */
))
{
...
@@ -804,7 +815,7 @@ void QGCApplication::showToolBarMessage(const QString& message)
...
@@ -804,7 +815,7 @@ void QGCApplication::showToolBarMessage(const QString& message)
{
{
MainWindow
*
mainWindow
=
MainWindow
::
instance
();
MainWindow
*
mainWindow
=
MainWindow
::
instance
();
if
(
mainWindow
)
{
if
(
mainWindow
)
{
mainWindow
->
getMainToolBar
()
->
showToolB
arMessage
(
message
);
mainWindow
->
showToolb
arMessage
(
message
);
}
else
{
}
else
{
QGCMessageBox
::
information
(
""
,
message
);
QGCMessageBox
::
information
(
""
,
message
);
}
}
...
...
src/QGCFileDialog.cc
View file @
57c34c1c
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
#include "QGCFileDialog.h"
#include "QGCFileDialog.h"
#include "QGCApplication.h"
#include "QGCApplication.h"
#include "MainWindow.h"
#include "MainWindow.h"
#ifdef QT_DEBUG
#ifdef QT_DEBUG
#ifndef __mobile__
#ifndef __mobile__
#include "UnitTest.h"
#include "UnitTest.h"
...
...
src/QGCMessageBox.h
View file @
57c34c1c
...
@@ -28,10 +28,12 @@
...
@@ -28,10 +28,12 @@
#include "MainWindow.h"
#include "MainWindow.h"
#include "QGCApplication.h"
#include "QGCApplication.h"
#ifdef QT_DEBUG
#ifdef QT_DEBUG
#ifndef __mobile__
#ifndef __mobile__
#include "UnitTest.h"
#include "UnitTest.h"
#endif
#endif
#endif
#endif
/// @file
/// @file
...
...
src/QGCQmlWidgetHolder.cpp
View file @
57c34c1c
...
@@ -31,6 +31,8 @@ QGCQmlWidgetHolder::QGCQmlWidgetHolder(const QString& title, QAction* action, QW
...
@@ -31,6 +31,8 @@ QGCQmlWidgetHolder::QGCQmlWidgetHolder(const QString& title, QAction* action, QW
{
{
_ui
.
setupUi
(
this
);
_ui
.
setupUi
(
this
);
layout
()
->
setContentsMargins
(
0
,
0
,
0
,
0
);
if
(
action
)
{
if
(
action
)
{
setWindowTitle
(
title
);
setWindowTitle
(
title
);
}
}
...
@@ -70,4 +72,4 @@ QQuickItem* QGCQmlWidgetHolder::getRootObject(void)
...
@@ -70,4 +72,4 @@ QQuickItem* QGCQmlWidgetHolder::getRootObject(void)
void
QGCQmlWidgetHolder
::
setResizeMode
(
QQuickWidget
::
ResizeMode
resizeMode
)
void
QGCQmlWidgetHolder
::
setResizeMode
(
QQuickWidget
::
ResizeMode
resizeMode
)
{
{
_ui
.
qmlWidget
->
setResizeMode
(
resizeMode
);
_ui
.
qmlWidget
->
setResizeMode
(
resizeMode
);
}
}
\ No newline at end of file
src/QmlControls/QGroundControl.Controls.qmldir
View file @
57c34c1c
...
@@ -34,3 +34,6 @@ MissionItemIndexLabel 1.0 MissionItemIndexLabel.qml
...
@@ -34,3 +34,6 @@ MissionItemIndexLabel 1.0 MissionItemIndexLabel.qml
MissionItemSummary 1.0 MissionItemSummary.qml
MissionItemSummary 1.0 MissionItemSummary.qml
MissionItemEditor 1.0 MissionItemEditor.qml
MissionItemEditor 1.0 MissionItemEditor.qml
MainToolBar 1.0 MainToolBar.qml
FlightDisplayView 1.0 FlightDisplayView.qml
src/VehicleSetup/SetupView.cc
deleted
100644 → 0
View file @
5795e64c
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009 - 2015 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL 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.
QGROUNDCONTROL 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 QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/// @file
/// @author Don Gagne <don@thegagnes.com>
#include "SetupView.h"
#include "AutoPilotPluginManager.h"
#include "VehicleComponent.h"
#include "QGCQmlWidgetHolder.h"
#include "MainWindow.h"
#include "QGCMessageBox.h"
#ifndef __mobile__
#include "FirmwareUpgradeController.h"
#endif
#include "ParameterEditorController.h"
#include <QQmlError>
#include <QQmlContext>
#include <QDebug>
SetupView
::
SetupView
(
QWidget
*
parent
)
:
QGCQmlWidgetHolder
(
QString
(),
NULL
,
parent
)
{
setSource
(
QUrl
::
fromUserInput
(
"qrc:/qml/SetupView.qml"
));
}
SetupView
::~
SetupView
()
{
}
#ifdef UNITTEST_BUILD
void
SetupView
::
showFirmware
(
void
)
{
#ifndef __mobile__
QVariant
returnedValue
;
bool
success
=
QMetaObject
::
invokeMethod
(
getRootObject
(),
"showFirmwarePanel"
,
Q_RETURN_ARG
(
QVariant
,
returnedValue
));
Q_ASSERT
(
success
);
Q_UNUSED
(
success
);
#endif
}
void
SetupView
::
showParameters
(
void
)
{
QVariant
returnedValue
;
bool
success
=
QMetaObject
::
invokeMethod
(
getRootObject
(),
"showParametersPanel"
,
Q_RETURN_ARG
(
QVariant
,
returnedValue
));
Q_ASSERT
(
success
);
Q_UNUSED
(
success
);
}
void
SetupView
::
showSummary
(
void
)
{
QVariant
returnedValue
;
bool
success
=
QMetaObject
::
invokeMethod
(
getRootObject
(),
"showSummaryPanel"
,
Q_RETURN_ARG
(
QVariant
,
returnedValue
));
Q_ASSERT
(
success
);
Q_UNUSED
(
success
);
}
void
SetupView
::
showVehicleComponentSetup
(
VehicleComponent
*
vehicleComponent
)
{
QVariant
returnedValue
;
bool
success
=
QMetaObject
::
invokeMethod
(
getRootObject
(),
"showVehicleComponentPanel"
,
Q_RETURN_ARG
(
QVariant
,
returnedValue
),
Q_ARG
(
QVariant
,
QVariant
::
fromValue
((
VehicleComponent
*
)
vehicleComponent
)));
Q_ASSERT
(
success
);
Q_UNUSED
(
success
);
}
#endif
src/VehicleSetup/SetupView.h
deleted
100644 → 0
View file @
5795e64c
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009 - 2014 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL 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.
QGROUNDCONTROL 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 QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
#ifndef SETUPVIEW_H
#define SETUPVIEW_H
#include "UASInterface.h"
#include "VehicleComponent.h"
#include "AutoPilotPlugin.h"
#include "QGCQmlWidgetHolder.h"
#include <QWidget>
/// @file
/// @brief This class is used to display the UI for the VehicleComponent objects.
/// @author Don Gagne <don@thegagnes.com>
class
SetupView
:
public
QGCQmlWidgetHolder
{
Q_OBJECT
public:
explicit
SetupView
(
QWidget
*
parent
=
0
);
~
SetupView
();
#ifdef UNITTEST_BUILD
void
showFirmware
(
void
);
void
showParameters
(
void
);
void
showSummary
(
void
);
void
showVehicleComponentSetup
(
VehicleComponent
*
vehicleComponent
);
#endif
};
#endif
src/VehicleSetup/SetupView.qml
View file @
57c34c1c
...
@@ -37,6 +37,7 @@ import QGroundControl.MultiVehicleManager 1.0
...
@@ -37,6 +37,7 @@ import QGroundControl.MultiVehicleManager 1.0
Rectangle
{
Rectangle
{
id
:
topLevel
id
:
topLevel
color
:
palette
.
window
color
:
palette
.
window
z
:
zOrder
// zOrder comes from the Loader in MainWindow.qml
QGCPalette
{
id
:
palette
;
colorGroupEnabled
:
true
}
QGCPalette
{
id
:
palette
;
colorGroupEnabled
:
true
}
...
...
src/VehicleSetup/SetupViewTest.cc
View file @
57c34c1c
...
@@ -27,14 +27,12 @@
...
@@ -27,14 +27,12 @@
#include "SetupViewTest.h"
#include "SetupViewTest.h"
#include "MockLink.h"
#include "MockLink.h"
#include "QGCMessageBox.h"
#include "QGCMessageBox.h"
#include "SetupView.h"
#include "MultiVehicleManager.h"
#include "MultiVehicleManager.h"
UT_REGISTER_TEST
(
SetupViewTest
)
UT_REGISTER_TEST
(
SetupViewTest
)
SetupViewTest
::
SetupViewTest
(
void
)
:
SetupViewTest
::
SetupViewTest
(
void
)
:
_mainWindow
(
NULL
),
_mainWindow
(
NULL
)
_mainToolBar
(
NULL
)
{
{
}
}
...
@@ -45,9 +43,6 @@ void SetupViewTest::init(void)
...
@@ -45,9 +43,6 @@ void SetupViewTest::init(void)
_mainWindow
=
MainWindow
::
_create
(
NULL
);
_mainWindow
=
MainWindow
::
_create
(
NULL
);
Q_CHECK_PTR
(
_mainWindow
);
Q_CHECK_PTR
(
_mainWindow
);
_mainToolBar
=
_mainWindow
->
getMainToolBar
();
Q_ASSERT
(
_mainToolBar
);
}
}
void
SetupViewTest
::
cleanup
(
void
)
void
SetupViewTest
::
cleanup
(
void
)
...
@@ -78,33 +73,29 @@ void SetupViewTest::_clickThrough_test(void)
...
@@ -78,33 +73,29 @@ void SetupViewTest::_clickThrough_test(void)
AutoPilotPlugin
*
autopilot
=
MultiVehicleManager
::
instance
()
->
activeVehicle
()
->
autopilotPlugin
();
AutoPilotPlugin
*
autopilot
=
MultiVehicleManager
::
instance
()
->
activeVehicle
()
->
autopilotPlugin
();
Q_ASSERT
(
autopilot
);
Q_ASSERT
(
autopilot
);
// Switch to the Setup view
_mainToolBar
->
onSetupView
();
QTest
::
qWait
(
1000
);
MainWindow
*
mainWindow
=
MainWindow
::
instance
();
MainWindow
*
mainWindow
=
MainWindow
::
instance
();
Q_ASSERT
(
mainWindow
);
Q_ASSERT
(
mainWindow
);
QWidget
*
setupViewWidget
=
mainWindow
->
getCurrentViewWidget
();
Q_ASSERT
(
setupViewWidget
);
SetupView
*
setupView
=
qobject_cast
<
SetupView
*>
(
setupViewWidget
);
Q_ASSERT
(
setupView
);
// Switch to the Setup view
_mainWindow
->
showSetupView
();
QTest
::
qWait
(
1000
);
// Click through fixed buttons
// Click through fixed buttons
qDebug
()
<<
"Showing firmware"
;
qDebug
()
<<
"Showing firmware"
;
setupView
->
show
Firmware
();
_mainWindow
->
showSetup
Firmware
();
QTest
::
qWait
(
1000
);
QTest
::
qWait
(
1000
);
qDebug
()
<<
"Showing parameters"
;
qDebug
()
<<
"Showing parameters"
;
setupView
->
show
Parameters
();
_mainWindow
->
showSetup
Parameters
();
QTest
::
qWait
(
1000
);
QTest
::
qWait
(
1000
);
qDebug
()
<<
"Showing summary"
;
qDebug
()
<<
"Showing summary"
;
setupView
->
show
Summary
();
_mainWindow
->
showSetup
Summary
();
QTest
::
qWait
(
1000
);
QTest
::
qWait
(
1000
);
const
QVariantList
&
components
=
autopilot
->
vehicleComponents
();
const
QVariantList
&
components
=
autopilot
->
vehicleComponents
();
foreach
(
QVariant
varComponent
,
components
)
{
foreach
(
QVariant
varComponent
,
components
)
{
VehicleComponent
*
component
=
qobject_cast
<
VehicleComponent
*>
(
qvariant_cast
<
QObject
*>
(
varComponent
));
VehicleComponent
*
component
=
qobject_cast
<
VehicleComponent
*>
(
qvariant_cast
<
QObject
*>
(
varComponent
));
qDebug
()
<<
"Showing"
<<
component
->
name
();
qDebug
()
<<
"Showing"
<<
component
->
name
();
setupView
->
showVehicleComponentSetup
(
component
);
_mainWindow
->
showSetupVehicleComponent
(
component
);
QTest
::
qWait
(
1000
);
QTest
::
qWait
(
1000
);
}
}
...
...
src/VehicleSetup/SetupViewTest.h
View file @
57c34c1c
...
@@ -29,7 +29,6 @@
...
@@ -29,7 +29,6 @@
#include "UnitTest.h"
#include "UnitTest.h"
#include "MainWindow.h"
#include "MainWindow.h"
#include "MainToolBar.h"
/// Click through test for Setup View buttons
/// Click through test for Setup View buttons
class
SetupViewTest
:
public
UnitTest
class
SetupViewTest
:
public
UnitTest
...
@@ -47,7 +46,6 @@ private slots:
...
@@ -47,7 +46,6 @@ private slots:
private:
private:
MainWindow
*
_mainWindow
;
MainWindow
*
_mainWindow
;
MainToolBar
*
_mainToolBar
;
};
};
#endif
#endif
src/qgcunittest/MainWindowTest.cc
View file @
57c34c1c
...
@@ -34,8 +34,7 @@
...
@@ -34,8 +34,7 @@
UT_REGISTER_TEST
(
MainWindowTest
)
UT_REGISTER_TEST
(
MainWindowTest
)
MainWindowTest
::
MainWindowTest
(
void
)
:
MainWindowTest
::
MainWindowTest
(
void
)
:
_mainWindow
(
NULL
),
_mainWindow
(
NULL
)
_mainToolBar
(
NULL
)
{
{
}
}
...
@@ -46,14 +45,12 @@ void MainWindowTest::init(void)
...
@@ -46,14 +45,12 @@ void MainWindowTest::init(void)
_mainWindow
=
MainWindow
::
_create
(
NULL
);
_mainWindow
=
MainWindow
::
_create
(
NULL
);
Q_CHECK_PTR
(
_mainWindow
);
Q_CHECK_PTR
(
_mainWindow
);
_mainToolBar
=
_mainWindow
->
getMainToolBar
();
Q_ASSERT
(
_mainToolBar
);
}
}
void
MainWindowTest
::
cleanup
(
void
)
void
MainWindowTest
::
cleanup
(
void
)
{
{
_mainWindow
->
close
();
_mainWindow
->
close
();
QTest
::
qWait
(
200
);
delete
_mainWindow
;
delete
_mainWindow
;
UnitTest
::
cleanup
();
UnitTest
::
cleanup
();
...
@@ -78,11 +75,11 @@ void MainWindowTest::_connectWindowClose_test(MAV_AUTOPILOT autopilot)
...
@@ -78,11 +75,11 @@ void MainWindowTest::_connectWindowClose_test(MAV_AUTOPILOT autopilot)
// Cycle through all the top level views
// Cycle through all the top level views
_main
ToolBar
->
on
SetupView
();
_main
Window
->
show
SetupView
();
QTest
::
qWait
(
200
);
QTest
::
qWait
(
200
);
_main
ToolBar
->
on
PlanView
();
_main
Window
->
show
PlanView
();
QTest
::
qWait
(
200
);
QTest
::
qWait
(
200
);
_main
ToolBar
->
on
FlyView
();
_main
Window
->
show
FlyView
();
QTest
::
qWait
(
200
);
QTest
::
qWait
(
200
);
// On MainWindow close we should get a message box telling the user to disconnect first. Cancel should do nothing.
// On MainWindow close we should get a message box telling the user to disconnect first. Cancel should do nothing.
...
...
src/qgcunittest/MainWindowTest.h
View file @
57c34c1c
...
@@ -31,7 +31,6 @@
...
@@ -31,7 +31,6 @@
#include "UnitTest.h"
#include "UnitTest.h"
#include "MainWindow.h"
#include "MainWindow.h"
#include "MainToolBar.h"
class
MainWindowTest
:
public
UnitTest
class
MainWindowTest
:
public
UnitTest
{
{
...
@@ -51,7 +50,6 @@ private:
...
@@ -51,7 +50,6 @@ private:
void
_connectWindowClose_test
(
MAV_AUTOPILOT
autopilot
);
void
_connectWindowClose_test
(
MAV_AUTOPILOT
autopilot
);
MainWindow
*
_mainWindow
;
MainWindow
*
_mainWindow
;
MainToolBar
*
_mainToolBar
;
};
};
#endif
#endif
src/ui/MainWindow.cc
View file @
57c34c1c
...
@@ -38,6 +38,7 @@ This file is part of the QGROUNDCONTROL project
...
@@ -38,6 +38,7 @@ This file is part of the QGROUNDCONTROL project
#include <QScreen>
#include <QScreen>
#include <QDesktopServices>
#include <QDesktopServices>
#include <QDockWidget>
#include <QDockWidget>
#include <QMenuBar>
#include "QGC.h"
#include "QGC.h"
#include "MAVLinkProtocol.h"
#include "MAVLinkProtocol.h"
...
@@ -46,14 +47,11 @@ This file is part of the QGROUNDCONTROL project
...
@@ -46,14 +47,11 @@ This file is part of the QGROUNDCONTROL project
#include "QGCMAVLinkLogPlayer.h"
#include "QGCMAVLinkLogPlayer.h"
#include "SettingsDialog.h"
#include "SettingsDialog.h"
#include "MAVLinkDecoder.h"
#include "MAVLinkDecoder.h"
#include "FlightDisplayView.h"
#include "SetupView.h"
#include "QGCApplication.h"
#include "QGCApplication.h"
#include "QGCFileDialog.h"
#include "QGCFileDialog.h"
#include "QGCMessageBox.h"
#include "QGCMessageBox.h"
#include "MultiVehicleManager.h"
#include "MultiVehicleManager.h"
#include "HomePositionManager.h"
#include "HomePositionManager.h"
#include "MissionEditor.h"
#include "LogCompressor.h"
#include "LogCompressor.h"
#include "UAS.h"
#include "UAS.h"
...
@@ -128,11 +126,8 @@ MainWindow::MainWindow(QSplashScreen* splashScreen)
...
@@ -128,11 +126,8 @@ MainWindow::MainWindow(QSplashScreen* splashScreen)
:
_autoReconnect
(
false
)
:
_autoReconnect
(
false
)
,
_lowPowerMode
(
false
)
,
_lowPowerMode
(
false
)
,
_showStatusBar
(
false
)
,
_showStatusBar
(
false
)
,
_centerStackActionGroup
(
new
QActionGroup
(
this
))
,
_centralLayout
(
NULL
)
,
_currentViewWidget
(
NULL
)
,
_splashScreen
(
splashScreen
)
,
_splashScreen
(
splashScreen
)
,
_
currentView
(
VIEW_SETUP
)
,
_
mainQmlWidgetHolder
(
NULL
)
{
{
Q_ASSERT
(
_instance
==
NULL
);
Q_ASSERT
(
_instance
==
NULL
);
_instance
=
this
;
_instance
=
this
;
...
@@ -148,6 +143,7 @@ MainWindow::MainWindow(QSplashScreen* splashScreen)
...
@@ -148,6 +143,7 @@ MainWindow::MainWindow(QSplashScreen* splashScreen)
// Setup user interface
// Setup user interface
loadSettings
();
loadSettings
();
emit
initStatusChanged
(
tr
(
"Setting up user interface"
),
Qt
::
AlignLeft
|
Qt
::
AlignBottom
,
QColor
(
62
,
93
,
141
));
emit
initStatusChanged
(
tr
(
"Setting up user interface"
),
Qt
::
AlignLeft
|
Qt
::
AlignBottom
,
QColor
(
62
,
93
,
141
));
_ui
.
setupUi
(
this
);
_ui
.
setupUi
(
this
);
// Make sure tool bar elements all fit before changing minimum width
// Make sure tool bar elements all fit before changing minimum width
setMinimumWidth
(
1008
);
setMinimumWidth
(
1008
);
...
@@ -155,10 +151,18 @@ MainWindow::MainWindow(QSplashScreen* splashScreen)
...
@@ -155,10 +151,18 @@ MainWindow::MainWindow(QSplashScreen* splashScreen)
// Setup central widget with a layout to hold the views
// Setup central widget with a layout to hold the views
_centralLayout
=
new
QVBoxLayout
();
_centralLayout
=
new
QVBoxLayout
();
_centralLayout
->
setContentsMargins
(
0
,
0
,
0
,
0
);
_centralLayout
->
setContentsMargins
(
0
,
0
,
0
,
0
);
centralWidget
()
->
setLayout
(
_centralLayout
);
centralWidget
()
->
setLayout
(
_centralLayout
);
_mainQmlWidgetHolder
=
new
QGCQmlWidgetHolder
(
QString
(),
NULL
,
this
);
_centralLayout
->
addWidget
(
_mainQmlWidgetHolder
);
_mainQmlWidgetHolder
->
setVisible
(
true
);
_mainQmlWidgetHolder
->
setContextPropertyObject
(
"controller"
,
this
);
_mainQmlWidgetHolder
->
setSource
(
QUrl
::
fromUserInput
(
"qrc:qml/MainWindow.qml"
));
// Set dock options
// Set dock options
setDockOptions
(
AnimatedDocks
|
AllowTabbedDocks
|
AllowNestedDocks
);
setDockOptions
(
0
);
// Setup corners
// Setup corners
setCorner
(
Qt
::
BottomRightCorner
,
Qt
::
BottomDockWidgetArea
);
setCorner
(
Qt
::
BottomRightCorner
,
Qt
::
BottomDockWidgetArea
);
...
@@ -167,26 +171,12 @@ MainWindow::MainWindow(QSplashScreen* splashScreen)
...
@@ -167,26 +171,12 @@ MainWindow::MainWindow(QSplashScreen* splashScreen)
menuBar
()
->
setNativeMenuBar
(
false
);
menuBar
()
->
setNativeMenuBar
(
false
);
#endif
#endif
#ifndef __mobile__
#ifdef UNITTEST_BUILD
#ifdef UNITTEST_BUILD
QAction
*
qmlTestAction
=
new
QAction
(
"Test QML palette and controls"
,
NULL
);
QAction
*
qmlTestAction
=
new
QAction
(
"Test QML palette and controls"
,
NULL
);
connect
(
qmlTestAction
,
&
QAction
::
triggered
,
this
,
&
MainWindow
::
_showQmlTestWidget
);
connect
(
qmlTestAction
,
&
QAction
::
triggered
,
this
,
&
MainWindow
::
_showQmlTestWidget
);
_ui
.
menuWidgets
->
addAction
(
qmlTestAction
);
_ui
.
menuWidgets
->
addAction
(
qmlTestAction
);
#endif
#endif
#endif
// Load QML Toolbar
QDockWidget
*
widget
=
new
QDockWidget
(
this
);
widget
->
setObjectName
(
"ToolBarDockWidget"
);
qmlRegisterType
<
MainToolBar
>
(
"QGroundControl.MainToolBar"
,
1
,
0
,
"MainToolBar"
);
_mainToolBar
=
new
MainToolBar
(
widget
);
widget
->
setWidget
(
_mainToolBar
);
widget
->
setFeatures
(
QDockWidget
::
NoDockWidgetFeatures
);
widget
->
setTitleBarWidget
(
new
QWidget
(
this
));
// Disables the title bar
addDockWidget
(
Qt
::
TopDockWidgetArea
,
widget
);
// Setup UI state machines
_centerStackActionGroup
->
setExclusive
(
true
);
// Status Bar
// Status Bar
setStatusBar
(
new
QStatusBar
(
this
));
setStatusBar
(
new
QStatusBar
(
this
));
statusBar
()
->
setSizeGripEnabled
(
true
);
statusBar
()
->
setSizeGripEnabled
(
true
);
...
@@ -226,8 +216,7 @@ MainWindow::MainWindow(QSplashScreen* splashScreen)
...
@@ -226,8 +216,7 @@ MainWindow::MainWindow(QSplashScreen* splashScreen)
// Set low power mode
// Set low power mode
enableLowPowerMode
(
_lowPowerMode
);
enableLowPowerMode
(
_lowPowerMode
);
emit
initStatusChanged
(
tr
(
"Restoring last view state"
),
Qt
::
AlignLeft
|
Qt
::
AlignBottom
,
QColor
(
62
,
93
,
141
));
emit
initStatusChanged
(
tr
(
"Restoring last view state"
),
Qt
::
AlignLeft
|
Qt
::
AlignBottom
,
QColor
(
62
,
93
,
141
));
// Restore the window setup
_loadCurrentViewState
();
#ifndef __mobile__
#ifndef __mobile__
// Restore the window position and size
// Restore the window position and size
...
@@ -286,6 +275,8 @@ MainWindow::MainWindow(QSplashScreen* splashScreen)
...
@@ -286,6 +275,8 @@ MainWindow::MainWindow(QSplashScreen* splashScreen)
_ui
.
actionFullscreen
->
setShortcut
(
QApplication
::
translate
(
"MainWindow"
,
"Ctrl+Return"
,
0
));
_ui
.
actionFullscreen
->
setShortcut
(
QApplication
::
translate
(
"MainWindow"
,
"Ctrl+Return"
,
0
));
#endif
#endif
_ui
.
actionFlight
->
setChecked
(
true
);
connect
(
&
windowNameUpdateTimer
,
SIGNAL
(
timeout
()),
this
,
SLOT
(
configureWindowName
()));
connect
(
&
windowNameUpdateTimer
,
SIGNAL
(
timeout
()),
this
,
SLOT
(
configureWindowName
()));
windowNameUpdateTimer
.
start
(
15000
);
windowNameUpdateTimer
.
start
(
15000
);
emit
initStatusChanged
(
tr
(
"Done"
),
Qt
::
AlignLeft
|
Qt
::
AlignBottom
,
QColor
(
62
,
93
,
141
));
emit
initStatusChanged
(
tr
(
"Done"
),
Qt
::
AlignLeft
|
Qt
::
AlignBottom
,
QColor
(
62
,
93
,
141
));
...
@@ -321,24 +312,9 @@ MainWindow::MainWindow(QSplashScreen* splashScreen)
...
@@ -321,24 +312,9 @@ MainWindow::MainWindow(QSplashScreen* splashScreen)
MainWindow
::~
MainWindow
()
MainWindow
::~
MainWindow
()
{
{
// Delete all UAS objects
for
(
int
i
=
0
;
i
<
_commsWidgetList
.
size
();
i
++
)
{
_commsWidgetList
[
i
]
->
deleteLater
();
}
_instance
=
NULL
;
_instance
=
NULL
;
}
}
void
MainWindow
::
resizeEvent
(
QResizeEvent
*
event
)
{
QMainWindow
::
resizeEvent
(
event
);
}
QString
MainWindow
::
_getWindowStateKey
()
{
return
QString
::
number
(
_currentView
)
+
"_windowstate_"
;
}
QString
MainWindow
::
_getWindowGeometryKey
()
QString
MainWindow
::
_getWindowGeometryKey
()
{
{
return
"_geometry"
;
return
"_geometry"
;
...
@@ -447,30 +423,6 @@ void MainWindow::_showDockWidgetAction(bool show)
...
@@ -447,30 +423,6 @@ void MainWindow::_showDockWidgetAction(bool show)
}
}
#endif
#endif
void
MainWindow
::
_buildMissionEditorView
(
void
)
{
if
(
!
_missionEditorView
)
{
_missionEditorView
=
new
MissionEditor
(
this
);
_missionEditorView
->
setVisible
(
false
);
}
}
void
MainWindow
::
_buildFlightView
(
void
)
{
if
(
!
_flightView
)
{
_flightView
=
new
FlightDisplayView
(
this
);
_flightView
->
setVisible
(
false
);
}
}
void
MainWindow
::
_buildSetupView
(
void
)
{
if
(
!
_setupView
)
{
_setupView
=
new
SetupView
(
this
);
_setupView
->
setVisible
(
false
);
}
}
void
MainWindow
::
fullScreenActionItemCallback
(
bool
)
void
MainWindow
::
fullScreenActionItemCallback
(
bool
)
{
{
_ui
.
actionNormal
->
setChecked
(
false
);
_ui
.
actionNormal
->
setChecked
(
false
);
...
@@ -514,7 +466,14 @@ void MainWindow::closeEvent(QCloseEvent *event)
...
@@ -514,7 +466,14 @@ void MainWindow::closeEvent(QCloseEvent *event)
// Should not be any active connections
// Should not be any active connections
Q_ASSERT
(
!
LinkManager
::
instance
()
->
anyConnectedLinks
());
Q_ASSERT
(
!
LinkManager
::
instance
()
->
anyConnectedLinks
());
// We have to pull out the QmlWidget from the main window and delete it here, before
// the MainWindow ends up getting deleted. Otherwise the Qml has a reference to MainWindow
// inside it which in turn causes a shutdown crash.
_centralLayout
->
removeWidget
(
_mainQmlWidgetHolder
);
delete
_mainQmlWidgetHolder
;
_mainQmlWidgetHolder
=
NULL
;
_storeCurrentViewState
();
_storeCurrentViewState
();
storeSettings
();
storeSettings
();
event
->
accept
();
event
->
accept
();
...
@@ -540,10 +499,6 @@ void MainWindow::storeSettings()
...
@@ -540,10 +499,6 @@ void MainWindow::storeSettings()
settings
.
setValue
(
"SHOW_STATUSBAR"
,
_showStatusBar
);
settings
.
setValue
(
"SHOW_STATUSBAR"
,
_showStatusBar
);
settings
.
endGroup
();
settings
.
endGroup
();
settings
.
setValue
(
_getWindowGeometryKey
(),
saveGeometry
());
settings
.
setValue
(
_getWindowGeometryKey
(),
saveGeometry
());
// Save the last current view in any case
settings
.
setValue
(
"CURRENT_VIEW"
,
_currentView
);
settings
.
setValue
(
_getWindowStateKey
(),
saveState
());
#ifndef __mobile__
#ifndef __mobile__
_storeVisibleWidgetsSettings
();
_storeVisibleWidgetsSettings
();
...
@@ -581,43 +536,9 @@ void MainWindow::enableAutoReconnect(bool enabled)
...
@@ -581,43 +536,9 @@ void MainWindow::enableAutoReconnect(bool enabled)
**/
**/
void
MainWindow
::
connectCommonActions
()
void
MainWindow
::
connectCommonActions
()
{
{
// Bind together the perspective actions
QActionGroup
*
perspectives
=
new
QActionGroup
(
_ui
.
menuPerspectives
);
perspectives
->
addAction
(
_ui
.
actionPlan
);
perspectives
->
addAction
(
_ui
.
actionSetup
);
perspectives
->
setExclusive
(
true
);
if
(
_currentView
==
VIEW_FLIGHT
)
{
_ui
.
actionFlight
->
setChecked
(
true
);
_ui
.
actionFlight
->
activate
(
QAction
::
Trigger
);
}
if
(
_currentView
==
VIEW_MISSIONEDITOR
)
{
_ui
.
actionPlan
->
setChecked
(
true
);
_ui
.
actionPlan
->
activate
(
QAction
::
Trigger
);
}
if
(
_currentView
==
VIEW_SETUP
)
{
_ui
.
actionSetup
->
setChecked
(
true
);
_ui
.
actionSetup
->
activate
(
QAction
::
Trigger
);
}
// Connect actions from ui
// Connect actions from ui
connect
(
_ui
.
actionAdd_Link
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
manageLinks
()));
connect
(
_ui
.
actionAdd_Link
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
manageLinks
()));
// Connect internal actions
connect
(
MultiVehicleManager
::
instance
(),
&
MultiVehicleManager
::
vehicleAdded
,
this
,
&
MainWindow
::
_vehicleAdded
);
// Views actions
connect
(
_ui
.
actionFlight
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
loadFlightView
()));
connect
(
_ui
.
actionPlan
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
loadPlanView
()));
// Help Actions
connect
(
_ui
.
actionOnline_Documentation
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
showHelp
()));
connect
(
_ui
.
actionDeveloper_Credits
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
showCredits
()));
connect
(
_ui
.
actionProject_Roadmap
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
showRoadMap
()));
// Audio output
// Audio output
_ui
.
actionMuteAudioOutput
->
setChecked
(
GAudioOutput
::
instance
()
->
isMuted
());
_ui
.
actionMuteAudioOutput
->
setChecked
(
GAudioOutput
::
instance
()
->
isMuted
());
connect
(
GAudioOutput
::
instance
(),
SIGNAL
(
mutedChanged
(
bool
)),
_ui
.
actionMuteAudioOutput
,
SLOT
(
setChecked
(
bool
)));
connect
(
GAudioOutput
::
instance
(),
SIGNAL
(
mutedChanged
(
bool
)),
_ui
.
actionMuteAudioOutput
,
SLOT
(
setChecked
(
bool
)));
...
@@ -626,8 +547,13 @@ void MainWindow::connectCommonActions()
...
@@ -626,8 +547,13 @@ void MainWindow::connectCommonActions()
// Application Settings
// Application Settings
connect
(
_ui
.
actionSettings
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
showSettings
()));
connect
(
_ui
.
actionSettings
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
showSettings
()));
// Update Tool Bar
// Views actions
_mainToolBar
->
setCurrentView
(
_currentView
);
connect
(
_ui
.
actionFlight
,
&
QAction
::
triggered
,
this
,
&
MainWindow
::
showFlyView
);
connect
(
_ui
.
actionPlan
,
&
QAction
::
triggered
,
this
,
&
MainWindow
::
showPlanView
);
connect
(
_ui
.
actionSetup
,
&
QAction
::
triggered
,
this
,
&
MainWindow
::
showSetupView
);
// Connect internal actions
connect
(
MultiVehicleManager
::
instance
(),
&
MultiVehicleManager
::
vehicleAdded
,
this
,
&
MainWindow
::
_vehicleAdded
);
}
}
void
MainWindow
::
_openUrl
(
const
QString
&
url
,
const
QString
&
errorMessage
)
void
MainWindow
::
_openUrl
(
const
QString
&
url
,
const
QString
&
errorMessage
)
...
@@ -640,43 +566,12 @@ void MainWindow::_openUrl(const QString& url, const QString& errorMessage)
...
@@ -640,43 +566,12 @@ void MainWindow::_openUrl(const QString& url, const QString& errorMessage)
}
}
}
}
void
MainWindow
::
showHelp
()
{
_openUrl
(
"http://qgroundcontrol.org/users/start"
,
tr
(
"To get to the online help, please open http://qgroundcontrol.org/user_guide in a browser."
));
}
void
MainWindow
::
showCredits
()
{
_openUrl
(
"http://qgroundcontrol.org/credits"
,
tr
(
"To get to the credits, please open http://qgroundcontrol.org/credits in a browser."
));
}
void
MainWindow
::
showRoadMap
()
{
_openUrl
(
"http://qgroundcontrol.org/dev/roadmap"
,
tr
(
"To get to the online help, please open http://qgroundcontrol.org/roadmap in a browser."
));
}
void
MainWindow
::
showSettings
()
void
MainWindow
::
showSettings
()
{
{
SettingsDialog
settings
(
this
);
SettingsDialog
settings
(
this
);
settings
.
exec
();
settings
.
exec
();
}
}
void
MainWindow
::
commsWidgetDestroyed
(
QObject
*
obj
)
{
// Do not dynamic cast or de-reference QObject, since object is either in destructor or may have already
// been destroyed.
if
(
_commsWidgetList
.
contains
(
obj
))
{
_commsWidgetList
.
removeOne
(
obj
);
}
}
void
MainWindow
::
_vehicleAdded
(
Vehicle
*
vehicle
)
void
MainWindow
::
_vehicleAdded
(
Vehicle
*
vehicle
)
{
{
connect
(
vehicle
->
uas
(),
SIGNAL
(
valueChanged
(
int
,
QString
,
QString
,
QVariant
,
quint64
)),
this
,
SIGNAL
(
valueChanged
(
int
,
QString
,
QString
,
QVariant
,
quint64
)));
connect
(
vehicle
->
uas
(),
SIGNAL
(
valueChanged
(
int
,
QString
,
QString
,
QVariant
,
quint64
)),
this
,
SIGNAL
(
valueChanged
(
int
,
QString
,
QString
,
QVariant
,
quint64
)));
...
@@ -691,95 +586,9 @@ void MainWindow::_storeCurrentViewState(void)
...
@@ -691,95 +586,9 @@ void MainWindow::_storeCurrentViewState(void)
}
}
#endif
#endif
settings
.
setValue
(
_getWindowStateKey
(),
saveState
());
settings
.
setValue
(
_getWindowGeometryKey
(),
saveGeometry
());
settings
.
setValue
(
_getWindowGeometryKey
(),
saveGeometry
());
}
}
/// Restores the state of the toolbar, status bar and widgets associated with the current view
void
MainWindow
::
_loadCurrentViewState
(
void
)
{
QWidget
*
centerView
=
NULL
;
switch
(
_currentView
)
{
case
VIEW_SETUP
:
_buildSetupView
();
centerView
=
_setupView
;
break
;
case
VIEW_FLIGHT
:
_buildFlightView
();
centerView
=
_flightView
;
break
;
case
VIEW_MISSIONEDITOR
:
_buildMissionEditorView
();
centerView
=
_missionEditorView
;
break
;
default:
Q_ASSERT
(
false
);
break
;
}
// Remove old view
if
(
_currentViewWidget
)
{
_currentViewWidget
->
setVisible
(
false
);
Q_ASSERT
(
_centralLayout
->
count
()
==
1
);
QLayoutItem
*
child
=
_centralLayout
->
takeAt
(
0
);
Q_ASSERT
(
child
);
delete
child
;
}
// Add the new one
Q_ASSERT
(
centerView
);
Q_ASSERT
(
_centralLayout
->
count
()
==
0
);
_currentViewWidget
=
centerView
;
_centralLayout
->
addWidget
(
_currentViewWidget
);
_centralLayout
->
setContentsMargins
(
0
,
0
,
0
,
0
);
_currentViewWidget
->
setVisible
(
true
);
if
(
settings
.
contains
(
_getWindowStateKey
()))
{
restoreState
(
settings
.
value
(
_getWindowStateKey
()).
toByteArray
());
}
// There is a bug in Qt where a Canvas element inside a QQuickWidget does not
// receive update requests. Here we emit a signal for them to get repainted.
emit
repaintCanvas
();
}
void
MainWindow
::
loadPlanView
()
{
if
(
_currentView
!=
VIEW_MISSIONEDITOR
)
{
_storeCurrentViewState
();
_currentView
=
VIEW_MISSIONEDITOR
;
_ui
.
actionPlan
->
setChecked
(
true
);
_loadCurrentViewState
();
}
}
void
MainWindow
::
loadSetupView
()
{
if
(
_currentView
!=
VIEW_SETUP
)
{
_storeCurrentViewState
();
_currentView
=
VIEW_SETUP
;
_ui
.
actionSetup
->
setChecked
(
true
);
_loadCurrentViewState
();
}
}
void
MainWindow
::
loadFlightView
()
{
if
(
_currentView
!=
VIEW_FLIGHT
)
{
_storeCurrentViewState
();
_currentView
=
VIEW_FLIGHT
;
_ui
.
actionFlight
->
setChecked
(
true
);
_loadCurrentViewState
();
}
}
/// @brief Hides the spash screen if it is currently being shown
/// @brief Hides the spash screen if it is currently being shown
void
MainWindow
::
hideSplashScreen
(
void
)
void
MainWindow
::
hideSplashScreen
(
void
)
{
{
...
...
src/ui/MainWindow.h
View file @
57c34c1c
...
@@ -37,25 +37,24 @@ This file is part of the QGROUNDCONTROL project
...
@@ -37,25 +37,24 @@ This file is part of the QGROUNDCONTROL project
#include <QSettings>
#include <QSettings>
#include <QList>
#include <QList>
#include "ui_MainWindow.h"
#include "LinkManager.h"
#include "LinkManager.h"
#include "LinkInterface.h"
#include "LinkInterface.h"
#include "UASInterface.h"
#include "UASInterface.h"
#include "CameraView.h"
#include "CameraView.h"
#include "MainToolBar.h"
#include "LogCompressor.h"
#include "LogCompressor.h"
#include "FlightDisplayView.h"
#include "QGCMAVLinkInspector.h"
#include "QGCMAVLinkInspector.h"
#include "QGCMAVLinkLogPlayer.h"
#include "QGCMAVLinkLogPlayer.h"
#include "MAVLinkDecoder.h"
#include "MAVLinkDecoder.h"
#include "Vehicle.h"
#include "Vehicle.h"
#include "QGCDockWidget.h"
#include "QGCDockWidget.h"
#include "QGCQmlWidgetHolder.h"
#include "ui_MainWindow.h"
#if (defined QGC_MOUSE_ENABLED_WIN) | (defined QGC_MOUSE_ENABLED_LINUX)
#if (defined QGC_MOUSE_ENABLED_WIN) | (defined QGC_MOUSE_ENABLED_LINUX)
#include "Mouse6dofInput.h"
#include "Mouse6dofInput.h"
#endif // QGC_MOUSE_ENABLED_WIN
#endif // QGC_MOUSE_ENABLED_WIN
class
QSplashScreen
;
class
QSplashScreen
;
class
QGCStatusBar
;
class
QGCStatusBar
;
class
Linecharts
;
class
Linecharts
;
...
@@ -67,7 +66,6 @@ class QGCDataPlot2D;
...
@@ -67,7 +66,6 @@ class QGCDataPlot2D;
**/
**/
class
MainWindow
:
public
QMainWindow
class
MainWindow
:
public
QMainWindow
{
{
friend
class
MainToolBar
;
Q_OBJECT
Q_OBJECT
public:
public:
...
@@ -106,32 +104,13 @@ public:
...
@@ -106,32 +104,13 @@ public:
/// @brief Restore (and connects) the last used connection (if any)
/// @brief Restore (and connects) the last used connection (if any)
void
restoreLastUsedConnection
();
void
restoreLastUsedConnection
();
/// @brief Gets a pointer to the Main Tool Bar
MainToolBar
*
getMainToolBar
(
void
)
{
return
_mainToolBar
;
}
/// @brief Gets a pointer to the Main Flight Display
FlightDisplayView
*
getFlightDisplay
()
{
return
dynamic_cast
<
FlightDisplayView
*>
(
_flightView
.
data
());
}
QWidget
*
getCurrentViewWidget
(
void
)
{
return
_currentViewWidget
;
}
public
slots
:
public
slots
:
/** @brief Show the application settings */
/** @brief Show the application settings */
void
showSettings
();
void
showSettings
();
void
loadSetupView
();
void
loadFlightView
();
void
loadPlanView
();
void
manageLinks
();
void
manageLinks
();
/** @brief Show the online help for users */
void
showHelp
();
/** @brief Show the authors / credits */
void
showCredits
();
/** @brief Show the project roadmap */
void
showRoadMap
();
/** @brief Automatically reconnect last link */
/** @brief Automatically reconnect last link */
void
enableAutoReconnect
(
bool
enabled
);
void
enableAutoReconnect
(
bool
enabled
);
...
@@ -143,8 +122,6 @@ public slots:
...
@@ -143,8 +122,6 @@ public slots:
/** @brief Update the window name */
/** @brief Update the window name */
void
configureWindowName
();
void
configureWindowName
();
void
commsWidgetDestroyed
(
QObject
*
obj
);
protected
slots
:
protected
slots
:
/**
/**
* @brief Unchecks the normalActionItem.
* @brief Unchecks the normalActionItem.
...
@@ -164,6 +141,19 @@ protected slots:
...
@@ -164,6 +141,19 @@ protected slots:
void
showStatusBarCallback
(
bool
checked
);
void
showStatusBarCallback
(
bool
checked
);
signals:
signals:
// Signals the Qml to show the specified view
void
showFlyView
(
void
);
void
showPlanView
(
void
);
void
showSetupView
(
void
);
void
showToolbarMessage
(
const
QString
&
message
);
// These are used for unit testing
void
showSetupFirmware
(
void
);
void
showSetupParameters
(
void
);
void
showSetupSummary
(
void
);
void
showSetupVehicleComponent
(
VehicleComponent
*
vehicleComponent
);
void
initStatusChanged
(
const
QString
&
message
,
int
alignment
,
const
QColor
&
color
);
void
initStatusChanged
(
const
QString
&
message
,
int
alignment
,
const
QColor
&
color
);
/** Emitted when any value changes from any source */
/** Emitted when any value changes from any source */
void
valueChanged
(
const
int
uasId
,
const
QString
&
name
,
const
QString
&
unit
,
const
QVariant
&
value
,
const
quint64
msec
);
void
valueChanged
(
const
int
uasId
,
const
QString
&
name
,
const
QString
&
unit
,
const
QVariant
&
value
,
const
quint64
msec
);
...
@@ -182,22 +172,6 @@ public:
...
@@ -182,22 +172,6 @@ public:
}
}
protected:
protected:
typedef
enum
_VIEW_SECTIONS
{
VIEW_UNUSED5
,
// Unused (don't remove, or it will screw up saved settigns indices)
VIEW_UNUSED3
,
// Unused (don't remove, or it will screw up saved settigns indices)
VIEW_FLIGHT
,
// Flight/Fly/Operate view mode. Used for 1st-person observation of the vehicle.
VIEW_UNUSED4
,
// Unused (don't remove, or it will screw up saved settigns indices)
VIEW_SETUP
,
// Setup view. Used for initializing the system for operation.
VIEW_UNUSED1
,
// Unused (don't remove, or it will screw up saved settigns indices)
VIEW_UNUSED2
,
// Unused (don't remove, or it will screw up saved settigns indices)
VIEW_MISSIONEDITOR
,
// New mission editor
}
VIEW_SECTIONS
;
/** @brief Catch window resize events */
void
resizeEvent
(
QResizeEvent
*
event
);
void
connectCommonActions
();
void
connectCommonActions
();
void
loadSettings
();
void
loadSettings
();
...
@@ -205,10 +179,6 @@ protected:
...
@@ -205,10 +179,6 @@ protected:
QSettings
settings
;
QSettings
settings
;
// Center widgets
QPointer
<
Linecharts
>
linechartWidget
;
QPointer
<
MainToolBar
>
_mainToolBar
;
QPointer
<
MAVLinkDecoder
>
mavlinkDecoder
;
QPointer
<
MAVLinkDecoder
>
mavlinkDecoder
;
QGCMAVLinkLogPlayer
*
logPlayer
;
QGCMAVLinkLogPlayer
*
logPlayer
;
...
@@ -241,7 +211,7 @@ private slots:
...
@@ -241,7 +211,7 @@ private slots:
void
_linkStateChange
(
LinkInterface
*
);
void
_linkStateChange
(
LinkInterface
*
);
void
_closeWindow
(
void
)
{
close
();
}
void
_closeWindow
(
void
)
{
close
();
}
void
_vehicleAdded
(
Vehicle
*
vehicle
);
void
_vehicleAdded
(
Vehicle
*
vehicle
);
#ifndef __mobile__
#ifndef __mobile__
void
_showDockWidgetAction
(
bool
show
);
void
_showDockWidgetAction
(
bool
show
);
#endif
#endif
...
@@ -277,12 +247,6 @@ private:
...
@@ -277,12 +247,6 @@ private:
QMap
<
QString
,
QAction
*>
_mapName2Action
;
QMap
<
QString
,
QAction
*>
_mapName2Action
;
#endif
#endif
void
_buildPlanView
(
void
);
void
_buildFlightView
(
void
);
void
_buildSetupView
(
void
);
void
_buildTerminalView
(
void
);
void
_buildMissionEditorView
(
void
);
void
_storeCurrentViewState
(
void
);
void
_storeCurrentViewState
(
void
);
void
_loadCurrentViewState
(
void
);
void
_loadCurrentViewState
(
void
);
...
@@ -300,16 +264,12 @@ private:
...
@@ -300,16 +264,12 @@ private:
bool
_autoReconnect
;
bool
_autoReconnect
;
bool
_lowPowerMode
;
///< If enabled, QGC reduces the update rates of all widgets
bool
_lowPowerMode
;
///< If enabled, QGC reduces the update rates of all widgets
bool
_showStatusBar
;
bool
_showStatusBar
;
QActionGroup
*
_centerStackActionGroup
;
QVBoxLayout
*
_centralLayout
;
QVBoxLayout
*
_centralLayout
;
QList
<
QObject
*>
_commsWidgetList
;
QWidget
*
_currentViewWidget
;
///< Currently displayed view widget
QSplashScreen
*
_splashScreen
;
///< Splash screen, NULL is splash screen not currently being shown
QSplashScreen
*
_splashScreen
;
///< Splash screen, NULL is splash screen not currently being shown
VIEW_SECTIONS
_currentView
;
///< Currently displayed view
Ui
::
MainWindow
_ui
;
Ui
::
MainWindow
_ui
;
QString
_screenFileName
;
QString
_getWindowStateKey
();
QGCQmlWidgetHolder
*
_mainQmlWidgetHolder
;
QString
_getWindowGeometryKey
();
QString
_getWindowGeometryKey
();
};
};
...
...
src/ui/MainWindow.qml
0 → 100644
View file @
57c34c1c
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2015 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL 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.
QGROUNDCONTROL 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 QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
import
QtQuick
2.3
import
QtQuick
.
Controls
1.2
import
QtPositioning
5.2
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
FlightMap
1.0
import
QGroundControl
.
ScreenTools
1.0
/// Qml for MainWindow
FlightDisplayView
{
id
:
_root
// sets the top margin soo map widgets are not under toolbar
topMargin
:
toolbar
.
height
+
ScreenTools
.
defaultFontPixelWidth
readonly
property
string
_planViewSource
:
"
MissionEditor.qml
"
readonly
property
string
_setupViewSource
:
"
SetupView.qml
"
Connections
{
target
:
controller
onShowFlyView
:
{
setupViewLoader
.
visible
=
false
planViewLoader
.
visible
=
false
_root
.
hideWidgets
=
false
}
onShowPlanView
:
{
if
(
planViewLoader
.
source
!=
_planViewSource
)
{
planViewLoader
.
source
=
_planViewSource
}
setupViewLoader
.
visible
=
false
planViewLoader
.
visible
=
true
_root
.
hideWidgets
=
true
}
onShowSetupView
:
{
if
(
setupViewLoader
.
source
!=
_setupViewSource
)
{
setupViewLoader
.
source
=
_setupViewSource
}
setupViewLoader
.
visible
=
true
planViewLoader
.
visible
=
false
_root
.
hideWidgets
=
true
}
onShowToolbarMessage
:
toolbar
.
showToolbarMessage
(
message
)
// The following are use for unit testing only
onShowSetupFirmware
:
setupViewLoader
.
item
.
showFirmwarePanel
()
onShowSetupParameters
:
setupViewLoader
.
item
.
showParametersPanel
()
onShowSetupSummary
:
setupViewLoader
.
item
.
showSummaryPanel
()
onShowSetupVehicleComponent
:
setupViewLoader
.
item
.
showVehicleComponentPanel
(
vechicleComponent
)
}
MainToolBar
{
id
:
toolbar
width
:
parent
.
width
z
:
_root
.
zOrderTopMost
}
Loader
{
id
:
planViewLoader
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
anchors.top
:
toolbar
.
bottom
anchors.bottom
:
parent
.
bottom
visible
:
false
property
real
zOrder
:
_root
.
zOrderTopMost
}
Loader
{
id
:
setupViewLoader
anchors.margins
:
ScreenTools
.
defaultFontPixelWidth
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
anchors.top
:
toolbar
.
bottom
anchors.bottom
:
parent
.
bottom
visible
:
false
property
real
zOrder
:
_root
.
zOrderTopMost
}
}
src/ui/QGCHilFlightGearConfiguration.cc
View file @
57c34c1c
#include "QGCHilFlightGearConfiguration.h"
#include "QGCHilFlightGearConfiguration.h"
#include "MainWindow.h"
#include "MainWindow.h"
#include <QMenu>
// Various settings groups and keys
// Various settings groups and keys
const
char
*
QGCHilFlightGearConfiguration
::
_settingsGroup
=
"QGC_HILCONFIG_FLIGHTGEAR"
;
const
char
*
QGCHilFlightGearConfiguration
::
_settingsGroup
=
"QGC_HILCONFIG_FLIGHTGEAR"
;
const
char
*
QGCHilFlightGearConfiguration
::
_mavSettingsSubGroupFixedWing
=
"FIXED_WING"
;
const
char
*
QGCHilFlightGearConfiguration
::
_mavSettingsSubGroupFixedWing
=
"FIXED_WING"
;
...
...
src/ui/SettingsDialog.cc
View file @
57c34c1c
...
@@ -36,7 +36,7 @@
...
@@ -36,7 +36,7 @@
#include "QGCApplication.h"
#include "QGCApplication.h"
#include "QGCFileDialog.h"
#include "QGCFileDialog.h"
#include "QGCMessageBox.h"
#include "QGCMessageBox.h"
#include "MainToolBar.h"
#include "MainToolBar
Controller
.h"
#include "FlightMapSettings.h"
#include "FlightMapSettings.h"
SettingsDialog
::
SettingsDialog
(
QWidget
*
parent
,
int
showTab
,
Qt
::
WindowFlags
flags
)
:
SettingsDialog
::
SettingsDialog
(
QWidget
*
parent
,
int
showTab
,
Qt
::
WindowFlags
flags
)
:
...
@@ -61,15 +61,6 @@ _ui(new Ui::SettingsDialog)
...
@@ -61,15 +61,6 @@ _ui(new Ui::SettingsDialog)
this
->
window
()
->
setWindowTitle
(
tr
(
"QGroundControl Settings"
));
this
->
window
()
->
setWindowTitle
(
tr
(
"QGroundControl Settings"
));
// Tool Bar Preferences
QSettings
settings
;
settings
.
beginGroup
(
TOOL_BAR_SETTINGS_GROUP
);
_ui
->
showBattery
->
setChecked
(
settings
.
value
(
TOOL_BAR_SHOW_BATTERY
,
true
).
toBool
());
_ui
->
showGPS
->
setChecked
(
settings
.
value
(
TOOL_BAR_SHOW_GPS
,
true
).
toBool
());
_ui
->
showMav
->
setChecked
(
settings
.
value
(
TOOL_BAR_SHOW_MAV
,
true
).
toBool
());
_ui
->
showMessages
->
setChecked
(
settings
.
value
(
TOOL_BAR_SHOW_MESSAGES
,
true
).
toBool
());
_ui
->
showRSSI
->
setChecked
(
settings
.
value
(
TOOL_BAR_SHOW_RSSI
,
true
).
toBool
());
settings
.
endGroup
();
// Audio preferences
// Audio preferences
_ui
->
audioMuteCheckBox
->
setChecked
(
GAudioOutput
::
instance
()
->
isMuted
());
_ui
->
audioMuteCheckBox
->
setChecked
(
GAudioOutput
::
instance
()
->
isMuted
());
connect
(
_ui
->
audioMuteCheckBox
,
SIGNAL
(
toggled
(
bool
)),
GAudioOutput
::
instance
(),
SLOT
(
mute
(
bool
)));
connect
(
_ui
->
audioMuteCheckBox
,
SIGNAL
(
toggled
(
bool
)),
GAudioOutput
::
instance
(),
SLOT
(
mute
(
bool
)));
...
@@ -181,31 +172,6 @@ void SettingsDialog::_selectSavedFilesDirectory(void)
...
@@ -181,31 +172,6 @@ void SettingsDialog::_selectSavedFilesDirectory(void)
// * Parameters
// * Parameters
}
}
void
SettingsDialog
::
on_showGPS_clicked
(
bool
checked
)
{
_mainWindow
->
getMainToolBar
()
->
viewStateChanged
(
TOOL_BAR_SHOW_GPS
,
checked
);
}
void
SettingsDialog
::
on_showBattery_clicked
(
bool
checked
)
{
_mainWindow
->
getMainToolBar
()
->
viewStateChanged
(
TOOL_BAR_SHOW_BATTERY
,
checked
);
}
void
SettingsDialog
::
on_showMessages_clicked
(
bool
checked
)
{
_mainWindow
->
getMainToolBar
()
->
viewStateChanged
(
TOOL_BAR_SHOW_MESSAGES
,
checked
);
}
void
SettingsDialog
::
on_showMav_clicked
(
bool
checked
)
{
_mainWindow
->
getMainToolBar
()
->
viewStateChanged
(
TOOL_BAR_SHOW_MAV
,
checked
);
}
void
SettingsDialog
::
on_showRSSI_clicked
(
bool
checked
)
{
_mainWindow
->
getMainToolBar
()
->
viewStateChanged
(
TOOL_BAR_SHOW_RSSI
,
checked
);
}
void
SettingsDialog
::
_bingMapRadioClicked
(
bool
checked
)
void
SettingsDialog
::
_bingMapRadioClicked
(
bool
checked
)
{
{
if
(
checked
)
{
if
(
checked
)
{
...
...
src/ui/SettingsDialog.h
View file @
57c34c1c
...
@@ -55,13 +55,6 @@ private slots:
...
@@ -55,13 +55,6 @@ private slots:
void
_deleteSettingsToggled
(
bool
checked
);
void
_deleteSettingsToggled
(
bool
checked
);
void
_selectSavedFilesDirectory
(
void
);
void
_selectSavedFilesDirectory
(
void
);
void
_validateBeforeClose
(
void
);
void
_validateBeforeClose
(
void
);
void
on_showGPS_clicked
(
bool
checked
);
void
on_showBattery_clicked
(
bool
checked
);
void
on_showMessages_clicked
(
bool
checked
);
void
on_showMav_clicked
(
bool
checked
);
void
on_showRSSI_clicked
(
bool
checked
);
void
_bingMapRadioClicked
(
bool
checked
);
void
_bingMapRadioClicked
(
bool
checked
);
void
_googleMapRadioClicked
(
bool
checked
);
void
_googleMapRadioClicked
(
bool
checked
);
...
...
src/ui/SettingsDialog.ui
View file @
57c34c1c
...
@@ -281,80 +281,6 @@
...
@@ -281,80 +281,6 @@
</layout>
</layout>
</widget>
</widget>
</item>
</item>
<item>
<widget
class=
"QGroupBox"
name=
"groupBox_3"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"MinimumExpanding"
vsizetype=
"Fixed"
>
<horstretch>
0
</horstretch>
<verstretch>
0
</verstretch>
</sizepolicy>
</property>
<property
name=
"title"
>
<string>
Tool Bar
</string>
</property>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout_6"
>
<item>
<layout
class=
"QVBoxLayout"
name=
"verticalLayout_2"
>
<item>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_3"
>
<item>
<widget
class=
"QCheckBox"
name=
"showGPS"
>
<property
name=
"minimumSize"
>
<size>
<width>
160
</width>
<height>
0
</height>
</size>
</property>
<property
name=
"text"
>
<string>
Show GPS
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QCheckBox"
name=
"showMessages"
>
<property
name=
"text"
>
<string>
Show Messages
</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_4"
>
<item>
<widget
class=
"QCheckBox"
name=
"showBattery"
>
<property
name=
"minimumSize"
>
<size>
<width>
160
</width>
<height>
0
</height>
</size>
</property>
<property
name=
"text"
>
<string>
Show Battery
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QCheckBox"
name=
"showMav"
>
<property
name=
"text"
>
<string>
Show Mav Icon
</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget
class=
"QCheckBox"
name=
"showRSSI"
>
<property
name=
"text"
>
<string>
Show RSSI
</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<item>
<widget
class=
"QGroupBox"
name=
"groupBox_2"
>
<widget
class=
"QGroupBox"
name=
"groupBox_2"
>
<property
name=
"title"
>
<property
name=
"title"
>
...
...
src/ui/toolbar/MainToolBar.qml
View file @
57c34c1c
...
@@ -34,12 +34,13 @@ import QtQuick.Controls.Styles 1.2
...
@@ -34,12 +34,13 @@ import QtQuick.Controls.Styles 1.2
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
FactControls
1.0
import
QGroundControl
.
FactControls
1.0
import
QGroundControl
.
Palette
1.0
import
QGroundControl
.
Palette
1.0
import
QGroundControl
.
MainToolBar
1.0
import
QGroundControl
.
MultiVehicleManager
1.0
import
QGroundControl
.
MultiVehicleManager
1.0
import
QGroundControl
.
ScreenTools
1.0
import
QGroundControl
.
ScreenTools
1.0
import
QGroundControl
.
Controllers
1.0
Rectangle
{
Item
{
id
:
toolBarHolder
id
:
toolBarHolder
height
:
toolBarHeight
property
var
qgcPal
:
QGCPalette
{
id
:
palette
;
colorGroupEnabled
:
true
}
property
var
qgcPal
:
QGCPalette
{
id
:
palette
;
colorGroupEnabled
:
true
}
...
@@ -63,20 +64,16 @@ Rectangle {
...
@@ -63,20 +64,16 @@ Rectangle {
property
var
colorGreenText
:
(
qgcPal
.
globalTheme
===
QGCPalette
.
Light
)
?
"
#046b1b
"
:
"
#00d930
"
property
var
colorGreenText
:
(
qgcPal
.
globalTheme
===
QGCPalette
.
Light
)
?
"
#046b1b
"
:
"
#00d930
"
property
var
colorWhiteText
:
(
qgcPal
.
globalTheme
===
QGCPalette
.
Light
)
?
"
#343333
"
:
"
#f0f0f0
"
property
var
colorWhiteText
:
(
qgcPal
.
globalTheme
===
QGCPalette
.
Light
)
?
"
#343333
"
:
"
#f0f0f0
"
color
:
qgcPal
.
windowShade
MainToolBarController
{
id
:
_controller
}
Connections
{
function
showToolbarMessage
(
message
)
{
target
:
mainToolBar
toolBarMessage
.
text
=
message
if
(
toolBarMessage
.
contentHeight
>
toolBarMessageCloseButton
.
height
)
{
onShowMessage
:
{
mainToolBar
.
height
=
toolBarHeight
+
toolBarMessage
.
contentHeight
+
(
verticalMargins
*
2
)
toolBarMessage
.
text
=
message
}
else
{
if
(
toolBarMessage
.
contentHeight
>
toolBarMessageCloseButton
.
height
)
{
mainToolBar
.
height
=
toolBarHeight
+
toolBarMessageCloseButton
.
height
+
(
verticalMargins
*
2
)
mainToolBar
.
height
=
toolBarHeight
+
toolBarMessage
.
contentHeight
+
(
verticalMargins
*
2
)
}
else
{
mainToolBar
.
height
=
toolBarHeight
+
toolBarMessageCloseButton
.
height
+
(
verticalMargins
*
2
)
}
toolBarMessageArea
.
visible
=
true
}
}
toolBarMessageArea
.
visible
=
true
}
}
function
getProportionalDimmension
(
val
)
{
function
getProportionalDimmension
(
val
)
{
...
@@ -150,51 +147,50 @@ Rectangle {
...
@@ -150,51 +147,50 @@ Rectangle {
}
}
function
showMavStatus
()
{
function
showMavStatus
()
{
return
(
multiVehicleManager
.
activeVehicleAvailable
&&
activeVehicle
.
heartbeatTimeout
===
0
&&
mainToolBa
r
.
connectionCount
>
0
);
return
(
multiVehicleManager
.
activeVehicleAvailable
&&
activeVehicle
.
heartbeatTimeout
===
0
&&
_controlle
r
.
connectionCount
>
0
);
}
}
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
//-- Main menu for Mobile Devices
//-- Main menu for Mobile Devices
Menu
{
Menu
{
id
:
maintMenu
id
:
maintMenu
ExclusiveGroup
{
id
:
mainMenuGroup
}
ExclusiveGroup
{
id
:
mainMenuGroup
}
MenuItem
{
MenuItem
{
text
:
"
Vehicle Setup
"
id
:
flyViewShowing
checkable
:
true
text
:
"
Fly
"
checkable
:
true
checked
:
true
exclusiveGroup
:
mainMenuGroup
exclusiveGroup
:
mainMenuGroup
checked
:
(
mainToolBar
.
currentView
===
MainToolBar
.
ViewSetup
)
onTriggered
:
onTriggered
:
{
{
checked
=
true
mainToolBar
.
onSetup
View
();
_controller
.
onFly
View
();
}
}
}
}
MenuItem
{
MenuItem
{
text
:
"
Plan View
"
id
:
setupViewShowing
checkable
:
true
text
:
"
Setup
"
check
ed
:
(
mainToolBar
.
currentView
===
MainToolBar
.
ViewPlan
)
check
able
:
true
exclusiveGroup
:
mainMenuGroup
exclusiveGroup
:
mainMenuGroup
onTriggered
:
{
onTriggered
:
{
mainToolBar
.
onPlanView
();
checked
=
true
_controller
.
onSetupView
();
}
}
}
}
MenuItem
{
MenuItem
{
text
:
"
Flight View
"
id
:
planViewShowing
checkable
:
true
text
:
"
Plan
"
check
ed
:
(
mainToolBar
.
currentView
===
MainToolBar
.
ViewFly
)
check
able
:
true
exclusiveGroup
:
mainMenuGroup
exclusiveGroup
:
mainMenuGroup
onTriggered
:
{
onTriggered
:
{
mainToolBar
.
onFlyView
();
checked
=
true
}
_controller
.
onPlanView
();
}
//-- Flight View Context Menu
MenuItem
{
text
:
"
Flight View Options...
"
visible
:
(
mainToolBar
.
currentView
===
MainToolBar
.
ViewFly
)
onTriggered
:
{
mainToolBar
.
onFlyViewMenu
();
}
}
}
}
}
// Menu
}
// Menu
...
@@ -210,7 +206,6 @@ Rectangle {
...
@@ -210,7 +206,6 @@ Rectangle {
id
:
messages
id
:
messages
width
:
(
activeVehicle
.
messageCount
>
99
)
?
getProportionalDimmension
(
65
)
:
getProportionalDimmension
(
60
)
width
:
(
activeVehicle
.
messageCount
>
99
)
?
getProportionalDimmension
(
65
)
:
getProportionalDimmension
(
60
)
height
:
cellHeight
height
:
cellHeight
visible
:
mainToolBar
.
showMessages
anchors.verticalCenter
:
parent
.
verticalCenter
anchors.verticalCenter
:
parent
.
verticalCenter
color
:
getMessageColor
()
color
:
getMessageColor
()
border.color
:
"
#00000000
"
border.color
:
"
#00000000
"
...
@@ -273,7 +268,7 @@ Rectangle {
...
@@ -273,7 +268,7 @@ Rectangle {
}
}
onClicked
:
{
onClicked
:
{
var
p
=
mapToItem
(
toolBarHolder
,
mouseX
,
mouseY
);
var
p
=
mapToItem
(
toolBarHolder
,
mouseX
,
mouseY
);
mainToolBa
r
.
onEnterMessageArea
(
p
.
x
,
p
.
y
);
_controlle
r
.
onEnterMessageArea
(
p
.
x
,
p
.
y
);
}
}
}
}
...
@@ -282,7 +277,6 @@ Rectangle {
...
@@ -282,7 +277,6 @@ Rectangle {
QGCButton
{
QGCButton
{
width
:
ScreenTools
.
defaultFontPixelWidth
*
12
width
:
ScreenTools
.
defaultFontPixelWidth
*
12
height
:
cellHeight
height
:
cellHeight
visible
:
mainToolBar
.
showMav
anchors.verticalCenter
:
parent
.
verticalCenter
anchors.verticalCenter
:
parent
.
verticalCenter
text
:
"
Vehicle
"
+
activeVehicle
.
id
text
:
"
Vehicle
"
+
activeVehicle
.
id
...
@@ -336,7 +330,6 @@ Rectangle {
...
@@ -336,7 +330,6 @@ Rectangle {
id
:
satelitte
id
:
satelitte
width
:
getProportionalDimmension
(
55
)
width
:
getProportionalDimmension
(
55
)
height
:
cellHeight
height
:
cellHeight
visible
:
mainToolBar
.
showGPS
anchors.verticalCenter
:
parent
.
verticalCenter
anchors.verticalCenter
:
parent
.
verticalCenter
color
:
getSatelliteColor
();
color
:
getSatelliteColor
();
border.color
:
"
#00000000
"
border.color
:
"
#00000000
"
...
@@ -370,9 +363,9 @@ Rectangle {
...
@@ -370,9 +363,9 @@ Rectangle {
id
:
rssiRC
id
:
rssiRC
width
:
getProportionalDimmension
(
55
)
width
:
getProportionalDimmension
(
55
)
height
:
cellHeight
height
:
cellHeight
visible
:
mainToolBar
.
showRSSI
&&
mainToolBa
r
.
remoteRSSI
<=
100
visible
:
_controlle
r
.
remoteRSSI
<=
100
anchors.verticalCenter
:
parent
.
verticalCenter
anchors.verticalCenter
:
parent
.
verticalCenter
color
:
getRSSIColor
(
mainToolBa
r
.
remoteRSSI
);
color
:
getRSSIColor
(
_controlle
r
.
remoteRSSI
);
border.color
:
"
#00000000
"
border.color
:
"
#00000000
"
border.width
:
0
border.width
:
0
Image
{
Image
{
...
@@ -386,7 +379,7 @@ Rectangle {
...
@@ -386,7 +379,7 @@ Rectangle {
smooth
:
true
smooth
:
true
}
}
QGCLabel
{
QGCLabel
{
text
:
mainToolBa
r
.
remoteRSSI
text
:
_controlle
r
.
remoteRSSI
anchors.right
:
parent
.
right
anchors.right
:
parent
.
right
anchors.rightMargin
:
getProportionalDimmension
(
6
)
anchors.rightMargin
:
getProportionalDimmension
(
6
)
anchors.verticalCenter
:
parent
.
verticalCenter
anchors.verticalCenter
:
parent
.
verticalCenter
...
@@ -401,9 +394,9 @@ Rectangle {
...
@@ -401,9 +394,9 @@ Rectangle {
id
:
rssiTelemetry
id
:
rssiTelemetry
width
:
getProportionalDimmension
(
80
)
width
:
getProportionalDimmension
(
80
)
height
:
cellHeight
height
:
cellHeight
visible
:
mainToolBar
.
showRSSI
&&
(
mainToolBar
.
telemetryRRSSI
>
0
)
&&
(
mainToolBa
r
.
telemetryLRSSI
>
0
)
visible
:
(
_controller
.
telemetryRRSSI
>
0
)
&&
(
_controlle
r
.
telemetryLRSSI
>
0
)
anchors.verticalCenter
:
parent
.
verticalCenter
anchors.verticalCenter
:
parent
.
verticalCenter
color
:
getRSSIColor
(
Math
.
min
(
mainToolBar
.
telemetryRRSSI
,
mainToolBa
r
.
telemetryLRSSI
));
color
:
getRSSIColor
(
Math
.
min
(
_controller
.
telemetryRRSSI
,
_controlle
r
.
telemetryLRSSI
));
border.color
:
"
#00000000
"
border.color
:
"
#00000000
"
border.width
:
0
border.width
:
0
Image
{
Image
{
...
@@ -429,7 +422,7 @@ Rectangle {
...
@@ -429,7 +422,7 @@ Rectangle {
color
:
colorWhite
color
:
colorWhite
}
}
QGCLabel
{
QGCLabel
{
text
:
mainToolBa
r
.
telemetryRRSSI
+
'
dB
'
text
:
_controlle
r
.
telemetryRRSSI
+
'
dB
'
width
:
getProportionalDimmension
(
30
)
width
:
getProportionalDimmension
(
30
)
horizontalAlignment
:
Text
.
AlignRight
horizontalAlignment
:
Text
.
AlignRight
font.pixelSize
:
ScreenTools
.
smallFontPixelSize
font.pixelSize
:
ScreenTools
.
smallFontPixelSize
...
@@ -446,7 +439,7 @@ Rectangle {
...
@@ -446,7 +439,7 @@ Rectangle {
color
:
colorWhite
color
:
colorWhite
}
}
QGCLabel
{
QGCLabel
{
text
:
mainToolBa
r
.
telemetryLRSSI
+
'
dB
'
text
:
_controlle
r
.
telemetryLRSSI
+
'
dB
'
width
:
getProportionalDimmension
(
30
)
width
:
getProportionalDimmension
(
30
)
horizontalAlignment
:
Text
.
AlignRight
horizontalAlignment
:
Text
.
AlignRight
font.pixelSize
:
ScreenTools
.
smallFontPixelSize
font.pixelSize
:
ScreenTools
.
smallFontPixelSize
...
@@ -461,7 +454,6 @@ Rectangle {
...
@@ -461,7 +454,6 @@ Rectangle {
id
:
batteryStatus
id
:
batteryStatus
width
:
activeVehicle
.
batteryConsumed
<
0.0
?
getProportionalDimmension
(
60
)
:
getProportionalDimmension
(
80
)
width
:
activeVehicle
.
batteryConsumed
<
0.0
?
getProportionalDimmension
(
60
)
:
getProportionalDimmension
(
80
)
height
:
cellHeight
height
:
cellHeight
visible
:
mainToolBar
.
showBattery
anchors.verticalCenter
:
parent
.
verticalCenter
anchors.verticalCenter
:
parent
.
verticalCenter
color
:
getBatteryColor
();
color
:
getBatteryColor
();
border.color
:
"
#00000000
"
border.color
:
"
#00000000
"
...
@@ -632,40 +624,44 @@ Rectangle {
...
@@ -632,40 +624,44 @@ Rectangle {
ExclusiveGroup
{
id
:
mainActionGroup
}
ExclusiveGroup
{
id
:
mainActionGroup
}
QGCToolBarButton
{
QGCToolBarButton
{
id
:
setupButton
id
:
setupButton
width
:
getProportionalDimmension
(
90
)
width
:
getProportionalDimmension
(
90
)
height
:
cellHeight
height
:
cellHeight
exclusiveGroup
:
mainActionGroup
exclusiveGroup
:
mainActionGroup
text
:
qsTr
(
"
Setup
"
)
text
:
"
Setup
"
checked
:
(
mainToolBar
.
currentView
===
MainToolBar
.
ViewSetup
)
onClicked
:
{
onClicked
:
{
mainToolBar
.
onSetupView
();
checked
=
true
_controller
.
onSetupView
();
}
}
z
:
1000
z
:
1000
}
}
QGCToolBarButton
{
QGCToolBarButton
{
id
:
planButton
id
:
planButton
width
:
getProportionalDimmension
(
90
)
width
:
getProportionalDimmension
(
90
)
height
:
cellHeight
height
:
cellHeight
exclusiveGroup
:
mainActionGroup
exclusiveGroup
:
mainActionGroup
text
:
qsTr
(
"
Plan
"
)
text
:
"
Plan
"
checked
:
(
mainToolBar
.
currentView
===
MainToolBar
.
ViewPlan
)
onClicked
:
{
onClicked
:
{
mainToolBar
.
onPlanView
();
checked
=
true
_controller
.
onPlanView
();
}
}
z
:
900
z
:
900
}
}
QGCToolBarButton
{
QGCToolBarButton
{
id
:
flyButton
id
:
flyButton
width
:
getProportionalDimmension
(
90
)
width
:
getProportionalDimmension
(
90
)
height
:
cellHeight
height
:
cellHeight
exclusiveGroup
:
mainActionGroup
exclusiveGroup
:
mainActionGroup
text
:
qsTr
(
"
Fly
"
)
text
:
"
Fly
"
checked
:
(
mainToolBar
.
currentView
===
MainToolBar
.
ViewFly
)
checked
:
true
onClicked
:
{
onClicked
:
{
mainToolBar
.
onFlyView
();
checked
=
true
_controller
.
onFlyView
();
}
}
z
:
800
z
:
800
}
}
...
@@ -728,7 +724,7 @@ Rectangle {
...
@@ -728,7 +724,7 @@ Rectangle {
id
:
connectionStatus
id
:
connectionStatus
width
:
getProportionalDimmension
(
160
)
width
:
getProportionalDimmension
(
160
)
height
:
cellHeight
height
:
cellHeight
visible
:
(
mainToolBa
r
.
connectionCount
>
0
&&
multiVehicleManager
.
activeVehicleAvailable
&&
activeVehicle
.
heartbeatTimeout
!=
0
)
visible
:
(
_controlle
r
.
connectionCount
>
0
&&
multiVehicleManager
.
activeVehicleAvailable
&&
activeVehicle
.
heartbeatTimeout
!=
0
)
anchors.verticalCenter
:
parent
.
verticalCenter
anchors.verticalCenter
:
parent
.
verticalCenter
color
:
"
#00000000
"
color
:
"
#00000000
"
border.color
:
"
#00000000
"
border.color
:
"
#00000000
"
...
@@ -759,7 +755,7 @@ Rectangle {
...
@@ -759,7 +755,7 @@ Rectangle {
Menu
{
Menu
{
id
:
connectMenu
id
:
connectMenu
Component.onCompleted
:
{
Component.onCompleted
:
{
mainToolBa
r
.
configListChanged
.
connect
(
connectMenu
.
updateConnectionList
);
_controlle
r
.
configListChanged
.
connect
(
connectMenu
.
updateConnectionList
);
connectMenu
.
updateConnectionList
();
connectMenu
.
updateConnectionList
();
}
}
function
addMenuEntry
(
name
)
{
function
addMenuEntry
(
name
)
{
...
@@ -767,15 +763,15 @@ Rectangle {
...
@@ -767,15 +763,15 @@ Rectangle {
if
(
name
!==
""
)
if
(
name
!==
""
)
label
=
name
;
label
=
name
;
var
mItem
=
connectMenu
.
addItem
(
label
);
var
mItem
=
connectMenu
.
addItem
(
label
);
var
menuSlot
=
function
()
{
mainToolBa
r
.
onConnect
(
name
)};
var
menuSlot
=
function
()
{
_controlle
r
.
onConnect
(
name
)};
mItem
.
triggered
.
connect
(
menuSlot
);
mItem
.
triggered
.
connect
(
menuSlot
);
}
}
function
updateConnectionList
()
{
function
updateConnectionList
()
{
connectMenu
.
clear
();
connectMenu
.
clear
();
for
(
var
i
=
0
;
i
<
mainToolBa
r
.
configList
.
length
;
i
++
)
{
for
(
var
i
=
0
;
i
<
_controlle
r
.
configList
.
length
;
i
++
)
{
connectMenu
.
addMenuEntry
(
mainToolBa
r
.
configList
[
i
]);
connectMenu
.
addMenuEntry
(
_controlle
r
.
configList
[
i
]);
}
}
if
(
mainToolBa
r
.
configList
.
length
>
0
)
{
if
(
_controlle
r
.
configList
.
length
>
0
)
{
connectMenu
.
addSeparator
();
connectMenu
.
addSeparator
();
}
}
// Add "Add Connection" to the list
// Add "Add Connection" to the list
...
@@ -786,7 +782,7 @@ Rectangle {
...
@@ -786,7 +782,7 @@ Rectangle {
QGCButton
{
QGCButton
{
id
:
connectButton
id
:
connectButton
width
:
getProportionalDimmension
(
100
)
width
:
getProportionalDimmension
(
100
)
visible
:
mainToolBa
r
.
connectionCount
===
0
visible
:
_controlle
r
.
connectionCount
===
0
text
:
qsTr
(
"
Connect
"
)
text
:
qsTr
(
"
Connect
"
)
menu
:
connectMenu
menu
:
connectMenu
}
}
...
@@ -794,21 +790,21 @@ Rectangle {
...
@@ -794,21 +790,21 @@ Rectangle {
QGCButton
{
QGCButton
{
id
:
disconnectButton
id
:
disconnectButton
width
:
getProportionalDimmension
(
100
)
width
:
getProportionalDimmension
(
100
)
visible
:
mainToolBa
r
.
connectionCount
===
1
visible
:
_controlle
r
.
connectionCount
===
1
text
:
qsTr
(
"
Disconnect
"
)
text
:
qsTr
(
"
Disconnect
"
)
onClicked
:
{
onClicked
:
{
mainToolBa
r
.
onDisconnect
(
""
);
_controlle
r
.
onDisconnect
(
""
);
}
}
}
}
Menu
{
Menu
{
id
:
disconnectMenu
id
:
disconnectMenu
Component.onCompleted
:
{
Component.onCompleted
:
{
mainToolBa
r
.
connectedListChanged
.
connect
(
disconnectMenu
.
onConnectedListChanged
)
_controlle
r
.
connectedListChanged
.
connect
(
disconnectMenu
.
onConnectedListChanged
)
}
}
function
addMenuEntry
(
name
)
{
function
addMenuEntry
(
name
)
{
var
mItem
=
disconnectMenu
.
addItem
(
name
);
var
mItem
=
disconnectMenu
.
addItem
(
name
);
var
menuSlot
=
function
()
{
mainToolBa
r
.
onDisconnect
(
name
)};
var
menuSlot
=
function
()
{
_controlle
r
.
onDisconnect
(
name
)};
mItem
.
triggered
.
connect
(
menuSlot
);
mItem
.
triggered
.
connect
(
menuSlot
);
}
}
function
onConnectedListChanged
(
conList
)
{
function
onConnectedListChanged
(
conList
)
{
...
@@ -823,7 +819,7 @@ Rectangle {
...
@@ -823,7 +819,7 @@ Rectangle {
id
:
multidisconnectButton
id
:
multidisconnectButton
width
:
getProportionalDimmension
(
100
)
width
:
getProportionalDimmension
(
100
)
text
:
"
Disconnect
"
text
:
"
Disconnect
"
visible
:
mainToolBa
r
.
connectionCount
>
1
visible
:
_controlle
r
.
connectionCount
>
1
menu
:
disconnectMenu
menu
:
disconnectMenu
}
}
}
// Row
}
// Row
...
@@ -833,7 +829,7 @@ Rectangle {
...
@@ -833,7 +829,7 @@ Rectangle {
id
:
progressBar
id
:
progressBar
anchors.top
:
toolRow
.
bottom
anchors.top
:
toolRow
.
bottom
height
:
getProportionalDimmension
(
3
)
height
:
getProportionalDimmension
(
3
)
width
:
parent
.
width
*
mainToolBa
r
.
progressBarValue
width
:
parent
.
width
*
_controlle
r
.
progressBarValue
color
:
qgcPal
.
text
color
:
qgcPal
.
text
}
}
...
@@ -868,8 +864,8 @@ Rectangle {
...
@@ -868,8 +864,8 @@ Rectangle {
onClicked
:
{
onClicked
:
{
parent
.
visible
=
false
parent
.
visible
=
false
mainToolBa
r
.
height
=
toolBarHeight
_controlle
r
.
height
=
toolBarHeight
mainToolBa
r
.
onToolBarMessageClosed
()
_controlle
r
.
onToolBarMessageClosed
()
}
}
}
}
}
}
...
...
src/ui/toolbar/MainToolBar.cc
→
src/ui/toolbar/MainToolBar
Controller
.cc
View file @
57c34c1c
...
@@ -30,28 +30,20 @@ This file is part of the QGROUNDCONTROL project
...
@@ -30,28 +30,20 @@ This file is part of the QGROUNDCONTROL project
#include <QQmlContext>
#include <QQmlContext>
#include <QQmlEngine>
#include <QQmlEngine>
#include "MainToolBar.h"
#include "MainToolBar
Controller
.h"
#include "ScreenToolsController.h"
#include "ScreenToolsController.h"
#include "MainWindow.h"
#include "MainWindow.h"
#include "UASMessageView.h"
#include "UASMessageView.h"
#include "UASMessageHandler.h"
#include "UASMessageHandler.h"
#include "FlightDisplayView.h"
#include "QGCApplication.h"
#include "QGCApplication.h"
#include "MultiVehicleManager.h"
#include "MultiVehicleManager.h"
#include "UAS.h"
#include "UAS.h"
MainToolBar
::
MainToolBar
(
QWidge
t
*
parent
)
MainToolBar
Controller
::
MainToolBarController
(
QObjec
t
*
parent
)
:
Q
GCQmlWidgetHolder
(
QString
(),
NULL
,
parent
)
:
Q
Object
(
parent
)
,
_vehicle
(
NULL
)
,
_vehicle
(
NULL
)
,
_mav
(
NULL
)
,
_mav
(
NULL
)
,
_toolBar
(
NULL
)
,
_currentView
(
ViewNone
)
,
_connectionCount
(
0
)
,
_connectionCount
(
0
)
,
_showGPS
(
true
)
,
_showMav
(
true
)
,
_showMessages
(
true
)
,
_showRSSI
(
true
)
,
_showBattery
(
true
)
,
_progressBarValue
(
0.0
f
)
,
_progressBarValue
(
0.0
f
)
,
_remoteRSSI
(
0
)
,
_remoteRSSI
(
0
)
,
_remoteRSSIstore
(
100.0
)
,
_remoteRSSIstore
(
100.0
)
...
@@ -60,108 +52,44 @@ MainToolBar::MainToolBar(QWidget* parent)
...
@@ -60,108 +52,44 @@ MainToolBar::MainToolBar(QWidget* parent)
,
_rollDownMessages
(
0
)
,
_rollDownMessages
(
0
)
,
_toolbarMessageVisible
(
false
)
,
_toolbarMessageVisible
(
false
)
{
{
setSizePolicy
(
QSizePolicy
::
MinimumExpanding
,
QSizePolicy
::
MinimumExpanding
);
setObjectName
(
"MainToolBar"
);
setMinimumWidth
(
MainWindow
::
instance
()
->
minimumWidth
());
// Get rid of layout default margins
QLayout
*
pl
=
layout
();
if
(
pl
)
{
pl
->
setContentsMargins
(
0
,
0
,
0
,
0
);
}
setMinimumHeight
(
ScreenToolsController
::
defaultFontPixelSize_s
()
*
3
);
setMaximumHeight
(
ScreenToolsController
::
defaultFontPixelSize_s
()
*
3
);
// Tool Bar Preferences
QSettings
settings
;
settings
.
beginGroup
(
TOOL_BAR_SETTINGS_GROUP
);
_showBattery
=
settings
.
value
(
TOOL_BAR_SHOW_BATTERY
,
true
).
toBool
();
_showGPS
=
settings
.
value
(
TOOL_BAR_SHOW_GPS
,
true
).
toBool
();
_showMav
=
settings
.
value
(
TOOL_BAR_SHOW_MAV
,
true
).
toBool
();
_showMessages
=
settings
.
value
(
TOOL_BAR_SHOW_MESSAGES
,
true
).
toBool
();
settings
.
endGroup
();
setContextPropertyObject
(
"mainToolBar"
,
this
);
setSource
(
QUrl
::
fromUserInput
(
"qrc:/qml/MainToolBar.qml"
));
setVisible
(
true
);
emit
configListChanged
();
emit
configListChanged
();
emit
connectionCountChanged
(
_connectionCount
);
emit
connectionCountChanged
(
_connectionCount
);
_activeVehicleChanged
(
MultiVehicleManager
::
instance
()
->
activeVehicle
());
_activeVehicleChanged
(
MultiVehicleManager
::
instance
()
->
activeVehicle
());
// Link signals
// Link signals
connect
(
LinkManager
::
instance
(),
&
LinkManager
::
linkConfigurationChanged
,
this
,
&
MainToolBar
::
_updateConfigurations
);
connect
(
LinkManager
::
instance
(),
&
LinkManager
::
linkConfigurationChanged
,
this
,
&
MainToolBar
Controller
::
_updateConfigurations
);
connect
(
LinkManager
::
instance
(),
&
LinkManager
::
linkConnected
,
this
,
&
MainToolBar
::
_linkConnected
);
connect
(
LinkManager
::
instance
(),
&
LinkManager
::
linkConnected
,
this
,
&
MainToolBar
Controller
::
_linkConnected
);
connect
(
LinkManager
::
instance
(),
&
LinkManager
::
linkDisconnected
,
this
,
&
MainToolBar
::
_linkDisconnected
);
connect
(
LinkManager
::
instance
(),
&
LinkManager
::
linkDisconnected
,
this
,
&
MainToolBar
Controller
::
_linkDisconnected
);
// RSSI (didn't like standard connection)
// RSSI (didn't like standard connection)
connect
(
MAVLinkProtocol
::
instance
(),
connect
(
MAVLinkProtocol
::
instance
(),
SIGNAL
(
radioStatusChanged
(
LinkInterface
*
,
unsigned
,
unsigned
,
unsigned
,
unsigned
,
unsigned
,
unsigned
,
unsigned
)),
this
,
SIGNAL
(
radioStatusChanged
(
LinkInterface
*
,
unsigned
,
unsigned
,
unsigned
,
unsigned
,
unsigned
,
unsigned
,
unsigned
)),
this
,
SLOT
(
_telemetryChanged
(
LinkInterface
*
,
unsigned
,
unsigned
,
unsigned
,
unsigned
,
unsigned
,
unsigned
,
unsigned
)));
SLOT
(
_telemetryChanged
(
LinkInterface
*
,
unsigned
,
unsigned
,
unsigned
,
unsigned
,
unsigned
,
unsigned
,
unsigned
)));
connect
(
MultiVehicleManager
::
instance
(),
&
MultiVehicleManager
::
activeVehicleChanged
,
this
,
&
MainToolBar
::
_activeVehicleChanged
);
connect
(
MultiVehicleManager
::
instance
(),
&
MultiVehicleManager
::
activeVehicleChanged
,
this
,
&
MainToolBarController
::
_activeVehicleChanged
);
connect
(
this
,
&
MainToolBar
::
heightChanged
,
this
,
&
MainToolBar
::
_heightChanged
);
}
}
MainToolBar
::~
MainToolBa
r
()
MainToolBar
Controller
::~
MainToolBarControlle
r
()
{
{
}
}
void
MainToolBar
::
_setToolBarState
(
const
QString
&
key
,
bool
value
)
void
MainToolBar
Controller
::
onSetupView
(
)
{
{
QSettings
settings
;
MainWindow
::
instance
()
->
showSetupView
();
settings
.
beginGroup
(
TOOL_BAR_SETTINGS_GROUP
);
settings
.
setValue
(
key
,
value
);
settings
.
endGroup
();
if
(
key
==
TOOL_BAR_SHOW_GPS
)
{
_showGPS
=
value
;
emit
showGPSChanged
(
value
);
}
else
if
(
key
==
TOOL_BAR_SHOW_MAV
)
{
_showMav
=
value
;
emit
showMavChanged
(
value
);
}
else
if
(
key
==
TOOL_BAR_SHOW_BATTERY
)
{
_showBattery
=
value
;
emit
showBatteryChanged
(
value
);
}
else
if
(
key
==
TOOL_BAR_SHOW_MESSAGES
)
{
_showMessages
=
value
;
emit
showMessagesChanged
(
value
);
}
else
if
(
key
==
TOOL_BAR_SHOW_RSSI
)
{
_showRSSI
=
value
;
emit
showRSSIChanged
(
value
);
}
}
}
void
MainToolBar
::
viewStateChanged
(
const
QString
&
key
,
bool
value
)
void
MainToolBar
Controller
::
onPlanView
(
)
{
{
_setToolBarState
(
key
,
value
);
MainWindow
::
instance
()
->
showPlanView
(
);
}
}
void
MainToolBar
::
onSetup
View
()
void
MainToolBar
Controller
::
onFly
View
()
{
{
setCurrentView
(
MainWindow
::
VIEW_SETUP
);
MainWindow
::
instance
()
->
showFlyView
();
MainWindow
::
instance
()
->
loadSetupView
();
}
void
MainToolBar
::
onPlanView
()
{
setCurrentView
(
MainWindow
::
VIEW_MISSIONEDITOR
);
MainWindow
::
instance
()
->
loadPlanView
();
}
void
MainToolBar
::
onFlyView
()
{
setCurrentView
(
MainWindow
::
VIEW_FLIGHT
);
MainWindow
::
instance
()
->
loadFlightView
();
}
void
MainToolBar
::
onFlyViewMenu
()
{
FlightDisplayView
*
fdsp
=
MainWindow
::
instance
()
->
getFlightDisplay
();
if
(
fdsp
)
{
fdsp
->
showOptionsMenu
();
}
}
}
void
MainToolBar
::
onDisconnect
(
QString
conf
)
void
MainToolBar
Controller
::
onDisconnect
(
QString
conf
)
{
{
if
(
conf
.
isEmpty
())
{
if
(
conf
.
isEmpty
())
{
// Disconnect Only Connected Link
// Disconnect Only Connected Link
...
@@ -191,7 +119,7 @@ void MainToolBar::onDisconnect(QString conf)
...
@@ -191,7 +119,7 @@ void MainToolBar::onDisconnect(QString conf)
}
}
}
}
void
MainToolBar
::
onConnect
(
QString
conf
)
void
MainToolBar
Controller
::
onConnect
(
QString
conf
)
{
{
// Connect Link
// Connect Link
if
(
conf
.
isEmpty
())
{
if
(
conf
.
isEmpty
())
{
...
@@ -209,64 +137,48 @@ void MainToolBar::onConnect(QString conf)
...
@@ -209,64 +137,48 @@ void MainToolBar::onConnect(QString conf)
}
}
}
}
void
MainToolBar
::
onEnterMessageArea
(
int
x
,
int
y
)
void
MainToolBar
Controller
::
onEnterMessageArea
(
int
x
,
int
y
)
{
{
Q_UNUSED
(
x
);
Q_UNUSED
(
y
);
// If not already there and messages are actually present
// If not already there and messages are actually present
if
(
!
_rollDownMessages
&&
UASMessageHandler
::
instance
()
->
messages
().
count
())
if
(
!
_rollDownMessages
&&
UASMessageHandler
::
instance
()
->
messages
().
count
())
{
{
if
(
MultiVehicleManager
::
instance
()
->
activeVehicle
())
{
if
(
MultiVehicleManager
::
instance
()
->
activeVehicle
())
MultiVehicleManager
::
instance
()
->
activeVehicle
()
->
resetMessages
();
MultiVehicleManager
::
instance
()
->
activeVehicle
()
->
resetMessages
();
}
// FIXME: Position of the message dropdown is hacked right now to speed up Qml conversion
// Show messages
// Show messages
int
dialogWidth
=
400
;
int
dialogWidth
=
400
;
#if 0
x = x - (dialogWidth >> 1);
x = x - (dialogWidth >> 1);
if(x < 0) x = 0;
if(x < 0) x = 0;
y = height() / 3;
y = height() / 3;
#endif
// Put dialog on top of the message alert icon
// Put dialog on top of the message alert icon
QPoint
p
=
mapToGlobal
(
QPoint
(
x
,
y
));
_rollDownMessages
=
new
UASMessageViewRollDown
(
MainWindow
::
instance
());
_rollDownMessages
=
new
UASMessageViewRollDown
(
MainWindow
::
instance
());
_rollDownMessages
->
setAttribute
(
Qt
::
WA_DeleteOnClose
);
_rollDownMessages
->
setAttribute
(
Qt
::
WA_DeleteOnClose
);
_rollDownMessages
->
move
(
mapFromGlobal
(
p
));
_rollDownMessages
->
move
(
QPoint
(
100
,
100
));
_rollDownMessages
->
setMinimumSize
(
dialogWidth
,
200
);
_rollDownMessages
->
setMinimumSize
(
dialogWidth
,
200
);
connect
(
_rollDownMessages
,
&
UASMessageViewRollDown
::
closeWindow
,
this
,
&
MainToolBar
::
_leaveMessageView
);
connect
(
_rollDownMessages
,
&
UASMessageViewRollDown
::
closeWindow
,
this
,
&
MainToolBar
Controller
::
_leaveMessageView
);
_rollDownMessages
->
show
();
_rollDownMessages
->
show
();
}
}
}
}
void
MainToolBar
::
_leaveMessageView
()
void
MainToolBar
Controller
::
_leaveMessageView
()
{
{
// Mouse has left the message window area (and it has closed itself)
// Mouse has left the message window area (and it has closed itself)
_rollDownMessages
=
NULL
;
_rollDownMessages
=
NULL
;
}
}
void
MainToolBar
::
setCurrentView
(
int
currentView
)
void
MainToolBarController
::
_activeVehicleChanged
(
Vehicle
*
vehicle
)
{
ViewType_t
view
=
ViewNone
;
switch
((
MainWindow
::
VIEW_SECTIONS
)
currentView
)
{
case
MainWindow
:
:
VIEW_MISSIONEDITOR
:
view
=
ViewPlan
;
break
;
case
MainWindow
:
:
VIEW_FLIGHT
:
view
=
ViewFly
;
break
;
case
MainWindow
:
:
VIEW_SETUP
:
view
=
ViewSetup
;
break
;
default:
view
=
ViewNone
;
break
;
}
if
(
view
!=
_currentView
)
{
_currentView
=
view
;
emit
currentViewChanged
();
}
}
void
MainToolBar
::
_activeVehicleChanged
(
Vehicle
*
vehicle
)
{
{
// Disconnect the previous one (if any)
// Disconnect the previous one (if any)
if
(
_vehicle
)
{
if
(
_vehicle
)
{
disconnect
(
_mav
,
&
UASInterface
::
remoteControlRSSIChanged
,
this
,
&
MainToolBar
::
_remoteControlRSSIChanged
);
disconnect
(
_mav
,
&
UASInterface
::
remoteControlRSSIChanged
,
this
,
&
MainToolBar
Controller
::
_remoteControlRSSIChanged
);
disconnect
(
_vehicle
->
autopilotPlugin
(),
&
AutoPilotPlugin
::
parameterListProgress
,
this
,
&
MainToolBar
::
_setProgressBarValue
);
disconnect
(
_vehicle
->
autopilotPlugin
(),
&
AutoPilotPlugin
::
parameterListProgress
,
this
,
&
MainToolBar
Controller
::
_setProgressBarValue
);
_mav
=
NULL
;
_mav
=
NULL
;
_vehicle
=
NULL
;
_vehicle
=
NULL
;
}
}
...
@@ -276,12 +188,12 @@ void MainToolBar::_activeVehicleChanged(Vehicle* vehicle)
...
@@ -276,12 +188,12 @@ void MainToolBar::_activeVehicleChanged(Vehicle* vehicle)
{
{
_vehicle
=
vehicle
;
_vehicle
=
vehicle
;
_mav
=
vehicle
->
uas
();
_mav
=
vehicle
->
uas
();
connect
(
_mav
,
&
UASInterface
::
remoteControlRSSIChanged
,
this
,
&
MainToolBar
::
_remoteControlRSSIChanged
);
connect
(
_mav
,
&
UASInterface
::
remoteControlRSSIChanged
,
this
,
&
MainToolBar
Controller
::
_remoteControlRSSIChanged
);
connect
(
_vehicle
->
autopilotPlugin
(),
&
AutoPilotPlugin
::
parameterListProgress
,
this
,
&
MainToolBar
::
_setProgressBarValue
);
connect
(
_vehicle
->
autopilotPlugin
(),
&
AutoPilotPlugin
::
parameterListProgress
,
this
,
&
MainToolBar
Controller
::
_setProgressBarValue
);
}
}
}
}
void
MainToolBar
::
_updateConfigurations
()
void
MainToolBar
Controller
::
_updateConfigurations
()
{
{
QStringList
tmpList
;
QStringList
tmpList
;
QList
<
LinkConfiguration
*>
configs
=
LinkManager
::
instance
()
->
getLinkConfigurationList
();
QList
<
LinkConfiguration
*>
configs
=
LinkManager
::
instance
()
->
getLinkConfigurationList
();
...
@@ -301,7 +213,7 @@ void MainToolBar::_updateConfigurations()
...
@@ -301,7 +213,7 @@ void MainToolBar::_updateConfigurations()
}
}
}
}
void
MainToolBar
::
_telemetryChanged
(
LinkInterface
*
,
unsigned
,
unsigned
,
unsigned
rssi
,
unsigned
remrssi
,
unsigned
,
unsigned
,
unsigned
)
void
MainToolBar
Controller
::
_telemetryChanged
(
LinkInterface
*
,
unsigned
,
unsigned
,
unsigned
rssi
,
unsigned
remrssi
,
unsigned
,
unsigned
,
unsigned
)
{
{
// We only care if we haveone single connection
// We only care if we haveone single connection
if
(
_connectionCount
==
1
)
{
if
(
_connectionCount
==
1
)
{
...
@@ -318,7 +230,7 @@ void MainToolBar::_telemetryChanged(LinkInterface*, unsigned, unsigned, unsigned
...
@@ -318,7 +230,7 @@ void MainToolBar::_telemetryChanged(LinkInterface*, unsigned, unsigned, unsigned
}
}
}
}
void
MainToolBar
::
_remoteControlRSSIChanged
(
uint8_t
rssi
)
void
MainToolBar
Controller
::
_remoteControlRSSIChanged
(
uint8_t
rssi
)
{
{
// We only care if we have one single connection
// We only care if we have one single connection
if
(
_connectionCount
==
1
)
{
if
(
_connectionCount
==
1
)
{
...
@@ -335,17 +247,17 @@ void MainToolBar::_remoteControlRSSIChanged(uint8_t rssi)
...
@@ -335,17 +247,17 @@ void MainToolBar::_remoteControlRSSIChanged(uint8_t rssi)
}
}
}
}
void
MainToolBar
::
_linkConnected
(
LinkInterface
*
)
void
MainToolBar
Controller
::
_linkConnected
(
LinkInterface
*
)
{
{
_updateConnection
();
_updateConnection
();
}
}
void
MainToolBar
::
_linkDisconnected
(
LinkInterface
*
link
)
void
MainToolBar
Controller
::
_linkDisconnected
(
LinkInterface
*
link
)
{
{
_updateConnection
(
link
);
_updateConnection
(
link
);
}
}
void
MainToolBar
::
_updateConnection
(
LinkInterface
*
disconnectedLink
)
void
MainToolBar
Controller
::
_updateConnection
(
LinkInterface
*
disconnectedLink
)
{
{
QStringList
connList
;
QStringList
connList
;
int
oldCount
=
_connectionCount
;
int
oldCount
=
_connectionCount
;
...
@@ -382,24 +294,18 @@ void MainToolBar::_updateConnection(LinkInterface *disconnectedLink)
...
@@ -382,24 +294,18 @@ void MainToolBar::_updateConnection(LinkInterface *disconnectedLink)
}
}
}
}
void
MainToolBar
::
_setProgressBarValue
(
float
value
)
void
MainToolBar
Controller
::
_setProgressBarValue
(
float
value
)
{
{
_progressBarValue
=
value
;
_progressBarValue
=
value
;
emit
progressBarValueChanged
(
value
);
emit
progressBarValueChanged
(
value
);
}
}
void
MainToolBar
::
_heightChanged
(
double
height
)
void
MainToolBarController
::
showToolBarMessage
(
const
QString
&
message
)
{
setMinimumHeight
(
height
);
setMaximumHeight
(
height
);
}
void
MainToolBar
::
showToolBarMessage
(
const
QString
&
message
)
{
{
_toolbarMessageQueueMutex
.
lock
();
_toolbarMessageQueueMutex
.
lock
();
if
(
_toolbarMessageQueue
.
count
()
==
0
&&
!
_toolbarMessageVisible
)
{
if
(
_toolbarMessageQueue
.
count
()
==
0
&&
!
_toolbarMessageVisible
)
{
QTimer
::
singleShot
(
500
,
this
,
&
MainToolBar
::
_delayedShowToolBarMessage
);
QTimer
::
singleShot
(
500
,
this
,
&
MainToolBar
Controller
::
_delayedShowToolBarMessage
);
}
}
_toolbarMessageQueue
+=
message
;
_toolbarMessageQueue
+=
message
;
...
@@ -407,7 +313,7 @@ void MainToolBar::showToolBarMessage(const QString& message)
...
@@ -407,7 +313,7 @@ void MainToolBar::showToolBarMessage(const QString& message)
_toolbarMessageQueueMutex
.
unlock
();
_toolbarMessageQueueMutex
.
unlock
();
}
}
void
MainToolBar
::
_delayedShowToolBarMessage
(
void
)
void
MainToolBar
Controller
::
_delayedShowToolBarMessage
(
void
)
{
{
QString
messages
;
QString
messages
;
...
@@ -428,7 +334,7 @@ void MainToolBar::_delayedShowToolBarMessage(void)
...
@@ -428,7 +334,7 @@ void MainToolBar::_delayedShowToolBarMessage(void)
}
}
}
}
void
MainToolBar
::
onToolBarMessageClosed
(
void
)
void
MainToolBar
Controller
::
onToolBarMessageClosed
(
void
)
{
{
_toolbarMessageVisible
=
false
;
_toolbarMessageVisible
=
false
;
_delayedShowToolBarMessage
();
_delayedShowToolBarMessage
();
...
...
src/ui/toolbar/MainToolBar.h
→
src/ui/toolbar/MainToolBar
Controller
.h
View file @
57c34c1c
...
@@ -27,10 +27,13 @@ This file is part of the QGROUNDCONTROL project
...
@@ -27,10 +27,13 @@ This file is part of the QGROUNDCONTROL project
* @author Gus Grubba <mavlink@grubba.com>
* @author Gus Grubba <mavlink@grubba.com>
*/
*/
#ifndef M
AINTOOLBAR
_H
#ifndef M
ainToolBarController
_H
#define M
AINTOOLBAR
_H
#define M
ainToolBarController
_H
#include "QGCQmlWidgetHolder.h"
#include <QObject>
#include "Vehicle.h"
#include "UASMessageView.h"
#define TOOL_BAR_SETTINGS_GROUP "TOOLBAR_SETTINGS_GROUP"
#define TOOL_BAR_SETTINGS_GROUP "TOOLBAR_SETTINGS_GROUP"
#define TOOL_BAR_SHOW_BATTERY "ShowBattery"
#define TOOL_BAR_SHOW_BATTERY "ShowBattery"
...
@@ -39,52 +42,31 @@ This file is part of the QGROUNDCONTROL project
...
@@ -39,52 +42,31 @@ This file is part of the QGROUNDCONTROL project
#define TOOL_BAR_SHOW_MESSAGES "ShowMessages"
#define TOOL_BAR_SHOW_MESSAGES "ShowMessages"
#define TOOL_BAR_SHOW_RSSI "ShowRSSI"
#define TOOL_BAR_SHOW_RSSI "ShowRSSI"
class
UASInterface
;
class
MainToolBarController
:
public
QObject
class
UASMessage
;
class
UASMessageViewRollDown
;
class
MainToolBar
:
public
QGCQmlWidgetHolder
{
{
Q_OBJECT
Q_OBJECT
Q_ENUMS
(
ViewType_t
)
public:
typedef
enum
{
public:
ViewNone
=
-
1
,
MainToolBarController
(
QObject
*
parent
=
NULL
);
ViewAnalyze
,
// MainWindow::VIEW_ENGINEER
~
MainToolBarController
();
ViewPlan
,
// MainWindow::VIEW_MISSION_EDITOR
ViewFly
,
// MainWindow::VIEW_FLIGHT
ViewSetup
,
// MainWindow::VIEW_SETUP
}
ViewType_t
;
MainToolBar
(
QWidget
*
parent
=
NULL
);
~
MainToolBar
();
Q_INVOKABLE
void
onSetupView
();
Q_INVOKABLE
void
onSetupView
();
Q_INVOKABLE
void
onPlanView
();
Q_INVOKABLE
void
onPlanView
();
Q_INVOKABLE
void
onFlyView
();
Q_INVOKABLE
void
onFlyView
();
Q_INVOKABLE
void
onFlyViewMenu
();
Q_INVOKABLE
void
onConnect
(
QString
conf
);
Q_INVOKABLE
void
onConnect
(
QString
conf
);
Q_INVOKABLE
void
onDisconnect
(
QString
conf
);
Q_INVOKABLE
void
onDisconnect
(
QString
conf
);
Q_INVOKABLE
void
onEnterMessageArea
(
int
x
,
int
y
);
Q_INVOKABLE
void
onEnterMessageArea
(
int
x
,
int
y
);
Q_INVOKABLE
void
onToolBarMessageClosed
(
void
);
Q_INVOKABLE
void
onToolBarMessageClosed
(
void
);
Q_PROPERTY
(
double
height
MEMBER
_toolbarHeight
NOTIFY
heightChanged
)
Q_PROPERTY
(
double
height
MEMBER
_toolbarHeight
NOTIFY
heightChanged
)
Q_PROPERTY
(
ViewType_t
currentView
MEMBER
_currentView
NOTIFY
currentViewChanged
)
Q_PROPERTY
(
QStringList
configList
MEMBER
_linkConfigurations
NOTIFY
configListChanged
)
Q_PROPERTY
(
QStringList
configList
MEMBER
_linkConfigurations
NOTIFY
configListChanged
)
Q_PROPERTY
(
int
connectionCount
READ
connectionCount
NOTIFY
connectionCountChanged
)
Q_PROPERTY
(
int
connectionCount
READ
connectionCount
NOTIFY
connectionCountChanged
)
Q_PROPERTY
(
QStringList
connectedList
MEMBER
_connectedList
NOTIFY
connectedListChanged
)
Q_PROPERTY
(
QStringList
connectedList
MEMBER
_connectedList
NOTIFY
connectedListChanged
)
Q_PROPERTY
(
bool
showGPS
MEMBER
_showGPS
NOTIFY
showGPSChanged
)
Q_PROPERTY
(
bool
showMav
MEMBER
_showMav
NOTIFY
showMavChanged
)
Q_PROPERTY
(
bool
showMessages
MEMBER
_showMessages
NOTIFY
showMessagesChanged
)
Q_PROPERTY
(
bool
showBattery
MEMBER
_showBattery
NOTIFY
showBatteryChanged
)
Q_PROPERTY
(
bool
showRSSI
MEMBER
_showRSSI
NOTIFY
showRSSIChanged
)
Q_PROPERTY
(
float
progressBarValue
MEMBER
_progressBarValue
NOTIFY
progressBarValueChanged
)
Q_PROPERTY
(
float
progressBarValue
MEMBER
_progressBarValue
NOTIFY
progressBarValueChanged
)
Q_PROPERTY
(
int
remoteRSSI
READ
remoteRSSI
NOTIFY
remoteRSSIChanged
)
Q_PROPERTY
(
int
remoteRSSI
READ
remoteRSSI
NOTIFY
remoteRSSIChanged
)
Q_PROPERTY
(
int
telemetryRRSSI
READ
telemetryRRSSI
NOTIFY
telemetryRRSSIChanged
)
Q_PROPERTY
(
int
telemetryRRSSI
READ
telemetryRRSSI
NOTIFY
telemetryRRSSIChanged
)
Q_PROPERTY
(
int
telemetryLRSSI
READ
telemetryLRSSI
NOTIFY
telemetryLRSSIChanged
)
Q_PROPERTY
(
int
telemetryLRSSI
READ
telemetryLRSSI
NOTIFY
telemetryLRSSIChanged
)
void
setCurrentView
(
int
currentView
);
void
viewStateChanged
(
const
QString
&
key
,
bool
value
);
void
viewStateChanged
(
const
QString
&
key
,
bool
value
);
int
remoteRSSI
()
{
return
_remoteRSSI
;
}
int
remoteRSSI
()
{
return
_remoteRSSI
;
}
int
telemetryRRSSI
()
{
return
_telemetryRRSSI
;
}
int
telemetryRRSSI
()
{
return
_telemetryRRSSI
;
}
...
@@ -95,14 +77,8 @@ public:
...
@@ -95,14 +77,8 @@ public:
signals:
signals:
void
connectionCountChanged
(
int
count
);
void
connectionCountChanged
(
int
count
);
void
currentViewChanged
();
void
configListChanged
();
void
configListChanged
();
void
connectedListChanged
(
QStringList
connectedList
);
void
connectedListChanged
(
QStringList
connectedList
);
void
showGPSChanged
(
bool
value
);
void
showMavChanged
(
bool
value
);
void
showMessagesChanged
(
bool
value
);
void
showBatteryChanged
(
bool
value
);
void
showRSSIChanged
(
bool
value
);
void
progressBarValueChanged
(
float
value
);
void
progressBarValueChanged
(
float
value
);
void
remoteRSSIChanged
(
int
value
);
void
remoteRSSIChanged
(
int
value
);
void
telemetryRRSSIChanged
(
int
value
);
void
telemetryRRSSIChanged
(
int
value
);
...
@@ -121,26 +97,17 @@ private slots:
...
@@ -121,26 +97,17 @@ private slots:
void
_setProgressBarValue
(
float
value
);
void
_setProgressBarValue
(
float
value
);
void
_remoteControlRSSIChanged
(
uint8_t
rssi
);
void
_remoteControlRSSIChanged
(
uint8_t
rssi
);
void
_telemetryChanged
(
LinkInterface
*
link
,
unsigned
rxerrors
,
unsigned
fixed
,
unsigned
rssi
,
unsigned
remrssi
,
unsigned
txbuf
,
unsigned
noise
,
unsigned
remnoise
);
void
_telemetryChanged
(
LinkInterface
*
link
,
unsigned
rxerrors
,
unsigned
fixed
,
unsigned
rssi
,
unsigned
remrssi
,
unsigned
txbuf
,
unsigned
noise
,
unsigned
remnoise
);
void
_heightChanged
(
double
height
);
void
_delayedShowToolBarMessage
(
void
);
void
_delayedShowToolBarMessage
(
void
);
private:
private:
void
_updateConnection
(
LinkInterface
*
disconnectedLink
=
NULL
);
void
_updateConnection
(
LinkInterface
*
disconnectedLink
=
NULL
);
void
_setToolBarState
(
const
QString
&
key
,
bool
value
);
private:
private:
Vehicle
*
_vehicle
;
Vehicle
*
_vehicle
;
UASInterface
*
_mav
;
UASInterface
*
_mav
;
QQuickItem
*
_toolBar
;
ViewType_t
_currentView
;
QStringList
_linkConfigurations
;
QStringList
_linkConfigurations
;
int
_connectionCount
;
int
_connectionCount
;
QStringList
_connectedList
;
QStringList
_connectedList
;
bool
_showGPS
;
bool
_showMav
;
bool
_showMessages
;
bool
_showRSSI
;
bool
_showBattery
;
float
_progressBarValue
;
float
_progressBarValue
;
int
_remoteRSSI
;
int
_remoteRSSI
;
double
_remoteRSSIstore
;
double
_remoteRSSIstore
;
...
@@ -155,4 +122,4 @@ private:
...
@@ -155,4 +122,4 @@ private:
QMutex
_toolbarMessageQueueMutex
;
QMutex
_toolbarMessageQueueMutex
;
};
};
#endif // M
AINTOOLBAR
_H
#endif // M
ainToolBarController
_H
src/ui/uas/UASMessageView.cc
View file @
57c34c1c
...
@@ -24,7 +24,6 @@ This file is part of the QGROUNDCONTROL project
...
@@ -24,7 +24,6 @@ This file is part of the QGROUNDCONTROL project
#include <QMenu>
#include <QMenu>
#include <QScrollBar>
#include <QScrollBar>
#include "MainToolBar.h"
#include "UASMessageView.h"
#include "UASMessageView.h"
#include "QGCUnconnectedInfoWidget.h"
#include "QGCUnconnectedInfoWidget.h"
#include "UASMessageHandler.h"
#include "UASMessageHandler.h"
...
...
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