ParameterEditorController.h 2.7 KB
Newer Older
1 2 3 4 5 6 7 8 9
/****************************************************************************
 *
 *   (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.
 *
 ****************************************************************************/

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

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

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

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

private slots:
    void _updateParameters(void);

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

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

#endif