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
57225710
Commit
57225710
authored
Aug 14, 2017
by
DonLakeFlyer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Switch to more generic QmlPageInfo from QGCSettings
Also plugin'ize intrument panel PageView pages
parent
3ebe6b4d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
106 additions
and
43 deletions
+106
-43
qgroundcontrol.pro
qgroundcontrol.pro
+2
-2
QGCCorePlugin.cc
src/api/QGCCorePlugin.cc
+56
-32
QGCCorePlugin.h
src/api/QGCCorePlugin.h
+6
-0
QmlPageInfo.cc
src/api/QmlPageInfo.cc
+7
-9
QmlPageInfo.h
src/api/QmlPageInfo.h
+35
-0
No files found.
qgroundcontrol.pro
View file @
57225710
...
...
@@ -390,12 +390,12 @@ FORMS += \
HEADERS
+=
\
src
/
api
/
QGCCorePlugin
.
h
\
src
/
api
/
QGCOptions
.
h
\
src
/
api
/
Q
GCSettings
.
h
\
src
/
api
/
Q
mlPageInfo
.
h
\
SOURCES
+=
\
src
/
api
/
QGCCorePlugin
.
cc
\
src
/
api
/
QGCOptions
.
cc
\
src
/
api
/
Q
GCSettings
.
cc
\
src
/
api
/
Q
mlPageInfo
.
cc
\
#
#
Unit
Test
specific
configuration
goes
here
(
requires
full
debug
build
with
all
plugins
)
...
...
src/api/QGCCorePlugin.cc
View file @
57225710
...
...
@@ -10,7 +10,7 @@
#include "QGCApplication.h"
#include "QGCCorePlugin.h"
#include "QGCOptions.h"
#include "Q
GCSettings
.h"
#include "Q
mlPageInfo
.h"
#include "FactMetaData.h"
#include "SettingsManager.h"
#include "AppMessages.h"
...
...
@@ -26,16 +26,20 @@ class QGCCorePlugin_p
{
public:
QGCCorePlugin_p
()
:
pGeneral
(
NULL
)
,
pCommLinks
(
NULL
)
,
pOfflineMaps
(
NULL
)
,
pMAVLink
(
NULL
)
,
pConsole
(
NULL
)
:
pGeneral
(
NULL
)
,
pCommLinks
(
NULL
)
,
pOfflineMaps
(
NULL
)
,
pMAVLink
(
NULL
)
,
pConsole
(
NULL
)
#if defined(QT_DEBUG)
,
pMockLink
(
NULL
)
,
pDebug
(
NULL
)
,
pMockLink
(
NULL
)
,
pDebug
(
NULL
)
#endif
,
defaultOptions
(
NULL
)
,
defaultOptions
(
NULL
)
,
valuesPageWidgetInfo
(
NULL
)
,
cameraPageWidgetInfo
(
NULL
)
,
healthPageWidgetInfo
(
NULL
)
,
vibrationPageWidgetInfo
(
NULL
)
{
}
...
...
@@ -61,17 +65,23 @@ public:
delete
defaultOptions
;
}
Q
GCSettings
*
pGeneral
;
Q
GCSettings
*
pCommLinks
;
Q
GCSettings
*
pOfflineMaps
;
Q
GCSettings
*
pMAVLink
;
Q
GCSettings
*
pConsole
;
Q
mlPageInfo
*
pGeneral
;
Q
mlPageInfo
*
pCommLinks
;
Q
mlPageInfo
*
pOfflineMaps
;
Q
mlPageInfo
*
pMAVLink
;
Q
mlPageInfo
*
pConsole
;
#if defined(QT_DEBUG)
Q
GCSettings
*
pMockLink
;
Q
GCSettings
*
pDebug
;
Q
mlPageInfo
*
pMockLink
;
Q
mlPageInfo
*
pDebug
;
#endif
QVariantList
settingsList
;
QGCOptions
*
defaultOptions
;
QmlPageInfo
*
valuesPageWidgetInfo
;
QmlPageInfo
*
cameraPageWidgetInfo
;
QmlPageInfo
*
healthPageWidgetInfo
;
QmlPageInfo
*
vibrationPageWidgetInfo
;
QVariantList
instrumentPageWidgetList
;
};
QGCCorePlugin
::~
QGCCorePlugin
()
...
...
@@ -99,41 +109,55 @@ void QGCCorePlugin::setToolbox(QGCToolbox *toolbox)
QVariantList
&
QGCCorePlugin
::
settingsPages
()
{
//-- If this hasn't been overridden, create default set of settings
if
(
!
_p
->
pGeneral
)
{
//-- Default Settings
_p
->
pGeneral
=
new
QGCSettings
(
tr
(
"General"
),
_p
->
pGeneral
=
new
QmlPageInfo
(
tr
(
"General"
),
QUrl
::
fromUserInput
(
"qrc:/qml/GeneralSettings.qml"
),
QUrl
::
fromUserInput
(
"qrc:/res/gear-white.svg"
));
_p
->
settingsList
.
append
(
QVariant
::
fromValue
((
Q
GCSettings
*
)
_p
->
pGeneral
));
_p
->
pCommLinks
=
new
Q
GCSettings
(
tr
(
"Comm Links"
),
_p
->
settingsList
.
append
(
QVariant
::
fromValue
((
Q
mlPageInfo
*
)
_p
->
pGeneral
));
_p
->
pCommLinks
=
new
Q
mlPageInfo
(
tr
(
"Comm Links"
),
QUrl
::
fromUserInput
(
"qrc:/qml/LinkSettings.qml"
),
QUrl
::
fromUserInput
(
"qrc:/res/waves.svg"
));
_p
->
settingsList
.
append
(
QVariant
::
fromValue
((
Q
GCSettings
*
)
_p
->
pCommLinks
));
_p
->
pOfflineMaps
=
new
Q
GCSettings
(
tr
(
"Offline Maps"
),
_p
->
settingsList
.
append
(
QVariant
::
fromValue
((
Q
mlPageInfo
*
)
_p
->
pCommLinks
));
_p
->
pOfflineMaps
=
new
Q
mlPageInfo
(
tr
(
"Offline Maps"
),
QUrl
::
fromUserInput
(
"qrc:/qml/OfflineMap.qml"
),
QUrl
::
fromUserInput
(
"qrc:/res/waves.svg"
));
_p
->
settingsList
.
append
(
QVariant
::
fromValue
((
Q
GCSettings
*
)
_p
->
pOfflineMaps
));
_p
->
pMAVLink
=
new
Q
GCSettings
(
tr
(
"MAVLink"
),
_p
->
settingsList
.
append
(
QVariant
::
fromValue
((
Q
mlPageInfo
*
)
_p
->
pOfflineMaps
));
_p
->
pMAVLink
=
new
Q
mlPageInfo
(
tr
(
"MAVLink"
),
QUrl
::
fromUserInput
(
"qrc:/qml/MavlinkSettings.qml"
),
QUrl
::
fromUserInput
(
"qrc:/res/waves.svg"
));
_p
->
settingsList
.
append
(
QVariant
::
fromValue
((
Q
GCSettings
*
)
_p
->
pMAVLink
));
_p
->
pConsole
=
new
Q
GCSettings
(
tr
(
"Console"
),
_p
->
settingsList
.
append
(
QVariant
::
fromValue
((
Q
mlPageInfo
*
)
_p
->
pMAVLink
));
_p
->
pConsole
=
new
Q
mlPageInfo
(
tr
(
"Console"
),
QUrl
::
fromUserInput
(
"qrc:/qml/QGroundControl/Controls/AppMessages.qml"
));
_p
->
settingsList
.
append
(
QVariant
::
fromValue
((
Q
GCSettings
*
)
_p
->
pConsole
));
_p
->
settingsList
.
append
(
QVariant
::
fromValue
((
Q
mlPageInfo
*
)
_p
->
pConsole
));
#if defined(QT_DEBUG)
//-- These are always present on Debug builds
_p
->
pMockLink
=
new
Q
GCSettings
(
tr
(
"Mock Link"
),
_p
->
pMockLink
=
new
Q
mlPageInfo
(
tr
(
"Mock Link"
),
QUrl
::
fromUserInput
(
"qrc:/qml/MockLink.qml"
));
_p
->
settingsList
.
append
(
QVariant
::
fromValue
((
Q
GCSettings
*
)
_p
->
pMockLink
));
_p
->
pDebug
=
new
Q
GCSettings
(
tr
(
"Debug"
),
_p
->
settingsList
.
append
(
QVariant
::
fromValue
((
Q
mlPageInfo
*
)
_p
->
pMockLink
));
_p
->
pDebug
=
new
Q
mlPageInfo
(
tr
(
"Debug"
),
QUrl
::
fromUserInput
(
"qrc:/qml/DebugWindow.qml"
));
_p
->
settingsList
.
append
(
QVariant
::
fromValue
((
Q
GCSettings
*
)
_p
->
pDebug
));
_p
->
settingsList
.
append
(
QVariant
::
fromValue
((
Q
mlPageInfo
*
)
_p
->
pDebug
));
#endif
}
return
_p
->
settingsList
;
}
QVariantList
&
QGCCorePlugin
::
instrumentPages
(
void
)
{
if
(
!
_p
->
valuesPageWidgetInfo
)
{
_p
->
valuesPageWidgetInfo
=
new
QmlPageInfo
(
tr
(
"Values"
),
QUrl
::
fromUserInput
(
"qrc:/qml/ValuePageWidget.qml"
));
_p
->
cameraPageWidgetInfo
=
new
QmlPageInfo
(
tr
(
"Camera"
),
QUrl
::
fromUserInput
(
"qrc:/qml/CameraPageWidget.qml"
));
_p
->
healthPageWidgetInfo
=
new
QmlPageInfo
(
tr
(
"Health"
),
QUrl
::
fromUserInput
(
"qrc:/qml/HealthPageWidget.qml"
));
_p
->
vibrationPageWidgetInfo
=
new
QmlPageInfo
(
tr
(
"Vibration"
),
QUrl
::
fromUserInput
(
"qrc:/qml/VibrationPageWidget.qml"
));
_p
->
instrumentPageWidgetList
.
append
(
QVariant
::
fromValue
(
_p
->
valuesPageWidgetInfo
));
_p
->
instrumentPageWidgetList
.
append
(
QVariant
::
fromValue
(
_p
->
cameraPageWidgetInfo
));
_p
->
instrumentPageWidgetList
.
append
(
QVariant
::
fromValue
(
_p
->
healthPageWidgetInfo
));
_p
->
instrumentPageWidgetList
.
append
(
QVariant
::
fromValue
(
_p
->
vibrationPageWidgetInfo
));
}
return
_p
->
instrumentPageWidgetList
;
}
int
QGCCorePlugin
::
defaultSettings
()
{
return
0
;
...
...
src/api/QGCCorePlugin.h
View file @
57225710
...
...
@@ -40,6 +40,7 @@ public:
~
QGCCorePlugin
();
Q_PROPERTY
(
QVariantList
settingsPages
READ
settingsPages
NOTIFY
settingsPagesChanged
)
Q_PROPERTY
(
QVariantList
instrumentPages
READ
instrumentPages
NOTIFY
instrumentPagesChanged
)
Q_PROPERTY
(
int
defaultSettings
READ
defaultSettings
CONSTANT
)
Q_PROPERTY
(
QGCOptions
*
options
READ
options
CONSTANT
)
...
...
@@ -54,6 +55,10 @@ public:
/// @return A list of QGCSettings
virtual
QVariantList
&
settingsPages
(
void
);
/// The list of PageWidget pages shown in the instrument panel
/// @return A list of QmlPageInfo
virtual
QVariantList
&
instrumentPages
(
void
);
/// The default settings panel to show
/// @return The settings index
virtual
int
defaultSettings
(
void
);
...
...
@@ -107,6 +112,7 @@ public:
signals:
void
settingsPagesChanged
(
void
);
void
instrumentPagesChanged
(
void
);
void
showTouchAreasChanged
(
bool
showTouchAreas
);
void
showAdvancedUIChanged
(
bool
showAdvancedUI
);
...
...
src/api/Q
GCSettings
.cc
→
src/api/Q
mlPageInfo
.cc
View file @
57225710
...
...
@@ -7,15 +7,13 @@
*
****************************************************************************/
#include "Q
GCSettings
.h"
#include "Q
mlPageInfo
.h"
/// @file
/// @brief Core Plugin Interface for QGroundControl. Settings element.
/// @author Gus Grubba <mavlink@grubba.com>
QGCSettings
::
QGCSettings
(
QString
title
,
QUrl
url
,
QUrl
icon
)
:
_title
(
title
)
,
_url
(
url
)
,
_icon
(
icon
)
QmlPageInfo
::
QmlPageInfo
(
QString
title
,
QUrl
url
,
QUrl
icon
,
QObject
*
parent
)
:
QObject
(
parent
)
,
_title
(
title
)
,
_url
(
url
)
,
_icon
(
icon
)
{
}
src/api/Q
GCSettings
.h
→
src/api/Q
mlPageInfo
.h
View file @
57225710
...
...
@@ -12,23 +12,21 @@
#include <QObject>
#include <QUrl>
/// @file
/// @brief Core Plugin Interface for QGroundControl. Settings element.
/// @author Gus Grubba <mavlink@grubba.com>
class
QGCSettings
:
public
QObject
/// Represents a
class
QmlPageInfo
:
public
QObject
{
Q_OBJECT
public:
Q
GCSettings
(
QString
title
,
QUrl
url
,
QUrl
icon
=
QUrl
()
);
Q
mlPageInfo
(
QString
title
,
QUrl
url
,
QUrl
icon
=
QUrl
(),
QObject
*
parent
=
NULL
);
Q_PROPERTY
(
QString
title
READ
title
CONSTANT
)
Q_PROPERTY
(
QUrl
url
READ
url
CONSTANT
)
Q_PROPERTY
(
QUrl
icon
READ
icon
CONSTANT
)
Q_PROPERTY
(
QString
title
READ
title
CONSTANT
)
///< Title for page
Q_PROPERTY
(
QUrl
url
READ
url
CONSTANT
)
///< Qml source code
Q_PROPERTY
(
QUrl
icon
READ
icon
CONSTANT
)
///< Icon for page
virtual
QString
title
()
{
return
_title
;
}
virtual
QUrl
url
()
{
return
_url
;
}
virtual
QUrl
icon
()
{
return
_icon
;
}
virtual
QString
title
()
{
return
_title
;
}
virtual
QUrl
url
()
{
return
_url
;
}
virtual
QUrl
icon
()
{
return
_icon
;
}
protected:
QString
_title
;
...
...
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