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
5f34008e
Commit
5f34008e
authored
Sep 18, 2011
by
lm
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improved toolbar updates
parent
2f608734
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
9 deletions
+43
-9
QGCToolBar.cc
src/ui/QGCToolBar.cc
+31
-9
QGCToolBar.h
src/ui/QGCToolBar.h
+12
-0
No files found.
src/ui/QGCToolBar.cc
View file @
5f34008e
...
...
@@ -32,7 +32,12 @@ QGCToolBar::QGCToolBar(QWidget *parent) :
toggleLoggingAction
(
NULL
),
logReplayAction
(
NULL
),
mav
(
NULL
),
player
(
NULL
)
player
(
NULL
),
changed
(
true
),
batteryPercent
(
0
),
batteryVoltage
(
0
),
wpId
(
0
),
wpDistance
(
0
)
{
setObjectName
(
"QGC_TOOLBAR"
);
...
...
@@ -87,6 +92,9 @@ QGCToolBar::QGCToolBar(QWidget *parent) :
setActiveUAS
(
UASManager
::
instance
()
->
getActiveUAS
());
connect
(
UASManager
::
instance
(),
SIGNAL
(
activeUASSet
(
UASInterface
*
)),
this
,
SLOT
(
setActiveUAS
(
UASInterface
*
)));
connect
(
&
updateViewTimer
,
SIGNAL
(
timeout
()),
this
,
SLOT
(
updateView
()));
updateViewTimer
.
start
(
2000
);
}
void
QGCToolBar
::
setLogPlayer
(
QGCMAVLinkLogPlayer
*
player
)
...
...
@@ -239,41 +247,55 @@ void QGCToolBar::createCustomWidgets()
}
void
QGCToolBar
::
updateView
()
{
if
(
!
changed
)
return
;
toolBarDistLabel
->
setText
(
tr
(
"%1 m"
).
arg
(
wpDistance
,
6
,
'f'
,
2
,
'0'
));
toolBarWpLabel
->
setText
(
tr
(
"WP%1"
).
arg
(
wpId
));
toolBarBatteryBar
->
setValue
(
batteryPercent
);
toolBarBatteryVoltageLabel
->
setText
(
tr
(
"%1 V"
).
arg
(
batteryVoltage
,
4
,
'f'
,
1
,
' '
));
toolBarStateLabel
->
setText
(
tr
(
"%1"
).
arg
(
state
));
toolBarModeLabel
->
setText
(
tr
(
"%1"
).
arg
(
mode
));
toolBarNameLabel
->
setText
(
systemName
);
toolBarMessageLabel
->
setText
(
lastSystemMessage
);
}
void
QGCToolBar
::
updateWaypointDistance
(
double
distance
)
{
toolBarDistLabel
->
setText
(
tr
(
"%1 m"
).
arg
(
distance
,
6
,
'f'
,
2
,
'0'
));
if
(
wpDistance
!=
distance
)
changed
=
true
;
wpDistance
=
distance
;
}
void
QGCToolBar
::
updateCurrentWaypoint
(
quint16
id
)
{
toolBarWpLabel
->
setText
(
tr
(
"WP%1"
).
arg
(
id
))
;
wpId
=
id
;
}
void
QGCToolBar
::
updateBatteryRemaining
(
UASInterface
*
uas
,
double
voltage
,
double
percent
,
int
seconds
)
{
Q_UNUSED
(
uas
);
Q_UNUSED
(
seconds
);
toolBarBatteryBar
->
setValue
(
percent
)
;
toolBarBatteryVoltageLabel
->
setText
(
tr
(
"%1 V"
).
arg
(
voltage
,
4
,
'f'
,
1
,
' '
))
;
batteryPercent
=
percent
;
batteryVoltage
=
voltage
;
}
void
QGCToolBar
::
updateState
(
UASInterface
*
system
,
QString
name
,
QString
description
)
{
Q_UNUSED
(
system
);
Q_UNUSED
(
description
);
toolBarStateLabel
->
setText
(
tr
(
"%1"
).
arg
(
name
))
;
state
=
name
;
}
void
QGCToolBar
::
updateMode
(
int
system
,
QString
name
,
QString
description
)
{
Q_UNUSED
(
system
);
Q_UNUSED
(
description
);
toolBarModeLabel
->
setText
(
tr
(
"%1"
).
arg
(
name
))
;
mode
=
state
;
}
void
QGCToolBar
::
updateName
(
const
QString
&
name
)
{
toolBarNameLabel
->
setText
(
name
)
;
systemName
=
name
;
}
/**
...
...
@@ -317,7 +339,7 @@ void QGCToolBar::receiveTextMessage(int uasid, int componentid, int severity, QS
Q_UNUSED
(
uasid
);
Q_UNUSED
(
componentid
);
Q_UNUSED
(
severity
);
toolBarMessageLabel
->
setText
(
text
)
;
lastSystemMessage
=
text
;
}
QGCToolBar
::~
QGCToolBar
()
...
...
src/ui/QGCToolBar.h
View file @
5f34008e
...
...
@@ -66,6 +66,8 @@ public slots:
void
updateCurrentWaypoint
(
quint16
id
);
/** @brief Update distance to current waypoint */
void
updateWaypointDistance
(
double
distance
);
/** @brief Repaint widgets */
void
updateView
();
protected:
void
createCustomWidgets
();
...
...
@@ -84,6 +86,16 @@ protected:
QProgressBar
*
toolBarBatteryBar
;
QLabel
*
toolBarBatteryVoltageLabel
;
QGCMAVLinkLogPlayer
*
player
;
bool
changed
;
float
batteryPercent
;
float
batteryVoltage
;
int
wpId
;
double
wpDistance
;
QString
state
;
QString
mode
;
QString
systemName
;
QString
lastSystemMessage
;
QTimer
updateViewTimer
;
};
#endif // QGCTOOLBAR_H
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