18 changed files with 377 additions and 33 deletions
@ -0,0 +1,67 @@
@@ -0,0 +1,67 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2026 Jon Beniston, M7RCE <jon@beniston.com> //
|
||||
// //
|
||||
// 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 as 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 V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef QT_LOCATION_FOUND |
||||
#include <QGeoServiceProvider> |
||||
#endif |
||||
|
||||
#include "vorlocalizerdisplaydialog.h" |
||||
|
||||
VORLocalizerDisplayDialog::VORLocalizerDisplayDialog(VORLocalizerSettings *settings, QWidget* parent) : |
||||
QDialog(parent), |
||||
ui(new Ui::VORLocalizerDisplayDialog), |
||||
m_settings(settings) |
||||
{ |
||||
ui->setupUi(this); |
||||
|
||||
#ifdef QT_LOCATION_FOUND |
||||
QStringList mapProviders = QGeoServiceProvider::availableServiceProviders(); |
||||
if (!mapProviders.contains("osm")) { |
||||
ui->mapProvider->removeItem(ui->mapProvider->findText("osm")); |
||||
} |
||||
if (!mapProviders.contains("mapboxgl")) { |
||||
ui->mapProvider->removeItem(ui->mapProvider->findText("mapboxgl")); |
||||
} |
||||
#endif |
||||
|
||||
int idx = ui->mapProvider->findText(settings->m_mapProvider); |
||||
if (idx != -1) { |
||||
ui->mapProvider->setCurrentIndex(idx); |
||||
} |
||||
ui->mapBoxAPIKey->setText(settings->m_mapBoxAPIKey); |
||||
} |
||||
|
||||
VORLocalizerDisplayDialog::~VORLocalizerDisplayDialog() |
||||
{ |
||||
delete ui; |
||||
} |
||||
|
||||
void VORLocalizerDisplayDialog::accept() |
||||
{ |
||||
if (!ui->mapProvider->currentText().isEmpty() && (m_settings->m_mapProvider != ui->mapProvider->currentText())) |
||||
{ |
||||
m_settings->m_mapProvider = ui->mapProvider->currentText(); |
||||
m_settingsKeys.append("mapProvider"); |
||||
} |
||||
if (m_settings->m_mapBoxAPIKey != ui->mapBoxAPIKey->text()) |
||||
{ |
||||
m_settings->m_mapBoxAPIKey = ui->mapBoxAPIKey->text(); |
||||
m_settingsKeys.append("mapBoxAPIKey"); |
||||
} |
||||
|
||||
QDialog::accept(); |
||||
} |
||||
@ -0,0 +1,42 @@
@@ -0,0 +1,42 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2026 Jon Beniston, M7RCE <jon@beniston.com> //
|
||||
// //
|
||||
// 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 as 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 V3 for more details. //
|
||||
// //
|
||||
// You should have received a copy of the GNU General Public License //
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef INCLUDE_VORLOCALIZERDISPLAYDIALOG_H |
||||
#define INCLUDE_VORLOCALIZERDISPLAYDIALOG_H |
||||
|
||||
#include "ui_vorlocalizerdisplaydialog.h" |
||||
#include "vorlocalizersettings.h" |
||||
|
||||
class VORLocalizerDisplayDialog : public QDialog { |
||||
Q_OBJECT |
||||
|
||||
public: |
||||
explicit VORLocalizerDisplayDialog(VORLocalizerSettings *settings, QWidget* parent = nullptr); |
||||
~VORLocalizerDisplayDialog(); |
||||
|
||||
const QStringList& getSettingsKeys() const { return m_settingsKeys; }; |
||||
|
||||
private slots: |
||||
void accept(); |
||||
|
||||
private: |
||||
Ui::VORLocalizerDisplayDialog* ui; |
||||
VORLocalizerSettings *m_settings; |
||||
QStringList m_settingsKeys; |
||||
}; |
||||
|
||||
#endif // INCLUDE_VORLOCALIZERDISPLAYDIALOG_H
|
||||
@ -0,0 +1,111 @@
@@ -0,0 +1,111 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<ui version="4.0"> |
||||
<class>VORLocalizerDisplayDialog</class> |
||||
<widget class="QDialog" name="VORLocalizerDisplayDialog"> |
||||
<property name="geometry"> |
||||
<rect> |
||||
<x>0</x> |
||||
<y>0</y> |
||||
<width>400</width> |
||||
<height>120</height> |
||||
</rect> |
||||
</property> |
||||
<property name="font"> |
||||
<font> |
||||
<pointsize>9</pointsize> |
||||
</font> |
||||
</property> |
||||
<property name="windowTitle"> |
||||
<string>Display Settings</string> |
||||
</property> |
||||
<layout class="QVBoxLayout" name="verticalLayout"> |
||||
<item> |
||||
<layout class="QFormLayout" name="mapLayout"> |
||||
<item row="0" column="0"> |
||||
<widget class="QLabel" name="mapProviderLabel"> |
||||
<property name="text"> |
||||
<string>Map provider</string> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item row="0" column="1"> |
||||
<widget class="QComboBox" name="mapProvider"> |
||||
<property name="toolTip"> |
||||
<string>Mapping service provider</string> |
||||
</property> |
||||
<item> |
||||
<property name="text"> |
||||
<string>osm</string> |
||||
</property> |
||||
</item> |
||||
<item> |
||||
<property name="text"> |
||||
<string>mapboxgl</string> |
||||
</property> |
||||
</item> |
||||
</widget> |
||||
</item> |
||||
<item row="1" column="0"> |
||||
<widget class="QLabel" name="mapBoxAPIKeyLabel"> |
||||
<property name="text"> |
||||
<string>Mapbox API key</string> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item row="1" column="1"> |
||||
<widget class="QLineEdit" name="mapBoxAPIKey"> |
||||
<property name="toolTip"> |
||||
<string>API key for Mapbox (https://www.mapbox.com), required for the mapboxgl map provider</string> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
</layout> |
||||
</item> |
||||
<item> |
||||
<widget class="QDialogButtonBox" name="buttonBox"> |
||||
<property name="orientation"> |
||||
<enum>Qt::Orientation::Horizontal</enum> |
||||
</property> |
||||
<property name="standardButtons"> |
||||
<set>QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::Ok</set> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
</layout> |
||||
</widget> |
||||
<resources/> |
||||
<connections> |
||||
<connection> |
||||
<sender>buttonBox</sender> |
||||
<signal>accepted()</signal> |
||||
<receiver>VORLocalizerDisplayDialog</receiver> |
||||
<slot>accept()</slot> |
||||
<hints> |
||||
<hint type="sourcelabel"> |
||||
<x>248</x> |
||||
<y>254</y> |
||||
</hint> |
||||
<hint type="destinationlabel"> |
||||
<x>157</x> |
||||
<y>274</y> |
||||
</hint> |
||||
</hints> |
||||
</connection> |
||||
<connection> |
||||
<sender>buttonBox</sender> |
||||
<signal>rejected()</signal> |
||||
<receiver>VORLocalizerDisplayDialog</receiver> |
||||
<slot>reject()</slot> |
||||
<hints> |
||||
<hint type="sourcelabel"> |
||||
<x>316</x> |
||||
<y>260</y> |
||||
</hint> |
||||
<hint type="destinationlabel"> |
||||
<x>286</x> |
||||
<y>274</y> |
||||
</hint> |
||||
</hints> |
||||
</connection> |
||||
</connections> |
||||
</ui> |
||||
Loading…
Reference in new issue