QGCComboBox.h 2.49 KB
Newer Older
1 2 3 4 5 6 7 8 9
#ifndef QGCCOMBOBOX_H
#define QGCCOMBOBOX_H

#include <QWidget>
#include <QAction>
#include <QtDesigner/QDesignerExportWidget>

#include "QGCToolWidgetItem.h"

10 11
class QGCUASParamManager;

12 13 14 15 16 17 18 19 20 21 22 23 24
namespace Ui
{
class QGCComboBox;
}

class QGCComboBox : public QGCToolWidgetItem
{
    Q_OBJECT

public:
    explicit QGCComboBox(QWidget *parent = 0);
    ~QGCComboBox();

25
    virtual void setEditMode(bool editMode);
26

27
public slots:
28 29
    /** @brief Queue parameter for sending to the MAV (add to pending list)*/
    void setParamPending();
30
    /** @brief Update the UI with the new parameter value */
31
    void setParameterValue(int uas, int componentId, int paramCount, int paramIndex, QString parameterName, const QVariant value);
32
    void writeSettings(QSettings& settings);
33
    void readSettings(const QString& pre,const QVariantMap& settings);
34
    void readSettings(const QSettings& settings);
35 36
    /** @brief request that the parameter for this widget be refreshed */
    void refreshParameter();
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
    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:
55
    QGCUASParamManager *paramMgr; ///< Access to parameter manager
56 57 58 59
    bool visibleEnabled;
    QString visibleParam;
    int visibleVal;
    QMap<QString,QString> comboBoxTextToParamMap;
60
    QMap<int,QPixmap> comboBoxIndexToPixmap;
61 62 63 64 65
    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;
66
    bool isDisabled;
67
    float parameterMax;
68
    int componentId;                 ///< ID of the MAV component to address
69 70 71 72 73 74 75 76
    //double scaledInt;
    void changeEvent(QEvent *e);

private:
    Ui::QGCComboBox *ui;
};

#endif // QGCCOMBOBOX_H