Skip to content
QGCToolWidget.h 1.87 KiB
Newer Older
#ifndef QGCTOOLWIDGET_H
#define QGCTOOLWIDGET_H

#include <QWidget>
#include <QAction>
lm's avatar
lm committed
#include <QMap>
lm's avatar
lm committed
#include "QGCToolWidgetItem.h"

#include "UAS.h"

namespace Ui {
    class QGCToolWidget;
}

class QGCToolWidget : public QWidget
{
    Q_OBJECT

public:
lm's avatar
lm committed
    explicit QGCToolWidget(const QString& title, QWidget *parent = 0);
lm's avatar
lm committed
    /** @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();

public slots:
    void addUAS(UASInterface* uas);
lm's avatar
lm committed
    /** @brief Delete this widget */
    void deleteWidget();
    /** @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
    /** @brief Store all widgets of this type to QSettings */
    static void storeWidgetsToSettings();

signals:
    void titleChanged(QString);

protected:
    QAction* addParamAction;
    QAction* addButtonAction;
lm's avatar
lm committed
    QAction* addCommandAction;
lm's avatar
lm committed
    QAction* deleteAction;
    QAction* exportAction;
    QAction* importAction;
lm's avatar
lm committed
    QAction* mainMenuAction;

    void contextMenuEvent(QContextMenuEvent* event);
    void createActions();
lm's avatar
lm committed
    QList<QGCToolWidgetItem* >* itemList();
    const QString getTitle();
    /** @brief Add an existing tool widget */
    void addToolWidget(QGCToolWidgetItem* widget);
lm's avatar
lm committed
    /** @deprecated */
lm's avatar
lm committed
    void addCommand();
    void setTitle();


private:
    Ui::QGCToolWidget *ui;
};

#endif // QGCTOOLWIDGET_H