Merge branch 'develop' into feat-ft2

This commit is contained in:
Bill Somerville 2019-03-22 20:51:42 +00:00
commit d862449dc8
6 changed files with 49 additions and 13 deletions

View File

@ -1015,6 +1015,9 @@ Configuration::impl::impl (Configuration * self, QNetworkAccessManager * network
}); });
lotw_users_.set_local_file_path (writeable_data_dir_.absoluteFilePath ("lotw-user-activity.csv")); lotw_users_.set_local_file_path (writeable_data_dir_.absoluteFilePath ("lotw-user-activity.csv"));
// load the dictionary if it exists
lotw_users_.load (ui_->LotW_CSV_URL_line_edit->text (), false);
// //
// validation // validation
ui_->callsign_line_edit->setValidator (new CallsignValidator {this}); ui_->callsign_line_edit->setValidator (new CallsignValidator {this});
@ -1073,6 +1076,7 @@ Configuration::impl::impl (Configuration * self, QNetworkAccessManager * network
// //
fill_port_combo_box (ui_->PTT_port_combo_box); fill_port_combo_box (ui_->PTT_port_combo_box);
ui_->PTT_port_combo_box->addItem ("CAT"); ui_->PTT_port_combo_box->addItem ("CAT");
ui_->PTT_port_combo_box->setItemData (ui_->PTT_port_combo_box->count () - 1, "Delegate to proxy CAT service", Qt::ToolTipRole);
// //
// setup hooks to keep audio channels aligned with devices // setup hooks to keep audio channels aligned with devices
@ -2163,7 +2167,7 @@ void Configuration::impl::on_rescan_log_push_button_clicked (bool /*clicked*/)
void Configuration::impl::on_LotW_CSV_fetch_push_button_clicked (bool /*checked*/) void Configuration::impl::on_LotW_CSV_fetch_push_button_clicked (bool /*checked*/)
{ {
lotw_users_.load (ui_->LotW_CSV_URL_line_edit->text (), true); lotw_users_.load (ui_->LotW_CSV_URL_line_edit->text (), true, true);
ui_->LotW_CSV_fetch_push_button->setEnabled (false); ui_->LotW_CSV_fetch_push_button->setEnabled (false);
} }
@ -2927,9 +2931,15 @@ void Configuration::impl::fill_port_combo_box (QComboBox * cb)
// remove possibly confusing Windows device path (OK because // remove possibly confusing Windows device path (OK because
// it gets added back by Hamlib) // it gets added back by Hamlib)
cb->addItem (p.systemLocation ().remove (QRegularExpression {R"(^\\\\\.\\)"})); cb->addItem (p.systemLocation ().remove (QRegularExpression {R"(^\\\\\.\\)"}));
auto tip = QString {"%1 %2 %3"}.arg (p.manufacturer ()).arg (p.serialNumber ()).arg (p.description ()).trimmed ();
if (tip.size ())
{
cb->setItemData (cb->count () - 1, tip, Qt::ToolTipRole);
}
} }
} }
cb->addItem("USB"); cb->addItem ("USB");
cb->setItemData (cb->count () - 1, "Custom USB device", Qt::ToolTipRole);
cb->setEditText (current_text); cb->setEditText (current_text);
} }

View File

@ -42,11 +42,12 @@ public:
{ {
} }
void load (QString const& url, bool forced_fetch) void load (QString const& url, bool fetch, bool forced_fetch)
{ {
auto csv_file_name = csv_file_.fileName ();
abort (); // abort any active download abort (); // abort any active download
if (!QFileInfo::exists (csv_file_name) || forced_fetch) auto csv_file_name = csv_file_.fileName ();
auto exists = QFileInfo::exists (csv_file_name);
if (fetch && (!exists || forced_fetch))
{ {
current_url_.setUrl (url); current_url_.setUrl (url);
if (current_url_.isValid () && !QSslSocket::supportsSsl ()) if (current_url_.isValid () && !QSslSocket::supportsSsl ())
@ -58,8 +59,11 @@ public:
} }
else else
{ {
// load the database asynchronously if (exists)
future_load_ = std::async (std::launch::async, &LotWUsers::impl::load_dictionary, this, csv_file_name); {
// load the database asynchronously
future_load_ = std::async (std::launch::async, &LotWUsers::impl::load_dictionary, this, csv_file_name);
}
} }
} }
@ -254,9 +258,9 @@ void LotWUsers::set_local_file_path (QString const& path)
m_->csv_file_.setFileName (path); m_->csv_file_.setFileName (path);
} }
void LotWUsers::load (QString const& url, bool force_download) void LotWUsers::load (QString const& url, bool fetch, bool force_download)
{ {
m_->load (url, force_download); m_->load (url, fetch, force_download);
} }
void LotWUsers::set_age_constraint (qint64 uploaded_since_days) void LotWUsers::set_age_constraint (qint64 uploaded_since_days)

