diff --git a/qgroundcontrol.pro b/qgroundcontrol.pro
index 3ac311a692a8138399c4b2e28abfff23a3eed6d0..abf2fa1bfe4002eeaf5979a4268709367d7db03d 100644
--- a/qgroundcontrol.pro
+++ b/qgroundcontrol.pro
@@ -142,7 +142,8 @@ FORMS += src/ui/MainWindow.ui \
src/ui/QMap3D.ui \
src/ui/QGCWebView.ui \
src/ui/map3D/QGCGoogleEarthView.ui \
- src/ui/map3D/QGCGoogleEarthViewWin.ui
+ src/ui/map3D/QGCGoogleEarthViewWin.ui \
+ src/ui/map3D/QGCGoogleEarthControls.ui
# src/ui/WaypointGlobalView.ui
INCLUDEPATH += src \
diff --git a/src/ui/map3D/QGCGoogleEarthControls.ui b/src/ui/map3D/QGCGoogleEarthControls.ui
new file mode 100644
index 0000000000000000000000000000000000000000..4b7d6a45fb2f7258aed5a05c7df837f1dc0b7b66
--- /dev/null
+++ b/src/ui/map3D/QGCGoogleEarthControls.ui
@@ -0,0 +1,21 @@
+
+
+
+
+ Form
+
+
+
+ 0
+ 0
+ 400
+ 300
+
+
+
+ Form
+
+
+
+
+
diff --git a/src/ui/map3D/QGCGoogleEarthView.cc b/src/ui/map3D/QGCGoogleEarthView.cc
index 7e120d3fcb7e56acf6fdf7399095d5d6712ecbad..7bc7c2633b97d2aaa8d2c1bab073c873dc16d4a0 100644
--- a/src/ui/map3D/QGCGoogleEarthView.cc
+++ b/src/ui/map3D/QGCGoogleEarthView.cc
@@ -6,7 +6,9 @@
#include "QGCGoogleEarthView.h"
#include "QGCWebPage.h"
#include "UASManager.h"
+#include "ui_QGCGoogleEarthControls.h"
#if (defined Q_OS_WIN) && !(defined __MINGW32__)
+#include "ui_QGCGoogleEarthViewWin.h"
#else
#include "ui_QGCGoogleEarthView.h"
#endif
@@ -16,20 +18,34 @@ QGCGoogleEarthView::QGCGoogleEarthView(QWidget *parent) :
updateTimer(new QTimer(this)),
mav(NULL),
followCamera(true),
-#if (defined Q_OS_WIN) && !(defined __MINGW32__)
+#if (defined Q_OS_MAC)
+ webViewMac(new QWebView(this)),
+#endif
+#if (defined Q_OS_WIN) & !(defined __MINGW32__)
webViewWin(new QGCWebAxWidget(this)),
#else
ui(new Ui::QGCGoogleEarthView)
#endif
{
-#if (defined Q_OS_WIN) && !(defined __MINGW32__)
+#if (defined Q_OS_WIN) & !(defined __MINGW32__)
// Create layout and attach webViewWin
#else
+#endif
+
ui->setupUi(this);
- ui->webView->setPage(new QGCWebPage(ui->webView));
- ui->webView->settings()->setAttribute(QWebSettings::PluginsEnabled, true);
- ui->webView->load(QUrl("earth.html"));
+#if (defined Q_OS_MAC)
+ ui->webViewLayout->addWidget(webViewMac);
+ webViewMac->setPage(new QGCWebPage(webViewMac));
+ webViewMac->settings()->setAttribute(QWebSettings::PluginsEnabled, true);
+ webViewMac->load(QUrl("earth.html"));
+#endif
+
+#if (defined Q_OS_WIN) & !(defined __MINGW32__)
+ webViewWin->load(QUrl("earth.html"));
+#endif
+
+#if ((defined Q_OS_MAC) | ((defined Q_OS_WIN) & !(defined __MINGW32__)))
connect(UASManager::instance(), SIGNAL(activeUASSet(UASInterface*)), this, SLOT(setActiveUAS(UASInterface*)));
connect(updateTimer, SIGNAL(timeout()), this, SLOT(updateState()));
updateTimer->start(200);
@@ -54,14 +70,29 @@ void QGCGoogleEarthView::setActiveUAS(UASInterface* uas)
mav = uas;
}
+void QGCGoogleEarthView::showTrail(int state)
+{
+
+}
+
+void QGCGoogleEarthView::showWaypoints(int state)
+{
+
+}
+
+void QGCGoogleEarthView::follow(bool follow)
+{
+
+}
+
void QGCGoogleEarthView::updateState()
{
- if (ui->webView->page()->currentFrame()->evaluateJavaScript("isInitialized();").toBool())
+ if (webViewMac->page()->currentFrame()->evaluateJavaScript("isInitialized();").toBool())
{
static bool initialized = false;
if (!initialized)
{
- ui->webView->page()->currentFrame()->evaluateJavaScript("setGCSHome(22.679833,8.549444, 470);");
+ webViewMac->page()->currentFrame()->evaluateJavaScript("setGCSHome(22.679833,8.549444, 470);");
initialized = true;
}
int uasId = 0;
@@ -83,7 +114,7 @@ void QGCGoogleEarthView::updateState()
pitch = mav->getPitch();
yaw = mav->getYaw();
}
- ui->webView->page()->currentFrame()->evaluateJavaScript(QString("setAircraftPositionAttitude(%1, %2, %3, %4, %6, %7, %8);")
+ webViewMac->page()->currentFrame()->evaluateJavaScript(QString("setAircraftPositionAttitude(%1, %2, %3, %4, %6, %7, %8);")
.arg(uasId)
.arg(lat)
.arg(lon)
@@ -94,7 +125,7 @@ void QGCGoogleEarthView::updateState()
if (followCamera)
{
- ui->webView->page()->currentFrame()->evaluateJavaScript(QString("updateFollowAircraft()"));
+ webViewMac->page()->currentFrame()->evaluateJavaScript(QString("updateFollowAircraft()"));
}
}
}
diff --git a/src/ui/map3D/QGCGoogleEarthView.h b/src/ui/map3D/QGCGoogleEarthView.h
index f59d9e8f7f6ba22cb2796f6c677aded49507c5a8..d7d2e9da9b456de1b9342b094593793714412b1d 100644
--- a/src/ui/map3D/QGCGoogleEarthView.h
+++ b/src/ui/map3D/QGCGoogleEarthView.h
@@ -5,6 +5,10 @@
#include
#include
+#if (defined Q_OS_MAC)
+#include
+#endif
+
#if (defined Q_OS_WIN) && !(defined __MINGW32__)
QGCWebAxWidget* webViewWin;
#include
@@ -30,7 +34,12 @@ protected:
};
#else
namespace Ui {
+ class QGCGoogleEarthControls;
+#if (defined Q_OS_WIN) && !(defined __MINGW32__)
+ class QGCGoogleEarthViewWin;
+#else
class QGCGoogleEarthView;
+#endif
}
#endif
@@ -47,17 +56,31 @@ public slots:
void updateState();
/** @brief Set the currently selected UAS */
void setActiveUAS(UASInterface* uas);
+ /** @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);
protected:
void changeEvent(QEvent *e);
QTimer* updateTimer;
UASInterface* mav;
bool followCamera;
+#if (defined Q_OS_WIN) && !(defined __MINGW32__)
+ WebAxWidget* webViewWin;
+#endif
+#if (defined Q_OS_MAC)
+ QWebView* webViewMac;
+#endif
- #if (defined Q_OS_WIN) && !(defined __MINGW32__)
-#else
private:
- Ui::QGCGoogleEarthView *ui;
+ Ui::QGCGoogleEarthControls* controls;
+#if (defined Q_OS_WIN) && !(defined __MINGW32__)
+ Ui::QGCGoogleEarthViewWin* ui;
+#else
+ Ui::QGCGoogleEarthView* ui;
#endif
};
diff --git a/src/ui/map3D/QGCGoogleEarthView.ui b/src/ui/map3D/QGCGoogleEarthView.ui
index a720d9a59ada593d183e553d2c3813664787dd07..0731e9a0013d1f44ff78a88b619c158c9aff5f30 100644
--- a/src/ui/map3D/QGCGoogleEarthView.ui
+++ b/src/ui/map3D/QGCGoogleEarthView.ui
@@ -6,35 +6,72 @@
0
0
- 400
+ 597
300
Form
-
+
+
+ 10
+
+
+ 5
+
- 0
+ 2
- -
-
-
-
- about:blank
-
+
-
+
+
+ -
+
+
+ -
+
+
+ Home
+
+
+
+ -
+
+
+ Follow
+
+
+
+ -
+
+
+ Trail
+
+
+
+ -
+
+
+ Clear WPs
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 177
+ 20
+
+
+
+
-
-
- QWebView
- QWidget
-
-
-