From a2ebe500bcbacc830c24a7baecfcad0b2cbaa7ff Mon Sep 17 00:00:00 2001 From: dogmaphobic Date: Fri, 23 Oct 2015 16:09:26 -0400 Subject: [PATCH] Some work for iOS --- QGCApplication.pro | 3 +- QGCCommon.pri | 34 ++++++++---- git_version.pri | 30 ---------- qgroundcontrol.pro | 2 - src/GAudioOutput.cc | 1 + src/QGCApplication.cc | 55 +++++++++---------- .../gstqtvideosink/utils/glutils.h | 2 +- src/git_version.h | 3 - 8 files changed, 52 insertions(+), 78 deletions(-) delete mode 100644 git_version.pri delete mode 100644 src/git_version.h diff --git a/QGCApplication.pro b/QGCApplication.pro index 9bf7968ec..a160bdbfc 100644 --- a/QGCApplication.pro +++ b/QGCApplication.pro @@ -18,7 +18,6 @@ # ------------------------------------------------- include(QGCCommon.pri) -include(git_version.pri) TARGET = qgroundcontrol TEMPLATE = app @@ -447,7 +446,7 @@ SOURCES += src/QmlControls/QmlTestWidget.cc !MobileBuild { INCLUDEPATH += \ - src/qgcunittest + src/qgcunittest HEADERS += \ src/FactSystem/FactSystemTestBase.h \ diff --git a/QGCCommon.pri b/QGCCommon.pri index d1f430cc8..975040af3 100644 --- a/QGCCommon.pri +++ b/QGCCommon.pri @@ -69,6 +69,16 @@ MobileBuild { DEFINES += __mobile__ } +# set the QGC version from git + +exists ($$PWD/.git) { + GIT_DESCRIBE = $$system(git --git-dir $$PWD/.git --work-tree $$PWD describe --always --tags) +} else { + GIT_DESCRIBE = None +} + +DEFINES += GIT_VERSION=\"\\\"$$GIT_DESCRIBE\\\"\" + # Installer configuration installer { @@ -161,11 +171,11 @@ MacBuild { } LinuxBuild { - DEFINES += __STDC_LIMIT_MACROS + DEFINES += __STDC_LIMIT_MACROS } WindowsBuild { - DEFINES += __STDC_LIMIT_MACROS + DEFINES += __STDC_LIMIT_MACROS } # @@ -177,14 +187,14 @@ WindowsBuild { # MacBuild | LinuxBuild { - QMAKE_CXXFLAGS_WARN_ON += -Wall + QMAKE_CXXFLAGS_WARN_ON += -Wall WarningsAsErrorsOn { QMAKE_CXXFLAGS_WARN_ON += -Werror } } WindowsBuild { - QMAKE_CXXFLAGS_WARN_ON += /W3 \ + QMAKE_CXXFLAGS_WARN_ON += /W3 \ /wd4996 \ # silence warnings about deprecated strcpy and whatnot /wd4005 \ # silence warnings about macro redefinition /wd4290 \ # ignore exception specifications @@ -200,14 +210,14 @@ 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 - QMAKE_CFLAGS_LTCG = -GL - - # Turn on debugging information so we can collect good crash dumps from release builds - QMAKE_CXXFLAGS_RELEASE += /Zi - QMAKE_LFLAGS_RELEASE += /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 + QMAKE_CFLAGS_LTCG = -GL + + # Turn on debugging information so we can collect good crash dumps from release builds + QMAKE_CXXFLAGS_RELEASE += /Zi + QMAKE_LFLAGS_RELEASE += /DEBUG } } diff --git a/git_version.pri b/git_version.pri deleted file mode 100644 index 87fa08961..000000000 --- a/git_version.pri +++ /dev/null @@ -1,30 +0,0 @@ -# set the QGC version from git - -exists ($$PWD/.git) { - GIT_DESCRIBE = $$system(git --git-dir $$PWD/.git --work-tree $$PWD describe --always --tags) - WindowsBuild { - QGC_GIT_VER = echo extern \"C\" { const char *git_version() { return \"$$GIT_DESCRIBE\"; } } > git_version.cpp - LIBS += git_version.obj - } else { - QGC_GIT_VER = echo \"extern \\\"C\\\" { const char *git_version() { return \\\"$$GIT_DESCRIBE\\\"; } }\" > git_version.cpp - LIBS += git_version.o - } -} - -WindowsBuild { - LIBS += git_version.obj -} else { - LIBS += git_version.o -} - -CONFIG(debug) { - GIT_VERSION_CXXFLAGS = $$QMAKE_CXXFLAGS_DEBUG -} else { - GIT_VERSION_CXXFLAGS = $$QMAKE_CXXFLAGS_RELEASE -} - -MacBuild { - QMAKE_PRE_LINK += $$QGC_GIT_VER && $$QMAKE_CXX -mmacosx-version-min=$$QMAKE_MACOSX_DEPLOYMENT_TARGET -c $$GIT_VERSION_CXXFLAGS git_version.cpp -} else { - QMAKE_PRE_LINK += $$QGC_GIT_VER && $$QMAKE_CXX -c $$GIT_VERSION_CXXFLAGS git_version.cpp -} diff --git a/qgroundcontrol.pro b/qgroundcontrol.pro index d577d25b7..ba89c959f 100644 --- a/qgroundcontrol.pro +++ b/qgroundcontrol.pro @@ -22,8 +22,6 @@ CONFIG += ordered SUBDIRS = ./QGCLocationPlugin.pro SUBDIRS += ./QGCApplication.pro -include(git_version.pri) - QGCApplication.depends = QGCLocationPlugin message(Qt version $$[QT_VERSION]) diff --git a/src/GAudioOutput.cc b/src/GAudioOutput.cc index 9f70a2012..743e44c0f 100644 --- a/src/GAudioOutput.cc +++ b/src/GAudioOutput.cc @@ -95,6 +95,7 @@ bool GAudioOutput::say(const QString& inText, int severity) if (!muted) { #if defined __android__ #if defined QGC_SPEECH_ENABLED + Q_UNUSED(severity); static const char V_jniClassName[] {"org/qgroundcontrol/qgchelper/UsbDeviceJNI"}; QAndroidJniEnvironment env; if (env->ExceptionCheck()) { diff --git a/src/QGCApplication.cc b/src/QGCApplication.cc index 3f34623d6..29ec286fa 100644 --- a/src/QGCApplication.cc +++ b/src/QGCApplication.cc @@ -41,7 +41,6 @@ #include "VideoStreaming.h" -#include "git_version.h" #include "QGC.h" #include "QGCApplication.h" #include "MainWindow.h" @@ -169,7 +168,7 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting) : QApplication(argc, argv) , _runningUnitTests(unitTesting) , _styleIsDark(true) - , _fakeMobile(false) + , _fakeMobile(false) #ifdef QT_DEBUG , _testHighDPI(false) #endif @@ -181,36 +180,36 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting) #ifndef __android__ setAttribute(Qt::AA_DontCreateNativeWidgetSiblings); #endif - + // Parse command line options - + bool fClearSettingsOptions = false; // Clear stored settings bool logging = false; // Turn on logging QString loggingOptions; - + CmdLineOpt_t rgCmdLineOptions[] = { { "--clear-settings", &fClearSettingsOptions, NULL }, { "--logging", &logging, &loggingOptions }, - { "--fake-mobile", &_fakeMobile, NULL }, + { "--fake-mobile", &_fakeMobile, NULL }, #ifdef QT_DEBUG { "--test-high-dpi", &_testHighDPI, NULL }, #endif // Add additional command line option flags here }; - + ParseCmdLineOptions(argc, argv, rgCmdLineOptions, sizeof(rgCmdLineOptions)/sizeof(rgCmdLineOptions[0]), false); #ifdef __mobile__ QLoggingCategory::setFilterRules(QStringLiteral("*Log.debug=false")); #else QString filterRules; - + // Turn off bogus ssl warning filterRules += "qt.network.ssl.warning=false\n"; - + if (logging) { QStringList logList = loggingOptions.split(","); - + if (logList[0] == "full") { filterRules += "*Log.debug=true\n"; for(int i=1; i 8) { @@ -329,9 +328,9 @@ void QGCApplication::_initCommon(void) QSettings settings; // Register our Qml objects - + qmlRegisterType("QGroundControl.Palette", 1, 0, "QGCPalette"); - + qmlRegisterUncreatableType ("QGroundControl.AutoPilotPlugin", 1, 0, "AutoPilotPlugin", "Reference only"); qmlRegisterUncreatableType ("QGroundControl.AutoPilotPlugin", 1, 0, "VehicleComponent", "Reference only"); qmlRegisterUncreatableType ("QGroundControl.Vehicle", 1, 0, "Vehicle", "Reference only"); @@ -362,12 +361,12 @@ void QGCApplication::_initCommon(void) qmlRegisterType ("QGroundControl.Controllers", 1, 0, "FirmwareUpgradeController"); qmlRegisterType ("QGroundControl.Controllers", 1, 0, "JoystickConfigController"); #endif - + // Register Qml Singletons qmlRegisterSingletonType ("QGroundControl", 1, 0, "QGroundControl", qgroundcontrolQmlGlobalSingletonFactory); qmlRegisterSingletonType ("QGroundControl.ScreenToolsController", 1, 0, "ScreenToolsController", screenToolsControllerSingletonFactory); qmlRegisterSingletonType ("QGroundControl.Mavlink", 1, 0, "Mavlink", mavlinkQmlSingletonFactory); - + // Show user an upgrade message if the settings version has been bumped up bool settingsUpgraded = false; if (settings.contains(_settingsVersionKey)) { @@ -398,7 +397,7 @@ void QGCApplication::_initCommon(void) savedFilesLocation.clear(); } } - + if (savedFilesLocation.isEmpty()) { // No location set (or invalid). Create a default one in Documents standard location. @@ -581,7 +580,7 @@ void QGCApplication::_createSingletons(void) FlightMapSettings* flightMapSettings = FlightMapSettings::_createSingleton(); Q_UNUSED(flightMapSettings); Q_ASSERT(flightMapSettings); - + // No dependencies HomePositionManager* homePositionManager = HomePositionManager::_createSingleton(); Q_UNUSED(homePositionManager); @@ -591,28 +590,28 @@ void QGCApplication::_createSingletons(void) FirmwarePlugin* firmwarePlugin = GenericFirmwarePlugin::_createSingleton(); Q_UNUSED(firmwarePlugin); Q_ASSERT(firmwarePlugin); - + // No dependencies firmwarePlugin = PX4FirmwarePlugin::_createSingleton(); firmwarePlugin = ArduCopterFirmwarePlugin::_createSingleton(); firmwarePlugin = ArduPlaneFirmwarePlugin::_createSingleton(); firmwarePlugin = ArduRoverFirmwarePlugin::_createSingleton(); - + // No dependencies FirmwarePluginManager* firmwarePluginManager = FirmwarePluginManager::_createSingleton(); Q_UNUSED(firmwarePluginManager); Q_ASSERT(firmwarePluginManager); - + // No dependencies MultiVehicleManager* multiVehicleManager = MultiVehicleManager::_createSingleton(); Q_UNUSED(multiVehicleManager); Q_ASSERT(multiVehicleManager); - + // No dependencies JoystickManager* joystickManager = JoystickManager::_createSingleton(); Q_UNUSED(joystickManager); Q_ASSERT(joystickManager); - + // No dependencies GAudioOutput* audio = GAudioOutput::_createSingleton(); Q_UNUSED(audio); @@ -706,7 +705,7 @@ void QGCApplication::saveTempFlightDataLogOnMainThread(QString tempLogfile) qgcApp()->mavlinkLogFilesLocation(), tr("Flight Data Log Files (*.mavlink)"), "mavlink"); - + if (!saveFilename.isEmpty()) { // if file exsits already, try to remove it first to overwrite it if(QFile::exists(saveFilename) && !QFile::remove(saveFilename)){ @@ -762,7 +761,7 @@ void QGCApplication::_loadCurrentStyle(void) success = false; } } - + setStyleSheet(styles); if (!success) { @@ -786,7 +785,7 @@ void QGCApplication::reportMissingParameter(int componentId, const QString& name void QGCApplication::_missingParamsDisplay(void) { Q_ASSERT(_missingParams.count()); - + QString params; foreach (QString name, _missingParams) { if (params.isEmpty()) { @@ -796,7 +795,7 @@ void QGCApplication::_missingParamsDisplay(void) } } _missingParams.clear(); - + QGCMessageBox::critical( "Missing Parameters", QString("Parameters missing from firmware: %1.\n\n" diff --git a/src/VideoStreaming/gstqtvideosink/utils/glutils.h b/src/VideoStreaming/gstqtvideosink/utils/glutils.h index 2ff461d20..02fa0985c 100644 --- a/src/VideoStreaming/gstqtvideosink/utils/glutils.h +++ b/src/VideoStreaming/gstqtvideosink/utils/glutils.h @@ -30,7 +30,7 @@ This file is part of the QGROUNDCONTROL project #ifndef GLUTILS_H #define GLUTILS_H -#ifdef __android__ +#ifdef __mobile__ #include #define getQOpenGLFunctions() QOpenGLContext::currentContext()->functions() #define QOpenGLFunctionsDef QOpenGLFunctions diff --git a/src/git_version.h b/src/git_version.h deleted file mode 100644 index 84dd2fbb5..000000000 --- a/src/git_version.h +++ /dev/null @@ -1,3 +0,0 @@ -extern "C" { - const char *git_version(); -} -- 2.22.0