当前位置: 首页 > news >正文

机器人地面站-[QGroundControl源码解析]-[7]-[api]

目录

前言

一.QmlComponentInfo

二.QGCSettings

三.QGCOptions

四.QGCCorePlugin

总结


前言

上篇讲完了Analyize中内容,主要对应界面上AnalyzeTool模块的功能。本篇我们来过api文件夹下的代码。api下的代码主要实现了qgc的核心接口,应用所有的选项和设置。下面来分析代码。

一.QmlComponentInfo

该类表示在设置界面中左侧的按钮如图

 代码也比较简单

/****************************************************************************
 *
 * (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
 *
 * QGroundControl is licensed according to the terms in the file
 * COPYING.md in the root of the source code directory.
 *
 ****************************************************************************/

#pragma once

#include <QObject>
#include <QUrl>

/// Represents a Qml component which can be loaded from a resource.
/// 表示可以从资源加载的Qml组件。
class QmlComponentInfo : public QObject
{
    Q_OBJECT

public:
    QmlComponentInfo(QString title, QUrl url, QUrl icon = QUrl(), QObject* parent = nullptr);

    Q_PROPERTY(QString  title   READ title  CONSTANT)   ///< Title for page
    Q_PROPERTY(QUrl     url     READ url    CONSTANT)   ///< Qml source code
    Q_PROPERTY(QUrl     icon    READ icon   CONSTANT)   ///< Icon for page

    virtual QString title   () { return _title; }
    virtual QUrl    url     () { return _url;   }
    virtual QUrl    icon    () { return _icon;  }

protected:
    QString _title; //标题
    QUrl    _url;   //链接
    QUrl    _icon;  //图表
};
/****************************************************************************
 *
 * (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
 *
 * QGroundControl is licensed according to the terms in the file
 * COPYING.md in the root of the source code directory.
 *
 ****************************************************************************/

#include "QmlComponentInfo.h"
//构造函数
QmlComponentInfo::QmlComponentInfo(QString title, QUrl url, QUrl icon, QObject* parent)
    : QObject   (parent)
    , _title    (title)
    , _url      (url)
    , _icon     (icon)
{

}

二.QGCSettings

该类和QmlComponentInfo类似,也是用来指定某个设置的条目的。

/****************************************************************************
 *
 * (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
 *
 * QGroundControl is licensed according to the terms in the file
 * COPYING.md in the root of the source code directory.
 *
 ****************************************************************************/

#pragma once

#include <QObject>
#include <QUrl>

/// @file
/// @brief Core Plugin Interface for QGroundControl. Settings element.
/// QGroundControl的核心插件接口。 设置元素
/// @author Gus Grubba <gus@auterion.com>

class QGCSettings : public QObject
{
    Q_OBJECT
public:
    QGCSettings(QString title, QUrl url, QUrl icon = QUrl());

    Q_PROPERTY(QString  title       READ title      CONSTANT)
    Q_PROPERTY(QUrl     url         READ url        CONSTANT)
    Q_PROPERTY(QUrl     icon        READ icon       CONSTANT)

    virtual QString     title       () { return _title; }
    virtual QUrl        url         () { return _url;   }
    virtual QUrl        icon        () { return _icon;  }

protected:
    QString _title;  //设置标题
    QUrl    _url;    //设置路径
    QUrl    _icon;   //设置图标
};
/****************************************************************************
 *
 * (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
 *
 * QGroundControl is licensed according to the terms in the file
 * COPYING.md in the root of the source code directory.
 *
 ****************************************************************************/

#include "QGCSettings.h"

/// @file
///     @brief Core Plugin Interface for QGroundControl. Settings element.
///     @author Gus Grubba <gus@auterion.com>

QGCSettings::QGCSettings(QString title, QUrl url, QUrl icon)
    : _title(title)
    , _url(url)
    , _icon(icon)
{
}

三.QGCOptions

此类用来保存QGC中的选项。里面包含了各种选项。

/****************************************************************************
 *
 * (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
 *
 * QGroundControl is licensed according to the terms in the file
 * COPYING.md in the root of the source code directory.
 *
 ****************************************************************************/

#pragma once

#include <QObject>
#include <QString>
#include <QUrl>
#include <QColor>

class QGCOptions;

class QGCFlyViewOptions : public QObject
{
    Q_OBJECT
public:
    QGCFlyViewOptions(QGCOptions* options, QObject* parent = nullptr);

    Q_PROPERTY(bool                     showMultiVehicleList            READ showMultiVehicleList           CONSTANT)
    Q_PROPERTY(bool                     showInstrumentPanel             READ showInstrumentPanel            CONSTANT)
    Q_PROPERTY(bool                     showMapScale                    READ showMapScale                   CONSTANT)
    Q_PROPERTY(bool                     guidedBarShowEmergencyStop      READ guidedBarShowEmergencyStop     NOTIFY guidedBarShowEmergencyStopChanged)
    Q_PROPERTY(bool                     guidedBarShowOrbit              READ guidedBarShowOrbit             NOTIFY guidedBarShowOrbitChanged)
    Q_PROPERTY(bool                     guidedBarShowROI                READ guidedBarShowROI               NOTIFY guidedBarShowROIChanged)

protected:
    virtual bool    showMultiVehicleList        () const { return true; }
    virtual bool    showMapScale                () const { return true; }
    virtual bool    showInstrumentPanel         () const { return true; }
    virtual bool    guidedBarShowEmergencyStop  () const { return true; }
    virtual bool    guidedBarShowOrbit          () const { return true; }
    virtual bool    guidedBarShowROI            () const { return true; }

    QGCOptions* _options;

signals:
    void guidedBarShowEmergencyStopChanged      (bool show);
    void guidedBarShowOrbitChanged              (bool show);
    void guidedBarShowROIChanged                (bool show);
};

class QGCOptions : public QObject
{
    Q_OBJECT
public:
    QGCOptions(QObject* parent = nullptr);

