Commit d7a47fad authored by Don Gagne's avatar Don Gagne

Map provider to use is now in settings

parent 7d841636
......@@ -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");
}
}
......@@ -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;
......
......@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>500</width>
<height>596</height>
<height>689</height>
</rect>
</property>
<property name="sizePolicy">
......@@ -115,6 +115,36 @@
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_4">
<property name="title">
<string>Map Provider</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QRadioButton" name="bingMapRadio">
<property name="text">
<string>Bing</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="googleMapRadio">
<property name="text">
<string>Google</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="openMapRadio">
<property name="text">
<string>Open Streets</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="sizePolicy">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment