diff --git a/ground/src/plugins/opmap/opmap_widget.ui b/ground/src/plugins/opmap/opmap_widget.ui index d3f6fe332..6dca7e7be 100644 --- a/ground/src/plugins/opmap/opmap_widget.ui +++ b/ground/src/plugins/opmap/opmap_widget.ui @@ -6,8 +6,8 @@ 0 0 - 647 - 441 + 656 + 171 @@ -239,29 +239,28 @@ color: rgb(255, 255, 255); - + - + 0 0 - - - 8 - 50 - false - + + Zoom level + + + false - background-color: rgba(255, 255, 255, 0); -color: rgb(255, 255, 255); + color: rgb(255, 255, 255); + - - Zoom + + 20 - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + false @@ -651,8 +650,6 @@ border: none; - labelMapPos - layoutWidget_2 diff --git a/ground/src/plugins/opmap/opmapgadgetwidget.cpp b/ground/src/plugins/opmap/opmapgadgetwidget.cpp index cd7b18e1e..94f2807b5 100644 --- a/ground/src/plugins/opmap/opmapgadgetwidget.cpp +++ b/ground/src/plugins/opmap/opmapgadgetwidget.cpp @@ -72,19 +72,23 @@ OPMapGadgetWidget::OPMapGadgetWidget(QWidget *parent) : QWidget(parent) m_map->configuration->DragButton = Qt::LeftButton; // use the left mouse button for map dragging } + // ************** + + createActions(); + // ************** // set the user control options - m_widget->labelZoom->setText(QString::number(m_map->Zoom())); m_widget->labelRotate->setText(QString::number(m_map->Rotate())); // m_widget->labelNumTilesToLoad->setText(" 0"); m_widget->labelMapPos->setText(""); m_widget->labelMousePos->setText(""); m_widget->progressBarMap->setMaximum(1); - // ************** - - createActions(); + m_widget->comboBoxZoom->clear(); + for (int i = 2; i <= 19; i++) + m_widget->comboBoxZoom->addItem(QString::number(i), i); + m_widget->comboBoxZoom->setCurrentIndex((int)(m_map->Zoom() + 0.5) - 2); // ************** // map stuff @@ -141,6 +145,8 @@ OPMapGadgetWidget::OPMapGadgetWidget(QWidget *parent) : QWidget(parent) m_statusUpdateTimer->start(); // ************** + + connect(m_widget->comboBoxZoom, SIGNAL(currentIndexChanged(int)), this, SLOT(on_comboBoxZoom_currentIndexChanged(int))); } // ************************************************************************************* @@ -335,7 +341,13 @@ void OPMapGadgetWidget::zoomChanged(double zoom) int i_zoom = (int)(zoom + 0.5); if (m_widget) - m_widget->labelZoom->setText(" " + QString::number(zoom)); + { +// m_widget->labelZoom->setText(" " + QString::number(zoom)); + + disconnect(m_widget->comboBoxZoom, SIGNAL(currentIndexChanged(int)), this, 0); + m_widget->comboBoxZoom->setCurrentIndex(i_zoom - 2); + connect(m_widget->comboBoxZoom, SIGNAL(currentIndexChanged(int)), this, SLOT(on_comboBoxZoom_currentIndexChanged(int))); + } switch (i_zoom) { @@ -364,7 +376,7 @@ void OPMapGadgetWidget::zoomChanged(double zoom) void OPMapGadgetWidget::OnMapDrag() { if (followUAVAct->isChecked()) - followUAVAct->setChecked(false); // disable follow UAV mode + followUAVAct->setChecked(false); // disable follow UAV mode when the user starts to manually drag the map } void OPMapGadgetWidget::OnCurrentPositionChanged(internals::PointLatLng point) @@ -498,6 +510,14 @@ void OPMapGadgetWidget::on_pushButtonGeoFenceP_clicked() } } +void OPMapGadgetWidget::on_comboBoxZoom_currentIndexChanged(int index) +{ + bool ok; + int i = (int)m_widget->comboBoxZoom->itemData(index).toInt(&ok); + setZoom(2 + index); +} + + // ************************************************************************************* // public functions diff --git a/ground/src/plugins/opmap/opmapgadgetwidget.h b/ground/src/plugins/opmap/opmapgadgetwidget.h index d89904493..3cdf95dab 100644 --- a/ground/src/plugins/opmap/opmapgadgetwidget.h +++ b/ground/src/plugins/opmap/opmapgadgetwidget.h @@ -78,6 +78,7 @@ private slots: void on_toolButtonZoomP_clicked(); void on_pushButtonGeoFenceM_clicked(); void on_pushButtonGeoFenceP_clicked(); + void on_comboBoxZoom_currentIndexChanged(int index); // map signals void zoomChanged(double zoom);