diff --git a/ground/src/plugins/opmap/opmap.pro b/ground/src/plugins/opmap/opmap.pro index 479b7ff11..ab65cca07 100644 --- a/ground/src/plugins/opmap/opmap.pro +++ b/ground/src/plugins/opmap/opmap.pro @@ -9,14 +9,17 @@ HEADERS += opmapplugin.h \ opmapgadgetfactory.h \ opmapgadgetconfiguration.h \ opmapgadget.h \ - opmapgadgetwidget.h + opmapgadgetwidget.h \ + opmap_waypointeditor_dialog.h SOURCES += opmapplugin.cpp \ opmapgadgetwidget.cpp \ opmapgadgetoptionspage.cpp \ opmapgadgetfactory.cpp \ opmapgadgetconfiguration.cpp \ - opmapgadget.cpp + opmapgadget.cpp \ + opmap_waypointeditor_dialog.cpp OTHER_FILES += OPMapGadget.pluginspec FORMS += opmapgadgetoptionspage.ui \ - opmap_widget.ui + opmap_widget.ui \ + opmap_waypointeditor_dialog.ui RESOURCES += opmap.qrc diff --git a/ground/src/plugins/opmap/opmap_waypointeditor_dialog.cpp b/ground/src/plugins/opmap/opmap_waypointeditor_dialog.cpp new file mode 100644 index 000000000..dc5891310 --- /dev/null +++ b/ground/src/plugins/opmap/opmap_waypointeditor_dialog.cpp @@ -0,0 +1,57 @@ +/** + ****************************************************************************** + * + * @file opmap_waypointeditor_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_waypointeditor_dialog.h" +#include "ui_opmap_waypointeditor_dialog.h" + +#include "extensionsystem/pluginmanager.h" + +opmap_waypointeditor_dialog::opmap_waypointeditor_dialog(QWidget *parent) : + QDialog(parent), + ui(new Ui::opmap_waypointeditor_dialog) +{ + ui->setupUi(this); + + setWindowFlags(Qt::Dialog); +} + +opmap_waypointeditor_dialog::~opmap_waypointeditor_dialog() +{ + delete ui; +} + +void opmap_waypointeditor_dialog::changeEvent(QEvent *e) +{ + QDialog::changeEvent(e); + switch (e->type()) { + case QEvent::LanguageChange: + ui->retranslateUi(this); + break; + default: + break; + } +} diff --git a/ground/src/plugins/opmap/opmap_waypointeditor_dialog.h b/ground/src/plugins/opmap/opmap_waypointeditor_dialog.h new file mode 100644 index 000000000..baafb5eb5 --- /dev/null +++ b/ground/src/plugins/opmap/opmap_waypointeditor_dialog.h @@ -0,0 +1,54 @@ +/** + ****************************************************************************** + * + * @file opmap_waypointeditor_dialog.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_WAYPOINTEDITOR_DIALOG_H +#define OPMAP_WAYPOINTEDITOR_DIALOG_H + +#include +#include +#include +#include "uavobjects/uavobjectmanager.h" +#include "uavobjects/positionactual.h" + +namespace Ui { + class opmap_waypointeditor_dialog; +} + +class opmap_waypointeditor_dialog : public QDialog { + Q_OBJECT +public: + opmap_waypointeditor_dialog(QWidget *parent = 0); + ~opmap_waypointeditor_dialog(); + +protected: + void changeEvent(QEvent *e); + +private: + Ui::opmap_waypointeditor_dialog *ui; +}; + +#endif // OPMAP_WAYPOINTEDITOR_DIALOG_H diff --git a/ground/src/plugins/opmap/opmap_waypointeditor_dialog.ui b/ground/src/plugins/opmap/opmap_waypointeditor_dialog.ui new file mode 100644 index 000000000..40f872f22 --- /dev/null +++ b/ground/src/plugins/opmap/opmap_waypointeditor_dialog.ui @@ -0,0 +1,138 @@ + + + opmap_waypointeditor_dialog + + + + 0 + 0 + 399 + 359 + + + + + 300 + 260 + + + + OpenPilot GCS Waypoint Editor + + + + :/core/images/openpilot_logo_128.png:/core/images/openpilot_logo_128.png + + + true + + + + + + Graphical waypoint Height and Timeline + + + + + + + + + + + + Waypoints + + + + + + true + + + false + + + false + + + + Num + + + + + Latitude + + + + + Longitude + + + + + Height + + + + + Relative Time + + + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + + + + buttonBox + accepted() + opmap_waypointeditor_dialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + opmap_waypointeditor_dialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/ground/src/plugins/opmap/opmap_widget.ui b/ground/src/plugins/opmap/opmap_widget.ui index 23a4a8eaa..6d67c44ef 100644 --- a/ground/src/plugins/opmap/opmap_widget.ui +++ b/ground/src/plugins/opmap/opmap_widget.ui @@ -112,7 +112,7 @@ color: rgb(255, 255, 255); - + :/core/images/prev.png:/core/images/prev.png @@ -144,7 +144,7 @@ color: rgb(255, 255, 255); - + :/core/images/find.png:/core/images/find.png @@ -184,7 +184,7 @@ color: rgb(255, 255, 255); - + :/opmap/images/gcs.png:/opmap/images/gcs.png @@ -214,7 +214,7 @@ color: rgb(255, 255, 255); - + :/opmap/images/uav.png:/opmap/images/uav.png @@ -257,7 +257,37 @@ color: rgb(255, 255, 255); - + + :/opmap/images/waypoint.png:/opmap/images/waypoint.png + + + + 16 + 16 + + + + true + + + true + + + + + + + Opens the waypoint editor + + + background-color: rgba(71, 71, 71, 0); +color: rgb(255, 255, 255); + + + + + + :/opmap/images/waypoint.png:/opmap/images/waypoint.png @@ -297,7 +327,7 @@ color: rgb(255, 255, 255); - + :/opmap/images/minus.png:/opmap/images/minus.png @@ -328,7 +358,7 @@ color: rgb(255, 255, 255); - + :/opmap/images/plus.png:/opmap/images/plus.png @@ -515,7 +545,7 @@ color: rgb(255, 255, 255); - + :/opmap/images/home.png:/opmap/images/home.png @@ -545,7 +575,7 @@ color: rgb(255, 255, 255); - + :/opmap/images/hold.png:/opmap/images/hold.png @@ -572,7 +602,7 @@ color: rgb(255, 255, 255); - + :/opmap/images/go.png:/opmap/images/go.png @@ -833,9 +863,6 @@ border: none; - - - - + diff --git a/ground/src/plugins/opmap/opmapgadgetwidget.cpp b/ground/src/plugins/opmap/opmapgadgetwidget.cpp index 7d60f1d8f..8c4d3f4bb 100644 --- a/ground/src/plugins/opmap/opmapgadgetwidget.cpp +++ b/ground/src/plugins/opmap/opmapgadgetwidget.cpp @@ -32,6 +32,7 @@ #include #include #include + #include "extensionsystem/pluginmanager.h" // ************************************************************************************* @@ -43,6 +44,7 @@ OPMapGadgetWidget::OPMapGadgetWidget(QWidget *parent) : QWidget(parent) m_widget = NULL; m_map = NULL; + waypoint_editor = NULL; setMouseTracking(true); @@ -124,6 +126,11 @@ OPMapGadgetWidget::OPMapGadgetWidget(QWidget *parent) : QWidget(parent) layout->addWidget(m_map); m_widget->mapWidget->setLayout(layout); + // ************** + // create the waypoint editor dialog + + waypoint_editor = new opmap_waypointeditor_dialog(this); + // ************** // create the user controls overlayed onto the map @@ -150,6 +157,7 @@ OPMapGadgetWidget::OPMapGadgetWidget(QWidget *parent) : QWidget(parent) OPMapGadgetWidget::~OPMapGadgetWidget() { + if (waypoint_editor) delete waypoint_editor; if (m_map) delete m_map; if (m_widget) delete m_widget; } @@ -461,43 +469,6 @@ void OPMapGadgetWidget::on_toolButtonZoomM_clicked() zoomOut(); } -void OPMapGadgetWidget::on_pushButtonGeoFenceM_clicked() -{ - if (m_widget) - { -// int geo_fence_distance = m_widget->spinBoxGeoFenceDistance->value(); -// int step = m_widget->spinBoxGeoFenceDistance->singleStep(); -// m_widget->spinBoxGeoFenceDistance->setValue(geo_fence_distance - step); - -// geo_fence_distance = m_widget->spinBoxGeoFenceDistance->value(); - - - - // to do - - - - } -} - -void OPMapGadgetWidget::on_pushButtonGeoFenceP_clicked() -{ - if (m_widget) - { -// int geo_fence_distance = m_widget->spinBoxGeoFenceDistance->value(); -// int step = m_widget->spinBoxGeoFenceDistance->singleStep(); -// m_widget->spinBoxGeoFenceDistance->setValue(geo_fence_distance + step); - -// geo_fence_distance = m_widget->spinBoxGeoFenceDistance->value(); - - - // to do - - - - } -} - void OPMapGadgetWidget::on_toolButtonFlightControlsShowHide_clicked() { if (m_widget) @@ -538,6 +509,12 @@ void OPMapGadgetWidget::on_toolButtonGo_clicked() { } +void OPMapGadgetWidget::on_toolButtonWaypointEditor_clicked() +{ + if (waypoint_editor) + waypoint_editor->show(); +} + // ************************************************************************************* // public functions @@ -938,7 +915,8 @@ void OPMapGadgetWidget::on_followUAVheadingAct_toggled(bool checked) void OPMapGadgetWidget::openWayPointEditor() { - // to do + if (waypoint_editor) + waypoint_editor->show(); } void OPMapGadgetWidget::addWayPoint() diff --git a/ground/src/plugins/opmap/opmapgadgetwidget.h b/ground/src/plugins/opmap/opmapgadgetwidget.h index 73d1a90ca..436f26744 100644 --- a/ground/src/plugins/opmap/opmapgadgetwidget.h +++ b/ground/src/plugins/opmap/opmapgadgetwidget.h @@ -29,11 +29,15 @@ #define OPMAP_GADGETWIDGET_H_ #include "opmapcontrol/opmapcontrol.h" + #include #include + #include "uavobjects/uavobjectmanager.h" #include "uavobjects/positionactual.h" +#include "opmap_waypointeditor_dialog.h" + namespace Ui { class OPMap_Widget; } @@ -75,12 +79,11 @@ private slots: void on_toolButtonFindPlace_clicked(); void on_toolButtonZoomM_clicked(); void on_toolButtonZoomP_clicked(); - void on_pushButtonGeoFenceM_clicked(); - void on_pushButtonGeoFenceP_clicked(); void on_toolButtonFlightControlsShowHide_clicked(); void on_toolButtonMapHome_clicked(); void on_toolButtonMapUAV_clicked(); void on_horizontalSliderZoom_sliderMoved(int position); + void on_toolButtonWaypointEditor_clicked(); void on_toolButtonHome_clicked(); void on_toolButtonHoldPosition_clicked(); @@ -146,6 +149,8 @@ private: mapcontrol::OPMapWidget *m_map; + opmap_waypointeditor_dialog *waypoint_editor; + QPushButton * createTransparentButton(QWidget *parent, QString text, QString icon); void createMapOverlayUserControls();