QGCToolWidget.h 1.87 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
    /** @brief Delete this widget */
    void deleteWidget();
35 36 37 38
    /** @brief Export this widget to a file */
    void exportWidget();
    /** @brief Import settings for this widget from a file */
    void importWidget(const QString& fileName);
lm's avatar
lm committed
39 40 41 42 43
    /** @brief Store all widgets of this type to QSettings */
    static void storeWidgetsToSettings();

signals:
    void titleChanged(QString);
44 45 46 47

protected:
    QAction* addParamAction;
    QAction* addButtonAction;
lm's avatar
lm committed
48
    QAction* addCommandAction;
49
    QAction* setTitleAction;
lm's avatar
lm committed
50
    QAction* deleteAction;
51 52
    QAction* exportAction;
    QAction* importAction;
53 54
    QVBoxLayout* toolLayout;
    UAS* mav;
lm's avatar
lm committed
55
    QAction* mainMenuAction;
56 57 58

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

protected slots:
    void addParam();
lm's avatar
lm committed
66
    /** @deprecated */
67
    void addAction();
lm's avatar
lm committed
68
    void addCommand();
69 70 71 72 73 74 75 76
    void setTitle();


private:
    Ui::QGCToolWidget *ui;
};

#endif // QGCTOOLWIDGET_H