    Q_PROPERTY(bool                     combineSettingsAndSetup         READ combineSettingsAndSetup        CONSTANT)
    Q_PROPERTY(double                   toolbarHeightMultiplier         READ toolbarHeightMultiplier        CONSTANT)
    Q_PROPERTY(bool                     enablePlanViewSelector          READ enablePlanViewSelector         CONSTANT)
    Q_PROPERTY(QUrl                     preFlightChecklistUrl           READ preFlightChecklistUrl          CONSTANT)
    Q_PROPERTY(bool                     showSensorCalibrationCompass    READ showSensorCalibrationCompass   NOTIFY showSensorCalibrationCompassChanged)
    Q_PROPERTY(bool                     showSensorCalibrationGyro       READ showSensorCalibrationGyro      NOTIFY showSensorCalibrationGyroChanged)
    Q_PROPERTY(bool                     showSensorCalibrationAccel      READ showSensorCalibrationAccel     NOTIFY showSensorCalibrationAccelChanged)
    Q_PROPERTY(bool                     showSensorCalibrationLevel      READ showSensorCalibrationLevel     NOTIFY showSensorCalibrationLevelChanged)
    Q_PROPERTY(bool                     showSensorCalibrationAirspeed   READ showSensorCalibrationAirspeed  NOTIFY showSensorCalibrationAirspeedChanged)
    Q_PROPERTY(bool                     sensorsHaveFixedOrientation     READ sensorsHaveFixedOrientation    CONSTANT)
    Q_PROPERTY(bool                     wifiReliableForCalibration      READ wifiReliableForCalibration     CONSTANT)
    Q_PROPERTY(bool                     showFirmwareUpgrade             READ showFirmwareUpgrade            NOTIFY showFirmwareUpgradeChanged)
    Q_PROPERTY(QString                  firmwareUpgradeSingleURL        READ firmwareUpgradeSingleURL       CONSTANT)
    Q_PROPERTY(bool                     missionWaypointsOnly            READ missionWaypointsOnly           NOTIFY missionWaypointsOnlyChanged)
    Q_PROPERTY(bool                     multiVehicleEnabled             READ multiVehicleEnabled            NOTIFY multiVehicleEnabledChanged)
    Q_PROPERTY(bool                     showOfflineMapExport            READ showOfflineMapExport           NOTIFY showOfflineMapExportChanged)
    Q_PROPERTY(bool                     showOfflineMapImport            READ showOfflineMapImport           NOTIFY showOfflineMapImportChanged)
    Q_PROPERTY(bool                     useMobileFileDialog             READ useMobileFileDialog            CONSTANT)
    Q_PROPERTY(bool                     showMissionStatus               READ showMissionStatus              CONSTANT)
    Q_PROPERTY(bool                     guidedActionsRequireRCRSSI      READ guidedActionsRequireRCRSSI     CONSTANT)
    Q_PROPERTY(bool                     showMissionAbsoluteAltitude     READ showMissionAbsoluteAltitude    NOTIFY showMissionAbsoluteAltitudeChanged)
    Q_PROPERTY(bool                     showSimpleMissionStart          READ showSimpleMissionStart         NOTIFY showSimpleMissionStartChanged)
    Q_PROPERTY(bool                     disableVehicleConnection        READ disableVehicleConnection       CONSTANT)
    Q_PROPERTY(float                    devicePixelRatio                READ devicePixelRatio               NOTIFY devicePixelRatioChanged)
    Q_PROPERTY(float                    devicePixelDensity              READ devicePixelDensity             NOTIFY devicePixelDensityChanged)
    Q_PROPERTY(bool                     checkFirmwareVersion            READ checkFirmwareVersion           CONSTANT)
    Q_PROPERTY(bool                     showMavlinkLogOptions           READ showMavlinkLogOptions          CONSTANT)
    Q_PROPERTY(bool                     enableSaveMainWindowPosition    READ enableSaveMainWindowPosition   CONSTANT)
    Q_PROPERTY(QStringList              surveyBuiltInPresetNames        READ surveyBuiltInPresetNames       CONSTANT)

    Q_PROPERTY(QGCFlyViewOptions*       flyView                         READ flyViewOptions                 CONSTANT)

    /// Should QGC hide its settings menu and colapse it into one single menu (Settings and Vehicle Setup)?
    /// QGC是否应该隐藏它的设置菜单,并将其折叠成一个单一的菜单(设置和车辆设置)?
    /// @return true if QGC should consolidate both menus into one.
    virtual bool        combineSettingsAndSetup     () { return false; }

    /// Main ToolBar Multiplier.主工具栏乘数。
    /// @return Factor to use when computing toolbar height
    virtual double      toolbarHeightMultiplier     () { return 1.0; }

    /// Enable Plan View Selector (Mission, Fence or Rally)
    /// 启用计划视图选择器(任务,栅栏或拉力赛)
    /// @return True or false
    virtual bool        enablePlanViewSelector      () { return true; }

    /// Should the mission status indicator (Plan View) be shown?
    /// 是否应显示任务状态指示器(计划视图)?
    /// @return Yes or no
    virtual bool    showMissionStatus               () { return true; }

    /// Provides an optional, custom preflight checklist
    /// 提供可选的自定义飞行前检查清单
    virtual QUrl    preFlightChecklistUrl           () const { return QUrl::fromUserInput("qrc:/qml/PreFlightCheckList.qml"); }

