mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-09-27 15:46:51 -04:00
Merge branch 'feat-fst280' of bitbucket.org:k1jt/wsjtx into feat-fst280
This commit is contained in:
commit
e96dee4c23
@ -669,10 +669,15 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
|
|||||||
#endif
|
#endif
|
||||||
connect(&proc_jt9, static_cast<void (QProcess::*) (int, QProcess::ExitStatus)> (&QProcess::finished),
|
connect(&proc_jt9, static_cast<void (QProcess::*) (int, QProcess::ExitStatus)> (&QProcess::finished),
|
||||||
[this] (int exitCode, QProcess::ExitStatus status) {
|
[this] (int exitCode, QProcess::ExitStatus status) {
|
||||||
subProcessFailed (&proc_jt9, exitCode, status);
|
if (subProcessFailed (&proc_jt9, exitCode, status))
|
||||||
|
{
|
||||||
|
m_valid = false; // ensures exit if still
|
||||||
|
// constructing
|
||||||
|
QTimer::singleShot (0, this, SLOT (close ()));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
connect(&p1, &QProcess::started, [this] () {
|
connect(&p1, &QProcess::started, [this] () {
|
||||||
showStatusMessage (QString {"Started: %1 \"%2\""}.arg (p1.program ()).arg (p1.arguments ().join (QLatin1String {"\" \""})));
|
showStatusMessage (QString {"Started: %1 \"%2\""}.arg (p1.program ()).arg (p1.arguments ().join ("\" \"")));
|
||||||
});
|
});
|
||||||
connect(&p1, &QProcess::readyReadStandardOutput, this, &MainWindow::p1ReadFromStdout);
|
connect(&p1, &QProcess::readyReadStandardOutput, this, &MainWindow::p1ReadFromStdout);
|
||||||
#if QT_VERSION < QT_VERSION_CHECK (5, 6, 0)
|
#if QT_VERSION < QT_VERSION_CHECK (5, 6, 0)
|
||||||
@ -687,25 +692,50 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
|
|||||||
#endif
|
#endif
|
||||||
connect(&p1, static_cast<void (QProcess::*) (int, QProcess::ExitStatus)> (&QProcess::finished),
|
connect(&p1, static_cast<void (QProcess::*) (int, QProcess::ExitStatus)> (&QProcess::finished),
|
||||||
[this] (int exitCode, QProcess::ExitStatus status) {
|
[this] (int exitCode, QProcess::ExitStatus status) {
|
||||||
subProcessFailed (&p1, exitCode, status);
|
if (subProcessFailed (&p1, exitCode, status))
|
||||||
|
{
|
||||||
|
m_valid = false; // ensures exit if still
|
||||||
|
// constructing
|
||||||
|
QTimer::singleShot (0, this, SLOT (close ()));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK (5, 6, 0)
|
#if QT_VERSION < QT_VERSION_CHECK (5, 6, 0)
|
||||||
connect(&p3, static_cast<void (QProcess::*) (QProcess::ProcessError)> (&QProcess::error),
|
connect(&p3, static_cast<void (QProcess::*) (QProcess::ProcessError)> (&QProcess::error),
|
||||||
[this] (QProcess::ProcessError error) {
|
[this] (QProcess::ProcessError error) {
|
||||||
subProcessError (&p3, error);
|
|
||||||
});
|
|
||||||
#else
|
#else
|
||||||
connect(&p3, &QProcess::errorOccurred, [this] (QProcess::ProcessError error) {
|
connect(&p3, &QProcess::errorOccurred, [this] (QProcess::ProcessError error) {
|
||||||
subProcessError (&p3, error);
|
|
||||||
});
|
|
||||||
#endif
|
#endif
|
||||||
|
#if !defined(Q_OS_WIN)
|
||||||
|
if (QProcess::FailedToStart != error)
|
||||||
|
#else
|
||||||
|
if (QProcess::Crashed != error)
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
subProcessError (&p3, error);
|
||||||
|
}
|
||||||
|
});
|
||||||
connect(&p3, &QProcess::started, [this] () {
|
connect(&p3, &QProcess::started, [this] () {
|
||||||
showStatusMessage (QString {"Started: %1 \"%2\""}.arg (p3.program ()).arg (p3.arguments ().join (QLatin1String {"\" \""})));
|
showStatusMessage (QString {"Started: %1 \"%2\""}.arg (p3.program ()).arg (p3.arguments ().join ("\" \"")));
|
||||||
});
|
});
|
||||||
connect(&p3, static_cast<void (QProcess::*) (int, QProcess::ExitStatus)> (&QProcess::finished),
|
connect(&p3, static_cast<void (QProcess::*) (int, QProcess::ExitStatus)> (&QProcess::finished),
|
||||||
[this] (int exitCode, QProcess::ExitStatus status) {
|
[this] (int exitCode, QProcess::ExitStatus status) {
|
||||||
subProcessFailed (&p3, exitCode, status);
|
#if defined(Q_OS_WIN)
|
||||||
|
// We forgo detecting user_hardware failures with exit
|
||||||
|
// code 1 on Windows. This is because we use CMD.EXE to
|
||||||
|
// run the executable. CMD.EXE returns exit code 1 when it
|
||||||
|
// can't find the target executable.
|
||||||
|
if (exitCode != 1) // CMD.EXE couldn't find file to execute
|
||||||
|
#else
|
||||||
|
// We forgo detecting user_hardware failures with exit
|
||||||
|
// code 127 non-Windows. This is because we use /bin/sh to
|
||||||
|
// run the executable. /bin/sh returns exit code 127 when it
|
||||||
|
// can't find the target executable.
|
||||||
|
if (exitCode != 127) // /bin/sh couldn't find file to execute
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
subProcessFailed (&p3, exitCode, status);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// hook up save WAV file exit handling
|
// hook up save WAV file exit handling
|
||||||
@ -2338,7 +2368,7 @@ void MainWindow::setup_status_bar (bool vhf)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::subProcessFailed (QProcess * process, int exit_code, QProcess::ExitStatus status)
|
bool MainWindow::subProcessFailed (QProcess * process, int exit_code, QProcess::ExitStatus status)
|
||||||
{
|
{
|
||||||
if (m_valid && (exit_code || QProcess::NormalExit != status))
|
if (m_valid && (exit_code || QProcess::NormalExit != status))
|
||||||
{
|
{
|
||||||
@ -2355,9 +2385,9 @@ void MainWindow::subProcessFailed (QProcess * process, int exit_code, QProcess::
|
|||||||
, tr ("Running: %1\n%2")
|
, tr ("Running: %1\n%2")
|
||||||
.arg (process->program () + ' ' + arguments.join (' '))
|
.arg (process->program () + ' ' + arguments.join (' '))
|
||||||
.arg (QString {process->readAllStandardError()}));
|
.arg (QString {process->readAllStandardError()}));
|
||||||
QTimer::singleShot (0, this, SLOT (close ()));
|
return true;
|
||||||
m_valid = false; // ensures exit if still constructing
|
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::subProcessError (QProcess * process, QProcess::ProcessError)
|
void MainWindow::subProcessError (QProcess * process, QProcess::ProcessError)
|
||||||
@ -2375,8 +2405,8 @@ void MainWindow::subProcessError (QProcess * process, QProcess::ProcessError)
|
|||||||
, tr ("Running: %1\n%2")
|
, tr ("Running: %1\n%2")
|
||||||
.arg (process->program () + ' ' + arguments.join (' '))
|
.arg (process->program () + ' ' + arguments.join (' '))
|
||||||
.arg (process->errorString ()));
|
.arg (process->errorString ()));
|
||||||
QTimer::singleShot (0, this, SLOT (close ()));
|
|
||||||
m_valid = false; // ensures exit if still constructing
|
m_valid = false; // ensures exit if still constructing
|
||||||
|
QTimer::singleShot (0, this, SLOT (close ()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8018,7 +8048,7 @@ void MainWindow::WSPR_scheduling ()
|
|||||||
}
|
}
|
||||||
m_WSPR_tx_next = false;
|
m_WSPR_tx_next = false;
|
||||||
if (m_config.is_transceiver_online () // need working rig control for hopping
|
if (m_config.is_transceiver_online () // need working rig control for hopping
|
||||||
&& !m_config.is_dummy_rig ()
|
// && !m_config.is_dummy_rig ()
|
||||||
&& ui->band_hopping_group_box->isChecked ()) {
|
&& ui->band_hopping_group_box->isChecked ()) {
|
||||||
auto hop_data = m_WSPR_band_hopping.next_hop (m_auto);
|
auto hop_data = m_WSPR_band_hopping.next_hop (m_auto);
|
||||||
qDebug () << "hop data: period:" << hop_data.period_name_
|
qDebug () << "hop data: period:" << hop_data.period_name_
|
||||||
@ -8029,22 +8059,25 @@ void MainWindow::WSPR_scheduling ()
|
|||||||
if (hop_data.frequencies_index_ >= 0) { // new band
|
if (hop_data.frequencies_index_ >= 0) { // new band
|
||||||
ui->bandComboBox->setCurrentIndex (hop_data.frequencies_index_);
|
ui->bandComboBox->setCurrentIndex (hop_data.frequencies_index_);
|
||||||
on_bandComboBox_activated (hop_data.frequencies_index_);
|
on_bandComboBox_activated (hop_data.frequencies_index_);
|
||||||
QStringList prefixes {".bat", ".cmd", ".exe", ""};
|
// Execute user's hardware controller
|
||||||
QString target;
|
auto band = m_config.bands ()->find (m_freqNominal).remove ('m');
|
||||||
for (auto const& prefix : prefixes)
|
#if defined(Q_OS_WIN)
|
||||||
{
|
// On windows we use CMD.EXE to find and execute the
|
||||||
target = QDir {m_appDir}.absoluteFilePath (QLatin1String {"user_hardware"});
|
// user_hardware executable. This means that the first matching
|
||||||
QFileInfo f {target + prefix};
|
// file extension on the PATHEXT environment variable found on
|
||||||
if (f.isExecutable ()) {
|
// the PATH environment variable path list. This give maximum
|
||||||
break;
|
// flexibility for users to write user_hardware in their
|
||||||
}
|
// language of choice, and place the file anywhere on the PATH
|
||||||
}
|
// environment variable. Equivalent to typing user_hardware
|
||||||
if (target.size ())
|
// without any path or extension at the CMD.EXE prompt.
|
||||||
{
|
p3.start("CMD", QStringList {"/C", "user_hardware", band});
|
||||||
// Execute user's hardware controller
|
#else
|
||||||
p3.start(QDir::toNativeSeparators (target)
|
// On non-Windows systems we expect the user_hardware executable
|
||||||
, QStringList {m_config.bands ()->find (m_freqNominal).remove ('m')});
|
// to be anywhere in the paths specified in the PATH environment
|
||||||
}
|
// variable path list, and executable. Equivalent to typing
|
||||||
|
// user_hardware without any path at the shell prompt.
|
||||||
|
p3.start("/bin/sh", QStringList {"-c", "user_hardware " + band});
|
||||||
|
#endif
|
||||||
|
|
||||||
// Produce a short tuneup signal
|
// Produce a short tuneup signal
|
||||||
m_tuneup = false;
|
m_tuneup = false;
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#define MAINWINDOW_H
|
#define MAINWINDOW_H
|
||||||
|
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
|
#include <QByteArray>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
@ -752,7 +753,7 @@ private:
|
|||||||
void rm_tb4(QString houndCall);
|
void rm_tb4(QString houndCall);
|
||||||
void read_wav_file (QString const& fname);
|
void read_wav_file (QString const& fname);
|
||||||
void decodeDone ();
|
void decodeDone ();
|
||||||
void subProcessFailed (QProcess *, int exit_code, QProcess::ExitStatus);
|
bool subProcessFailed (QProcess *, int exit_code, QProcess::ExitStatus);
|
||||||
void subProcessError (QProcess *, QProcess::ProcessError);
|
void subProcessError (QProcess *, QProcess::ProcessError);
|
||||||
void statusUpdate () const;
|
void statusUpdate () const;
|
||||||
void update_watchdog_label ();
|
void update_watchdog_label ();
|
||||||
|
Loading…
Reference in New Issue
Block a user