summaryrefslogtreecommitdiff
path: root/map65/devsetup.cpp
diff options
context:
space:
mode:
authorChristoph Berg <myon@debian.org>2026-09-26 23:24:28 +0200
committerChristoph Berg <myon@debian.org>2026-09-26 23:24:28 +0200
commit69344560ea394c06ca94acac46a2e4c3e8b7b229 (patch)
treeebc98370a697a9bbd6b973a14fa5113c475c6db7 /map65/devsetup.cpp
parent3e9d10a67671d0bd5c7b8c3ca8088f1818322eff (diff)
parent059831534c7e884f0a607ed86b582fd00d821731 (diff)
Update upstream source from tag 'upstream/3.2.0_rc1+dfsg'
Update to upstream version '3.2.0~rc1+dfsg' with Debian dir dbff457fd2c3616d5c77b863c7bfb2186ed86047
Diffstat (limited to 'map65/devsetup.cpp')
-rw-r--r--map65/devsetup.cpp94
1 files changed, 86 insertions, 8 deletions
diff --git a/map65/devsetup.cpp b/map65/devsetup.cpp
index 2b1e9e8f..4fae12ea 100644
--- a/map65/devsetup.cpp
+++ b/map65/devsetup.cpp
@@ -9,6 +9,9 @@
#include <QStringList>
#include <QSerialPortInfo>
#include <QRegularExpression>
+#include <QSignalBlocker>
+#include <QSettings>
+#include "SettingsGroup.hpp"
#if !defined(Q_OS_WIN)
extern "C" {
@@ -54,8 +57,17 @@ DevSetup::DevSetup(MainWindow *parent)
mw(parent)
{
ui.setupUi(this); //setup the dialog form
+
+ {
+ QSettings settings(mw->m_settings_filename, QSettings::IniFormat);
+ SettingsGroup g {&settings, "DevSetup"};
+ restoreGeometry(settings.value("geometry").toByteArray());
+ }
+
m_restartSoundIn=false;
m_restartSoundOut=false;
+ m_restartRequired=false;
+ m_pendingFs96000=-1;
QButtonGroup *buttonGroup = new QButtonGroup(this);
buttonGroup->addButton(ui.w3szBut);
@@ -74,6 +86,18 @@ DevSetup::~DevSetup()
{
}
+void DevSetup::done(int r)
+{
+ // accept()/reject() (OK, Cancel, and the title-bar close button, which
+ // triggers reject() internally) all funnel through here -- unlike
+ // closeEvent(), which only fires for the title-bar close button, not
+ // for accept()/reject() called directly from button clicks.
+ QSettings settings(mw->m_settings_filename, QSettings::IniFormat);
+ SettingsGroup g {&settings, "DevSetup"};
+ settings.setValue("geometry", saveGeometry());
+ QDialog::done(r);
+}
+
void DevSetup::initDlg()
{
int k,id;
@@ -105,9 +129,10 @@ getDev(&numDevices,
k = 0;
for (id = 0; id < numDevices; id++) {
- if (!(96000 >= minSpeed[id] && 96000 <= maxSpeed[id]))
+ if (!(g_sampleRate >= minSpeed[id] && g_sampleRate <= maxSpeed[id]))
continue;
+
#ifdef _WIN32
if (!QString(hostAPI_DeviceName[id].name).contains("MME"))
continue;
@@ -201,6 +226,14 @@ for (id = 0; id < numDevices; id++) {
ptt_set_override(nullptr);
#endif
+ if (mw->m_fs96000 == 2)
+ oldSampleRate = 192000;
+ else if (mw->m_fs96000 == 1)
+ oldSampleRate = 96000;
+ else if (mw->m_fs96000 == 0)
+ oldSampleRate = 95238;
+ else oldSampleRate = 96000;
+
ui.astroFont->setValue(mw->m_astroFont);
ui.cbXpol->setChecked(mw->m_xpol);
ui.rbAntennaX->setChecked(mw->m_xpolx);
@@ -212,10 +245,16 @@ for (id = 0; id < numDevices; id++) {
ui.dPhiSpinBox->setValue(mw->m_dPhi);
ui.fCalSpinBox->setValue(mw->m_fCal);
ui.faddEntry->setText(QString::number(mw->m_fAdd,'f',3));
- ui.networkRadioButton->setChecked(mw->m_network);
- ui.soundCardRadioButton->setChecked(!mw->m_network);
- ui.rb96000->setChecked(mw->m_fs96000);
- ui.rb95238->setChecked(!mw->m_fs96000);
+ {
+ QSignalBlocker blockNetwork {ui.networkRadioButton};
+ QSignalBlocker blockSoundCard {ui.soundCardRadioButton};
+ ui.networkRadioButton->setChecked(mw->m_network);
+ ui.soundCardRadioButton->setChecked(!mw->m_network);
+ }
+ ui.rb192000->setChecked(mw->m_fs96000 == 2);
+ ui.rb96000->setChecked(mw->m_fs96000 == 1);
+ ui.rb95238->setChecked(mw->m_fs96000 == 0);
+ on_soundCardRadioButton_toggled(ui.soundCardRadioButton->isChecked());
ui.rbIQXT->setChecked(mw->m_bIQxt);
ui.rbSi570->setChecked(!mw->m_bIQxt);
ui.mult570TxSpinBox->setEnabled(mw->m_bIQxt);
@@ -267,10 +306,26 @@ void DevSetup::accept()
// Check to see whether SoundInThread must be restarted,
// and save user parameters.
+ int newSampleRate = ui.rb192000->isChecked() ? 192000 :
+ ui.rb96000->isChecked() ? 96000 :
+ 95238;
+ int newFs96000 = ui.rb192000->isChecked() ? 2 :
+ ui.rb96000->isChecked() ? 1 :
+ 0;
+ double const newFAdd = ui.faddEntry->text().toDouble();
+
+ m_restartRequired = oldSampleRate != newSampleRate;
+ if (m_restartRequired) {
+ m_pendingFs96000 = newFs96000;
+ } else {
+ emit sampleRateChanged(newSampleRate);
+ }
+
if(mw->m_network!=ui.networkRadioButton->isChecked() or
mw->m_nDevIn!=ui.comboBoxSndIn->currentIndex() or
mw->m_paInDevice!=m_inDevList[mw->m_nDevIn] or
mw->m_xpol!=ui.cbXpol->isChecked() or
+ mw->m_fAdd!=newFAdd or
mw->m_udpPort!=ui.sbPort->value()) m_restartSoundIn=true;
if(mw->m_nDevOut!=ui.comboBoxSndOut->currentIndex() or
@@ -303,9 +358,11 @@ void DevSetup::accept()
mw->m_timeout=ui.timeoutSpinBox->value();
mw->m_dPhi=ui.dPhiSpinBox->value();
mw->m_fCal=ui.fCalSpinBox->value();
- mw->m_fAdd=ui.faddEntry->text().toDouble();
+ mw->m_fAdd=newFAdd;
mw->m_network=ui.networkRadioButton->isChecked();
- mw->m_fs96000=ui.rb96000->isChecked();
+ if (!m_restartRequired) {
+ mw->m_fs96000 = newFs96000;
+ }
mw->m_bIQxt=ui.rbIQXT->isChecked();
mw->m_nDevIn=ui.comboBoxSndIn->currentIndex();
mw->m_paInDevice=m_inDevList[mw->m_nDevIn];
@@ -325,13 +382,34 @@ void DevSetup::accept()
mw->m_spot_to_psk_reporter = ui.pskBox->isChecked();
mw->m_psk_reporter_tcpip = ui.pskReporterTcpIpBox->isChecked();
+ if (m_restartRequired) {
+ QMessageBox::information(this,
+ "Restart Required",
+ "Changing sample rate requires MAP65 to be restarted.\n"
+ "Please exit MAP65 and start it again.");
+ }
+
+ // Normal path
QDialog::accept();
+
}
void DevSetup::on_soundCardRadioButton_toggled(bool checked)
{
ui.comboBoxSndIn->setEnabled(ui.soundCardRadioButton->isChecked());
- ui.rb96000->setChecked(checked);
+ int fs96000 = ui.rb192000->isChecked() ? 2 :
+ ui.rb95238->isChecked() ? 0 :
+ 1;
+ if(checked) {
+ if(fs96000 == 0) fs96000 = 1;
+ ui.rb95238->setEnabled(false);
+ }
+ else {
+ ui.rb95238->setEnabled(true);
+ }
+ ui.rb192000->setChecked(fs96000 == 2);
+ ui.rb96000->setChecked(fs96000 == 1);
+ ui.rb95238->setChecked(fs96000 == 0);
ui.rb95238->setEnabled(!checked);
ui.label_InputDev->setEnabled(checked);
ui.label_Port->setEnabled(!checked);