6#ifdef QGC_GST_STREAMING
17#ifdef QGC_QT_STREAMING
23#ifdef QGC_CUSTOM_BUILD
27#include <QtCore/QApplicationStatic>
28#include <QtCore/QFile>
29#include <QtQml/qqml.h>
30#include <QtQml/QQmlApplicationEngine>
31#include <QtQml/QQmlContext>
32#include <QtQuick/QQuickItem>
36#ifndef QGC_CUSTOM_BUILD
40QGCCorePlugin::QGCCorePlugin(QObject *parent)
45 qCDebug(QGCCorePluginLog) <<
this;
48QGCCorePlugin::~QGCCorePlugin()
50 qCDebug(QGCCorePluginLog) <<
this;
55#ifndef QGC_CUSTOM_BUILD
56 return _qgcCorePluginInstance();
58 return CUSTOMCLASS::instance();
62const QVariantList &QGCCorePlugin::analyzePages()
64 static const QVariantList analyzeList = {
67 QUrl::fromUserInput(QStringLiteral(
"qrc:/qml/QGroundControl/AnalyzeView/LogDownloadPage.qml")),
68 QUrl::fromUserInput(QStringLiteral(
"qrc:/qmlimages/LogDownloadIcon.svg")))),
71 QUrl::fromUserInput(QStringLiteral(
"qrc:/qml/QGroundControl/AnalyzeView/GeoTag/GeoTagPage.qml")),
72 QUrl::fromUserInput(QStringLiteral(
"qrc:/qml/QGroundControl/AnalyzeView/GeoTag/GeoTagIcon.svg")))),
74 tr(
"MAVLink Console"),
75 QUrl::fromUserInput(QStringLiteral(
"qrc:/qml/QGroundControl/AnalyzeView/MAVLinkConsolePage.qml")),
76 QUrl::fromUserInput(QStringLiteral(
"qrc:/qmlimages/MAVLinkConsoleIcon.svg")))),
77#ifndef QGC_DISABLE_MAVLINK_INSPECTOR
79 tr(
"MAVLink Inspector"),
80 QUrl::fromUserInput(QStringLiteral(
"qrc:/qml/QGroundControl/AnalyzeView/MAVLinkInspectorPage.qml")),
81 QUrl::fromUserInput(QStringLiteral(
"qrc:/qmlimages/MAVLinkInspector.svg")))),
85 QUrl::fromUserInput(QStringLiteral(
"qrc:/qml/QGroundControl/AnalyzeView/VibrationPage.qml")),
86 QUrl::fromUserInput(QStringLiteral(
"qrc:/qmlimages/VibrationPageIcon")))),
94 return _defaultOptions;
99 return _emptyCustomMapItems;
102void QGCCorePlugin::adjustSettingMetaData(
const QString &settingsGroup,
FactMetaData &metaData,
bool &visible)
110 QVariant outdoorPalette;
111#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
119#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
134QString QGCCorePlugin::showAdvancedUIMessage()
const
136 return tr(
"WARNING: You are about to enter Advanced Mode. "
137 "If used incorrectly, this may cause your vehicle to malfunction thus voiding your warranty. "
138 "You should do so only if instructed by customer support. "
139 "Are you sure you want to enable Advanced Mode?");
142void QGCCorePlugin::factValueGridCreateDefaultSettings(
FactValueGrid* factValueGrid)
144#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
163 value->setFact(
"Vehicle",
"AltitudeRelative");
164 value->
setIcon(
"arrow-thick-up.svg");
165 value->setText(value->fact()->shortDescription());
166 value->setShowUnits(
true);
171 if (includeFWValues) {
172 value->setFact(
"Vehicle",
"AirSpeed");
173 value->setText(
"AirSpd");
174 value->setShowUnits(
true);
176 value->setFact(
"Vehicle",
"GroundSpeed");
177 value->setIcon(
"arrow-simple-right.svg");
178 value->setText(value->fact()->shortDescription());
179 value->setShowUnits(
true);
189 if (includeFWValues) {
198 value->setFact(QStringLiteral(
"Vehicle"), QStringLiteral(
"AltitudeRelative"));
199 value->
setIcon(QStringLiteral(
"arrow-thick-up.svg"));
200 value->setText(value->fact()->shortDescription());
201 value->setShowUnits(
true);
204 value->setFact(QStringLiteral(
"Vehicle"), QStringLiteral(
"DistanceToHome"));
205 value->
setIcon(QStringLiteral(
"bookmark copy 3.svg"));
206 value->setText(value->fact()->shortDescription());
207 value->setShowUnits(
true);
213 value->setFact(QStringLiteral(
"Vehicle"), QStringLiteral(
"ClimbRate"));
214 value->setIcon(QStringLiteral(
"arrow-simple-up.svg"));
215 value->setText(value->fact()->shortDescription());
216 value->setShowUnits(
true);
219 value->setFact(QStringLiteral(
"Vehicle"), QStringLiteral(
"GroundSpeed"));
220 value->setIcon(QStringLiteral(
"arrow-simple-right.svg"));
221 value->setText(value->fact()->shortDescription());
222 value->setShowUnits(
true);
224 if (includeFWValues) {
229 value->setFact(QStringLiteral(
"Vehicle"), QStringLiteral(
"AirSpeed"));
230 value->setText(QStringLiteral(
"AirSpd"));
231 value->setShowUnits(
true);
234 value->setFact(QStringLiteral(
"Vehicle"), QStringLiteral(
"ThrottlePct"));
235 value->setText(QStringLiteral(
"Thr"));
236 value->setShowUnits(
true);
243 value->setFact(QStringLiteral(
"Vehicle"), QStringLiteral(
"FlightTime"));
244 value->setIcon(QStringLiteral(
"timer.svg"));
245 value->setText(value->fact()->shortDescription());
246 value->setShowUnits(
false);
249 value->setFact(QStringLiteral(
"Vehicle"), QStringLiteral(
"FlightDistance"));
250 value->setIcon(QStringLiteral(
"travel-walk.svg"));
251 value->setText(value->fact()->shortDescription());
252 value->setShowUnits(
true);
256QQmlApplicationEngine *QGCCorePlugin::createQmlApplicationEngine(QObject *parent)
258 QQmlApplicationEngine *
const qmlEngine =
new QQmlApplicationEngine(parent);
259 qmlEngine->addImportPath(QStringLiteral(
"qrc:/qml"));
260 qmlEngine->rootContext()->setContextProperty(QStringLiteral(
"joystickManager"), JoystickManager::instance());
261 qmlEngine->rootContext()->setContextProperty(QStringLiteral(
"debugMessageModel"),
QGCLogging::instance());
265void QGCCorePlugin::createRootWindow(QQmlApplicationEngine *qmlEngine)
267 qmlEngine->load(QUrl(QStringLiteral(
"qrc:/qml/QGroundControl/MainWindow.qml")));
270VideoReceiver *QGCCorePlugin::createVideoReceiver(QObject *parent)
272#ifdef QGC_GST_STREAMING
274#elif defined(QGC_QT_STREAMING)
281void *QGCCorePlugin::createVideoSink(QQuickItem *widget, QObject *parent)
283#ifdef QGC_GST_STREAMING
285#elif defined(QGC_QT_STREAMING)
288 Q_UNUSED(widget); Q_UNUSED(parent);
292void QGCCorePlugin::releaseVideoSink(
void *sink)
294#ifdef QGC_GST_STREAMING
296#elif defined(QGC_QT_STREAMING)
303const QVariantList &QGCCorePlugin::toolBarIndicators()
305 static const QVariantList toolBarIndicatorList = QVariantList(
307 QVariant::fromValue(QUrl::fromUserInput(QStringLiteral(
"qrc:/qml/QGroundControl/Toolbar/RTKGPSIndicator.qml"))),
311 return toolBarIndicatorList;
314QVariantList QGCCorePlugin::firstRunPromptsToShow()
316 QList<int> rgIdsToShow;
318 rgIdsToShow.append(firstRunPromptStdIds());
319 rgIdsToShow.append(firstRunPromptCustomIds());
322 for (
int idToRemove: rgAlreadyShownIds) {
323 (void) rgIdsToShow.removeOne(idToRemove);
326 QVariantList rgVarIdsToShow;
327 for (
int id: rgIdsToShow) {
328 rgVarIdsToShow.append(
id);
331 return rgVarIdsToShow;
334QString QGCCorePlugin::firstRunPromptResource(
int id)
const
337 case kUnitsFirstRunPromptId:
338 return QStringLiteral(
"/qml/QGroundControl/FirstRunPromptDialogs/UnitsFirstRunPrompt.qml");
339 case kOfflineVehicleFirstRunPromptId:
340 return QStringLiteral(
"/qml/QGroundControl/FirstRunPromptDialogs/OfflineVehicleFirstRunPrompt.qml");
346void QGCCorePlugin::_setShowTouchAreas(
bool show)
354void QGCCorePlugin::_setShowAdvancedUI(
bool show)
Q_APPLICATION_STATIC(QGCCorePlugin, _qgcCorePluginInstance)
#define QGC_LOGGING_CATEGORY(name, categoryStr)
static const char * indoorPaletteName
static const char * settingsGroup
static QList< int > firstRunPromptsIdsVariantToList(const QVariant &firstRunPromptIds)
static const char * androidDontSaveToSDCardName
QmlObjectListModel * columns(void) const
void setFontSize(FontSize fontSize)
QmlObjectListModel * appendColumn(void)
Vehicle * specificVehicleForCard(void) const
QGCMAVLink::VehicleClass_t vehicleClass(void) const
void setIcon(const QString &icon)
static const char * telemetrySaveName
void showTouchAreasChanged(bool showTouchAreas)
void showAdvancedUIChanged(bool showAdvancedUI)
static QGCLogging * instance()
Get the singleton instance.
static constexpr const VehicleClass_t VehicleClassFixedWing
static constexpr const VehicleClass_t VehicleClassAirship
static constexpr const VehicleClass_t VehicleClassVTOL
Represents a Qml component which can be loaded from a resource.
VideoReceiver * createVideoReceiver(QObject *parent)
void releaseVideoSink(void *sink)
void * createVideoSink(QQuickItem *widget, QObject *)