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
5903cc8d
Commit
5903cc8d
authored
Apr 25, 2016
by
Lorenz Meier
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3273 from mavlink/text_cleanup
Clean UAS text handling
parents
696f9e32
97b2274d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
3 deletions
+23
-3
UASMessageHandler.cc
src/uas/UASMessageHandler.cc
+21
-3
UASMessageHandler.h
src/uas/UASMessageHandler.h
+2
-0
No files found.
src/uas/UASMessageHandler.cc
View file @
5903cc8d
...
...
@@ -55,6 +55,8 @@ bool UASMessage::severityIsError()
UASMessageHandler
::
UASMessageHandler
(
QGCApplication
*
app
)
:
QGCTool
(
app
)
,
_activeUAS
(
NULL
)
,
_activeComponent
(
-
1
)
,
_multiComp
(
false
)
,
_errorCount
(
0
)
,
_errorCountTotal
(
0
)
,
_warningCount
(
0
)
...
...
@@ -127,6 +129,14 @@ void UASMessageHandler::handleTextMessage(int, int compId, int severity, QString
_mutex
.
lock
();
if
(
_activeComponent
<
0
)
{
_activeComponent
=
compId
;
}
if
(
compId
!=
_activeComponent
)
{
_multiComp
=
true
;
}
// So first determine the styling based on the severity.
QString
style
;
switch
(
severity
)
...
...
@@ -186,14 +196,22 @@ void UASMessageHandler::handleTextMessage(int, int compId, int severity, QString
// Finally preppend the properly-styled text with a timestamp.
QString
dateString
=
QDateTime
::
currentDateTime
().
toString
(
"hh:mm:ss.zzz"
);
UASMessage
*
message
=
new
UASMessage
(
compId
,
severity
,
text
);
message
->
_setFormatedText
(
QString
(
"<p style=
\"
color:#e0e0f0
\"
>[%2 - COMP:%3]<font style=
\"
%1
\"
>%4 %5</font></p>"
).
arg
(
style
).
arg
(
dateString
).
arg
(
compId
).
arg
(
severityText
).
arg
(
text
));
_messages
.
append
(
message
);
int
count
=
_messages
.
count
();
QString
compString
(
""
);
if
(
_multiComp
)
{
compString
=
QString
(
" COMP:%1"
).
arg
(
compId
);
}
message
->
_setFormatedText
(
QString
(
"<p><font style=
\"
%1
\"
>[%2%3]%4 %5</font></p>"
).
arg
(
style
).
arg
(
dateString
).
arg
(
compString
).
arg
(
severityText
).
arg
(
text
));
if
(
message
->
severityIsError
())
{
_latestError
=
severityText
+
" "
+
text
;
}
_mutex
.
unlock
();
emit
textMessageReceived
(
message
);
_messages
.
append
(
message
);
int
count
=
_messages
.
count
();
emit
textMessageCountChanged
(
count
);
if
(
_showErrorsInToolbar
&&
message
->
severityIsError
())
{
...
...
src/uas/UASMessageHandler.h
View file @
5903cc8d
...
...
@@ -158,6 +158,8 @@ private slots:
private:
UASInterface
*
_activeUAS
;
int
_activeComponent
;
bool
_multiComp
;
QVector
<
UASMessage
*>
_messages
;
QMutex
_mutex
;
int
_errorCount
;
...
...
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