5#ifndef QGC_NO_SERIAL_LINK
35#ifdef QGC_CUSTOM_BUILD
39#include <QtCore/QApplicationStatic>
40#include <QtCore/QFile>
41#include <QtQml/QQmlApplicationEngine>
42#include <QtQml/QQmlContext>
43#include <QtQuick/QQuickItem>
47#ifndef QGC_CUSTOM_BUILD
56 qCDebug(QGCCorePluginLog) <<
this;
61 qCDebug(QGCCorePluginLog) <<
this;
66#ifndef QGC_CUSTOM_BUILD
67 return _qgcCorePluginInstance();
69 return CUSTOMCLASS::instance();
79#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
80 static const QVariantList analyzeList = {
82 static const QVariantList analyzeList = {
85 QUrl::fromUserInput(QStringLiteral(
"qrc:/qml/QGroundControl/AnalyzeView/LogViewer/LogViewerPage.qml")),
86 QUrl::fromUserInput(QStringLiteral(
"qrc:/qmlimages/MAVLinkInspector.svg")))),
90 QUrl::fromUserInput(QStringLiteral(
"qrc:/qml/QGroundControl/AnalyzeView/OnboardLogs/OnboardLogPage.qml")),
91 QUrl::fromUserInput(QStringLiteral(
"qrc:/qmlimages/OnboardLogIcon.svg")),
nullptr,
95 QUrl::fromUserInput(QStringLiteral(
"qrc:/qml/QGroundControl/AnalyzeView/GeoTag/GeoTagPage.qml")),
96 QUrl::fromUserInput(QStringLiteral(
"qrc:/qml/QGroundControl/AnalyzeView/GeoTag/GeoTagIcon.svg")))),
98 tr(
"Video Recordings"),
100 QStringLiteral(
"qrc:/qml/QGroundControl/AnalyzeView/VideoRecordings/VideoRecordingsPage.qml")),
101 QUrl::fromUserInput(QStringLiteral(
"qrc:/qmlimages/camera_video.svg")))),
103 tr(
"MAVLink Console"),
105 QStringLiteral(
"qrc:/qml/QGroundControl/AnalyzeView/MAVLinkConsole/MAVLinkConsolePage.qml")),
106 QUrl::fromUserInput(QStringLiteral(
"qrc:/qmlimages/MAVLinkConsoleIcon.svg")),
nullptr,
109 tr(
"MAVLink Inspector"),
111 QStringLiteral(
"qrc:/qml/QGroundControl/AnalyzeView/MAVLinkInspector/MAVLinkInspectorPage.qml")),
112 QUrl::fromUserInput(QStringLiteral(
"qrc:/qmlimages/MAVLinkInspector.svg")),
nullptr,
116 QUrl::fromUserInput(QStringLiteral(
"qrc:/qml/QGroundControl/AnalyzeView/Vibration/VibrationPage.qml")),
117 QUrl::fromUserInput(QStringLiteral(
"qrc:/qmlimages/VibrationPageIcon")),
nullptr,
126 return _defaultOptions;
131 return _emptyCustomMapItems;
136 return _emptyCustomMapItems;
152 if (metaData.
name() == AppSettings::indoorPaletteName) {
153 QVariant outdoorPalette;
154#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
163 else if (metaData.
name() == AppSettings::androidDontSaveToSDCardName) {
168 else if (metaData.
name() == AppSettings::androidUsePosixSerialName) {
169#if defined(Q_OS_ANDROID) && !defined(QGC_NO_SERIAL_LINK)
182 return tr(
"WARNING: You are about to enter Advanced Mode. "
183 "If used incorrectly, this may cause your vehicle to malfunction thus voiding your warranty. "
184 "You should do so only if instructed by customer support. "
185 "Are you sure you want to enable Advanced Mode?");
200#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
219 value->
setFact(
"Vehicle",
"AltitudeRelative");
220 value->setIcon(
"arrow-thick-up.svg");
221 value->setText(value->fact()->shortDescription());
222 value->setShowUnits(
true);
227 if (includeFWValues) {
228 value->setFact(
"Vehicle",
"AirSpeed");
229 value->setText(
"AirSpd");
230 value->setShowUnits(
true);
232 value->setFact(
"Vehicle",
"GroundSpeed");
233 value->setIcon(
"arrow-simple-right.svg");
234 value->setText(value->fact()->shortDescription());
235 value->setShowUnits(
true);
245 if (includeFWValues) {
254 value->
setFact(QStringLiteral(
"Vehicle"), QStringLiteral(
"AltitudeRelative"));
255 value->setIcon(QStringLiteral(
"arrow-thick-up.svg"));
256 value->setText(value->fact()->shortDescription());
257 value->setShowUnits(
true);
260 value->
setFact(QStringLiteral(
"Vehicle"), QStringLiteral(
"DistanceToHome"));
261 value->setIcon(QStringLiteral(
"bookmark copy 3.svg"));
262 value->setText(value->fact()->shortDescription());
263 value->setShowUnits(
true);
269 value->
setFact(QStringLiteral(
"Vehicle"), QStringLiteral(
"ClimbRate"));
270 value->setIcon(QStringLiteral(
"arrow-simple-up.svg"));
271 value->setText(value->fact()->shortDescription());
272 value->setShowUnits(
true);
275 value->
setFact(QStringLiteral(
"Vehicle"), QStringLiteral(
"GroundSpeed"));
276 value->setIcon(QStringLiteral(
"arrow-simple-right.svg"));
277 value->setText(value->fact()->shortDescription());
278 value->setShowUnits(
true);
280 if (includeFWValues) {
285 value->setFact(QStringLiteral(
"Vehicle"), QStringLiteral(
"AirSpeed"));
286 value->setText(QStringLiteral(
"AirSpd"));
287 value->setShowUnits(
true);
290 value->setFact(QStringLiteral(
"Vehicle"), QStringLiteral(
"ThrottlePct"));
291 value->setText(QStringLiteral(
"Thr"));
292 value->setShowUnits(
true);
299 value->
setFact(QStringLiteral(
"Vehicle"), QStringLiteral(
"FlightTime"));
300 value->setIcon(QStringLiteral(
"timer.svg"));
301 value->setText(value->fact()->shortDescription());
302 value->setShowUnits(
false);
305 value->
setFact(QStringLiteral(
"Vehicle"), QStringLiteral(
"FlightDistance"));
306 value->setIcon(QStringLiteral(
"travel-walk.svg"));
307 value->setText(value->fact()->shortDescription());
308 value->setShowUnits(
true);
314 QQmlApplicationEngine *
const qmlEngine =
new QQmlApplicationEngine(parent);
315 qmlEngine->addImportPath(QStringLiteral(
"qrc:/qml"));
327 qmlEngine->load(QUrl(QStringLiteral(
"qrc:/qml/QGroundControl/MainWindow.qml")));
337 static const QVariantList toolBarIndicatorList = QVariantList({
338 QVariant::fromValue(QUrl::fromUserInput(QStringLiteral(
"qrc:/qml/QGroundControl/Toolbar/GPSIndicator.qml"))),
340 QUrl::fromUserInput(QStringLiteral(
"qrc:/qml/QGroundControl/Toolbar/VideoStreamIndicator.qml"))),
343 return toolBarIndicatorList;
357 QList<int> rgIdsToShow;
363 for (
int idToRemove: rgAlreadyShownIds) {
364 (void) rgIdsToShow.removeOne(idToRemove);
367 QVariantList rgVarIdsToShow;
368 for (
int id: rgIdsToShow) {
369 rgVarIdsToShow.append(
id);
372 return rgVarIdsToShow;
379 return QStringLiteral(
"/qml/QGroundControl/FirstRunPromptDialogs/InitialSetupPrompt.qml");
385void QGCCorePlugin::_setShowTouchAreas(
bool show)
393void QGCCorePlugin::_setShowAdvancedUI(
bool show)
403 auto makeEntry = [](
const char* canonical,
const QString& translated) {
405 entry[QStringLiteral(
"canonicalName")] = QString(canonical);
406 entry[QStringLiteral(
"translatedName")] = translated;
431 const QString &complexItemType,
434 const QString &kmlOrShpFile)
448 qCWarning(QGCCorePluginLog) <<
"QGCCorePlugin::createComplexMissionItem - Unknown complex item type:" << complexItemType;
Q_APPLICATION_STATIC(QGCCorePlugin, _qgcCorePluginInstance)
#define QGC_LOGGING_CATEGORY(name, categoryStr)
static QList< int > firstRunPromptsIdsVariantToList(const QVariant &firstRunPromptIds)
static constexpr const char * canonicalName
static constexpr const char * jsonComplexItemTypeValue
QmlObjectListModel * columns(void) const
void setFontSize(FontSize fontSize)
Q_INVOKABLE QmlObjectListModel * appendColumn(void)
Vehicle * specificVehicleForCard(void) const
QGCMAVLinkTypes::VehicleClass_t vehicleClass(void) const
Q_INVOKABLE void appendRow(void)
bool singleVehicleSupport()
Returns true if the system supports only a single firmware class with a single vehicle type.
static FirmwarePluginManager * instance()
static constexpr const char * jsonComplexItemTypeValue
static constexpr const char * canonicalName
Q_INVOKABLE void setFact(const QString &factGroupName, const QString &factName)
static JoystickManager * instance()
Master controller for mission, fence, rally.
Extension mechanism for generic, non-firmware-specific customization of QGC.
virtual ComplexMissionItem * createComplexMissionItem(const QString &complexItemType, PlanMasterController *masterController, bool flyView, const QString &kmlOrShpFile=QString())
virtual QList< int > firstRunPromptStdIds()
QGCCorePlugin(QObject *parent=nullptr)
virtual QVariantList complexMissionItemNames(Vehicle *vehicle)
void showTouchAreasChanged(bool showTouchAreas)
virtual void factValueGridCreateDefaultSettings(FactValueGrid *factValueGrid)
void showAdvancedUIChanged(bool showAdvancedUI)
virtual const QVariantList & toolBarIndicators()
virtual QList< int > firstRunPromptCustomIds()
virtual Q_INVOKABLE QString firstRunPromptResource(int id) const
Returns the resource which contains the specified first run prompt for display.
static constexpr int kInitialSetupPromptId
virtual QGCOptions * options()
virtual QQmlApplicationEngine * createQmlApplicationEngine(QObject *parent)
virtual bool showInitialSetupMeasurementUnits() const
virtual const QVariantList & analyzePages()
virtual bool showInitialSetupVehiclePreferences() const
virtual QString showAdvancedUIMessage() const
virtual void createRootWindow(QQmlApplicationEngine *qmlEngine)
Allows the plugin to override the creation of the root (native) window.
virtual VideoReceiver * createVideoReceiver(QObject *parent)
Allows the plugin to override the creation of VideoReceiver.
virtual const QmlObjectListModel * customGeoMapItems()
Q_INVOKABLE QVariantList firstRunPromptsToShow()
Returns the list of first run prompt ids which need to be displayed according to current settings.
virtual const QmlObjectListModel * customMapItems()
Allows custom builds to add custom items to the FlightMap. Objects put into QmlObjectListModel should...
virtual QList< PlanCreator * > planCreators(PlanMasterController *planMasterController)
virtual void adjustSettingMetaData(const QString &settingsGroup, FactMetaData &metaData, bool &userVisible)
virtual void destroyQmlApplicationEngine(QQmlApplicationEngine *qmlEngine)
static QGCCorePlugin * 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.
QString settingsGroup() const
static SettingsManager * instance()
static constexpr const char * canonicalName
static constexpr const char * jsonComplexItemTypeValue
static constexpr const char * jsonComplexItemTypeValue
static constexpr const char * canonicalName
static constexpr const char * canonicalName
static constexpr const char * jsonComplexItemTypeValue
static VideoBackend & instance()
virtual VideoReceiver * createReceiver(QObject *parent)=0
A receiver that can play: once initialize() has failed, one that needs no initialization.
bool hasPosixSerialPorts()
Whether the device has a serial port node that QGC may read and write.