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
e95c0951
Commit
e95c0951
authored
Apr 11, 2019
by
Gus Grubba
Browse files
Refactor message system and fix typos/errors
parent
e55deea4
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/Microhard/MicrohardSettings.qml
View file @
e95c0951
...
...
@@ -27,7 +27,7 @@ import QGroundControl.Palette 1.0
import
QGroundControl
.
ScreenTools
1.0
import
QGroundControl
.
SettingsManager
1.0
Item
{
Rectangle
{
id
:
_root
color
:
qgcPal
.
window
anchors.fill
:
parent
...
...
src/QmlControls/AppMessages.qml
View file @
e95c0951
...
...
@@ -128,7 +128,6 @@ Item {
fileExtension
:
qsTr
(
"
txt
"
)
selectExisting
:
false
title
:
qsTr
(
"
Select log save file
"
)
root
:
_root
onAcceptedForSave
:
{
debugMessageModel
.
writeMessages
(
file
);
visible
=
false
;
...
...
src/Taisync/TaisyncSettings.qml
View file @
e95c0951
...
...
@@ -27,7 +27,7 @@ import QGroundControl.Palette 1.0
import
QGroundControl
.
ScreenTools
1.0
import
QGroundControl
.
SettingsManager
1.0
Item
{
Rectangle
{
id
:
_root
color
:
qgcPal
.
window
anchors.fill
:
parent
...
...
src/ui/MainQmlWindow.qml
View file @
e95c0951
...
...
@@ -429,7 +429,7 @@ ApplicationWindow {
}
//-------------------------------------------------------------------------
//--
System
Messages
//--
Vehicle
Messages
function
formatMessage
(
message
)
{
message
=
message
.
replace
(
new
RegExp
(
"
<#E>
"
,
"
g
"
),
"
color:
"
+
qgcPal
.
warningText
+
"
; font:
"
+
(
ScreenTools
.
defaultFontPointSize
.
toFixed
(
0
)
-
1
)
+
"
pt monospace;
"
);
...
...
@@ -438,8 +438,8 @@ ApplicationWindow {
return
message
;
}
function
showMessage
Area
()
{
if
(
!
m
essageArea
.
visible
)
{
function
show
Vehicle
Message
s
()
{
if
(
!
vehicleM
essageArea
.
visible
)
{
if
(
QGroundControl
.
multiVehicleManager
.
activeVehicleAvailable
)
{
messageText
.
text
=
formatMessage
(
activeVehicle
.
formatedMessages
)
//-- Hack to scroll to last message
...
...
@@ -449,12 +449,12 @@ ApplicationWindow {
}
else
{
messageText
.
text
=
qsTr
(
"
No Messages
"
)
}
m
essageArea
.
open
()
vehicleM
essageArea
.
open
()
}
}
onFormatedMessageChanged
:
{
if
(
m
essageArea
.
visible
)
{
if
(
vehicleM
essageArea
.
visible
)
{
messageText
.
append
(
formatMessage
(
formatedMessage
))
//-- Hack to scroll down
messageFlick
.
flick
(
0
,
-
500
)
...
...
@@ -462,7 +462,7 @@ ApplicationWindow {
}
Popup
{
id
:
m
essageArea
id
:
vehicleM
essageArea
width
:
mainWindow
.
width
*
0.666
height
:
mainWindow
.
height
*
0.666
modal
:
true
...
...
@@ -490,7 +490,7 @@ ApplicationWindow {
color
:
qgcPal
.
text
}
}
//-- Dismiss
System
Message
//-- Dismiss
Vehicle
Message
s
QGCColoredImage
{
anchors.margins
:
ScreenTools
.
defaultFontPixelHeight
*
0.5
anchors.top
:
parent
.
top
...
...
@@ -507,7 +507,7 @@ ApplicationWindow {
anchors.fill
:
parent
anchors.margins
:
ScreenTools
.
isMobile
?
-
ScreenTools
.
defaultFontPixelHeight
:
0
onClicked
:
{
m
essageArea
.
close
()
vehicleM
essageArea
.
close
()
}
}
}
...
...
@@ -529,7 +529,7 @@ ApplicationWindow {
onClicked
:
{
if
(
QGroundControl
.
multiVehicleManager
.
activeVehicleAvailable
)
{
activeVehicle
.
clearMessages
();
m
essageArea
.
close
()
vehicleM
essageArea
.
close
()
}
}
}
...
...
@@ -537,17 +537,18 @@ ApplicationWindow {
}
//-------------------------------------------------------------------------
//--
Critical
System Messages
//-- System Messages
property
var
_messageQueue
:
[]
property
string
_
critical
Message
:
""
property
string
_
system
Message
:
""
function
showMessage
(
message
)
{
if
(
criticalMmessageArea
.
visible
||
QGroundControl
.
videoManager
.
fullScreen
)
{
vehicleMessageArea
.
close
()
if
(
systemMessageArea
.
visible
||
QGroundControl
.
videoManager
.
fullScreen
)
{
_messageQueue
.
push
(
message
)
}
else
{
_
critical
Message
=
message
criticalMm
essageArea
.
open
()
_
system
Message
=
message
systemM
essageArea
.
open
()
}
}
...
...
@@ -560,11 +561,11 @@ ApplicationWindow {
}
Popup
{
id
:
criticalMm
essageArea
id
:
systemM
essageArea
y
:
ScreenTools
.
defaultFontPixelHeight
x
:
(
mainWindow
.
width
-
width
)
*
0.5
width
:
mainWindow
.
width
*
0.55
height
:
Math
.
min
(
criticalMessageText
.
height
+
(
ScreenTools
.
defaultFontPixelHeight
*
2
),
ScreenTools
.
defaultFontPixelHeight
*
6
)
height
:
ScreenTools
.
defaultFontPixelHeight
*
6
modal
:
false
focus
:
true
closePolicy
:
Popup
.
CloseOnEscape
...
...
@@ -578,40 +579,39 @@ ApplicationWindow {
}
onOpened
:
{
console
.
log
(
'
Critical Message:
'
+
mainWindow
.
_criticalMessage
)
criticalMessageText
.
text
=
mainWindow
.
_criticalMessage
systemMessageText
.
text
=
mainWindow
.
_systemMessage
}
onClosed
:
{
//-- Are there messages in the waiting queue?
if
(
mainWindow
.
_messageQueue
.
length
)
{
mainWindow
.
_
critical
Message
=
""
mainWindow
.
_
system
Message
=
""
//-- Show all messages in queue
for
(
var
i
=
0
;
i
<
mainWindow
.
_messageQueue
.
length
;
i
++
)
{
var
text
=
mainWindow
.
_messageQueue
[
i
]
mainWindow
.
_
critical
Message
.
append
(
text
)
mainWindow
.
_
system
Message
.
append
(
text
)
}
//-- Clear it
mainWindow
.
_messageQueue
=
[]
criticalMm
essageArea
.
open
()
systemM
essageArea
.
open
()
}
else
{
mainWindow
.
_
critical
Message
=
""
mainWindow
.
_
system
Message
=
""
}
}
Flickable
{
id
:
critical
MessageFlick
id
:
system
MessageFlick
anchors.margins
:
ScreenTools
.
defaultFontPixelHeight
anchors.fill
:
parent
contentHeight
:
critical
MessageText
.
height
contentWidth
:
critical
MessageText
.
width
contentHeight
:
system
MessageText
.
height
contentWidth
:
system
MessageText
.
width
boundsBehavior
:
Flickable
.
StopAtBounds
pixelAligned
:
true
clip
:
true
TextEdit
{
id
:
critical
MessageText
width
:
criticalMm
essageArea
.
width
-
critical
Close
.
width
-
(
ScreenTools
.
defaultFontPixelHeight
*
2
)
anchors.
left
:
parent
.
left
id
:
system
MessageText
width
:
systemM
essageArea
.
width
-
systemMessage
Close
.
width
-
(
ScreenTools
.
defaultFontPixelHeight
*
2
)
anchors.
centerIn
:
parent
readOnly
:
true
textFormat
:
TextEdit
.
RichText
font.pointSize
:
ScreenTools
.
defaultFontPointSize
...
...
@@ -623,7 +623,7 @@ ApplicationWindow {
//-- Dismiss Critical Message
QGCColoredImage
{
id
:
critical
Close
id
:
systemMessage
Close
anchors.margins
:
ScreenTools
.
defaultFontPixelHeight
*
0.5
anchors.top
:
parent
.
top
anchors.right
:
parent
.
right
...
...
@@ -637,7 +637,7 @@ ApplicationWindow {
anchors.fill
:
parent
anchors.margins
:
ScreenTools
.
isMobile
?
-
ScreenTools
.
defaultFontPixelHeight
:
0
onClicked
:
{
criticalMm
essageArea
.
close
()
systemM
essageArea
.
close
()
}
}
}
...
...
@@ -652,12 +652,12 @@ ApplicationWindow {
sourceSize.height
:
width
source
:
"
/res/ArrowDown.svg
"
fillMode
:
Image
.
PreserveAspectFit
visible
:
critical
MessageText
.
lineCount
>
5
visible
:
system
MessageText
.
lineCount
>
5
color
:
qgcPal
.
alertText
MouseArea
{
anchors.fill
:
parent
onClicked
:
{
critical
MessageFlick
.
flick
(
0
,
-
500
)
system
MessageFlick
.
flick
(
0
,
-
500
)
}
}
}
...
...
src/ui/preferences/GeneralSettings.qml
View file @
e95c0951
...
...
@@ -24,7 +24,7 @@ import QGroundControl.Palette 1.0
import
QGroundControl
.
Controllers
1.0
import
QGroundControl
.
SettingsManager
1.0
Item
{
Rectangle
{
id
:
_root
color
:
qgcPal
.
window
anchors.fill
:
parent
...
...
src/ui/toolbar/MessageIndicator.qml
View file @
e95c0951
...
...
@@ -67,6 +67,6 @@ Item {
MouseArea
{
anchors.fill
:
parent
onClicked
:
mainWindow
.
showMessage
Area
()
onClicked
:
mainWindow
.
show
Vehicle
Message
s
()
}
}
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