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
50d02ed7
Commit
50d02ed7
authored
Aug 24, 2020
by
DonLakeFlyer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parent
f3404af4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
94 additions
and
9 deletions
+94
-9
MessageIndicator.qml
src/ui/toolbar/MessageIndicator.qml
+94
-9
No files found.
src/ui/toolbar/MessageIndicator.qml
View file @
50d02ed7
...
@@ -21,26 +21,28 @@ import QGroundControl.Palette 1.0
...
@@ -21,26 +21,28 @@ import QGroundControl.Palette 1.0
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
//-- Message Indicator
//-- Message Indicator
Item
{
Item
{
id
:
_root
width
:
height
width
:
height
anchors.top
:
parent
.
top
anchors.top
:
parent
.
top
anchors.bottom
:
parent
.
bottom
anchors.bottom
:
parent
.
bottom
property
bool
showIndicator
:
true
property
bool
showIndicator
:
true
property
bool
_isMessageImportant
:
activeVehicle
?
!
activeVehicle
.
messageTypeNormal
&&
!
activeVehicle
.
messageTypeNone
:
false
property
var
_activeVehicle
:
QGroundControl
.
multiVehicleManager
.
activeVehicle
property
bool
_isMessageImportant
:
_activeVehicle
?
!
_activeVehicle
.
messageTypeNormal
&&
!
_activeVehicle
.
messageTypeNone
:
false
function
getMessageColor
()
{
function
getMessageColor
()
{
if
(
activeVehicle
)
{
if
(
_
activeVehicle
)
{
if
(
activeVehicle
.
messageTypeNone
)
if
(
_
activeVehicle
.
messageTypeNone
)
return
qgcPal
.
colorGrey
return
qgcPal
.
colorGrey
if
(
activeVehicle
.
messageTypeNormal
)
if
(
_
activeVehicle
.
messageTypeNormal
)
return
qgcPal
.
colorBlue
;
return
qgcPal
.
colorBlue
;
if
(
activeVehicle
.
messageTypeWarning
)
if
(
_
activeVehicle
.
messageTypeWarning
)
return
qgcPal
.
colorOrange
;
return
qgcPal
.
colorOrange
;
if
(
activeVehicle
.
messageTypeError
)
if
(
_
activeVehicle
.
messageTypeError
)
return
qgcPal
.
colorRed
;
return
qgcPal
.
colorRed
;
// Cannot be so make make it obnoxious to show error
// Cannot be so make make it obnoxious to show error
console
.
log
(
"
Invalid vehicle message type
"
)
console
.
warn
(
"
MessageIndicator.qml:getMessageColor Invalid vehicle message type
"
,
_activeVehicle
.
messageTypeNone
)
return
"
purple
"
;
return
"
purple
"
;
}
}
//-- It can only get here when closing (vehicle gone while window active)
//-- It can only get here when closing (vehicle gone while window active)
...
@@ -54,7 +56,7 @@ Item {
...
@@ -54,7 +56,7 @@ Item {
sourceSize.height
:
height
sourceSize.height
:
height
fillMode
:
Image
.
PreserveAspectFit
fillMode
:
Image
.
PreserveAspectFit
cache
:
false
cache
:
false
visible
:
activeVehicle
&&
activeVehicle
.
messageCount
>
0
&&
_isMessageImportant
visible
:
_activeVehicle
&&
_
activeVehicle
.
messageCount
>
0
&&
_isMessageImportant
}
}
QGCColoredImage
{
QGCColoredImage
{
...
@@ -68,6 +70,89 @@ Item {
...
@@ -68,6 +70,89 @@ Item {
MouseArea
{
MouseArea
{
anchors.fill
:
parent
anchors.fill
:
parent
onClicked
:
mainWindow
.
showVehicleMessages
()
onClicked
:
mainWindow
.
showIndicatorPopup
(
_root
,
vehicleMessagesPopup
)
}
Component
{
id
:
vehicleMessagesPopup
Rectangle
{
width
:
mainWindow
.
width
*
0.666
height
:
mainWindow
.
height
*
0.666
radius
:
ScreenTools
.
defaultFontPixelHeight
/
2
color
:
qgcPal
.
window
border.color
:
qgcPal
.
text
function
formatMessage
(
message
)
{
message
=
message
.
replace
(
new
RegExp
(
"
<#E>
"
,
"
g
"
),
"
color:
"
+
qgcPal
.
warningText
+
"
; font:
"
+
(
ScreenTools
.
defaultFontPointSize
.
toFixed
(
0
)
-
1
)
+
"
pt monospace;
"
);
message
=
message
.
replace
(
new
RegExp
(
"
<#I>
"
,
"
g
"
),
"
color:
"
+
qgcPal
.
warningText
+
"
; font:
"
+
(
ScreenTools
.
defaultFontPointSize
.
toFixed
(
0
)
-
1
)
+
"
pt monospace;
"
);
message
=
message
.
replace
(
new
RegExp
(
"
<#N>
"
,
"
g
"
),
"
color:
"
+
qgcPal
.
text
+
"
; font:
"
+
(
ScreenTools
.
defaultFontPointSize
.
toFixed
(
0
)
-
1
)
+
"
pt monospace;
"
);
return
message
;
}
Component.onCompleted
:
{
messageText
.
text
=
formatMessage
(
_activeVehicle
.
formattedMessages
)
//-- Hack to scroll to last message
for
(
var
i
=
0
;
i
<
_activeVehicle
.
messageCount
;
i
++
)
messageFlick
.
flick
(
0
,
-
5000
)
_activeVehicle
.
resetMessages
()
}
Connections
{
target
:
_activeVehicle
onNewFormattedMessage
:{
messageText
.
append
(
formatMessage
(
formattedMessage
))
//-- Hack to scroll down
messageFlick
.
flick
(
0
,
-
500
)
}
}
QGCLabel
{
anchors.centerIn
:
parent
text
:
qsTr
(
"
No Messages
"
)
visible
:
messageText
.
length
===
0
}
//-- Clear Messages
QGCColoredImage
{
anchors.bottom
:
parent
.
bottom
anchors.right
:
parent
.
right
anchors.margins
:
ScreenTools
.
defaultFontPixelHeight
*
0.5
height
:
ScreenTools
.
isMobile
?
ScreenTools
.
defaultFontPixelHeight
*
1.5
:
ScreenTools
.
defaultFontPixelHeight
width
:
height
sourceSize.height
:
height
source
:
"
/res/TrashDelete.svg
"
fillMode
:
Image
.
PreserveAspectFit
mipmap
:
true
smooth
:
true
color
:
qgcPal
.
text
visible
:
messageText
.
length
!==
0
MouseArea
{
anchors.fill
:
parent
onClicked
:
{
if
(
_activeVehicle
)
{
_activeVehicle
.
clearMessages
()
mainWindow
.
hideIndicatorPopup
()
}
}
}
}
QGCFlickable
{
id
:
messageFlick
anchors.margins
:
ScreenTools
.
defaultFontPixelHeight
anchors.fill
:
parent
contentHeight
:
messageText
.
height
contentWidth
:
messageText
.
width
pixelAligned
:
true
TextEdit
{
id
:
messageText
readOnly
:
true
textFormat
:
TextEdit
.
RichText
color
:
qgcPal
.
text
}
}
}
}
}
}
}
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