AppSettings.h 5.19 KB
Newer Older
1 2
/****************************************************************************
 *
Gus Grubba's avatar
Gus Grubba committed
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.
 *
 ****************************************************************************/
Gus Grubba's avatar
Gus Grubba committed
9 10 11 12

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

13
#pragma once
14
#include <QTranslator>
15

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

Gus Grubba's avatar
Gus Grubba committed
19
/// Application Settings
20
class AppSettings : public SettingsGroup
21 22
{
    Q_OBJECT
23

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

27 28 29 30 31 32 33 34 35 36 37 38 39
    DEFINE_SETTING_NAME_GROUP()

    DEFINE_SETTINGFACT(offlineEditingFirmwareType)
    DEFINE_SETTINGFACT(offlineEditingVehicleType)
    DEFINE_SETTINGFACT(offlineEditingCruiseSpeed)
    DEFINE_SETTINGFACT(offlineEditingHoverSpeed)
    DEFINE_SETTINGFACT(offlineEditingAscentSpeed)
    DEFINE_SETTINGFACT(offlineEditingDescentSpeed)
    DEFINE_SETTINGFACT(batteryPercentRemainingAnnounce)
    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 48
    DEFINE_SETTINGFACT(appFontPointSize)
    DEFINE_SETTINGFACT(indoorPalette)
    DEFINE_SETTINGFACT(showLargeCompass)
    DEFINE_SETTINGFACT(savePath)
    DEFINE_SETTINGFACT(autoLoadMissions)
    DEFINE_SETTINGFACT(useChecklist)
49
    DEFINE_SETTINGFACT(enforceChecklist)
50 51 52 53 54
    DEFINE_SETTINGFACT(mapboxToken)
    DEFINE_SETTINGFACT(esriToken)
    DEFINE_SETTINGFACT(defaultFirmwareType)
    DEFINE_SETTINGFACT(gstDebugLevel)
    DEFINE_SETTINGFACT(followTarget)
55 56
    DEFINE_SETTINGFACT(enableTaisync)
    DEFINE_SETTINGFACT(enableTaisyncVideo)
57
    DEFINE_SETTINGFACT(enableMicrohard)
58
    DEFINE_SETTINGFACT(language)
59
    DEFINE_SETTINGFACT(disableAllPersistence)
Gus Grubba's avatar
Gus Grubba committed
60
    DEFINE_SETTINGFACT(usePairing)
61
    DEFINE_SETTINGFACT(saveCsvTelemetry)
62
    DEFINE_SETTINGFACT(firstRunPromptIdsShown)
63

64

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

68 69 70
    Q_PROPERTY(QString missionSavePath      READ missionSavePath    NOTIFY savePathsChanged)
    Q_PROPERTY(QString parameterSavePath    READ parameterSavePath  NOTIFY savePathsChanged)
    Q_PROPERTY(QString telemetrySavePath    READ telemetrySavePath  NOTIFY savePathsChanged)
71
    Q_PROPERTY(QString logSavePath          READ logSavePath        NOTIFY savePathsChanged)
72
    Q_PROPERTY(QString videoSavePath        READ videoSavePath      NOTIFY savePathsChanged)
73
    Q_PROPERTY(QString crashSavePath        READ crashSavePath      NOTIFY savePathsChanged)
74

75
    Q_PROPERTY(QString planFileExtension        MEMBER planFileExtension        CONSTANT)
76
    Q_PROPERTY(QString missionFileExtension     MEMBER missionFileExtension     CONSTANT)
77
    Q_PROPERTY(QString waypointsFileExtension   MEMBER waypointsFileExtension   CONSTANT)
78 79
    Q_PROPERTY(QString parameterFileExtension   MEMBER parameterFileExtension   CONSTANT)
    Q_PROPERTY(QString telemetryFileExtension   MEMBER telemetryFileExtension   CONSTANT)
80
    Q_PROPERTY(QString kmlFileExtension         MEMBER kmlFileExtension         CONSTANT)
81
    Q_PROPERTY(QString shpFileExtension         MEMBER shpFileExtension         CONSTANT)
82
    Q_PROPERTY(QString logFileExtension         MEMBER logFileExtension         CONSTANT)
83

84 85 86 87 88 89
    QString missionSavePath     ();
    QString parameterSavePath   ();
    QString telemetrySavePath   ();
    QString logSavePath         ();
    QString videoSavePath       ();
    QString crashSavePath       ();
90

91 92 93 94 95
    // 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);

96 97
    static MAV_AUTOPILOT    offlineEditingFirmwareTypeFromFirmwareType  (MAV_AUTOPILOT firmwareType);
    static MAV_TYPE         offlineEditingVehicleTypeFromVehicleType    (MAV_TYPE vehicleType);
98 99 100

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

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

signals:
120
    void savePathsChanged();
121 122

private slots:
123 124
    void _indoorPaletteChanged();
    void _checkSavePathDirectories();
125 126 127 128
    void _languageChanged();

private:
    QTranslator _QGCTranslator;
129 130

};