    /// Allows replacing the toolbar Light Theme color
    /// 允许替换工具栏的光主题颜色
    virtual QColor  toolbarBackgroundLight          () const;
    /// Allows replacing the toolbar Dark Theme color
    /// 允许替换工具栏的暗主题颜色
    virtual QColor  toolbarBackgroundDark           () const;
    /// By returning false you can hide the following sensor calibration pages
    /// 通过返回false,您可以隐藏以下传感器校准页面
    virtual bool    showSensorCalibrationCompass    () const { return true; }
    virtual bool    showSensorCalibrationGyro       () const { return true; }
    virtual bool    showSensorCalibrationAccel      () const { return true; }
    virtual bool    showSensorCalibrationLevel      () const { return true; }
    virtual bool    showSensorCalibrationAirspeed   () const { return true; }
    virtual bool    wifiReliableForCalibration      () const { return false; }
    virtual bool    sensorsHaveFixedOrientation     () const { return false; }
    virtual bool    showFirmwareUpgrade             () const { return true; }
    virtual bool    missionWaypointsOnly            () const { return false; }  ///< true: Only allow waypoints and complex items in Plan 计划中只允许路径点和复杂项目
    virtual bool    multiVehicleEnabled             () const { return true; }   ///< false: multi vehicle support is disabled 多设备支持被禁用
    virtual bool    guidedActionsRequireRCRSSI      () const { return false; }  ///< true: Guided actions will be disabled is there is no RC RSSI 如果没有RC RSSI,引导动作将被禁用
    virtual bool    showOfflineMapExport            () const { return true; }
    virtual bool    showOfflineMapImport            () const { return true; }
    virtual bool    showMissionAbsoluteAltitude     () const { return true; }
    virtual bool    showSimpleMissionStart          () const { return false; }
    virtual bool    disableVehicleConnection        () const { return false; }  ///< true: vehicle connection is disabled
    virtual bool    checkFirmwareVersion            () const { return true; }
    virtual bool    showMavlinkLogOptions           () const { return true; }
    /// Desktop builds save the main application size and position on close (and restore it on open)
    /// 桌面构建在关闭时保存主应用程序的大小和位置(并在打开时恢复)
    virtual bool    enableSaveMainWindowPosition    () const { return true; }
    virtual QStringList surveyBuiltInPresetNames    () const { return QStringList(); } // Built in presets cannot be deleted

#if defined(__mobile__)
    virtual bool    useMobileFileDialog             () const { return true;}
#else
    virtual bool    useMobileFileDialog             () const { return false;}
#endif

    /// If returned QString in non-empty it means that firmware upgrade will run in a mode which only
    /// supports downloading a single firmware file from the URL. It also supports custom install through
    /// the Advanced options.
    /// 如果返回的QString不为空,这意味着固件升级将以只支持从URL下载单个固件文件的模式运行。 它还支持通过高级选项自定义安装。
    virtual QString firmwareUpgradeSingleURL        () const { return QString(); }

    /// Device specific pixel ratio/density (for when Qt doesn't properly read it from the hardware)
    /// 特定于设备的像素比/密度(当Qt不能正确地从硬件读取它时)
    virtual float   devicePixelRatio                () const { return 0.0f; }
    virtual float   devicePixelDensity              () const { return 0.0f; }

    virtual QGCFlyViewOptions* flyViewOptions       ();

signals:
    void showSensorCalibrationCompassChanged    (bool show);
    void showSensorCalibrationGyroChanged       (bool show);
    void showSensorCalibrationAccelChanged      (bool show);
    void showSensorCalibrationLevelChanged      (bool show);
    void showSensorCalibrationAirspeedChanged   (bool show);
    void showFirmwareUpgradeChanged             (bool show);
    void missionWaypointsOnlyChanged            (bool missionWaypointsOnly);
    void multiVehicleEnabledChanged             (bool multiVehicleEnabled);
    void showOfflineMapExportChanged            ();
    void showOfflineMapImportChanged            ();
    void showMissionAbsoluteAltitudeChanged     ();
    void showSimpleMissionStartChanged          ();
    void devicePixelRatioChanged                ();
    void devicePixelDensityChanged              ();

protected:
    QGCFlyViewOptions* _defaultFlyViewOptions = nullptr;
};

cc文件

/****************************************************************************
 *
 * (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
 *
 * QGroundControl is licensed according to the terms in the file
 * COPYING.md in the root of the source code directory.
 *
 ****************************************************************************/

#include "QGCOptions.h"

#include <QtQml>

/// @file
///     @brief Core Plugin Interface for QGroundControl - Application Options
///     QGroundControl的核心插件接口-应用程序选项
///     @author Gus Grubba <gus@auterion.com>

QGCOptions::QGCOptions(QObject* parent)
    : QObject(parent)
{
    QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership);
}

QColor QGCOptions::toolbarBackgroundLight() const
{
    return QColor(255,255,255);
}

QColor QGCOptions::toolbarBackgroundDark() const
{
    return QColor(0,0,0);
}

QGCFlyViewOptions* QGCOptions::flyViewOptions(void)
{
    if (!_defaultFlyViewOptions) {
        _defaultFlyViewOptions = new QGCFlyViewOptions(this);
    }
    return _defaultFlyViewOptions;
}

QGCFlyViewOptions::QGCFlyViewOptions(QGCOptions* options, QObject* parent)
    : QObject   (parent)
    , _options  (options)
{
    QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership);
}

四.QGCCorePlugin

该类提供了QGroundControl的核心插件接口。控制各个界面按钮显示。

/****************************************************************************
 *
 * (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
 *
 * QGroundControl is licensed according to the terms in the file
 * COPYING.md in the root of the source code directory.
 *
 ****************************************************************************/

#pragma once

#include "QGCToolbox.h"
#include "QGCPalette.h"
#include "QGCMAVLink.h"
#include "QmlObjectListModel.h"

#include <QObject>
#include <QVariantList>

/// @file
/// @brief Core Plugin Interface for QGroundControl
/// @author Gus Grubba <gus@auterion.com>

class QGCApplication;
class QGCOptions;
class QGCSettings;
class QGCCorePlugin_p;
class FactMetaData;
class QGeoPositionInfoSource;
class QQmlApplicationEngine;
class Vehicle;
class LinkInterface;
class QmlObjectListModel;
class VideoReceiver;
class VideoSink;
class PlanMasterController;
class QGCCameraManager;
class QGCCameraControl;
class QQuickItem;
class InstrumentValueAreaController;

//核心插件类 继承自qgctool
class QGCCorePlugin : public QGCTool
{
    Q_OBJECT
public:
    QGCCorePlugin(QGCApplication* app, QGCToolbox* toolbox);
    ~QGCCorePlugin();

