Commit a2ebe500 authored by dogmaphobic's avatar dogmaphobic

Some work for iOS

parent af824e20
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
# ------------------------------------------------- # -------------------------------------------------
include(QGCCommon.pri) include(QGCCommon.pri)
include(git_version.pri)
TARGET = qgroundcontrol TARGET = qgroundcontrol
TEMPLATE = app TEMPLATE = app
...@@ -447,7 +446,7 @@ SOURCES += src/QmlControls/QmlTestWidget.cc ...@@ -447,7 +446,7 @@ SOURCES += src/QmlControls/QmlTestWidget.cc
!MobileBuild { !MobileBuild {
INCLUDEPATH += \ INCLUDEPATH += \
src/qgcunittest src/qgcunittest
HEADERS += \ HEADERS += \
src/FactSystem/FactSystemTestBase.h \ src/FactSystem/FactSystemTestBase.h \
......
...@@ -69,6 +69,16 @@ MobileBuild { ...@@ -69,6 +69,16 @@ MobileBuild {
DEFINES += __mobile__ 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 configuration
installer { installer {
...@@ -161,11 +171,11 @@ MacBuild { ...@@ -161,11 +171,11 @@ MacBuild {
} }
LinuxBuild { LinuxBuild {
DEFINES += __STDC_LIMIT_MACROS DEFINES += __STDC_LIMIT_MACROS
} }
WindowsBuild { WindowsBuild {
DEFINES += __STDC_LIMIT_MACROS DEFINES += __STDC_LIMIT_MACROS
} }
# #
...@@ -177,14 +187,14 @@ WindowsBuild { ...@@ -177,14 +187,14 @@ WindowsBuild {
# #
MacBuild | LinuxBuild { MacBuild | LinuxBuild {
QMAKE_CXXFLAGS_WARN_ON += -Wall QMAKE_CXXFLAGS_WARN_ON += -Wall
WarningsAsErrorsOn { WarningsAsErrorsOn {
QMAKE_CXXFLAGS_WARN_ON += -Werror QMAKE_CXXFLAGS_WARN_ON += -Werror
} }
} }
WindowsBuild { WindowsBuild {
QMAKE_CXXFLAGS_WARN_ON += /W3 \ QMAKE_CXXFLAGS_WARN_ON += /W3 \
/wd4996 \ # silence warnings about deprecated strcpy and whatnot /wd4996 \ # silence warnings about deprecated strcpy and whatnot
/wd4005 \ # silence warnings about macro redefinition /wd4005 \ # silence warnings about macro redefinition
/wd4290 \ # ignore exception specifications /wd4290 \ # ignore exception specifications
...@@ -200,14 +210,14 @@ WindowsBuild { ...@@ -200,14 +210,14 @@ WindowsBuild {
ReleaseBuild { ReleaseBuild {
DEFINES += QT_NO_DEBUG DEFINES += QT_NO_DEBUG
WindowsBuild { WindowsBuild {
# Use link time code generation for better optimization (I believe this is supported in MSVC Express, but not 100% sure) # 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_LFLAGS_LTCG = /LTCG
QMAKE_CFLAGS_LTCG = -GL QMAKE_CFLAGS_LTCG = -GL
# Turn on debugging information so we can collect good crash dumps from release builds # Turn on debugging information so we can collect good crash dumps from release builds
QMAKE_CXXFLAGS_RELEASE += /Zi QMAKE_CXXFLAGS_RELEASE += /Zi
QMAKE_LFLAGS_RELEASE += /DEBUG QMAKE_LFLAGS_RELEASE += /DEBUG
} }
} }
......
# 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
}
...@@ -22,8 +22,6 @@ CONFIG += ordered ...@@ -22,8 +22,6 @@ CONFIG += ordered
SUBDIRS = ./QGCLocationPlugin.pro SUBDIRS = ./QGCLocationPlugin.pro
SUBDIRS += ./QGCApplication.pro SUBDIRS += ./QGCApplication.pro
include(git_version.pri)
QGCApplication.depends = QGCLocationPlugin QGCApplication.depends = QGCLocationPlugin
message(Qt version $$[QT_VERSION]) message(Qt version $$[QT_VERSION])
......
...@@ -95,6 +95,7 @@ bool GAudioOutput::say(const QString& inText, int severity) ...@@ -95,6 +95,7 @@ bool GAudioOutput::say(const QString& inText, int severity)
if (!muted) { if (!muted) {
#if defined __android__ #if defined __android__
#if defined QGC_SPEECH_ENABLED #if defined QGC_SPEECH_ENABLED
Q_UNUSED(severity);
static const char V_jniClassName[] {"org/qgroundcontrol/qgchelper/UsbDeviceJNI"}; static const char V_jniClassName[] {"org/qgroundcontrol/qgchelper/UsbDeviceJNI"};
QAndroidJniEnvironment env; QAndroidJniEnvironment env;
if (env->ExceptionCheck()) { if (env->ExceptionCheck()) {
......
...@@ -41,7 +41,6 @@ ...@@ -41,7 +41,6 @@
#include "VideoStreaming.h" #include "VideoStreaming.h"
#include "git_version.h"
#include "QGC.h" #include "QGC.h"
#include "QGCApplication.h" #include "QGCApplication.h"
#include "MainWindow.h" #include "MainWindow.h"
...@@ -169,7 +168,7 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting) ...@@ -169,7 +168,7 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting)
: QApplication(argc, argv) : QApplication(argc, argv)
, _runningUnitTests(unitTesting) , _runningUnitTests(unitTesting)
, _styleIsDark(true) , _styleIsDark(true)
, _fakeMobile(false) , _fakeMobile(false)
#ifdef QT_DEBUG #ifdef QT_DEBUG
, _testHighDPI(false) , _testHighDPI(false)
#endif #endif
...@@ -181,36 +180,36 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting) ...@@ -181,36 +180,36 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting)
#ifndef __android__ #ifndef __android__
setAttribute(Qt::AA_DontCreateNativeWidgetSiblings); setAttribute(Qt::AA_DontCreateNativeWidgetSiblings);
#endif #endif
// Parse command line options // Parse command line options
bool fClearSettingsOptions = false; // Clear stored settings bool fClearSettingsOptions = false; // Clear stored settings
bool logging = false; // Turn on logging bool logging = false; // Turn on logging
QString loggingOptions; QString loggingOptions;
CmdLineOpt_t rgCmdLineOptions[] = { CmdLineOpt_t rgCmdLineOptions[] = {
{ "--clear-settings", &fClearSettingsOptions, NULL }, { "--clear-settings", &fClearSettingsOptions, NULL },
{ "--logging", &logging, &loggingOptions }, { "--logging", &logging, &loggingOptions },
{ "--fake-mobile", &_fakeMobile, NULL }, { "--fake-mobile", &_fakeMobile, NULL },
#ifdef QT_DEBUG #ifdef QT_DEBUG
{ "--test-high-dpi", &_testHighDPI, NULL }, { "--test-high-dpi", &_testHighDPI, NULL },
#endif #endif
// Add additional command line option flags here // Add additional command line option flags here
}; };
ParseCmdLineOptions(argc, argv, rgCmdLineOptions, sizeof(rgCmdLineOptions)/sizeof(rgCmdLineOptions[0]), false); ParseCmdLineOptions(argc, argv, rgCmdLineOptions, sizeof(rgCmdLineOptions)/sizeof(rgCmdLineOptions[0]), false);
#ifdef __mobile__ #ifdef __mobile__
QLoggingCategory::setFilterRules(QStringLiteral("*Log.debug=false")); QLoggingCategory::setFilterRules(QStringLiteral("*Log.debug=false"));
#else #else
QString filterRules; QString filterRules;
// Turn off bogus ssl warning // Turn off bogus ssl warning
filterRules += "qt.network.ssl.warning=false\n"; filterRules += "qt.network.ssl.warning=false\n";
if (logging) { if (logging) {
QStringList logList = loggingOptions.split(","); QStringList logList = loggingOptions.split(",");
if (logList[0] == "full") { if (logList[0] == "full") {
filterRules += "*Log.debug=true\n"; filterRules += "*Log.debug=true\n";
for(int i=1; i<logList.count(); i++) { for(int i=1; i<logList.count(); i++) {
...@@ -262,7 +261,7 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting) ...@@ -262,7 +261,7 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting)
} }
} }
} }
qDebug() << "Filter rules" << filterRules; qDebug() << "Filter rules" << filterRules;
QLoggingCategory::setFilterRules(filterRules); QLoggingCategory::setFilterRules(filterRules);
#endif #endif
...@@ -271,7 +270,7 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting) ...@@ -271,7 +270,7 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting)
_missingParamsDelayedDisplayTimer.setSingleShot(true); _missingParamsDelayedDisplayTimer.setSingleShot(true);
_missingParamsDelayedDisplayTimer.setInterval(_missingParamsDelayedDisplayTimerTimeout); _missingParamsDelayedDisplayTimer.setInterval(_missingParamsDelayedDisplayTimerTimeout);
connect(&_missingParamsDelayedDisplayTimer, &QTimer::timeout, this, &QGCApplication::_missingParamsDisplay); connect(&_missingParamsDelayedDisplayTimer, &QTimer::timeout, this, &QGCApplication::_missingParamsDisplay);
// Set application information // Set application information
if (_runningUnitTests) { if (_runningUnitTests) {
// We don't want unit tests to use the same QSettings space as the normal app. So we tweak the app // We don't want unit tests to use the same QSettings space as the normal app. So we tweak the app
...@@ -283,7 +282,7 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting) ...@@ -283,7 +282,7 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting)
setOrganizationName(QGC_ORG_NAME); setOrganizationName(QGC_ORG_NAME);
setOrganizationDomain(QGC_ORG_DOMAIN); setOrganizationDomain(QGC_ORG_DOMAIN);
QString versionString(git_version()); QString versionString(GIT_VERSION);
// stable versions are on tags (v1.2.3) // stable versions are on tags (v1.2.3)
// development versions are full git describe versions (v1.2.3-18-g879e8b3) // development versions are full git describe versions (v1.2.3-18-g879e8b3)
if (versionString.length() > 8) { if (versionString.length() > 8) {
...@@ -329,9 +328,9 @@ void QGCApplication::_initCommon(void) ...@@ -329,9 +328,9 @@ void QGCApplication::_initCommon(void)
QSettings settings; QSettings settings;
// Register our Qml objects // Register our Qml objects
qmlRegisterType<QGCPalette>("QGroundControl.Palette", 1, 0, "QGCPalette"); qmlRegisterType<QGCPalette>("QGroundControl.Palette", 1, 0, "QGCPalette");
qmlRegisterUncreatableType<AutoPilotPlugin> ("QGroundControl.AutoPilotPlugin", 1, 0, "AutoPilotPlugin", "Reference only"); qmlRegisterUncreatableType<AutoPilotPlugin> ("QGroundControl.AutoPilotPlugin", 1, 0, "AutoPilotPlugin", "Reference only");
qmlRegisterUncreatableType<VehicleComponent> ("QGroundControl.AutoPilotPlugin", 1, 0, "VehicleComponent", "Reference only"); qmlRegisterUncreatableType<VehicleComponent> ("QGroundControl.AutoPilotPlugin", 1, 0, "VehicleComponent", "Reference only");
qmlRegisterUncreatableType<Vehicle> ("QGroundControl.Vehicle", 1, 0, "Vehicle", "Reference only"); qmlRegisterUncreatableType<Vehicle> ("QGroundControl.Vehicle", 1, 0, "Vehicle", "Reference only");
...@@ -362,12 +361,12 @@ void QGCApplication::_initCommon(void) ...@@ -362,12 +361,12 @@ void QGCApplication::_initCommon(void)
qmlRegisterType<FirmwareUpgradeController> ("QGroundControl.Controllers", 1, 0, "FirmwareUpgradeController"); qmlRegisterType<FirmwareUpgradeController> ("QGroundControl.Controllers", 1, 0, "FirmwareUpgradeController");
qmlRegisterType<JoystickConfigController> ("QGroundControl.Controllers", 1, 0, "JoystickConfigController"); qmlRegisterType<JoystickConfigController> ("QGroundControl.Controllers", 1, 0, "JoystickConfigController");
#endif #endif
// Register Qml Singletons // Register Qml Singletons
qmlRegisterSingletonType<QGroundControlQmlGlobal> ("QGroundControl", 1, 0, "QGroundControl", qgroundcontrolQmlGlobalSingletonFactory); qmlRegisterSingletonType<QGroundControlQmlGlobal> ("QGroundControl", 1, 0, "QGroundControl", qgroundcontrolQmlGlobalSingletonFactory);
qmlRegisterSingletonType<ScreenToolsController> ("QGroundControl.ScreenToolsController", 1, 0, "ScreenToolsController", screenToolsControllerSingletonFactory); qmlRegisterSingletonType<ScreenToolsController> ("QGroundControl.ScreenToolsController", 1, 0, "ScreenToolsController", screenToolsControllerSingletonFactory);
qmlRegisterSingletonType<MavlinkQmlSingleton> ("QGroundControl.Mavlink", 1, 0, "Mavlink", mavlinkQmlSingletonFactory); qmlRegisterSingletonType<MavlinkQmlSingleton> ("QGroundControl.Mavlink", 1, 0, "Mavlink", mavlinkQmlSingletonFactory);
// Show user an upgrade message if the settings version has been bumped up // Show user an upgrade message if the settings version has been bumped up
bool settingsUpgraded = false; bool settingsUpgraded = false;
if (settings.contains(_settingsVersionKey)) { if (settings.contains(_settingsVersionKey)) {
...@@ -398,7 +397,7 @@ void QGCApplication::_initCommon(void) ...@@ -398,7 +397,7 @@ void QGCApplication::_initCommon(void)
savedFilesLocation.clear(); savedFilesLocation.clear();
} }
} }
if (savedFilesLocation.isEmpty()) { if (savedFilesLocation.isEmpty()) {
// No location set (or invalid). Create a default one in Documents standard location. // No location set (or invalid). Create a default one in Documents standard location.
...@@ -581,7 +580,7 @@ void QGCApplication::_createSingletons(void) ...@@ -581,7 +580,7 @@ void QGCApplication::_createSingletons(void)
FlightMapSettings* flightMapSettings = FlightMapSettings::_createSingleton(); FlightMapSettings* flightMapSettings = FlightMapSettings::_createSingleton();
Q_UNUSED(flightMapSettings); Q_UNUSED(flightMapSettings);
Q_ASSERT(flightMapSettings); Q_ASSERT(flightMapSettings);
// No dependencies // No dependencies
HomePositionManager* homePositionManager = HomePositionManager::_createSingleton(); HomePositionManager* homePositionManager = HomePositionManager::_createSingleton();
Q_UNUSED(homePositionManager); Q_UNUSED(homePositionManager);
...@@ -591,28 +590,28 @@ void QGCApplication::_createSingletons(void) ...@@ -591,28 +590,28 @@ void QGCApplication::_createSingletons(void)
FirmwarePlugin* firmwarePlugin = GenericFirmwarePlugin::_createSingleton(); FirmwarePlugin* firmwarePlugin = GenericFirmwarePlugin::_createSingleton();
Q_UNUSED(firmwarePlugin); Q_UNUSED(firmwarePlugin);
Q_ASSERT(firmwarePlugin); Q_ASSERT(firmwarePlugin);
// No dependencies // No dependencies
firmwarePlugin = PX4FirmwarePlugin::_createSingleton(); firmwarePlugin = PX4FirmwarePlugin::_createSingleton();
firmwarePlugin = ArduCopterFirmwarePlugin::_createSingleton(); firmwarePlugin = ArduCopterFirmwarePlugin::_createSingleton();
firmwarePlugin = ArduPlaneFirmwarePlugin::_createSingleton(); firmwarePlugin = ArduPlaneFirmwarePlugin::_createSingleton();
firmwarePlugin = ArduRoverFirmwarePlugin::_createSingleton(); firmwarePlugin = ArduRoverFirmwarePlugin::_createSingleton();
// No dependencies // No dependencies
FirmwarePluginManager* firmwarePluginManager = FirmwarePluginManager::_createSingleton(); FirmwarePluginManager* firmwarePluginManager = FirmwarePluginManager::_createSingleton();
Q_UNUSED(firmwarePluginManager); Q_UNUSED(firmwarePluginManager);
Q_ASSERT(firmwarePluginManager); Q_ASSERT(firmwarePluginManager);
// No dependencies // No dependencies
MultiVehicleManager* multiVehicleManager = MultiVehicleManager::_createSingleton(); MultiVehicleManager* multiVehicleManager = MultiVehicleManager::_createSingleton();
Q_UNUSED(multiVehicleManager); Q_UNUSED(multiVehicleManager);
Q_ASSERT(multiVehicleManager); Q_ASSERT(multiVehicleManager);
// No dependencies // No dependencies
JoystickManager* joystickManager = JoystickManager::_createSingleton(); JoystickManager* joystickManager = JoystickManager::_createSingleton();
Q_UNUSED(joystickManager); Q_UNUSED(joystickManager);
Q_ASSERT(joystickManager); Q_ASSERT(joystickManager);
// No dependencies // No dependencies
GAudioOutput* audio = GAudioOutput::_createSingleton(); GAudioOutput* audio = GAudioOutput::_createSingleton();
Q_UNUSED(audio); Q_UNUSED(audio);
...@@ -706,7 +705,7 @@ void QGCApplication::saveTempFlightDataLogOnMainThread(QString tempLogfile) ...@@ -706,7 +705,7 @@ void QGCApplication::saveTempFlightDataLogOnMainThread(QString tempLogfile)
qgcApp()->mavlinkLogFilesLocation(), qgcApp()->mavlinkLogFilesLocation(),
tr("Flight Data Log Files (*.mavlink)"), tr("Flight Data Log Files (*.mavlink)"),
"mavlink"); "mavlink");
if (!saveFilename.isEmpty()) { if (!saveFilename.isEmpty()) {
// if file exsits already, try to remove it first to overwrite it // if file exsits already, try to remove it first to overwrite it
if(QFile::exists(saveFilename) && !QFile::remove(saveFilename)){ if(QFile::exists(saveFilename) && !QFile::remove(saveFilename)){
...@@ -762,7 +761,7 @@ void QGCApplication::_loadCurrentStyle(void) ...@@ -762,7 +761,7 @@ void QGCApplication::_loadCurrentStyle(void)
success = false; success = false;
} }
} }
setStyleSheet(styles); setStyleSheet(styles);
if (!success) { if (!success) {
...@@ -786,7 +785,7 @@ void QGCApplication::reportMissingParameter(int componentId, const QString& name ...@@ -786,7 +785,7 @@ void QGCApplication::reportMissingParameter(int componentId, const QString& name
void QGCApplication::_missingParamsDisplay(void) void QGCApplication::_missingParamsDisplay(void)
{ {
Q_ASSERT(_missingParams.count()); Q_ASSERT(_missingParams.count());
QString params; QString params;
foreach (QString name, _missingParams) { foreach (QString name, _missingParams) {
if (params.isEmpty()) { if (params.isEmpty()) {
...@@ -796,7 +795,7 @@ void QGCApplication::_missingParamsDisplay(void) ...@@ -796,7 +795,7 @@ void QGCApplication::_missingParamsDisplay(void)
} }
} }
_missingParams.clear(); _missingParams.clear();
QGCMessageBox::critical( QGCMessageBox::critical(
"Missing Parameters", "Missing Parameters",
QString("Parameters missing from firmware: %1.\n\n" QString("Parameters missing from firmware: %1.\n\n"
......
...@@ -30,7 +30,7 @@ This file is part of the QGROUNDCONTROL project ...@@ -30,7 +30,7 @@ This file is part of the QGROUNDCONTROL project
#ifndef GLUTILS_H #ifndef GLUTILS_H
#define GLUTILS_H #define GLUTILS_H
#ifdef __android__ #ifdef __mobile__
#include <QOpenGLFunctions> #include <QOpenGLFunctions>
#define getQOpenGLFunctions() QOpenGLContext::currentContext()->functions() #define getQOpenGLFunctions() QOpenGLContext::currentContext()->functions()
#define QOpenGLFunctionsDef QOpenGLFunctions #define QOpenGLFunctionsDef QOpenGLFunctions
......
extern "C" {
const char *git_version();
}
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