QGCCorePlugin.cc 20.3 KB
Newer Older
1 2
/****************************************************************************
 *
Gus Grubba's avatar
Gus Grubba committed
3
 * (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
4 5 6 7 8 9
 *
 * QGroundControl is licensed according to the terms in the file
 * COPYING.md in the root of the source code directory.
 *
 ****************************************************************************/

10
#include "QGCApplication.h"
11 12
#include "QGCCorePlugin.h"
#include "QGCOptions.h"
13
#include "QmlComponentInfo.h"
14
#include "FactMetaData.h"
Don Gagne's avatar
Don Gagne committed
15
#include "SettingsManager.h"
16
#include "AppMessages.h"
17
#include "QmlObjectListModel.h"
18
#include "VideoManager.h"
19 20
#if defined(QGC_GST_STREAMING)
#include "GStreamer.h"
21
#include "VideoReceiver.h"
22
#endif
23
#include "QGCLoggingCategory.h"
24
#include "QGCCameraManager.h"
25 26
#include "HorizontalFactValueGrid.h"
#include "VerticalFactValueGrid.h"
27
#include "InstrumentValueData.h"
28 29 30 31 32 33

#include <QtQml>
#include <QQmlEngine>

/// @file
///     @brief Core Plugin Interface for QGroundControl - Default Implementation
Gus Grubba's avatar
Gus Grubba committed
34
///     @author Gus Grubba <gus@auterion.com>
35 36 37 38 39 40 41

class QGCCorePlugin_p
{
public:
    QGCCorePlugin_p()
    {
    }
42

43 44 45 46 47 48 49 50
    ~QGCCorePlugin_p()
    {
        if(pGeneral)
            delete pGeneral;
        if(pCommLinks)
            delete pCommLinks;
        if(pOfflineMaps)
            delete pOfflineMaps;
51 52 53 54
#if defined(QGC_GST_TAISYNC_ENABLED)
        if(pTaisync)
            delete pTaisync;
#endif
55 56 57 58
#if defined(QGC_GST_MICROHARD_ENABLED)
        if(pMicrohard)
            delete pMicrohard;
#endif
Gus Grubba's avatar
Gus Grubba committed
59
#if defined(QGC_AIRMAP_ENABLED)
Gus Grubba's avatar
Gus Grubba committed
60 61
        if(pAirmap)
            delete pAirmap;
Gus Grubba's avatar
Gus Grubba committed
62
#endif
63 64 65 66 67 68 69 70 71
        if(pMAVLink)
            delete pMAVLink;
        if(pConsole)
            delete pConsole;
#if defined(QT_DEBUG)
        if(pMockLink)
            delete pMockLink;
        if(pDebug)
            delete pDebug;
72 73
        if(pQmlTest)
            delete pQmlTest;
74 75 76 77
#endif
        if(defaultOptions)
            delete defaultOptions;
    }
78

79 80 81 82 83 84
    QmlComponentInfo* pGeneral                  = nullptr;
    QmlComponentInfo* pCommLinks                = nullptr;
    QmlComponentInfo* pOfflineMaps              = nullptr;
#if defined(QGC_GST_TAISYNC_ENABLED)
    QmlComponentInfo* pTaisync                  = nullptr;
#endif
85 86 87
#if defined(QGC_GST_MICROHARD_ENABLED)
    QmlComponentInfo* pMicrohard                = nullptr;
#endif
Gus Grubba's avatar
Gus Grubba committed
88
#if defined(QGC_AIRMAP_ENABLED)
89
    QmlComponentInfo* pAirmap                   = nullptr;
Gus Grubba's avatar
Gus Grubba committed
90
#endif
91 92 93
    QmlComponentInfo* pMAVLink                  = nullptr;
    QmlComponentInfo* pConsole                  = nullptr;
    QmlComponentInfo* pHelp                     = nullptr;
94
#if defined(QT_DEBUG)
95 96
    QmlComponentInfo* pMockLink                 = nullptr;
    QmlComponentInfo* pDebug                    = nullptr;
97
    QmlComponentInfo* pQmlTest                  = nullptr;
98
#endif
99

100 101 102 103 104 105 106
    QmlComponentInfo*   valuesPageWidgetInfo    = nullptr;
    QmlComponentInfo*   cameraPageWidgetInfo    = nullptr;
    QmlComponentInfo*   videoPageWidgetInfo     = nullptr;
    QmlComponentInfo*   vibrationPageWidgetInfo = nullptr;

