summaryrefslogtreecommitdiff
path: root/widgets
diff options
context:
space:
mode:
authorChristoph Berg <myon@debian.org>2026-06-22 12:03:55 +0200
committerChristoph Berg <myon@debian.org>2026-06-22 12:03:55 +0200
commitde18fc13175a5bf0e2b48a042d2fc06e87c88d24 (patch)
treef517074cd603d30eb7ba7e2122d38051e4c1439c /widgets
parentb76e8361909e47f0937d4a64a5a4cb5939f51eb7 (diff)
parentd83a420f0517d7fc47aeb288a6a0cf4891784fcc (diff)
Update upstream source from tag 'upstream/3.0.2+dfsg'
Update to upstream version '3.0.2+dfsg' with Debian dir 90381fe7be9f5ea84d9b16c9cccf200a3fbe138b
Diffstat (limited to 'widgets')
-rw-r--r--widgets/about.cpp2
-rw-r--r--widgets/activeStations.cpp28
-rw-r--r--widgets/displaytext.cpp8
-rw-r--r--widgets/fastgraph.cpp6
-rw-r--r--widgets/mainwindow.cpp67
-rw-r--r--widgets/widegraph.cpp19
-rw-r--r--widgets/widegraph.h2
-rw-r--r--widgets/widegraph.ui2
8 files changed, 100 insertions, 34 deletions
diff --git a/widgets/about.cpp b/widgets/about.cpp
index 59400929..85366124 100644
--- a/widgets/about.cpp
+++ b/widgets/about.cpp
@@ -15,7 +15,7 @@ CAboutDlg::CAboutDlg(QWidget *parent) :
ui->labelTxt->setText ("<h2>" + QString {"WSJT-X v"
+ QCoreApplication::applicationVersion ()
- + " " + revision ()}.simplified () + "<br />"
+ + " " + display_revision ()}.simplified () + "<br />"
"WSJT-X implements a number of digital modes designed for <br />"
"weak-signal Amateur Radio communication. <br /><br />"
diff --git a/widgets/activeStations.cpp b/widgets/activeStations.cpp
index 7353501c..067d36b5 100644
--- a/widgets/activeStations.cpp
+++ b/widgets/activeStations.cpp
@@ -125,31 +125,37 @@ void ActiveStations::displayRecentStations(QString mode, QString const& t)
m_clickOK=false;
ui->RecentStationsPlainTextEdit->setPlainText(t);
-//White background for Q65-60x decodes, yellow for Q65-30x:
int i0=0;
int i1=0;
- int npos=0;
int nlines=t.count("\n");
QTextCursor cursor=ui->RecentStationsPlainTextEdit->textCursor();
QTextCharFormat fmt;
+
+ // Use a regular expression matcher to find the text pattern within each line bounds
+ QRegularExpression regex(" 30[ABCD] ");
+
for(int i=0; i<nlines; i++) {
i1=t.indexOf("\n",i0);
- npos=t.indexOf(QRegularExpression(" 30[ABCD] "), i0);
- if(npos>0) {
- cursor.setPosition(npos);
- cursor.select(QTextCursor::LineUnderCursor);
+ // Isolate the current line to check for the match
+ QString currentLine = t.mid(i0, i1 - i0);
+ bool hasMatch = currentLine.contains(regex);
+
+ // Move the cursor to the current line we are processing
+ cursor.setPosition(i0);
+ cursor.select(QTextCursor::LineUnderCursor);
+
+ if(hasMatch) {
fmt.setBackground(QBrush(Qt::yellow));
fmt.setForeground(QBrush(Qt::black));
} else {
- cursor.setPosition(i0+10);
- cursor.select(QTextCursor::LineUnderCursor);
- fmt.clearForeground();
- fmt.clearBackground();
+ // Explicitly force the background back to white
+ fmt.setBackground(QBrush(Qt::white));
+ fmt.setForeground(QBrush(Qt::black));
}
+
cursor.setCharFormat(fmt);
i0=i1+1;
}
-
m_clickOK=bClickOK;
}
diff --git a/widgets/displaytext.cpp b/widgets/displaytext.cpp
index 2494928a..5c8e4233 100644
--- a/widgets/displaytext.cpp
+++ b/widgets/displaytext.cpp
@@ -208,7 +208,7 @@ void DisplayText::insertText(QString const& text, QColor bg, QColor fg
{
temp_format = format;
cursor.insertText(text.mid (text_index, call_index - text_index), format);
- if (pos.value ().second.isValid ())
+ if (pos.value ().first.isValid ())
{
temp_format.setBackground (pos.value ().first);
}
@@ -872,7 +872,7 @@ void DisplayText::highlight_callsign (QString const& callsign, QColor const& bg,
}
else
{
- auto pos = highlighted_calls_.find (callsign);
+ auto pos = highlighted_calls_.find (callsign.toUpper ());
if (bg.isValid () || fg.isValid ())
{
auto colours = qMakePair (bg, fg);
@@ -918,7 +918,7 @@ void DisplayText::AudioAlerts()
#ifdef WIN32
if(m_config->alert_Enabled()) {
QAudioOutput info(QAudioDeviceInfo::defaultOutputDevice());
- QString audioPath = QCoreApplication::applicationDirPath() + "/sounds" + m_config->voicesPath() + "/";
+ QString audioPath = app_sounds_directory (m_config->voicesPath());
QAudioFormat format;
format.setCodec("audio/pcm");
format.setSampleRate (48000);
@@ -930,7 +930,7 @@ void DisplayText::AudioAlerts()
connect(audio, SIGNAL(stateChanged(QAudio::State)), this, SLOT(handleStateChanged(QAudio::State)));
#else
if(m_config->alert_Enabled()) {
- QString audioPath = QCoreApplication::applicationDirPath() + "/sounds" + m_config->voicesPath() + "/";
+ QString audioPath = app_sounds_directory (m_config->voicesPath());
#endif
QFile *effect2 = new QFile(this);
QFile *effect3 = new QFile(this);
diff --git a/widgets/fastgraph.cpp b/widgets/fastgraph.cpp
index 9efe5fc6..10580f82 100644
--- a/widgets/fastgraph.cpp
+++ b/widgets/fastgraph.cpp
@@ -98,7 +98,11 @@ void FastGraph::on_pbAutoLevel_clicked()
for(int i=0; i<=fast_jh; i++) {
sum += fast_green[i];
}
- m_ave=sum/fast_jh;
+ if (fast_jh == 0) {
+ m_ave=0.0;
+ } else {
+ m_ave=sum/fast_jh;
+ }
ui->gainSlider->setValue(127-int(2.2*m_ave));
ui->zeroSlider->setValue(int(m_ave)+20);
ui->greenZeroSlider->setValue(160-int(3.3*m_ave));
diff --git a/widgets/mainwindow.cpp b/widgets/mainwindow.cpp
index d58a98be..dc7e1d2d 100644
--- a/widgets/mainwindow.cpp
+++ b/widgets/mainwindow.cpp
@@ -636,6 +636,8 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
connect(m_wideGraph.data (), SIGNAL(freezeDecode2(int)),this,SLOT(freezeDecode(int)));
connect(m_wideGraph.data (), SIGNAL(f11f12(int)),this,SLOT(bumpFqso(int)));
connect(m_wideGraph.data (), SIGNAL(setXIT2(int)),this,SLOT(setXIT(int)));
+ m_wideGraph->setReferenceSpectrumAvailable(
+ QFile::exists(m_config.writeable_data_dir ().absoluteFilePath ("refspec.dat")));
connect (m_fastGraph.data (), &FastGraph::fastPick, this, &MainWindow::fastPick);
@@ -1126,6 +1128,9 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
, "-e", QDir::toNativeSeparators (m_appDir)
, "-a", QDir::toNativeSeparators (m_config.writeable_data_dir ().absolutePath ())
, "-t", QDir::toNativeSeparators (m_config.temp_dir ().absolutePath ())
+ // -r: read-only shipped-data dir (cty.dat, ALLCALL7.TXT, ...) for the
+ // Fortran decoder; resolves to Contents/Resources/wsjtx on macOS.
+ , "-r", QDir::toNativeSeparators (m_config.data_dir ().absolutePath ())
};
QProcessEnvironment new_env {m_env};
new_env.insert ("OMP_STACKSIZE", "10M");
@@ -1226,6 +1231,22 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
ui->outAttenuation->setValue(0);
ui->outAttenuation->setValue(attVal);
Q_EMIT m_config.transceiver_volume(m_config.volume());
+ // set_mode() in the constructor emits transceiver_period() while the TCI
+ // rig is still offline, so TransceiverBase::set() skips do_period() and
+ // TCITransceiver's m_period stays at its 15.0 s default. For any mode
+ // whose TR period != 15 s (FT4, MSK144, Q65-15, FST4-15, ...) the
+ // modulator then computes against 15000 ms and readAudioData emits
+ // silence for the whole transmission (panadapter shows energy, no audio
+ // reaches the air). Re-emit the period here, now that TCI is connected.
+ // That same offline set_mode() also left m_TRperiod cached in
+ // Configuration even though the rig never applied it, so force=true
+ // bypasses Configuration's period de-dup and guarantees the resync
+ // regardless of TCI bring-up timing.
+ // OOB guard matches on_actionFT4_triggered() and the other mode handlers.
+ // Hardens public PR WSJTX/wsjtx#21 (Ramon Martinez, rampa069) for the
+ // Configuration de-dup cache.
+ if (ui->bandComboBox->currentText()!="OOB")
+ Q_EMIT m_config.transceiver_period(m_TRperiod, true);
});
}
@@ -2008,7 +2029,7 @@ void MainWindow::readSettings()
#ifdef WIN32
if (m_config.alert_Enabled()) { // testing and initializing the default audio device for playing audible alerts
QAudioOutput info(QAudioDeviceInfo::defaultOutputDevice());
- QString audioPath = QCoreApplication::applicationDirPath() + "/sounds" + m_config.voicesPath() + "/";
+ QString audioPath = app_sounds_directory (m_config.voicesPath());
QAudioFormat format;
format.setCodec("audio/pcm");
format.setSampleRate (48000);
@@ -2018,7 +2039,7 @@ void MainWindow::readSettings()
QAudioOutput* audio;
audio = new QAudioOutput(format, this);
QFile *effect = new QFile(this);
- effect->setFileName(QString("%1/%2").arg(audioPath, "Testing.wav"));
+ effect->setFileName(QString("%1/%2").arg(audioPath, "Testing123.wav"));
effect->open(QIODevice::ReadOnly);
audio->start(effect);
}
@@ -2240,8 +2261,8 @@ void MainWindow::dataSink(qint64 frames)
if(!m_diskData) {
refspectrum_(&dec_data.d2[k-m_nsps/2],&m_bClearRefSpec,&m_bRefSpec,
&m_bUseRef, fname.constData (), (FCL)fname.size ());
+ m_bClearRefSpec=false;
}
- m_bClearRefSpec=false;
if(m_mode=="MSK144" or m_bFast9) {
fastSink(frames);
@@ -3365,7 +3386,7 @@ void MainWindow::fastSink(qint64 frames)
if (m_config.alert_Enabled() && ((m_config.alert_DXcall() && play_DXcall && m_hisCall!="") or (m_config.alert_Wanted() && play_Wanted))) {
#ifdef WIN32
QAudioOutput info(QAudioDeviceInfo::defaultOutputDevice());
- QString audioPath = QCoreApplication::applicationDirPath() + "/sounds" + m_config.voicesPath() + "/";
+ QString audioPath = app_sounds_directory (m_config.voicesPath());
QAudioFormat format;
format.setCodec("audio/pcm");
format.setSampleRate (48000);
@@ -3381,9 +3402,9 @@ void MainWindow::fastSink(qint64 frames)
effect1->open(QIODevice::ReadOnly);
audio->start(effect1);
#else
- QString audioPath = QCoreApplication::applicationDirPath() + "/sounds" + m_config.voicesPath() + "/";
+ QString audioPath = app_sounds_directory (m_config.voicesPath());
if (m_config.alert_DXcall() && play_DXcall) QSound::play(audioPath + "DXcall.wav"); // for Linux and macOS
- else if (m_config.alert_DXcall() && play_Wanted) QSound::play(audioPath + "Wanted.wav"); // for Linux and macOS
+ else if (m_config.alert_Wanted() && play_Wanted) QSound::play(audioPath + "Wanted.wav"); // for Linux and macOS
#endif
play_DXcall = false;
play_Wanted = false;
@@ -4517,6 +4538,8 @@ void MainWindow::on_stopButton_clicked() //stopButton
m_loopall=false;
if(m_bRefSpec) {
MessageBox::information_message (this, tr ("Reference spectrum saved"));
+ m_wideGraph->setReferenceSpectrumAvailable(
+ QFile::exists(m_config.writeable_data_dir ().absoluteFilePath ("refspec.dat")));
m_bRefSpec=false;
}
if (ui->DX_Call_Button->isChecked()) ui->DX_Call_Button->click ();
@@ -7192,7 +7215,7 @@ void MainWindow::readFromStdout() //readFromStdout
if (m_config.alert_Enabled() && ((m_config.alert_DXcall() && play_DXcall && m_hisCall!="") or (m_config.alert_Wanted() && play_Wanted))) {
#ifdef WIN32
QAudioOutput info(QAudioDeviceInfo::defaultOutputDevice());
- QString audioPath = QCoreApplication::applicationDirPath() + "/sounds" + m_config.voicesPath() + "/";
+ QString audioPath = app_sounds_directory (m_config.voicesPath());
QAudioFormat format;
format.setCodec("audio/pcm");
format.setSampleRate (48000);
@@ -7208,9 +7231,9 @@ void MainWindow::readFromStdout() //readFromStdout
effect1->open(QIODevice::ReadOnly);
audio->start(effect1);
#else
- QString audioPath = QCoreApplication::applicationDirPath() + "/sounds" + m_config.voicesPath() + "/";
+ QString audioPath = app_sounds_directory (m_config.voicesPath());
if (m_config.alert_DXcall() && play_DXcall) QSound::play(audioPath + "DXcall.wav"); // for Linux and macOS
- else if (m_config.alert_DXcall() && play_Wanted) QSound::play(audioPath + "Wanted.wav"); // for Linux and macOS
+ else if (m_config.alert_Wanted() && play_Wanted) QSound::play(audioPath + "Wanted.wav"); // for Linux and macOS
#endif
play_DXcall = false;
play_Wanted = false;
@@ -10390,7 +10413,7 @@ void MainWindow::mousePressEvent(QMouseEvent *event) // mouse press events
// Testing the default audio device
#ifdef WIN32
QAudioOutput info(QAudioDeviceInfo::defaultOutputDevice());
- QString audioPath = QCoreApplication::applicationDirPath() + "/sounds" + m_config.voicesPath() + "/";
+ QString audioPath = app_sounds_directory (m_config.voicesPath());
QAudioFormat format;
format.setCodec("audio/pcm");
format.setSampleRate (48000);
@@ -10404,7 +10427,7 @@ void MainWindow::mousePressEvent(QMouseEvent *event) // mouse press events
effect->open(QIODevice::ReadOnly);
audio->start(effect);
#else
- QString audioPath = QCoreApplication::applicationDirPath() + "/sounds" + m_config.voicesPath() + "/";
+ QString audioPath = app_sounds_directory (m_config.voicesPath());
QSound::play(audioPath + "Testing_long.wav"); // for Linux and macOS
#endif
}
@@ -13885,6 +13908,16 @@ void MainWindow::on_actionMeasure_phase_response_triggered()
void MainWindow::on_actionErase_reference_spectrum_triggered()
{
+ QFile refspec_file {m_config.writeable_data_dir ().absoluteFilePath ("refspec.dat")};
+ bool refspec_available {false};
+ if (refspec_file.exists () and !refspec_file.remove ()) {
+ refspec_available = refspec_file.exists ();
+ MessageBox::warning_message (this, tr ("File Error"),
+ tr ("Cannot remove \"%1\": %2")
+ .arg (refspec_file.fileName (), refspec_file.errorString ()));
+ }
+ if (m_wideGraph) m_wideGraph->clearReferenceSpectrum (refspec_available);
+ m_bUseRef=false;
m_bClearRefSpec=true;
}
@@ -17341,7 +17374,11 @@ void MainWindow::on_actionErase_Ignore_List_triggered()
void MainWindow::read_ALLCALL7()
{
- static QFile AllCall7File {"ALLCALL7.TXT"};
+ // Read the shipped read-only ALLCALL7.TXT from the data dir where it installs
+ // (Contents/Resources/wsjtx on macOS, share/wsjtx on Linux/Windows), mirroring
+ // the JPLEPH idiom (m_config.data_dir()). The function-local static is built on
+ // the first call, after Configuration is constructed, so m_config is valid.
+ static QFile AllCall7File {m_config.data_dir ().absoluteFilePath ("ALLCALL7.TXT")};
QTextStream AllCall7Stream(&AllCall7File);
if(AllCall7File.open(QIODevice::ReadOnly | QIODevice::Text)) {
while (!AllCall7Stream.atEnd()) {
@@ -17377,7 +17414,6 @@ void MainWindow::alertQSYmessage ()
{
#ifdef WIN32
QAudioOutput info(QAudioDeviceInfo::defaultOutputDevice());
- QString binPath = QCoreApplication::applicationDirPath();
QAudioFormat format;
format.setCodec("audio/pcm");
format.setSampleRate (48000);
@@ -17388,11 +17424,10 @@ void MainWindow::alertQSYmessage ()
audio = new QAudioOutput(format, this);
connect(audio, SIGNAL(stateChanged(QAudio::State)), this, SLOT(handleStateChanged(QAudio::State)));
QFile *effect1 = new QFile(this);
- effect1->setFileName(QString("%1/%2").arg(binPath, "/sounds/Message.wav"));
+ effect1->setFileName(app_sounds_directory () + "Message.wav");
effect1->open(QIODevice::ReadOnly);
audio->start(effect1);
#else
- QString binPath = QCoreApplication::applicationDirPath();
- QSound::play(binPath + "/sounds/Message.wav"); // for Linux and macOS
+ QSound::play(app_sounds_directory () + "Message.wav"); // for Linux and macOS
#endif
}
diff --git a/widgets/widegraph.cpp b/widgets/widegraph.cpp
index 2bdef6bd..4aa2ea10 100644
--- a/widgets/widegraph.cpp
+++ b/widgets/widegraph.cpp
@@ -497,6 +497,25 @@ bool WideGraph::useRef() //Flatten
return m_bRef;
}
+void WideGraph::setReferenceSpectrumAvailable(bool available)
+{
+ if(!available) {
+ m_bRef=false;
+ ui->cbRef->setChecked(false);
+ ui->widePlot->setFlatten(m_bFlatten,m_bRef);
+ }
+ ui->cbRef->setEnabled(available);
+}
+
+void WideGraph::clearReferenceSpectrum(bool reference_spectrum_available)
+{
+ m_bRef=false;
+ ui->cbRef->setChecked(false);
+ ui->widePlot->setFlatten(m_bFlatten,m_bRef);
+ setReferenceSpectrumAvailable(reference_spectrum_available);
+ m_n=0;
+}
+
void WideGraph::replot()
{
if(ui->widePlot->scaleOK()) ui->widePlot->replot();
diff --git a/widgets/widegraph.h b/widgets/widegraph.h
index 2b19dc98..ff1daf72 100644
--- a/widgets/widegraph.h
+++ b/widgets/widegraph.h
@@ -41,6 +41,8 @@ public:
void setSubMode(int n);
bool flatten();
bool useRef();
+ void setReferenceSpectrumAvailable(bool available);
+ void clearReferenceSpectrum(bool reference_spectrum_available);
void setTol(int n);
void setSuperFox(bool b);
void setSuperHound(bool b);
diff --git a/widgets/widegraph.ui b/widgets/widegraph.ui
index 0f8b374e..a4ee7695 100644
--- a/widgets/widegraph.ui
+++ b/widgets/widegraph.ui
@@ -408,7 +408,7 @@
<item>
<widget class="QCheckBox" name="cbRef">
<property name="toolTip">
- <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Compute and save a reference spectrum. (Not yet fully implemented.)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Apply a saved reference spectrum to flatten the received passband. Available after a reference spectrum has been measured. (Not yet fully implemented.)&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Ref Spec</string>