QGCToolWidget.h 1.86 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

#include "UAS.h"

12 13 14
namespace Ui
{
class QGCToolWidget;
15 16 17 18 19 20 21
}

class QGCToolWidget : public QWidget
{
    Q_OBJECT

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

lm's avatar
lm committed
25 26 27 28 29 30 31
    /** @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();

32 33
public slots:
    void addUAS(UASInterface* uas);
lm's avatar
lm committed
34 35
    /** @brief Delete this widget */
    void deleteWidget();
36 37 38 39
    /** @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
40 41 42 43 44
    /** @brief Store all widgets of this type to QSettings */
    static void storeWidgetsToSettings();

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

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

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

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


private:
    Ui::QGCToolWidget *ui;
};

#endif // QGCTOOLWIDGET_H