View File

@ -23,7 +23,7 @@ public:
void set_local_file_path (QString const&); void set_local_file_path (QString const&);
Q_SLOT void load (QString const& url, bool force_download = false); Q_SLOT void load (QString const& url, bool fetch = true, bool force_download = false);
Q_SLOT void set_age_constraint (qint64 uploaded_since_days); Q_SLOT void set_age_constraint (qint64 uploaded_since_days);
// returns true if the specified call sign 'call' has uploaded their // returns true if the specified call sign 'call' has uploaded their

View File

@ -3,6 +3,8 @@
#include <stdexcept> #include <stdexcept>
#include <QDebug> #include <QDebug>
#include <QMutex>
#include <QMutexLocker>
#include <QString> #include <QString>
#include <QFile> #include <QFile>
#include <QTextStream> #include <QTextStream>
@ -28,10 +30,11 @@ private:
QTextStream * original_stream_; QTextStream * original_stream_;
QtMessageHandler original_handler_; QtMessageHandler original_handler_;
static QTextStream * current_stream_; static QTextStream * current_stream_;
static QMutex mutex_;
}; };
QTextStream * TraceFile::impl::current_stream_; QTextStream * TraceFile::impl::current_stream_;
QMutex TraceFile::impl::mutex_;
// delegate to implementation class // delegate to implementation class
TraceFile::TraceFile (QString const& trace_file_path) TraceFile::TraceFile (QString const& trace_file_path)
@ -73,7 +76,10 @@ TraceFile::impl::~impl ()
void TraceFile::impl::message_handler (QtMsgType type, QMessageLogContext const& context, QString const& msg) void TraceFile::impl::message_handler (QtMsgType type, QMessageLogContext const& context, QString const& msg)
{ {
Q_ASSERT_X (current_stream_, "TraceFile:message_handler", "no stream to write to"); Q_ASSERT_X (current_stream_, "TraceFile:message_handler", "no stream to write to");
*current_stream_ << qFormatLogMessage (type, context, msg) << endl; {
QMutexLocker lock {&mutex_}; // thread safety - serialize writes to the trace file
*current_stream_ << qFormatLogMessage (type, context, msg) << endl;
}
if (QtFatalMsg == type) if (QtFatalMsg == type)
{ {

View File

@ -91,7 +91,7 @@ d). Edit lines as needed. Keeping them in alphabetic order help see dupes.
:sourceforge-jtsdk: https://sourceforge.net/projects/jtsdk[SourceForge JTSDK] :sourceforge-jtsdk: https://sourceforge.net/projects/jtsdk[SourceForge JTSDK]
:ubuntu_sdk: https://launchpad.net/~ubuntu-sdk-team/+archive/ppa[Ubuntu SDK Notice] :ubuntu_sdk: https://launchpad.net/~ubuntu-sdk-team/+archive/ppa[Ubuntu SDK Notice]
:win_openssl_packages: https://slproweb.com/products/Win32OpenSSL.html[Windows OpenSSL Packages] :win_openssl_packages: https://slproweb.com/products/Win32OpenSSL.html[Windows OpenSSL Packages]
:win32_openssl: https://slproweb.com/download/Win32OpenSSL_Light-1_0_2q.exe[Win32 OpenSSL Lite Package] :win32_openssl: https://slproweb.com/download/Win32OpenSSL_Light-1_0_2r.exe[Win32 OpenSSL Lite Package]
:writelog: https://writelog.com/[Writelog] :writelog: https://writelog.com/[Writelog]
:wsjt_yahoo_group: https://groups.yahoo.com/neo/groups/wsjtgroup/info[WSJT Group] :wsjt_yahoo_group: https://groups.yahoo.com/neo/groups/wsjtgroup/info[WSJT Group]
:wsjtx: http://physics.princeton.edu/pulsar/K1JT/wsjtx.html[WSJT-X] :wsjtx: http://physics.princeton.edu/pulsar/K1JT/wsjtx.html[WSJT-X]

View File

@ -95,3 +95,19 @@ QT_QPA_PLATFORMTHEME set to empty (the space after the '=' character
is necessary): is necessary):
QT_QPA_PLATFORMTHEME= wsjtx QT_QPA_PLATFORMTHEME= wsjtx
I am running _WSJT-X_ on Linux using a KDE desktop. Why does *Menu->Configurations* misbehave?::
The KDE development team have added code to Qt that tries to
automatically add shortcut accelerator keys to all buttons including
pop up menu buttons, this interferes with operation of the application
(many other Qt applications have similar issues with KDE). Until this
is fixed by the KDE team you must disable this misfeature. Edit the
file ~/.config/kdeglobals and add a section containing the following:
[Development]
AutoCheckAccelerators=false
+
See https://stackoverflow.com/a/32711483 and
https://bugs.kde.org/show_bug.cgi?id=337491 for more details.