UASQuickView.h 1.93 KB
Newer Older
1 2 3 4 5 6 7 8 9
#ifndef UASQUICKVIEW_H
#define UASQUICKVIEW_H

#include <QWidget>
#include <QTimer>
#include <QLabel>
#include "uas/UASInterface.h"
#include "ui_UASQuickView.h"
#include "UASQuickViewItem.h"
10 11
#include "MAVLinkDecoder.h"
#include "UASQuickViewItemSelect.h"
12
#include "Vehicle.h"
13 14 15 16 17
class UASQuickView : public QWidget
{
    Q_OBJECT
public:
    UASQuickView(QWidget *parent = 0);
18
    ~UASQuickView();
19
    void addSource(MAVLinkDecoder *decoder);
20 21
private:
    UASInterface *uas;
22 23

    /** List of enabled properties */
24
    QList<QString> uasEnabledPropertyList;
25 26

    /** Maps from the property name to the current value */
27
    QMap<QString,double> uasPropertyValueMap;
28 29

    /** Maps from property name to the display item */
30
    QMap<QString,UASQuickViewItem*> uasPropertyToLabelMap;
31 32

    /** Timer for updating the UI */
33
    QTimer *updateTimer;
34 35

    /** Selection dialog for selectin/deselecting gauge items */
36
    UASQuickViewItemSelect *quickViewSelectDialog;
37 38 39 40 41 42

    /** Saves gauge layout to settings file */
    void saveSettings();

    /** Loads gauge layout from settings file */
    void loadSettings();
43

44 45
    void recalculateItemTextSizing();

46 47 48 49 50 51 52 53 54 55
    /** Column Count */
    int m_columnCount;

    QList<QVBoxLayout*> m_verticalLayoutList;
    void sortItems(int columncount);
    QList<int> m_verticalLayoutItemCount;
    int m_currentColumn;
    QMap<QString,int> m_PropertyToLayoutIndexMap;

    //FlowLayout *layout;
56 57
protected:
    Ui::Form ui;
58
    void resizeEvent(QResizeEvent *evt);
59 60 61
signals:
    
public slots:
62
    void valueChanged(const int uasid, const QString& name, const QString& unit, const QVariant& value,const quint64 msecs);
63
    void actionTriggered(bool checked);
Don Gagne's avatar
Don Gagne committed
64
    void addActionTriggered();
65
    void updateTimerTick();
66 67 68
    void selectDialogClosed();
    void valueEnabled(QString value);
    void valueDisabled(QString value);
69
    void columnActionTriggered();
70 71 72
    
private slots:
    void _activeVehicleChanged(Vehicle* vehicle);
73 74 75
};

#endif // UASQUICKVIEW_H