    Q_PROPERTY(QVariantList         settingsPages                   READ settingsPages                                  NOTIFY settingsPagesChanged) //设置界面
    Q_PROPERTY(QVariantList         analyzePages                    READ analyzePages                                   NOTIFY analyzePagesChanged)  //分析界面
    Q_PROPERTY(int                  defaultSettings                 READ defaultSettings                                CONSTANT) //默认设置
    Q_PROPERTY(QGCOptions*          options                         READ options                                        CONSTANT) //选项
    Q_PROPERTY(bool                 showTouchAreas                  READ showTouchAreas         WRITE setShowTouchAreas NOTIFY showTouchAreasChanged) //显示触控区域
    Q_PROPERTY(bool                 showAdvancedUI                  READ showAdvancedUI         WRITE setShowAdvancedUI NOTIFY showAdvancedUIChanged) //显示高级ui
    Q_PROPERTY(QString              showAdvancedUIMessage           READ showAdvancedUIMessage                          CONSTANT) //显示高级ui信息
    Q_PROPERTY(QString              brandImageIndoor                READ brandImageIndoor                               CONSTANT) //
    Q_PROPERTY(QString              brandImageOutdoor               READ brandImageOutdoor                              CONSTANT)
    Q_PROPERTY(QmlObjectListModel*  customMapItems                  READ customMapItems                                 CONSTANT)
    Q_PROPERTY(QVariantList         toolBarIndicators               READ toolBarIndicators                              NOTIFY toolBarIndicatorsChanged) //工具栏指示器
    Q_PROPERTY(int                  unitsFirstRunPromptId           MEMBER unitsFirstRunPromptId                        CONSTANT)
    Q_PROPERTY(int                  offlineVehicleFirstRunPromptId  MEMBER offlineVehicleFirstRunPromptId               CONSTANT)

    Q_INVOKABLE bool guidedActionsControllerLogging() const;

    /// The list of settings under the Settings Menu
    /// 设置菜单下的设置列表
    /// @return A list of QGCSettings
    virtual QVariantList& settingsPages();

    /// The list of pages/buttons under the Analyze Menu
    /// Analyze菜单下的页面/按钮列表
    /// @return A list of QmlPageInfo
    virtual QVariantList& analyzePages();

    /// The default settings panel to show
    /// 显示的默认设置面板
    /// @return The settings index
    virtual int defaultSettings();

    /// Global options
    /// @return An instance of QGCOptions 全局选项
    virtual QGCOptions* options();

    /// Allows the core plugin to override the visibility for a settings group
    /// 允许核心插件覆盖设置组的可见性
    ///     @param name - SettingsGroup name
    /// @return true: Show settings ui, false: Hide settings ui
    virtual bool overrideSettingsGroupVisibility(QString name);

    /// Allows the core plugin to override the setting meta data before the setting fact is created.
    /// 允许核心插件在创建设置事实之前覆盖设置元数据。
    ///     @param settingsGroup - QSettings group which contains this item
    ///     @param metaData - MetaData for setting fact
    /// @return true: Setting should be visible in ui, false: Setting should not be shown in ui
    virtual bool adjustSettingMetaData(const QString& settingsGroup, FactMetaData& metaData);

    /// Return the resource file which contains the brand image for for Indoor theme.
    /// 返回包含室内主题的品牌形象的资源文件。
    virtual QString brandImageIndoor() const { return QString(); }

    /// Return the resource file which contains the brand image for for Outdoor theme.
    virtual QString brandImageOutdoor() const { return QString(); }

    /// @return The message to show to the user when they a re prompted to confirm turning on advanced ui.
    /// 当用户被提示确认打开高级ui时显示给用户的消息。
    virtual QString showAdvancedUIMessage() const;

    /// @return An instance of an alternate position source (or NULL if not available)
    /// 备用位置源的实例(如果不可用则为NULL)
    virtual QGeoPositionInfoSource* createPositionSource(QObject* /*parent*/) { return nullptr; }

    /// Allows a plugin to override the specified color name from the palette
    /// 允许插件覆盖调色板中指定的颜色名称
    virtual void paletteOverride(QString colorName, QGCPalette::PaletteColorInfo_t& colorInfo);

    virtual void factValueGridCreateDefaultSettings(const QString& defaultSettingsGroup);

    /// Allows the plugin to override or get access to the QmlApplicationEngine to do things like add import
    /// path or stuff things into the context prior to window creation.
    /// 允许插件覆盖或访问QmlApplicationEngine来做一些事情,如添加导入路径或在创建窗口之前将东西放入上下文。
    virtual QQmlApplicationEngine* createQmlApplicationEngine(QObject* parent);

    /// Allows the plugin to override the creation of the root (native) window.
    /// 允许插件覆盖根(本机)窗口的创建。
    virtual void createRootWindow(QQmlApplicationEngine* qmlEngine);

    /// Allows the plugin to override the creation of VideoManager.
    /// 允许插件覆盖VideoManager的创建。
    virtual VideoManager* createVideoManager(QGCApplication* app, QGCToolbox* toolbox);
    /// Allows the plugin to override the creation of VideoReceiver.
    /// 允许插件覆盖VideoReceiver的创建
    virtual VideoReceiver* createVideoReceiver(QObject* parent);
    /// Allows the plugin to override the creation of VideoSink.
    /// 允许插件覆盖VideoSink的创建。
    virtual void* createVideoSink(QObject* parent, QQuickItem* widget);
    /// Allows the plugin to override the release of VideoSink.
    /// 允许插件覆盖VideoSink的释放
    virtual void releaseVideoSink(void* sink);

    /// Allows the plugin to see all mavlink traffic to a vehicle
    /// 允许插件看到所有mavlink流量到车辆
    /// @return true: Allow vehicle to continue processing, false: Vehicle should not process message
    virtual bool mavlinkMessage(Vehicle* vehicle, LinkInterface* link, mavlink_message_t message);

    /// Allows custom builds to add custom items to the FlightMap. Objects put into QmlObjectListModel should derive from QmlComponentInfo and set the url property.
    /// 允许自定义构建向FlightMap添加自定义项目。 放在QmlObjectListModel中的对象应该派生自QmlComponentInfo并设置url属性。
    virtual QmlObjectListModel* customMapItems();

    /// Allows custom builds to add custom items to the plan file before the document is created.
    /// 允许自定义构建在创建文档之前向计划文件添加自定义项。
    virtual void    preSaveToJson           (PlanMasterController* /*pController*/, QJsonObject& /*json*/) {}
    /// Allows custom builds to add custom items to the plan file after the document is created.
    /// 允许自定义构建在创建文档后向计划文件添加自定义项。
    virtual void    postSaveToJson          (PlanMasterController* /*pController*/, QJsonObject& /*json*/) {}

