diff --git a/src/ui/SettingsDialog.cc b/src/ui/SettingsDialog.cc index 8200c9f69dd611a533238f3b31bbe6312455a505..ea9862b5f4a8b2b09c9d4a2cb5aa1da8a77f616e 100644 --- a/src/ui/SettingsDialog.cc +++ b/src/ui/SettingsDialog.cc @@ -37,6 +37,7 @@ #include "QGCFileDialog.h" #include "QGCMessageBox.h" #include "MainToolBar.h" +#include "FlightMapSettings.h" SettingsDialog::SettingsDialog(QWidget *parent, int showTab, Qt::WindowFlags flags) : QDialog(parent, flags), @@ -94,7 +95,18 @@ _ui(new Ui::SettingsDialog) connect(_ui->styleChooser, SIGNAL(currentIndexChanged(int)), this, SLOT(styleChanged(int))); connect(_ui->browseSavedFilesLocation, &QPushButton::clicked, this, &SettingsDialog::_selectSavedFilesDirectory); connect(_ui->buttonBox, &QDialogButtonBox::accepted, this, &SettingsDialog::_validateBeforeClose); - + + // Flight Map settings + + FlightMapSettings* fmSettings = FlightMapSettings::instance(); + _ui->bingMapRadio->setChecked(fmSettings->mapProvider() == "Bing"); + _ui->googleMapRadio->setChecked(fmSettings->mapProvider() == "Google"); + _ui->openMapRadio->setChecked(fmSettings->mapProvider() == "Open"); + + connect(_ui->bingMapRadio, &QRadioButton::clicked, this, &SettingsDialog::_bingMapRadioClicked); + connect(_ui->googleMapRadio, &QRadioButton::clicked, this, &SettingsDialog::_googleMapRadioClicked); + connect(_ui->openMapRadio, &QRadioButton::clicked, this, &SettingsDialog::_openMapRadioClicked); + switch (showTab) { case ShowCommLinks: _ui->tabWidget->setCurrentWidget(pLinkConf); @@ -193,3 +205,24 @@ void SettingsDialog::on_showRSSI_clicked(bool checked) { _mainWindow->getMainToolBar()->viewStateChanged(TOOL_BAR_SHOW_RSSI, checked); } + +void SettingsDialog::_bingMapRadioClicked(bool checked) +{ + if (checked) { + FlightMapSettings::instance()->setMapProvider("Bing"); + } +} + +void SettingsDialog::_googleMapRadioClicked(bool checked) +{ + if (checked) { + FlightMapSettings::instance()->setMapProvider("Google"); + } +} + +void SettingsDialog::_openMapRadioClicked(bool checked) +{ + if (checked) { + FlightMapSettings::instance()->setMapProvider("Open"); + } +} diff --git a/src/ui/SettingsDialog.h b/src/ui/SettingsDialog.h index ac1a31108ea065452367adf75ff2e0d74048538a..f991e9b79ab402d920f39275ccd0489da065292a 100644 --- a/src/ui/SettingsDialog.h +++ b/src/ui/SettingsDialog.h @@ -62,6 +62,10 @@ private slots: void on_showMav_clicked(bool checked); void on_showRSSI_clicked(bool checked); + + void _bingMapRadioClicked(bool checked); + void _googleMapRadioClicked(bool checked); + void _openMapRadioClicked(bool checked); private: MainWindow* _mainWindow; diff --git a/src/ui/SettingsDialog.ui b/src/ui/SettingsDialog.ui index 036595c8181c5e781afccf83a1b511923c1bf39a..0db0fa3fffed2086d347cccfc6379857d337a94c 100644 --- a/src/ui/SettingsDialog.ui +++ b/src/ui/SettingsDialog.ui @@ -7,7 +7,7 @@ 0 0 500 - 596 + 689 @@ -115,6 +115,36 @@ + + + + Map Provider + + + + + + Bing + + + + + + + Google + + + + + + + Open Streets + + + + + +