QGCToolWidgetItem.h 1.28 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
    void contextMenuEvent (QContextMenuEvent* event);
40
    void init();
41 42 43
    UASInterface* uas;

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

51

52 53 54 55

};

#endif // QGCTOOLWIDGETITEM_H