    /// Allows custom builds to add custom items to the mission section of the plan file before the item is created.
    /// 允许自定义构建在项目创建之前将自定义项目添加到计划文件的任务部分。
    virtual void    preSaveToMissionJson    (PlanMasterController* /*pController*/, QJsonObject& /*missionJson*/) {}
    /// Allows custom builds to add custom items to the mission section of the plan file after the item is created.
    /// 允许自定义构建在项目创建后将自定义项目添加到计划文件的任务部分。
    virtual void    postSaveToMissionJson   (PlanMasterController* /*pController*/, QJsonObject& /*missionJson*/) {}

    /// Allows custom builds to load custom items from the plan file before the document is parsed.
    /// 允许自定义构建在解析文档之前从计划文件加载自定义项。
    virtual void    preLoadFromJson     (PlanMasterController* /*pController*/, QJsonObject& /*json*/) {}
    /// Allows custom builds to load custom items from the plan file after the document is parsed.
    /// 允许自定义构建在文档解析后从计划文件加载自定义项。
    virtual void    postLoadFromJson    (PlanMasterController* /*pController*/, QJsonObject& /*json*/) {}

    /// Returns the url to download the stable version check file. Return QString() to indicate no version check should be performed.
    /// Default QGC mainline implemenentation returns QGC Stable file location. Default QGC custom build code returns QString().
    /// Custom builds can override to turn on and provide their own location.
    /// The contents of this file should be a single line in the form:
    ///     v3.4.4
    /// This indicates the latest stable version number.
    /// 返回下载稳定版本检查文件的url,返回QString()表示不应执行版本检查。默认的QGC主线实现返回QGC稳定的文件位置。默认QGC自定义构建代码返回QString()。 该文件的内容应该是表单中的一行:
    virtual QString stableVersionCheckFileUrl() const;

    /// Returns the user visible url to show user where to download new stable builds from.
    /// 返回用户可见的url,以显示用户从哪里下载新的稳定构建。
    /// Custom builds must override to provide their own location.
    /// 自定义构建必须重写以提供它们自己的位置。
    virtual QString stableDownloadLocation() const { return QString("qgroundcontrol.com"); }

    /// Returns the complex mission items to display in the Plan UI
    /// 返回要在Plan UI中显示的复杂任务项
    /// @param complexMissionItemNames Default set of complex items  复杂项目的默认集合
    /// @return Complex items to be made available to user
    virtual QStringList complexMissionItemNames(Vehicle* /*vehicle*/, const QStringList& complexMissionItemNames) { return complexMissionItemNames; }

    /// Returns the standard list of first run prompt ids for possible display. Actual display is based on the
    /// current AppSettings::firstRunPromptIds value. The order of this list also determines the order the prompts
    /// will be displayed in.
    virtual QList<int> firstRunPromptStdIds(void);

    /// Returns the custom build list of first run prompt ids for possible display. Actual display is based on the
    /// current AppSettings::firstRunPromptIds value. The order of this list also determines the order the prompts
    /// will be displayed in.
    virtual QList<int> firstRunPromptCustomIds(void);

    /// Returns the resource which contains the specified first run prompt for display
    ///返回包含指定的第一次运行提示符的资源
    Q_INVOKABLE virtual QString firstRunPromptResource(int id);

    /// Returns the list of toolbar indicators which are not related to a vehicle
    ///     signals toolbarIndicatorsChanged
    /// 返回与车辆信号toolbarIndicatorsChanged无关的工具栏指示器列表
    /// @return A list of QUrl with the indicators
    virtual const QVariantList& toolBarIndicators(void);

    /// Returns the list of first run prompt ids which need to be displayed according to current settings
    /// 返回根据当前设置需要显示的第一次运行提示符id的列表
    Q_INVOKABLE QVariantList firstRunPromptsToShow(void);

    bool showTouchAreas() const { return _showTouchAreas; }
    bool showAdvancedUI() const { return _showAdvancedUI; }
    void setShowTouchAreas(bool show);
    void setShowAdvancedUI(bool show);

    // Override from QGCTool
    void                            setToolbox              (QGCToolbox* toolbox);

    // Standard first run prompt ids  标准的第一次运行提示id
    static const int unitsFirstRunPromptId =            1;
    static const int offlineVehicleFirstRunPromptId =   2;

    // Custom builds can start there first run prompt ids from here 自定义构建可以从那里开始,然后从这里运行提示id
    static const int firstRunPromptIdsFirstCustomId = 10000;

signals:
    void settingsPagesChanged       ();
    void analyzePagesChanged        ();
    void showTouchAreasChanged      (bool showTouchAreas);
    void showAdvancedUIChanged      (bool showAdvancedUI);
    void toolBarIndicatorsChanged   ();

protected:
    bool                _showTouchAreas;
    bool                _showAdvancedUI;
    Vehicle*            _activeVehicle  = nullptr;
    QGCCameraManager*   _cameraManager  = nullptr;
    QGCCameraControl*   _currentCamera  = nullptr;
    QVariantList        _toolBarIndicatorList;

private:
    QGCCorePlugin_p*    _p;
};

cc文件

/****************************************************************************
 *
 * (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
 *
 * QGroundControl is licensed according to the terms in the file
 * COPYING.md in the root of the source code directory.
 *
 ****************************************************************************/

#include "QGCApplication.h"
#include "QGCCorePlugin.h"
#include "QGCOptions.h"
#include "QmlComponentInfo.h"
#include "FactMetaData.h"
#include "SettingsManager.h"
#include "AppMessages.h"
#include "QmlObjectListModel.h"
#include "VideoManager.h"
#if defined(QGC_GST_STREAMING)
#include "GStreamer.h"
#include "VideoReceiver.h"
#endif
#include "QGCLoggingCategory.h"
#include "QGCCameraManager.h"
#include "HorizontalFactValueGrid.h"
#include "InstrumentValueData.h"

#include <QtQml>
#include <QQmlEngine>

/// @file
///     @brief Core Plugin Interface for QGroundControl - Default Implementation
///     QGroundControl的核心插件接口-默认实现
///     @author Gus Grubba <gus@auterion.com>

class QGCCorePlugin_p
{
public:
    QGCCorePlugin_p()
    {
    }

