ParameterEditorController.h 2.61 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 11 12 13

/// @file
///     @author Don Gagne <don@thegagnes.com>

Don Gagne's avatar
Don Gagne committed
14 15 16 17 18
#ifndef PARAMETEREDITORCONTROLLER_H
#define PARAMETEREDITORCONTROLLER_H

#include <QObject>
#include <QList>
19

Don Gagne's avatar
Don Gagne committed
20 21
#include "AutoPilotPlugin.h"
#include "UASInterface.h"
Don Gagne's avatar
Don Gagne committed
22
#include "FactPanelController.h"
23
#include "QmlObjectListModel.h"
24
#include "ParameterManager.h"
Don Gagne's avatar
Don Gagne committed
25

Don Gagne's avatar
Don Gagne committed
26
class ParameterEditorController : public FactPanelController
27 28
{
    Q_OBJECT
29

30
public:
Don Gagne's avatar
Don Gagne committed
31
    ParameterEditorController(void);
32
    ~ParameterEditorController();
Don Gagne's avatar
Don Gagne committed
33

34
    Q_PROPERTY(QString              searchText          MEMBER _searchText          NOTIFY searchTextChanged)
35
    Q_PROPERTY(QString              currentCategory     MEMBER _currentCategory     NOTIFY currentCategoryChanged)
36 37
    Q_PROPERTY(QString              currentGroup        MEMBER _currentGroup        NOTIFY currentGroupChanged)
    Q_PROPERTY(QmlObjectListModel*  parameters          MEMBER _parameters          CONSTANT)
38
    Q_PROPERTY(QStringList          categories          MEMBER _categories          CONSTANT)
39 40
    Q_PROPERTY(bool                 showModifiedOnly    MEMBER _showModifiedOnly    NOTIFY showModifiedOnlyChanged)

41 42
    Q_INVOKABLE QStringList getGroupsForCategory(const QString& category);
    Q_INVOKABLE QStringList searchParameters(const QString& searchText, bool searchInName=true, bool searchInDescriptions=true);
43

Don Gagne's avatar
Don Gagne committed
44 45 46
    Q_INVOKABLE void saveToFile(const QString& filename);
    Q_INVOKABLE void loadFromFile(const QString& filename);
    Q_INVOKABLE void refresh(void);
47
    Q_INVOKABLE void resetAllToDefaults(void);
48
    Q_INVOKABLE void resetAllToVehicleConfiguration(void);
49
    Q_INVOKABLE void setRCToParam(const QString& paramName);
50

51
    QList<QObject*> model(void);
52

53
signals:
54
    void searchTextChanged(QString searchText);
55
    void currentCategoryChanged(QString category);
56
    void currentGroupChanged(QString group);
57
    void showErrorMessage(const QString& errorMsg);
58
    void showModifiedOnlyChanged();
59 60 61 62

private slots:
    void _updateParameters(void);

63 64 65
private:
    bool _shouldShow(Fact *fact);

66
private:
67
    QStringList         _categories;
68
    QString             _searchText;
69
    QString             _currentCategory;
70 71
    QString             _currentGroup;
    QmlObjectListModel* _parameters;
72
    ParameterManager*   _parameterMgr;
73
    bool                _showModifiedOnly;
74 75 76
};

#endif