QGCToolWidgetComboBox.h 2.61 KB
Newer Older
1 2
#ifndef QGCToolWidgetComboBox_H
#define QGCToolWidgetComboBox_H
3 4 5

#include <QWidget>
#include <QAction>
dogmaphobic's avatar
dogmaphobic committed
6
#ifndef __android__
7
#include <QtDesigner/QDesignerExportWidget>
dogmaphobic's avatar
dogmaphobic committed
8
#endif
9 10
#include "QGCToolWidgetItem.h"

11
class QGCUASParamManagerInterface;
12

13 14
namespace Ui
{
15
class QGCToolWidgetComboBox;
16 17
}

18
class QGCToolWidgetComboBox : public QGCToolWidgetItem
19 20 21 22
{
    Q_OBJECT

public:
23 24
    explicit QGCToolWidgetComboBox(QWidget *parent = 0);
    ~QGCToolWidgetComboBox();
25

26
    virtual void setEditMode(bool editMode);
27

28
public slots:
29 30
    /** @brief Queue parameter for sending to the MAV (add to pending list)*/
    void setParamPending();
31
    /** @brief Update the UI with the new parameter value */
32
    void setParameterValue(int uas, int componentId, int paramCount, int paramIndex, QString parameterName, const QVariant value);
33
    void writeSettings(QSettings& settings);
34
    void readSettings(const QString& pre,const QVariantMap& settings);
35
    void readSettings(const QSettings& settings);
36 37
    /** @brief request that the parameter for this widget be refreshed */
    void refreshParameter();
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
    void setActiveUAS(UASInterface *uas);
    void selectComponent(int componentIndex);
    void selectParameter(int paramIndex);
    /** @brief Show descriptive text next to slider */
    void showInfo(bool enable);
    /** @brief Show tool tip of calling element */
    void showTooltip();

protected slots:
    /** @brief Request the parameter of this widget from the MAV */
    void requestParameter();
    /** @brief Button click to add a new item to the combobox */
    void addButtonClicked();
    /** @brief Button click to remove the currently selected item from the combobox */
    void delButtonClicked();
    /** @brief Updates current parameter based on new combobox value */
    void comboBoxIndexChanged(QString val);
protected:
56
    QGCUASParamManagerInterface *paramMgr; ///< Access to parameter manager
57 58 59 60
    bool visibleEnabled;
    QString visibleParam;
    int visibleVal;
    QMap<QString,QString> comboBoxTextToParamMap;
61
    QMap<int,QPixmap> comboBoxIndexToPixmap;
62 63 64 65 66
    QMap<QString,int> comboBoxTextToValMap; ///< Comboboxtext/parameter value map
    QString parameterName;         ///< Key/Name of the parameter
    QVariant parameterValue;          ///< Value of the parameter
    double parameterScalingFactor; ///< Factor to scale the parameter between slider and true value
    float parameterMin;
67
    bool isDisabled;
68
    float parameterMax;
69
    int componentId;                 ///< ID of the MAV component to address
70 71 72 73
    //double scaledInt;
    void changeEvent(QEvent *e);

private:
74
    Ui::QGCToolWidgetComboBox *ui;
75 76
};

77
#endif // QGCToolWidgetComboBox_H