Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
a4c19e72
Commit
a4c19e72
authored
Jan 22, 2016
by
dogmaphobic
Browse files
Making Map and Video persistent.
parent
570db278
Changes
6
Hide whitespace changes
Inline
Side-by-side
qgroundcontrol.qrc
View file @
a4c19e72
...
...
@@ -59,6 +59,7 @@
<file alias="QGroundControl/Controls/QGCCheckBox.qml">src/QmlControls/QGCCheckBox.qml</file>
<file alias="QGroundControl/Controls/QGCColoredImage.qml">src/QmlControls/QGCColoredImage.qml</file>
<file alias="QGroundControl/Controls/QGCFlickable.qml">src/QmlControls/QGCFlickable.qml</file>
<file alias="QGroundControl/Controls/QGCPipable.qml">src/QmlControls/QGCPipable.qml</file>
<file alias="QGroundControl/Controls/QGCFlickableVerticalIndicator.qml">src/QmlControls/QGCFlickableVerticalIndicator.qml</file>
<file alias="QGroundControl/Controls/QGCFlickableHorizontalIndicator.qml">src/QmlControls/QGCFlickableHorizontalIndicator.qml</file>
<file alias="QGroundControl/Controls/QGCComboBox.qml">src/QmlControls/QGCComboBox.qml</file>
...
...
src/FlightDisplay/FlightDisplayView.qml
View file @
a4c19e72
...
...
@@ -47,7 +47,7 @@ Item {
readonly
property
bool
isBackgroundDark
:
_mainIsMap
?
(
_flightMap
?
_flightMap
.
isSatelliteMap
:
true
)
:
true
property
var
_activeVehicle
:
multiVehicleManager
.
activeVehicle
property
var
_activeVehicle
:
multiVehicleManager
.
activeVehicle
readonly
property
real
_defaultRoll
:
0
readonly
property
real
_defaultPitch
:
0
...
...
@@ -74,145 +74,140 @@ Item {
property
real
_airSpeed
:
_activeVehicle
?
_activeVehicle
.
airSpeed
:
_defaultAirSpeed
property
real
_climbRate
:
_activeVehicle
?
_activeVehicle
.
climbRate
:
_defaultClimbRate
property
var
_flightMap
:
null
property
var
_flightVideo
:
null
property
var
_savedZoomLevel
:
0
property
real
_
pipSize
:
mainWindow
.
width
*
0.2
property
real
pipSize
:
mainWindow
.
width
*
0.2
FlightDisplayViewController
{
id
:
_controller
}
function
reloadContents
()
{
if
(
_flightVideo
)
{
_flightVideo
.
visible
=
false
}
function
setStates
()
{
if
(
_mainIsMap
)
{
mainLoader
.
source
=
"
FlightDisplayViewMap.qml
"
pipLoader
.
source
=
"
FlightDisplayViewVideo.qml
"
//-- Adjust Margins
_flightMapContainer
.
state
=
"
fullMode
"
_flightVideo
.
state
=
"
pipMode
"
//-- Save/Restore Map Zoom Level
if
(
_savedZoomLevel
!=
0
)
_flightMap
.
zoomLevel
=
_savedZoomLevel
else
_savedZoomLevel
=
_flightMap
.
zoomLevel
}
else
{
mainLoader
.
source
=
"
FlightDisplayViewVideo.qml
"
pipLoader
.
source
=
"
FlightDisplayViewMap.qml
"
//-- Adjust Margins
_flightMapContainer
.
state
=
"
pipMode
"
_flightVideo
.
state
=
"
fullMode
"
//-- Set Map Zoom Level
_savedZoomLevel
=
_flightMap
.
zoomLevel
_flightMap
.
zoomLevel
=
_savedZoomLevel
-
3
}
}
Component.onCompleted
:
{
reloadContents
()
;
widgetsLoader
.
source
=
"
FlightDisplayViewWidgets.qml
"
function
setPipVisibility
(
state
)
{
_isPipVisible
=
state
;
QGroundControl
.
saveBoolGlobalSetting
(
_PIPVisibleKey
,
state
)
}
//-- Main Window
Loader
{
id
:
mainLoader
anchors.fill
:
parent
onLoaded
:
{
if
(
_mainIsMap
)
{
_flightMap
=
item
if
(
_savedZoomLevel
!=
0
)
_flightMap
.
zoomLevel
=
_savedZoomLevel
else
_savedZoomLevel
=
_flightMap
.
zoomLevel
}
else
{
_flightVideo
=
item
}
}
Component.onCompleted
:
{
widgetsLoader
.
source
=
"
FlightDisplayViewWidgets.qml
"
setStates
()
}
//-- PIP Window
//-- Map View
// For whatever reason, if FlightDisplayViewMap is the root item, changing
// width/height has no effect.
Item
{
id
:
pip
visible
:
_controller
.
hasVideo
&&
_isPipVisible
anchors.margins
:
ScreenTools
.
defaultFontPixelHeight
anchors.left
:
parent
.
left
anchors.bottom
:
parent
.
bottom
width
:
_pipSize
height
:
_pipSize
*
(
9
/
16
)
Loader
{
id
:
pipLoader
anchors.fill
:
parent
onLoaded
:
{
if
(
_mainIsMap
)
{
_flightVideo
=
item
}
else
{
_flightMap
=
item
_savedZoomLevel
=
_flightMap
.
zoomLevel
_flightMap
.
zoomLevel
=
_savedZoomLevel
-
3
id
:
_flightMapContainer
z
:
_mainIsMap
?
root
.
z
+
1
:
root
.
z
+
2
anchors.left
:
root
.
left
anchors.bottom
:
root
.
bottom
visible
:
_mainIsMap
||
_isPipVisible
width
:
_mainIsMap
?
root
.
width
:
pipSize
height
:
_mainIsMap
?
root
.
height
:
pipSize
*
(
9
/
16
)
states
:
[
State
{
name
:
"
pipMode
"
PropertyChanges
{
target
:
_flightMapContainer
anchors.margins
:
ScreenTools
.
defaultFontPixelHeight
}
},
State
{
name
:
"
fullMode
"
PropertyChanges
{
target
:
_flightMapContainer
anchors.margins
:
0
}
}
]
FlightDisplayViewMap
{
id
:
_flightMap
anchors.fill
:
parent
}
MouseArea
{
anchors.fill
:
parent
onClicked
:
{
_mainIsMap
=
!
_mainIsMap
reloadContents
();
QGroundControl
.
saveBoolGlobalSetting
(
_mainIsMapKey
,
_mainIsMap
)
}
}
Image
{
id
:
closePIP
source
:
"
/qmlimages/PiP.svg
"
mipmap
:
true
fillMode
:
Image
.
PreserveAspectFit
anchors.left
:
parent
.
left
anchors.bottom
:
parent
.
bottom
height
:
ScreenTools
.
defaultFontPixelSize
*
2.5
width
:
ScreenTools
.
defaultFontPixelSize
*
2.5
MouseArea
{
anchors.fill
:
parent
onClicked
:
{
_isPipVisible
=
false
QGroundControl
.
saveBoolGlobalSetting
(
_PIPVisibleKey
,
false
)
}
//-- Video View
FlightDisplayViewVideo
{
id
:
_flightVideo
z
:
_mainIsMap
?
root
.
z
+
2
:
root
.
z
+
1
width
:
!
_mainIsMap
?
root
.
width
:
pipSize
height
:
!
_mainIsMap
?
root
.
height
:
pipSize
*
(
9
/
16
)
anchors.left
:
root
.
left
anchors.bottom
:
root
.
bottom
visible
:
_controller
.
hasVideo
&&
(
!
_mainIsMap
||
_isPipVisible
)
states
:
[
State
{
name
:
"
pipMode
"
PropertyChanges
{
target
:
_flightVideo
anchors.margins
:
ScreenTools
.
defaultFontPixelHeight
}
},
State
{
name
:
"
fullMode
"
PropertyChanges
{
target
:
_flightVideo
anchors.margins
:
0
}
}
}
]
}
//-- Show PIP
Rectangle
{
id
:
openPIP
anchors.left
:
parent
.
left
anchors.bottom
:
parent
.
bottom
anchors.margins
:
ScreenTools
.
defaultFontPixelHeight
height
:
ScreenTools
.
defaultFontPixelSize
*
2
width
:
ScreenTools
.
defaultFontPixelSize
*
2
radius
:
ScreenTools
.
defaultFontPixelSize
/
3
visible
:
_controller
.
hasVideo
&&
!
_isPipVisible
color
:
isBackgroundDark
?
Qt
.
rgba
(
0
,
0
,
0
,
0.75
)
:
Qt
.
rgba
(
0
,
0
,
0
,
0.5
)
Image
{
width
:
parent
.
width
*
0.75
height
:
parent
.
height
*
0.75
source
:
"
/res/buttonRight.svg
"
mipmap
:
true
fillMode
:
Image
.
PreserveAspectFit
anchors.verticalCenter
:
parent
.
verticalCenter
anchors.horizontalCenter
:
parent
.
horizontalCenter
QGCPipable
{
id
:
_flightVideoPipControl
z
:
_flightVideo
.
z
+
3
width
:
pipSize
height
:
pipSize
*
(
9
/
16
)
anchors.left
:
root
.
left
anchors.bottom
:
root
.
bottom
anchors.margins
:
ScreenTools
.
defaultFontPixelHeight
isHidden
:
!
_isPipVisible
isDark
:
isBackgroundDark
onActivated
:
{
_mainIsMap
=
!
_mainIsMap
setStates
()
}
MouseArea
{
anchors.fill
:
parent
onClicked
:
{
_isPipVisible
=
true
QGroundControl
.
saveBoolGlobalSetting
(
_PIPVisibleKey
,
true
)
}
onHideIt
:
{
setPipVisibility
(
!
state
)
}
}
//-- Widgets
Loader
{
id
:
widgetsLoader
z
:
root
.
z
+
4
anchors.right
:
parent
.
right
anchors.left
:
parent
.
left
anchors.bottom
:
parent
.
bottom
height
:
availableHeight
property
bool
isBackgroundDark
:
root
.
isBackgroundDark
}
//-- Virtual Joystick
Item
{
id
:
multiTouchItem
width
:
parent
.
width
-
(
pip
.
width
/
2
)
z
:
root
.
z
+
5
width
:
parent
.
width
-
(
_flightVideoPipControl
.
width
/
2
)
height
:
thumbAreaHeight
visible
:
QGroundControl
.
virtualTabletJoystick
anchors.bottom
:
pip
.
top
anchors.bottom
:
_flightVideoPipControl
.
top
anchors.bottomMargin
:
ScreenTools
.
defaultFontPixelHeight
*
2
anchors.horizontalCenter
:
parent
.
horizontalCenter
...
...
src/FlightDisplay/FlightDisplayViewWidgets.qml
View file @
a4c19e72
...
...
@@ -118,8 +118,8 @@ Item {
anchors.margins
:
ScreenTools
.
defaultFontPixelHeight
anchors.right
:
parent
.
right
anchors.bottom
:
parent
.
bottom
width
:
_
pipSize
height
:
_
pipSize
*
(
9
/
16
)
width
:
pipSize
height
:
pipSize
*
(
9
/
16
)
color
:
Qt
.
rgba
(
0
,
0
,
0
,
0.75
)
Column
{
id
:
instruments
...
...
src/FlightDisplay/qmldir
View file @
a4c19e72
Module QGroundControl.FlightDisplay
FlightDisplayView 1.0 FlightDisplayView.qml
FlightDisplayViewMap 1.0 FlightDisplayViewMap.qml
src/QmlControls/QGCPipable.qml
0 → 100644
View file @
a4c19e72
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2016 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.5
import
QtQuick
.
Controls
1.3
import
QGroundControl
1.0
import
QGroundControl
.
ScreenTools
1.0
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
Palette
1.0
Item
{
id
:
pip
property
bool
isHidden
:
false
property
bool
isDark
:
false
signal
activated
()
signal
hideIt
(
bool
state
)
MouseArea
{
anchors.fill
:
parent
enabled
:
!
isHidden
onClicked
:
{
pip
.
activated
()
}
}
//-- PIP Corner Indicator
Image
{
id
:
closePIP
source
:
"
/qmlimages/PiP.svg
"
mipmap
:
true
fillMode
:
Image
.
PreserveAspectFit
anchors.left
:
parent
.
left
anchors.bottom
:
parent
.
bottom
visible
:
!
isHidden
height
:
ScreenTools
.
defaultFontPixelSize
*
2.5
width
:
ScreenTools
.
defaultFontPixelSize
*
2.5
MouseArea
{
anchors.fill
:
parent
onClicked
:
{
pip
.
hideIt
(
true
)
}
}
}
//-- Show PIP
Rectangle
{
id
:
openPIP
anchors.left
:
parent
.
left
anchors.bottom
:
parent
.
bottom
height
:
ScreenTools
.
defaultFontPixelSize
*
2
width
:
ScreenTools
.
defaultFontPixelSize
*
2
radius
:
ScreenTools
.
defaultFontPixelSize
/
3
visible
:
isHidden
color
:
isDark
?
Qt
.
rgba
(
0
,
0
,
0
,
0.75
)
:
Qt
.
rgba
(
0
,
0
,
0
,
0.5
)
Image
{
width
:
parent
.
width
*
0.75
height
:
parent
.
height
*
0.75
source
:
"
/res/buttonRight.svg
"
mipmap
:
true
fillMode
:
Image
.
PreserveAspectFit
anchors.verticalCenter
:
parent
.
verticalCenter
anchors.horizontalCenter
:
parent
.
horizontalCenter
}
MouseArea
{
anchors.fill
:
parent
onClicked
:
{
pip
.
hideIt
(
false
)
}
}
}
}
src/QmlControls/QGroundControl.Controls.qmldir
View file @
a4c19e72
...
...
@@ -21,6 +21,7 @@ QGCComboBox 1.0 QGCComboBox.qml
QGCFlickable 1.0 QGCFlickable.qml
QGCLabel 1.0 QGCLabel.qml
QGCMovableItem 1.0 QGCMovableItem.qml
QGCPipable 1.0 QGCPipable.qml
QGCRadioButton 1.0 QGCRadioButton.qml
QGCTextField 1.0 QGCTextField.qml
QGCToolBarButton 1.0 QGCToolBarButton.qml
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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