AppSettings.h 5.75 KB
Newer Older
1
/***************_qgcTranslatorSourceCode***********************************************
2
 *
3
 * (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
4 5 6 7 8
 *
 * QGroundControl is licensed according to the terms in the file
 * COPYING.md in the root of the source code directory.
 *
 ****************************************************************************/
9 10 11 12

/// @file
/// @brief Application Settings

13
#pragma once
14
#include <QTranslator>
15

16
#include "SettingsGroup.h"
17
#include "QGCMAVLink.h"
18

19
/// Application Settings
20
class AppSettings : public SettingsGroup
21 22
{
    Q_OBJECT
23

24
public:
25
    AppSettings(QObject* parent = nullptr);
26

27 28
    DEFINE_SETTING_NAME_GROUP()

29 30
    DEFINE_SETTINGFACT(offlineEditingFirmwareClass)
    DEFINE_SETTINGFACT(offlineEditingVehicleClass)
31 32 33 34
    DEFINE_SETTINGFACT(offlineEditingCruiseSpeed)
    DEFINE_SETTINGFACT(offlineEditingHoverSpeed)
    DEFINE_SETTINGFACT(offlineEditingAscentSpeed)
    DEFINE_SETTINGFACT(offlineEditingDescentSpeed)
35
    DEFINE_SETTINGFACT(batteryPercentRemainingAnnounce) // Important: This is only used to calculate battery swaps
36 37 38 39
    DEFINE_SETTINGFACT(defaultMissionItemAltitude)
    DEFINE_SETTINGFACT(telemetrySave)
    DEFINE_SETTINGFACT(telemetrySaveNotArmed)
    DEFINE_SETTINGFACT(audioMuted)
40
    DEFINE_SETTINGFACT(checkInternet)
41
    DEFINE_SETTINGFACT(virtualJoystick)
42
    DEFINE_SETTINGFACT(virtualJoystickAutoCenterThrottle)
43 44 45 46 47
    DEFINE_SETTINGFACT(appFontPointSize)
    DEFINE_SETTINGFACT(indoorPalette)
    DEFINE_SETTINGFACT(showLargeCompass)
    DEFINE_SETTINGFACT(savePath)
    DEFINE_SETTINGFACT(useChecklist)
48
    DEFINE_SETTINGFACT(enforceChecklist)
49
    DEFINE_SETTINGFACT(mapboxToken)
50 51
    DEFINE_SETTINGFACT(mapboxAccount)
    DEFINE_SETTINGFACT(mapboxStyle)
52 53 54 55
    DEFINE_SETTINGFACT(esriToken)
    DEFINE_SETTINGFACT(defaultFirmwareType)
    DEFINE_SETTINGFACT(gstDebugLevel)
    DEFINE_SETTINGFACT(followTarget)
56 57
    DEFINE_SETTINGFACT(enableTaisync)
    DEFINE_SETTINGFACT(enableTaisyncVideo)
58 59 60 61 62 63 64 65 66
    DEFINE_SETTINGFACT(enableMicrohard)
    DEFINE_SETTINGFACT(language)
    DEFINE_SETTINGFACT(disableAllPersistence)
    DEFINE_SETTINGFACT(usePairing)
    DEFINE_SETTINGFACT(saveCsvTelemetry)
    DEFINE_SETTINGFACT(firstRunPromptIdsShown)
    DEFINE_SETTINGFACT(forwardMavlink)
    DEFINE_SETTINGFACT(forwardMavlinkHostName)

67

68 69 70
    // Although this is a global setting it only affects ArduPilot vehicle since PX4 automatically starts the stream from the vehicle side
    DEFINE_SETTINGFACT(apmStartMavlinkStreams)

71 72 73
    Q_PROPERTY(QString missionSavePath      READ missionSavePath    NOTIFY savePathsChanged)
    Q_PROPERTY(QString parameterSavePath    READ parameterSavePath  NOTIFY savePathsChanged)
    Q_PROPERTY(QString telemetrySavePath    READ telemetrySavePath  NOTIFY savePathsChanged)
74
    Q_PROPERTY(QString logSavePath          READ logSavePath        NOTIFY savePathsChanged)
75
    Q_PROPERTY(QString videoSavePath        READ videoSavePath      NOTIFY savePathsChanged)
76
    Q_PROPERTY(QString photoSavePath        READ photoSavePath      NOTIFY savePathsChanged)
77
    Q_PROPERTY(QString crashSavePath        READ crashSavePath      NOTIFY savePathsChanged)
78

79
    Q_PROPERTY(QString planFileExtension        MEMBER planFileExtension        CONSTANT)
80
    Q_PROPERTY(QString missionFileExtension     MEMBER missionFileExtension     CONSTANT)
81
    Q_PROPERTY(QString waypointsFileExtension   MEMBER waypointsFileExtension   CONSTANT)
82 83
    Q_PROPERTY(QString parameterFileExtension   MEMBER parameterFileExtension   CONSTANT)
    Q_PROPERTY(QString telemetryFileExtension   MEMBER telemetryFileExtension   CONSTANT)
84
    Q_PROPERTY(QString kmlFileExtension         MEMBER kmlFileExtension         CONSTANT)
85
    Q_PROPERTY(QString shpFileExtension         MEMBER shpFileExtension         CONSTANT)
86
    Q_PROPERTY(QString logFileExtension         MEMBER logFileExtension         CONSTANT)
87

88 89 90 91 92
    QString missionSavePath     ();
    QString parameterSavePath   ();
    QString telemetrySavePath   ();
    QString logSavePath         ();
    QString videoSavePath       ();
93
    QString photoSavePath       ();
94
    QString crashSavePath       ();
95

96 97 98 99
    // Helper methods for working with firstRunPromptIds QVariant settings string list
    static QList<int> firstRunPromptsIdsVariantToList   (const QVariant& firstRunPromptIds);
    static QVariant   firstRunPromptsIdsListToVariant   (const QList<int>& rgIds);
    Q_INVOKABLE void  firstRunPromptIdsMarkIdAsShown    (int id);
100 101 102

    // Application wide file extensions
    static const char* parameterFileExtension;
103
    static const char* planFileExtension;
104
    static const char* missionFileExtension;
105
    static const char* waypointsFileExtension;
106 107 108
    static const char* fenceFileExtension;
    static const char* rallyPointFileExtension;
    static const char* telemetryFileExtension;
109
    static const char* kmlFileExtension;
110
    static const char* shpFileExtension;
111
    static const char* logFileExtension;
112 113 114 115 116

    // Child directories of savePath for specific file types
    static const char* parameterDirectory;
    static const char* telemetryDirectory;
    static const char* missionDirectory;
117
    static const char* logDirectory;
118
    static const char* videoDirectory;
119
    static const char* photoDirectory;
120
    static const char* crashDirectory;
121

122 123 124 125 126 127
    // Returns the current language setting bypassing the standard SettingsGroup path. This should only be used
    // by QGCApplication::setLanguage to query the language setting as early in the boot process as possible.
    // Specfically prior to any JSON files being loaded such that JSON file can be translated. Also since this
    // is a one-off mechanism custom build overrides for language are not currently supported.
    static int _languageID(void);

128
signals:
129
    void savePathsChanged();
130 131

private slots:
132 133
    void _indoorPaletteChanged();
    void _checkSavePathDirectories();
134
    void _languageChanged();
135
};