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
07f790aa
Commit
07f790aa
authored
Nov 27, 2015
by
dogmaphobic
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added toolbar indicators popup (drop down) showing extended information.
parent
dcd33841
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
321 additions
and
165 deletions
+321
-165
MainWindow.qml
src/ui/MainWindow.qml
+134
-13
MainToolBar.qml
src/ui/toolbar/MainToolBar.qml
+123
-74
MainToolBarIndicators.qml
src/ui/toolbar/MainToolBarIndicators.qml
+64
-78
No files found.
src/ui/MainWindow.qml
View file @
07f790aa
...
...
@@ -25,11 +25,12 @@ import QtQuick 2.5
import
QtQuick
.
Controls
1.2
import
QtPositioning
5.2
import
QGroundControl
1.0
import
QGroundControl
.
Palette
1.0
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
FlightDisplay
1.0
import
QGroundControl
.
ScreenTools
1.0
import
QGroundControl
1.0
import
QGroundControl
.
Palette
1.0
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
FlightDisplay
1.0
import
QGroundControl
.
ScreenTools
1.0
import
QGroundControl
.
MultiVehicleManager
1.0
/// Qml for MainWindow
Item
{
...
...
@@ -40,15 +41,20 @@ Item {
QGCPalette
{
id
:
__qgcPal
;
colorGroupEnabled
:
true
}
property
real
tbHeight
:
ScreenTools
.
isMobile
?
(
ScreenTools
.
isTinyScreen
?
(
mainWindow
.
width
*
0.0666
)
:
(
mainWindow
.
width
*
0.05
))
:
ScreenTools
.
defaultFontPixelSize
*
4
property
int
tbCellHeight
:
tbHeight
*
0.75
property
real
tbSpacing
:
ScreenTools
.
isMobile
?
width
*
0.00824
:
9.54
property
real
tbButtonWidth
:
tbCellHeight
*
1.3
property
real
availableHeight
:
height
-
tbHeight
property
real
menuButtonWidth
:
(
tbButtonWidth
*
2
)
+
(
tbSpacing
*
4
)
+
1
property
real
tbHeight
:
ScreenTools
.
isMobile
?
(
ScreenTools
.
isTinyScreen
?
(
mainWindow
.
width
*
0.0666
)
:
(
mainWindow
.
width
*
0.05
))
:
ScreenTools
.
defaultFontPixelSize
*
4
property
int
tbCellHeight
:
tbHeight
*
0.75
property
real
tbSpacing
:
ScreenTools
.
isMobile
?
width
*
0.00824
:
9.54
property
real
tbButtonWidth
:
tbCellHeight
*
1.3
property
real
availableHeight
:
height
-
tbHeight
property
real
menuButtonWidth
:
(
tbButtonWidth
*
2
)
+
(
tbSpacing
*
4
)
+
1
property
var
defaultPosition
:
QtPositioning
.
coordinate
(
37.803784
,
-
122.462276
)
property
var
tabletPosition
:
defaultPosition
property
var
defaultPosition
:
QtPositioning
.
coordinate
(
37.803784
,
-
122.462276
)
property
var
tabletPosition
:
defaultPosition
property
var
currentPopUp
:
null
property
real
currentCenterX
:
0
property
var
activeVehicle
:
multiVehicleManager
.
activeVehicle
property
string
formatedMessage
:
activeVehicle
?
activeVehicle
.
formatedMessage
:
""
Connections
{
...
...
@@ -129,6 +135,42 @@ Item {
flightView
.
interactive
=
enabled
}
onFormatedMessageChanged
:
{
if
(
messageArea
.
visible
)
{
messageText
.
append
(
formatedMessage
)
//-- Hack to scroll down
messageFlick
.
flick
(
0
,
-
500
)
}
}
function
showMessageArea
()
{
if
(
currentPopUp
)
{
currentPopUp
.
close
()
}
if
(
multiVehicleManager
.
activeVehicleAvailable
)
{
messageText
.
text
=
activeVehicle
.
formatedMessages
//-- Hack to scroll to last message
for
(
var
i
=
0
;
i
<
activeVehicle
.
messageCount
;
i
++
)
messageFlick
.
flick
(
0
,
-
5000
)
activeVehicle
.
resetMessages
()
}
else
{
messageText
.
text
=
"
No Messages
"
}
currentPopUp
=
messageArea
messageArea
.
visible
=
true
mainWindow
.
setMapInteractive
(
false
)
}
function
showPopUp
(
dropItem
,
centerX
)
{
if
(
currentPopUp
)
{
currentPopUp
.
close
()
}
indicatorDropdown
.
centerX
=
centerX
indicatorDropdown
.
sourceComponent
=
dropItem
indicatorDropdown
.
visible
=
true
currentPopUp
=
indicatorDropdown
}
//-- Left Settings Menu
Loader
{
id
:
leftPanel
...
...
@@ -176,4 +218,83 @@ Item {
visible
:
false
}
//-------------------------------------------------------------------------
//-- Dismiss Pop Up Messages
MouseArea
{
visible
:
currentPopUp
!=
null
enabled
:
currentPopUp
!=
null
anchors.fill
:
parent
onClicked
:
{
currentPopUp
.
close
()
}
}
//-------------------------------------------------------------------------
//-- Indicator Drop Down Info
Loader
{
id
:
indicatorDropdown
visible
:
false
property
real
centerX
:
0
function
close
()
{
sourceComponent
=
null
mainWindow
.
currentPopUp
=
null
}
}
//-------------------------------------------------------------------------
//-- System Message Area
Rectangle
{
id
:
messageArea
function
close
()
{
currentPopUp
=
null
messageText
.
text
=
""
mainWindow
.
setMapInteractive
(
true
)
messageArea
.
visible
=
false
}
width
:
mainWindow
.
width
*
0.5
height
:
mainWindow
.
height
*
0.5
color
:
Qt
.
rgba
(
0
,
0
,
0
,
0.75
)
visible
:
false
radius
:
ScreenTools
.
defaultFontPixelHeight
*
0.5
anchors.horizontalCenter
:
parent
.
horizontalCenter
anchors.top
:
parent
.
top
anchors.topMargin
:
tbHeight
+
ScreenTools
.
defaultFontPixelHeight
Flickable
{
id
:
messageFlick
anchors.margins
:
ScreenTools
.
defaultFontPixelHeight
anchors.fill
:
parent
contentHeight
:
messageText
.
height
contentWidth
:
messageText
.
width
boundsBehavior
:
Flickable
.
StopAtBounds
pixelAligned
:
true
clip
:
true
TextEdit
{
id
:
messageText
readOnly
:
true
textFormat
:
TextEdit
.
RichText
color
:
"
white
"
}
}
//-- Dismiss System Message
Image
{
anchors.margins
:
ScreenTools
.
defaultFontPixelHeight
anchors.top
:
parent
.
top
anchors.right
:
parent
.
right
width
:
ScreenTools
.
defaultFontPixelHeight
*
1.5
height
:
ScreenTools
.
defaultFontPixelHeight
*
1.5
source
:
"
/res/XDelete.svg
"
fillMode
:
Image
.
PreserveAspectFit
mipmap
:
true
smooth
:
true
MouseArea
{
anchors.fill
:
parent
onClicked
:
{
messageArea
.
close
()
}
}
}
}
}
src/ui/toolbar/MainToolBar.qml
View file @
07f790aa
...
...
@@ -28,12 +28,12 @@ This file is part of the QGROUNDCONTROL project
*/
import
QtQuick
2.5
import
QtQuick
.
Layouts
1.2
import
QtQuick
.
Controls
1.2
import
QtQuick
.
Controls
.
Styles
1.2
import
QGroundControl
1.0
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
FactControls
1.0
import
QGroundControl
.
Palette
1.0
import
QGroundControl
.
MultiVehicleManager
1.0
import
QGroundControl
.
ScreenTools
1.0
...
...
@@ -51,8 +51,6 @@ Rectangle {
property
bool
isBackgroundDark
:
true
property
bool
opaqueBackground
:
false
property
string
formatedMessage
:
activeVehicle
?
activeVehicle
.
formatedMessage
:
""
/*
Dev System (Mac OS)
...
...
@@ -149,28 +147,6 @@ Rectangle {
MainToolBarController
{
id
:
_controller
}
onFormatedMessageChanged
:
{
if
(
messageArea
.
visible
)
{
messageText
.
append
(
formatedMessage
)
//-- Hack to scroll down
messageFlick
.
flick
(
0
,
-
500
)
}
}
function
showMessageArea
()
{
if
(
multiVehicleManager
.
activeVehicleAvailable
)
{
messageText
.
text
=
activeVehicle
.
formatedMessages
//-- Hack to scroll to last message
for
(
var
i
=
0
;
i
<
activeVehicle
.
messageCount
;
i
++
)
messageFlick
.
flick
(
0
,
-
5000
)
activeVehicle
.
resetMessages
()
}
else
{
messageText
.
text
=
"
No Messages
"
}
messageArea
.
visible
=
true
mainWindow
.
setMapInteractive
(
false
)
}
function
showToolbarMessage
(
message
)
{
toolBarMessage
.
text
=
message
toolBarMessageArea
.
visible
=
true
...
...
@@ -180,6 +156,21 @@ Rectangle {
return
(
multiVehicleManager
.
activeVehicleAvailable
&&
activeVehicle
.
heartbeatTimeout
===
0
);
}
function
getBatteryColor
()
{
if
(
activeVehicle
)
{
if
(
activeVehicle
.
batteryPercent
>
75
)
{
return
colorGreen
}
if
(
activeVehicle
.
batteryPercent
>
50
)
{
return
colorOrange
}
if
(
activeVehicle
.
batteryPercent
>
0.1
)
{
return
colorRed
}
}
return
colorGrey
}
Component.onCompleted
:
{
//-- TODO: Get this from the actual state
flyButton
.
checked
=
true
...
...
@@ -192,6 +183,113 @@ Rectangle {
onShowSetupView
:{
setupButton
.
checked
=
true
}
}
//---------------------------------------------
// Battery Info
Component
{
id
:
batteryInfo
Rectangle
{
color
:
Qt
.
rgba
(
0
,
0
,
0
,
0.75
)
width
:
battCol
.
width
+
ScreenTools
.
defaultFontPixelWidth
*
3
height
:
battCol
.
height
+
ScreenTools
.
defaultFontPixelHeight
*
2
radius
:
ScreenTools
.
defaultFontPixelHeight
*
0.5
Column
{
id
:
battCol
spacing
:
ScreenTools
.
defaultFontPixelHeight
*
0.5
width
:
Math
.
max
(
battGrid
.
width
,
battLabel
.
width
)
anchors.margins
:
ScreenTools
.
defaultFontPixelHeight
anchors.centerIn
:
parent
QGCLabel
{
id
:
battLabel
text
:
(
activeVehicle
&&
(
activeVehicle
.
batteryVoltage
>
0
))
?
"
Battery Status
"
:
"
Battery Data Unavailable
"
font.weight
:
Font
.
DemiBold
anchors.horizontalCenter
:
parent
.
horizontalCenter
}
GridLayout
{
id
:
battGrid
visible
:
(
activeVehicle
&&
(
activeVehicle
.
batteryVoltage
>
0
))
anchors.margins
:
ScreenTools
.
defaultFontPixelHeight
columnSpacing
:
ScreenTools
.
defaultFontPixelWidth
anchors.horizontalCenter
:
parent
.
horizontalCenter
columns
:
2
QGCLabel
{
text
:
"
Voltage:
"
}
QGCLabel
{
text
:
activeVehicle
?
(
activeVehicle
.
batteryVoltage
.
toFixed
(
1
)
+
"
V
"
)
:
"
N/A
"
color
:
getBatteryColor
()
}
// TODO: What "controller" provides "Facts"?
/*
QGCLabel {
text: "Cell Voltage:"
}
QGCLabel {
text: (activeVehicle.batteryVoltage / controller.getParameterFact(-1, "BAT_N_CELLS").value) + "V"
color: getBatteryColor()
}
*/
QGCLabel
{
text
:
"
Accumulated Consumption:
"
}
QGCLabel
{
text
:
activeVehicle
?
(
activeVehicle
.
batteryConsumed
+
"
mA
"
)
:
"
N/A
"
color
:
getBatteryColor
()
}
}
}
Component.onCompleted
:
{
var
pos
=
mapFromItem
(
toolBar
,
centerX
-
(
width
/
2
),
toolBar
.
height
)
x
=
pos
.
x
y
=
pos
.
y
+
ScreenTools
.
defaultFontPixelHeight
}
}
}
//---------------------------------------------
// RC RSSI Info
Component
{
id
:
rcRSSIInfo
Rectangle
{
color
:
Qt
.
rgba
(
0
,
0
,
0
,
0.75
)
width
:
battCol
.
width
+
ScreenTools
.
defaultFontPixelWidth
*
3
height
:
battCol
.
height
+
ScreenTools
.
defaultFontPixelHeight
*
2
radius
:
ScreenTools
.
defaultFontPixelHeight
*
0.5
Column
{
id
:
battCol
spacing
:
ScreenTools
.
defaultFontPixelHeight
*
0.5
width
:
Math
.
max
(
battGrid
.
width
,
rssiLabel
.
width
)
anchors.margins
:
ScreenTools
.
defaultFontPixelHeight
anchors.centerIn
:
parent
QGCLabel
{
id
:
rssiLabel
text
:
"
RC RSSI Status
"
font.weight
:
Font
.
DemiBold
anchors.horizontalCenter
:
parent
.
horizontalCenter
}
GridLayout
{
id
:
battGrid
anchors.margins
:
ScreenTools
.
defaultFontPixelHeight
columnSpacing
:
ScreenTools
.
defaultFontPixelWidth
anchors.horizontalCenter
:
parent
.
horizontalCenter
columns
:
2
QGCLabel
{
text
:
"
RSSI:
"
}
QGCLabel
{
text
:
activeVehicle
?
(
activeVehicle
.
rcRSSI
+
"
%
"
)
:
0
}
}
}
Component.onCompleted
:
{
var
pos
=
mapFromItem
(
toolBar
,
centerX
-
(
width
/
2
),
toolBar
.
height
)
x
=
pos
.
x
y
=
pos
.
y
+
ScreenTools
.
defaultFontPixelHeight
}
}
}
//---------------------------------------------
// Toolbar Row
Row
{
id
:
viewRow
height
:
mainWindow
.
tbCellHeight
...
...
@@ -287,55 +385,6 @@ Rectangle {
}
}
//-------------------------------------------------------------------------
//-- System Message Area
Rectangle
{
id
:
messageArea
width
:
mainWindow
.
width
*
0.5
height
:
mainWindow
.
height
*
0.5
anchors.top
:
parent
.
bottom
anchors.horizontalCenter
:
parent
.
horizontalCenter
color
:
Qt
.
rgba
(
0
,
0
,
0
,
0.75
)
visible
:
false
radius
:
ScreenTools
.
defaultFontPixelHeight
*
0.5
Flickable
{
id
:
messageFlick
anchors.margins
:
ScreenTools
.
defaultFontPixelHeight
anchors.fill
:
parent
contentHeight
:
messageText
.
height
contentWidth
:
messageText
.
width
boundsBehavior
:
Flickable
.
StopAtBounds
pixelAligned
:
true
clip
:
true
TextEdit
{
id
:
messageText
readOnly
:
true
textFormat
:
TextEdit
.
RichText
color
:
"
white
"
}
}
//-- Dismiss System Message
Image
{
anchors.margins
:
ScreenTools
.
defaultFontPixelHeight
anchors.top
:
parent
.
top
anchors.right
:
parent
.
right
width
:
ScreenTools
.
defaultFontPixelHeight
*
1.5
height
:
ScreenTools
.
defaultFontPixelHeight
*
1.5
source
:
"
/res/XDelete.svg
"
fillMode
:
Image
.
PreserveAspectFit
mipmap
:
true
smooth
:
true
MouseArea
{
anchors.fill
:
parent
onClicked
:
{
messageText
.
text
=
""
messageArea
.
visible
=
false
mainWindow
.
setMapInteractive
(
true
)
}
}
}
}
QGCLabel
{
id
:
connectionStatus
visible
:
(
_controller
.
connectionCount
>
0
&&
multiVehicleManager
.
activeVehicleAvailable
&&
activeVehicle
.
heartbeatTimeout
!=
0
)
...
...
src/ui/toolbar/MainToolBarIndicators.qml
View file @
07f790aa
This diff is collapsed.
Click to expand it.
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