diff --git a/src/QmlControls/QGCMouseArea.qml b/src/QmlControls/QGCMouseArea.qml index ee0bcb58311582cdb34d6faa68a102ab119a8855..4c601f196cc039dbc26e30a5b36ae341284abdaf 100644 --- a/src/QmlControls/QGCMouseArea.qml +++ b/src/QmlControls/QGCMouseArea.qml @@ -25,7 +25,7 @@ MouseArea { Rectangle { anchors.fill: parent border.color: "red" - border.width: QGroundControl.showTouchAreas ? 1 : 0 + border.width: QGroundControl.corePlugin.showTouchAreas ? 1 : 0 color: "transparent" } } diff --git a/src/QmlControls/QGroundControlQmlGlobal.cc b/src/QmlControls/QGroundControlQmlGlobal.cc index 59a4579c3fbb18ba04db6c6e1399377b16299510..af893774ea8496833310aeb7d2c8f17394ad3c1e 100644 --- a/src/QmlControls/QGroundControlQmlGlobal.cc +++ b/src/QmlControls/QGroundControlQmlGlobal.cc @@ -32,8 +32,6 @@ QGroundControlQmlGlobal::QGroundControlQmlGlobal(QGCApplication* app) , _corePlugin(NULL) , _firmwarePluginManager(NULL) , _settingsManager(NULL) - , _showTouchAreas(false) - , _showAdvancedUI(false) { // We clear the parent on this object since we run into shutdown problems caused by hybrid qml app. Instead we let it leak on shutdown. setParent(NULL); diff --git a/src/QmlControls/QGroundControlQmlGlobal.h b/src/QmlControls/QGroundControlQmlGlobal.h index 24c0aa58c31322c4be861645373825bb66686749..047e3f86e94e6e61b3ce4b8dd6d39ba35b69ef8c 100644 --- a/src/QmlControls/QGroundControlQmlGlobal.h +++ b/src/QmlControls/QGroundControlQmlGlobal.h @@ -73,9 +73,6 @@ public: Q_PROPERTY(QString qgcVersion READ qgcVersion CONSTANT) - Q_PROPERTY(bool showTouchAreas MEMBER _showTouchAreas NOTIFY showTouchAreasChanged) - Q_PROPERTY(bool showAdvancedUI MEMBER _showAdvancedUI NOTIFY showAdvancedUIChanged) - Q_INVOKABLE void saveGlobalSetting (const QString& key, const QString& value); Q_INVOKABLE QString loadGlobalSetting (const QString& key, const QString& defaultValue); Q_INVOKABLE void saveBoolGlobalSetting (const QString& key, bool value); @@ -156,9 +153,6 @@ public: QString qgcVersion(void) const { return qgcApp()->applicationVersion(); } - bool showTouchAreas(void) const { return _showTouchAreas; } ///< Show visible extents of touch areas - bool showAdvancedUI(void) const { return _showAdvancedUI; } ///< Show hidden advanced UI - // Overrides from QGCTool virtual void setToolbox(QGCToolbox* toolbox); @@ -168,8 +162,6 @@ signals: void mavlinkSystemIDChanged (int id); void flightMapPositionChanged (QGeoCoordinate flightMapPosition); void flightMapZoomChanged (double flightMapZoom); - void showTouchAreasChanged (bool showTouchAreas); - void showAdvancedUIChanged (bool showAdvancedUI); private: FlightMapSettings* _flightMapSettings; @@ -186,9 +178,6 @@ private: QGeoCoordinate _flightMapPosition; double _flightMapZoom; - - bool _showTouchAreas; - bool _showAdvancedUI; }; #endif diff --git a/src/api/QGCCorePlugin.cc b/src/api/QGCCorePlugin.cc index f547ede2a7b68abfbb6fad7b5a29bd1a7a55e6a3..02100348e7305d02ca9b2241cb919a11c6b43a64 100644 --- a/src/api/QGCCorePlugin.cc +++ b/src/api/QGCCorePlugin.cc @@ -36,6 +36,7 @@ public: , defaultOptions(NULL) { } + ~QGCCorePlugin_p() { if(pGeneral) @@ -57,6 +58,7 @@ public: if(defaultOptions) delete defaultOptions; } + QGCSettings* pGeneral; QGCSettings* pCommLinks; QGCSettings* pOfflineMaps; @@ -79,6 +81,8 @@ QGCCorePlugin::~QGCCorePlugin() QGCCorePlugin::QGCCorePlugin(QGCApplication *app) : QGCTool(app) + , _showTouchAreas(false) + , _showAdvancedUI(false) { _p = new QGCCorePlugin_p; } @@ -91,7 +95,7 @@ void QGCCorePlugin::setToolbox(QGCToolbox *toolbox) qmlRegisterUncreatableType("QGroundControl.QGCOptions", 1, 0, "QGCOptions", "Reference only"); } -QVariantList &QGCCorePlugin::settings() +QVariantList &QGCCorePlugin::settingsPages() { //-- If this hasn't been overridden, create default set of settings if(!_p->pGeneral) { diff --git a/src/api/QGCCorePlugin.h b/src/api/QGCCorePlugin.h index 2f5d3926fa903af69e58e20eb5a19fdb9748df7e..b78ee0617a3110dd502c56df1b76417c62f7618a 100644 --- a/src/api/QGCCorePlugin.h +++ b/src/api/QGCCorePlugin.h @@ -33,13 +33,16 @@ public: QGCCorePlugin(QGCApplication* app); ~QGCCorePlugin(); - Q_PROPERTY(QVariantList settings READ settings CONSTANT) + Q_PROPERTY(QVariantList settingsPages READ settingsPages NOTIFY settingsPagesChanged) Q_PROPERTY(int defaultSettings READ defaultSettings CONSTANT) Q_PROPERTY(QGCOptions* options READ options CONSTANT) + Q_PROPERTY(bool showTouchAreas MEMBER _showTouchAreas NOTIFY showTouchAreasChanged) + Q_PROPERTY(bool showAdvancedUI MEMBER _showAdvancedUI NOTIFY showAdvancedUIChanged) + /// The list of settings under the Settings Menu /// @return A list of QGCSettings - virtual QVariantList& settings (); + virtual QVariantList& settingsPages (); /// The default settings panel to show /// @return The settings index @@ -61,6 +64,16 @@ public: // Override from QGCTool void setToolbox (QGCToolbox *toolbox); + +signals: + void settingsPagesChanged (void); + void showTouchAreasChanged (bool showTouchAreas); + void showAdvancedUIChanged (bool showAdvancedUI); + +protected: + bool _showTouchAreas; + bool _showAdvancedUI; + private: - QGCCorePlugin_p* _p; + QGCCorePlugin_p* _p; }; diff --git a/src/ui/toolbar/MainToolBar.qml b/src/ui/toolbar/MainToolBar.qml index 610cb6e45da0394124119fc0ff8810be4f841f25..47b1d419fbbadc5112078e9748069667d066b9d4 100644 --- a/src/ui/toolbar/MainToolBar.qml +++ b/src/ui/toolbar/MainToolBar.qml @@ -74,9 +74,9 @@ Rectangle { console.log("easter egg click", ++_clickCount) eggTimer.restart() if (_clickCount == 5) { - QGroundControl.showAdvancedUI = true + QGroundControl.corePlugin.showAdvancedUI = true } else if (_clickCount == 7) { - QGroundControl.showTouchAreas = true + QGroundControl.corePlugin.showTouchAreas = true } }