QGCGoogleEarthView.h 1.91 KB
Newer Older
pixhawk's avatar
pixhawk committed
1 2 3 4
#ifndef QGCGOOGLEEARTHVIEW_H
#define QGCGOOGLEEARTHVIEW_H

#include <QWidget>
5 6
#include <QTimer>
#include <UASInterface.h>
pixhawk's avatar
pixhawk committed
7

8 9 10 11
#if (defined Q_OS_MAC)
#include <QWebView>
#endif

12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
#if (defined Q_OS_WIN) && !(defined __MINGW32__)
    QGCWebAxWidget* webViewWin;
#include <ActiveQt/QAxWidget>
#include "windows.h"

class WebAxWidget : public QAxWidget
{
public:

    WebAxWidget(QWidget* parent = 0, Qt::WindowFlags f = 0)
        : QAxWidget(parent, f)
    {
    }
protected:
    virtual bool translateKeyEvent(int message, int keycode) const
    {
        if (message >= WM_KEYFIRST && message <= WM_KEYLAST)
            return true;
        else
            return QAxWidget::translateKeyEvent(message, keycode);
    }

};
#else
pixhawk's avatar
pixhawk committed
36
namespace Ui {
37 38 39 40
    class QGCGoogleEarthControls;
#if (defined Q_OS_WIN) && !(defined __MINGW32__)
    class QGCGoogleEarthViewWin;
#else
pixhawk's avatar
pixhawk committed
41
    class QGCGoogleEarthView;
42
#endif
pixhawk's avatar
pixhawk committed
43
}
44
#endif
pixhawk's avatar
pixhawk committed
45 46 47 48 49 50 51 52 53

class QGCGoogleEarthView : public QWidget
{
    Q_OBJECT

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

54 55 56 57 58
public slots:
    /** @brief Update the internal state. Does not trigger a redraw */
    void updateState();
    /** @brief Set the currently selected UAS */
    void setActiveUAS(UASInterface* uas);
59 60 61 62 63 64
    /** @brief Show the vehicle trail */
    void showTrail(int state);
    /** @brief Show the waypoints */
    void showWaypoints(int state);
    /** @brief Follow the aircraft during flight */
    void follow(bool follow);
65

pixhawk's avatar
pixhawk committed
66 67
protected:
    void changeEvent(QEvent *e);
68 69 70
    QTimer* updateTimer;
    UASInterface* mav;
    bool followCamera;
71 72 73 74 75 76
#if (defined Q_OS_WIN) && !(defined __MINGW32__)
    WebAxWidget* webViewWin;
#endif
#if (defined Q_OS_MAC)
    QWebView* webViewMac;
#endif
pixhawk's avatar
pixhawk committed
77 78

private:
79 80 81 82 83
    Ui::QGCGoogleEarthControls* controls;
#if (defined Q_OS_WIN) && !(defined __MINGW32__)
    Ui::QGCGoogleEarthViewWin* ui;
#else
    Ui::QGCGoogleEarthView* ui;
84
#endif
pixhawk's avatar
pixhawk committed
85 86 87
};

#endif // QGCGOOGLEEARTHVIEW_H