    ~QGCCorePlugin_p()
    {
        if(pGeneral)
            delete pGeneral;
        if(pCommLinks)
            delete pCommLinks;
        if(pOfflineMaps)
            delete pOfflineMaps;
#if defined(QGC_GST_TAISYNC_ENABLED)
        if(pTaisync)
            delete pTaisync;
#endif
#if defined(QGC_GST_MICROHARD_ENABLED)
        if(pMicrohard)
            delete pMicrohard;
#endif
#if defined(QGC_AIRMAP_ENABLED)
        if(pAirmap)
            delete pAirmap;
#endif
        if(pMAVLink)
            delete pMAVLink;
        if(pConsole)
            delete pConsole;
#if defined(QT_DEBUG)
        if(pMockLink)
            delete pMockLink;
        if(pDebug)
            delete pDebug;
        if(pQmlTest)
            delete pQmlTest;
#endif
        if(defaultOptions)
            delete defaultOptions;
    }

    //对应application setting界面上左侧的按钮
    QmlComponentInfo* pGeneral                  = nullptr;  //常规
    QmlComponentInfo* pCommLinks                = nullptr;  //通信连接
    QmlComponentInfo* pOfflineMaps              = nullptr;  //离线地图
#if defined(QGC_GST_TAISYNC_ENABLED)
    QmlComponentInfo* pTaisync                  = nullptr;
#endif
#if defined(QGC_GST_MICROHARD_ENABLED)
    QmlComponentInfo* pMicrohard                = nullptr;
#endif
#if defined(QGC_AIRMAP_ENABLED)
    QmlComponentInfo* pAirmap                   = nullptr;
#endif
    QmlComponentInfo* pMAVLink                  = nullptr; //mavlink
    QmlComponentInfo* pConsole                  = nullptr; //控制台
    QmlComponentInfo* pHelp                     = nullptr; //帮助
#if defined(QT_DEBUG)
    QmlComponentInfo* pMockLink                 = nullptr; //模拟链接
    QmlComponentInfo* pDebug                    = nullptr; //调试
    QmlComponentInfo* pQmlTest                  = nullptr; //调色板测试
#endif

    QGCOptions*         defaultOptions          = nullptr; //默认选项
    QVariantList        settingsList;       //设置列表
    QVariantList        analyzeList;        //分析列表

    QmlObjectListModel _emptyCustomMapItems;
};

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

QGCCorePlugin::QGCCorePlugin(QGCApplication *app, QGCToolbox* toolbox)
    : QGCTool(app, toolbox)
    , _showTouchAreas(false)
    , _showAdvancedUI(true)
{
    QQmlEngine::setObjectOwnership(this, QQmlEngine::CppOwnership);
    _p = new QGCCorePlugin_p;
}

void QGCCorePlugin::setToolbox(QGCToolbox *toolbox)
{
    QGCTool::setToolbox(toolbox);

    //qmlRegisterUncreatableType()将c++类(派生自QObject)注册到QML系统(注册为非实例化类型)
    qmlRegisterUncreatableType<QGCCorePlugin>       ("QGroundControl", 1, 0, "QGCCorePlugin",       "Reference only");
    qmlRegisterUncreatableType<QGCOptions>          ("QGroundControl", 1, 0, "QGCOptions",          "Reference only");
    qmlRegisterUncreatableType<QGCFlyViewOptions>   ("QGroundControl", 1, 0, "QGCFlyViewOptions",   "Reference only");
}


//构建application setting界面上左侧的按钮
QVariantList &QGCCorePlugin::settingsPages()
{

    if(!_p->pGeneral) {
        //构建常规按钮
        _p->pGeneral = new QmlComponentInfo(tr("General"),
                                            QUrl::fromUserInput("qrc:/qml/GeneralSettings.qml"),
                                            QUrl::fromUserInput("qrc:/res/gear-white.svg"));
        _p->settingsList.append(QVariant::fromValue(reinterpret_cast<QmlComponentInfo*>(_p->pGeneral)));

        //构建通讯连接按钮
        _p->pCommLinks = new QmlComponentInfo(tr("Comm Links"),
                                              QUrl::fromUserInput("qrc:/qml/LinkSettings.qml"),
                                              QUrl::fromUserInput("qrc:/res/waves.svg"));
        _p->settingsList.append(QVariant::fromValue(reinterpret_cast<QmlComponentInfo*>(_p->pCommLinks)));

        //构建离线地图按钮
        _p->pOfflineMaps = new QmlComponentInfo(tr("Offline Maps"),
                                                QUrl::fromUserInput("qrc:/qml/OfflineMap.qml"),
                                                QUrl::fromUserInput("qrc:/res/waves.svg"));
        _p->settingsList.append(QVariant::fromValue(reinterpret_cast<QmlComponentInfo*>(_p->pOfflineMaps)));
#if defined(QGC_GST_TAISYNC_ENABLED)
        _p->pTaisync = new QmlComponentInfo(tr("Taisync"),
                                            QUrl::fromUserInput("qrc:/qml/TaisyncSettings.qml"),
                                            QUrl::fromUserInput(""));
        _p->settingsList.append(QVariant::fromValue(reinterpret_cast<QmlComponentInfo*>(_p->pTaisync)));
#endif
#if defined(QGC_GST_MICROHARD_ENABLED)
        _p->pMicrohard = new QmlComponentInfo(tr("Microhard"),
                                              QUrl::fromUserInput("qrc:/qml/MicrohardSettings.qml"),
                                              QUrl::fromUserInput(""));
        _p->settingsList.append(QVariant::fromValue(reinterpret_cast<QmlComponentInfo*>(_p->pMicrohard)));
#endif
#if defined(QGC_AIRMAP_ENABLED)
        _p->pAirmap = new QmlComponentInfo(tr("AirMap"),
                                           QUrl::fromUserInput("qrc:/qml/AirmapSettings.qml"),
                                           QUrl::fromUserInput(""));
        _p->settingsList.append(QVariant::fromValue(reinterpret_cast<QmlComponentInfo*>(_p->pAirmap)));
#endif

        //构建mavlink按钮
        _p->pMAVLink = new QmlComponentInfo(tr("MAVLink"),
                                            QUrl::fromUserInput("qrc:/qml/MavlinkSettings.qml"),
                                            QUrl::fromUserInput("qrc:/res/waves.svg"));
        _p->settingsList.append(QVariant::fromValue(reinterpret_cast<QmlComponentInfo*>(_p->pMAVLink)));

        //构建控制台按钮
        _p->pConsole = new QmlComponentInfo(tr("Console"),
                                            QUrl::fromUserInput("qrc:/qml/QGroundControl/Controls/AppMessages.qml"));
        _p->settingsList.append(QVariant::fromValue(reinterpret_cast<QmlComponentInfo*>(_p->pConsole)));

        //构建帮助按钮
        _p->pHelp = new QmlComponentInfo(tr("Help"),
                                         QUrl::fromUserInput("qrc:/qml/HelpSettings.qml"));
        _p->settingsList.append(QVariant::fromValue(reinterpret_cast<QmlComponentInfo*>(_p->pHelp)));
#if defined(QT_DEBUG)
        //-- These are always present on Debug builds

        //构建模拟连接按钮
        _p->pMockLink = new QmlComponentInfo(tr("Mock Link"),
                                             QUrl::fromUserInput("qrc:/qml/MockLink.qml"));
        _p->settingsList.append(QVariant::fromValue(reinterpret_cast<QmlComponentInfo*>(_p->pMockLink)));

        //构建调试按钮
        _p->pDebug = new QmlComponentInfo(tr("Debug"),
                                          QUrl::fromUserInput("qrc:/qml/DebugWindow.qml"));
        _p->settingsList.append(QVariant::fromValue(reinterpret_cast<QmlComponentInfo*>(_p->pDebug)));

        //构建调色板测试按钮
        _p->pQmlTest = new QmlComponentInfo(tr("Palette Test"),
                                            QUrl::fromUserInput("qrc:/qml/QmlTest.qml"));
        _p->settingsList.append(QVariant::fromValue(reinterpret_cast<QmlComponentInfo*>(_p->pQmlTest)));
#endif
    }
    return _p->settingsList;
}