    QGCOptions*         defaultOptions          = nullptr;
    QVariantList        settingsList;
107
    QVariantList        analyzeList;
108 109 110
    QVariantList        instrumentPageWidgetList;

    QmlObjectListModel _emptyCustomMapItems;
111 112 113 114 115 116 117 118 119
};

QGCCorePlugin::~QGCCorePlugin()
{
    if(_p) {
        delete _p;
    }
}

120 121
QGCCorePlugin::QGCCorePlugin(QGCApplication *app, QGCToolbox* toolbox)
    : QGCTool(app, toolbox)
122
    , _showTouchAreas(false)
123
    , _showAdvancedUI(true)
124
{
125
    QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership);
126 127 128 129 130
    _p = new QGCCorePlugin_p;
}

void QGCCorePlugin::setToolbox(QGCToolbox *toolbox)
{
DonLakeFlyer's avatar
DonLakeFlyer committed
131
    QGCTool::setToolbox(toolbox);
132 133 134 135 136

    qmlRegisterUncreatableType<QGCCorePlugin>       ("QGroundControl", 1, 0, "QGCCorePlugin",       "Reference only");
    qmlRegisterUncreatableType<QGCOptions>          ("QGroundControl", 1, 0, "QGCOptions",          "Reference only");
    qmlRegisterUncreatableType<QGCFlyViewOptions>   ("QGroundControl", 1, 0, "QGCFlyViewOptions",   "Reference only");

137 138 139 140 141 142 143 144 145 146 147 148
    //-- Handle Camera and Video Changes
    connect(toolbox->multiVehicleManager(), &MultiVehicleManager::activeVehicleChanged, this, &QGCCorePlugin::_activeVehicleChanged);
}

void QGCCorePlugin::_activeVehicleChanged(Vehicle* activeVehicle)
{
    if(activeVehicle != _activeVehicle) {
        if(_activeVehicle) {
            disconnect(_activeVehicle, &Vehicle::dynamicCamerasChanged, this, &QGCCorePlugin::_dynamicCamerasChanged);
        }
        if(_dynamicCameras) {
            disconnect(_dynamicCameras, &QGCCameraManager::currentCameraChanged, this, &QGCCorePlugin::_currentCameraChanged);
149
            _dynamicCameras = nullptr;
150 151
        }
        _activeVehicle = activeVehicle;
152 153 154
        if(_activeVehicle) {
            connect(_activeVehicle, &Vehicle::dynamicCamerasChanged, this, &QGCCorePlugin::_dynamicCamerasChanged);
        }
155 156 157 158 159
    }
}

void QGCCorePlugin::_dynamicCamerasChanged()
{
160 161 162 163
    if(_currentCamera) {
        disconnect(_currentCamera, &QGCCameraControl::autoStreamChanged, this, &QGCCorePlugin::_autoStreamChanged);
        _currentCamera = nullptr;
    }
164 165
    if(_activeVehicle) {
        _dynamicCameras = _activeVehicle->dynamicCameras();
166 167 168
        if(_dynamicCameras) {
            connect(_dynamicCameras, &QGCCameraManager::currentCameraChanged, this, &QGCCorePlugin::_currentCameraChanged);
        }
169 170 171 172
    }
}

void QGCCorePlugin::_currentCameraChanged()
173 174 175 176 177 178 179 180 181 182 183 184 185 186
{
    if(_dynamicCameras) {
        QGCCameraControl* cp = _dynamicCameras->currentCameraInstance();
        if(_currentCamera) {
            disconnect(_currentCamera, &QGCCameraControl::autoStreamChanged, this, &QGCCorePlugin::_autoStreamChanged);
        }
        if(_currentCamera != cp) {
            _currentCamera = cp;
            connect(_currentCamera, &QGCCameraControl::autoStreamChanged, this, &QGCCorePlugin::_autoStreamChanged);
        }
    }
}

void QGCCorePlugin::_autoStreamChanged()
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212
{
    _resetInstrumentPages();
    emit instrumentPagesChanged();
}

