QGCOptions.h 7.78 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
/****************************************************************************
 *
 *   (c) 2009-2016 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>
14
#include <QUrl>
15
16
17
18
19

/// @file
///     @brief Core Plugin Interface for QGroundControl - Application Options
///     @author Gus Grubba <mavlink@grubba.com>

20
class CustomInstrumentWidget;
21
22
23
24
25
26
class QGCOptions : public QObject
{
    Q_OBJECT
public:
    QGCOptions(QObject* parent = NULL);

27
28
29
30
    Q_PROPERTY(bool                     combineSettingsAndSetup         READ combineSettingsAndSetup        CONSTANT)
    Q_PROPERTY(double                   toolbarHeightMultiplier         READ toolbarHeightMultiplier        CONSTANT)
    Q_PROPERTY(bool                     enablePlanViewSelector          READ enablePlanViewSelector         CONSTANT)
    Q_PROPERTY(CustomInstrumentWidget*  instrumentWidget                READ instrumentWidget               CONSTANT)
Gus Grubba's avatar
Gus Grubba committed
31
    Q_PROPERTY(QUrl                     flyViewOverlay                  READ flyViewOverlay                 CONSTANT)
32
33
34
35
36
    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)
37
38
    Q_PROPERTY(bool                     sensorsHaveFixedOrientation     READ sensorsHaveFixedOrientation    CONSTANT)
    Q_PROPERTY(bool                     wifiReliableForCalibration      READ wifiReliableForCalibration     CONSTANT)
39
    Q_PROPERTY(bool                     showFirmwareUpgrade             READ showFirmwareUpgrade            NOTIFY showFirmwareUpgradeChanged)
40
    Q_PROPERTY(QString                  firmwareUpgradeSingleURL        READ firmwareUpgradeSingleURL       CONSTANT)
41
42
    Q_PROPERTY(bool                     guidedBarShowEmergencyStop      READ guidedBarShowEmergencyStop     NOTIFY guidedBarShowEmergencyStopChanged)
    Q_PROPERTY(bool                     guidedBarShowOrbit              READ guidedBarShowOrbit             NOTIFY guidedBarShowOrbitChanged)
43
    Q_PROPERTY(bool                     missionWaypointsOnly            READ missionWaypointsOnly           NOTIFY missionWaypointsOnlyChanged)
44
    Q_PROPERTY(bool                     multiVehicleEnabled             READ multiVehicleEnabled            NOTIFY multiVehicleEnabledChanged)
45
46
    Q_PROPERTY(bool                     showOfflineMapExport            READ showOfflineMapExport           NOTIFY showOfflineMapExportChanged)
    Q_PROPERTY(bool                     showOfflineMapImport            READ showOfflineMapImport           NOTIFY showOfflineMapImportChanged)
47
    Q_PROPERTY(bool                     useMobileFileDialog             READ useMobileFileDialog            CONSTANT)
48

Don Gagne's avatar
Don Gagne committed
49
50
    /// Should QGC hide its settings menu and colapse it into one single menu (Settings and Vehicle Setup)?
    /// @return true if QGC should consolidate both menus into one.
51
    virtual bool        combineSettingsAndSetup     () { return false; }
Don Gagne's avatar
Don Gagne committed
52
53
54

    /// Main ToolBar Multiplier.
    /// @return Factor to use when computing toolbar height
55
    virtual double      toolbarHeightMultiplier     () { return 1.0; }
Don Gagne's avatar
Don Gagne committed
56
57
58

    /// Enable Plan View Selector (Mission, Fence or Rally)
    /// @return True or false
59
    virtual bool        enablePlanViewSelector      () { return true; }
Don Gagne's avatar
Don Gagne committed
60
61
62

    /// Provides an alternate instrument widget for the Fly View
    /// @return An alternate widget (see QGCInstrumentWidget.qml, the default widget)
63
    virtual CustomInstrumentWidget* instrumentWidget();
Don Gagne's avatar
Don Gagne committed
64

Gus Grubba's avatar
Gus Grubba committed
65
66
    /// Allows access to the full fly view window
    virtual QUrl    flyViewOverlay                  () const { return QUrl(); }
67
    /// By returning false you can hide the following sensor calibration pages
68
69
70
71
72
    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; }
73
74
    virtual bool    wifiReliableForCalibration      () const { return false; }
    virtual bool    sensorsHaveFixedOrientation     () const { return false; }
75
    virtual bool    showFirmwareUpgrade             () const { return true; }
76
77
    virtual bool    guidedBarShowEmergencyStop      () const { return true; }
    virtual bool    guidedBarShowOrbit              () const { return true; }
DonLakeFlyer's avatar
DonLakeFlyer committed
78
    virtual bool    missionWaypointsOnly            () const { return false; }  ///< true: Only allow waypoints and complex items in Plan
79
    virtual bool    multiVehicleEnabled             () const { return true; }   ///< false: multi vehicle support is disabled
80

81
82
83
#if defined(__mobile__)
    virtual bool    showOfflineMapExport            () const { return false; }
    virtual bool    showOfflineMapImport            () const { return false; }
84
    virtual bool    useMobileFileDialog             () const { return true;}
85
86
87
#else
    virtual bool    showOfflineMapExport            () const { return true; }
    virtual bool    showOfflineMapImport            () const { return true; }
88
    virtual bool    useMobileFileDialog             () const { return false;}
89
90
#endif

91
92
93
94
    /// 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.
    virtual QString firmwareUpgradeSingleURL        () const { return QString(); }
95

96
97
98
99
100
101
signals:
    void showSensorCalibrationCompassChanged    (bool show);
    void showSensorCalibrationGyroChanged       (bool show);
    void showSensorCalibrationAccelChanged      (bool show);
    void showSensorCalibrationLevelChanged      (bool show);
    void showSensorCalibrationAirspeedChanged   (bool show);
102
    void showFirmwareUpgradeChanged             (bool show);
Gus Grubba's avatar
Gus Grubba committed
103
    void guidedBarShowEmergencyStopChanged      (bool show);
104
    void guidedBarShowOrbitChanged              (bool show);
105
    void missionWaypointsOnlyChanged            (bool missionWaypointsOnly);
106
    void multiVehicleEnabledChanged             (bool multiVehicleEnabled);
107
108
    void showOfflineMapExportChanged            ();
    void showOfflineMapImportChanged            ();
109

110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
private:
    CustomInstrumentWidget* _defaultInstrumentWidget;
};

//-----------------------------------------------------------------------------
class CustomInstrumentWidget : public QObject
{
    Q_OBJECT
public:
    //-- Widget Position
    enum Pos {
        POS_TOP_RIGHT           = 0,
        POS_CENTER_RIGHT        = 1,
        POS_BOTTOM_RIGHT        = 2,
    };
    Q_ENUMS(Pos)
    CustomInstrumentWidget(QObject* parent = NULL);
    Q_PROPERTY(QUrl     source  READ source CONSTANT)
    Q_PROPERTY(Pos      widgetPosition              READ widgetPosition             NOTIFY widgetPositionChanged)
    virtual QUrl        source                      () { return QUrl(); }
    virtual Pos         widgetPosition              () { return POS_CENTER_RIGHT; }
signals:
    void widgetPositionChanged  ();
133
};