//构建analyize tool界面上左侧的按钮
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

        //mavlink控制台
        _p->analyzeList.append(QVariant::fromValue(new QmlComponentInfo(tr("MAVLink Console"),  QUrl::fromUserInput("qrc:/qml/MavlinkConsolePage.qml"),     QUrl::fromUserInput("qrc:/qmlimages/MavlinkConsoleIcon"))));
#if !defined(QGC_DISABLE_MAVLINK_INSPECTOR)

        //mavlink检测
        _p->analyzeList.append(QVariant::fromValue(new QmlComponentInfo(tr("MAVLink Inspector"),QUrl::fromUserInput("qrc:/qml/MAVLinkInspectorPage.qml"),   QUrl::fromUserInput("qrc:/qmlimages/MAVLinkInspector"))));
#endif
        //振动
        _p->analyzeList.append(QVariant::fromValue(new QmlComponentInfo(tr("Vibration"),        QUrl::fromUserInput("qrc:/qml/VibrationPage.qml"),          QUrl::fromUserInput("qrc:/qmlimages/VibrationPageIcon"))));
    }
    return _p->analyzeList;
}


int QGCCorePlugin::defaultSettings()
{
    return 0;
}


QGCOptions* QGCCorePlugin::options()
{
    if (!_p->defaultOptions) {
        //构建QGC中的选项
        _p->defaultOptions = new QGCOptions(this);
    }
    return _p->defaultOptions;
}


bool QGCCorePlugin::overrideSettingsGroupVisibility(QString name)
{
    Q_UNUSED(name);

    // Always show all
    return true;
}

bool QGCCorePlugin::adjustSettingMetaData(const QString& settingsGroup, FactMetaData& metaData)
{
    if (settingsGroup == AppSettings::settingsGroup) {
#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

        //-- Default Palette
        if (metaData.name() == AppSettings::indoorPaletteName) {
            QVariant outdoorPalette;
#if defined (__mobile__)
            outdoorPalette = 0;
#else
            outdoorPalette = 1;
#endif
            metaData.setRawDefaultValue(outdoorPalette);
            return true;
        }

#if defined (__mobile__)
        if (metaData.name() == AppSettings::telemetrySaveName) {
            // Mobile devices have limited storage so don't turn on telemtry saving by default
            metaData.setRawDefaultValue(false);
            return true;
        }
#endif
    }

    return true; // Show setting in ui
}


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);
    }
}

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

}


/**
警告:您即将进入高级模式。”
“如果使用不当,这可能会导致您的车辆发生故障,从而使您的保修失效。”
“只有在客户支持部门的指示下,您才应该这样做。”
“您确定要启用高级模式吗?”
 */
QString QGCCorePlugin::showAdvancedUIMessage() const
{
    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?");
}



void QGCCorePlugin::factValueGridCreateDefaultSettings(const QString& defaultSettingsGroup)
{
    //factValueGrid设置
    HorizontalFactValueGrid factValueGrid(defaultSettingsGroup);

    bool        includeFWValues = factValueGrid.vehicleClass() == QGCMAVLink::VehicleClassFixedWing || factValueGrid.vehicleClass() == QGCMAVLink::VehicleClassVTOL || factValueGrid.vehicleClass() == QGCMAVLink::VehicleClassAirship;

    factValueGrid.setFontSize(FactValueGrid::LargeFontSize);

    factValueGrid.appendColumn();
    factValueGrid.appendColumn();
    factValueGrid.appendColumn();
    if (includeFWValues) {
        factValueGrid.appendColumn();
    }
    factValueGrid.appendRow();

    int                 rowIndex    = 0;
    QmlObjectListModel* column      = factValueGrid.columns()->value<QmlObjectListModel*>(0);

    InstrumentValueData* value = column->value<InstrumentValueData*>(rowIndex++);
    value->setFact("Vehicle", "AltitudeRelative");
    value->setIcon("arrow-thick-up.svg");
    value->setText(value->fact()->shortDescription());
    value->setShowUnits(true);

    value = column->value<InstrumentValueData*>(rowIndex++);
    value->setFact("Vehicle", "DistanceToHome");
    value->setIcon("bookmark copy 3.svg");
    value->setText(value->fact()->shortDescription());
    value->setShowUnits(true);

    rowIndex    = 0;
    column      = factValueGrid.columns()->value<QmlObjectListModel*>(1);

    value = column->value<InstrumentValueData*>(rowIndex++);
    value->setFact("Vehicle", "ClimbRate");
    value->setIcon("arrow-simple-up.svg");
    value->setText(value->fact()->shortDescription());
    value->setShowUnits(true);

    value = column->value<InstrumentValueData*>(rowIndex++);
    value->setFact("Vehicle", "GroundSpeed");
    value->setIcon("arrow-simple-right.svg");
    value->setText(value->fact()->shortDescription());
    value->setShowUnits(true);


    if (includeFWValues) {
        rowIndex    = 0;
        column      = factValueGrid.columns()->value<QmlObjectListModel*>(2);

        value = column->value<InstrumentValueData*>(rowIndex++);
        value->setFact("Vehicle", "AirSpeed");
        value->setText("AirSpd");
        value->setShowUnits(true);

        value = column->value<InstrumentValueData*>(rowIndex++);
        value->setFact("Vehicle", "ThrottlePct");
        value->setText("Thr");
        value->setShowUnits(true);
    }

    rowIndex    = 0;
    column      = factValueGrid.columns()->value<QmlObjectListModel*>(includeFWValues ? 3 : 2);

    value = column->value<InstrumentValueData*>(rowIndex++);
    value->setFact("Vehicle", "FlightTime");
    value->setIcon("timer.svg");
    value->setText(value->fact()->shortDescription());
    value->setShowUnits(false);

    value = column->value<InstrumentValueData*>(rowIndex++);
    value->setFact("Vehicle", "FlightDistance");
    value->setIcon("travel-walk.svg");
    value->setText(value->fact()->shortDescription());
    value->setShowUnits(true);
}