void QGCCorePlugin::_resetInstrumentPages()
{
    if (_p->valuesPageWidgetInfo) {
        _p->valuesPageWidgetInfo->deleteLater();
        _p->valuesPageWidgetInfo = nullptr;
    }
    if(_p->cameraPageWidgetInfo) {
        _p->cameraPageWidgetInfo->deleteLater();
        _p->cameraPageWidgetInfo = nullptr;
    }
#if defined(QGC_GST_STREAMING)
    if(_p->videoPageWidgetInfo) {
        _p->videoPageWidgetInfo->deleteLater();
        _p->videoPageWidgetInfo = nullptr;
    }
#endif
    if(_p->vibrationPageWidgetInfo) {
        _p->vibrationPageWidgetInfo->deleteLater();
        _p->vibrationPageWidgetInfo = nullptr;
    }
    _p->instrumentPageWidgetList.clear();
213 214
}

215
QVariantList &QGCCorePlugin::settingsPages()
216 217
{
    if(!_p->pGeneral) {
218
        _p->pGeneral = new QmlComponentInfo(tr("General"),
219 220
                                            QUrl::fromUserInput("qrc:/qml/GeneralSettings.qml"),
                                            QUrl::fromUserInput("qrc:/res/gear-white.svg"));
221
        _p->settingsList.append(QVariant::fromValue(reinterpret_cast<QmlComponentInfo*>(_p->pGeneral)));
222
        _p->pCommLinks = new QmlComponentInfo(tr("Comm Links"),
223 224
                                              QUrl::fromUserInput("qrc:/qml/LinkSettings.qml"),
                                              QUrl::fromUserInput("qrc:/res/waves.svg"));
225
        _p->settingsList.append(QVariant::fromValue(reinterpret_cast<QmlComponentInfo*>(_p->pCommLinks)));
226
        _p->pOfflineMaps = new QmlComponentInfo(tr("Offline Maps"),
227 228
                                                QUrl::fromUserInput("qrc:/qml/OfflineMap.qml"),
                                                QUrl::fromUserInput("qrc:/res/waves.svg"));
229
        _p->settingsList.append(QVariant::fromValue(reinterpret_cast<QmlComponentInfo*>(_p->pOfflineMaps)));
230 231
#if defined(QGC_GST_TAISYNC_ENABLED)
        _p->pTaisync = new QmlComponentInfo(tr("Taisync"),
232 233
                                            QUrl::fromUserInput("qrc:/qml/TaisyncSettings.qml"),
                                            QUrl::fromUserInput(""));
234 235
        _p->settingsList.append(QVariant::fromValue(reinterpret_cast<QmlComponentInfo*>(_p->pTaisync)));
#endif
236 237
#if defined(QGC_GST_MICROHARD_ENABLED)
        _p->pMicrohard = new QmlComponentInfo(tr("Microhard"),
238 239
                                              QUrl::fromUserInput("qrc:/qml/MicrohardSettings.qml"),
                                              QUrl::fromUserInput(""));
240 241
        _p->settingsList.append(QVariant::fromValue(reinterpret_cast<QmlComponentInfo*>(_p->pMicrohard)));
#endif
Gus Grubba's avatar
Gus Grubba committed
242
#if defined(QGC_AIRMAP_ENABLED)
Gus Grubba's avatar
Gus Grubba committed
243
        _p->pAirmap = new QmlComponentInfo(tr("AirMap"),
244 245
                                           QUrl::fromUserInput("qrc:/qml/AirmapSettings.qml"),
                                           QUrl::fromUserInput(""));
246
        _p->settingsList.append(QVariant::fromValue(reinterpret_cast<QmlComponentInfo*>(_p->pAirmap)));
Gus Grubba's avatar
Gus Grubba committed
247
#endif
248
        _p->pMAVLink = new QmlComponentInfo(tr("MAVLink"),
249 250
                                            QUrl::fromUserInput("qrc:/qml/MavlinkSettings.qml"),
                                            QUrl::fromUserInput("qrc:/res/waves.svg"));
251
        _p->settingsList.append(QVariant::fromValue(reinterpret_cast<QmlComponentInfo*>(_p->pMAVLink)));
252
        _p->pConsole = new QmlComponentInfo(tr("Console"),
253
                                            QUrl::fromUserInput("qrc:/qml/QGroundControl/Controls/AppMessages.qml"));
254
        _p->settingsList.append(QVariant::fromValue(reinterpret_cast<QmlComponentInfo*>(_p->pConsole)));
255
        _p->pHelp = new QmlComponentInfo(tr("Help"),
256
                                         QUrl::fromUserInput("qrc:/qml/HelpSettings.qml"));
257
        _p->settingsList.append(QVariant::fromValue(reinterpret_cast<QmlComponentInfo*>(_p->pHelp)));
DonLakeFlyer's avatar
DonLakeFlyer committed
258
#if defined(QT_DEBUG)
259
        //-- These are always present on Debug builds
260
        _p->pMockLink = new QmlComponentInfo(tr("Mock Link"),
261
                                             QUrl::fromUserInput("qrc:/qml/MockLink.qml"));
262
        _p->settingsList.append(QVariant::fromValue(reinterpret_cast<QmlComponentInfo*>(_p->pMockLink)));
263
        _p->pDebug = new QmlComponentInfo(tr("Debug"),
264
                                          QUrl::fromUserInput("qrc:/qml/DebugWindow.qml"));
265
        _p->settingsList.append(QVariant::fromValue(reinterpret_cast<QmlComponentInfo*>(_p->pDebug)));
266
        _p->pQmlTest = new QmlComponentInfo(tr("Palette Test"),
267
                                            QUrl::fromUserInput("qrc:/qml/QmlTest.qml"));
268
        _p->settingsList.append(QVariant::fromValue(reinterpret_cast<QmlComponentInfo*>(_p->pQmlTest)));
DonLakeFlyer's avatar
DonLakeFlyer committed
269
#endif
270 271 272 273
    }
    return _p->settingsList;
}

