QGCToolWidgetItem.h 1.26 KB
Newer Older
1 2 3 4 5
#ifndef QGCTOOLWIDGETITEM_H
#define QGCTOOLWIDGETITEM_H

#include <QWidget>
#include <QAction>
lm's avatar
lm committed
6
#include <QSettings>
7

8 9
#include "UASInterface.h"

10 11 12 13
class QGCToolWidgetItem : public QWidget
{
    Q_OBJECT
public:
14
    QGCToolWidgetItem(const QString& name, QWidget *parent = 0);
15 16
    ~QGCToolWidgetItem();

17
    int componentId() {
18 19
        return _component;
    }
20

21 22
    virtual void setEditMode(bool editMode);
    bool isEditMode() const { return isInEditMode; }
23
public slots:
24 25 26
    void startEditMode() { setEditMode(true); }
    void endEditMode() { setEditMode(false); }

27 28 29
    virtual void setComponent(int comp) {
        _component = comp;
    }
lm's avatar
lm committed
30 31
    virtual void writeSettings(QSettings& settings) = 0;
    virtual void readSettings(const QSettings& settings) = 0;
32
    virtual void readSettings(const QString& pre,const QVariantMap& settings) = 0;
33
    virtual void setActiveUAS(UASInterface *uas);
34

lm's avatar
lm committed
35 36 37
signals:
    void editingFinished();

38
protected:
39 40 41 42
    void contextMenuEvent (QContextMenuEvent* event);
    UASInterface* uas;

private:
43 44
    QAction* startEditAction;
    QAction* stopEditAction;
lm's avatar
lm committed
45
    QAction* deleteAction;
46
    bool isInEditMode;
47
    QString qgcToolWidgetItemName;
48 49
    int _component;          ///< The MAV component (the process or device ID)

50

51 52 53 54

};

#endif // QGCTOOLWIDGETITEM_H