QQmlApplicationEngine* QGCCorePlugin::createQmlApplicationEngine(QObject* parent)
{
    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")));
}

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

    return true;
}

QmlObjectListModel* QGCCorePlugin::customMapItems()
{
    return &_p->_emptyCustomMapItems;
}

VideoManager* QGCCorePlugin::createVideoManager(QGCApplication *app, QGCToolbox *toolbox)
{
    return new VideoManager(app, toolbox);
}

VideoReceiver* QGCCorePlugin::createVideoReceiver(QObject* parent)
{
#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
}

void QGCCorePlugin::releaseVideoSink(void* sink)
{
#if defined(QGC_GST_STREAMING)
    GStreamer::releaseVideoSink(sink);
#else
    Q_UNUSED(sink)
#endif
}

bool QGCCorePlugin::guidedActionsControllerLogging() const
{
    return GuidedActionsControllerLog().isDebugEnabled();
}

QString QGCCorePlugin::stableVersionCheckFileUrl() const
{
#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
}

const QVariantList& QGCCorePlugin::toolBarIndicators(void)
{
    //-- Default list of indicators for all vehicles.
    if(_toolBarIndicatorList.size() == 0) {
        _toolBarIndicatorList = QVariantList({
                                                 QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/GPSRTKIndicator.qml")),
                                             });
    }
    return _toolBarIndicatorList;
}

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();
}

总结

又水了一篇,其实不是想水,是自己都没理清楚,这些类的作用,估计要到后面过qml的时候再来理顺了,所以这几个类只是先翻译了一遍,加了点自己的理解。

相关文章:

  • 对lua进行模糊测试及问题记录
  • VMware安装centOS7
  • Linux安全基线(二)配置8小项
  • 操作系统-第二章-调度与调度算法
  • 千年传承!敦煌遗址在云宇宙重建,背后还隐藏了哪些故事
  • IB课程热门科目你喜欢哪几个?
  • Node.js | JavaScript也能写后端?
  • 正念禅修(一)
  • cf #821 Div.2(A~E)
  • IDEA使用git拉取gitLab的项目——多个项目得放在同一文件下
  • 天津市高分二号卫星影像获取/高分一号卫星影像
  • 【错误解决】KeyError: ‘FusedBatchNormV3‘
  • TOP10!政策红利「叠加」市场刚需,谁在「领跑」干线物流赛道
  • 【Python数据分析 - 10】:pandas常见基本操作
  • 菊风推出小程序SDK,支持与落地电话、App、智能硬件互通!
  • php的引用
  • 【407天】跃迁之路——程序员高效学习方法论探索系列(实验阶段164-2018.03.19)...
  • 【笔记】你不知道的JS读书笔记——Promise
  • angular组件开发
  • DOM的那些事
  • gulp 教程
  • iOS筛选菜单、分段选择器、导航栏、悬浮窗、转场动画、启动视频等源码
  • Kibana配置logstash,报表一体化
  • Phpstorm怎样批量删除空行?
  • Redash本地开发环境搭建
  • socket.io+express实现聊天室的思考(三)
  • spring-boot List转Page
  • SQLServer插入数据
  • vue2.0开发聊天程序(四) 完整体验一次Vue开发(下)
  • -- 查询加强-- 使用如何where子句进行筛选,% _ like的使用
  • 多线程事务回滚
  • 回顾 Swift 多平台移植进度 #2
  • 近期前端发展计划
  • 前端面试之闭包
  • 使用 Docker 部署 Spring Boot项目
  • 异常机制详解
  • 转载:[译] 内容加速黑科技趣谈
  • HanLP分词命名实体提取详解
  • ionic异常记录
  • LIGO、Virgo第三轮探测告捷,同时探测到一对黑洞合并产生的引力波事件 ...
  • 容器镜像
  • ​iOS安全加固方法及实现
  • #我与Java虚拟机的故事#连载06:收获颇多的经典之作
  • (1)(1.13) SiK无线电高级配置(六)
  • (14)目标检测_SSD训练代码基于pytorch搭建代码
  • (NO.00004)iOS实现打砖块游戏(九):游戏中小球与反弹棒的碰撞
  • (第61天)多租户架构(CDB/PDB)
  • (第一天)包装对象、作用域、创建对象
  • (四)库存超卖案例实战——优化redis分布式锁
  • (五)网络优化与超参数选择--九五小庞
  • .[hudsonL@cock.li].mkp勒索加密数据库完美恢复---惜分飞
  • .axf 转化 .bin文件 的方法
  • .NET 4 并行(多核)“.NET研究”编程系列之二 从Task开始
  • .NET Core 中插件式开发实现
  • .net 程序发生了一个不可捕获的异常