274
QVariantList& QGCCorePlugin::instrumentPages()
275 276
{
    if (!_p->valuesPageWidgetInfo) {
Gus Grubba's avatar
Gus Grubba committed
277 278 279
        _p->valuesPageWidgetInfo    = new QmlComponentInfo(tr("Values"),    QUrl::fromUserInput("qrc:/qml/ValuePageWidget.qml"));
        _p->cameraPageWidgetInfo    = new QmlComponentInfo(tr("Camera"),    QUrl::fromUserInput("qrc:/qml/CameraPageWidget.qml"));
#if defined(QGC_GST_STREAMING)
280
        if(!_currentCamera || !_currentCamera->autoStream()) {
281 282 283
            //-- Video Page Widget only available if using manual video streaming
            _p->videoPageWidgetInfo = new QmlComponentInfo(tr("Video Stream"), QUrl::fromUserInput("qrc:/qml/VideoPageWidget.qml"));
        }
Gus Grubba's avatar
Gus Grubba committed
284
#endif
285
        _p->vibrationPageWidgetInfo = new QmlComponentInfo(tr("Vibration"), QUrl::fromUserInput("qrc:/qml/VibrationPageWidget.qml"));
286 287 288

        _p->instrumentPageWidgetList.append(QVariant::fromValue(_p->valuesPageWidgetInfo));
        _p->instrumentPageWidgetList.append(QVariant::fromValue(_p->cameraPageWidgetInfo));
Gus Grubba's avatar
Gus Grubba committed
289 290 291
#if defined(QGC_GST_STREAMING)
        _p->instrumentPageWidgetList.append(QVariant::fromValue(_p->videoPageWidgetInfo));
#endif
292 293 294 295 296
        _p->instrumentPageWidgetList.append(QVariant::fromValue(_p->vibrationPageWidgetInfo));
    }
    return _p->instrumentPageWidgetList;
}

297 298 299 300 301 302 303 304 305 306 307 308 309 310 311
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;
}

312
int QGCCorePlugin::defaultSettings()
313 314 315 316
{
    return 0;
}

317 318
QGCOptions* QGCCorePlugin::options()
{
319 320
    if (!_p->defaultOptions) {
        _p->defaultOptions = new QGCOptions(this);
321 322 323 324
    }
    return _p->defaultOptions;
}

325 326 327
bool QGCCorePlugin::overrideSettingsGroupVisibility(QString name)
{
    Q_UNUSED(name);
328

329 330 331
    // Always show all
    return true;
}
332

