diff --git a/images/earth.html b/images/earth.html new file mode 100644 index 0000000000000000000000000000000000000000..afdcec85903127711b85d0d757b3a2a6ee2ce15c --- /dev/null +++ b/images/earth.html @@ -0,0 +1,61 @@ + + + + + QGroundControl Google Earth View + + + + + + +
+
+
+ + diff --git a/mavground.qrc b/mavground.qrc index 6bb41cfdb8a2b2deddc1c0820342ed9244724a98..a5d1940b1f0ba3325461f8fdc8d435b3006907d5 100644 --- a/mavground.qrc +++ b/mavground.qrc @@ -82,6 +82,7 @@ images/mapproviders/openstreetmap.png images/mapproviders/google.png images/mapproviders/yahoo.png + images/earth.html images/Vera.ttf diff --git a/qgroundcontrol.pri b/qgroundcontrol.pri index 24bdd3daa42ab733096ade1b78860f4796524011..88ccc31a850244dc678b34728b623192a044a02a 100644 --- a/qgroundcontrol.pri +++ b/qgroundcontrol.pri @@ -77,7 +77,9 @@ macx { ICON = $$BASEDIR/images/icons/macx.icns # Copy audio files if needed - QMAKE_PRE_LINK += cp -rf $$BASEDIR/audio $$DESTDIR/qgroundcontrol.app/Contents/MacOs/. + QMAKE_PRE_LINK += && cp -rf $$BASEDIR/audio $$DESTDIR/qgroundcontrol.app/Contents/MacOs/. + # Copy google earth starter file + QMAKE_PRE_LINK += && cp -f $$BASEDIR/images/earth.html $$DESTDIR/qgroundcontrol.app/Contents/MacOs/. exists(/Library/Frameworks/osg.framework):exists(/Library/Frameworks/OpenThreads.framework) { # No check for GLUT.framework since it's a MAC default @@ -326,6 +328,10 @@ DEFINES += QGC_OSG_ENABLED # osg/osgEarth dynamic casts might fail without this compiler option. # see http://osgearth.org/wiki/FAQ for details. + # Copy google earth starter file + QMAKE_PRE_LINK += && cp -f $$BASEDIR/images/earth.html $$TARGETDIR/release/ + QMAKE_PRE_LINK += && cp -f $$BASEDIR/images/earth.html $$TARGETDIR/debug/ + } # Windows (32bit) diff --git a/qgroundcontrol.pro b/qgroundcontrol.pro index 69ea7e7c7dd7cbf8d44c5638e7066973ea2f2869..923f846515ba3da4663e2e29bad6b68fe56e4bc0 100644 --- a/qgroundcontrol.pro +++ b/qgroundcontrol.pro @@ -30,7 +30,8 @@ QT += network \ opengl \ svg \ xml \ - phonon + phonon \ + webkit TEMPLATE = app TARGET = qgroundcontrol BASEDIR = $$IN_PWD @@ -138,7 +139,9 @@ FORMS += src/ui/MainWindow.ui \ src/ui/QGCPxImuFirmwareUpdate.ui \ src/ui/QGCDataPlot2D.ui \ src/ui/QGCRemoteControlView.ui \ - src/ui/QMap3D.ui + src/ui/QMap3D.ui \ + src/ui/QGCWebView.ui \ + src/ui/map3D/QGCGoogleEarthView.ui # src/ui/WaypointGlobalView.ui INCLUDEPATH += src \ @@ -229,7 +232,9 @@ HEADERS += src/MG.h \ src/ui/RadioCalibration/SwitchCalibrator.h \ src/ui/RadioCalibration/CurveCalibrator.h \ src/ui/RadioCalibration/AbstractCalibrator.h \ - src/comm/QGCMAVLink.h + src/comm/QGCMAVLink.h \ + src/ui/QGCWebView.h \ + src/ui/map3D/QGCGoogleEarthView.h contains(DEPENDENCIES_PRESENT, osg) { @@ -329,7 +334,9 @@ SOURCES += src/main.cc \ src/ui/RadioCalibration/SwitchCalibrator.cc \ src/ui/RadioCalibration/CurveCalibrator.cc \ src/ui/RadioCalibration/AbstractCalibrator.cc \ - src/ui/RadioCalibration/RadioCalibrationData.cc + src/ui/RadioCalibration/RadioCalibrationData.cc \ + src/ui/QGCWebView.cc \ + src/ui/map3D/QGCGoogleEarthView.cc contains(DEPENDENCIES_PRESENT, osg) { message("Including sources for OpenSceneGraph") diff --git a/src/ui/MainWindow.cc b/src/ui/MainWindow.cc index 87f7b5a987d5827dbc268f6d1decf4c4fa523ea8..4af4fcf50cca0f862fc1f138333e57820642043b 100644 --- a/src/ui/MainWindow.cc +++ b/src/ui/MainWindow.cc @@ -142,6 +142,7 @@ void MainWindow::buildWidgets() #ifdef QGC_OSGEARTH_ENABLED _3DMapWidget = Q3DWidgetFactory::get("MAP3D"); #endif + gEarthWidget = new QGCGoogleEarthView(this); // Dock widgets controlDockWidget = new QDockWidget(tr("Control"), this); @@ -239,6 +240,7 @@ void MainWindow::arrangeCenterStack() #ifdef QGC_OSGEARTH_ENABLED if (_3DMapWidget) centerStack->addWidget(_3DMapWidget); #endif + if (gEarthWidget) centerStack->addWidget(gEarthWidget); if (hudWidget) centerStack->addWidget(hudWidget); if (dataplotWidget) centerStack->addWidget(dataplotWidget); @@ -388,6 +390,7 @@ void MainWindow::connectActions() connect(ui.actionOnline_documentation, SIGNAL(triggered()), this, SLOT(showHelp())); connect(ui.actionCredits_Developers, SIGNAL(triggered()), this, SLOT(showCredits())); connect(ui.actionProject_Roadmap, SIGNAL(triggered()), this, SLOT(showRoadMap())); + connect(ui.actionGoogleEarthView, SIGNAL(triggered()), this, SLOT(loadGoogleEarthView())); // Joystick configuration connect(ui.actionJoystickSettings, SIGNAL(triggered()), this, SLOT(configure())); @@ -1017,6 +1020,55 @@ void MainWindow::load3DMapView() } #endif this->show(); + } + +void MainWindow::loadGoogleEarthView() +{ + clearView(); + + // 3D map + if (gEarthWidget) + { + QStackedWidget *centerStack = dynamic_cast(centralWidget()); + if (centerStack) + { + centerStack->setCurrentWidget(gEarthWidget); + } + } + + // UAS CONTROL + if (controlDockWidget) + { + addDockWidget(Qt::LeftDockWidgetArea, controlDockWidget); + controlDockWidget->show(); + } + + // UAS LIST + if (listDockWidget) + { + addDockWidget(Qt::BottomDockWidgetArea, listDockWidget); + listDockWidget->show(); + } + + // WAYPOINT LIST + if (waypointsDockWidget) + { + addDockWidget(Qt::BottomDockWidgetArea, waypointsDockWidget); + waypointsDockWidget->show(); + } + + // HORIZONTAL SITUATION INDICATOR + if (hsiDockWidget) + { + HSIDisplay* hsi = dynamic_cast( hsiDockWidget->widget() ); + if (hsi) + { + hsi->start(); + addDockWidget(Qt::LeftDockWidgetArea, hsiDockWidget); + hsiDockWidget->show(); + } + } + this->show(); } diff --git a/src/ui/MainWindow.h b/src/ui/MainWindow.h index 31bb449b21f77e3e77731aba72aa6c5acca68eb3..38db7929181b952c0693c75267a607b5b92c3c4d 100644 --- a/src/ui/MainWindow.h +++ b/src/ui/MainWindow.h @@ -63,7 +63,7 @@ This file is part of the QGROUNDCONTROL project #include "HSIDisplay.h" #include "QGCDataPlot2D.h" #include "QGCRemoteControlView.h" - +#include "QGCGoogleEarthView.h" #include "LogCompressor.h" @@ -113,6 +113,8 @@ public slots: void loadOperatorView(); /** @brief Load 3D view */ void load3DView(); + /** @brief Load 3D Google Earth view */ + void loadGoogleEarthView(); /** @brief Load 3D map view */ void load3DMapView(); /** @brief Load view with all widgets */ @@ -170,6 +172,7 @@ protected: #ifdef QGC_OSGEARTH_ENABLED QPointer _3DMapWidget; #endif + QPointer gEarthWidget; // Dock widgets QPointer controlDockWidget; QPointer infoDockWidget; diff --git a/src/ui/MainWindow.ui b/src/ui/MainWindow.ui index ed91679edcafa0bf811a97f6a1e6cc2509a5b520..cf7a13f8febe6e8193e36aca7faa74db9dc70e7e 100644 --- a/src/ui/MainWindow.ui +++ b/src/ui/MainWindow.ui @@ -38,7 +38,7 @@ 0 0 1000 - 25 + 22 @@ -77,6 +77,7 @@ + @@ -235,7 +236,7 @@ :/images/categories/preferences-system.svg:/images/categories/preferences-system.svg - Show 3D local view + Show 3D Local View Show 3D view @@ -316,7 +317,7 @@ :/images/categories/applications-internet.svg:/images/categories/applications-internet.svg - Show Global operator view + Show 2D Map View @@ -325,7 +326,16 @@ :/images/categories/applications-internet.svg:/images/categories/applications-internet.svg - Show 3D Globe view + Show 3D Global View + + + + + + :/images/mapproviders/google.png:/images/mapproviders/google.png + + + Google Earth View diff --git a/src/ui/QGCWebView.cc b/src/ui/QGCWebView.cc new file mode 100644 index 0000000000000000000000000000000000000000..7de964b90022f7e51bd191e1ec2b0d72dfa035f6 --- /dev/null +++ b/src/ui/QGCWebView.cc @@ -0,0 +1,28 @@ +#include "QGCWebView.h" +#include "ui_QGCWebView.h" + +QGCWebView::QGCWebView(QWidget *parent) : + QWidget(parent), + ui(new Ui::QGCWebView) +{ + ui->setupUi(this); + ui->webView->settings()->setAttribute(QWebSettings::PluginsEnabled, true); + ui->webView->load(QUrl("http://qgroundcontrol.org")); +} + +QGCWebView::~QGCWebView() +{ + delete ui; +} + +void QGCWebView::changeEvent(QEvent *e) +{ + QWidget::changeEvent(e); + switch (e->type()) { + case QEvent::LanguageChange: + ui->retranslateUi(this); + break; + default: + break; + } +} diff --git a/src/ui/QGCWebView.h b/src/ui/QGCWebView.h new file mode 100644 index 0000000000000000000000000000000000000000..9c85ff08f16f5325b242738db4bc78e6e3f1af97 --- /dev/null +++ b/src/ui/QGCWebView.h @@ -0,0 +1,25 @@ +#ifndef QGCWEBVIEW_H +#define QGCWEBVIEW_H + +#include + +namespace Ui { + class QGCWebView; +} + +class QGCWebView : public QWidget +{ + Q_OBJECT + +public: + explicit QGCWebView(QWidget *parent = 0); + ~QGCWebView(); + +protected: + void changeEvent(QEvent *e); + +private: + Ui::QGCWebView *ui; +}; + +#endif // QGCWEBVIEW_H diff --git a/src/ui/QGCWebView.ui b/src/ui/QGCWebView.ui new file mode 100644 index 0000000000000000000000000000000000000000..d7f8a87a33dcb1767e00004ff8790d2f6e8f49f6 --- /dev/null +++ b/src/ui/QGCWebView.ui @@ -0,0 +1,37 @@ + + + QGCWebView + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + + + about:blank + + + + + + + + + QWebView + QWidget +
QtWebKit/QWebView
+
+
+ + +
diff --git a/src/ui/map3D/QGCGoogleEarthView.cc b/src/ui/map3D/QGCGoogleEarthView.cc new file mode 100644 index 0000000000000000000000000000000000000000..9f3beb303e67e6d792b4ef4afa359d57eaaaf368 --- /dev/null +++ b/src/ui/map3D/QGCGoogleEarthView.cc @@ -0,0 +1,28 @@ +#include "QGCGoogleEarthView.h" +#include "ui_QGCGoogleEarthView.h" + +QGCGoogleEarthView::QGCGoogleEarthView(QWidget *parent) : + QWidget(parent), + ui(new Ui::QGCGoogleEarthView) +{ + ui->setupUi(this); + ui->webView->settings()->setAttribute(QWebSettings::PluginsEnabled, true); + ui->webView->load(QUrl("earth.html")); +} + +QGCGoogleEarthView::~QGCGoogleEarthView() +{ + delete ui; +} + +void QGCGoogleEarthView::changeEvent(QEvent *e) +{ + QWidget::changeEvent(e); + switch (e->type()) { + case QEvent::LanguageChange: + ui->retranslateUi(this); + break; + default: + break; + } +} diff --git a/src/ui/map3D/QGCGoogleEarthView.h b/src/ui/map3D/QGCGoogleEarthView.h new file mode 100644 index 0000000000000000000000000000000000000000..47f17c1fb819b62803c81ae84450a5157b2743b2 --- /dev/null +++ b/src/ui/map3D/QGCGoogleEarthView.h @@ -0,0 +1,25 @@ +#ifndef QGCGOOGLEEARTHVIEW_H +#define QGCGOOGLEEARTHVIEW_H + +#include + +namespace Ui { + class QGCGoogleEarthView; +} + +class QGCGoogleEarthView : public QWidget +{ + Q_OBJECT + +public: + explicit QGCGoogleEarthView(QWidget *parent = 0); + ~QGCGoogleEarthView(); + +protected: + void changeEvent(QEvent *e); + +private: + Ui::QGCGoogleEarthView *ui; +}; + +#endif // QGCGOOGLEEARTHVIEW_H diff --git a/src/ui/map3D/QGCGoogleEarthView.ui b/src/ui/map3D/QGCGoogleEarthView.ui new file mode 100644 index 0000000000000000000000000000000000000000..a720d9a59ada593d183e553d2c3813664787dd07 --- /dev/null +++ b/src/ui/map3D/QGCGoogleEarthView.ui @@ -0,0 +1,40 @@ + + + QGCGoogleEarthView + + + + 0 + 0 + 400 + 300 + + + + Form + + + + 0 + + + + + + about:blank + + + + + + + + + QWebView + QWidget +
QtWebKit/QWebView
+
+
+ + +