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
b2471b00
Commit
b2471b00
authored
Oct 28, 2015
by
Don Gagne
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2129 from tcanabrava/moreSmallFixesV2
More small fixes v2
parents
44313e19
a77773b6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
57 deletions
+60
-57
MainWindow.cc
src/ui/MainWindow.cc
+60
-46
MainWindow.h
src/ui/MainWindow.h
+0
-11
No files found.
src/ui/MainWindow.cc
View file @
b2471b00
...
...
@@ -84,15 +84,29 @@ This file is part of the QGROUNDCONTROL project
const
char
*
MAIN_SETTINGS_GROUP
=
"QGC_MAINWINDOW"
;
#ifndef __mobile__
const
char
*
MainWindow
::
_mavlinkDockWidgetName
=
"MAVLink Inspector"
;
const
char
*
MainWindow
::
_customCommandWidgetName
=
"Custom Command"
;
const
char
*
MainWindow
::
_filesDockWidgetName
=
"Onboard Files"
;
const
char
*
MainWindow
::
_uasStatusDetailsDockWidgetName
=
"Status Details"
;
const
char
*
MainWindow
::
_uasInfoViewDockWidgetName
=
"Info View"
;
const
char
*
MainWindow
::
_hilDockWidgetName
=
"HIL Config"
;
const
char
*
MainWindow
::
_analyzeDockWidgetName
=
"Analyze"
;
const
char
*
MainWindow
::
_visibleWidgetsKey
=
"VisibleWidgets"
;
enum
DockWidgetTypes
{
MAVLINK_INSPECTOR
,
CUSTOM_COMMAND
,
ONBOARD_FILES
,
STATUS_DETAILS
,
INFO_VIEW
,
HIL_CONFIG
,
ANALYZE
};
static
const
char
*
rgDockWidgetNames
[]
=
{
"MAVLink Inspector"
,
"Custom Command"
,
"Onboard Files"
,
"Status Details"
,
"Info View"
,
"HIL Config"
,
"Analyze"
};
#define ARRAY_SIZE(ARRAY) (sizeof(ARRAY) / sizeof(ARRAY[0]))
static
const
char
*
_visibleWidgetsKey
=
"VisibleWidgets"
;
#endif
static
MainWindow
*
_instance
=
NULL
;
///< @brief MainWindow singleton
...
...
@@ -318,27 +332,16 @@ void MainWindow::_buildCommonWidgets(void)
logPlayer
=
new
QGCMAVLinkLogPlayer
(
statusBar
());
statusBar
()
->
addPermanentWidget
(
logPlayer
);
static
const
char
*
rgDockWidgetNames
[]
=
{
_mavlinkDockWidgetName
,
_customCommandWidgetName
,
_filesDockWidgetName
,
_uasStatusDetailsDockWidgetName
,
_uasInfoViewDockWidgetName
,
_hilDockWidgetName
,
_analyzeDockWidgetName
,
};
static
const
size_t
cDockWidgetNames
=
sizeof
(
rgDockWidgetNames
)
/
sizeof
(
rgDockWidgetNames
[
0
]);
for
(
size_t
i
=
0
;
i
<
cDockWidgetNames
;
i
++
)
{
for
(
int
i
=
0
,
end
=
ARRAY_SIZE
(
rgDockWidgetNames
);
i
<
end
;
i
++
)
{
const
char
*
pDockWidgetName
=
rgDockWidgetNames
[
i
];
// Add to menu
QAction
*
action
=
new
QAction
(
pDockWidgetName
,
NULL
);
QAction
*
action
=
new
QAction
(
tr
(
pDockWidgetName
)
,
NULL
);
action
->
setCheckable
(
true
);
action
->
setData
(
pDockWidgetName
);
action
->
setData
(
i
);
connect
(
action
,
&
QAction
::
triggered
,
this
,
&
MainWindow
::
_showDockWidgetAction
);
_ui
.
menuWidgets
->
addAction
(
action
);
_mapName2Action
[
pDockWidgetName
]
=
action
;
}
}
...
...
@@ -365,28 +368,35 @@ void MainWindow::_showDockWidget(const QString& name, bool show)
void
MainWindow
::
_createInnerDockWidget
(
const
QString
&
widgetName
)
{
QGCDockWidget
*
widget
=
NULL
;
if
(
widgetName
==
_mavlinkDockWidgetName
)
{
widget
=
new
QGCMAVLinkInspector
(
widgetName
,
_mapName2Action
[
widgetName
],
MAVLinkProtocol
::
instance
(),
this
);
}
else
if
(
widgetName
==
_customCommandWidgetName
)
{
widget
=
new
CustomCommandWidget
(
widgetName
,
_mapName2Action
[
widgetName
],
this
);
}
else
if
(
widgetName
==
_filesDockWidgetName
)
{
widget
=
new
QGCUASFileViewMulti
(
widgetName
,
_mapName2Action
[
widgetName
],
this
);
}
else
if
(
widgetName
==
_uasStatusDetailsDockWidgetName
)
{
widget
=
new
UASInfoWidget
(
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
);
widget
=
pInfoView
;
}
else
{
qWarning
()
<<
"Attempt to create unknown Inner Dock Widget"
<<
widgetName
;
return
;
QAction
*
action
=
_mapName2Action
[
widgetName
];
switch
(
action
->
data
().
toInt
())
{
case
MAVLINK_INSPECTOR
:
widget
=
new
QGCMAVLinkInspector
(
widgetName
,
action
,
MAVLinkProtocol
::
instance
(),
this
);
break
;
case
CUSTOM_COMMAND
:
widget
=
new
CustomCommandWidget
(
widgetName
,
action
,
this
);
break
;
case
ONBOARD_FILES
:
widget
=
new
QGCUASFileViewMulti
(
widgetName
,
action
,
this
);
break
;
case
STATUS_DETAILS
:
widget
=
new
UASInfoWidget
(
widgetName
,
action
,
this
);
break
;
case
HIL_CONFIG
:
widget
=
new
HILDockWidget
(
widgetName
,
action
,
this
);
break
;
case
ANALYZE
:
widget
=
new
Linecharts
(
widgetName
,
action
,
mavlinkDecoder
,
this
);
break
;
case
INFO_VIEW
:
widget
=
new
QGCTabbedInfoView
(
widgetName
,
action
,
this
);
break
;
}
if
(
action
->
data
().
toInt
()
==
INFO_VIEW
)
{
qobject_cast
<
QGCTabbedInfoView
*>
(
widget
)
->
addSource
(
mavlinkDecoder
);
}
_mapName2DockWidget
[
widgetName
]
=
widget
;
}
...
...
@@ -399,19 +409,23 @@ void MainWindow::_hideAllDockWidgets(void)
void
MainWindow
::
_showDockWidgetAction
(
bool
show
)
{
QAction
*
action
=
dynamic
_cast
<
QAction
*>
(
QObject
::
sender
());
QAction
*
action
=
qobject
_cast
<
QAction
*>
(
QObject
::
sender
());
Q_ASSERT
(
action
);
_showDockWidget
(
action
->
text
()
,
show
);
_showDockWidget
(
rgDockWidgetNames
[
action
->
data
().
toInt
()]
,
show
);
}
#endif
void
MainWindow
::
fullScreenActionItemCallback
(
bool
)
{
if
(
!
_ui
.
actionFullscreen
->
isChecked
())
_ui
.
actionFullscreen
->
setChecked
(
true
);
_ui
.
actionNormal
->
setChecked
(
false
);
}
void
MainWindow
::
normalActionItemCallback
(
bool
)
{
if
(
!
_ui
.
actionNormal
->
isChecked
())
_ui
.
actionNormal
->
setChecked
(
true
);
_ui
.
actionFullscreen
->
setChecked
(
false
);
}
...
...
src/ui/MainWindow.h
View file @
b2471b00
...
...
@@ -227,15 +227,6 @@ private:
QPointer
<
QWidget
>
_missionEditorView
;
#ifndef __mobile__
// Dock widget names
static
const
char
*
_mavlinkDockWidgetName
;
static
const
char
*
_customCommandWidgetName
;
static
const
char
*
_filesDockWidgetName
;
static
const
char
*
_uasStatusDetailsDockWidgetName
;
static
const
char
*
_uasInfoViewDockWidgetName
;
static
const
char
*
_hilDockWidgetName
;
static
const
char
*
_analyzeDockWidgetName
;
QMap
<
QString
,
QGCDockWidget
*>
_mapName2DockWidget
;
QMap
<
QString
,
QAction
*>
_mapName2Action
;
#endif
...
...
@@ -250,8 +241,6 @@ private:
void
_showDockWidget
(
const
QString
&
name
,
bool
show
);
void
_loadVisibleWidgetsSettings
(
void
);
void
_storeVisibleWidgetsSettings
(
void
);
static
const
char
*
_visibleWidgetsKey
;
#endif
bool
_autoReconnect
;
...
...
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