|
|
|
@ -41,7 +41,6 @@
@@ -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)
@@ -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)
@@ -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<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; |
|
|
|
|
QLoggingCategory::setFilterRules(filterRules); |
|
|
|
|
#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.setInterval(_missingParamsDelayedDisplayTimerTimeout); |
|
|
|
|
connect(&_missingParamsDelayedDisplayTimer, &QTimer::timeout, this, &QGCApplication::_missingParamsDisplay); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Set application information
|
|
|
|
|
if (_runningUnitTests) { |
|
|
|
|
// 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); |
|
|
|
|
setOrganizationDomain(QGC_ORG_DOMAIN); |
|
|
|
|
|
|
|
|
|
QString versionString(git_version()); |
|
|
|
|
QString versionString(GIT_VERSION); |
|
|
|
|
// stable versions are on tags (v1.2.3)
|
|
|
|
|
// development versions are full git describe versions (v1.2.3-18-g879e8b3)
|
|
|
|
|
if (versionString.length() > 8) { |
|
|
|
@ -329,9 +328,9 @@ void QGCApplication::_initCommon(void)
@@ -329,9 +328,9 @@ void QGCApplication::_initCommon(void)
|
|
|
|
|
QSettings settings; |
|
|
|
|
|
|
|
|
|
// Register our Qml objects
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
qmlRegisterType<QGCPalette>("QGroundControl.Palette", 1, 0, "QGCPalette"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
qmlRegisterUncreatableType<AutoPilotPlugin> ("QGroundControl.AutoPilotPlugin", 1, 0, "AutoPilotPlugin", "Reference only"); |
|
|
|
|
qmlRegisterUncreatableType<VehicleComponent> ("QGroundControl.AutoPilotPlugin", 1, 0, "VehicleComponent", "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<JoystickConfigController> ("QGroundControl.Controllers", 1, 0, "JoystickConfigController"); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Register Qml Singletons
|
|
|
|
|
qmlRegisterSingletonType<QGroundControlQmlGlobal> ("QGroundControl", 1, 0, "QGroundControl", qgroundcontrolQmlGlobalSingletonFactory); |
|
|
|
|
qmlRegisterSingletonType<ScreenToolsController> ("QGroundControl.ScreenToolsController", 1, 0, "ScreenToolsController", screenToolsControllerSingletonFactory); |
|
|
|
|
qmlRegisterSingletonType<MavlinkQmlSingleton> ("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)
@@ -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)
@@ -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)
@@ -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)
@@ -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)
@@ -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
@@ -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)
@@ -796,7 +795,7 @@ void QGCApplication::_missingParamsDisplay(void)
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
_missingParams.clear(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QGCMessageBox::critical( |
|
|
|
|
"Missing Parameters", |
|
|
|
|
QString("Parameters missing from firmware: %1.\n\n" |
|
|
|
|