From fe015311bb147d4e4b4fcab985b20fd5de7485d8 Mon Sep 17 00:00:00 2001 From: dogmaphobic Date: Wed, 22 Apr 2015 19:11:02 -0400 Subject: [PATCH] First stab at iOS builds --- QGCApplication.pro | 115 ++++++---- QGCCommon.pri | 65 ++++-- QGCLocationPlugin.pro | 3 +- QGCSetup.pri | 2 +- ios/iOS-Info.plist | 37 ++++ .../Core/products/SelfadjointMatrixVector.h | 6 +- libs/opmapcontrol/opmapcontrol_external.pri | 206 +++++++++--------- src/QGCApplication.cc | 12 +- src/QGCFileDialog.cc | 12 +- src/QGCMessageBox.h | 4 +- src/QmlControls/MavManager.cc | 1 + src/QmlControls/ScreenTools.h | 4 + .../qgeocodingmanagerengineqgc.cpp | 1 + src/VehicleSetup/PX4Bootloader.cc | 4 - src/VehicleSetup/PX4FirmwareUpgradeThread.cc | 4 - src/VehicleSetup/SetupView.cc | 34 +-- src/comm/LinkConfiguration.cc | 6 + src/comm/LinkConfiguration.h | 2 + src/comm/LinkManager.cc | 13 ++ src/comm/LinkManager.h | 11 +- src/comm/QGCJSBSimLink.cc | 1 + src/comm/SerialLink.h | 1 + src/main.cc | 6 +- src/qgcunittest/UnitTest.h | 2 +- src/uas/UAS.cc | 30 ++- src/uas/UAS.h | 18 +- src/uas/UASInterface.h | 2 + src/ui/MainWindow.cc | 27 ++- src/ui/MainWindow.h | 8 +- src/ui/QGCCommConfiguration.cc | 6 + src/ui/QGCDataPlot2D.cc | 14 +- src/ui/QGCLinkConfiguration.cc | 2 + src/ui/QGCMAVLinkLogPlayer.cc | 2 + src/ui/SettingsDialog.cc | 10 +- src/ui/SettingsDialog.h | 2 +- src/ui/linechart/IncrementalPlot.cc | 2 +- src/ui/uas/UASView.cc | 3 + 37 files changed, 434 insertions(+), 244 deletions(-) create mode 100644 ios/iOS-Info.plist diff --git a/QGCApplication.pro b/QGCApplication.pro index c8575e3b0..27b68f301 100644 --- a/QGCApplication.pro +++ b/QGCApplication.pro @@ -20,6 +20,7 @@ include(QGCCommon.pri) TARGET = qgroundcontrol +TEMPLATE = app # Load additional config flags from user_config.pri exists(user_config.pri):infile(user_config.pri, CONFIG) { @@ -31,19 +32,15 @@ LinuxBuild { CONFIG += link_pkgconfig } -message(BASEDIR $$BASEDIR DESTDIR $$DESTDIR TARGET $$TARGET) - # QGC QtLocation plugin LIBS += -L$${LOCATION_PLUGIN_DESTDIR} LIBS += -l$${LOCATION_PLUGIN_NAME} -LinuxBuild|MacBuild|AndroidBuild { - PRE_TARGETDEPS += $${LOCATION_PLUGIN_DESTDIR}/lib$${LOCATION_PLUGIN_NAME}.a -} - WindowsBuild { PRE_TARGETDEPS += $${LOCATION_PLUGIN_DESTDIR}/$${LOCATION_PLUGIN_NAME}.lib +} else { + PRE_TARGETDEPS += $${LOCATION_PLUGIN_DESTDIR}/lib$${LOCATION_PLUGIN_NAME}.a } # Qt configuration @@ -51,13 +48,13 @@ WindowsBuild { CONFIG += qt \ thread -QT += network \ +QT += \ + network \ concurrent \ gui \ location \ opengl \ positioning \ - printsupport \ qml \ quick \ quickwidgets \ @@ -66,8 +63,10 @@ QT += network \ widgets \ xml \ -!AndroidBuild { - QT += serialport +!MobileBuild { + QT += \ + printsupport \ + serialport \ } contains(DEFINES, QGC_NOTIFY_TUNES_ENABLED) { @@ -83,8 +82,14 @@ QT += testlib MacBuild { QMAKE_INFO_PLIST = Custom-Info.plist - ICON = $$BASEDIR/resources/icons/macx.icns - QT += quickwidgets + ICON = $${BASEDIR}/resources/icons/macx.icns + OTHER_FILES += Custom-Info.plist +} + +iOSBuild { + QMAKE_INFO_PLIST = $${BASEDIR}/ios/iOS-Info.plist + ICON = $${BASEDIR}/resources/icons/macx.icns + OTHER_FILES += $${BASEDIR}/iOS-Info.plist } LinuxBuild { @@ -92,7 +97,7 @@ LinuxBuild { } WindowsBuild { - RC_FILE = $$BASEDIR/qgroundcontrol.rc + RC_FILE = $${BASEDIR}/qgroundcontrol.rc } # @@ -100,10 +105,12 @@ WindowsBuild { # DebugBuild { +!iOSBuild { CONFIG += console } +} -!AndroidBuild { +!MobileBuild { # qextserialport should not be used by general QGroundControl code. Use QSerialPort instead. This is only # here to support special case Firmware Upgrade code. include(libs/qextserialport/src/qextserialport.pri) @@ -186,10 +193,6 @@ FORMS += \ src/ui/mission/QGCMissionOther.ui \ src/ui/QGCCommConfiguration.ui \ src/ui/QGCDataPlot2D.ui \ - src/ui/QGCHilConfiguration.ui \ - src/ui/QGCHilFlightGearConfiguration.ui \ - src/ui/QGCHilJSBSimConfiguration.ui \ - src/ui/QGCHilXPlaneConfiguration.ui \ src/ui/QGCLinkConfiguration.ui \ src/ui/QGCMapRCToParamDialog.ui \ src/ui/QGCMAVLinkInspector.ui \ @@ -201,7 +204,6 @@ FORMS += \ src/ui/QGCUASFileViewMulti.ui \ src/ui/QGCUDPLinkConfiguration.ui \ src/ui/QGCWaypointListMulti.ui \ - src/ui/SerialSettings.ui \ src/ui/SettingsDialog.ui \ src/ui/uas/QGCUnconnectedInfoWidget.ui \ src/ui/uas/UASMessageView.ui \ @@ -216,11 +218,20 @@ FORMS += \ src/ui/WaypointList.ui \ src/ui/WaypointViewOnlyView.ui \ -!AndroidBuild { +!iOSBuild { +FORMS += \ + src/ui/SerialSettings.ui \ +} + +!MobileBuild { FORMS += \ src/ui/JoystickButton.ui \ src/ui/JoystickAxis.ui \ - src/ui/JoystickWidget.ui + src/ui/JoystickWidget.ui \ + src/ui/QGCHilConfiguration.ui \ + src/ui/QGCHilFlightGearConfiguration.ui \ + src/ui/QGCHilJSBSimConfiguration.ui \ + src/ui/QGCHilXPlaneConfiguration.ui \ } HEADERS += \ @@ -234,12 +245,7 @@ HEADERS += \ src/comm/MockLinkFileServer.h \ src/comm/MockLinkMissionItemHandler.h \ src/comm/ProtocolInterface.h \ - src/comm/QGCFlightGearLink.h \ - src/comm/QGCHilLink.h \ - src/comm/QGCJSBSimLink.h \ src/comm/QGCMAVLink.h \ - src/comm/QGCXPlaneLink.h \ - src/comm/SerialLink.h \ src/comm/TCPLink.h \ src/comm/UDPLink.h \ src/GAudioOutput.h \ @@ -306,10 +312,6 @@ HEADERS += \ src/ui/mission/QGCMissionOther.h \ src/ui/QGCCommConfiguration.h \ src/ui/QGCDataPlot2D.h \ - src/ui/QGCHilConfiguration.h \ - src/ui/QGCHilFlightGearConfiguration.h \ - src/ui/QGCHilJSBSimConfiguration.h \ - src/ui/QGCHilXPlaneConfiguration.h \ src/ui/QGCLinkConfiguration.h \ src/ui/QGCMainWindowAPConfigurator.h \ src/ui/QGCMapRCToParamDialog.h \ @@ -323,7 +325,6 @@ HEADERS += \ src/ui/QGCUASFileViewMulti.h \ src/ui/QGCUDPLinkConfiguration.h \ src/ui/QGCWaypointListMulti.h \ - src/ui/SerialConfigurationWindow.h \ src/ui/SettingsDialog.h \ src/ui/toolbar/MainToolBar.h \ src/ui/uas/QGCUnconnectedInfoWidget.h \ @@ -347,13 +348,27 @@ HEADERS += \ src/ViewWidgets/ViewWidgetController.h \ src/Waypoint.h \ -!AndroidBuild { +!iOSBuild { HEADERS += \ + src/comm/SerialLink.h \ + src/ui/SerialConfigurationWindow.h \ +} + +!MobileBuild { +HEADERS += \ + src/comm/QGCFlightGearLink.h \ + src/comm/QGCHilLink.h \ + src/comm/QGCJSBSimLink.h \ + src/comm/QGCXPlaneLink.h \ src/input/JoystickInput.h \ + src/ui/CameraView.h \ src/ui/JoystickAxis.h \ src/ui/JoystickButton.h \ src/ui/JoystickWidget.h \ - src/ui/CameraView.h \ + src/ui/QGCHilConfiguration.h \ + src/ui/QGCHilFlightGearConfiguration.h \ + src/ui/QGCHilJSBSimConfiguration.h \ + src/ui/QGCHilXPlaneConfiguration.h \ } SOURCES += \ @@ -365,10 +380,6 @@ SOURCES += \ src/comm/MockLink.cc \ src/comm/MockLinkFileServer.cc \ src/comm/MockLinkMissionItemHandler.cc \ - src/comm/QGCFlightGearLink.cc \ - src/comm/QGCJSBSimLink.cc \ - src/comm/QGCXPlaneLink.cc \ - src/comm/SerialLink.cc \ src/comm/TCPLink.cc \ src/comm/UDPLink.cc \ src/GAudioOutput.cc \ @@ -430,10 +441,6 @@ SOURCES += \ src/ui/mission/QGCMissionOther.cc \ src/ui/QGCCommConfiguration.cc \ src/ui/QGCDataPlot2D.cc \ - src/ui/QGCHilConfiguration.cc \ - src/ui/QGCHilFlightGearConfiguration.cc \ - src/ui/QGCHilJSBSimConfiguration.cc \ - src/ui/QGCHilXPlaneConfiguration.cc \ src/ui/QGCLinkConfiguration.cc \ src/ui/QGCMainWindowAPConfigurator.cc \ src/ui/QGCMapRCToParamDialog.cpp \ @@ -447,7 +454,6 @@ SOURCES += \ src/ui/QGCUASFileViewMulti.cc \ src/ui/QGCUDPLinkConfiguration.cc \ src/ui/QGCWaypointListMulti.cc \ - src/ui/SerialConfigurationWindow.cc \ src/ui/SettingsDialog.cc \ src/ui/toolbar/MainToolBar.cc \ src/ui/uas/QGCUnconnectedInfoWidget.cc \ @@ -471,13 +477,26 @@ SOURCES += \ src/ViewWidgets/ViewWidgetController.cc \ src/Waypoint.cc \ -!AndroidBuild { +!iOSBuild { SOURCES += \ + src/comm/SerialLink.cc \ + src/ui/SerialConfigurationWindow.cc \ +} + +!MobileBuild { +SOURCES += \ + src/comm/QGCFlightGearLink.cc \ + src/comm/QGCJSBSimLink.cc \ + src/comm/QGCXPlaneLink.cc \ src/input/JoystickInput.cc \ + src/ui/CameraView.cc \ src/ui/JoystickAxis.cc \ src/ui/JoystickButton.cc \ src/ui/JoystickWidget.cc \ - src/ui/CameraView.cc + src/ui/QGCHilConfiguration.cc \ + src/ui/QGCHilFlightGearConfiguration.cc \ + src/ui/QGCHilJSBSimConfiguration.cc \ + src/ui/QGCHilXPlaneConfiguration.cc \ } # @@ -494,7 +513,7 @@ DebugBuild|WindowsDebugAndRelease { HEADERS += src/QmlControls/QmlTestWidget.h SOURCES += src/QmlControls/QmlTestWidget.cc -!AndroidBuild { +!MobileBuild { INCLUDEPATH += \ src/qgcunittest @@ -536,7 +555,7 @@ SOURCES += \ src/qgcunittest/PX4RCCalibrationTest.cc \ } # DebugBuild|WindowsDebugAndRelease -} # AndroidBuild +} # MobileBuild # # AutoPilot Plugin Support @@ -569,7 +588,7 @@ HEADERS+= \ src/VehicleSetup/SetupView.h \ src/VehicleSetup/VehicleComponent.h \ -!AndroidBuild { +!MobileBuild { HEADERS += \ src/VehicleSetup/FirmwareUpgradeController.h \ src/VehicleSetup/PX4Bootloader.h \ @@ -599,7 +618,7 @@ SOURCES += \ src/VehicleSetup/SetupView.cc \ src/VehicleSetup/VehicleComponent.cc \ -!AndroidBuild { +!MobileBuild { SOURCES += \ src/VehicleSetup/FirmwareUpgradeController.cc \ src/VehicleSetup/PX4Bootloader.cc \ diff --git a/QGCCommon.pri b/QGCCommon.pri index f0f9516bb..7d3cdfb46 100644 --- a/QGCCommon.pri +++ b/QGCCommon.pri @@ -32,8 +32,7 @@ linux { CONFIG += LinuxBuild } else : android-g++ { message("Android build") - CONFIG += AndroidBuild - DEFINES += __mobile__ + CONFIG += AndroidBuild MobileBuild DEFINES += __android__ warning("Android build is experimental and not fully functional") } else { @@ -54,8 +53,17 @@ linux { } else { error("Unsupported Mac toolchain, only 64-bit LLVM+clang is supported") } +} else : ios { + message("iOS build") + CONFIG += iOSBuild MobileBuild app_bundle + DEFINES += __ios__ + warning("iOS build is experimental and not yet functional") } else { - error("Unsupported build platform, only Linux, Windows, and Mac are supported") + error("Unsupported build platform, only Linux, Windows, Android and Mac (Mac OS and iOS) are supported") +} + +MobileBuild { + DEFINES += __mobile__ } # Installer configuration @@ -86,29 +94,46 @@ win32:debug_and_release { # Setup our build directories -BASEDIR = $${IN_PWD} - -DebugBuild { - DESTDIR = $${OUT_PWD}/debug - BUILDDIR = $${OUT_PWD}/build-debug -} +BASEDIR = $$IN_PWD +DESTDIR = $${OUT_PWD}/debug +BUILDDIR = $${OUT_PWD}/build-debug ReleaseBuild { DESTDIR = $${OUT_PWD}/release BUILDDIR = $${OUT_PWD}/build-release } -OBJECTS_DIR = $${BUILDDIR}/obj -MOC_DIR = $${BUILDDIR}/moc -UI_DIR = $${BUILDDIR}/ui -RCC_DIR = $${BUILDDIR}/rcc -LANGUAGE = C++ +iOSBuild { + # For whatever reason, the iOS build fails with these set. Some files have the full, + # properly concatenaded path and file name while others have only the second portion, + # as if BUILDDIR was empty. + OBJECTS_DIR = ~/tmp/qgcfoo + MOC_DIR = ~/tmp/qgcfoo + UI_DIR = ~/tmp/qgcfoo + RCC_DIR = ~/tmp/qgcfoo +} else { + OBJECTS_DIR = $${BUILDDIR}/obj + MOC_DIR = $${BUILDDIR}/moc + UI_DIR = $${BUILDDIR}/ui + RCC_DIR = $${BUILDDIR}/rcc +} + +LANGUAGE = C++ + +AndroidBuild { + target.path = $$DESTDIR +} # We place the created plugin lib into the objects dir so that make clean will clean it as well -LOCATION_PLUGIN_DESTDIR = $${OBJECTS_DIR} -LOCATION_PLUGIN_NAME = QGeoServiceProviderFactoryQGC +iOSBuild { + LOCATION_PLUGIN_DESTDIR = ~/tmp/qgcfoo +} else { + LOCATION_PLUGIN_DESTDIR = $$OBJECTS_DIR +} + +LOCATION_PLUGIN_NAME = QGeoServiceProviderFactoryQGC -message(BASEDIR $$BASEDIR DESTDIR $$DESTDIR TARGET $$TARGET) +message(BASEDIR $$BASEDIR DESTDIR $$DESTDIR TARGET $$TARGET OUTPUT $$OUT_PWD) # Turn off serial port warnings DEFINES += _TTY_NOWARN_ @@ -121,6 +146,10 @@ AndroidBuild { DEFINES += __STDC_LIMIT_MACROS } +iOSBuild { + QMAKE_IOS_DEPLOYMENT_TARGET = 7.0 +} + MacBuild { CONFIG += x86_64 CONFIG -= x86 @@ -134,7 +163,6 @@ LinuxBuild { WindowsBuild { DEFINES += __STDC_LIMIT_MACROS - # Specify multi-process compilation within Visual Studio. # (drastically improves compilation times for multi-core computers) QMAKE_CXXFLAGS_DEBUG += -MP @@ -173,7 +201,6 @@ WindowsBuild { ReleaseBuild { DEFINES += QT_NO_DEBUG - WindowsBuild { # Use link time code generation for better optimization (I believe this is supported in MSVC Express, but not 100% sure) QMAKE_LFLAGS_LTCG = /LTCG diff --git a/QGCLocationPlugin.pro b/QGCLocationPlugin.pro index e2da91af3..26826fdd8 100644 --- a/QGCLocationPlugin.pro +++ b/QGCLocationPlugin.pro @@ -6,7 +6,7 @@ CONFIG += plugin static QT += location-private positioning-private network PLUGIN_TYPE = geoservices -DESTDIR = $${LOCATION_PLUGIN_DESTDIR} +DESTDIR = $${LOCATION_PLUGIN_DESTDIR} INCLUDEPATH += $$QT.location.includes @@ -30,4 +30,3 @@ SOURCES += \ OTHER_FILES += \ src/QtLocationPlugin/qgc_maps_plugin.json - diff --git a/QGCSetup.pri b/QGCSetup.pri index cce994557..bad8f2dc1 100644 --- a/QGCSetup.pri +++ b/QGCSetup.pri @@ -44,7 +44,7 @@ WindowsBuild { BASEDIR_COPY_RESOURCE_LIST = $$replace(BASEDIR,"/","\\") QMAKE_POST_LINK += $$escape_expand(\\n) $$QMAKE_COPY_DIR \"$$BASEDIR_COPY_RESOURCE_LIST\\flightgear\" \"$$DESTDIR_COPY_RESOURCE_LIST\\flightgear\" } else { - !AndroidBuild { + !MobileBuild { # Make sure to keep both sides of this if using the same set of directories QMAKE_POST_LINK += && $$QMAKE_COPY_DIR $$BASEDIR/flightgear $$DESTDIR_COPY_RESOURCE_LIST } diff --git a/ios/iOS-Info.plist b/ios/iOS-Info.plist new file mode 100644 index 000000000..977556aa2 --- /dev/null +++ b/ios/iOS-Info.plist @@ -0,0 +1,37 @@ + + + + + CFBundleIconFile + + CFBundlePackageType + APPL + CFBundleGetInfoString + Created by Qt/QMake + CFBundleSignature + ???? + CFBundleExecutable + qgroundcontrol + CFBundleIdentifier + org.qgroundcontrol.${PRODUCT_NAME:rfc1034identifier} + CFBundleDisplayName + ${PRODUCT_NAME} + CFBundleName + ${PRODUCT_NAME} + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1.0 + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UISupportedInterfaceOrientations + + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + NOTE + This file was generated by Qt/QMake. + + diff --git a/libs/eigen/Eigen/src/Core/products/SelfadjointMatrixVector.h b/libs/eigen/Eigen/src/Core/products/SelfadjointMatrixVector.h index c40e80f53..f698f67f9 100644 --- a/libs/eigen/Eigen/src/Core/products/SelfadjointMatrixVector.h +++ b/libs/eigen/Eigen/src/Core/products/SelfadjointMatrixVector.h @@ -79,8 +79,8 @@ EIGEN_DONT_INLINE void selfadjoint_matrix_vector_product(t0); @@ -147,7 +147,7 @@ EIGEN_DONT_INLINE void selfadjoint_matrix_vector_product("QGroundControl.Controllers", 1, 0, "SensorsComponentController"); qmlRegisterType("QGroundControl.Controllers", 1, 0, "PowerComponentController"); qmlRegisterType("QGroundControl.Controllers", 1, 0, "RadioComponentController"); -#ifndef __android__ +#ifndef __mobile__ qmlRegisterType("QGroundControl.Controllers", 1, 0, "FirmwareUpgradeController"); #endif @@ -710,4 +712,4 @@ void QGCApplication::_missingParamsDisplay(void) QGCMessageBox::critical("Missing Parameters", QString("Parameters missing from firmware: %1.\n\n" "You should quit QGroundControl immediately and update your firmware.").arg(params)); -} \ No newline at end of file +} diff --git a/src/QGCFileDialog.cc b/src/QGCFileDialog.cc index 398017bb1..6933afd9d 100644 --- a/src/QGCFileDialog.cc +++ b/src/QGCFileDialog.cc @@ -26,7 +26,7 @@ #include #include "MainWindow.h" #ifdef QT_DEBUG -#ifndef __android__ +#ifndef __mobile__ #include "UnitTest.h" #endif #endif @@ -40,7 +40,7 @@ QString QGCFileDialog::getExistingDirectory( _validate(options); #ifdef QT_DEBUG -#ifndef __android__ +#ifndef __mobile__ if (qgcApp()->runningUnitTests()) { return UnitTest::_getExistingDirectory(parent, caption, dir, options); } else @@ -61,7 +61,7 @@ QString QGCFileDialog::getOpenFileName( _validate(options); #ifdef QT_DEBUG -#ifndef __android__ +#ifndef __mobile__ if (qgcApp()->runningUnitTests()) { return UnitTest::_getOpenFileName(parent, caption, dir, filter, options); } else @@ -82,7 +82,7 @@ QStringList QGCFileDialog::getOpenFileNames( _validate(options); #ifdef QT_DEBUG -#ifndef __android__ +#ifndef __mobile__ if (qgcApp()->runningUnitTests()) { return UnitTest::_getOpenFileNames(parent, caption, dir, filter, options); } else @@ -105,7 +105,7 @@ QString QGCFileDialog::getSaveFileName( _validate(options); #ifdef QT_DEBUG -#ifndef __android__ +#ifndef __mobile__ if (qgcApp()->runningUnitTests()) { return UnitTest::_getSaveFileName(parent, caption, dir, filter, defaultSuffix, options); } else @@ -217,7 +217,7 @@ void QGCFileDialog::_validate(Options& options) Q_ASSERT(qgcApp()); Q_ASSERT_X(QThread::currentThread() == qgcApp()->thread(), "Threading issue", "QGCFileDialog can only be called from main thread"); -#ifdef __android__ +#ifdef __mobile__ Q_UNUSED(options) #else // On OSX native dialog can hang so we always use Qt dialogs diff --git a/src/QGCMessageBox.h b/src/QGCMessageBox.h index 91402a9d0..4818253b1 100644 --- a/src/QGCMessageBox.h +++ b/src/QGCMessageBox.h @@ -29,7 +29,7 @@ #include "MainWindow.h" #include "QGCApplication.h" #ifdef QT_DEBUG -#ifndef __android__ +#ifndef __mobile__ #include "UnitTest.h" #endif #endif @@ -106,7 +106,7 @@ private: } #ifdef QT_DEBUG -#ifndef __android__ +#ifndef __mobile__ if (qgcApp()->runningUnitTests()) { qDebug() << "QGCMessageBox (unit testing)" << title << text; return UnitTest::_messageBox(icon, title, text, buttons, defaultButton); diff --git a/src/QmlControls/MavManager.cc b/src/QmlControls/MavManager.cc index d6324cf90..5b2ab4e05 100644 --- a/src/QmlControls/MavManager.cc +++ b/src/QmlControls/MavManager.cc @@ -27,6 +27,7 @@ This file is part of the QGROUNDCONTROL project * @author Gus Grubba */ +#include "UAS.h" #include "MainWindow.h" #include "UASManager.h" #include "Waypoint.h" diff --git a/src/QmlControls/ScreenTools.h b/src/QmlControls/ScreenTools.h index 98d8da206..6c1f9cabb 100644 --- a/src/QmlControls/ScreenTools.h +++ b/src/QmlControls/ScreenTools.h @@ -125,6 +125,10 @@ public: bool isAndroid () { return true; } bool isiOS () { return false; } bool isMobile () { return true; } +#elif defined(__ios__) + bool isAndroid () { return false; } + bool isiOS () { return true; } + bool isMobile () { return true; } #else bool isAndroid () { return false; } bool isiOS () { return false; } diff --git a/src/QtLocationPlugin/qgeocodingmanagerengineqgc.cpp b/src/QtLocationPlugin/qgeocodingmanagerengineqgc.cpp index 7d3dc7498..4ed1b840b 100644 --- a/src/QtLocationPlugin/qgeocodingmanagerengineqgc.cpp +++ b/src/QtLocationPlugin/qgeocodingmanagerengineqgc.cpp @@ -48,6 +48,7 @@ #include #include #include +#include #include #include #include diff --git a/src/VehicleSetup/PX4Bootloader.cc b/src/VehicleSetup/PX4Bootloader.cc index 62c69c75d..81eb339c7 100644 --- a/src/VehicleSetup/PX4Bootloader.cc +++ b/src/VehicleSetup/PX4Bootloader.cc @@ -28,11 +28,7 @@ #include "PX4Bootloader.h" #include -#ifdef __android__ -#include "qserialportinfo.h" -#else #include -#endif #include #include diff --git a/src/VehicleSetup/PX4FirmwareUpgradeThread.cc b/src/VehicleSetup/PX4FirmwareUpgradeThread.cc index 2d98fea3c..642c115db 100644 --- a/src/VehicleSetup/PX4FirmwareUpgradeThread.cc +++ b/src/VehicleSetup/PX4FirmwareUpgradeThread.cc @@ -29,11 +29,7 @@ #include "PX4Bootloader.h" #include -#ifdef __android__ -#include "qserialportinfo.h" -#else #include -#endif #include PX4FirmwareUpgradeThreadWorker::PX4FirmwareUpgradeThreadWorker(QObject* parent) : diff --git a/src/VehicleSetup/SetupView.cc b/src/VehicleSetup/SetupView.cc index df5211e06..4fb1cced1 100644 --- a/src/VehicleSetup/SetupView.cc +++ b/src/VehicleSetup/SetupView.cc @@ -1,24 +1,24 @@ /*===================================================================== - + QGroundControl Open Source Ground Control Station - + (c) 2009 - 2014 QGROUNDCONTROL PROJECT - + This file is part of the QGROUNDCONTROL project - + QGROUNDCONTROL is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - + QGROUNDCONTROL is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with QGROUNDCONTROL. If not, see . - + ======================================================================*/ /// @file @@ -32,7 +32,7 @@ #include "QGCQmlWidgetHolder.h" #include "MainWindow.h" #include "QGCMessageBox.h" -#ifndef __android__ +#ifndef __mobile__ #include "FirmwareUpgradeController.h" #endif #include "ParameterEditorController.h" @@ -45,19 +45,19 @@ SetupView::SetupView(QWidget* parent) : QGCQmlWidgetHolder(parent), _uasCurrent(NULL), _initComplete(false), - _readyAutopilot(NULL) + _readyAutopilot(NULL) { -#ifdef __android__ +#ifdef __mobile__ _showFirmware = false; #else _showFirmware = true; #endif - + connect(UASManager::instance(), &UASManager::activeUASSet, this, &SetupView::_setActiveUAS); - + getRootContext()->setContextProperty("controller", this); setSource(QUrl::fromUserInput("qrc:/qml/SetupView.qml")); - + _setActiveUAS(UASManager::instance()->getActiveUAS()); } @@ -73,9 +73,9 @@ void SetupView::_setActiveUAS(UASInterface* uas) } _pluginReadyChanged(false); - + _uasCurrent = uas; - + if (_uasCurrent) { _autopilot = AutoPilotPluginManager::instance()->getInstanceForAutoPilotPlugin(_uasCurrent); if (_autopilot.data()->pluginReady()) { @@ -100,7 +100,7 @@ void SetupView::_pluginReadyChanged(bool pluginReady) #ifdef UNITTEST_BUILD void SetupView::showFirmware(void) { -#ifndef __android__ +#ifndef __mobile__ QVariant returnedValue; bool success = QMetaObject::invokeMethod(getRootObject(), "showFirmwarePanel", @@ -141,4 +141,4 @@ void SetupView::showVehicleComponentSetup(VehicleComponent* vehicleComponent) AutoPilotPlugin* SetupView::autopilot(void) { return _readyAutopilot; -} \ No newline at end of file +} diff --git a/src/comm/LinkConfiguration.cc b/src/comm/LinkConfiguration.cc index 2b793a4ff..6a8d4c940 100644 --- a/src/comm/LinkConfiguration.cc +++ b/src/comm/LinkConfiguration.cc @@ -28,7 +28,9 @@ This file is part of the QGROUNDCONTROL project */ #include "LinkConfiguration.h" +#ifndef __ios__ #include "SerialLink.h" +#endif #include "UDPLink.h" #include "TCPLink.h" @@ -82,9 +84,11 @@ LinkConfiguration* LinkConfiguration::createSettings(int type, const QString& na { LinkConfiguration* config = NULL; switch(type) { +#ifndef __ios__ case LinkConfiguration::TypeSerial: config = new SerialConfiguration(name); break; +#endif case LinkConfiguration::TypeUdp: config = new UDPConfiguration(name); break; @@ -108,9 +112,11 @@ LinkConfiguration* LinkConfiguration::duplicateSettings(LinkConfiguration* sourc { LinkConfiguration* dupe = NULL; switch(source->type()) { +#ifndef __ios__ case TypeSerial: dupe = new SerialConfiguration(dynamic_cast(source)); break; +#endif case TypeUdp: dupe = new UDPConfiguration(dynamic_cast(source)); break; diff --git a/src/comm/LinkConfiguration.h b/src/comm/LinkConfiguration.h index 34639bc60..02fec412a 100644 --- a/src/comm/LinkConfiguration.h +++ b/src/comm/LinkConfiguration.h @@ -39,7 +39,9 @@ public: /// The link types supported by QGC enum { +#ifndef __ios__ TypeSerial, ///< Serial Link +#endif TypeUdp, ///< UDP Link TypeTcp, ///< TCP Link // TODO Below is not yet implemented diff --git a/src/comm/LinkManager.cc b/src/comm/LinkManager.cc index aef67729a..8e1eae052 100644 --- a/src/comm/LinkManager.cc +++ b/src/comm/LinkManager.cc @@ -32,11 +32,14 @@ This file is part of the QGROUNDCONTROL project #include #include #include + +#ifndef __ios__ #ifdef __android__ #include "qserialportinfo.h" #else #include #endif +#endif #include "LinkManager.h" #include "MainWindow.h" @@ -59,8 +62,10 @@ LinkManager::LinkManager(QObject* parent) , _mavlinkChannelsUsedBitMask(0) , _nullSharedLink(NULL) { +#ifndef __ios__ connect(&_portListTimer, &QTimer::timeout, this, &LinkManager::_updateConfigurationList); _portListTimer.start(1000); +#endif } LinkManager::~LinkManager() @@ -79,9 +84,11 @@ LinkInterface* LinkManager::createConnectedLink(LinkConfiguration* config) Q_ASSERT(config); LinkInterface* pLink = NULL; switch(config->type()) { +#ifndef __ios__ case LinkConfiguration::TypeSerial: pLink = new SerialLink(dynamic_cast(config)); break; +#endif case LinkConfiguration::TypeUdp: pLink = new UDPLink(dynamic_cast(config)); break; @@ -370,10 +377,12 @@ void LinkManager::loadLinkConfigurationList() } LinkConfiguration* pLink = NULL; switch(type) { +#ifndef __ios__ case LinkConfiguration::TypeSerial: pLink = (LinkConfiguration*)new SerialConfiguration(name); pLink->setPreferred(preferred); break; +#endif case LinkConfiguration::TypeUdp: pLink = (LinkConfiguration*)new UDPConfiguration(name); pLink->setPreferred(preferred); @@ -422,6 +431,7 @@ void LinkManager::loadLinkConfigurationList() _configurationsLoaded = true; } +#ifndef __ios__ SerialConfiguration* LinkManager::_findSerialConfiguration(const QString& portName) { QString searchPort = portName.trimmed(); @@ -436,7 +446,9 @@ SerialConfiguration* LinkManager::_findSerialConfiguration(const QString& portNa } return NULL; } +#endif +#ifndef __ios__ void LinkManager::_updateConfigurationList(void) { if (_configUpdateSuspended || !_configurationsLoaded) { @@ -526,6 +538,7 @@ void LinkManager::_updateConfigurationList(void) saveLinkConfigurationList(); } } +#endif bool LinkManager::containsLink(LinkInterface* link) { diff --git a/src/comm/LinkManager.h b/src/comm/LinkManager.h index 4cbab2579..b202995d6 100644 --- a/src/comm/LinkManager.h +++ b/src/comm/LinkManager.h @@ -35,7 +35,9 @@ This file is part of the PIXHAWK project #include "LinkInterface.h" // Links +#ifndef __ios__ #include "SerialLink.h" +#endif #include "UDPLink.h" #include "TCPLink.h" @@ -94,8 +96,9 @@ public: const QList getLinks(); // Returns list of all serial links +#ifndef __ios__ const QList getSerialLinks(); - +#endif /// Sets the flag to suspend the all new connections /// @param reason User visible reason to suspend connections void setConnectionsSuspended(QString reason); @@ -156,8 +159,9 @@ private: bool _connectionsSuspendedMsg(void); void _updateConfigurationList(void); +#ifndef __ios__ SerialConfiguration* _findSerialConfiguration(const QString& portName); - +#endif QList _linkConfigurations; ///< List of configured links /// List of available links kept as QSharedPointers. We use QSharedPointer since @@ -171,8 +175,9 @@ private: bool _configurationsLoaded; ///< true: Link configurations have been loaded bool _connectionsSuspended; ///< true: all new connections should not be allowed QString _connectionsSuspendedReason; ///< User visible reason for suspension +#ifndef __ios__ QTimer _portListTimer; - +#endif uint32_t _mavlinkChannelsUsedBitMask; SharedLinkInterface _nullSharedLink; diff --git a/src/comm/QGCJSBSimLink.cc b/src/comm/QGCJSBSimLink.cc index ddca7f62e..0322b2295 100644 --- a/src/comm/QGCJSBSimLink.cc +++ b/src/comm/QGCJSBSimLink.cc @@ -36,6 +36,7 @@ This file is part of the QGROUNDCONTROL project #include +#include "UAS.h" #include "QGCJSBSimLink.h" #include "QGC.h" #include "QGCMessageBox.h" diff --git a/src/comm/SerialLink.h b/src/comm/SerialLink.h index 8f2011e83..3038b24e0 100644 --- a/src/comm/SerialLink.h +++ b/src/comm/SerialLink.h @@ -40,6 +40,7 @@ class SerialLink; #include #include #include + #ifdef __android__ #include "qserialport.h" #else diff --git a/src/main.cc b/src/main.cc index 5f6dc5f28..9ff0d79f7 100644 --- a/src/main.cc +++ b/src/main.cc @@ -35,7 +35,7 @@ This file is part of the QGROUNDCONTROL project #include "MainWindow.h" #include "configuration.h" #ifdef QT_DEBUG -#ifndef __android__ +#ifndef __mobile__ #include "UnitTest.h" #endif #include "CmdLineOptParser.h" @@ -101,7 +101,9 @@ int main(int argc, char *argv[]) // that we use these types in signals, and without calling qRegisterMetaType we can't queue // these signals. In general we don't queue these signals, but we do what the warning says // anyway to silence the debug output. +#ifndef __ios__ qRegisterMetaType(); +#endif qRegisterMetaType(); // We statically link to the google QtLocation plugin @@ -158,7 +160,7 @@ int main(int argc, char *argv[]) int exitCode; -#ifndef __android__ +#ifndef __mobile__ #ifdef QT_DEBUG if (runUnitTests) { if (!app->_initForUnitTests()) { diff --git a/src/qgcunittest/UnitTest.h b/src/qgcunittest/UnitTest.h index 5e46eff7f..1046d6034 100644 --- a/src/qgcunittest/UnitTest.h +++ b/src/qgcunittest/UnitTest.h @@ -28,7 +28,7 @@ #ifndef UNITTEST_H #define UNITTEST_H -#ifndef __android__ +#ifndef __mobile__ #include #include diff --git a/src/uas/UAS.cc b/src/uas/UAS.cc index 0a532c80b..6cb37da58 100644 --- a/src/uas/UAS.cc +++ b/src/uas/UAS.cc @@ -26,7 +26,9 @@ #include "MAVLinkProtocol.h" #include "QGCMAVLink.h" #include "LinkManager.h" +#ifndef __ios__ #include "SerialLink.h" +#endif #include #include "AutoPilotPluginManager.h" #include "QGCMessageBox.h" @@ -141,8 +143,9 @@ UAS::UAS(MAVLinkProtocol* protocol, int id) : UASInterface(), blockHomePositionChanges(false), receivedMode(false), - +#ifndef __mobile__ simulation(0), +#endif // The protected members. connectionLost(false), @@ -2401,6 +2404,7 @@ void UAS::toggleAutonomy() * Set the manual control commands. * This can only be done if the system has manual inputs enabled and is armed. */ +#ifndef __mobile__ void UAS::setExternalControlSetpoint(float roll, float pitch, float yaw, float thrust, qint8 xHat, qint8 yHat, quint16 buttons, quint8 joystickMode) { Q_UNUSED(xHat); @@ -2580,7 +2584,9 @@ void UAS::setExternalControlSetpoint(float roll, float pitch, float yaw, float t } } } +#endif +#ifndef __mobile__ void UAS::setManual6DOFControlCommands(double x, double y, double z, double roll, double pitch, double yaw) { // If system has manual inputs enabled and is armed @@ -2614,6 +2620,7 @@ void UAS::setManual6DOFControlCommands(double x, double y, double z, double roll qDebug() << "3DMOUSE/MANUAL CONTROL: IGNORING COMMANDS: Set mode to MANUAL to send 3DMouse commands first"; } } +#endif /** * @return the type of the system @@ -2747,6 +2754,7 @@ bool UAS::emergencyKILL() /** * If enabled, connect the flight gear link. */ +#ifndef __mobile__ void UAS::enableHilFlightGear(bool enable, QString options, bool sensorHil, QObject * configuration) { Q_UNUSED(configuration); @@ -2775,10 +2783,12 @@ void UAS::enableHilFlightGear(bool enable, QString options, bool sensorHil, QObj stopHil(); } } +#endif /** * If enabled, connect the JSBSim link. */ +#ifndef __mobile__ void UAS::enableHilJSBSim(bool enable, QString options) { QGCJSBSimLink* link = dynamic_cast(simulation); @@ -2802,10 +2812,12 @@ void UAS::enableHilJSBSim(bool enable, QString options) stopHil(); } } +#endif /** * If enabled, connect the X-plane gear link. */ +#ifndef __mobile__ void UAS::enableHilXPlane(bool enable) { QGCXPlaneLink* link = dynamic_cast(simulation); @@ -2827,6 +2839,7 @@ void UAS::enableHilXPlane(bool enable) stopHil(); } } +#endif /** * @param time_us Timestamp (microseconds since UNIX epoch or microseconds since system boot) @@ -2846,6 +2859,7 @@ void UAS::enableHilXPlane(bool enable) * @param yacc Y acceleration (mg) * @param zacc Z acceleration (mg) */ +#ifndef __mobile__ void UAS::sendHilGroundTruth(quint64 time_us, float roll, float pitch, float yaw, float rollspeed, float pitchspeed, float yawspeed, double lat, double lon, double alt, float vx, float vy, float vz, float ind_airspeed, float true_airspeed, float xacc, float yacc, float zacc) @@ -2875,6 +2889,7 @@ void UAS::sendHilGroundTruth(quint64 time_us, float roll, float pitch, float yaw emit valueChanged(uasId, "IAS sim", "m/s", ind_airspeed, getUnixTime()); emit valueChanged(uasId, "TAS sim", "m/s", true_airspeed, getUnixTime()); } +#endif /** * @param time_us Timestamp (microseconds since UNIX epoch or microseconds since system boot) @@ -2894,6 +2909,7 @@ void UAS::sendHilGroundTruth(quint64 time_us, float roll, float pitch, float yaw * @param yacc Y acceleration (mg) * @param zacc Z acceleration (mg) */ +#ifndef __mobile__ void UAS::sendHilState(quint64 time_us, float roll, float pitch, float yaw, float rollspeed, float pitchspeed, float yawspeed, double lat, double lon, double alt, float vx, float vy, float vz, float ind_airspeed, float true_airspeed, float xacc, float yacc, float zacc) @@ -2930,11 +2946,13 @@ void UAS::sendHilState(quint64 time_us, float roll, float pitch, float yaw, floa qDebug() << __FILE__ << __LINE__ << "HIL is onboard not enabled, trying to enable."; } } +#endif /* * @param abs_pressure Absolute Pressure (hPa) * @param diff_pressure Differential Pressure (hPa) */ +#ifndef __mobile__ void UAS::sendHilSensors(quint64 time_us, float xacc, float yacc, float zacc, float rollspeed, float pitchspeed, float yawspeed, float xmag, float ymag, float zmag, float abs_pressure, float diff_pressure, float pressure_alt, float temperature, quint32 fields_changed) { @@ -2955,7 +2973,9 @@ void UAS::sendHilSensors(quint64 time_us, float xacc, float yacc, float zacc, fl qDebug() << __FILE__ << __LINE__ << "HIL is onboard not enabled, trying to enable."; } } +#endif +#ifndef __mobile__ void UAS::sendHilOpticalFlow(quint64 time_us, qint16 flow_x, qint16 flow_y, float flow_comp_m_x, float flow_comp_m_y, quint8 quality, float ground_distance) { @@ -2988,7 +3008,9 @@ void UAS::sendHilOpticalFlow(quint64 time_us, qint16 flow_x, qint16 flow_y, floa } } +#endif +#ifndef __mobile__ void UAS::sendHilGps(quint64 time_us, double lat, double lon, double alt, int fix_type, float eph, float epv, float vel, float vn, float ve, float vd, float cog, int satellites) { // Only send at 10 Hz max rate @@ -3017,11 +3039,12 @@ void UAS::sendHilGps(quint64 time_us, double lat, double lon, double alt, int fi qDebug() << __FILE__ << __LINE__ << "HIL is onboard not enabled, trying to enable."; } } - +#endif /** * Connect flight gear link. **/ +#ifndef __mobile__ void UAS::startHil() { if (hilEnabled) return; @@ -3032,10 +3055,12 @@ void UAS::startHil() // Connect HIL simulation link simulation->connectSimulation(); } +#endif /** * disable flight gear link. */ +#ifndef __mobile__ void UAS::stopHil() { if (simulation && simulation->isConnected()) { @@ -3046,6 +3071,7 @@ void UAS::stopHil() hilEnabled = false; sensorHil = false; } +#endif void UAS::shutdown() { diff --git a/src/uas/UAS.h b/src/uas/UAS.h index 358e42792..af5ffee51 100644 --- a/src/uas/UAS.h +++ b/src/uas/UAS.h @@ -36,12 +36,14 @@ This file is part of the QGROUNDCONTROL project #include #include #include "QGCMAVLink.h" +#include "FileManager.h" +#ifndef __mobile__ +#include "JoystickInput.h" #include "QGCHilLink.h" #include "QGCFlightGearLink.h" #include "QGCJSBSimLink.h" #include "QGCXPlaneLink.h" -#include "FileManager.h" -#include "JoystickInput.h" +#endif Q_DECLARE_LOGGING_CATEGORY(UASLog) @@ -463,7 +465,9 @@ protected: //COMMENTS FOR TEST UNIT bool receivedMode; ///< True if mode was retrieved from current conenction to UAS /// SIMULATION +#ifndef __mobile__ QGCHilLink* simulation; ///< Hardware in the loop simulation link +#endif public: /** @brief Set the current battery type */ @@ -493,10 +497,11 @@ public: } /** @brief Get the HIL simulation */ +#ifndef __mobile__ QGCHilLink* getHILSimulation() const { return simulation; } - +#endif int getSystemType(); bool isAirplane(); @@ -703,6 +708,7 @@ public slots: void go(); /** @brief Enable / disable HIL */ +#ifndef __mobile__ void enableHilFlightGear(bool enable, QString options, bool sensorHil, QObject * configuration); void enableHilJSBSim(bool enable, QString options); void enableHilXPlane(bool enable); @@ -744,7 +750,7 @@ public slots: /** @brief Stops the UAV's Hardware-in-the-Loop simulation status **/ void stopHil(); - +#endif /** @brief Stops the robot system. If it is an MAV, the robot starts the emergency landing procedure **/ void emergencySTOP(); @@ -781,10 +787,14 @@ public slots: void toggleAutonomy(); /** @brief Set the values for the manual control of the vehicle */ +#ifndef __mobile__ void setExternalControlSetpoint(float roll, float pitch, float yaw, float thrust, qint8 xHat, qint8 yHat, quint16 buttons, quint8); +#endif /** @brief Set the values for the 6dof manual control of the vehicle */ +#ifndef __mobile__ void setManual6DOFControlCommands(double x, double y, double z, double roll, double pitch, double yaw); +#endif /** @brief Add a link associated with this robot */ void addLink(LinkInterface* link); diff --git a/src/uas/UASInterface.h b/src/uas/UASInterface.h index ede2bebfc..ce6e9291f 100644 --- a/src/uas/UASInterface.h +++ b/src/uas/UASInterface.h @@ -353,6 +353,7 @@ public slots: virtual QString getBatterySpecs() = 0; /** @brief Send the full HIL state to the MAV */ +#ifndef __mobile__ virtual void sendHilState(quint64 time_us, float roll, float pitch, float yaw, float rollspeed, float pitchspeed, float yawspeed, double lat, double lon, double alt, float vx, float vy, float vz, float ind_airspeed, float true_airspeed, float xacc, float yacc, float zacc) = 0; @@ -367,6 +368,7 @@ public slots: /** @brief Send Optical Flow sensor message for HIL, (arguments and units accoding to mavlink documentation*/ virtual void sendHilOpticalFlow(quint64 time_us, qint16 flow_x, qint16 flow_y, float flow_comp_m_x, float flow_comp_m_y, quint8 quality, float ground_distance) = 0; +#endif /** @brief Send command to map a RC channel to a parameter */ virtual void sendMapRCToParam(QString param_id, float scale, float value0, quint8 param_rc_channel_index, float valueMin, float valueMax) = 0; diff --git a/src/ui/MainWindow.cc b/src/ui/MainWindow.cc index f08cbc13b..57b97d5b1 100644 --- a/src/ui/MainWindow.cc +++ b/src/ui/MainWindow.cc @@ -33,18 +33,22 @@ This file is part of the QGROUNDCONTROL project #include #include #include +#ifndef __mobile__ #include #include #include +#endif #include #include #include "QGC.h" +#ifndef __ios__ #include "SerialLink.h" +#endif #include "MAVLinkProtocol.h" #include "QGCWaypointListMulti.h" #include "MainWindow.h" -#ifndef __android__ +#ifndef __mobile__ #include "JoystickWidget.h" #endif #include "GAudioOutput.h" @@ -88,6 +92,9 @@ This file is part of the QGROUNDCONTROL project #if defined(Q_OS_OSX) double MainWindow::_pixelFactor = 1.0; double MainWindow::_fontFactor = 1.0; +#elif defined(__ios__) +double MainWindow::_pixelFactor = 1.0; +double MainWindow::_fontFactor = 1.0; #elif defined(Q_OS_WIN) double MainWindow::_pixelFactor = 0.86; double MainWindow::_fontFactor = 0.63; @@ -217,7 +224,7 @@ MainWindow::MainWindow(QSplashScreen* splashScreen) connectCommonActions(); // Connect user interface devices emit initStatusChanged(tr("Initializing joystick interface"), Qt::AlignLeft | Qt::AlignBottom, QColor(62, 93, 141)); -#ifndef __android__ +#ifndef __mobile__ joystick = new JoystickInput(); #endif #ifdef QGC_MOUSE_ENABLED_WIN @@ -248,7 +255,7 @@ MainWindow::MainWindow(QSplashScreen* splashScreen) emit initStatusChanged(tr("Restoring last view state"), Qt::AlignLeft | Qt::AlignBottom, QColor(62, 93, 141)); // Restore the window setup _loadCurrentViewState(); -#ifndef __android__ +#ifndef __mobile__ // Restore the window position and size emit initStatusChanged(tr("Restoring last window size"), Qt::AlignLeft | Qt::AlignBottom, QColor(62, 93, 141)); @@ -317,7 +324,7 @@ MainWindow::MainWindow(QSplashScreen* splashScreen) if (!qgcApp()->runningUnitTests()) { _ui.actionStatusBar->setChecked(_showStatusBar); showStatusBarCallback(_showStatusBar); -#ifdef __android__ +#ifdef __mobile__ menuBar()->hide(); #endif show(); @@ -341,7 +348,7 @@ MainWindow::MainWindow(QSplashScreen* splashScreen) MainWindow::~MainWindow() { -#ifndef __android__ +#ifndef __mobile__ if (joystick) { joystick->shutdown(); @@ -585,6 +592,7 @@ void MainWindow::_createInnerDockWidget(const QString& widgetName) } } +#ifndef __mobile__ void MainWindow::_showHILConfigurationWidgets(void) { UASInterface* uas = UASManager::instance()->getActiveUAS(); @@ -624,6 +632,7 @@ void MainWindow::_showHILConfigurationWidgets(void) } } } +#endif void MainWindow::fullScreenActionItemCallback(bool) { @@ -852,7 +861,7 @@ void MainWindow::showRoadMap() void MainWindow::showSettings() { -#ifndef __android__ +#ifndef __mobile__ SettingsDialog settings(joystick, this); #else SettingsDialog settings(this); @@ -883,7 +892,9 @@ void MainWindow::UASCreated(UASInterface* uas) connect(uas, SIGNAL(misconfigurationDetected(UASInterface*)), this, SLOT(handleMisconfiguration(UASInterface*))); // HIL +#ifndef __mobile__ _showHILConfigurationWidgets(); +#endif if (!linechartWidget) { @@ -1004,7 +1015,9 @@ void MainWindow::_loadCurrentViewState(void) // HIL dock widget are dynamic and don't take part in the saved window state, so this // need to happen after we restore state +#ifndef __mobile__ _showHILConfigurationWidgets(); +#endif // There is a bug in Qt where a Canvas element inside a QQuickWidget does not // receive update requests. Here we emit a signal for them to get repainted. @@ -1138,7 +1151,7 @@ void MainWindow::hideSplashScreen(void) void MainWindow::manageLinks() { -#ifndef __android__ +#ifndef __mobile__ SettingsDialog settings(joystick, this, SettingsDialog::ShowCommLinks); #else SettingsDialog settings(this, SettingsDialog::ShowCommLinks); diff --git a/src/ui/MainWindow.h b/src/ui/MainWindow.h index ed121a9ce..4ba330997 100644 --- a/src/ui/MainWindow.h +++ b/src/ui/MainWindow.h @@ -47,7 +47,7 @@ This file is part of the QGROUNDCONTROL project #include "WaypointList.h" #include "CameraView.h" #include "UASListWidget.h" -#ifndef __android__ +#ifndef __mobile__ #include "input/JoystickInput.h" #endif #if (defined QGC_MOUSE_ENABLED_WIN) | (defined QGC_MOUSE_ENABLED_LINUX) @@ -65,7 +65,6 @@ This file is part of the QGROUNDCONTROL project #include "QGCMAVLinkLogPlayer.h" #include "MAVLinkDecoder.h" #include "QGCUASFileViewMulti.h" -#include "QGCFlightGearLink.h" class QGCMapTool; class QGCMAVLinkMessageSender; @@ -263,7 +262,7 @@ protected: QPointer fileWidget; -#ifndef __android__ +#ifndef __mobile__ JoystickInput* joystick; ///< The joystick manager for QGC #endif @@ -290,7 +289,6 @@ protected: LogCompressor* comp; QTimer* videoTimer; - QGCFlightGearLink* fgLink; QTimer windowNameUpdateTimer; private slots: @@ -353,7 +351,9 @@ private: void _hideAllHilDockWidgets(void); void _hideAllDockWidgets(void); void _showDockWidget(const QString &name, bool show); +#ifndef __mobile__ void _showHILConfigurationWidgets(void); +#endif bool _autoReconnect; bool _lowPowerMode; ///< If enabled, QGC reduces the update rates of all widgets diff --git a/src/ui/QGCCommConfiguration.cc b/src/ui/QGCCommConfiguration.cc index 39e118c22..13da2a771 100644 --- a/src/ui/QGCCommConfiguration.cc +++ b/src/ui/QGCCommConfiguration.cc @@ -30,8 +30,10 @@ This file is part of the QGROUNDCONTROL project #include +#ifndef __ios__ #include "SerialLink.h" #include "SerialConfigurationWindow.h" +#endif #include "QGCUDPLinkConfiguration.h" #include "QGCTCPLinkConfiguration.h" #include "QGCCommConfiguration.h" @@ -45,7 +47,9 @@ QGCCommConfiguration::QGCCommConfiguration(QWidget *parent, LinkConfiguration *c // Add link types _config = config; _ui->typeCombo->addItem(tr("Select Type"), LinkConfiguration::TypeLast); +#ifndef __ios__ _ui->typeCombo->addItem(tr("Serial"), LinkConfiguration::TypeSerial); +#endif _ui->typeCombo->addItem(tr("UDP"), LinkConfiguration::TypeUdp); _ui->typeCombo->addItem(tr("TCP"), LinkConfiguration::TypeTcp); #ifdef QT_DEBUG @@ -113,6 +117,7 @@ void QGCCommConfiguration::_loadTypeConfigWidget(int type) { Q_ASSERT(_config != NULL); switch(type) { +#ifndef __ios__ case LinkConfiguration::TypeSerial: { QWidget* conf = new SerialConfigurationWindow((SerialConfiguration*)_config, this); _ui->linkScrollArea->setWidget(conf); @@ -120,6 +125,7 @@ void QGCCommConfiguration::_loadTypeConfigWidget(int type) _ui->typeCombo->setCurrentIndex(_ui->typeCombo->findData(LinkConfiguration::TypeSerial)); } break; +#endif case LinkConfiguration::TypeUdp: { QWidget* conf = new QGCUDPLinkConfiguration((UDPConfiguration*)_config, this); _ui->linkScrollArea->setWidget(conf); diff --git a/src/ui/QGCDataPlot2D.cc b/src/ui/QGCDataPlot2D.cc index c833fde07..07e6b7ae8 100644 --- a/src/ui/QGCDataPlot2D.cc +++ b/src/ui/QGCDataPlot2D.cc @@ -29,11 +29,13 @@ This file is part of the QGROUNDCONTROL project */ #include +#ifndef __mobile__ #include +#include +#endif #include #include #include -#include #include #include @@ -161,6 +163,7 @@ void QGCDataPlot2D::savePlot() void QGCDataPlot2D::print() { +#ifndef __mobile__ QPrinter printer(QPrinter::HighResolution); // printer.setOutputFormat(QPrinter::PdfFormat); // //QPrinter printer(QPrinter::HighResolution); @@ -196,10 +199,14 @@ void QGCDataPlot2D::print() plot->setStyleSheet("QWidget { background-color: #050508; color: #DDDDDF; background-clip: border; font-size: 11pt;}"); //plot->setCanvasBackground(QColor(5, 5, 8)); } +#endif } void QGCDataPlot2D::exportPDF(QString fileName) { +#ifdef __mobile__ + Q_UNUSED(fileName) +#else QPrinter printer; printer.setOutputFormat(QPrinter::PdfFormat); printer.setOutputFileName(fileName); @@ -235,10 +242,14 @@ void QGCDataPlot2D::exportPDF(QString fileName) //plot->print(printer); plot->setStyleSheet("QWidget { background-color: #050508; color: #DDDDDF; background-clip: border; font-size: 11pt;}"); //plot->setCanvasBackground(QColor(5, 5, 8)); +#endif } void QGCDataPlot2D::exportSVG(QString fileName) { +#ifdef __mobile__ + Q_UNUSED(fileName) +#else if ( !fileName.isEmpty() ) { plot->setStyleSheet("QWidget { background-color: #FFFFFF; color: #000000; background-clip: border; font-size: 10pt;}"); //plot->setCanvasBackground(Qt::white); @@ -257,6 +268,7 @@ void QGCDataPlot2D::exportSVG(QString fileName) //plot->print(generator); plot->setStyleSheet("QWidget { background-color: #050508; color: #DDDDDF; background-clip: border; font-size: 11pt;}"); } +#endif } /** diff --git a/src/ui/QGCLinkConfiguration.cc b/src/ui/QGCLinkConfiguration.cc index 47459da18..bf2153d2c 100644 --- a/src/ui/QGCLinkConfiguration.cc +++ b/src/ui/QGCLinkConfiguration.cc @@ -135,6 +135,7 @@ void QGCLinkConfiguration::_fixUnnamed(LinkConfiguration* config) //-- Check for "Unnamed" if (config->name() == tr("Unnamed")) { switch(config->type()) { +#ifndef __ios__ case LinkConfiguration::TypeSerial: { QString tname = dynamic_cast(config)->portName(); #ifdef Q_OS_WIN32 @@ -146,6 +147,7 @@ void QGCLinkConfiguration::_fixUnnamed(LinkConfiguration* config) config->setName(QString("Serial Device on %1").arg(tname)); break; } +#endif case LinkConfiguration::TypeUdp: config->setName( QString("UDP Link on Port %1").arg(dynamic_cast(config)->localPort())); diff --git a/src/ui/QGCMAVLinkLogPlayer.cc b/src/ui/QGCMAVLinkLogPlayer.cc index 45bc0479d..c7d8f7c6f 100644 --- a/src/ui/QGCMAVLinkLogPlayer.cc +++ b/src/ui/QGCMAVLinkLogPlayer.cc @@ -2,7 +2,9 @@ #include #include "MainWindow.h" +#ifndef __ios__ #include "SerialLink.h" +#endif #include "QGCMAVLinkLogPlayer.h" #include "QGC.h" #include "ui_QGCMAVLinkLogPlayer.h" diff --git a/src/ui/SettingsDialog.cc b/src/ui/SettingsDialog.cc index bbe196c8f..fe885ae37 100644 --- a/src/ui/SettingsDialog.cc +++ b/src/ui/SettingsDialog.cc @@ -28,7 +28,7 @@ #include "MainWindow.h" #include "ui_SettingsDialog.h" -#ifndef __android__ +#ifndef __mobile__ #include "JoystickWidget.h" #endif #include "LinkManager.h" @@ -41,7 +41,7 @@ #include "QGCMessageBox.h" #include "MainToolBar.h" -#ifndef __android__ +#ifndef __mobile__ SettingsDialog::SettingsDialog(JoystickInput *joystick, QWidget *parent, int showTab, Qt::WindowFlags flags) : #else SettingsDialog::SettingsDialog(QWidget *parent, int showTab, Qt::WindowFlags flags) : @@ -58,14 +58,14 @@ _ui(new Ui::SettingsDialog) move(position.topLeft()); QGCLinkConfiguration* pLinkConf = new QGCLinkConfiguration(this); -#ifndef __android__ +#ifndef __mobile__ JoystickWidget* pJoystickConf = new JoystickWidget(joystick, this); #endif MAVLinkSettingsWidget* pMavsettings = new MAVLinkSettingsWidget(MAVLinkProtocol::instance(), this); // Add the link settings pane _ui->tabWidget->addTab(pLinkConf, "Comm Links"); -#ifndef __android__ +#ifndef __mobile__ // Add the joystick settings pane _ui->tabWidget->addTab(pJoystickConf, "Controllers"); #endif @@ -113,7 +113,7 @@ _ui(new Ui::SettingsDialog) case ShowCommLinks: _ui->tabWidget->setCurrentWidget(pLinkConf); break; -#ifndef __android__ +#ifndef __mobile__ case ShowControllers: _ui->tabWidget->setCurrentWidget(pJoystickConf); break; diff --git a/src/ui/SettingsDialog.h b/src/ui/SettingsDialog.h index cd8568430..bf1c85eaf 100644 --- a/src/ui/SettingsDialog.h +++ b/src/ui/SettingsDialog.h @@ -45,7 +45,7 @@ public: ShowMavlink }; -#ifdef __android__ +#ifdef __mobile__ SettingsDialog(QWidget *parent = 0, int showTab = ShowDefault, Qt::WindowFlags flags = Qt::Sheet); #else SettingsDialog(JoystickInput *joystick, QWidget *parent = 0, int showTab = ShowDefault, Qt::WindowFlags flags = Qt::Sheet); diff --git a/src/ui/linechart/IncrementalPlot.cc b/src/ui/linechart/IncrementalPlot.cc index 705a1a984..4c8268978 100644 --- a/src/ui/linechart/IncrementalPlot.cc +++ b/src/ui/linechart/IncrementalPlot.cc @@ -56,7 +56,7 @@ void CurveData::append(double *x, double *y, int count) d_y.resize(newSize); } - for ( register int i = 0; i < count; i++ ) { + for ( int i = 0; i < count; i++ ) { d_x[d_count + i] = x[i]; d_y[d_count + i] = y[i]; } diff --git a/src/ui/uas/UASView.cc b/src/ui/uas/UASView.cc index 408ce4fd4..f3af3168e 100644 --- a/src/ui/uas/UASView.cc +++ b/src/ui/uas/UASView.cc @@ -40,7 +40,10 @@ This file is part of the PIXHAWK project #include "UASWaypointManager.h" #include "MainWindow.h" #include "ui_UASView.h" + +#ifndef __mobile__ #include +#endif UASView::UASView(UASInterface* uas, QWidget *parent) : QWidget(parent), -- 2.22.0