diff --git a/src/api/QGCCorePlugin.cc b/src/api/QGCCorePlugin.cc index d38bfb82b507ccd8ec98b5a2a606c2e4e2213182..d0685823a5c713ac0e2b635f7bf8cd000f3d4acc 100644 --- a/src/api/QGCCorePlugin.cc +++ b/src/api/QGCCorePlugin.cc @@ -29,10 +29,10 @@ public: , pOfflineMaps(NULL) , pMAVLink(NULL) , pConsole(NULL) -#if defined(QT_DEBUG) + #if defined(QT_DEBUG) , pMockLink(NULL) , pDebug(NULL) -#endif + #endif , defaultOptions(NULL) { } @@ -89,10 +89,10 @@ QGCCorePlugin::QGCCorePlugin(QGCApplication *app) void QGCCorePlugin::setToolbox(QGCToolbox *toolbox) { - QGCTool::setToolbox(toolbox); - QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership); - qmlRegisterUncreatableType("QGroundControl.QGCCorePlugin", 1, 0, "QGCCorePlugin", "Reference only"); - qmlRegisterUncreatableType("QGroundControl.QGCOptions", 1, 0, "QGCOptions", "Reference only"); + QGCTool::setToolbox(toolbox); + QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership); + qmlRegisterUncreatableType("QGroundControl.QGCCorePlugin", 1, 0, "QGCCorePlugin", "Reference only"); + qmlRegisterUncreatableType("QGroundControl.QGCOptions", 1, 0, "QGCOptions", "Reference only"); } QVariantList &QGCCorePlugin::settingsPages() @@ -101,33 +101,33 @@ QVariantList &QGCCorePlugin::settingsPages() if(!_p->pGeneral) { //-- Default Settings _p->pGeneral = new QGCSettings(tr("General"), - QUrl::fromUserInput("qrc:/qml/GeneralSettings.qml"), - QUrl::fromUserInput("qrc:/res/gear-white.svg")); + QUrl::fromUserInput("qrc:/qml/GeneralSettings.qml"), + QUrl::fromUserInput("qrc:/res/gear-white.svg")); _p->settingsList.append(QVariant::fromValue((QGCSettings*)_p->pGeneral)); _p->pCommLinks = new QGCSettings(tr("Comm Links"), - QUrl::fromUserInput("qrc:/qml/LinkSettings.qml"), - QUrl::fromUserInput("qrc:/res/waves.svg")); + QUrl::fromUserInput("qrc:/qml/LinkSettings.qml"), + QUrl::fromUserInput("qrc:/res/waves.svg")); _p->settingsList.append(QVariant::fromValue((QGCSettings*)_p->pCommLinks)); _p->pOfflineMaps = new QGCSettings(tr("Offline Maps"), - QUrl::fromUserInput("qrc:/qml/OfflineMap.qml"), - QUrl::fromUserInput("qrc:/res/waves.svg")); + QUrl::fromUserInput("qrc:/qml/OfflineMap.qml"), + QUrl::fromUserInput("qrc:/res/waves.svg")); _p->settingsList.append(QVariant::fromValue((QGCSettings*)_p->pOfflineMaps)); _p->pMAVLink = new QGCSettings(tr("MAVLink"), - QUrl::fromUserInput("qrc:/qml/MavlinkSettings.qml"), - QUrl::fromUserInput("qrc:/res/waves.svg")); + QUrl::fromUserInput("qrc:/qml/MavlinkSettings.qml"), + QUrl::fromUserInput("qrc:/res/waves.svg")); _p->settingsList.append(QVariant::fromValue((QGCSettings*)_p->pMAVLink)); _p->pConsole = new QGCSettings(tr("Console"), - QUrl::fromUserInput("qrc:/qml/QGroundControl/Controls/AppMessages.qml")); + QUrl::fromUserInput("qrc:/qml/QGroundControl/Controls/AppMessages.qml")); _p->settingsList.append(QVariant::fromValue((QGCSettings*)_p->pConsole)); - #if defined(QT_DEBUG) +#if defined(QT_DEBUG) //-- These are always present on Debug builds _p->pMockLink = new QGCSettings(tr("Mock Link"), - QUrl::fromUserInput("qrc:/qml/MockLink.qml")); + QUrl::fromUserInput("qrc:/qml/MockLink.qml")); _p->settingsList.append(QVariant::fromValue((QGCSettings*)_p->pMockLink)); _p->pDebug = new QGCSettings(tr("Debug"), - QUrl::fromUserInput("qrc:/qml/DebugWindow.qml")); + QUrl::fromUserInput("qrc:/qml/DebugWindow.qml")); _p->settingsList.append(QVariant::fromValue((QGCSettings*)_p->pDebug)); - #endif +#endif } return _p->settingsList; } @@ -168,3 +168,19 @@ bool QGCCorePlugin::adjustSettingMetaData(FactMetaData& metaData) return true; // Show setting in ui } + +void QGCCorePlugin::setShowTouchAreas(bool show) +{ + if (show != _showTouchAreas) { + _showTouchAreas = show; + emit showTouchAreasChanged(show); + } +} + +void QGCCorePlugin::setShowAdvancedUI(bool show) +{ + if (show != _showAdvancedUI) { + _showAdvancedUI = show; + emit showAdvancedUIChanged(show); + } +} diff --git a/src/api/QGCCorePlugin.h b/src/api/QGCCorePlugin.h index 2786978e3a6ba46b58eb21a9b9ed7fdcfa93a11e..8605c6ec4a5cea075e6dc24a19e525caa994586e 100644 --- a/src/api/QGCCorePlugin.h +++ b/src/api/QGCCorePlugin.h @@ -37,8 +37,8 @@ public: 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) + Q_PROPERTY(bool showTouchAreas READ showTouchAreas WRITE setShowTouchAreas NOTIFY showTouchAreasChanged) + Q_PROPERTY(bool showAdvancedUI READ showAdvancedUI WRITE setShowAdvancedUI NOTIFY showAdvancedUIChanged) Q_PROPERTY(QString brandImageIndoor READ brandImageIndoor CONSTANT) Q_PROPERTY(QString brandImageOutdoor READ brandImageIndoor CONSTANT) @@ -71,6 +71,11 @@ public: /// Return the resource file which contains the brand image for for Outdoor theme. virtual QString brandImageOutdoor(void) const { return QString(); } + bool showTouchAreas(void) const { return _showTouchAreas; } + bool showAdvancedUI(void) const { return _showAdvancedUI; } + void setShowTouchAreas(bool show); + void setShowAdvancedUI(bool show); + // Override from QGCTool void setToolbox (QGCToolbox *toolbox); diff --git a/src/api/QGCOptions.h b/src/api/QGCOptions.h index 9c5b54600bdbb604e553de3a2265d40f22320321..1a41a0ee59a7c01a5373d18ea0d2728db6194f5f 100644 --- a/src/api/QGCOptions.h +++ b/src/api/QGCOptions.h @@ -52,12 +52,12 @@ public: virtual CustomInstrumentWidget* instrumentWidget(); /// By returning false you can hide the following sensor calibration pages - bool showSensorCalibrationCompass () const { return true; } - bool showSensorCalibrationGyro () const { return true; } - bool showSensorCalibrationAccel () const { return true; } - bool showSensorCalibrationLevel () const { return true; } - bool showSensorCalibrationAirspeed () const { return true; } - bool showSensorCalibrationOrient () const { return true; } + virtual bool showSensorCalibrationCompass () const { return true; } + virtual bool showSensorCalibrationGyro () const { return true; } + virtual bool showSensorCalibrationAccel () const { return true; } + virtual bool showSensorCalibrationLevel () const { return true; } + virtual bool showSensorCalibrationAirspeed () const { return true; } + virtual bool showSensorCalibrationOrient () const { return true; } signals: void showSensorCalibrationCompassChanged (bool show); diff --git a/src/ui/toolbar/MainToolBar.qml b/src/ui/toolbar/MainToolBar.qml index 548c451a05cfe776f777b5b0f8b95be826fecebb..694f73013bc1e2d42fd6869d350a58d20042dc9d 100644 --- a/src/ui/toolbar/MainToolBar.qml +++ b/src/ui/toolbar/MainToolBar.qml @@ -67,28 +67,6 @@ Rectangle { flyButton.checked = true } - // Easter egg mechanism - MouseArea { - anchors.fill: parent - onClicked: { - console.log("easter egg click", ++_clickCount) - eggTimer.restart() - if (_clickCount == 5) { - QGroundControl.corePlugin.showAdvancedUI = true - } else if (_clickCount == 7) { - QGroundControl.corePlugin.showTouchAreas = true - } - } - - property int _clickCount: 0 - - Timer { - id: eggTimer - interval: 1000 - onTriggered: parent._clickCount = 0 - } - } - /// Bottom single pixel divider Rectangle { anchors.left: parent.left diff --git a/src/ui/toolbar/MainToolBarIndicators.qml b/src/ui/toolbar/MainToolBarIndicators.qml index 0aabdf2b8b2c27239abdbc3be12eb032191a9527..9680e039e0cc397de61f13a2da035bf765872c93 100644 --- a/src/ui/toolbar/MainToolBarIndicators.qml +++ b/src/ui/toolbar/MainToolBarIndicators.qml @@ -25,6 +25,28 @@ Item { QGCPalette { id: qgcPal } + // Easter egg mechanism + MouseArea { + anchors.fill: parent + onClicked: { + console.log("easter egg click", ++_clickCount) + eggTimer.restart() + if (_clickCount == 5) { + QGroundControl.corePlugin.showAdvancedUI = true + } else if (_clickCount == 7) { + QGroundControl.corePlugin.showTouchAreas = true + } + } + + property int _clickCount: 0 + + Timer { + id: eggTimer + interval: 1000 + onTriggered: parent._clickCount = 0 + } + } + QGCLabel { id: waitForVehicle anchors.verticalCenter: parent.verticalCenter