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")),
95 QUrl::fromUserInput(QStringLiteral(
"qrc:/qml/QGroundControl/AnalyzeView/GeoTag/GeoTagPage.qml")),
96 QUrl::fromUserInput(QStringLiteral(
"qrc:/qml/QGroundControl/AnalyzeView/GeoTag/GeoTagIcon.svg")))),
98 tr(
"MAVLink Console"),
99 QUrl::fromUserInput(QStringLiteral(
"qrc:/qml/QGroundControl/AnalyzeView/MAVLinkConsole/MAVLinkConsolePage.qml")),
100 QUrl::fromUserInput(QStringLiteral(
"qrc:/qmlimages/MAVLinkConsoleIcon.svg")),
103 tr(
"MAVLink Inspector"),
104 QUrl::fromUserInput(QStringLiteral(
"qrc:/qml/QGroundControl/AnalyzeView/MAVLinkInspector/MAVLinkInspectorPage.qml")),
105 QUrl::fromUserInput(QStringLiteral(
"qrc:/qmlimages/MAVLinkInspector.svg")),
109 QUrl::fromUserInput(QStringLiteral(
"qrc:/qml/QGroundControl/AnalyzeView/Vibration/VibrationPage.qml")),
110 QUrl::fromUserInput(QStringLiteral(
"qrc:/qmlimages/VibrationPageIcon")),
119 return _defaultOptions;
124 return _emptyCustomMapItems;
140 if (metaData.
name() == AppSettings::indoorPaletteName) {
141 QVariant outdoorPalette;
142#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
151 else if (metaData.
name() == AppSettings::androidDontSaveToSDCardName) {
156 else if (metaData.
name() == AppSettings::androidUsePosixSerialName) {
157#if defined(Q_OS_ANDROID) && !defined(QGC_NO_SERIAL_LINK)
170 return tr(
"WARNING: You are about to enter Advanced Mode. "
171 "If used incorrectly, this may cause your vehicle to malfunction thus voiding your warranty. "
172 "You should do so only if instructed by customer support. "
173 "Are you sure you want to enable Advanced Mode?");
188#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
207 value->
setFact(
"Vehicle",
"AltitudeRelative");
208 value->setIcon(
"arrow-thick-up.svg");
209 value->setText(value->fact()->shortDescription());
210 value->setShowUnits(
true);
215 if (includeFWValues) {
216 value->
setFact(
"Vehicle",
"AirSpeed");
217 value->setText(
"AirSpd");
218 value->setShowUnits(
true);
220 value->setFact(
"Vehicle",
"GroundSpeed");
221 value->setIcon(
"arrow-simple-right.svg");
222 value->setText(value->fact()->shortDescription());
223 value->setShowUnits(
true);
233 if (includeFWValues) {
242 value->
setFact(QStringLiteral(
"Vehicle"), QStringLiteral(
"AltitudeRelative"));
243 value->setIcon(QStringLiteral(
"arrow-thick-up.svg"));
244 value->setText(value->fact()->shortDescription());
245 value->setShowUnits(
true);
248 value->
setFact(QStringLiteral(
"Vehicle"), QStringLiteral(
"DistanceToHome"));
249 value->setIcon(QStringLiteral(
"bookmark copy 3.svg"));
250 value->setText(value->fact()->shortDescription());
251 value->setShowUnits(
true);
257 value->
setFact(QStringLiteral(
"Vehicle"), QStringLiteral(
"ClimbRate"));
258 value->setIcon(QStringLiteral(
"arrow-simple-up.svg"));
259 value->setText(value->fact()->shortDescription());
260 value->setShowUnits(
true);
263 value->
setFact(QStringLiteral(
"Vehicle"), QStringLiteral(
"GroundSpeed"));
264 value->setIcon(QStringLiteral(
"arrow-simple-right.svg"));
265 value->setText(value->fact()->shortDescription());
266 value->setShowUnits(
true);
268 if (includeFWValues) {
273 value->setFact(QStringLiteral(
"Vehicle"), QStringLiteral(
"AirSpeed"));
274 value->setText(QStringLiteral(
"AirSpd"));
275 value->setShowUnits(
true);
278 value->setFact(QStringLiteral(
"Vehicle"), QStringLiteral(
"ThrottlePct"));
279 value->setText(QStringLiteral(
"Thr"));
280 value->setShowUnits(
true);
287 value->
setFact(QStringLiteral(
"Vehicle"), QStringLiteral(
"FlightTime"));
288 value->setIcon(QStringLiteral(
"timer.svg"));
289 value->setText(value->fact()->shortDescription());
290 value->setShowUnits(
false);
293 value->
setFact(QStringLiteral(
"Vehicle"), QStringLiteral(
"FlightDistance"));
294 value->setIcon(QStringLiteral(
"travel-walk.svg"));
295 value->setText(value->fact()->shortDescription());
296 value->setShowUnits(
true);
302 QQmlApplicationEngine *
const qmlEngine =
new QQmlApplicationEngine(parent);
303 qmlEngine->addImportPath(QStringLiteral(
"qrc:/qml"));
315 qmlEngine->load(QUrl(QStringLiteral(
"qrc:/qml/QGroundControl/MainWindow.qml")));
335 static const QVariantList toolBarIndicatorList = QVariantList(
337 QVariant::fromValue(QUrl::fromUserInput(QStringLiteral(
"qrc:/qml/QGroundControl/Toolbar/RTKGPSIndicator.qml"))),
341 return toolBarIndicatorList;
355 QList<int> rgIdsToShow;
361 for (
int idToRemove: rgAlreadyShownIds) {
362 (void) rgIdsToShow.removeOne(idToRemove);
365 QVariantList rgVarIdsToShow;
366 for (
int id: rgIdsToShow) {
367 rgVarIdsToShow.append(
id);
370 return rgVarIdsToShow;
377 return QStringLiteral(
"/qml/QGroundControl/FirstRunPromptDialogs/InitialSetupPrompt.qml");
383void QGCCorePlugin::_setShowTouchAreas(
bool show)
391void QGCCorePlugin::_setShowAdvancedUI(
bool show)
401 auto makeEntry = [](
const char* canonical,
const QString& translated) {
403 entry[QStringLiteral(
"canonicalName")] = QString(canonical);
404 entry[QStringLiteral(
"translatedName")] = translated;
429 const QString &complexItemType,
432 const QString &kmlOrShpFile)
446 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 * createVideoSink(QQuickItem *widget, QObject *parent)
Allows the plugin to override the creation of VideoSink.
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 void releaseVideoSink(void *sink)
Allows the plugin to override the release of VideoSink.
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
bool hasPosixSerialPorts()
void releaseSink(void *sink)
void * createSink(QQuickItem *widget, QObject *parent)
VideoReceiver * createReceiver(QObject *parent)