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
fd70e34c
Commit
fd70e34c
authored
9 years ago
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move Analyze view to widget
parent
aa9f5591
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
34 additions
and
195 deletions
+34
-195
MainWindowTest.cc
src/qgcunittest/MainWindowTest.cc
+0
-2
MainWindow.cc
src/ui/MainWindow.cc
+4
-47
MainWindow.h
src/ui/MainWindow.h
+2
-6
MainWindow.ui
src/ui/MainWindow.ui
+1
-12
MultiVehicleDockWidget.cc
src/ui/MultiVehicleDockWidget.cc
+4
-1
Linecharts.cc
src/ui/linechart/Linecharts.cc
+14
-86
Linecharts.h
src/ui/linechart/Linecharts.h
+8
-16
MainToolBar.cc
src/ui/toolbar/MainToolBar.cc
+1
-10
MainToolBar.h
src/ui/toolbar/MainToolBar.h
+0
-1
MainToolBar.qml
src/ui/toolbar/MainToolBar.qml
+0
-14
No files found.
src/qgcunittest/MainWindowTest.cc
View file @
fd70e34c
...
...
@@ -84,8 +84,6 @@ void MainWindowTest::_connectWindowClose_test(MAV_AUTOPILOT autopilot)
QTest
::
qWait
(
200
);
_mainToolBar
->
onFlyView
();
QTest
::
qWait
(
200
);
_mainToolBar
->
onAnalyzeView
();
QTest
::
qWait
(
200
);
// On MainWindow close we should get a message box telling the user to disconnect first. Cancel should do nothing.
setExpectedMessageBox
(
QGCMessageBox
::
Cancel
);
...
...
This diff is collapsed.
Click to expand it.
src/ui/MainWindow.cc
View file @
fd70e34c
...
...
@@ -95,6 +95,7 @@ const char* MainWindow::_uasStatusDetailsDockWidgetName = "Status Details";
const
char
*
MainWindow
::
_pfdDockWidgetName
=
"Primary Flight Display"
;
const
char
*
MainWindow
::
_uasInfoViewDockWidgetName
=
"Info View"
;
const
char
*
MainWindow
::
_hilDockWidgetName
=
"HIL Config"
;
const
char
*
MainWindow
::
_analyzeDockWidgetName
=
"Analyze"
;
const
char
*
MainWindow
::
_visibleWidgetsKey
=
"VisibleWidgets"
;
#endif
...
...
@@ -277,13 +278,11 @@ MainWindow::MainWindow(QSplashScreen* splashScreen)
_ui
.
actionSetup
->
setShortcut
(
QApplication
::
translate
(
"MainWindow"
,
"Meta+1"
,
0
));
_ui
.
actionPlan
->
setShortcut
(
QApplication
::
translate
(
"MainWindow"
,
"Meta+2"
,
0
));
_ui
.
actionFlight
->
setShortcut
(
QApplication
::
translate
(
"MainWindow"
,
"Meta+3"
,
0
));
_ui
.
actionAnalyze
->
setShortcut
(
QApplication
::
translate
(
"MainWindow"
,
"Meta+4"
,
0
));
_ui
.
actionFullscreen
->
setShortcut
(
QApplication
::
translate
(
"MainWindow"
,
"Meta+Return"
,
0
));
#else
_ui
.
actionSetup
->
setShortcut
(
QApplication
::
translate
(
"MainWindow"
,
"Ctrl+1"
,
0
));
_ui
.
actionPlan
->
setShortcut
(
QApplication
::
translate
(
"MainWindow"
,
"Ctrl+2"
,
0
));
_ui
.
actionFlight
->
setShortcut
(
QApplication
::
translate
(
"MainWindow"
,
"Ctrl+3"
,
0
));
_ui
.
actionAnalyze
->
setShortcut
(
QApplication
::
translate
(
"MainWindow"
,
"Ctrl+4"
,
0
));
_ui
.
actionFullscreen
->
setShortcut
(
QApplication
::
translate
(
"MainWindow"
,
"Ctrl+Return"
,
0
));
#endif
...
...
@@ -367,6 +366,7 @@ void MainWindow::_buildCommonWidgets(void)
_pfdDockWidgetName
,
_uasInfoViewDockWidgetName
,
_hilDockWidgetName
,
_analyzeDockWidgetName
,
};
static
const
size_t
cDockWidgetNames
=
sizeof
(
rgDockWidgetNames
)
/
sizeof
(
rgDockWidgetNames
[
0
]);
...
...
@@ -419,6 +419,8 @@ void MainWindow::_createInnerDockWidget(const QString& widgetName)
widget
=
new
FlightDisplayWidget
(
widgetName
,
_mapName2Action
[
widgetName
],
this
);
}
else
if
(
widgetName
==
_hilDockWidgetName
)
{
widget
=
new
HILDockWidget
(
widgetName
,
_mapName2Action
[
widgetName
],
this
);
}
else
if
(
widgetName
==
_analyzeDockWidgetName
)
{
widget
=
new
Linecharts
(
widgetName
,
_mapName2Action
[
widgetName
],
mavlinkDecoder
,
this
);
}
else
if
(
widgetName
==
_uasInfoViewDockWidgetName
)
{
QGCTabbedInfoView
*
pInfoView
=
new
QGCTabbedInfoView
(
widgetName
,
_mapName2Action
[
widgetName
],
this
);
pInfoView
->
addSource
(
mavlinkDecoder
);
...
...
@@ -469,14 +471,6 @@ void MainWindow::_buildSetupView(void)
}
}
void
MainWindow
::
_buildAnalyzeView
(
void
)
{
if
(
!
_analyzeView
)
{
_analyzeView
=
new
QGCDataPlot2D
(
this
);
_analyzeView
->
setVisible
(
false
);
}
}
void
MainWindow
::
fullScreenActionItemCallback
(
bool
)
{
_ui
.
actionNormal
->
setChecked
(
false
);
...
...
@@ -589,18 +583,10 @@ void MainWindow::connectCommonActions()
{
// Bind together the perspective actions
QActionGroup
*
perspectives
=
new
QActionGroup
(
_ui
.
menuPerspectives
);
perspectives
->
addAction
(
_ui
.
actionAnalyze
);
perspectives
->
addAction
(
_ui
.
actionFlight
);
perspectives
->
addAction
(
_ui
.
actionPlan
);
perspectives
->
addAction
(
_ui
.
actionSetup
);
perspectives
->
setExclusive
(
true
);
// Mark the right one as selected
if
(
_currentView
==
VIEW_ANALYZE
)
{
_ui
.
actionAnalyze
->
setChecked
(
true
);
_ui
.
actionAnalyze
->
activate
(
QAction
::
Trigger
);
}
if
(
_currentView
==
VIEW_FLIGHT
)
{
_ui
.
actionFlight
->
setChecked
(
true
);
...
...
@@ -625,7 +611,6 @@ void MainWindow::connectCommonActions()
// Views actions
connect
(
_ui
.
actionFlight
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
loadFlightView
()));
connect
(
_ui
.
actionAnalyze
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
loadAnalyzeView
()));
connect
(
_ui
.
actionPlan
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
loadPlanView
()));
// Help Actions
...
...
@@ -695,18 +680,6 @@ void MainWindow::commsWidgetDestroyed(QObject *obj)
void
MainWindow
::
_vehicleAdded
(
Vehicle
*
vehicle
)
{
connect
(
vehicle
->
uas
(),
SIGNAL
(
valueChanged
(
int
,
QString
,
QString
,
QVariant
,
quint64
)),
this
,
SIGNAL
(
valueChanged
(
int
,
QString
,
QString
,
QVariant
,
quint64
)));
if
(
!
linechartWidget
)
{
linechartWidget
=
new
Linecharts
(
this
);
linechartWidget
->
setVisible
(
false
);
}
linechartWidget
->
addSource
(
mavlinkDecoder
);
if
(
_analyzeView
!=
linechartWidget
)
{
_analyzeView
=
linechartWidget
;
}
}
/// Stores the state of the toolbar, status bar and widgets associated with the current view
...
...
@@ -733,11 +706,6 @@ void MainWindow::_loadCurrentViewState(void)
centerView
=
_setupView
;
break
;
case
VIEW_ANALYZE
:
_buildAnalyzeView
();
centerView
=
_analyzeView
;
break
;
case
VIEW_FLIGHT
:
_buildFlightView
();
centerView
=
_flightView
;
...
...
@@ -779,17 +747,6 @@ void MainWindow::_loadCurrentViewState(void)
emit
repaintCanvas
();
}
void
MainWindow
::
loadAnalyzeView
()
{
if
(
_currentView
!=
VIEW_ANALYZE
)
{
_storeCurrentViewState
();
_currentView
=
VIEW_ANALYZE
;
_ui
.
actionAnalyze
->
setChecked
(
true
);
_loadCurrentViewState
();
}
}
void
MainWindow
::
loadPlanView
()
{
if
(
_currentView
!=
VIEW_MISSIONEDITOR
)
...
...
This diff is collapsed.
Click to expand it.
src/ui/MainWindow.h
View file @
fd70e34c
...
...
@@ -56,7 +56,6 @@ This file is part of the QGROUNDCONTROL project
#endif // QGC_MOUSE_ENABLED_WIN
class
QGCFirmwareUpdate
;
class
QSplashScreen
;
class
QGCStatusBar
;
class
Linecharts
;
...
...
@@ -122,7 +121,6 @@ public slots:
void
loadSetupView
();
void
loadFlightView
();
void
loadAnalyzeView
();
void
loadPlanView
();
void
manageLinks
();
...
...
@@ -187,7 +185,7 @@ protected:
typedef
enum
_VIEW_SECTIONS
{
VIEW_
ANALYZE
,
// Engineering/Analyze view mode. Used for analyzing data and modifying onboard parameters
VIEW_
UNUSED5
,
// Unused (don't remove, or it will screw up saved settigns indices)
VIEW_UNUSED3
,
// Unused (don't remove, or it will screw up saved settigns indices)
VIEW_FLIGHT
,
// Flight/Fly/Operate view mode. Used for 1st-person observation of the vehicle.
VIEW_UNUSED4
,
// Unused (don't remove, or it will screw up saved settigns indices)
...
...
@@ -205,7 +203,6 @@ protected:
void
loadSettings
();
void
storeSettings
();
QSettings
settings
;
// Center widgets
...
...
@@ -263,7 +260,6 @@ private:
QPointer
<
QWidget
>
_planView
;
QPointer
<
QWidget
>
_flightView
;
QPointer
<
QWidget
>
_setupView
;
QPointer
<
QWidget
>
_analyzeView
;
QPointer
<
QWidget
>
_missionEditorView
;
#ifndef __mobile__
...
...
@@ -275,6 +271,7 @@ private:
static
const
char
*
_pfdDockWidgetName
;
static
const
char
*
_uasInfoViewDockWidgetName
;
static
const
char
*
_hilDockWidgetName
;
static
const
char
*
_analyzeDockWidgetName
;
QMap
<
QString
,
QGCDockWidget
*>
_mapName2DockWidget
;
QMap
<
QString
,
QAction
*>
_mapName2Action
;
...
...
@@ -283,7 +280,6 @@ private:
void
_buildPlanView
(
void
);
void
_buildFlightView
(
void
);
void
_buildSetupView
(
void
);
void
_buildAnalyzeView
(
void
);
void
_buildTerminalView
(
void
);
void
_buildMissionEditorView
(
void
);
...
...
This diff is collapsed.
Click to expand it.
src/ui/MainWindow.ui
View file @
fd70e34c
...
...
@@ -80,7 +80,6 @@
<addaction
name=
"actionSetup"
/>
<addaction
name=
"actionPlan"
/>
<addaction
name=
"actionFlight"
/>
<addaction
name=
"actionAnalyze"
/>
<addaction
name=
"separator"
/>
<addaction
name=
"actionFullscreen"
/>
<addaction
name=
"actionNormal"
/>
...
...
@@ -134,14 +133,6 @@
<string>
Plan
</string>
</property>
</action>
<action
name=
"actionAnalyze"
>
<property
name=
"checkable"
>
<bool>
true
</bool>
</property>
<property
name=
"text"
>
<string>
Analyze
</string>
</property>
</action>
<action
name=
"actionFlight"
>
<property
name=
"checkable"
>
<bool>
true
</bool>
...
...
@@ -237,9 +228,7 @@
</action>
</widget>
<layoutdefault
spacing=
"6"
margin=
"11"
/>
<resources>
<include
location=
"../../qgroundcontrol.qrc"
/>
</resources>
<resources/>
<connections>
<connection>
<sender>
actionExit
</sender>
...
...
This diff is collapsed.
Click to expand it.
src/ui/MultiVehicleDockWidget.cc
View file @
fd70e34c
...
...
@@ -40,8 +40,11 @@ MultiVehicleDockWidget::MultiVehicleDockWidget(const QString& title, QAction* ac
void
MultiVehicleDockWidget
::
init
(
void
)
{
foreach
(
Vehicle
*
vehicle
,
MultiVehicleManager
::
instance
()
->
vehicles
())
{
_vehicleAdded
(
vehicle
);
}
if
(
MultiVehicleManager
::
instance
()
->
activeVehicle
())
{
_vehicleAdded
(
MultiVehicleManager
::
instance
()
->
activeVehicle
());
_activeVehicleChanged
(
MultiVehicleManager
::
instance
()
->
activeVehicle
());
}
}
...
...
This diff is collapsed.
Click to expand it.
src/ui/linechart/Linecharts.cc
View file @
fd70e34c
...
...
@@ -5,99 +5,27 @@
#include "MainWindow.h"
#include "UAS.h"
Linecharts
::
Linecharts
(
QWidget
*
parent
)
:
QStackedWidget
(
parent
),
plots
(),
active
(
true
)
Linecharts
::
Linecharts
(
const
QString
&
title
,
QAction
*
action
,
MAVLinkDecoder
*
decoder
,
QWidget
*
parent
)
:
MultiVehicleDockWidget
(
title
,
action
,
parent
)
,
_mavlinkDecoder
(
decoder
)
{
this
->
setVisible
(
false
);
// Add each MAV
foreach
(
Vehicle
*
vehicle
,
MultiVehicleManager
::
instance
()
->
vehicles
())
{
addVehicle
(
vehicle
);
}
connect
(
MultiVehicleManager
::
instance
(),
&
MultiVehicleManager
::
vehicleAdded
,
this
,
&
Linecharts
::
addVehicle
);
}
init
();
void
Linecharts
::
showEvent
(
QShowEvent
*
event
)
{
// React only to internal (pre-display)
// events
Q_UNUSED
(
event
)
QWidget
*
prevWidget
=
currentWidget
();
if
(
prevWidget
)
{
LinechartWidget
*
chart
=
dynamic_cast
<
LinechartWidget
*>
(
prevWidget
);
if
(
chart
)
{
this
->
active
=
true
;
chart
->
setActive
(
true
);
}
}
QWidget
::
showEvent
(
event
);
emit
visibilityChanged
(
true
);
this
->
setVisible
(
false
);
}
void
Linecharts
::
hideEvent
(
QHideEvent
*
ev
ent
)
QWidget
*
Linecharts
::
_newVehicleWidget
(
Vehicle
*
vehicle
,
QWidget
*
par
ent
)
{
// React only to internal (pre-display)
// events
Q_UNUSED
(
event
)
QWidget
*
prevWidget
=
currentWidget
();
if
(
prevWidget
)
{
LinechartWidget
*
chart
=
dynamic_cast
<
LinechartWidget
*>
(
prevWidget
);
if
(
chart
)
{
this
->
active
=
false
;
chart
->
setActive
(
false
);
}
}
QWidget
::
hideEvent
(
event
);
emit
visibilityChanged
(
false
);
}
LinechartWidget
*
widget
=
new
LinechartWidget
(
vehicle
->
id
(),
parent
);
void
Linecharts
::
addVehicle
(
Vehicle
*
vehicle
)
{
UAS
*
uas
=
vehicle
->
uas
();
// FIXME Add removeSystem() call
// Connect valueChanged signals
connect
(
vehicle
->
uas
(),
&
UAS
::
valueChanged
,
widget
,
&
LinechartWidget
::
appendData
);
// Compatibility hack
int
uasid
=
0
;
/*uas->getUASID()*/
if
(
!
plots
.
contains
(
uasid
))
{
LinechartWidget
*
widget
=
new
LinechartWidget
(
uasid
,
this
);
addWidget
(
widget
);
plots
.
insert
(
uasid
,
widget
);
// Connect valueChanged signals
connect
(
uas
,
SIGNAL
(
valueChanged
(
int
,
QString
,
QString
,
QVariant
,
quint64
)),
widget
,
SLOT
(
appendData
(
int
,
QString
,
QString
,
QVariant
,
quint64
)));
// Connect decoder
connect
(
_mavlinkDecoder
,
&
MAVLinkDecoder
::
valueChanged
,
widget
,
&
LinechartWidget
::
appendData
);
connect
(
widget
,
SIGNAL
(
logfileWritten
(
QString
)),
this
,
SIGNAL
(
logfileWritten
(
QString
)));
// Set system active if this is the only system
// if (active)
// {
// if (plots.size() == 1)
// {
// FIXME XXX HACK
// Connect generic sources
for
(
int
i
=
0
;
i
<
genericSources
.
count
();
++
i
)
{
connect
(
genericSources
[
i
],
SIGNAL
(
valueChanged
(
int
,
QString
,
QString
,
QVariant
,
quint64
)),
plots
.
values
().
first
(),
SLOT
(
appendData
(
int
,
QString
,
QString
,
QVariant
,
quint64
)));
}
// Select system
widget
->
setActive
(
true
);
//widget->selectActiveSystem(0);
}
// }
// }
}
// Select system
widget
->
setActive
(
true
);
void
Linecharts
::
addSource
(
QObject
*
obj
)
{
genericSources
.
append
(
obj
);
// FIXME XXX HACK
if
(
plots
.
size
()
>
0
)
{
// Connect generic source
connect
(
obj
,
SIGNAL
(
valueChanged
(
int
,
QString
,
QString
,
QVariant
,
quint64
)),
plots
.
values
().
first
(),
SLOT
(
appendData
(
int
,
QString
,
QString
,
QVariant
,
quint64
)));
}
return
widget
;
}
This diff is collapsed.
Click to expand it.
src/ui/linechart/Linecharts.h
View file @
fd70e34c
...
...
@@ -7,34 +7,26 @@
#include "LinechartWidget.h"
#include "Vehicle.h"
#include "MultiVehicleDockWidget.h"
#include "MAVLinkDecoder.h"
class
Linecharts
:
public
QStacked
Widget
class
Linecharts
:
public
MultiVehicleDock
Widget
{
Q_OBJECT
public:
explicit
Linecharts
(
QWidget
*
parent
=
0
);
explicit
Linecharts
(
const
QString
&
title
,
QAction
*
action
,
MAVLinkDecoder
*
decoder
,
QWidget
*
parent
=
0
);
signals:
/** @brief This signal is emitted once a logfile has been finished writing */
void
logfileWritten
(
QString
fileName
);
void
visibilityChanged
(
bool
visible
);
public
slots
:
/** @brief Add a new system to the list of plots */
void
addVehicle
(
Vehicle
*
vehicle
);
/** @brief Add a new generic message source (not a system) */
void
addSource
(
QObject
*
obj
);
protected:
// Override from MultiVehicleDockWidget
virtual
QWidget
*
_newVehicleWidget
(
Vehicle
*
vehicle
,
QWidget
*
parent
);
QMap
<
int
,
LinechartWidget
*>
plots
;
QVector
<
QObject
*>
genericSources
;
bool
active
;
/** @brief Start updating widget */
void
showEvent
(
QShowEvent
*
event
);
/** @brief Stop updating widget */
void
hideEvent
(
QHideEvent
*
event
);
private:
MAVLinkDecoder
*
_mavlinkDecoder
;
};
#endif // LINECHARTS_H
This diff is collapsed.
Click to expand it.
src/ui/toolbar/MainToolBar.cc
View file @
fd70e34c
...
...
@@ -161,12 +161,6 @@ void MainToolBar::onFlyViewMenu()
}
}
void
MainToolBar
::
onAnalyzeView
()
{
setCurrentView
(
MainWindow
::
VIEW_ANALYZE
);
MainWindow
::
instance
()
->
loadAnalyzeView
();
}
void
MainToolBar
::
onDisconnect
(
QString
conf
)
{
if
(
conf
.
isEmpty
())
{
...
...
@@ -248,9 +242,6 @@ void MainToolBar::setCurrentView(int currentView)
{
ViewType_t
view
=
ViewNone
;
switch
((
MainWindow
::
VIEW_SECTIONS
)
currentView
)
{
case
MainWindow
:
:
VIEW_ANALYZE
:
view
=
ViewAnalyze
;
break
;
case
MainWindow
:
:
VIEW_MISSIONEDITOR
:
view
=
ViewPlan
;
break
;
...
...
@@ -441,4 +432,4 @@ void MainToolBar::onToolBarMessageClosed(void)
{
_toolbarMessageVisible
=
false
;
_delayedShowToolBarMessage
();
}
\ No newline at end of file
}
This diff is collapsed.
Click to expand it.
src/ui/toolbar/MainToolBar.h
View file @
fd70e34c
...
...
@@ -64,7 +64,6 @@ public:
Q_INVOKABLE
void
onPlanView
();
Q_INVOKABLE
void
onFlyView
();
Q_INVOKABLE
void
onFlyViewMenu
();
Q_INVOKABLE
void
onAnalyzeView
();
Q_INVOKABLE
void
onConnect
(
QString
conf
);
Q_INVOKABLE
void
onDisconnect
(
QString
conf
);
Q_INVOKABLE
void
onEnterMessageArea
(
int
x
,
int
y
);
...
...
This diff is collapsed.
Click to expand it.
src/ui/toolbar/MainToolBar.qml
View file @
fd70e34c
...
...
@@ -626,7 +626,6 @@ Rectangle {
setupButton
.
repaintChevron
=
true
;
planButton
.
repaintChevron
=
true
;
flyButton
.
repaintChevron
=
true
;
analyzeButton
.
repaintChevron
=
true
;
}
}
...
...
@@ -670,19 +669,6 @@ Rectangle {
}
z
:
800
}
QGCToolBarButton
{
id
:
analyzeButton
width
:
getProportionalDimmension
(
90
)
height
:
cellHeight
exclusiveGroup
:
mainActionGroup
text
:
qsTr
(
"
Analyze
"
)
checked
:
(
mainToolBar
.
currentView
===
MainToolBar
.
ViewAnalyze
)
onClicked
:
{
mainToolBar
.
onAnalyzeView
();
}
z
:
700
}
}
// Row
//---------------------------------------------------------------------
...
...
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