From bd56e4476e0c8a7071b9fa50dffc129f73dc640c Mon Sep 17 00:00:00 2001 From: pip Date: Wed, 23 Jun 2010 07:35:00 +0000 Subject: [PATCH] Added functionality to some user control buttons on the new map plug-in git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@867 ebee16cc-31ac-478f-84a7-5cbb03baadba --- ground/src/plugins/opmap/opmap_widget.ui | 17 +++------ .../src/plugins/opmap/opmapgadgetwidget.cpp | 37 ++++++++++++++++--- ground/src/plugins/opmap/opmapgadgetwidget.h | 7 +++- 3 files changed, 44 insertions(+), 17 deletions(-) diff --git a/ground/src/plugins/opmap/opmap_widget.ui b/ground/src/plugins/opmap/opmap_widget.ui index dd7ab0b73..505080d55 100644 --- a/ground/src/plugins/opmap/opmap_widget.ui +++ b/ground/src/plugins/opmap/opmap_widget.ui @@ -102,7 +102,8 @@ Show/Hide Flight Controls - background-color: rgba(255, 255, 255, 0); + background-color: rgba(255, 255, 255, 0); +color: rgb(255, 255, 255); @@ -247,7 +248,8 @@ color: rgb(255, 255, 255); false - color: rgb(255, 255, 255); + background-color: rgba(128, 128, 128, 0); +color: rgb(255, 255, 255); @@ -609,15 +611,8 @@ color: rgb(255, 255, 255); false - QToolButton { -background-color: rgba(255, 255, 255, 0); -color: rgb(255, 255, 255); -} -QToolButton:hover { - -} -QToolButton:pressed { -} + background-color: rgba(255, 255, 255, 0); +color: rgb(255, 255, 255); diff --git a/ground/src/plugins/opmap/opmapgadgetwidget.cpp b/ground/src/plugins/opmap/opmapgadgetwidget.cpp index e82b857ef..0e17a6a78 100644 --- a/ground/src/plugins/opmap/opmapgadgetwidget.cpp +++ b/ground/src/plugins/opmap/opmapgadgetwidget.cpp @@ -378,8 +378,10 @@ void OPMapGadgetWidget::zoomChanged(double zoom) void OPMapGadgetWidget::OnMapDrag() { - if (followUAVAct->isChecked()) - followUAVAct->setChecked(false); // disable follow UAV mode when the user starts to manually drag the map + if (followUAVAct) + { // disable follow UAV mode when the user starts to manually drag the map + if (followUAVAct->isChecked()) followUAVAct->setChecked(false); + } } void OPMapGadgetWidget::OnCurrentPositionChanged(internals::PointLatLng point) @@ -538,6 +540,28 @@ void OPMapGadgetWidget::on_toolButtonFlightControlsShowHide_clicked() } } +void OPMapGadgetWidget::on_toolButtonMapHome_clicked() +{ + followUAVAct->setChecked(false); +} + +void OPMapGadgetWidget::on_toolButtonMapUAV_clicked() +{ + followUAVAct->toggle(); +} + +void OPMapGadgetWidget::on_toolButtonHome_clicked() +{ +} + +void OPMapGadgetWidget::on_toolButtonHoldPosition_clicked() +{ +} + +void OPMapGadgetWidget::on_toolButtonGo_clicked() +{ +} + // ************************************************************************************* // public functions @@ -696,7 +720,7 @@ void OPMapGadgetWidget::createMapOverlayUserControls() void OPMapGadgetWidget::createActions() { // *********************** - // create the menu actions + // create menu actions closeAct = new QAction(tr("&Close menu"), this); // closeAct->setShortcuts(QKeySequence::New); @@ -741,7 +765,7 @@ void OPMapGadgetWidget::createActions() followUAVAct->setStatusTip(tr("Keep the map centered onto the UAV")); followUAVAct->setCheckable(true); followUAVAct->setChecked(false); - connect(followUAVAct, SIGNAL(triggered()), this, SLOT(followUAV())); + connect(followUAVAct, SIGNAL(toggled(bool)), this, SLOT(on_followUAVAct_toggled(bool))); wayPointEditorAct = new QAction(tr("&Way point editor"), this); wayPointEditorAct->setShortcut(tr("Ctrl+W")); @@ -911,8 +935,11 @@ void OPMapGadgetWidget::goUAV() } } -void OPMapGadgetWidget::followUAV() +void OPMapGadgetWidget::on_followUAVAct_toggled(bool checked) { + if (m_widget) + if (m_widget->toolButtonMapUAV->isChecked() != followUAVAct->isChecked()) + m_widget->toolButtonMapUAV->setChecked(followUAVAct->isChecked()); } void OPMapGadgetWidget::openWayPointEditor() diff --git a/ground/src/plugins/opmap/opmapgadgetwidget.h b/ground/src/plugins/opmap/opmapgadgetwidget.h index ad54a158e..ce08d62b6 100644 --- a/ground/src/plugins/opmap/opmapgadgetwidget.h +++ b/ground/src/plugins/opmap/opmapgadgetwidget.h @@ -80,7 +80,12 @@ private slots: void on_pushButtonGeoFenceP_clicked(); void on_comboBoxZoom_currentIndexChanged(int index); void on_toolButtonFlightControlsShowHide_clicked(); + void on_toolButtonMapHome_clicked(); + void on_toolButtonMapUAV_clicked(); + void on_toolButtonHome_clicked(); + void on_toolButtonHoldPosition_clicked(); + void on_toolButtonGo_clicked(); // map signals void zoomChanged(double zoom); @@ -101,7 +106,7 @@ private slots: void goMouseClick(); void goHome(); void goUAV(); - void followUAV(); + void on_followUAVAct_toggled(bool checked); void openWayPointEditor(); void addWayPoint(); void deleteWayPoint();