Commit c18132c8 authored by Gus Grubba's avatar Gus Grubba Committed by Lorenz Meier

Disable MAVLink inspector for platforms that do not support it.

Move analyze page list model to the core plugin.
parent 05e7be62
......@@ -25,6 +25,7 @@ linux {
DEFINES += QGC_ENABLE_NFC RW_SUPPORT
DEFINES += QGC_GST_TAISYNC_ENABLED
DEFINES += QGC_GST_MICROHARD_ENABLED
DEFINES += QGC_ENABLE_MAVLINK_INSPECTOR
linux-clang {
message("Linux clang")
QMAKE_CXXFLAGS += -Qunused-arguments -fcolor-diagnostics
......@@ -52,6 +53,7 @@ linux {
message("Android Arm 32 bit build")
} else:equals(ANDROID_TARGET_ARCH, arm64-v8a) {
DEFINES += __androidArm64__
DEFINES += QGC_ENABLE_MAVLINK_INSPECTOR
message("Android Arm 64 bit build")
} else:equals(ANDROID_TARGET_ARCH, x86) {
CONFIG += Androidx86Build
......@@ -71,6 +73,7 @@ linux {
DEFINES += __STDC_LIMIT_MACROS
DEFINES += QGC_GST_TAISYNC_ENABLED
DEFINES += QGC_GST_MICROHARD_ENABLED
DEFINES += QGC_ENABLE_MAVLINK_INSPECTOR
} else {
error("Unsupported Windows toolchain, only Visual Studio 2017 64 bit is supported")
}
......@@ -82,6 +85,7 @@ linux {
CONFIG -= x86
DEFINES += QGC_GST_TAISYNC_ENABLED
DEFINES += QGC_GST_MICROHARD_ENABLED
DEFINES += QGC_ENABLE_MAVLINK_INSPECTOR
equals(QT_MAJOR_VERSION, 5) | greaterThan(QT_MINOR_VERSION, 5) {
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.7
} else {
......
......@@ -263,7 +263,6 @@ QT += \
svg \
widgets \
xml \
charts \
texttospeech
# Multimedia only used if QVC is enabled
......@@ -573,7 +572,6 @@ HEADERS += \
src/AnalyzeView/LogDownloadController.h \
src/AnalyzeView/PX4LogParser.h \
src/AnalyzeView/ULogParser.h \
src/AnalyzeView/MAVLinkInspectorController.h \
src/AnalyzeView/MavlinkConsoleController.h \
src/Audio/AudioOutput.h \
src/Camera/QGCCameraControl.h \
......@@ -815,7 +813,6 @@ SOURCES += \
src/AnalyzeView/LogDownloadController.cc \
src/AnalyzeView/PX4LogParser.cc \
src/AnalyzeView/ULogParser.cc \
src/AnalyzeView/MAVLinkInspectorController.cc \
src/AnalyzeView/MavlinkConsoleController.cc \
src/Audio/AudioOutput.cc \
src/Camera/QGCCameraControl.cc \
......@@ -1230,6 +1227,17 @@ SOURCES += \
src/FactSystem/ParameterManager.cc \
src/FactSystem/SettingsFact.cc \
#-------------------------------------------------------------------------------------
# MAVLink Inspector
contains (DEFINES, QGC_ENABLE_MAVLINK_INSPECTOR) {
HEADERS += \
src/AnalyzeView/MAVLinkInspectorController.h
SOURCES += \
src/AnalyzeView/MAVLinkInspectorController.cc
QT += \
charts
}
#-------------------------------------------------------------------------------------
# Taisync
contains (DEFINES, QGC_GST_TAISYNC_ENABLED) {
......
......@@ -91,64 +91,21 @@ Rectangle {
visible: !ScreenTools.isShortScreen
}
ListModel {
id: desktopModel
ListElement {
buttonImage: "/qmlimages/LogDownloadIcon"
buttonText: qsTr("Log Download")
pageSource: "LogDownloadPage.qml"
}
ListElement {
buttonImage: "/qmlimages/GeoTagIcon"
buttonText: qsTr("GeoTag Images")
pageSource: "GeoTagPage.qml"
}
ListElement {
buttonImage: "/qmlimages/MavlinkConsoleIcon"
buttonText: qsTr("MAVLink Console")
pageSource: "MavlinkConsolePage.qml"
}
ListElement {
buttonImage: "/qmlimages/MAVLinkInspector"
buttonText: qsTr("MAVLink Inspector")
pageSource: "MAVLinkInspectorPage.qml"
}
}
ListModel {
id: mobileModel
ListElement {
buttonImage: "/qmlimages/LogDownloadIcon"
buttonText: qsTr("Log Download")
pageSource: "LogDownloadPage.qml"
}
ListElement {
buttonImage: "/qmlimages/MavlinkConsoleIcon"
buttonText: qsTr("MAVLink Console")
pageSource: "MavlinkConsolePage.qml"
}
ListElement {
buttonImage: "/qmlimages/MAVLinkInspector"
buttonText: qsTr("MAVLink Inspector")
pageSource: "MAVLinkInspectorPage.qml"
}
}
Repeater {
id: buttonRepeater
model: ScreenTools.isMobile ? mobileModel : desktopModel
model: QGroundControl.corePlugin ? QGroundControl.corePlugin.analyzePages : []
Component.onCompleted: itemAt(0).checked = true
SubMenuButton {
id: subMenu
imageResource: buttonImage
imageResource: modelData.icon
setupIndicator: false
exclusiveGroup: setupButtonGroup
text: buttonText
text: modelData.title
property var window: analyzeWidgetWindow
property var loader: analyzeWidgetLoader
onClicked: {
_curIndex = index
panelLoader.source = pageSource
panelLoader.source = modelData.url
checked = true
}
Window {
......@@ -156,7 +113,7 @@ Rectangle {
width: ScreenTools.defaultFontPixelWidth * 100
height: ScreenTools.defaultFontPixelHeight * 40
visible: false
title: buttonText
title: modelData.title
Rectangle {
color: qgcPal.window
anchors.fill: parent
......@@ -169,7 +126,7 @@ Rectangle {
analyzeWidgetWindow.visible = false
analyzeWidgetLoader.source = ""
_curIndex = index
panelLoader.source = pageSource
panelLoader.source = modelData.url
subMenu.visible = true
subMenu.checked = true
}
......
......@@ -497,7 +497,9 @@ void QGCApplication::_initCommon()
qmlRegisterUncreatableType<CameraCalc> (kQGroundControl, 1, 0, "CameraCalc", kRefOnly);
qmlRegisterUncreatableType<LogReplayLink> (kQGroundControl, 1, 0, "LogReplayLink", kRefOnly);
qmlRegisterType<LogReplayLinkController> (kQGroundControl, 1, 0, "LogReplayLinkController");
qmlRegisterUncreatableType<MAVLinkChartController> (kQGroundControl, 1, 0, "MAVLinkChart", kRefOnly);
#if defined(QGC_ENABLE_MAVLINK_INSPECTOR)
qmlRegisterUncreatableType<MAVLinkChartController> (kQGroundControl, 1, 0, "MAVLinkChart", kRefOnly);
#endif
#if defined(QGC_ENABLE_PAIRING)
qmlRegisterUncreatableType<PairingManager> (kQGroundControl, 1, 0, "PairingManager", kRefOnly);
#endif
......@@ -534,8 +536,9 @@ void QGCApplication::_initCommon()
#endif
qmlRegisterType<GeoTagController> (kQGCControllers, 1, 0, "GeoTagController");
qmlRegisterType<MavlinkConsoleController> (kQGCControllers, 1, 0, "MavlinkConsoleController");
#if defined(QGC_ENABLE_MAVLINK_INSPECTOR)
qmlRegisterType<MAVLinkInspectorController> (kQGCControllers, 1, 0, "MAVLinkInspectorController");
#endif
// Register Qml Singletons
qmlRegisterSingletonType<QGroundControlQmlGlobal> ("QGroundControl", 1, 0, "QGroundControl", qgroundcontrolQmlGlobalSingletonFactory);
qmlRegisterSingletonType<ScreenToolsController> ("QGroundControl.ScreenToolsController", 1, 0, "ScreenToolsController", screenToolsControllerSingletonFactory);
......
......@@ -102,6 +102,7 @@ public:
Q_PROPERTY(bool isVersionCheckEnabled READ isVersionCheckEnabled WRITE setIsVersionCheckEnabled NOTIFY isVersionCheckEnabledChanged)
Q_PROPERTY(int mavlinkSystemID READ mavlinkSystemID WRITE setMavlinkSystemID NOTIFY mavlinkSystemIDChanged)
Q_PROPERTY(bool hasAPMSupport READ hasAPMSupport CONSTANT)
Q_PROPERTY(bool hasMAVLinkInspector READ hasMAVLinkInspector CONSTANT)
Q_PROPERTY(QGeoCoordinate flightMapPosition READ flightMapPosition WRITE setFlightMapPosition NOTIFY flightMapPositionChanged)
Q_PROPERTY(double flightMapZoom READ flightMapZoom WRITE setFlightMapZoom NOTIFY flightMapZoomChanged)
......@@ -221,6 +222,12 @@ public:
bool hasAPMSupport () { return true; }
#endif
#if defined(QGC_ENABLE_MAVLINK_INSPECTOR)
bool hasMAVLinkInspector () { return true; }
#else
bool hasMAVLinkInspector () { return false; }
#endif
int supportedFirmwareCount ();
int supportedVehicleCount ();
bool px4ProFirmwareSupported ();
......
......@@ -99,6 +99,7 @@ public:
QGCOptions* defaultOptions = nullptr;
QVariantList settingsList;
QVariantList analyzeList;
QVariantList instrumentPageWidgetList;
QmlObjectListModel _emptyCustomMapItems;
......@@ -291,6 +292,21 @@ QVariantList& QGCCorePlugin::instrumentPages()
return _p->instrumentPageWidgetList;
}
QVariantList& QGCCorePlugin::analyzePages()
{
if (!_p->analyzeList.count()) {
_p->analyzeList.append(QVariant::fromValue(new QmlComponentInfo(tr("Log Download"), QUrl::fromUserInput("qrc:/qml/LogDownloadPage.qml"), QUrl::fromUserInput("qrc:/qmlimages/LogDownloadIcon"))));
#if !defined(__mobile__)
_p->analyzeList.append(QVariant::fromValue(new QmlComponentInfo(tr("GeoTag Images"), QUrl::fromUserInput("qrc:/qml/GeoTagPage.qml"), QUrl::fromUserInput("qrc:/qmlimages/GeoTagIcon"))));
#endif
_p->analyzeList.append(QVariant::fromValue(new QmlComponentInfo(tr("MAVLink Console"), QUrl::fromUserInput("qrc:/qml/MavlinkConsolePage.qml"), QUrl::fromUserInput("qrc:/qmlimages/MavlinkConsoleIcon"))));
#if defined(QGC_ENABLE_MAVLINK_INSPECTOR)
_p->analyzeList.append(QVariant::fromValue(new QmlComponentInfo(tr("MAVLink Inspector"),QUrl::fromUserInput("qrc:/qml/MAVLinkInspectorPage.qml"), QUrl::fromUserInput("qrc:/qmlimages/MAVLinkInspector"))));
#endif
}
return _p->analyzeList;
}
int QGCCorePlugin::defaultSettings()
{
return 0;
......
......@@ -44,6 +44,7 @@ public:
~QGCCorePlugin();
Q_PROPERTY(QVariantList settingsPages READ settingsPages NOTIFY settingsPagesChanged)
Q_PROPERTY(QVariantList analyzePages READ analyzePages NOTIFY analyzePagesChanged)
Q_PROPERTY(QVariantList instrumentPages READ instrumentPages NOTIFY instrumentPagesChanged)
Q_PROPERTY(int defaultSettings READ defaultSettings CONSTANT)
Q_PROPERTY(QGCOptions* options READ options CONSTANT)
......@@ -60,6 +61,10 @@ public:
/// @return A list of QGCSettings
virtual QVariantList& settingsPages();
/// The list of pages/buttons under the Analyze Menu
/// @return A list of QmlPageInfo
virtual QVariantList& analyzePages();
/// The list of PageWidget pages shown in the instrument panel
/// @return A list of QmlPageInfo
virtual QVariantList& instrumentPages();
......@@ -158,6 +163,7 @@ public:
signals:
void settingsPagesChanged ();
void analyzePagesChanged ();
void instrumentPagesChanged ();
void showTouchAreasChanged (bool showTouchAreas);
void showAdvancedUIChanged (bool showAdvancedUI);
......
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