333
bool QGCCorePlugin::adjustSettingMetaData(const QString& settingsGroup, FactMetaData& metaData)
334
{
335
    if (settingsGroup == AppSettings::settingsGroup) {
Gus Grubba's avatar
Gus Grubba committed
336 337 338 339 340 341 342 343
#if !defined(QGC_ENABLE_PAIRING)
        //-- If we don't support pairing, disable it.
        if (metaData.name() == AppSettings::usePairingName) {
            metaData.setRawDefaultValue(false);
            //-- And hide the option
            return false;
        }
#endif
344

345 346 347
        //-- Default Palette
        if (metaData.name() == AppSettings::indoorPaletteName) {
            QVariant outdoorPalette;
Don Gagne's avatar
Don Gagne committed
348
#if defined (__mobile__)
349
            outdoorPalette = 0;
Don Gagne's avatar
Don Gagne committed
350
#else
351
            outdoorPalette = 1;
Don Gagne's avatar
Don Gagne committed
352
#endif
353 354 355 356
            metaData.setRawDefaultValue(outdoorPalette);
            return true;
        }

357
#if defined (__mobile__)
358 359 360 361 362
        if (metaData.name() == AppSettings::telemetrySaveName) {
            // Mobile devices have limited storage so don't turn on telemtry saving by default
            metaData.setRawDefaultValue(false);
            return true;
        }
363
#endif
Don Gagne's avatar
Don Gagne committed
364
    }
365

366
    return true; // Show setting in ui
367
}
DonLakeFlyer's avatar
DonLakeFlyer committed
368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383

void QGCCorePlugin::setShowTouchAreas(bool show)
{
    if (show != _showTouchAreas) {
        _showTouchAreas = show;
        emit showTouchAreasChanged(show);
    }
}

void QGCCorePlugin::setShowAdvancedUI(bool show)
{
    if (show != _showAdvancedUI) {
        _showAdvancedUI = show;
        emit showAdvancedUIChanged(show);
    }
}
384

385
void QGCCorePlugin::paletteOverride(QString /*colorName*/, QGCPalette::PaletteColorInfo_t& /*colorInfo*/)
386
{
387

388
}
389

390
QString QGCCorePlugin::showAdvancedUIMessage() const
391 392 393 394 395 396
{
    return tr("WARNING: You are about to enter Advanced Mode. "
              "If used incorrectly, this may cause your vehicle to malfunction thus voiding your warranty. "
              "You should do so only if instructed by customer support. "
              "Are you sure you want to enable Advanced Mode?");
}
397

398
void QGCCorePlugin::factValueGridCreateDefaultSettings(const QString& defaultSettingsGroup)
399
{
400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415
    if (defaultSettingsGroup == VerticalFactValueGrid::valuePageDefaultSettingsGroup) {
        VerticalFactValueGrid factValueGrid(defaultSettingsGroup);

        factValueGrid.setFontSize(FactValueGrid::LargeFontSize);

        QmlObjectListModel* row = factValueGrid.appendRow();
        InstrumentValueData* value = row->value<InstrumentValueData*>(0);
        value->setFact("Vehicle", "DistanceToHome");
        value->setText(value->fact()->shortDescription());
        value->setShowUnits(true);

        row = factValueGrid.appendRow();
        value = row->value<InstrumentValueData*>(0);
        value->setFact("Vehicle", "FlightDistance");
        value->setText(value->fact()->shortDescription());
        value->setShowUnits(true);
416

417 418 419 420 421 422 423
        row = factValueGrid.appendRow();
        value = row->value<InstrumentValueData*>(0);
        value->setFact("Vehicle", "FlightTime");
        value->setText(value->fact()->shortDescription());
        value->setShowUnits(false);
    } else if (defaultSettingsGroup == HorizontalFactValueGrid::toolbarDefaultSettingsGroup) {
        HorizontalFactValueGrid factValueGrid(defaultSettingsGroup);
424

425
        factValueGrid.setFontSize(FactValueGrid::LargeFontSize);
426

427 428 429 430 431 432
        QmlObjectListModel* row = factValueGrid.appendRow();
        InstrumentValueData* value = row->value<InstrumentValueData*>(0);
        value->setFact("Vehicle", "AltitudeRelative");
        value->setIcon("arrow-thick-up.svg");
        value->setText(value->fact()->shortDescription());
        value->setShowUnits(true);
433

434 435 436 437 438
        row = factValueGrid.appendRow();
        value = row->value<InstrumentValueData*>(0);
        value->setFact("Vehicle", "GroundSpeed");
        value->setIcon("arrow-thick-right.svg");
        value->setShowUnits(true);
439
    }
440
}
441

442
QQmlApplicationEngine* QGCCorePlugin::createQmlApplicationEngine(QObject* parent)
443
{
444 445 446 447 448 449 450 451 452 453
    QQmlApplicationEngine* qmlEngine = new QQmlApplicationEngine(parent);
    qmlEngine->addImportPath("qrc:/qml");
    qmlEngine->rootContext()->setContextProperty("joystickManager", qgcApp()->toolbox()->joystickManager());
    qmlEngine->rootContext()->setContextProperty("debugMessageModel", AppMessages::getModel());
    return qmlEngine;
}

