From d19ada41936771a54ee428c69a7c561e3edf8625 Mon Sep 17 00:00:00 2001 From: pip Date: Tue, 29 Jun 2010 11:11:35 +0000 Subject: [PATCH] Moved new map plug-in openGL option to it's options page. Added 'Edit waypoint' option to the right click context menu on the new map plug-in. git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@935 ebee16cc-31ac-478f-84a7-5cbb03baadba --- ground/src/plugins/opmap/opmap.pro | 9 +- .../opmap/opmap_edit_waypoint_dialog.cpp | 76 +++++ .../opmap/opmap_edit_waypoint_dialog.h | 58 ++++ .../opmap/opmap_edit_waypoint_dialog.ui | 237 ++++++++++++++++ .../plugins/opmap/opmap_mapoverlaywidget.cpp | 27 ++ .../plugins/opmap/opmap_mapoverlaywidget.h | 27 ++ ground/src/plugins/opmap/opmap_widget.ui | 8 +- ground/src/plugins/opmap/opmapgadget.cpp | 2 + .../opmap/opmapgadgetconfiguration.cpp | 25 +- .../plugins/opmap/opmapgadgetconfiguration.h | 8 + .../plugins/opmap/opmapgadgetoptionspage.cpp | 11 +- .../plugins/opmap/opmapgadgetoptionspage.ui | 262 +++++++++--------- .../src/plugins/opmap/opmapgadgetwidget.cpp | 71 ++--- ground/src/plugins/opmap/opmapgadgetwidget.h | 26 +- 14 files changed, 655 insertions(+), 192 deletions(-) create mode 100644 ground/src/plugins/opmap/opmap_edit_waypoint_dialog.cpp create mode 100644 ground/src/plugins/opmap/opmap_edit_waypoint_dialog.h create mode 100644 ground/src/plugins/opmap/opmap_edit_waypoint_dialog.ui diff --git a/ground/src/plugins/opmap/opmap.pro b/ground/src/plugins/opmap/opmap.pro index 63b34dd60..6d0146a2e 100644 --- a/ground/src/plugins/opmap/opmap.pro +++ b/ground/src/plugins/opmap/opmap.pro @@ -11,7 +11,8 @@ HEADERS += opmapplugin.h \ opmapgadget.h \ opmapgadgetwidget.h \ opmap_waypointeditor_dialog.h \ - opmap_mapoverlaywidget.h + opmap_mapoverlaywidget.h \ + opmap_edit_waypoint_dialog.h SOURCES += opmapplugin.cpp \ opmapgadgetwidget.cpp \ opmapgadgetoptionspage.cpp \ @@ -19,10 +20,12 @@ SOURCES += opmapplugin.cpp \ opmapgadgetconfiguration.cpp \ opmapgadget.cpp \ opmap_waypointeditor_dialog.cpp \ - opmap_mapoverlaywidget.cpp + opmap_mapoverlaywidget.cpp \ + opmap_edit_waypoint_dialog.cpp OTHER_FILES += OPMapGadget.pluginspec FORMS += opmapgadgetoptionspage.ui \ opmap_widget.ui \ opmap_waypointeditor_dialog.ui \ - opmap_mapoverlaywidget.ui + opmap_mapoverlaywidget.ui \ + opmap_edit_waypoint_dialog.ui RESOURCES += opmap.qrc diff --git a/ground/src/plugins/opmap/opmap_edit_waypoint_dialog.cpp b/ground/src/plugins/opmap/opmap_edit_waypoint_dialog.cpp new file mode 100644 index 000000000..8ae984abd --- /dev/null +++ b/ground/src/plugins/opmap/opmap_edit_waypoint_dialog.cpp @@ -0,0 +1,76 @@ +/** + ****************************************************************************** + * + * @file opmap_edit_waypoint_dialog.cpp + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup opmap + * @{ + * + *****************************************************************************/ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "opmap_edit_waypoint_dialog.h" +#include "ui_opmap_edit_waypoint_dialog.h" + +opmap_edit_waypoint_dialog::opmap_edit_waypoint_dialog(QWidget *parent) : + QDialog(parent), + ui(new Ui::opmap_edit_waypoint_dialog) +{ + ui->setupUi(this); + setWindowFlags(Qt::Dialog); +} + +opmap_edit_waypoint_dialog::~opmap_edit_waypoint_dialog() +{ + delete ui; +} + +void opmap_edit_waypoint_dialog::changeEvent(QEvent *e) +{ + QDialog::changeEvent(e); + switch (e->type()) { + case QEvent::LanguageChange: + ui->retranslateUi(this); + break; + default: + break; + } +} + +void opmap_edit_waypoint_dialog::on_pushButtonOK_clicked() +{ + // to do + + close(); +} + +void opmap_edit_waypoint_dialog::on_pushButtonApply_clicked() +{ + // to do +} + +void opmap_edit_waypoint_dialog::on_pushButtonRevert_clicked() +{ + // to do +} + +void opmap_edit_waypoint_dialog::on_pushButtonCancel_clicked() +{ + close(); +} diff --git a/ground/src/plugins/opmap/opmap_edit_waypoint_dialog.h b/ground/src/plugins/opmap/opmap_edit_waypoint_dialog.h new file mode 100644 index 000000000..904ee58ce --- /dev/null +++ b/ground/src/plugins/opmap/opmap_edit_waypoint_dialog.h @@ -0,0 +1,58 @@ +/** + ****************************************************************************** + * + * @file opmap_edit_waypoint_dialog.cpp + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup opmap + * @{ + * + *****************************************************************************/ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef OPMAP_EDIT_WAYPOINT_DIALOG_H +#define OPMAP_EDIT_WAYPOINT_DIALOG_H + +#include + +namespace Ui { + class opmap_edit_waypoint_dialog; +} + +class opmap_edit_waypoint_dialog : public QDialog { + Q_OBJECT +public: + opmap_edit_waypoint_dialog(QWidget *parent = 0); + ~opmap_edit_waypoint_dialog(); + +protected: + void changeEvent(QEvent *e); + +private: + Ui::opmap_edit_waypoint_dialog *ui; + +private slots: + +private slots: + void on_pushButtonCancel_clicked(); + void on_pushButtonRevert_clicked(); + void on_pushButtonApply_clicked(); + void on_pushButtonOK_clicked(); +}; + +#endif // OPMAP_EDIT_WAYPOINT_DIALOG_H diff --git a/ground/src/plugins/opmap/opmap_edit_waypoint_dialog.ui b/ground/src/plugins/opmap/opmap_edit_waypoint_dialog.ui new file mode 100644 index 000000000..2645345fc --- /dev/null +++ b/ground/src/plugins/opmap/opmap_edit_waypoint_dialog.ui @@ -0,0 +1,237 @@ + + + opmap_edit_waypoint_dialog + + + Qt::WindowModal + + + + 0 + 0 + 476 + 187 + + + + + 0 + 0 + + + + OpenPilot GCS Edit Waypoint + + + + :/core/images/openpilot_logo_128.png:/core/images/openpilot_logo_128.png + + + true + + + + + + + + Description + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + Number + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Latitude + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Longitude + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Height + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + 40 + 0 + + + + + 40 + 16777215 + + + + + + + + + 0 + 0 + + + + + 130 + 0 + + + + + 130 + 16777215 + + + + + + + + + 0 + 0 + + + + + 130 + 0 + + + + + 130 + 16777215 + + + + + + + + + 0 + 0 + + + + + 130 + 0 + + + + + 130 + 16777215 + + + + + + + + degrees + + + + + + + degrees + + + + + + + feet + + + + + + + + + + + OK + + + + + + + Apply + + + + + + + Revert + + + + + + + Cancel + + + + + + + + + + + + diff --git a/ground/src/plugins/opmap/opmap_mapoverlaywidget.cpp b/ground/src/plugins/opmap/opmap_mapoverlaywidget.cpp index ef9852a54..a19b08fc7 100644 --- a/ground/src/plugins/opmap/opmap_mapoverlaywidget.cpp +++ b/ground/src/plugins/opmap/opmap_mapoverlaywidget.cpp @@ -1,3 +1,30 @@ +/** + ****************************************************************************** + * + * @file opmap_mapoverlaywidget.cpp + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup opmap + * @{ + * + *****************************************************************************/ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + #include "opmap_mapoverlaywidget.h" #include "ui_opmap_mapoverlaywidget.h" diff --git a/ground/src/plugins/opmap/opmap_mapoverlaywidget.h b/ground/src/plugins/opmap/opmap_mapoverlaywidget.h index a7ed98a7f..11a0123b5 100644 --- a/ground/src/plugins/opmap/opmap_mapoverlaywidget.h +++ b/ground/src/plugins/opmap/opmap_mapoverlaywidget.h @@ -1,3 +1,30 @@ +/** + ****************************************************************************** + * + * @file opmap_mapoverlaywidget.h + * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010. + * @brief + * @see The GNU Public License (GPL) Version 3 + * @defgroup opmap + * @{ + * + *****************************************************************************/ +/* + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + #ifndef OPMAP_MAPOVERLAYWIDGET_H #define OPMAP_MAPOVERLAYWIDGET_H diff --git a/ground/src/plugins/opmap/opmap_widget.ui b/ground/src/plugins/opmap/opmap_widget.ui index 58e41e01a..a40a86a82 100644 --- a/ground/src/plugins/opmap/opmap_widget.ui +++ b/ground/src/plugins/opmap/opmap_widget.ui @@ -768,7 +768,7 @@ QTreeView::branch:open:has-children:!has-siblings, QTreeView::branch:open:has-ch - false + true true @@ -873,6 +873,9 @@ border-radius: 2px; false + + Qt::NoContextMenu + QWidget { /* all types of qwidget */ background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(71, 71, 71, 255), stop:1 rgba(110, 110, 110, 255)); @@ -1143,6 +1146,9 @@ border-radius: 3px; 0 + + Qt::NoContextMenu + QFrame{ background-color: qlineargradient(spread:pad, x1:0.5, y1:0, x2:0.5, y2:1, stop:0 rgba(110, 110, 110, 255), stop:1 rgba(71, 71, 71, 255)); diff --git a/ground/src/plugins/opmap/opmapgadget.cpp b/ground/src/plugins/opmap/opmapgadget.cpp index 1a908ff47..4825ccf11 100644 --- a/ground/src/plugins/opmap/opmapgadget.cpp +++ b/ground/src/plugins/opmap/opmapgadget.cpp @@ -45,6 +45,8 @@ void OPMapGadget::loadConfiguration(IUAVGadgetConfiguration *config) m_widget->setMapProvider(m->mapProvider()); m_widget->setZoom(m->zoom()); m_widget->setPosition(QPointF(m->longitude(), m->latitude())); + m_widget->setUseOpenGL(m->useOpenGL()); + m_widget->setShowTileGridLines(m->showTileGridLines()); m_widget->setAccessMode(m->accessMode()); m_widget->setUseMemoryCache(m->useMemoryCache()); m_widget->setCacheLocation(m->cacheLocation()); diff --git a/ground/src/plugins/opmap/opmapgadgetconfiguration.cpp b/ground/src/plugins/opmap/opmapgadgetconfiguration.cpp index b3ee3696b..fd9f12a92 100644 --- a/ground/src/plugins/opmap/opmapgadgetconfiguration.cpp +++ b/ground/src/plugins/opmap/opmapgadgetconfiguration.cpp @@ -35,6 +35,8 @@ OPMapGadgetConfiguration::OPMapGadgetConfiguration(QString classId, const QByteA m_defaultZoom(2), m_defaultLatitude(0), m_defaultLongitude(0), + m_useOpenGL(false), + m_showTileGridLines(false), m_accessMode("ServerAndCache"), m_useMemoryCache(true), m_cacheLocation(QDir::currentPath() + QDir::separator() + "mapscache" + QDir::separator()) @@ -43,26 +45,33 @@ OPMapGadgetConfiguration::OPMapGadgetConfiguration(QString classId, const QByteA { QDataStream stream(state); - int zoom; + QString mapProvider; + int zoom; double latitude; double longitude; - QString mapProvider; + bool useOpenGL; + bool showTileGridLines; QString accessMode; bool useMemoryCache; QString cacheLocation; + stream >> mapProvider; stream >> zoom; stream >> latitude; stream >> longitude; - stream >> mapProvider; + stream >> useOpenGL; + stream >> showTileGridLines; stream >> accessMode; stream >> useMemoryCache; stream >> cacheLocation; + if (!mapProvider.isEmpty()) m_mapProvider = mapProvider; m_defaultZoom = zoom; m_defaultLatitude = latitude; m_defaultLongitude = longitude; - if (!mapProvider.isEmpty()) m_mapProvider = mapProvider; + m_useOpenGL = useOpenGL; + m_showTileGridLines = showTileGridLines; + if (!accessMode.isEmpty()) m_accessMode = accessMode; m_useMemoryCache = useMemoryCache; if (!cacheLocation.isEmpty()) m_cacheLocation = cacheLocation; @@ -73,10 +82,12 @@ IUAVGadgetConfiguration * OPMapGadgetConfiguration::clone() { OPMapGadgetConfiguration *m = new OPMapGadgetConfiguration(this->classId()); + m->m_mapProvider = m_mapProvider; m->m_defaultZoom = m_defaultZoom; m->m_defaultLatitude = m_defaultLatitude; m->m_defaultLongitude = m_defaultLongitude; - m->m_mapProvider = m_mapProvider; + m->m_useOpenGL = m_useOpenGL; + m->m_showTileGridLines = m_showTileGridLines; m->m_accessMode = m_accessMode; m->m_useMemoryCache = m_useMemoryCache; m->m_cacheLocation = m_cacheLocation; @@ -89,10 +100,12 @@ QByteArray OPMapGadgetConfiguration::saveState() const QByteArray bytes; QDataStream stream(&bytes, QIODevice::WriteOnly); + stream << m_mapProvider; stream << m_defaultZoom; stream << m_defaultLatitude; stream << m_defaultLongitude; - stream << m_mapProvider; + stream << m_useOpenGL; + stream << m_showTileGridLines; stream << m_accessMode; stream << m_useMemoryCache; stream << m_cacheLocation; diff --git a/ground/src/plugins/opmap/opmapgadgetconfiguration.h b/ground/src/plugins/opmap/opmapgadgetconfiguration.h index 5411cd02f..14d1245c6 100644 --- a/ground/src/plugins/opmap/opmapgadgetconfiguration.h +++ b/ground/src/plugins/opmap/opmapgadgetconfiguration.h @@ -41,6 +41,8 @@ Q_PROPERTY(QString mapProvider READ mapProvider WRITE setMapProvider) Q_PROPERTY(int zoommo READ zoom WRITE setZoom) Q_PROPERTY(double latitude READ latitude WRITE setLatitude) Q_PROPERTY(double longitude READ longitude WRITE setLongitude) +Q_PROPERTY(bool useOpenGL READ useOpenGL WRITE setUseOpenGL) +Q_PROPERTY(bool showTileGridLines READ showTileGridLines WRITE setShowTileGridLines) Q_PROPERTY(QString accessMode READ accessMode WRITE setAccessMode) Q_PROPERTY(bool useMemoryCache READ useMemoryCache WRITE setUseMemoryCache) Q_PROPERTY(QString cacheLocation READ cacheLocation WRITE setCacheLocation) @@ -54,6 +56,8 @@ public: int zoom() const { return m_defaultZoom; } double latitude() const { return m_defaultLatitude; } double longitude() const { return m_defaultLongitude; } + bool useOpenGL() const { return m_useOpenGL; } + bool showTileGridLines() const { return m_showTileGridLines; } QString accessMode() const { return m_accessMode; } bool useMemoryCache() const { return m_useMemoryCache; } QString cacheLocation() const { return m_cacheLocation; } @@ -63,6 +67,8 @@ public slots: void setZoom(int zoom) { m_defaultZoom = zoom; } void setLatitude(double latitude) { m_defaultLatitude = latitude; } void setLongitude(double longitude) { m_defaultLongitude = longitude; } + void setUseOpenGL(bool useOpenGL) { m_useOpenGL = useOpenGL; } + void setShowTileGridLines(bool showTileGridLines) { m_showTileGridLines = showTileGridLines; } void setAccessMode(QString accessMode) { m_accessMode = accessMode; } void setUseMemoryCache(bool useMemoryCache) { m_useMemoryCache = useMemoryCache; } void setCacheLocation(QString cacheLocation) { m_cacheLocation = cacheLocation; } @@ -72,6 +78,8 @@ private: int m_defaultZoom; double m_defaultLatitude; double m_defaultLongitude; + bool m_useOpenGL; + bool m_showTileGridLines; QString m_accessMode; bool m_useMemoryCache; QString m_cacheLocation; diff --git a/ground/src/plugins/opmap/opmapgadgetoptionspage.cpp b/ground/src/plugins/opmap/opmapgadgetoptionspage.cpp index 9488bf1d9..9c9873339 100644 --- a/ground/src/plugins/opmap/opmapgadgetoptionspage.cpp +++ b/ground/src/plugins/opmap/opmapgadgetoptionspage.cpp @@ -69,11 +69,14 @@ QWidget *OPMapGadgetOptionsPage::createPage(QWidget *parent) m_page->latitudeSpinBox->setValue(m_config->latitude()); m_page->longitudeSpinBox->setValue(m_config->longitude()); + m_page->checkBoxUseOpenGL->setChecked(m_config->useOpenGL()); + m_page->checkBoxShowTileGridLines->setChecked(m_config->showTileGridLines()); + index = m_page->accessModeComboBox->findText(m_config->accessMode()); index = (index >= 0) ? index : 0; m_page->accessModeComboBox->setCurrentIndex(index); - m_page->pushButtonUseMemoryCache->setChecked(m_config->useMemoryCache()); + m_page->checkBoxUseMemoryCache->setChecked(m_config->useMemoryCache()); m_page->lineEditCacheLocation->setText(m_config->cacheLocation()); connect(m_page->pushButtonCacheLocation, SIGNAL(clicked()), this, SLOT(on_pushButtonCacheLocation_clicked())); @@ -101,7 +104,7 @@ void OPMapGadgetOptionsPage::on_pushButtonCacheDefaults_clicked() index = (index >= 0) ? index : 0; m_page->accessModeComboBox->setCurrentIndex(index); - m_page->pushButtonUseMemoryCache->setChecked(true); + m_page->checkBoxUseMemoryCache->setChecked(true); m_page->lineEditCacheLocation->setText(QDir::currentPath() + QDir::separator() + "mapscache" + QDir::separator()); } @@ -112,8 +115,10 @@ void OPMapGadgetOptionsPage::apply() m_config->setZoom(m_page->zoomSpinBox->value()); m_config->setLatitude(m_page->latitudeSpinBox->value()); m_config->setLongitude(m_page->longitudeSpinBox->value()); + m_config->setUseOpenGL(m_page->checkBoxUseOpenGL->isChecked()); + m_config->setShowTileGridLines(m_page->checkBoxShowTileGridLines->isChecked()); m_config->setAccessMode(m_page->accessModeComboBox->currentText()); - m_config->setUseMemoryCache(m_page->pushButtonUseMemoryCache->isChecked()); + m_config->setUseMemoryCache(m_page->checkBoxUseMemoryCache->isChecked()); m_config->setCacheLocation(m_page->lineEditCacheLocation->text()); } diff --git a/ground/src/plugins/opmap/opmapgadgetoptionspage.ui b/ground/src/plugins/opmap/opmapgadgetoptionspage.ui index face2469e..20f991374 100644 --- a/ground/src/plugins/opmap/opmapgadgetoptionspage.ui +++ b/ground/src/plugins/opmap/opmapgadgetoptionspage.ui @@ -25,24 +25,7 @@ - - - - OpenHandCursor - - - - - - - Map type - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - + Default longitude @@ -52,7 +35,7 @@ - + 8 @@ -65,33 +48,20 @@ - - + + - false + true Qt::RightToLeft - Show Grid + Use OpenGL - - - - false - - - Qt::RightToLeft - - - OpenGL - - - - + 8 @@ -104,17 +74,7 @@ - - - - Default zoom - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - + Default latitude @@ -124,16 +84,59 @@ - + 18 + + + + Default zoom + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + OpenHandCursor + + + + + + + Map type + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + true + + + true + + + Qt::RightToLeft + + + Show Tile Grid Lines + + + - + Qt::Vertical @@ -158,69 +161,21 @@ Server and Cache + + Qt::AlignCenter + - - - - - - OpenHandCursor - - - - - - - Access mode - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - OpenHandCursor - - - Use memory caching - - - QPushButton { -} -QPushButton:pressed { -} -QPushButton:hover { -} -QPushButton:checked { -/*background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, -stop: 0 rgba(180, 190, 220, 255), stop: 1 rgba(200, 230, 255, 255));*/ -} - - - - Memory Cache - - - true - - - false - - - false - - - - + + + + Qt::Horizontal + + + + + + @@ -248,7 +203,7 @@ stop: 0 rgba(180, 190, 220, 255), stop: 1 rgba(200, 230, 255, 255));*/ - + Qt::Horizontal @@ -261,30 +216,60 @@ stop: 0 rgba(180, 190, 220, 255), stop: 1 rgba(200, 230, 255, 255));*/ - - + + + + + + Qt::Horizontal - - QSizePolicy::Fixed - - 30 + 40 20 + + + + Access mode + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + 160 + 0 + + + + OpenHandCursor + + + - - + + - Cache location: + Cache location @@ -314,12 +299,35 @@ stop: 0 rgba(180, 190, 220, 255), stop: 1 rgba(200, 230, 255, 255));*/ - - - - Qt::Horizontal - - + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + true + + + Qt::RightToLeft + + + Use Memory Cache + + + + diff --git a/ground/src/plugins/opmap/opmapgadgetwidget.cpp b/ground/src/plugins/opmap/opmapgadgetwidget.cpp index a24fed6b5..bf0ee5354 100644 --- a/ground/src/plugins/opmap/opmapgadgetwidget.cpp +++ b/ground/src/plugins/opmap/opmapgadgetwidget.cpp @@ -44,7 +44,6 @@ OPMapGadgetWidget::OPMapGadgetWidget(QWidget *parent) : QWidget(parent) m_widget = NULL; m_map = NULL; - waypoint_editor = NULL; wayPoint_treeView_model = NULL; findPlaceCompleter = NULL; m_map_graphics_scene = NULL; @@ -164,17 +163,10 @@ OPMapGadgetWidget::OPMapGadgetWidget(QWidget *parent) : QWidget(parent) m_map->SetMaxZoom(19); // increase the maximum zoom level m_map->SetMouseWheelZoomType(internals::MouseWheelZoomType::MousePositionWithoutCenter); // set how the mouse wheel zoom functions m_map->SetFollowMouse(true); // we want a contiuous mouse position reading - m_map->SetUseOpenGL(openGLAct->isChecked()); // enable/disable openGL - m_map->SetShowTileGridLines(gridLinesAct->isChecked()); // map grid lines on/off m_map->SetCurrentPosition(internals::PointLatLng(data.Latitude, data.Longitude)); // set the default map position } // ************** - // create the waypoint editor dialog - - waypoint_editor = new opmap_waypointeditor_dialog(this); - - // ************** @@ -259,9 +251,9 @@ OPMapGadgetWidget::OPMapGadgetWidget(QWidget *parent) : QWidget(parent) OPMapGadgetWidget::~OPMapGadgetWidget() { clearWayPoints(); - if (m_map_overlay_widget) delete m_map_overlay_widget; + if (wayPoint_treeView_model) delete wayPoint_treeView_model; - if (waypoint_editor) delete waypoint_editor; + if (m_map_overlay_widget) delete m_map_overlay_widget; if (m_map) delete m_map; if (m_widget) delete m_widget; } @@ -356,14 +348,12 @@ void OPMapGadgetWidget::contextMenuEvent(QContextMenuEvent *event) menu.addAction(wayPointEditorAct); menu.addAction(addWayPointAct); + menu.addAction(editWayPointAct); menu.addAction(deleteWayPointAct); menu.addAction(clearWayPointsAct); menu.addSeparator(); -// menu.addAction(gridLinesAct); - menu.addAction(openGLAct); - menu.exec(event->globalPos()); // **************** @@ -704,8 +694,7 @@ void OPMapGadgetWidget::on_toolButtonAddWaypoint_clicked() void OPMapGadgetWidget::on_toolButtonWaypointEditor_clicked() { - if (waypoint_editor) - waypoint_editor->show(); + openWayPointEditor(); } void OPMapGadgetWidget::on_treeViewWaypoints_clicked(QModelIndex index) @@ -765,6 +754,18 @@ void OPMapGadgetWidget::setAccessMode(QString accessMode) m_map->configuration->SetAccessMode(mapcontrol::Helper::AccessModeFromString(accessMode)); } +void OPMapGadgetWidget::setUseOpenGL(bool useOpenGL) +{ + if (m_map) + m_map->SetUseOpenGL(useOpenGL); +} + +void OPMapGadgetWidget::setShowTileGridLines(bool showTileGridLines) +{ + if (m_map) + m_map->SetShowTileGridLines(showTileGridLines); +} + void OPMapGadgetWidget::setUseMemoryCache(bool useMemoryCache) { if (m_map) @@ -866,6 +867,11 @@ void OPMapGadgetWidget::createActions() addWayPointAct->setStatusTip(tr("Add waypoint")); connect(addWayPointAct, SIGNAL(triggered()), this, SLOT(addWayPoint())); + editWayPointAct = new QAction(tr("&Edit waypoint"), this); + editWayPointAct->setShortcut(tr("Ctrl+E")); + editWayPointAct->setStatusTip(tr("Edit waypoint")); + connect(editWayPointAct, SIGNAL(triggered()), this, SLOT(editWayPoint())); + deleteWayPointAct = new QAction(tr("&Delete waypoint"), this); deleteWayPointAct->setShortcut(tr("Ctrl+D")); deleteWayPointAct->setStatusTip(tr("Delete waypoint")); @@ -876,20 +882,6 @@ void OPMapGadgetWidget::createActions() clearWayPointsAct->setStatusTip(tr("Clear waypoints")); connect(clearWayPointsAct, SIGNAL(triggered()), this, SLOT(clearWayPoints())); - gridLinesAct = new QAction(tr("Grid lines"), this); - gridLinesAct->setShortcut(tr("Ctrl+G")); - gridLinesAct->setStatusTip(tr("Show/Hide grid lines")); - gridLinesAct->setCheckable(true); - gridLinesAct->setChecked(false); - connect(gridLinesAct, SIGNAL(triggered()), this, SLOT(gridLines())); - - openGLAct = new QAction(tr("Use OpenGL"), this); - openGLAct->setShortcut(tr("Ctrl+O")); - openGLAct->setStatusTip(tr("Enable/Disable OpenGL")); - openGLAct->setCheckable(true); - openGLAct->setChecked(false); - connect(openGLAct, SIGNAL(triggered()), this, SLOT(openGL())); - zoom2Act = new QAction(tr("2"), this); zoom2Act->setCheckable(true); connect(zoom2Act, SIGNAL(triggered()), this, SLOT(zoom2())); @@ -1052,8 +1044,7 @@ void OPMapGadgetWidget::on_followUAVheadingAct_toggled(bool checked) void OPMapGadgetWidget::openWayPointEditor() { - if (waypoint_editor) - waypoint_editor->show(); + waypoint_editor_dialog.show(); } void OPMapGadgetWidget::addWayPoint() @@ -1077,6 +1068,12 @@ void OPMapGadgetWidget::addWayPoint() // to do } +void OPMapGadgetWidget::editWayPoint() +{ + // to do + waypoint_edit_dialog.show(); +} + void OPMapGadgetWidget::deleteWayPoint() { // to do @@ -1090,16 +1087,4 @@ void OPMapGadgetWidget::clearWayPoints() m_waypoint_list_mutex.unlock(); } -void OPMapGadgetWidget::gridLines() -{ - if (m_map) - m_map->SetShowTileGridLines(gridLinesAct->isChecked()); -} - -void OPMapGadgetWidget::openGL() -{ - if (m_map) - m_map->SetUseOpenGL(openGLAct->isChecked()); -} - // ************************************************************************************* diff --git a/ground/src/plugins/opmap/opmapgadgetwidget.h b/ground/src/plugins/opmap/opmapgadgetwidget.h index 56024e071..7311a0436 100644 --- a/ground/src/plugins/opmap/opmapgadgetwidget.h +++ b/ground/src/plugins/opmap/opmapgadgetwidget.h @@ -42,6 +42,7 @@ #include "opmap_mapoverlaywidget.h" #include "opmap_waypointeditor_dialog.h" +#include "opmap_edit_waypoint_dialog.h" namespace Ui { @@ -70,10 +71,17 @@ public: OPMapGadgetWidget(QWidget *parent = 0); ~OPMapGadgetWidget(); - void setZoom(int value); - void setPosition(QPointF pos); - void setMapProvider(QString provider); - void setAccessMode(QString accessMode); + /** + * @brief public functions + * + * @param + */ + void setZoom(int value); + void setPosition(QPointF pos); + void setMapProvider(QString provider); + void setUseOpenGL(bool useOpenGL); + void setShowTileGridLines(bool showTileGridLines); + void setAccessMode(QString accessMode); void setUseMemoryCache(bool useMemoryCache); void setCacheLocation(QString cacheLocation); @@ -152,10 +160,9 @@ private slots: void on_followUAVheadingAct_toggled(bool checked); void openWayPointEditor(); void addWayPoint(); + void editWayPoint(); void deleteWayPoint(); void clearWayPoints(); - void gridLines(); - void openGL(); void zoom2() { setZoom(2); } void zoom3() { setZoom(3); } void zoom4() { setZoom(4); } @@ -194,7 +201,9 @@ private: mapcontrol::OPMapWidget *m_map; - opmap_waypointeditor_dialog *waypoint_editor; + opmap_waypointeditor_dialog waypoint_editor_dialog; + + opmap_edit_waypoint_dialog waypoint_edit_dialog; QGraphicsScene *m_map_graphics_scene; QGraphicsProxyWidget *m_map_scene_proxy; @@ -219,10 +228,9 @@ private: QAction *followUAVheadingAct; QAction *wayPointEditorAct; QAction *addWayPointAct; + QAction *editWayPointAct; QAction *deleteWayPointAct; QAction *clearWayPointsAct; - QAction *gridLinesAct; - QAction *openGLAct; QActionGroup *zoomActGroup; QAction *zoom2Act;