MissionCommandList.h 1.64 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 9
 *
 * QGroundControl is licensed according to the terms in the file
 * COPYING.md in the root of the source code directory.
 *
 ****************************************************************************/

10
#pragma once
11 12 13 14 15 16 17 18 19 20 21

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

#include <QObject>
#include <QString>
#include <QJsonObject>
#include <QJsonValue>

22
class MissionCommandUIInfo;
23

24
/// Maintains a list of MissionCommandUIInfo objects loaded from a json file.
25 26 27 28 29
class MissionCommandList : public QObject
{
    Q_OBJECT
    
public:
30
    /// @param baseCommandList true: bottomost level of mission command hierarchy (partial spec allowed), false: override level of hierarchy
31
    MissionCommandList(const QString& jsonFilename, bool baseCommandList, QObject* parent = nullptr);
32

33 34
    /// Returns list of categories in this list
    QStringList& categories(void) { return _categories; }
35

36 37
    /// Returns the ui info for specified command, NULL if command not found
    MissionCommandUIInfo* getUIInfo(MAV_CMD command) const;
38

39
    const QList<MAV_CMD>& commandIds(void) const { return _ids; }
40
    
41 42
    static const char* qgcFileType;

43
private:
44
    void _loadMavCmdInfoJson(const QString& jsonFilename, bool baseCommandList);
45

46 47 48
    QMap<MAV_CMD, MissionCommandUIInfo*>    _infoMap;
    QList<MAV_CMD>                          _ids;
    QStringList                             _categories;
49

50 51
    static const char* _versionJsonKey;
    static const char* _mavCmdInfoJsonKey;
52
};