void QGCCorePlugin::createRootWindow(QQmlApplicationEngine* qmlEngine)
{
    qmlEngine->load(QUrl(QStringLiteral("qrc:/qml/MainRootWindow.qml")));
454
}
455 456 457 458 459 460 461 462 463

bool QGCCorePlugin::mavlinkMessage(Vehicle* vehicle, LinkInterface* link, mavlink_message_t message)
{
    Q_UNUSED(vehicle);
    Q_UNUSED(link);
    Q_UNUSED(message);

    return true;
}
464

465
QmlObjectListModel* QGCCorePlugin::customMapItems()
466 467 468
{
    return &_p->_emptyCustomMapItems;
}
469

470 471 472 473 474
VideoManager* QGCCorePlugin::createVideoManager(QGCApplication *app, QGCToolbox *toolbox)
{
    return new VideoManager(app, toolbox);
}

475 476
VideoReceiver* QGCCorePlugin::createVideoReceiver(QObject* parent)
{
477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493
#if defined(QGC_GST_STREAMING)
    return GStreamer::createVideoReceiver(parent);
#else
    Q_UNUSED(parent)
    return nullptr;
#endif
}

void* QGCCorePlugin::createVideoSink(QObject* parent, QQuickItem* widget)
{
#if defined(QGC_GST_STREAMING)
    return GStreamer::createVideoSink(parent, widget);
#else
    Q_UNUSED(parent)
    Q_UNUSED(widget)
    return nullptr;
#endif
494
}
495

496 497 498 499 500 501 502 503 504
void QGCCorePlugin::releaseVideoSink(void* sink)
{
#if defined(QGC_GST_STREAMING)
    GStreamer::releaseVideoSink(sink);
#else
    Q_UNUSED(sink)
#endif
}

505
bool QGCCorePlugin::guidedActionsControllerLogging() const
506 507 508
{
    return GuidedActionsControllerLog().isDebugEnabled();
}
509

510
QString QGCCorePlugin::stableVersionCheckFileUrl() const
511 512 513 514 515 516 517 518
{
#ifdef QGC_CUSTOM_BUILD
    // Custom builds must override to turn on and provide their own location
    return QString();
#else
    return QString("https://s3-us-west-2.amazonaws.com/qgroundcontrol/latest/QGC.version.txt");
#endif
}
519

520
const QVariantList& QGCCorePlugin::toolBarIndicators(void)
521 522 523 524
{
    //-- Default list of indicators for all vehicles.
    if(_toolBarIndicatorList.size() == 0) {
        _toolBarIndicatorList = QVariantList({
525 526
                                                 QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/GPSRTKIndicator.qml")),
                                             });
527 528 529
    }
    return _toolBarIndicatorList;
}
530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574

QList<int> QGCCorePlugin::firstRunPromptStdIds(void)
{
    QList<int> rgStdIds = { unitsFirstRunPromptId, offlineVehicleFirstRunPromptId };
    return rgStdIds;
}

QList<int> QGCCorePlugin::firstRunPromptCustomIds(void)
{
    return QList<int>();
}

QVariantList QGCCorePlugin::firstRunPromptsToShow(void)
{
    QList<int> rgIdsToShow;

    rgIdsToShow.append(firstRunPromptStdIds());
    rgIdsToShow.append(firstRunPromptCustomIds());

    QList<int> rgAlreadyShownIds = AppSettings::firstRunPromptsIdsVariantToList(_toolbox->settingsManager()->appSettings()->firstRunPromptIdsShown()->rawValue());

    for (int idToRemove: rgAlreadyShownIds) {
        rgIdsToShow.removeOne(idToRemove);
    }

    QVariantList rgVarIdsToShow;
    for (int id: rgIdsToShow) {
        rgVarIdsToShow.append(id);
    }

    return rgVarIdsToShow;
}

QString QGCCorePlugin::firstRunPromptResource(int id)
{
    switch (id) {
    case unitsFirstRunPromptId:
        return "/FirstRunPromptDialogs/UnitsFirstRunPrompt.qml";
    case offlineVehicleFirstRunPromptId:
        return "/FirstRunPromptDialogs/OfflineVehicleFirstRunPrompt.qml";
        break;
    }

    return QString();
}