Skip to content

Commit

Permalink
Implemented region selection for repeater book. (#454)
Browse files Browse the repository at this point in the history
  • Loading branch information
hmatuschek authored Jul 20, 2024
1 parent 0a27c5f commit 20d3faf
Show file tree
Hide file tree
Showing 9 changed files with 392 additions and 264 deletions.
Binary file added doc/manual/gui/fig/qdmr-settings-datasources.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/manual/gui/fig/qdmr-settings-programming.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
74 changes: 52 additions & 22 deletions doc/manual/gui/settingsdialog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,45 @@
</info>

<para>
The application settings dialog controls some of the behavior of <application>qdmr</application>.
The dialog is divided into 4 sections: <guilabel>Location</guilabel>, <guilabel>Radio
Programming</guilabel>, <guilabel>Call-Sign DB</guilabel> and <guilabel>Extended Features</guilabel>.
The application settings dialog controls the behavior of <application>qdmr</application>.
The dialog is divided into 3 sections, accessible via the tabs on the top.
</para>

<screenshot>
<mediaobject>
<imageobject><imagedata fileref="fig/qdmr-settings-dialog.png" width="5cm" align="center"/></imageobject>
<textobject>Screen shot of the application settings dialog.</textobject>
</mediaobject>
<title>The settings dialog</title>
</screenshot>


<section>
<info>
<title>Location settings</title>
<title>Data Sources</title>
</info>

<para>
The <guilabel>Data Sources</guilabel> tab collects the settings for the location service and
repeater database.
</para>

<screenshot>
<mediaobject>
<imageobject><imagedata fileref="fig/qdmr-settings-datasources.png" width="5cm" align="center"/></imageobject>
<textobject>Screen shot of the application settings dialog for the data sources.</textobject>
</mediaobject>
<title>The settings dialog: Data sources</title>
</screenshot>

<para>
The first section concerns the location of the user. You may enter your <glossterm>Maidenhead
Locator</glossterm> here or you may enable <guilabel>System location</guilabel>. The latter tries
to obtain the current location from the operating system. This information is then used in the
channel editors (see <xref linkend="guiChannels"/>) to provide auto-completion for repeaters
nearby.
</para>

<para>
The second section allows to set the source for the repeater database. This enables
<application>qdmr</application> to automatically complete some information for a repeater if its
callsign is entered as the name, when creating a new channel. For some weird reason, the single
data source <ulink url="https://www.repeaterbook.com/">Repeater Book</ulink> provides two identical
APIs for North America and the rest of the World. You must select your source accordingly.
</para>
</section>


Expand All @@ -45,8 +58,21 @@
</info>

<para>
The second section controls the programming of the radio and how codeplugs are assembled. The
first option <guilabel>Update codeplug</guilabel> specifies whether a codeplug is generated from
The second tab controls, how the radios are programmed. That is, how the codeplug is assembled and
also, how the callsign database gets curated.
</para>

<screenshot>
<mediaobject>
<imageobject><imagedata fileref="fig/qdmr-settings-programming.png" width="5cm" align="center"/></imageobject>
<textobject>Screen shot of the application settings dialog for programming the radios.</textobject>
</mediaobject>
<title>The settings dialog: Programming</title>
</screenshot>

<para>
The first section specifies how codeplugs are assembled. The first option
<guilabel>Update codeplug</guilabel> specifies whether a codeplug is generated from
scratch or whether the codeplug currently programmed on the radio gets updated.
<application>qdmr</application> does not implement all settings possible for all radios,
consequently <guilabel>Update codeplug</guilabel> should be choses to maintain all settings
Expand Down Expand Up @@ -77,13 +103,6 @@
manufacturer. But be aware, that transmitting outside the declared frequency range may destroy
the radio!
</para>
</section>


<section>
<info>
<title>Call-sign DB settings</title>
</info>

<para>
The <guilabel>Call-Sign DB</guilabel> section collects options that control the automatic
Expand Down Expand Up @@ -124,12 +143,23 @@
</para>
</section>


<section>
<info>
<title>Extended feature settings</title>
<title>Extension settings</title>
</info>

<para>
The last tab collects settings, controlling several extended settings for the devices.
</para>

<screenshot>
<mediaobject>
<imageobject><imagedata fileref="fig/qdmr-settings-extensions.png" width="5cm" align="center"/></imageobject>
<textobject>Screen shot of the application settings dialog for extensions.</textobject>
</mediaobject>
<title>The settings dialog: Extensions</title>
</screenshot>

<para>
DMR originated as a standard for commercial radios. Consequently, there are many features that
are not relevant or even illegal for ham-radio use (e.g., encryption). However, some operators
Expand Down
8 changes: 7 additions & 1 deletion src/repeaterbookcompleter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include "logger.hh"
#include "utils.hh"
#include "settings.hh"


/* ********************************************************************************************* *
Expand Down Expand Up @@ -418,7 +419,12 @@ RepeaterBookList::search(const QString &text) {
if ((_queries.contains(call)) && (_queries[call].daysTo(QDateTime::currentDateTime())<3))
return;

QUrl url("https://www.repeaterbook.com/api/exportROW.php");
QUrl url;
if (Region::World == Settings().repeaterBookRegion())
url = QUrl("https://www.repeaterbook.com/api/exportROW.php");
else
url = QUrl("https://www.repeaterbook.com/api/export.php");

QUrlQuery query;
query.addQueryItem("callsign", QString("%1%").arg(call));
url.setQuery(query);
Expand Down
6 changes: 6 additions & 0 deletions src/repeaterbookcompleter.hh
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ class RepeaterBookList: public QAbstractListModel
{
Q_OBJECT

public:
enum Region {
World, NorthAmerica
};
Q_ENUM(Region)

public:
explicit RepeaterBookList(QObject *parent=nullptr);

Expand Down
18 changes: 18 additions & 0 deletions src/settings.cc
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,15 @@ Settings::position() const {
return loc2deg(locator());
}

RepeaterBookList::Region
Settings::repeaterBookRegion() const {
return value("repeaterBookRegion", RepeaterBookList::Region::World).value<RepeaterBookList::Region>();
}
void
Settings::setRepeaterBookRegion(RepeaterBookList::Region region) {
setValue("repeaterBookRegion", region);
}

bool
Settings::updateCodeplug() const {
return value("updateCodeplug", true).toBool();
Expand Down Expand Up @@ -313,6 +322,11 @@ SettingsDialog::SettingsDialog(QWidget *parent)
if (queryLocation->isChecked())
locatorEntry->setEnabled(false);

switch (settings.repeaterBookRegion()) {
case RepeaterBookList::World: Ui::SettingsDialog::repeaterBookRegion->setCurrentIndex(0); break;
case RepeaterBookList::NorthAmerica: Ui::SettingsDialog::repeaterBookRegion->setCurrentIndex(1); break;
}

connect(Ui::SettingsDialog::ignoreFrequencyLimits, SIGNAL(toggled(bool)),
this, SLOT(onIgnoreFrequencyLimitsSet(bool)));
connect(queryLocation, SIGNAL(toggled(bool)), this, SLOT(onSystemLocationToggled(bool)));
Expand Down Expand Up @@ -397,6 +411,10 @@ SettingsDialog::accept() {
Settings settings;
settings.setQueryPosition(queryLocation->isChecked());
settings.setLocator(locatorEntry->text().simplified());
if (0 == Ui::SettingsDialog::repeaterBookRegion->currentIndex())
settings.setRepeaterBookRegion(RepeaterBookList::World);
else
settings.setRepeaterBookRegion(RepeaterBookList::NorthAmerica);
settings.setUpdateCodeplug(updateCodeplug->isChecked());
settings.setAutoEnableGPS(autoEnableGPS->isChecked());
settings.setAutoEnableRoaming(autoEnableRoaming->isChecked());
Expand Down
4 changes: 4 additions & 0 deletions src/settings.hh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include "ui_settingsdialog.h"

#include "codeplug.hh"
#include "repeaterbookcompleter.hh"


class Settings : public QSettings
Expand All @@ -30,6 +31,9 @@ public:
void setLocator(const QString &locator);
QGeoCoordinate position() const;

RepeaterBookList::Region repeaterBookRegion() const;
void setRepeaterBookRegion(RepeaterBookList::Region region);

bool updateCodeplug() const;
void setUpdateCodeplug(bool update);

Expand Down
Loading

0 comments on commit 20d3faf

Please sign in to comment.