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
5af9e035
Commit
5af9e035
authored
Feb 20, 2014
by
Lorenz Meier
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #540 from mavlink/3dviews
3dviews
parents
dcf0b4f9
3d1f55cf
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
110 additions
and
41 deletions
+110
-41
MainWindow.cc
src/ui/MainWindow.cc
+91
-40
MainWindow.h
src/ui/MainWindow.h
+7
-1
MainWindow.ui
src/ui/MainWindow.ui
+12
-0
No files found.
src/ui/MainWindow.cc
View file @
5af9e035
...
...
@@ -70,13 +70,13 @@ This file is part of the QGROUNDCONTROL project
#include <QGCConfigView.h>
#include "SerialSettingsDialog.h"
#include "terminalconsole.h"
#include "menuactionhelper.h"
// Add support for the MAVLink generator UI if it's been requested.
#ifdef QGC_MAVGEN_ENABLED
#include "XMLCommProtocolWidget.h"
#endif
#include "menuactionhelper.h"
// Add support for the MAVLink generator UI if it's been requested.
#ifdef QGC_MAVGEN_ENABLED
#include "XMLCommProtocolWidget.h"
#endif
#ifdef QGC_OSG_ENABLED
#include "Q3DWidgetFactory.h"
#endif
...
...
@@ -279,19 +279,19 @@ void MainWindow::init()
joystickWidget
=
0
;
joystick
=
new
JoystickInput
();
#ifdef QGC_MOUSE_ENABLED_WIN
#ifdef QGC_MOUSE_ENABLED_WIN
emit
initStatusChanged
(
tr
(
"Initializing 3D mouse interface"
),
Qt
::
AlignLeft
|
Qt
::
AlignBottom
,
QColor
(
62
,
93
,
141
));
mouseInput
=
new
Mouse3DInput
(
this
);
mouse
=
new
Mouse6dofInput
(
mouseInput
);
#endif //QGC_MOUSE_ENABLED_WIN
#endif //QGC_MOUSE_ENABLED_WIN
#if QGC_MOUSE_ENABLED_LINUX
#if QGC_MOUSE_ENABLED_LINUX
emit
initStatusChanged
(
tr
(
"Initializing 3D mouse interface"
),
Qt
::
AlignLeft
|
Qt
::
AlignBottom
,
QColor
(
62
,
93
,
141
));
mouse
=
new
Mouse6dofInput
(
this
);
connect
(
this
,
SIGNAL
(
x11EventOccured
(
XEvent
*
)),
mouse
,
SLOT
(
handleX11Event
(
XEvent
*
)));
#endif //QGC_MOUSE_ENABLED_LINUX
#endif //QGC_MOUSE_ENABLED_LINUX
// Connect link
if
(
autoReconnect
)
...
...
@@ -468,6 +468,12 @@ void MainWindow::buildCustomWidget()
case
VIEW_MAVLINK
:
dock
=
createDockWidget
(
mavlinkView
,
tool
,
tool
->
getTitle
(),
tool
->
objectName
(),(
VIEW_SECTIONS
)
view
,
location
);
break
;
case
VIEW_GOOGLEEARTH
:
dock
=
createDockWidget
(
googleEarthView
,
tool
,
tool
->
getTitle
(),
tool
->
objectName
(),(
VIEW_SECTIONS
)
view
,
location
);
break
;
case
VIEW_LOCAL3D
:
dock
=
createDockWidget
(
local3DView
,
tool
,
tool
->
getTitle
(),
tool
->
objectName
(),(
VIEW_SECTIONS
)
view
,
location
);
break
;
default:
dock
=
createDockWidget
(
centerStack
->
currentWidget
(),
tool
,
tool
->
getTitle
(),
tool
->
objectName
(),(
VIEW_SECTIONS
)
view
,
location
);
break
;
...
...
@@ -550,18 +556,41 @@ void MainWindow::buildCommonWidgets()
engineeringView
->
setObjectName
(
"VIEW_ENGINEER"
);
engineeringView
->
setCentralWidget
(
new
QGCDataPlot2D
(
this
));
addToCentralStackedWidget
(
engineeringView
,
VIEW_ENGINEER
,
tr
(
"Logfile Plot"
));
}
// Add the MAVLink generator UI if it's been requested.
#ifdef QGC_MAVGEN_ENABLED
if
(
!
mavlinkView
)
{
mavlinkView
=
new
SubMainWindow
(
this
);
}
// Add the MAVLink generator UI if it's been requested.
#ifdef QGC_MAVGEN_ENABLED
if
(
!
mavlinkView
)
{
mavlinkView
=
new
SubMainWindow
(
this
);
mavlinkView
->
setObjectName
(
"VIEW_MAVLINK"
);
mavlinkView
->
setCentralWidget
(
new
XMLCommProtocolWidget
(
this
));
addToCentralStackedWidget
(
mavlinkView
,
VIEW_MAVLINK
,
tr
(
"Mavlink Generator"
));
}
#endif
#endif
#if (defined _MSC_VER) | (defined Q_OS_MAC)
if
(
!
googleEarthView
)
{
googleEarthView
=
new
SubMainWindow
(
this
);
googleEarthView
->
setObjectName
(
"VIEW_GOOGLEEARTH"
);
googleEarthView
->
setCentralWidget
(
new
QGCGoogleEarthView
(
this
));
addToCentralStackedWidget
(
googleEarthView
,
VIEW_GOOGLEEARTH
,
tr
(
"Google Earth View"
));
}
#endif
#ifdef QGC_OSG_ENABLED
if
(
!
local3DView
)
{
q3DWidget
=
Q3DWidgetFactory
::
get
(
"PIXHAWK"
,
this
);
q3DWidget
->
setObjectName
(
"VIEW_3DWIDGET"
);
local3DView
=
new
SubMainWindow
(
this
);
local3DView
->
setObjectName
(
"VIEW_LOCAL3D"
);
local3DView
->
setCentralWidget
(
q3DWidget
);
addToCentralStackedWidget
(
local3DView
,
VIEW_LOCAL3D
,
tr
(
"Local 3D View"
));
}
#endif
if
(
!
simView
)
{
...
...
@@ -666,24 +695,6 @@ void MainWindow::buildCommonWidgets()
dataplotWidget = new QGCDataPlot2D(this);
addCentralWidget(dataplotWidget, tr("Logfile Plot"));
}*/
#ifdef QGC_OSG_ENABLED
if
(
q3DWidget
)
{
q3DWidget
=
Q3DWidgetFactory
::
get
(
"PIXHAWK"
,
this
);
q3DWidget
->
setObjectName
(
"VIEW_3DWIDGET"
);
addToCentralStackedWidget
(
q3DWidget
,
VIEW_3DWIDGET
,
tr
(
"Local 3D"
));
}
#endif
#ifdef QGC_GOOGLE_EARTH_ENABLED
if
(
!
earthWidget
)
{
earthWidget
=
new
QGCGoogleEarthView
(
this
);
addToCentralStackedWidget
(
earthWidget
,
VIEW_GOOGLEEARTH
,
tr
(
"Google Earth"
));
}
#endif
}
void
MainWindow
::
addTool
(
SubMainWindow
*
parent
,
VIEW_SECTIONS
view
,
QDockWidget
*
widget
,
const
QString
&
title
,
Qt
::
DockWidgetArea
area
)
...
...
@@ -1232,6 +1243,8 @@ void MainWindow::connectCommonActions()
}
perspectives
->
addAction
(
ui
.
actionTerminalView
);
perspectives
->
addAction
(
ui
.
actionUnconnectedView
);
perspectives
->
addAction
(
ui
.
actionGoogleEarthView
);
perspectives
->
addAction
(
ui
.
actionLocal3DView
);
perspectives
->
setExclusive
(
true
);
// Mark the right one as selected
...
...
@@ -1275,6 +1288,16 @@ void MainWindow::connectCommonActions()
ui
.
actionTerminalView
->
setChecked
(
true
);
ui
.
actionTerminalView
->
activate
(
QAction
::
Trigger
);
}
if
(
currentView
==
VIEW_GOOGLEEARTH
)
{
ui
.
actionGoogleEarthView
->
setChecked
(
true
);
ui
.
actionGoogleEarthView
->
activate
(
QAction
::
Trigger
);
}
if
(
currentView
==
VIEW_LOCAL3D
)
{
ui
.
actionLocal3DView
->
setChecked
(
true
);
ui
.
actionLocal3DView
->
activate
(
QAction
::
Trigger
);
}
if
(
currentView
==
VIEW_UNCONNECTED
)
{
ui
.
actionUnconnectedView
->
setChecked
(
true
);
...
...
@@ -1312,6 +1335,8 @@ void MainWindow::connectCommonActions()
connect
(
ui
.
actionMissionView
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
loadOperatorView
()));
connect
(
ui
.
actionUnconnectedView
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
loadUnconnectedView
()));
connect
(
ui
.
actionHardwareConfig
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
loadHardwareConfigView
()));
connect
(
ui
.
actionGoogleEarthView
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
loadGoogleEarthView
()));
connect
(
ui
.
actionLocal3DView
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
loadLocal3DView
()));
if
(
getCustomMode
()
==
CUSTOM_MODE_APM
)
{
connect
(
ui
.
actionSoftwareConfig
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
loadSoftwareConfigView
()));
...
...
@@ -1850,7 +1875,12 @@ void MainWindow::loadViewState()
case
VIEW_TERMINAL
:
centerStack
->
setCurrentWidget
(
terminalView
);
break
;
case
VIEW_GOOGLEEARTH
:
centerStack
->
setCurrentWidget
(
googleEarthView
);
break
;
case
VIEW_LOCAL3D
:
centerStack
->
setCurrentWidget
(
local3DView
);
break
;
case
VIEW_UNCONNECTED
:
case
VIEW_FULL
:
default:
...
...
@@ -1949,6 +1979,27 @@ void MainWindow::loadTerminalView()
}
}
void
MainWindow
::
loadGoogleEarthView
()
{
if
(
currentView
!=
VIEW_GOOGLEEARTH
)
{
storeViewState
();
currentView
=
VIEW_GOOGLEEARTH
;
ui
.
actionGoogleEarthView
->
setChecked
(
true
);
loadViewState
();
}
}
void
MainWindow
::
loadLocal3DView
()
{
if
(
currentView
!=
VIEW_LOCAL3D
)
{
storeViewState
();
currentView
=
VIEW_LOCAL3D
;
ui
.
actionLocal3DView
->
setChecked
(
true
);
loadViewState
();
}
}
void
MainWindow
::
loadUnconnectedView
()
{
...
...
@@ -2025,11 +2076,11 @@ bool MainWindow::dockWidgetTitleBarsEnabled() const
return
menuActionHelper
->
dockWidgetTitleBarsEnabled
();
}
#ifdef QGC_MOUSE_ENABLED_LINUX
#ifdef QGC_MOUSE_ENABLED_LINUX
bool
MainWindow
::
x11Event
(
XEvent
*
event
)
{
emit
x11EventOccured
(
event
);
//qDebug("XEvent occured...");
return
false
;
}
#endif // QGC_MOUSE_ENABLED_LINUX
#endif // QGC_MOUSE_ENABLED_LINUX
src/ui/MainWindow.h
View file @
5af9e035
...
...
@@ -239,6 +239,10 @@ public slots:
void
loadMAVLinkView
();
/** @brief Load Terminal Console views */
void
loadTerminalView
();
/** @brief Load Google Earth View */
void
loadGoogleEarthView
();
/** @brief Load local 3D view */
void
loadLocal3DView
();
/** @brief Show the online help for users */
void
showHelp
();
...
...
@@ -332,7 +336,7 @@ protected:
VIEW_HARDWARE_CONFIG
,
VIEW_SOFTWARE_CONFIG
,
VIEW_TERMINAL
,
VIEW_
3DWIDGET
,
VIEW_
LOCAL3D
,
VIEW_GOOGLEEARTH
,
VIEW_UNCONNECTED
,
///< View in unconnected mode, when no UAS is available
VIEW_FULL
///< All widgets shown at once
...
...
@@ -405,6 +409,8 @@ protected:
QPointer
<
SubMainWindow
>
engineeringView
;
QPointer
<
SubMainWindow
>
simView
;
QPointer
<
SubMainWindow
>
terminalView
;
QPointer
<
SubMainWindow
>
googleEarthView
;
QPointer
<
SubMainWindow
>
local3DView
;
// Center widgets
QPointer
<
Linecharts
>
linechartWidget
;
...
...
src/ui/MainWindow.ui
View file @
5af9e035
...
...
@@ -102,6 +102,8 @@
<addaction
name=
"actionTerminalView"
/>
<addaction
name=
"actionEngineersView"
/>
<addaction
name=
"actionSimulationView"
/>
<addaction
name=
"actionGoogleEarthView"
/>
<addaction
name=
"actionLocal3DView"
/>
<addaction
name=
"separator"
/>
<addaction
name=
"actionFirmwareUpdateView"
/>
<addaction
name=
"actionMavlinkView"
/>
...
...
@@ -502,6 +504,16 @@
<string>
Terminal
</string>
</property>
</action>
<action
name=
"actionGoogleEarthView"
>
<property
name=
"text"
>
<string>
Google Earth
</string>
</property>
</action>
<action
name=
"actionLocal3DView"
>
<property
name=
"text"
>
<string>
Local 3D View
</string>
</property>
</action>
</widget>
<layoutdefault
spacing=
"6"
margin=
"11"
/>
<resources>
...
...
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