Commit 1ec20628 authored by Gus Grubba's avatar Gus Grubba Committed by GitHub

Merge pull request #4778 from DonLakeFlyer/CorePluginFix

Fix problems with core plugin virtually
parents 0dcb10c7 b564708d
......@@ -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<QGCCorePlugin>("QGroundControl.QGCCorePlugin", 1, 0, "QGCCorePlugin", "Reference only");
qmlRegisterUncreatableType<QGCOptions>("QGroundControl.QGCOptions", 1, 0, "QGCOptions", "Reference only");
QGCTool::setToolbox(toolbox);
QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership);
qmlRegisterUncreatableType<QGCCorePlugin>("QGroundControl.QGCCorePlugin", 1, 0, "QGCCorePlugin", "Reference only");
qmlRegisterUncreatableType<QGCOptions>("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);
}
}
......@@ -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);
......
......@@ -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);
......
......@@ -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
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment