mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-24 13:18:38 -05:00
Qt v5.15 compatibility
This commit is contained in:
parent
4476c0e736
commit
9c22b5c3ed
@ -67,16 +67,34 @@ public:
|
||||
private:
|
||||
Q_SLOT void start_recording ()
|
||||
{
|
||||
qtout << "started recording at " << QDateTime::currentDateTimeUtc ().toString ("hh:mm:ss.zzz UTC") << endl;
|
||||
qtout << "started recording at " << QDateTime::currentDateTimeUtc ().toString ("hh:mm:ss.zzz UTC")
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||
<< Qt::endl
|
||||
#else
|
||||
<< endl
|
||||
#endif
|
||||
;
|
||||
source_.start (output_);
|
||||
if (!notify_interval_) QTimer::singleShot (duration_ * 1000, Qt::PreciseTimer, this, &Record::stop_recording);
|
||||
qtout << QString {"buffer size used is: %1"}.arg (source_.bufferSize ()) << endl;
|
||||
qtout << QString {"buffer size used is: %1"}.arg (source_.bufferSize ())
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||
<< Qt::endl
|
||||
#else
|
||||
<< endl
|
||||
#endif
|
||||
;
|
||||
}
|
||||
|
||||
Q_SLOT void notify ()
|
||||
{
|
||||
auto length = source_.elapsedUSecs ();
|
||||
qtout << QString {"%1 μs recorded\r"}.arg (length) << flush;
|
||||
qtout << QString {"%1 μs recorded\r"}.arg (length)
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||
<< Qt::flush
|
||||
#else
|
||||
<< flush
|
||||
#endif
|
||||
;
|
||||
if (length >= duration_ * 1000 * 1000) stop_recording ();
|
||||
}
|
||||
|
||||
@ -85,7 +103,13 @@ private:
|
||||
auto length = source_.elapsedUSecs ();
|
||||
source_.stop ();
|
||||
qtout << QString {"%1 μs recorded "}.arg (length) << '(' << source_.format ().framesForBytes (output_->size ()) << " frames recorded)\n";
|
||||
qtout << "stopped recording at " << QDateTime::currentDateTimeUtc ().toString ("hh:mm:ss.zzz UTC") << endl;
|
||||
qtout << "stopped recording at " << QDateTime::currentDateTimeUtc ().toString ("hh:mm:ss.zzz UTC")
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||
<< Qt::endl
|
||||
#else
|
||||
<< endl
|
||||
#endif
|
||||
;
|
||||
Q_EMIT done ();
|
||||
}
|
||||
|
||||
@ -134,15 +158,33 @@ public:
|
||||
private:
|
||||
Q_SLOT void start_playback ()
|
||||
{
|
||||
qtout << "started playback at " << QDateTime::currentDateTimeUtc ().toString ("hh:mm:ss.zzz UTC") << endl;
|
||||
qtout << "started playback at " << QDateTime::currentDateTimeUtc ().toString ("hh:mm:ss.zzz UTC")
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||
<< Qt::endl
|
||||
#else
|
||||
<< endl
|
||||
#endif
|
||||
;
|
||||
sink_.start (input_);
|
||||
qtout << QString {"buffer size used is: %1 (%2 frames)"}.arg (sink_.bufferSize ()).arg (sink_.format ().framesForBytes (sink_.bufferSize ())) << endl;
|
||||
qtout << QString {"buffer size used is: %1 (%2 frames)"}.arg (sink_.bufferSize ()).arg (sink_.format ().framesForBytes (sink_.bufferSize ()))
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||
<< Qt::endl
|
||||
#else
|
||||
<< endl
|
||||
#endif
|
||||
;
|
||||
}
|
||||
|
||||
Q_SLOT void notify ()
|
||||
{
|
||||
auto length = sink_.elapsedUSecs ();
|
||||
qtout << QString {"%1 μs rendered\r"}.arg (length) << flush;
|
||||
qtout << QString {"%1 μs rendered\r"}.arg (length) <<
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||
Qt::flush
|
||||
#else
|
||||
flush
|
||||
#endif
|
||||
;
|
||||
}
|
||||
|
||||
Q_SLOT void sink_state_changed (QAudio::State state)
|
||||
@ -175,7 +217,13 @@ private:
|
||||
auto length = sink_.elapsedUSecs ();
|
||||
sink_.stop ();
|
||||
qtout << QString {"%1 μs rendered "}.arg (length) << '(' << sink_.format ().framesForBytes (input_->size ()) << " frames rendered)\n";
|
||||
qtout << "stopped playback at " << QDateTime::currentDateTimeUtc ().toString ("hh:mm:ss.zzz UTC") << endl;
|
||||
qtout << "stopped playback at " << QDateTime::currentDateTimeUtc ().toString ("hh:mm:ss.zzz UTC")
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||
<< Qt::endl
|
||||
#else
|
||||
<< endl
|
||||
#endif
|
||||
;
|
||||
Q_EMIT done ();
|
||||
}
|
||||
|
||||
@ -258,7 +306,13 @@ int main(int argc, char *argv[])
|
||||
int n {0};
|
||||
for (auto const& device : input_devices)
|
||||
{
|
||||
qtout << ++n << " - [" << device.deviceName () << ']' << endl;
|
||||
qtout << ++n << " - [" << device.deviceName () << ']'
|
||||
#if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0)
|
||||
<< Qt::endl
|
||||
#else
|
||||
<< endl
|
||||
#endif
|
||||
;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -269,7 +323,13 @@ int main(int argc, char *argv[])
|
||||
int n {0};
|
||||
for (auto const& device : output_devices)
|
||||
{
|
||||
qtout << ++n << " - [" << device.deviceName () << ']' << endl;
|
||||
qtout << ++n << " - [" << device.deviceName () << ']'
|
||||
#if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0)
|
||||
<< Qt::endl
|
||||
#else
|
||||
<< endl
|
||||
#endif
|
||||
;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -352,7 +412,13 @@ int main(int argc, char *argv[])
|
||||
auto source = input_device ? input_devices[input_device - 1] : QAudioDeviceInfo::defaultInputDevice ();
|
||||
if (!source.isFormatSupported (audio_format))
|
||||
{
|
||||
qtout << "warning, requested format not supported, using nearest" << endl;
|
||||
qtout << "warning, requested format not supported, using nearest"
|
||||
#if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0)
|
||||
<< Qt::endl
|
||||
#else
|
||||
<< endl
|
||||
#endif
|
||||
;
|
||||
audio_format = source.nearestFormat (audio_format);
|
||||
}
|
||||
BWFFile output_file {audio_format, ofi.filePath ()};
|
||||
|
@ -887,7 +887,7 @@ message (STATUS "hamlib_LIBRARY_DIRS: ${hamlib_LIBRARY_DIRS}")
|
||||
#
|
||||
|
||||
# Widgets finds its own dependencies.
|
||||
find_package (Qt5 COMPONENTS Widgets Multimedia PrintSupport Sql LinguistTools REQUIRED)
|
||||
find_package (Qt5 COMPONENTS Widgets SerialPort Multimedia PrintSupport Sql LinguistTools REQUIRED)
|
||||
|
||||
if (WIN32)
|
||||
add_definitions (-DQT_NEEDS_QTMAIN)
|
||||
@ -1381,9 +1381,9 @@ set_target_properties (wsjtx PROPERTIES
|
||||
|
||||
target_include_directories (wsjtx PRIVATE ${FFTW3_INCLUDE_DIRS})
|
||||
if (APPLE)
|
||||
target_link_libraries (wsjtx wsjt_fort wsjt_cxx wsjt_qt wsjt_qtmm ${hamlib_LIBRARIES} ${FFTW3_LIBRARIES})
|
||||
target_link_libraries (wsjtx Qt5::SerialPort wsjt_fort wsjt_cxx wsjt_qt wsjt_qtmm ${hamlib_LIBRARIES} ${FFTW3_LIBRARIES})
|
||||
else ()
|
||||
target_link_libraries (wsjtx wsjt_fort_omp wsjt_cxx wsjt_qt wsjt_qtmm ${hamlib_LIBRARIES} ${FFTW3_LIBRARIES})
|
||||
target_link_libraries (wsjtx Qt5::SerialPort wsjt_fort_omp wsjt_cxx wsjt_qt wsjt_qtmm ${hamlib_LIBRARIES} ${FFTW3_LIBRARIES})
|
||||
if (OpenMP_C_FLAGS)
|
||||
set_target_properties (wsjtx PROPERTIES
|
||||
COMPILE_FLAGS "${OpenMP_C_FLAGS}"
|
||||
@ -1399,7 +1399,6 @@ else ()
|
||||
)
|
||||
endif ()
|
||||
endif ()
|
||||
qt5_use_modules (wsjtx SerialPort) # not sure why the interface link library syntax above doesn't work
|
||||
|
||||
# make a library for WSJT-X UDP servers
|
||||
# add_library (wsjtx_udp SHARED ${UDP_library_CXXSRCS})
|
||||
@ -1419,8 +1418,7 @@ set_target_properties (wsjtx_udp-static PROPERTIES
|
||||
OUTPUT_NAME wsjtx_udp
|
||||
)
|
||||
target_compile_definitions (wsjtx_udp-static PUBLIC UDP_STATIC_DEFINE)
|
||||
#qt5_use_modules (wsjtx_udp Network)
|
||||
qt5_use_modules (wsjtx_udp-static Network Gui)
|
||||
target_link_libraries (wsjtx_udp-static Qt5::Network Qt5::Gui)
|
||||
generate_export_header (wsjtx_udp-static BASE_NAME udp)
|
||||
|
||||
add_executable (udp_daemon UDPExamples/UDPDaemon.cpp UDPExamples/udp_daemon.rc ${WSJTX_ICON_FILE})
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include <QStringList>
|
||||
#include <QRegularExpression>
|
||||
#include <QDebug>
|
||||
#include "qt_helpers.hpp"
|
||||
|
||||
extern "C" {
|
||||
bool stdmsg_(char const * msg, fortran_charlen_t);
|
||||
@ -58,7 +59,7 @@ QStringList DecodedText::messageWords () const
|
||||
return words_re.match(t).capturedTexts();
|
||||
}
|
||||
// simple word split for free text messages
|
||||
auto words = message_.split (' ', QString::SkipEmptyParts);
|
||||
auto words = message_.split (' ', SkipEmptyParts);
|
||||
// add whole message as item 0 to mimic RE capture list
|
||||
words.prepend (message_);
|
||||
return words;
|
||||
@ -122,7 +123,7 @@ bool DecodedText::report(QString const& myBaseCall, QString const& dxBaseCall, /
|
||||
{
|
||||
if (message_.size () < 1) return false;
|
||||
|
||||
QStringList const& w = message_.split(" ",QString::SkipEmptyParts);
|
||||
QStringList const& w = message_.split(" ", Qt::SkipEmptyParts);
|
||||
if (w.size ()
|
||||
&& is_standard_ && (w[0] == myBaseCall
|
||||
|| w[0].endsWith ("/" + myBaseCall)
|
||||
|
@ -49,10 +49,12 @@ public:
|
||||
|
||||
void display (QUrl const& url, QString const& name_we)
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
|
||||
if (QNetworkAccessManager::Accessible != qnam_->networkAccessible ()) {
|
||||
// try and recover network access for QNAM
|
||||
qnam_->setNetworkAccessible (QNetworkAccessManager::Accessible);
|
||||
}
|
||||
#endif
|
||||
|
||||
// try and find a localized manual
|
||||
auto lang = QLocale::system ().name ();
|
||||
|
@ -2,6 +2,9 @@
|
||||
#include <limits>
|
||||
#include <qmath.h>
|
||||
#include <QDateTime>
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||
#include <QRandomGenerator>
|
||||
#endif
|
||||
#include <QDebug>
|
||||
#include "widgets/mainwindow.h" // TODO: G4WJS - break this dependency
|
||||
#include "Audio/soundout.h"
|
||||
@ -278,8 +281,13 @@ qint64 Modulator::readData (char * data, qint64 maxSize)
|
||||
|
||||
int j=m_ic/480;
|
||||
if(m_fSpread>0.0 and j!=m_j0) {
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||
float x1=QRandomGenerator::global ()->generateDouble ();
|
||||
float x2=QRandomGenerator::global ()->generateDouble ();
|
||||
#else
|
||||
float x1=(float)qrand()/RAND_MAX;
|
||||
float x2=(float)qrand()/RAND_MAX;
|
||||
#endif
|
||||
toneFrequency = m_toneFrequency0 + 0.5*m_fSpread*(x1+x2-1.0);
|
||||
m_dphi = m_twoPi * toneFrequency / m_frameRate;
|
||||
m_j0=j;
|
||||
|
@ -69,11 +69,13 @@ public:
|
||||
|
||||
void download (QUrl url)
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
|
||||
if (QNetworkAccessManager::Accessible != network_manager_->networkAccessible ())
|
||||
{
|
||||
// try and recover network access for QNAM
|
||||
network_manager_->setNetworkAccessible (QNetworkAccessManager::Accessible);
|
||||
}
|
||||
#endif
|
||||
|
||||
QNetworkRequest request {url};
|
||||
request.setRawHeader ("User-Agent", "WSJT LotW User Downloader");
|
||||
|
@ -423,6 +423,7 @@ MessageClient::MessageClient (QString const& id, QString const& version, QString
|
||||
: QObject {self}
|
||||
, m_ {id, version, revision, server_port, this}
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
|
||||
connect (&*m_, static_cast<void (impl::*) (impl::SocketError)> (&impl::error)
|
||||
, [this] (impl::SocketError e)
|
||||
{
|
||||
@ -441,6 +442,11 @@ MessageClient::MessageClient (QString const& id, QString const& version, QString
|
||||
Q_EMIT error (m_->errorString ());
|
||||
}
|
||||
});
|
||||
#else
|
||||
connect (&*m_, &impl::errorOccurred, [this] (impl::SocketError) {
|
||||
Q_EMIT error (m_->errorString ());
|
||||
});
|
||||
#endif
|
||||
set_server (server);
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,9 @@
|
||||
|
||||
#include <QHostInfo>
|
||||
#include <QTimer>
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||
#include <QRandomGenerator>
|
||||
#endif
|
||||
|
||||
#include "Network/MessageClient.hpp"
|
||||
|
||||
@ -43,7 +46,11 @@ PSK_Reporter::PSK_Reporter(MessageClient * message_client, QObject *parent) :
|
||||
"00960004"; // Report time
|
||||
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
|
||||
m_randomId_h = QString("%1").arg(qrand(),8,16,QChar('0'));
|
||||
#else
|
||||
m_randomId_h = QString("%1").arg(QRandomGenerator::global ()->generate (), 8, 16, QChar('0'));
|
||||
#endif
|
||||
|
||||
QHostInfo::lookupHost("report.pskreporter.info", this, SLOT(dnsLookupResult(QHostInfo)));
|
||||
|
||||
|
@ -208,10 +208,12 @@ QString WSPRNet::urlEncodeSpot(QHash<QString,QString> const& query)
|
||||
void WSPRNet::work()
|
||||
{
|
||||
if (!urlQueue.isEmpty()) {
|
||||
#if QT_VERSION < QT_VERSION_CHECK (5, 15, 0)
|
||||
if (QNetworkAccessManager::Accessible != networkManager->networkAccessible ()) {
|
||||
// try and recover network access for QNAM
|
||||
networkManager->setNetworkAccessible (QNetworkAccessManager::Accessible);
|
||||
}
|
||||
#endif
|
||||
QUrl url(urlQueue.dequeue());
|
||||
QNetworkRequest request(url);
|
||||
m_outstandingRequests << networkManager->get(request);
|
||||
|
@ -121,10 +121,12 @@ bool RemoteFile::sync (QUrl const& url, bool local, bool force)
|
||||
|
||||
void RemoteFile::download (QUrl url)
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
|
||||
if (QNetworkAccessManager::Accessible != network_manager_->networkAccessible ()) {
|
||||
// try and recover network access for QNAM
|
||||
network_manager_->setNetworkAccessible (QNetworkAccessManager::Accessible);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (url.isValid () && (!QSslSocket::supportsSsl () || http_only_))
|
||||
{
|
||||
|
@ -78,7 +78,12 @@ void TraceFile::impl::message_handler (QtMsgType type, QMessageLogContext const&
|
||||
Q_ASSERT_X (current_stream_, "TraceFile:message_handler", "no stream to write to");
|
||||
{
|
||||
QMutexLocker lock {&mutex_}; // thread safety - serialize writes to the trace file
|
||||
*current_stream_ << qFormatLogMessage (type, context, msg) << endl;
|
||||
*current_stream_ << qFormatLogMessage (type, context, msg) <<
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
|
||||
endl;
|
||||
#else
|
||||
Qt::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (QtFatalMsg == type)
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include <QDir>
|
||||
|
||||
#include "Network/NetworkServerLookup.hpp"
|
||||
#include "qt_helpers.hpp"
|
||||
|
||||
namespace
|
||||
{
|
||||
@ -167,7 +168,7 @@ int HRDTransceiver::do_start ()
|
||||
HRD_info << "Id: " << id << "\n";
|
||||
HRD_info << "Version: " << version << "\n";
|
||||
|
||||
auto radios = send_command ("get radios", false, false).trimmed ().split (',', QString::SkipEmptyParts);
|
||||
auto radios = send_command ("get radios", false, false).trimmed ().split (',', Qt::SkipEmptyParts);
|
||||
if (radios.isEmpty ())
|
||||
{
|
||||
TRACE_CAT ("HRDTransceiver", "no rig found");
|
||||
@ -178,7 +179,7 @@ int HRDTransceiver::do_start ()
|
||||
Q_FOREACH (auto const& radio, radios)
|
||||
{
|
||||
HRD_info << "\t" << radio << "\n";
|
||||
auto entries = radio.trimmed ().split (':', QString::SkipEmptyParts);
|
||||
auto entries = radio.trimmed ().split (':', Qt::SkipEmptyParts);
|
||||
radios_.push_back (std::forward_as_tuple (entries[0].toUInt (), entries[1]));
|
||||
}
|
||||
|
||||
@ -202,11 +203,11 @@ int HRDTransceiver::do_start ()
|
||||
HRD_info << "VFO count: " << vfo_count_ << "\n";
|
||||
TRACE_CAT ("HRDTransceiver", "vfo count:" << vfo_count_);
|
||||
|
||||
buttons_ = send_command ("get buttons").trimmed ().split (',', QString::SkipEmptyParts).replaceInStrings (" ", "~");
|
||||
buttons_ = send_command ("get buttons").trimmed ().split (',', Qt::SkipEmptyParts).replaceInStrings (" ", "~");
|
||||
TRACE_CAT ("HRDTransceiver", "HRD Buttons: " << buttons_);
|
||||
HRD_info << "Buttons: {" << buttons_.join (", ") << "}\n";
|
||||
|
||||
dropdown_names_ = send_command ("get dropdowns").trimmed ().split (',', QString::SkipEmptyParts);
|
||||
dropdown_names_ = send_command ("get dropdowns").trimmed ().split (',', Qt::SkipEmptyParts);
|
||||
TRACE_CAT ("HRDTransceiver", "Dropdowns:");
|
||||
HRD_info << "Dropdowns:\n";
|
||||
Q_FOREACH (auto const& dd, dropdown_names_)
|
||||
@ -217,12 +218,12 @@ int HRDTransceiver::do_start ()
|
||||
dropdowns_[dd] = selections;
|
||||
}
|
||||
|
||||
slider_names_ = send_command ("get sliders").trimmed ().split (',', QString::SkipEmptyParts).replaceInStrings (" ", "~");
|
||||
slider_names_ = send_command ("get sliders").trimmed ().split (',', Qt::SkipEmptyParts).replaceInStrings (" ", "~");
|
||||
TRACE_CAT ("HRDTransceiver", "Sliders:-");
|
||||
HRD_info << "Sliders:\n";
|
||||
Q_FOREACH (auto const& s, slider_names_)
|
||||
{
|
||||
auto range = send_command ("get slider-range " + current_radio_name + " " + s).trimmed ().split (',', QString::SkipEmptyParts);
|
||||
auto range = send_command ("get slider-range " + current_radio_name + " " + s).trimmed ().split (',', Qt::SkipEmptyParts);
|
||||
TRACE_CAT ("HRDTransceiver", "\t" << s << ": {" << range.join (", ") << "}");
|
||||
HRD_info << "\t" << s << ": {" << range.join (", ") << "}\n";
|
||||
sliders_[s] = range;
|
||||
@ -601,7 +602,7 @@ void HRDTransceiver::do_frequency (Frequency f, MODE m, bool /*no_ignore*/)
|
||||
auto fo_string = QString::number (f);
|
||||
if (vfo_count_ > 1 && reversed_)
|
||||
{
|
||||
auto frequencies = send_command ("get frequencies").trimmed ().split ('-', QString::SkipEmptyParts);
|
||||
auto frequencies = send_command ("get frequencies").trimmed ().split ('-', Qt::SkipEmptyParts);
|
||||
send_simple_command ("set frequencies-hz " + QString::number (frequencies[0].toUInt ()) + ' ' + fo_string);
|
||||
}
|
||||
else
|
||||
@ -687,14 +688,14 @@ void HRDTransceiver::do_tx_frequency (Frequency tx, MODE mode, bool /*no_ignore*
|
||||
{
|
||||
Q_ASSERT (vfo_count_ > 1);
|
||||
|
||||
auto frequencies = send_command ("get frequencies").trimmed ().split ('-', QString::SkipEmptyParts);
|
||||
auto frequencies = send_command ("get frequencies").trimmed ().split ('-', Qt::SkipEmptyParts);
|
||||
send_simple_command ("set frequencies-hz " + fo_string + ' ' + QString::number (frequencies[1].toUInt ()));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (vfo_count_ > 1)
|
||||
{
|
||||
auto frequencies = send_command ("get frequencies").trimmed ().split ('-', QString::SkipEmptyParts);
|
||||
auto frequencies = send_command ("get frequencies").trimmed ().split ('-', Qt::SkipEmptyParts);
|
||||
send_simple_command ("set frequencies-hz " + QString::number (frequencies[0].toUInt ()) + ' ' + fo_string);
|
||||
}
|
||||
else if ((vfo_B_button_ >= 0 && vfo_A_button_ >= 0) || vfo_toggle_button_ >= 0)
|
||||
@ -986,7 +987,7 @@ void HRDTransceiver::do_poll ()
|
||||
|
||||
if (vfo_count_ > 1)
|
||||
{
|
||||
auto frequencies = send_command ("get frequencies", quiet).trimmed ().split ('-', QString::SkipEmptyParts);
|
||||
auto frequencies = send_command ("get frequencies", quiet).trimmed ().split ('-', Qt::SkipEmptyParts);
|
||||
update_rx_frequency (frequencies[reversed_ ? 1 : 0].toUInt ());
|
||||
update_other_frequency (frequencies[reversed_ ? 0 : 1].toUInt ());
|
||||
}
|
||||
|
@ -39,11 +39,18 @@ public:
|
||||
Radio::register_types ();
|
||||
|
||||
connect (this, &QIODevice::readyRead, this, &MessageServer::impl::pending_datagrams);
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
|
||||
connect (this, static_cast<void (impl::*) (SocketError)> (&impl::error)
|
||||
, [this] (SocketError /* e */)
|
||||
{
|
||||
Q_EMIT self_->error (errorString ());
|
||||
});
|
||||
#else
|
||||
connect (this, &impl::errorOccurred, [this] (SocketError /* e */)
|
||||
{
|
||||
Q_EMIT self_->error (errorString ());
|
||||
});
|
||||
#endif
|
||||
connect (clock_, &QTimer::timeout, this, &impl::tick);
|
||||
clock_->start (NetworkMessage::pulse * 1000);
|
||||
}
|
||||
|
@ -242,7 +242,13 @@ namespace
|
||||
QTextStream stream {&file};
|
||||
Q_FOREACH (auto colour, colours_)
|
||||
{
|
||||
stream << colour.red () << ';' << colour.green () << ';' << colour.blue () << endl;
|
||||
stream << colour.red () << ';' << colour.green () << ';' << colour.blue () <<
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
|
||||
endl
|
||||
#else
|
||||
Qt::endl
|
||||
#endif
|
||||
;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1,5 +1,9 @@
|
||||
#include "getfile.h"
|
||||
#include <QDir>
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||
#include <QRandomGenerator>
|
||||
#include <random>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
@ -171,6 +175,10 @@ void savewav(QString fname, int ntrperiod)
|
||||
/* Generate gaussian random float with mean=0 and std_dev=1 */
|
||||
float gran()
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||
static std::normal_distribution<float> d;
|
||||
return d (*QRandomGenerator::global ());
|
||||
#else
|
||||
float fac,rsq,v1,v2;
|
||||
static float gset;
|
||||
static int iset;
|
||||
@ -192,6 +200,7 @@ float gran()
|
||||
gset = v1*fac;
|
||||
iset++;
|
||||
return v2*fac;
|
||||
#endif
|
||||
}
|
||||
|
||||
int ptt(int nport, int ntx, int* iptt, int* nopen)
|
||||
|
@ -84,12 +84,12 @@ int killbyname(const char *szToTerminate)
|
||||
if(hInstLib == NULL) return 605;
|
||||
|
||||
// Get procedure addresses.
|
||||
lpfEnumProcesses = (BOOL(WINAPI *)(DWORD *,DWORD,DWORD*))
|
||||
lpfEnumProcesses = (BOOL(WINAPI *)(DWORD *,DWORD,DWORD*))(void (*)())
|
||||
GetProcAddress( hInstLib, "EnumProcesses" ) ;
|
||||
lpfEnumProcessModules = (BOOL(WINAPI *)(HANDLE, HMODULE *,
|
||||
DWORD, LPDWORD)) GetProcAddress( hInstLib, "EnumProcessModules" ) ;
|
||||
DWORD, LPDWORD))(void (*)()) GetProcAddress( hInstLib, "EnumProcessModules" ) ;
|
||||
lpfGetModuleBaseName =(DWORD (WINAPI *)(HANDLE, HMODULE, LPTSTR,
|
||||
DWORD )) GetProcAddress( hInstLib, "GetModuleBaseNameA" ) ;
|
||||
DWORD ))(void (*)()) GetProcAddress( hInstLib, "GetModuleBaseNameA" ) ;
|
||||
|
||||
if(lpfEnumProcesses == NULL || lpfEnumProcessModules == NULL ||
|
||||
lpfGetModuleBaseName == NULL) {
|
||||
@ -164,20 +164,20 @@ int killbyname(const char *szToTerminate)
|
||||
// which does not have the Toolhelp32
|
||||
// functions in the Kernel 32.
|
||||
lpfCreateToolhelp32Snapshot=
|
||||
(HANDLE(WINAPI *)(DWORD,DWORD))
|
||||
(HANDLE(WINAPI *)(DWORD,DWORD))(void (*)())
|
||||
GetProcAddress( hInstLib,
|
||||
"CreateToolhelp32Snapshot" ) ;
|
||||
lpfProcess32First=
|
||||
(BOOL(WINAPI *)(HANDLE,LPPROCESSENTRY32))
|
||||
(BOOL(WINAPI *)(HANDLE,LPPROCESSENTRY32))(void (*)())
|
||||
GetProcAddress( hInstLib, "Process32First" ) ;
|
||||
lpfProcess32Next=
|
||||
(BOOL(WINAPI *)(HANDLE,LPPROCESSENTRY32))
|
||||
(BOOL(WINAPI *)(HANDLE,LPPROCESSENTRY32))(void (*)())
|
||||
GetProcAddress( hInstLib, "Process32Next" ) ;
|
||||
lpfModule32First=
|
||||
(BOOL(WINAPI *)(HANDLE,LPMODULEENTRY32))
|
||||
(BOOL(WINAPI *)(HANDLE,LPMODULEENTRY32))(void (*)())
|
||||
GetProcAddress( hInstLib, "Module32First" ) ;
|
||||
lpfModule32Next=
|
||||
(BOOL(WINAPI *)(HANDLE,LPMODULEENTRY32))
|
||||
(BOOL(WINAPI *)(HANDLE,LPMODULEENTRY32))(void (*)())
|
||||
GetProcAddress( hInstLib, "Module32Next" ) ;
|
||||
if( lpfProcess32Next == NULL ||
|
||||
lpfProcess32First == NULL ||
|
||||
|
@ -442,9 +442,21 @@ bool WorkedBefore::add (QString const& call
|
||||
QTextStream out {&file};
|
||||
if (!file.size ())
|
||||
{
|
||||
out << "WSJT-X ADIF Export<eoh>" << endl; // new file
|
||||
out << "WSJT-X ADIF Export<eh>" << // new file
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
|
||||
endl
|
||||
#else
|
||||
Qt::endl
|
||||
#endif
|
||||
;
|
||||
}
|
||||
out << ADIF_record << " <eor>" << endl;
|
||||
out << ADIF_record << " <eor>" <<
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
|
||||
endl
|
||||
#else
|
||||
Qt::endl
|
||||
#endif
|
||||
;
|
||||
}
|
||||
m_->worked_.emplace (call.toUpper (), grid.left (4).toUpper (), band.toUpper (), mode.toUpper ()
|
||||
, entity.entity_name, entity.continent, entity.CQ_zone, entity.ITU_zone);
|
||||
|
@ -103,7 +103,13 @@ QByteArray LogBook::QSOToADIF (QString const& hisCall, QString const& hisGrid, Q
|
||||
if(operator_call!="") t+=" <operator:" + QString::number(operator_call.size()) + ">" + operator_call;
|
||||
if (xSent.size ())
|
||||
{
|
||||
auto words = xSent.split (' ', QString::SkipEmptyParts);
|
||||
auto words = xSent.split (' '
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
|
||||
, QString::SkipEmptyParts
|
||||
#else
|
||||
, Qt::SkipEmptyParts
|
||||
#endif
|
||||
);
|
||||
if (words.size () > 1)
|
||||
{
|
||||
if (words.back ().toUInt ())
|
||||
@ -126,7 +132,13 @@ QByteArray LogBook::QSOToADIF (QString const& hisCall, QString const& hisGrid, Q
|
||||
}
|
||||
}
|
||||
if (xRcvd.size ()) {
|
||||
auto words = xRcvd.split (' ', QString::SkipEmptyParts);
|
||||
auto words = xRcvd.split (' '
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
|
||||
, QString::SkipEmptyParts
|
||||
#else
|
||||
, Qt::SkipEmptyParts
|
||||
#endif
|
||||
);
|
||||
if (words.size () == 2)
|
||||
{
|
||||
if (words.at (1).toUInt ())
|
||||
|
2
main.cpp
2
main.cpp
@ -49,6 +49,7 @@ extern "C" {
|
||||
|
||||
namespace
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK (5, 15, 0)
|
||||
struct RNGSetup
|
||||
{
|
||||
RNGSetup ()
|
||||
@ -58,6 +59,7 @@ namespace
|
||||
qsrand (seed); // this is good for rand() as well
|
||||
}
|
||||
} seeding;
|
||||
#endif
|
||||
|
||||
// We can't use the GUI after QApplication::exit() is called so
|
||||
// uncaught exceptions can get lost on Windows systems where there
|
||||
|
@ -274,5 +274,9 @@ void FoxLog::export_qsos (QTextStream& out) const
|
||||
<< ADIF_field {"operator", m_->configuration_->opCall ()}
|
||||
<< "<eor>";
|
||||
}
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
|
||||
out << endl;
|
||||
#else
|
||||
out << Qt::endl;
|
||||
#endif
|
||||
}
|
||||
|
@ -4766,7 +4766,7 @@ Qt::Alignment QCPLayoutInset::insetAlignment(int index) const
|
||||
else
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO << "Invalid element index:" << index;
|
||||
return 0;
|
||||
return Qt::Alignment {};
|
||||
}
|
||||
}
|
||||
|
||||
@ -6013,11 +6013,13 @@ double QCPAxisTickerDateTime::dateTimeToKey(const QDateTime dateTime)
|
||||
*/
|
||||
double QCPAxisTickerDateTime::dateTimeToKey(const QDate date)
|
||||
{
|
||||
# if QT_VERSION < QT_VERSION_CHECK(4, 7, 0)
|
||||
#if QT_VERSION < QT_VERSION_CHECK(4, 7, 0)
|
||||
return QDateTime(date).toTime_t();
|
||||
# else
|
||||
#elif QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
|
||||
return QDateTime(date).toMSecsSinceEpoch()/1000.0;
|
||||
# endif
|
||||
#else
|
||||
return date.startOfDay().toMSecsSinceEpoch()/1000.0;
|
||||
#endif
|
||||
}
|
||||
/* end of 'src/axis/axistickerdatetime.cpp' */
|
||||
|
||||
@ -6499,7 +6501,11 @@ void QCPAxisTickerText::addTick(double position, QString label)
|
||||
*/
|
||||
void QCPAxisTickerText::addTicks(const QMap<double, QString> &ticks)
|
||||
{
|
||||
# if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
|
||||
mTicks.unite(ticks);
|
||||
#else
|
||||
mTicks.insert(ticks);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*! \overload
|
||||
@ -12598,9 +12604,11 @@ QCustomPlot::QCustomPlot(QWidget *parent) :
|
||||
mBufferDevicePixelRatio(1.0), // will be adapted to primary screen below
|
||||
mPlotLayout(0),
|
||||
mAutoAddPlottableToLegend(true),
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
|
||||
mAntialiasedElements(QCP::aeNone),
|
||||
mNotAntialiasedElements(QCP::aeNone),
|
||||
mInteractions(0),
|
||||
#endif
|
||||
mSelectionTolerance(8),
|
||||
mNoAntialiasingOnDrag(false),
|
||||
mBackgroundBrush(Qt::white, Qt::SolidPattern),
|
||||
@ -12617,7 +12625,9 @@ QCustomPlot::QCustomPlot(QWidget *parent) :
|
||||
mReplotting(false),
|
||||
mReplotQueued(false),
|
||||
mOpenGlMultisamples(16),
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
|
||||
mOpenGlAntialiasedElementsBackup(QCP::aeNone),
|
||||
#endif
|
||||
mOpenGlCacheLabelsBackup(true)
|
||||
{
|
||||
setAttribute(Qt::WA_NoMousePropagation);
|
||||
@ -14668,7 +14678,15 @@ void QCustomPlot::wheelEvent(QWheelEvent *event)
|
||||
{
|
||||
emit mouseWheel(event);
|
||||
// forward event to layerable under cursor:
|
||||
QList<QCPLayerable*> candidates = layerableListAt(event->pos(), false);
|
||||
QList<QCPLayerable*> candidates = layerableListAt(
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
|
||||
event->pos()
|
||||
#elif QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
|
||||
event->posF()
|
||||
#else
|
||||
event->position()
|
||||
#endif
|
||||
, false);
|
||||
for (int i=0; i<candidates.size(); ++i)
|
||||
{
|
||||
event->accept(); // default impl of QCPLayerable's mouse events ignore the event, in that case propagate to next candidate in list
|
||||
@ -15002,7 +15020,7 @@ void QCustomPlot::processRectSelection(QRect rect, QMouseEvent *event)
|
||||
|
||||
if (mInteractions.testFlag(QCP::iSelectPlottables))
|
||||
{
|
||||
QMap<int, QPair<QCPAbstractPlottable*, QCPDataSelection> > potentialSelections; // map key is number of selected data points, so we have selections sorted by size
|
||||
QMultiMap<int, QPair<QCPAbstractPlottable*, QCPDataSelection> > potentialSelections; // map key is number of selected data points, so we have selections sorted by size
|
||||
QRectF rectF(rect.normalized());
|
||||
if (QCPAxisRect *affectedAxisRect = axisRectAt(rectF.topLeft()))
|
||||
{
|
||||
@ -15013,7 +15031,7 @@ void QCustomPlot::processRectSelection(QRect rect, QMouseEvent *event)
|
||||
{
|
||||
QCPDataSelection dataSel = plottableInterface->selectTestRect(rectF, true);
|
||||
if (!dataSel.isEmpty())
|
||||
potentialSelections.insertMulti(dataSel.dataPointCount(), QPair<QCPAbstractPlottable*, QCPDataSelection>(plottable, dataSel));
|
||||
potentialSelections.insert(dataSel.dataPointCount(), QPair<QCPAbstractPlottable*, QCPDataSelection>(plottable, dataSel));
|
||||
}
|
||||
}
|
||||
|
||||
@ -15022,7 +15040,7 @@ void QCustomPlot::processRectSelection(QRect rect, QMouseEvent *event)
|
||||
// only leave plottable with most selected points in map, since we will only select a single plottable:
|
||||
if (!potentialSelections.isEmpty())
|
||||
{
|
||||
QMap<int, QPair<QCPAbstractPlottable*, QCPDataSelection> >::iterator it = potentialSelections.begin();
|
||||
QMultiMap<int, QPair<QCPAbstractPlottable*, QCPDataSelection> >::iterator it = potentialSelections.begin();
|
||||
while (it != potentialSelections.end()-1) // erase all except last element
|
||||
it = potentialSelections.erase(it);
|
||||
}
|
||||
@ -15048,7 +15066,7 @@ void QCustomPlot::processRectSelection(QRect rect, QMouseEvent *event)
|
||||
}
|
||||
|
||||
// go through selections in reverse (largest selection first) and emit select events:
|
||||
QMap<int, QPair<QCPAbstractPlottable*, QCPDataSelection> >::const_iterator it = potentialSelections.constEnd();
|
||||
QMultiMap<int, QPair<QCPAbstractPlottable*, QCPDataSelection> >::const_iterator it = potentialSelections.constEnd();
|
||||
while (it != potentialSelections.constBegin())
|
||||
{
|
||||
--it;
|
||||
@ -17619,14 +17637,24 @@ void QCPAxisRect::wheelEvent(QWheelEvent *event)
|
||||
if (mRangeZoom != 0)
|
||||
{
|
||||
double factor;
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
|
||||
double wheelSteps = event->delta()/120.0; // a single step delta is +/-120 usually
|
||||
#else
|
||||
double wheelSteps = event->angleDelta().y()/120.0; // a single step delta is +/-120 usually
|
||||
#endif
|
||||
if (mRangeZoom.testFlag(Qt::Horizontal))
|
||||
{
|
||||
factor = qPow(mRangeZoomFactorHorz, wheelSteps);
|
||||
for (int i=0; i<mRangeZoomHorzAxis.size(); ++i)
|
||||
{
|
||||
if (!mRangeZoomHorzAxis.at(i).isNull())
|
||||
mRangeZoomHorzAxis.at(i)->scaleRange(factor, mRangeZoomHorzAxis.at(i)->pixelToCoord(event->pos().x()));
|
||||
mRangeZoomHorzAxis.at(i)->scaleRange(factor, mRangeZoomHorzAxis.at(i)->pixelToCoord(
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
|
||||
event->posF().x()
|
||||
#else
|
||||
event->position().x()
|
||||
#endif
|
||||
));
|
||||
}
|
||||
}
|
||||
if (mRangeZoom.testFlag(Qt::Vertical))
|
||||
@ -17635,7 +17663,13 @@ void QCPAxisRect::wheelEvent(QWheelEvent *event)
|
||||
for (int i=0; i<mRangeZoomVertAxis.size(); ++i)
|
||||
{
|
||||
if (!mRangeZoomVertAxis.at(i).isNull())
|
||||
mRangeZoomVertAxis.at(i)->scaleRange(factor, mRangeZoomVertAxis.at(i)->pixelToCoord(event->pos().y()));
|
||||
mRangeZoomVertAxis.at(i)->scaleRange(factor, mRangeZoomVertAxis.at(i)->pixelToCoord(
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
|
||||
event->posF().y()
|
||||
#else
|
||||
event->position().y()
|
||||
#endif
|
||||
));
|
||||
}
|
||||
}
|
||||
mParentPlot->replot();
|
||||
@ -19262,7 +19296,7 @@ void QCPColorScale::setRangeDrag(bool enabled)
|
||||
if (enabled)
|
||||
mAxisRect.data()->setRangeDrag(QCPAxis::orientation(mType));
|
||||
else
|
||||
mAxisRect.data()->setRangeDrag(0);
|
||||
mAxisRect.data()->setRangeDrag(Qt::Orientations());
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -19282,7 +19316,7 @@ void QCPColorScale::setRangeZoom(bool enabled)
|
||||
if (enabled)
|
||||
mAxisRect.data()->setRangeZoom(QCPAxis::orientation(mType));
|
||||
else
|
||||
mAxisRect.data()->setRangeZoom(0);
|
||||
mAxisRect.data()->setRangeZoom(Qt::Orientations());
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -51,6 +51,12 @@
|
||||
return QString {mo.enumerator (mo.indexOfEnumerator (#ENUM)).valueToKey (static_cast<int> (m))}; \
|
||||
}
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0)
|
||||
Qt::SplitBehaviorFlags const SkipEmptyParts = Qt::SkipEmptyParts;
|
||||
#else
|
||||
QString::SplitBehavior const SkipEmptyParts = QString::SkipEmptyParts;
|
||||
#endif
|
||||
|
||||
inline
|
||||
void throw_qstring (QString const& qs)
|
||||
{
|
||||
|
@ -99,7 +99,13 @@ void ExportCabrillo::save_log ()
|
||||
<< "ADDRESS: " << ui->addr_1_line_edit->text() << '\n'
|
||||
<< "ADDRESS: " << ui->addr_2_line_edit->text() << '\n';
|
||||
if (log_) log_->export_qsos (out);
|
||||
out << "END-OF-LOG:" << endl;
|
||||
out << "END-OF-LOG:"
|
||||
#if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0)
|
||||
<< Qt::endl
|
||||
#else
|
||||
<< endl
|
||||
#endif
|
||||
;
|
||||
return;
|
||||
} else {
|
||||
auto const& message = tr ("Cannot open \"%1\" for writing: %2")
|
||||
|
@ -131,7 +131,11 @@ auto Astro::astroUpdate(QDateTime const& t, QString const& mygrid, QString const
|
||||
QTextStream out {&message};
|
||||
out << " " << date << "\n"
|
||||
"UTC: " << utc << "\n"
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
|
||||
<< Qt::fixed
|
||||
#else
|
||||
<< fixed
|
||||
#endif
|
||||
<< qSetFieldWidth (6)
|
||||
<< qSetRealNumberPrecision (1)
|
||||
<< "Az: " << azmoon << "\n"
|
||||
|
@ -142,8 +142,20 @@ void LogQSO::accept()
|
||||
}
|
||||
|
||||
if ((special_op == SpOp::RTTY and xsent!="" and xrcvd!="")) {
|
||||
if(rptSent=="" or !xsent.contains(rptSent+" ")) rptSent=xsent.split(" ",QString::SkipEmptyParts).at(0);
|
||||
if(rptRcvd=="" or !xrcvd.contains(rptRcvd+" ")) rptRcvd=xrcvd.split(" ",QString::SkipEmptyParts).at(0);
|
||||
if(rptSent=="" or !xsent.contains(rptSent+" ")) rptSent=xsent.split(" "
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
|
||||
, QString::SkipEmptyParts
|
||||
#else
|
||||
, Qt::SkipEmptyParts
|
||||
#endif
|
||||
).at(0);
|
||||
if(rptRcvd=="" or !xrcvd.contains(rptRcvd+" ")) rptRcvd=xrcvd.split(" "
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
|
||||
, QString::SkipEmptyParts
|
||||
#else
|
||||
, Qt::SkipEmptyParts
|
||||
#endif
|
||||
).at(0);
|
||||
}
|
||||
|
||||
// validate
|
||||
@ -181,7 +193,13 @@ void LogQSO::accept()
|
||||
"," + rptSent + "," + rptRcvd + "," + m_txPower +
|
||||
"," + m_comments + "," + name;
|
||||
QTextStream out(&f);
|
||||
out << logEntry << endl;
|
||||
out << logEntry <<
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
|
||||
endl
|
||||
#else
|
||||
Qt::endl
|
||||
#endif
|
||||
;
|
||||
f.close();
|
||||
}
|
||||
|
||||
|
@ -39,6 +39,9 @@
|
||||
#include <QUdpSocket>
|
||||
#include <QAbstractItemView>
|
||||
#include <QInputDialog>
|
||||
#if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0)
|
||||
#include <QRandomGenerator>
|
||||
#endif
|
||||
|
||||
#include "revision_utils.hpp"
|
||||
#include "qt_helpers.hpp"
|
||||
@ -84,7 +87,6 @@
|
||||
#include "ui_mainwindow.h"
|
||||
#include "moc_mainwindow.cpp"
|
||||
|
||||
|
||||
extern "C" {
|
||||
//----------------------------------------------------- C and Fortran routines
|
||||
void symspec_(struct dec_data *, int* k, int* ntrperiod, int* nsps, int* ingain,
|
||||
@ -654,16 +656,17 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
|
||||
subProcessError (&proc_jt9, error);
|
||||
});
|
||||
#else
|
||||
connect(&proc_jt9, static_cast<void (QProcess::*) (QProcess::ProcessError)> (&QProcess::errorOccurred),
|
||||
[this] (QProcess::ProcessError error) {
|
||||
subProcessError (&proc_jt9, error);
|
||||
});
|
||||
connect(&proc_jt9, &QProcess::errorOccurred, [this] (QProcess::ProcessError error) {
|
||||
subProcessError (&proc_jt9, error);
|
||||
});
|
||||
#endif
|
||||
connect(&proc_jt9, static_cast<void (QProcess::*) (int, QProcess::ExitStatus)> (&QProcess::finished),
|
||||
[this] (int exitCode, QProcess::ExitStatus status) {
|
||||
subProcessFailed (&proc_jt9, exitCode, status);
|
||||
});
|
||||
|
||||
connect(&p1, &QProcess::started, [this] () {
|
||||
showStatusMessage (QString {"Started: %1 \"%2\""}.arg (p1.program ()).arg (p1.arguments ().join (QLatin1String {"\" \""})));
|
||||
});
|
||||
connect(&p1, &QProcess::readyReadStandardOutput, this, &MainWindow::p1ReadFromStdout);
|
||||
#if QT_VERSION < QT_VERSION_CHECK (5, 6, 0)
|
||||
connect(&p1, static_cast<void (QProcess::*) (QProcess::ProcessError)> (&QProcess::error),
|
||||
@ -671,10 +674,9 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
|
||||
subProcessError (&p1, error);
|
||||
});
|
||||
#else
|
||||
connect(&p1, static_cast<void (QProcess::*) (QProcess::ProcessError)> (&QProcess::errorOccurred),
|
||||
[this] (QProcess::ProcessError error) {
|
||||
subProcessError (&p1, error);
|
||||
});
|
||||
connect(&p1, &QProcess::errorOccurred, [this] (QProcess::ProcessError error) {
|
||||
subProcessError (&p1, error);
|
||||
});
|
||||
#endif
|
||||
connect(&p1, static_cast<void (QProcess::*) (int, QProcess::ExitStatus)> (&QProcess::finished),
|
||||
[this] (int exitCode, QProcess::ExitStatus status) {
|
||||
@ -687,11 +689,13 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
|
||||
subProcessError (&p3, error);
|
||||
});
|
||||
#else
|
||||
connect(&p3, static_cast<void (QProcess::*) (QProcess::ProcessError)> (&QProcess::errorOccurred),
|
||||
[this] (QProcess::ProcessError error) {
|
||||
subProcessError (&p3, error);
|
||||
});
|
||||
connect(&p3, &QProcess::errorOccurred, [this] (QProcess::ProcessError error) {
|
||||
subProcessError (&p3, error);
|
||||
});
|
||||
#endif
|
||||
connect(&p3, &QProcess::started, [this] () {
|
||||
showStatusMessage (QString {"Started: %1 \"%2\""}.arg (p3.program ()).arg (p3.arguments ().join (QLatin1String {"\" \""})));
|
||||
});
|
||||
connect(&p3, static_cast<void (QProcess::*) (int, QProcess::ExitStatus)> (&QProcess::finished),
|
||||
[this] (int exitCode, QProcess::ExitStatus status) {
|
||||
subProcessFailed (&p3, exitCode, status);
|
||||
@ -1400,7 +1404,13 @@ void MainWindow::dataSink(qint64 frames)
|
||||
QFile f {m_config.writeable_data_dir ().absoluteFilePath ("fmt.all")};
|
||||
if (f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append)) {
|
||||
QTextStream out(&f);
|
||||
out << t << endl;
|
||||
out << t
|
||||
#if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0)
|
||||
<< Qt::endl
|
||||
#else
|
||||
<< endl
|
||||
#endif
|
||||
;
|
||||
f.close();
|
||||
} else {
|
||||
MessageBox::warning_message (this, tr ("File Open Error")
|
||||
@ -1507,36 +1517,39 @@ void MainWindow::dataSink(qint64 frames)
|
||||
}
|
||||
|
||||
if(m_mode.startsWith ("WSPR")) {
|
||||
QString t2,cmnd,depth_string;
|
||||
double f0m1500=m_dialFreqRxWSPR/1000000.0; // + 0.000001*(m_BFO - 1500);
|
||||
t2 = t2.asprintf(" -f %.6f ",f0m1500);
|
||||
if((m_ndepth&7)==1) depth_string=" -qB "; //2 pass w subtract, no Block detection, no shift jittering
|
||||
if((m_ndepth&7)==2) depth_string=" -C 500 -o 4 "; //3 pass, subtract, Block detection, OSD
|
||||
if((m_ndepth&7)==3) depth_string=" -C 500 -o 4 -d "; //3 pass, subtract, Block detect, OSD, more candidates
|
||||
QString degrade;
|
||||
degrade = degrade.asprintf("-d %4.1f ",m_config.degrade());
|
||||
|
||||
QStringList t2;
|
||||
QStringList depth_args;
|
||||
t2 << "-f" << QString {"%1"}.arg (m_dialFreqRxWSPR / 1000000.0, 0, 'f', 6);
|
||||
if((m_ndepth&7)==1) depth_args << "-qB"; //2 pass w subtract, no Block detection, no shift jittering
|
||||
if((m_ndepth&7)==2) depth_args << "-C" << "500" << "-o" << "4"; //3 pass, subtract, Block detection, OSD
|
||||
if((m_ndepth&7)==3) depth_args << "-C" << "500" << "-o" << "4" << "-d"; //3 pass, subtract, Block detect, OSD, more candidates
|
||||
QStringList degrade;
|
||||
degrade << "-d" << QString {"%1"}.arg (m_config.degrade(), 4, 'f', 1);
|
||||
m_cmndP1.clear ();
|
||||
if(m_diskData) {
|
||||
cmnd='"' + m_appDir + '"' + "/wsprd " + depth_string + " -a \"" +
|
||||
QDir::toNativeSeparators(m_config.writeable_data_dir ().absolutePath()) + "\" \"" + m_path + "\"";
|
||||
m_cmndP1 << depth_args << "-a"
|
||||
<< QDir::toNativeSeparators (m_config.writeable_data_dir ().absolutePath()) << m_path;
|
||||
} else {
|
||||
if(m_mode=="WSPR-LF") {
|
||||
// cmnd='"' + m_appDir + '"' + "/wspr_fsk8d " + degrade + t2 +" -a \"" +
|
||||
// QDir::toNativeSeparators(m_config.writeable_data_dir ().absolutePath()) + "\" " +
|
||||
// '"' + m_fnameWE + ".wav\"";
|
||||
} else {
|
||||
cmnd='"' + m_appDir + '"' + "/wsprd " + depth_string + " -a \"" +
|
||||
QDir::toNativeSeparators(m_config.writeable_data_dir ().absolutePath()) + "\" " +
|
||||
t2 + '"' + m_fnameWE + ".wav\"";
|
||||
}
|
||||
// if(m_mode=="WSPR-LF")
|
||||
// {
|
||||
// m_cmndP1 << degrade << t2 << "-a"
|
||||
// << QDir::toNativeSeparators (m_config.writeable_data_dir ().absolutePath())
|
||||
// << m_fnameWE + ".wav";
|
||||
// }
|
||||
// else
|
||||
{
|
||||
m_cmndP1 << depth_args << "-a"
|
||||
<< QDir::toNativeSeparators (m_config.writeable_data_dir ().absolutePath())
|
||||
<< t2 << m_fnameWE + ".wav";
|
||||
}
|
||||
}
|
||||
QString t3=cmnd;
|
||||
int i1=cmnd.indexOf("/wsprd ");
|
||||
cmnd=t3.mid(0,i1+7) + t3.mid(i1+7);
|
||||
// QString t3=cmnd;
|
||||
// int i1=cmnd.indexOf("/wsprd ");
|
||||
// cmnd=t3.mid(0,i1+7) + t3.mid(i1+7);
|
||||
|
||||
// if(m_mode=="WSPR-LF") cmnd=cmnd.replace("/wsprd ","/wspr_fsk8d "+degrade+t2);
|
||||
if (ui) ui->DecodeButton->setChecked (true);
|
||||
m_cmndP1=QDir::toNativeSeparators(cmnd);
|
||||
// m_cmndP1=QDir::toNativeSeparators(cmnd);
|
||||
p1Timer.start(1000);
|
||||
m_decoderBusy = true;
|
||||
statusUpdate ();
|
||||
@ -1547,7 +1560,14 @@ void MainWindow::dataSink(qint64 frames)
|
||||
|
||||
void MainWindow::startP1()
|
||||
{
|
||||
p1.start(m_cmndP1);
|
||||
// if (m_mode=="WSPR-LF")
|
||||
// {
|
||||
// p1.start (QDir::toNativeSeparators (QDir {QApplication::applicationDirPath ()}.absoluteFilePath ("wspr_fsk8d")), m_cmndP1);
|
||||
// }
|
||||
// else
|
||||
{
|
||||
p1.start (QDir::toNativeSeparators (QDir {QApplication::applicationDirPath ()}.absoluteFilePath ("wsprd")), m_cmndP1);
|
||||
}
|
||||
}
|
||||
|
||||
QString MainWindow::save_wave_file (QString const& name, short const * data, int samples,
|
||||
@ -2184,7 +2204,13 @@ void MainWindow::statusChanged()
|
||||
if (!tmpGrid.size ()) tmpGrid="n/a"; // Not Available
|
||||
out << qSetRealNumberPrecision (12) << (m_freqNominal / 1.e6)
|
||||
<< ";" << m_mode << ";" << m_hisCall << ";"
|
||||
<< ui->rptSpinBox->value() << ";" << m_modeTx << ";" << tmpGrid << endl;
|
||||
<< ui->rptSpinBox->value() << ";" << m_modeTx << ";" << tmpGrid
|
||||
#if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0)
|
||||
<< Qt::endl
|
||||
#else
|
||||
<< endl
|
||||
#endif
|
||||
;
|
||||
f.close();
|
||||
} else {
|
||||
if (m_splash && m_splash->isVisible ()) m_splash->hide ();
|
||||
@ -2851,7 +2877,13 @@ void MainWindow::decode() //decode()
|
||||
if( m_dateTimeLastTX.isValid () ) {
|
||||
qint64 isecs_since_tx = m_dateTimeLastTX.secsTo(now);
|
||||
dec_data.params.lapcqonly= (isecs_since_tx > 300);
|
||||
// QTextStream(stdout) << "last tx " << isecs_since_tx << endl;
|
||||
// QTextStream(stdout) << "last tx " << isecs_since_tx
|
||||
// #if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0)
|
||||
// << Qt::endl
|
||||
// #else
|
||||
// << endl
|
||||
// #endif
|
||||
// ;
|
||||
} else {
|
||||
m_dateTimeLastTX = now.addSecs(-900);
|
||||
dec_data.params.lapcqonly=true;
|
||||
@ -3240,7 +3272,7 @@ void MainWindow::readFromStdout() //readFromStdout
|
||||
int audioFreq=decodedtext.frequencyOffset();
|
||||
if(m_mode=="FT8" or m_mode=="FT4") {
|
||||
auto const& parts = decodedtext.string().remove("<").remove(">")
|
||||
.split (' ', QString::SkipEmptyParts);
|
||||
.split (' ', SkipEmptyParts);
|
||||
if (parts.size() > 6) {
|
||||
auto for_us = parts[5].contains (m_baseCall)
|
||||
|| ("DE" == parts[5] && qAbs (ui->RxFreqSpinBox->value () - audioFreq) <= 10);
|
||||
@ -3280,7 +3312,7 @@ void MainWindow::readFromStdout() //readFromStdout
|
||||
|
||||
if(m_mode=="FT8" and SpecOp::HOUND==m_config.special_op_id()) {
|
||||
if(decodedtext.string().contains(";")) {
|
||||
QStringList w=decodedtext.string().mid(24).split(" ",QString::SkipEmptyParts);
|
||||
QStringList w=decodedtext.string().mid(24).split(" ",SkipEmptyParts);
|
||||
QString foxCall=w.at(3);
|
||||
foxCall=foxCall.remove("<").remove(">");
|
||||
if(w.at(0)==m_config.my_callsign() or w.at(0)==Radio::base_callsign(m_config.my_callsign())) {
|
||||
@ -3296,7 +3328,7 @@ void MainWindow::readFromStdout() //readFromStdout
|
||||
hound_reply ();
|
||||
}
|
||||
} else {
|
||||
QStringList w=decodedtext.string().mid(24).split(" ",QString::SkipEmptyParts);
|
||||
QStringList w=decodedtext.string().mid(24).split(" ",SkipEmptyParts);
|
||||
if(decodedtext.string().contains("/")) w.append(" +00"); //Add a dummy report
|
||||
if(w.size()>=3) {
|
||||
QString foxCall=w.at(1);
|
||||
@ -3384,7 +3416,7 @@ void MainWindow::auto_sequence (DecodedText const& message, unsigned start_toler
|
||||
|| message_words.contains ("DE")))
|
||||
|| !message.isStandardMessage ()); // free text 73/RR73
|
||||
|
||||
QStringList w=message.string().mid(22).remove("<").remove(">").split(" ",QString::SkipEmptyParts);
|
||||
QStringList w=message.string().mid(22).remove("<").remove(">").split(" ",SkipEmptyParts);
|
||||
QString w2;
|
||||
int nrpt=0;
|
||||
if (w.size () > 2)
|
||||
@ -3665,8 +3697,12 @@ void MainWindow::guiUpdate()
|
||||
else if (SpecOp::HOUND == m_config.special_op_id()) {
|
||||
if(m_auto && !m_tune) {
|
||||
if (ui->TxFreqSpinBox->value() < 999 && m_ntx != 3) {
|
||||
int nf = (qrand() % 2000) + 1000; // Hound randomized range: 1000-3000 Hz
|
||||
ui->TxFreqSpinBox->setValue(nf);
|
||||
// Hound randomized range: 1000-3000 Hz
|
||||
#if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0)
|
||||
ui->TxFreqSpinBox->setValue (QRandomGenerator::global ()->bounded (1000, 2999));
|
||||
#else
|
||||
ui->TxFreqSpinBox->setValue ((qrand () % 2000) + 1000);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
if (m_nSentFoxRrpt==2 and m_ntx==3) {
|
||||
@ -3685,8 +3721,11 @@ void MainWindow::guiUpdate()
|
||||
// If HoldTxFreq is not checked, randomize Fox's Tx Freq
|
||||
// NB: Maybe this should be done no more than once every 5 minutes or so ?
|
||||
if(m_mode=="FT8" and SpecOp::FOX==m_config.special_op_id() and !ui->cbHoldTxFreq->isChecked()) {
|
||||
int fTx = 300.0 + 300.0*double(qrand())/RAND_MAX;
|
||||
ui->TxFreqSpinBox->setValue(fTx);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0)
|
||||
ui->TxFreqSpinBox->setValue (QRandomGenerator::global ()->bounded (300, 599));
|
||||
#else
|
||||
ui->TxFreqSpinBox->setValue(300.0 + 300.0*double(qrand())/RAND_MAX);
|
||||
#endif
|
||||
}
|
||||
|
||||
setXIT (ui->TxFreqSpinBox->value ());
|
||||
@ -3858,7 +3897,7 @@ void MainWindow::guiUpdate()
|
||||
|
||||
if(SpecOp::FIELD_DAY==m_config.special_op_id() or SpecOp::RTTY==m_config.special_op_id()) {
|
||||
if(m_ntx==2 or m_ntx==3) {
|
||||
QStringList t=ui->tx2->text().split(' ', QString::SkipEmptyParts);
|
||||
QStringList t=ui->tx2->text().split(' ', SkipEmptyParts);
|
||||
int n=t.size();
|
||||
m_xSent=t.at(n-2) + " " + t.at(n-1);
|
||||
}
|
||||
@ -3893,7 +3932,7 @@ void MainWindow::guiUpdate()
|
||||
|
||||
auto t2 = QDateTime::currentDateTimeUtc ().toString ("hhmm");
|
||||
icw[0] = 0;
|
||||
auto msg_parts = m_currentMessage.split (' ', QString::SkipEmptyParts);
|
||||
auto msg_parts = m_currentMessage.split (' ', SkipEmptyParts);
|
||||
if (msg_parts.size () > 2) {
|
||||
// clean up short code forms
|
||||
msg_parts[0].remove (QChar {'<'});
|
||||
@ -3904,7 +3943,7 @@ void MainWindow::guiUpdate()
|
||||
auto is_73 = m_QSOProgress >= ROGER_REPORT
|
||||
&& message_is_73 (m_currentMessageType, msg_parts);
|
||||
m_sentFirst73 = is_73
|
||||
&& !message_is_73 (m_lastMessageType, m_lastMessageSent.split (' ', QString::SkipEmptyParts));
|
||||
&& !message_is_73 (m_lastMessageType, m_lastMessageSent.split (' ', SkipEmptyParts));
|
||||
if (m_sentFirst73) {
|
||||
m_qsoStop=t2;
|
||||
if(m_config.id_after_73 ()) {
|
||||
@ -4472,7 +4511,7 @@ void MainWindow::processMessage (DecodedText const& message, Qt::KeyboardModifie
|
||||
auto ctrl = modifiers.testFlag (Qt::ControlModifier);
|
||||
// auto alt = modifiers.testFlag (Qt::AltModifier);
|
||||
// basic mode sanity checks
|
||||
auto const& parts = message.string ().split (' ', QString::SkipEmptyParts);
|
||||
auto const& parts = message.string ().split (' ', SkipEmptyParts);
|
||||
if (parts.size () < 5) return;
|
||||
auto const& mode = parts.at (4).left (1);
|
||||
if (("JT9+JT65" == m_mode && !("@" == mode || "#" == mode))
|
||||
@ -4530,7 +4569,7 @@ void MainWindow::processMessage (DecodedText const& message, Qt::KeyboardModifie
|
||||
ui->dxCallEntry->setText(hiscall);
|
||||
}
|
||||
|
||||
QStringList w=message.string().mid(22).remove("<").remove(">").split(" ",QString::SkipEmptyParts);
|
||||
QStringList w=message.string().mid(22).remove("<").remove(">").split(" ",SkipEmptyParts);
|
||||
int nw=w.size();
|
||||
if(nw>=4) {
|
||||
if(message_words.size()<3) return;
|
||||
@ -4622,7 +4661,7 @@ void MainWindow::processMessage (DecodedText const& message, Qt::KeyboardModifie
|
||||
MessageBox::information_message (this, msg);
|
||||
}
|
||||
|
||||
QStringList t=message.string().split(' ', QString::SkipEmptyParts);
|
||||
QStringList t=message.string().split(' ', SkipEmptyParts);
|
||||
int n=t.size();
|
||||
QString t0=t.at(n-2);
|
||||
QString t1=t0.right(1);
|
||||
@ -5396,7 +5435,13 @@ void MainWindow::on_addButton_clicked() //Add button
|
||||
}
|
||||
if(f1.size()==0) {
|
||||
QTextStream out(&f1);
|
||||
out << "ZZZZZZ" << endl;
|
||||
out << "ZZZZZZ"
|
||||
#if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0)
|
||||
<< Qt::endl
|
||||
#else
|
||||
<< endl
|
||||
#endif
|
||||
;
|
||||
f1.close();
|
||||
f1.open(QIODevice::ReadOnly | QIODevice::Text);
|
||||
}
|
||||
@ -6975,7 +7020,13 @@ void MainWindow::handle_transceiver_update (Transceiver::TransceiverState const&
|
||||
QTextStream out(&f2);
|
||||
out << QDateTime::currentDateTimeUtc().toString("yyyy-MM-dd hh:mm")
|
||||
<< " " << qSetRealNumberPrecision (12) << (m_freqNominal / 1.e6) << " MHz "
|
||||
<< m_mode << endl;
|
||||
<< m_mode
|
||||
#if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0)
|
||||
<< Qt::endl
|
||||
#else
|
||||
<< endl
|
||||
#endif
|
||||
;
|
||||
f2.close();
|
||||
} else {
|
||||
MessageBox::warning_message (this, tr ("File Error")
|
||||
@ -7553,7 +7604,7 @@ void MainWindow::replayDecodes ()
|
||||
// appended info
|
||||
if (message.size() >= 4 && message.left (4) != "----")
|
||||
{
|
||||
auto const& parts = message.split (' ', QString::SkipEmptyParts);
|
||||
auto const& parts = message.split (' ', SkipEmptyParts);
|
||||
if (parts.size () >= 5 && parts[3].contains ('.')) // WSPR
|
||||
{
|
||||
postWSPRDecode (false, parts);
|
||||
@ -7571,7 +7622,7 @@ void MainWindow::replayDecodes ()
|
||||
void MainWindow::postDecode (bool is_new, QString const& message)
|
||||
{
|
||||
auto const& decode = message.trimmed ();
|
||||
auto const& parts = decode.left (22).split (' ', QString::SkipEmptyParts);
|
||||
auto const& parts = decode.left (22).split (' ', SkipEmptyParts);
|
||||
if (parts.size () >= 5)
|
||||
{
|
||||
auto has_seconds = parts[0].size () > 4;
|
||||
@ -7644,9 +7695,11 @@ void MainWindow::p1ReadFromStdout() //p1readFromStdout
|
||||
ui->DecodeButton->setChecked (false);
|
||||
if(m_uploadSpots
|
||||
&& m_config.is_transceiver_online ()) { // need working rig control
|
||||
float x=qrand()/((double)RAND_MAX + 1.0);
|
||||
int msdelay=20000*x;
|
||||
uploadTimer.start(msdelay); //Upload delay
|
||||
#if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0)
|
||||
uploadTimer.start(QRandomGenerator::global ()->bounded (0, 20000)); // Upload delay
|
||||
#else
|
||||
uploadTimer.start(20000 * qrand()/((double)RAND_MAX + 1.0)); // Upload delay
|
||||
#endif
|
||||
} else {
|
||||
QFile f(QDir::toNativeSeparators(m_config.writeable_data_dir ().absolutePath()) + "/wspr_spots.txt");
|
||||
if(f.exists()) f.remove();
|
||||
@ -7746,7 +7799,13 @@ void MainWindow::WSPR_history(Frequency dialFreq, int ndecodes)
|
||||
QFile f {m_config.writeable_data_dir ().absoluteFilePath ("WSPR_history.txt")};
|
||||
if (f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append)) {
|
||||
QTextStream out(&f);
|
||||
out << t1 << endl;
|
||||
out << t1
|
||||
#if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0)
|
||||
<< Qt::endl
|
||||
#else
|
||||
<< endl
|
||||
#endif
|
||||
;
|
||||
f.close();
|
||||
} else {
|
||||
MessageBox::warning_message (this, tr ("File Error")
|
||||
@ -7836,18 +7895,22 @@ void MainWindow::WSPR_scheduling ()
|
||||
if (hop_data.frequencies_index_ >= 0) { // new band
|
||||
ui->bandComboBox->setCurrentIndex (hop_data.frequencies_index_);
|
||||
on_bandComboBox_activated (hop_data.frequencies_index_);
|
||||
m_cmnd.clear ();
|
||||
QStringList prefixes {".bat", ".cmd", ".exe", ""};
|
||||
QString target;
|
||||
for (auto const& prefix : prefixes)
|
||||
{
|
||||
auto const& path = m_appDir + "/user_hardware" + prefix;
|
||||
QFile f {path};
|
||||
if (f.exists ()) {
|
||||
m_cmnd = QDir::toNativeSeparators (f.fileName ()) + ' ' +
|
||||
m_config.bands ()->find (m_freqNominal).remove ('m');
|
||||
target = QDir {m_appDir}.absoluteFilePath (QLatin1String {"user_hardware"});
|
||||
QFileInfo f {target + prefix};
|
||||
if (f.isExecutable ()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(m_cmnd!="") p3.start(m_cmnd); // Execute user's hardware controller
|
||||
if (target.size ())
|
||||
{
|
||||
// Execute user's hardware controller
|
||||
p3.start(QDir::toNativeSeparators (target)
|
||||
, QStringList {m_config.bands ()->find (m_freqNominal).remove ('m')});
|
||||
}
|
||||
|
||||
// Produce a short tuneup signal
|
||||
m_tuneup = false;
|
||||
@ -8173,7 +8236,13 @@ void MainWindow::write_transmit_entry (QString const& file_name)
|
||||
out << time.toString("yyMMdd_hhmmss")
|
||||
<< " Transmitting " << qSetRealNumberPrecision (12) << (m_freqNominal / 1.e6)
|
||||
<< " MHz " << m_modeTx
|
||||
<< ": " << m_currentMessage << endl;
|
||||
<< ": " << m_currentMessage
|
||||
#if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0)
|
||||
<< Qt::endl
|
||||
#else
|
||||
<< endl
|
||||
#endif
|
||||
;
|
||||
f.close();
|
||||
}
|
||||
else
|
||||
@ -8261,7 +8330,7 @@ QString MainWindow::sortHoundCalls(QString t, int isort, int max_dB)
|
||||
QString msg,houndCall,t1;
|
||||
QString ABC{"ABCDEFGHIJKLMNOPQRSTUVWXYZ _"};
|
||||
QList<int> list;
|
||||
int i,j,k,m,n,nlines;
|
||||
int i,j,k,n,nlines;
|
||||
bool bReverse=(isort >= 3);
|
||||
|
||||
isort=qAbs(isort);
|
||||
@ -8278,20 +8347,20 @@ QString MainWindow::sortHoundCalls(QString t, int isort, int max_dB)
|
||||
j=0;
|
||||
t="";
|
||||
for(auto a: map.keys()) {
|
||||
t1=map[a].split(" ",QString::SkipEmptyParts).at(2);
|
||||
t1=map[a].split(" ",SkipEmptyParts).at(2);
|
||||
int nsnr=t1.toInt(); // get snr
|
||||
if(nsnr <= max_dB) { // keep only if snr in specified range
|
||||
if(isort==1) t += map[a] + "\n";
|
||||
if(isort==3 or isort==4) {
|
||||
i=2; // sort Hound calls by snr
|
||||
if(isort==4) i=4; // sort Hound calls by distance
|
||||
t1=map[a].split(" ",QString::SkipEmptyParts).at(i);
|
||||
t1=map[a].split(" ",SkipEmptyParts).at(i);
|
||||
n=1000*(t1.toInt()+100) + j; // pack (snr or dist) and index j into n
|
||||
list.insert(j,n); // add n to list at [j]
|
||||
}
|
||||
|
||||
if(isort==2) { // sort Hound calls by grid
|
||||
t1=map[a].split(" ",QString::SkipEmptyParts).at(1);
|
||||
t1=map[a].split(" ",SkipEmptyParts).at(1);
|
||||
if(t1=="....") t1="ZZ99";
|
||||
int i1=ABC.indexOf(t1.mid(0,1));
|
||||
int i2=ABC.indexOf(t1.mid(1,1));
|
||||
@ -8328,11 +8397,13 @@ QString MainWindow::sortHoundCalls(QString t, int isort, int max_dB)
|
||||
a[i]=i;
|
||||
}
|
||||
for(i=nn-1; i>-1; i--) {
|
||||
#if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0)
|
||||
j = (i + 1) * QRandomGenerator::global ()->generateDouble ();
|
||||
#else
|
||||
j=(i+1)*double(qrand())/RAND_MAX;
|
||||
m=a[j];
|
||||
a[j]=a[i];
|
||||
a[i]=m;
|
||||
t += lines2.at(m) + "\n";
|
||||
#endif
|
||||
std::swap (a[j], a[i]);
|
||||
t += lines2.at(a[i]) + "\n";
|
||||
}
|
||||
}
|
||||
|
||||
@ -8356,13 +8427,13 @@ void MainWindow::selectHound(QString line)
|
||||
*/
|
||||
|
||||
if(line.length()==0) return;
|
||||
QString houndCall=line.split(" ",QString::SkipEmptyParts).at(0);
|
||||
QString houndCall=line.split(" ",SkipEmptyParts).at(0);
|
||||
|
||||
// Don't add a call already enqueued or in QSO
|
||||
if(ui->textBrowser4->toPlainText().indexOf(houndCall) >= 0) return;
|
||||
|
||||
QString houndGrid=line.split(" ",QString::SkipEmptyParts).at(1); // Hound caller's grid
|
||||
QString rpt=line.split(" ",QString::SkipEmptyParts).at(2); // Hound SNR
|
||||
QString houndGrid=line.split(" ",SkipEmptyParts).at(1); // Hound caller's grid
|
||||
QString rpt=line.split(" ",SkipEmptyParts).at(2); // Hound SNR
|
||||
|
||||
m_houndCallers=m_houndCallers.remove(line+"\n"); // Remove t from sorted Hound list
|
||||
m_nSortedHounds--;
|
||||
@ -8726,9 +8797,20 @@ void MainWindow::writeFoxQSO(QString const& msg)
|
||||
QFile f {m_config.writeable_data_dir ().absoluteFilePath ("FoxQSO.txt")};
|
||||
if (f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append)) {
|
||||
QTextStream out(&f);
|
||||
out << QDateTime::currentDateTimeUtc().toString("yyyy-MM-dd hh:mm:ss")
|
||||
<< " " << fixed << qSetRealNumberPrecision (3) << (m_freqNominal/1.e6)
|
||||
<< t << msg << endl;
|
||||
out << QDateTime::currentDateTimeUtc().toString("yyyy-MM-dd hh:mm:ss") << " "
|
||||
#if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0)
|
||||
<< Qt::fixed
|
||||
#else
|
||||
<< fixed
|
||||
#endif
|
||||
<< qSetRealNumberPrecision (3) << (m_freqNominal/1.e6)
|
||||
<< t << msg
|
||||
#if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0)
|
||||
<< Qt::endl
|
||||
#else
|
||||
<< endl
|
||||
#endif
|
||||
;
|
||||
f.close();
|
||||
} else {
|
||||
MessageBox::warning_message (this, tr("File Open Error"),
|
||||
@ -8855,7 +8937,13 @@ void MainWindow::write_all(QString txRx, QString message)
|
||||
QFile f{m_config.writeable_data_dir().absoluteFilePath(file_name)};
|
||||
if (f.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append)) {
|
||||
QTextStream out(&f);
|
||||
out << line << endl;
|
||||
out << line
|
||||
#if QT_VERSION >= QT_VERSION_CHECK (5, 15, 0)
|
||||
<< Qt::endl
|
||||
#else
|
||||
<< endl
|
||||
#endif
|
||||
;
|
||||
f.close();
|
||||
} else {
|
||||
auto const& message2 = tr ("Cannot open \"%1\" for append: %2")
|
||||
|
@ -3,6 +3,8 @@
|
||||
#define MAINWINDOW_H
|
||||
|
||||
#include <QMainWindow>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QLabel>
|
||||
#include <QThread>
|
||||
#include <QProcess>
|
||||
@ -605,8 +607,7 @@ private:
|
||||
QString m_rptRcvd;
|
||||
QString m_qsoStart;
|
||||
QString m_qsoStop;
|
||||
QString m_cmnd;
|
||||
QString m_cmndP1;
|
||||
QStringList m_cmndP1;
|
||||
QString m_msgSent0;
|
||||
QString m_calls;
|
||||
QString m_CQtype;
|
||||
@ -713,7 +714,7 @@ private:
|
||||
void pskPost(DecodedText const& decodedtext);
|
||||
void displayDialFrequency ();
|
||||
void transmitDisplay (bool);
|
||||
void processMessage(DecodedText const&, Qt::KeyboardModifiers = 0);
|
||||
void processMessage(DecodedText const&, Qt::KeyboardModifiers = Qt::NoModifier);
|
||||
void replyToCQ (QTime, qint32 snr, float delta_time, quint32 delta_frequency, QString const& mode, QString const& message_text, bool low_confidence, quint8 modifiers);
|
||||
void locationChange(QString const& location);
|
||||
void replayDecodes ();
|
||||
|
Loading…
Reference in New Issue
Block a user