QGCToolWidget.h 1.56 KB
Newer Older
1 2 3 4 5
#ifndef QGCTOOLWIDGET_H
#define QGCTOOLWIDGET_H

#include <QWidget>
#include <QAction>
lm's avatar
lm committed
6
#include <QMap>
7
#include <QVBoxLayout>
lm's avatar
lm committed
8
#include "QGCToolWidgetItem.h"
9 10 11 12 13 14 15 16 17 18 19 20

#include "UAS.h"

namespace Ui {
    class QGCToolWidget;
}

class QGCToolWidget : public QWidget
{
    Q_OBJECT

public:
lm's avatar
lm committed
21
    explicit QGCToolWidget(const QString& title, QWidget *parent = 0);
22 23
    ~QGCToolWidget();

lm's avatar
lm committed
24 25 26 27 28 29 30
    /** @brief Factory method to instantiate all tool widgets */
    static QList<QGCToolWidget*> createWidgetsFromSettings(QWidget* parent);
    /** @Give the tool widget a reference to its action in the main menu */
    void setMainMenuAction(QAction* action);
    /** @brief All instances of this class */
    static QMap<QString, QGCToolWidget*>* instances();

31 32
public slots:
    void addUAS(UASInterface* uas);
lm's avatar
lm committed
33 34 35 36 37 38 39
    /** @brief Delete this widget */
    void deleteWidget();
    /** @brief Store all widgets of this type to QSettings */
    static void storeWidgetsToSettings();

signals:
    void titleChanged(QString);
40 41 42 43 44

protected:
    QAction* addParamAction;
    QAction* addButtonAction;
    QAction* setTitleAction;
lm's avatar
lm committed
45
    QAction* deleteAction;
46 47
    QVBoxLayout* toolLayout;
    UAS* mav;
lm's avatar
lm committed
48
    QAction* mainMenuAction;
49 50 51

    void contextMenuEvent(QContextMenuEvent* event);
    void createActions();
lm's avatar
lm committed
52 53 54 55
    QList<QGCToolWidgetItem* >* itemList();
    const QString getTitle();
    /** @brief Add an existing tool widget */
    void addToolWidget(QGCToolWidgetItem* widget);
56 57 58 59 60 61 62 63 64 65 66 67

protected slots:
    void addParam();
    void addAction();
    void setTitle();


private:
    Ui::QGCToolWidget *ui;
};

#endif // QGCTOOLWIDGET_H