ParameterEditorController.h 2.65 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
Don Gagne's avatar
Don Gagne committed
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);
Don Gagne's avatar
Don Gagne committed
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 setRCToParam(const QString& paramName);
Don Gagne's avatar
Don Gagne committed
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 73
    ParameterManager*   _parameterMgr;
    QString             _componentCategoryPrefix;
74
    bool                _showModifiedOnly;
75 76 77
};

#endif