mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-25 13:48:42 -05:00
Move LotW users file management to Configuration implementation
This commit is contained in:
parent
0032a00ffe
commit
617b845a85
@ -180,6 +180,7 @@
|
|||||||
#include "MessageBox.hpp"
|
#include "MessageBox.hpp"
|
||||||
#include "MaidenheadLocatorValidator.hpp"
|
#include "MaidenheadLocatorValidator.hpp"
|
||||||
#include "CallsignValidator.hpp"
|
#include "CallsignValidator.hpp"
|
||||||
|
#include "LotWUsers.hpp"
|
||||||
|
|
||||||
#include "ui_Configuration.h"
|
#include "ui_Configuration.h"
|
||||||
#include "moc_Configuration.cpp"
|
#include "moc_Configuration.cpp"
|
||||||
@ -354,8 +355,11 @@ public:
|
|||||||
using FrequencyDelta = Radio::FrequencyDelta;
|
using FrequencyDelta = Radio::FrequencyDelta;
|
||||||
using port_type = Configuration::port_type;
|
using port_type = Configuration::port_type;
|
||||||
|
|
||||||
explicit impl (Configuration * self, QDir const& temp_directory,
|
explicit impl (Configuration * self
|
||||||
QSettings * settings, QWidget * parent);
|
, QNetworkAccessManager * network_manager
|
||||||
|
, QDir const& temp_directory
|
||||||
|
, QSettings * settings
|
||||||
|
, QWidget * parent);
|
||||||
~impl ();
|
~impl ();
|
||||||
|
|
||||||
bool have_rig ();
|
bool have_rig ();
|
||||||
@ -471,6 +475,7 @@ private:
|
|||||||
|
|
||||||
QScopedPointer<Ui::configuration_dialog> ui_;
|
QScopedPointer<Ui::configuration_dialog> ui_;
|
||||||
|
|
||||||
|
QNetworkAccessManager * network_manager_;
|
||||||
QSettings * settings_;
|
QSettings * settings_;
|
||||||
|
|
||||||
QDir doc_dir_;
|
QDir doc_dir_;
|
||||||
@ -488,6 +493,8 @@ private:
|
|||||||
QFont decoded_text_font_;
|
QFont decoded_text_font_;
|
||||||
QFont next_decoded_text_font_;
|
QFont next_decoded_text_font_;
|
||||||
|
|
||||||
|
LotWUsers lotw_users_;
|
||||||
|
|
||||||
bool restart_sound_input_device_;
|
bool restart_sound_input_device_;
|
||||||
bool restart_sound_output_device_;
|
bool restart_sound_output_device_;
|
||||||
|
|
||||||
@ -602,13 +609,9 @@ private:
|
|||||||
QString opCall_;
|
QString opCall_;
|
||||||
QString udp_server_name_;
|
QString udp_server_name_;
|
||||||
port_type udp_server_port_;
|
port_type udp_server_port_;
|
||||||
// QString n1mm_server_name () const;
|
|
||||||
QString n1mm_server_name_;
|
QString n1mm_server_name_;
|
||||||
port_type n1mm_server_port_;
|
port_type n1mm_server_port_;
|
||||||
bool broadcast_to_n1mm_;
|
bool broadcast_to_n1mm_;
|
||||||
// port_type n1mm_server_port () const;
|
|
||||||
// bool valid_n1mm_info () const;
|
|
||||||
// bool broadcast_to_n1mm() const;
|
|
||||||
bool accept_udp_requests_;
|
bool accept_udp_requests_;
|
||||||
bool udpWindowToFront_;
|
bool udpWindowToFront_;
|
||||||
bool udpWindowRestore_;
|
bool udpWindowRestore_;
|
||||||
@ -630,9 +633,9 @@ private:
|
|||||||
|
|
||||||
|
|
||||||
// delegate to implementation class
|
// delegate to implementation class
|
||||||
Configuration::Configuration (QDir const& temp_directory,
|
Configuration::Configuration (QNetworkAccessManager * network_manager, QDir const& temp_directory,
|
||||||
QSettings * settings, QWidget * parent)
|
QSettings * settings, QWidget * parent)
|
||||||
: m_ {this, temp_directory, settings, parent}
|
: m_ {this, network_manager, temp_directory, settings, parent}
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -735,6 +738,7 @@ QDir Configuration::azel_directory () const {return m_->azel_directory_;}
|
|||||||
QString Configuration::rig_name () const {return m_->rig_params_.rig_name;}
|
QString Configuration::rig_name () const {return m_->rig_params_.rig_name;}
|
||||||
bool Configuration::pwrBandTxMemory () const {return m_->pwrBandTxMemory_;}
|
bool Configuration::pwrBandTxMemory () const {return m_->pwrBandTxMemory_;}
|
||||||
bool Configuration::pwrBandTuneMemory () const {return m_->pwrBandTuneMemory_;}
|
bool Configuration::pwrBandTuneMemory () const {return m_->pwrBandTuneMemory_;}
|
||||||
|
LotWUsers const& Configuration::lotw_users () const {return m_->lotw_users_;}
|
||||||
|
|
||||||
void Configuration::set_calibration (CalibrationParams params)
|
void Configuration::set_calibration (CalibrationParams params)
|
||||||
{
|
{
|
||||||
@ -906,17 +910,19 @@ namespace
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Configuration::impl::impl (Configuration * self, QDir const& temp_directory,
|
Configuration::impl::impl (Configuration * self, QNetworkAccessManager * network_manager
|
||||||
QSettings * settings, QWidget * parent)
|
, QDir const& temp_directory, QSettings * settings, QWidget * parent)
|
||||||
: QDialog {parent}
|
: QDialog {parent}
|
||||||
, self_ {self}
|
, self_ {self}
|
||||||
, transceiver_thread_ {nullptr}
|
, transceiver_thread_ {nullptr}
|
||||||
, ui_ {new Ui::configuration_dialog}
|
, ui_ {new Ui::configuration_dialog}
|
||||||
|
, network_manager_ {network_manager}
|
||||||
, settings_ {settings}
|
, settings_ {settings}
|
||||||
, doc_dir_ {doc_path ()}
|
, doc_dir_ {doc_path ()}
|
||||||
, data_dir_ {data_path ()}
|
, data_dir_ {data_path ()}
|
||||||
, temp_dir_ {temp_directory}
|
, temp_dir_ {temp_directory}
|
||||||
, writeable_data_dir_ {QStandardPaths::writableLocation (QStandardPaths::DataLocation)}
|
, writeable_data_dir_ {QStandardPaths::writableLocation (QStandardPaths::DataLocation)}
|
||||||
|
, lotw_users_ {network_manager_}
|
||||||
, restart_sound_input_device_ {false}
|
, restart_sound_input_device_ {false}
|
||||||
, restart_sound_output_device_ {false}
|
, restart_sound_output_device_ {false}
|
||||||
, frequencies_ {&bands_}
|
, frequencies_ {&bands_}
|
||||||
@ -997,6 +1003,9 @@ Configuration::impl::impl (Configuration * self, QDir const& temp_directory,
|
|||||||
// this must be done after the default paths above are set
|
// this must be done after the default paths above are set
|
||||||
read_settings ();
|
read_settings ();
|
||||||
|
|
||||||
|
// load LotW users data
|
||||||
|
lotw_users_.load (writeable_data_dir_.absoluteFilePath ("lotw-user-activity.csv"));
|
||||||
|
|
||||||
//
|
//
|
||||||
// validation
|
// validation
|
||||||
//
|
//
|
||||||
|
@ -16,11 +16,13 @@ class QWidget;
|
|||||||
class QAudioDeviceInfo;
|
class QAudioDeviceInfo;
|
||||||
class QString;
|
class QString;
|
||||||
class QDir;
|
class QDir;
|
||||||
|
class QNetworkAccessManager;
|
||||||
class Bands;
|
class Bands;
|
||||||
class FrequencyList_v2;
|
class FrequencyList_v2;
|
||||||
class StationList;
|
class StationList;
|
||||||
class QStringListModel;
|
class QStringListModel;
|
||||||
class QHostAddress;
|
class QHostAddress;
|
||||||
|
class LotWUsers;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Class Configuration
|
// Class Configuration
|
||||||
@ -69,7 +71,7 @@ public:
|
|||||||
enum Type2MsgGen {type_2_msg_1_full, type_2_msg_3_full, type_2_msg_5_only};
|
enum Type2MsgGen {type_2_msg_1_full, type_2_msg_3_full, type_2_msg_5_only};
|
||||||
Q_ENUM (Type2MsgGen)
|
Q_ENUM (Type2MsgGen)
|
||||||
|
|
||||||
explicit Configuration (QDir const& temp_directory, QSettings * settings,
|
explicit Configuration (QNetworkAccessManager *, QDir const& temp_directory, QSettings * settings,
|
||||||
QWidget * parent = nullptr);
|
QWidget * parent = nullptr);
|
||||||
~Configuration ();
|
~Configuration ();
|
||||||
|
|
||||||
@ -181,6 +183,7 @@ public:
|
|||||||
QColor color_LoTW() const;
|
QColor color_LoTW() const;
|
||||||
bool pwrBandTxMemory () const;
|
bool pwrBandTxMemory () const;
|
||||||
bool pwrBandTuneMemory () const;
|
bool pwrBandTuneMemory () const;
|
||||||
|
LotWUsers const& lotw_users () const;
|
||||||
|
|
||||||
struct CalibrationParams
|
struct CalibrationParams
|
||||||
{
|
{
|
||||||
@ -239,8 +242,6 @@ public:
|
|||||||
Q_SLOT void transceiver_tx_frequency (Frequency = 0u);
|
Q_SLOT void transceiver_tx_frequency (Frequency = 0u);
|
||||||
|
|
||||||
// Set transceiver mode.
|
// Set transceiver mode.
|
||||||
//
|
|
||||||
// Rationalise means ensure TX uses same mode as RX.
|
|
||||||
Q_SLOT void transceiver_mode (MODE);
|
Q_SLOT void transceiver_mode (MODE);
|
||||||
|
|
||||||
// Set/unset PTT.
|
// Set/unset PTT.
|
||||||
|
@ -16,8 +16,6 @@
|
|||||||
#include <QNetworkReply>
|
#include <QNetworkReply>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
#include "Configuration.hpp"
|
|
||||||
|
|
||||||
#include "pimpl_impl.hpp"
|
#include "pimpl_impl.hpp"
|
||||||
|
|
||||||
#include "moc_LotWUsers.cpp"
|
#include "moc_LotWUsers.cpp"
|
||||||
@ -34,10 +32,9 @@ class LotWUsers::impl final
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
impl (LotWUsers * self, QNetworkAccessManager * network_manager, QString const& lotw_csv_file)
|
impl (LotWUsers * self, QNetworkAccessManager * network_manager)
|
||||||
: self_ {self}
|
: self_ {self}
|
||||||
, network_manager_ {network_manager}
|
, network_manager_ {network_manager}
|
||||||
, csv_file_ {lotw_csv_file}
|
|
||||||
, url_valid_ {false}
|
, url_valid_ {false}
|
||||||
, redirect_count_ {0}
|
, redirect_count_ {0}
|
||||||
{
|
{
|
||||||
@ -226,23 +223,20 @@ public:
|
|||||||
|
|
||||||
#include "LotWUsers.moc"
|
#include "LotWUsers.moc"
|
||||||
|
|
||||||
LotWUsers::LotWUsers (Configuration const * configuration, QNetworkAccessManager * network_manager
|
LotWUsers::LotWUsers (QNetworkAccessManager * network_manager, QObject * parent)
|
||||||
, QObject * parent)
|
|
||||||
: QObject {parent}
|
: QObject {parent}
|
||||||
, m_ {this
|
, m_ {this, network_manager}
|
||||||
, network_manager
|
|
||||||
, configuration->writeable_data_dir ().absoluteFilePath ("lotw-user-activity.csv")}
|
|
||||||
{
|
{
|
||||||
m_->load (false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LotWUsers::~LotWUsers ()
|
LotWUsers::~LotWUsers ()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void LotWUsers::download_new_file ()
|
void LotWUsers::load (QString const& lotw_csv_file, bool force_download)
|
||||||
{
|
{
|
||||||
m_->load (true);
|
m_->csv_file_.setFileName (lotw_csv_file);
|
||||||
|
m_->load (force_download);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LotWUsers::user (QString const& call, qint64 uploaded_since_days) const
|
bool LotWUsers::user (QString const& call, qint64 uploaded_since_days) const
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
class QString;
|
class QString;
|
||||||
class QDate;
|
class QDate;
|
||||||
class Configuration;
|
|
||||||
class QNetworkAccessManager;
|
class QNetworkAccessManager;
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -19,10 +18,10 @@ class LotWUsers final
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LotWUsers (Configuration const * configuration, QNetworkAccessManager *, QObject * parent = 0);
|
LotWUsers (QNetworkAccessManager *, QObject * parent = 0);
|
||||||
~LotWUsers ();
|
~LotWUsers ();
|
||||||
|
|
||||||
void download_new_file ();
|
void load (QString const& lotw_csv_file, bool force_download = false);
|
||||||
|
|
||||||
// returns true if the specified call sign 'call' has uploaded their
|
// returns true if the specified call sign 'call' has uploaded their
|
||||||
// log to LotW in the last 'uploaded_since_days' days
|
// log to LotW in the last 'uploaded_since_days' days
|
||||||
|
@ -59,6 +59,7 @@
|
|||||||
#include "MaidenheadLocatorValidator.hpp"
|
#include "MaidenheadLocatorValidator.hpp"
|
||||||
#include "CallsignValidator.hpp"
|
#include "CallsignValidator.hpp"
|
||||||
#include "EqualizationToolsDialog.hpp"
|
#include "EqualizationToolsDialog.hpp"
|
||||||
|
#include "LotWUsers.hpp"
|
||||||
|
|
||||||
#include "ui_mainwindow.h"
|
#include "ui_mainwindow.h"
|
||||||
#include "moc_mainwindow.cpp"
|
#include "moc_mainwindow.cpp"
|
||||||
@ -202,8 +203,7 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
|
|||||||
m_configurations_button {0},
|
m_configurations_button {0},
|
||||||
m_settings {multi_settings->settings ()},
|
m_settings {multi_settings->settings ()},
|
||||||
ui(new Ui::MainWindow),
|
ui(new Ui::MainWindow),
|
||||||
m_config {temp_directory, m_settings, this},
|
m_config {&m_network_manager, temp_directory, m_settings, this},
|
||||||
m_lotw_users {&m_config, &m_network_manager},
|
|
||||||
m_WSPR_band_hopping {m_settings, &m_config, this},
|
m_WSPR_band_hopping {m_settings, &m_config, this},
|
||||||
m_WSPR_tx_next {false},
|
m_WSPR_tx_next {false},
|
||||||
m_rigErrorMessageBox {MessageBox::Critical, tr ("Rig Control Error")
|
m_rigErrorMessageBox {MessageBox::Critical, tr ("Rig Control Error")
|
||||||
@ -386,8 +386,8 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
|
|||||||
ui->dxGridEntry->setValidator (new MaidenheadLocatorValidator {this});
|
ui->dxGridEntry->setValidator (new MaidenheadLocatorValidator {this});
|
||||||
ui->dxCallEntry->setValidator (new CallsignValidator {this});
|
ui->dxCallEntry->setValidator (new CallsignValidator {this});
|
||||||
ui->sbTR->values ({5, 10, 15, 30});
|
ui->sbTR->values ({5, 10, 15, 30});
|
||||||
ui->decodedTextBrowser->setLotWUsers (&m_lotw_users);
|
ui->decodedTextBrowser->setLotWUsers (&m_config.lotw_users ());
|
||||||
ui->decodedTextBrowser2->setLotWUsers (&m_lotw_users);
|
ui->decodedTextBrowser2->setLotWUsers (&m_config.lotw_users ());
|
||||||
|
|
||||||
m_baseCall = Radio::base_callsign (m_config.my_callsign ());
|
m_baseCall = Radio::base_callsign (m_config.my_callsign ());
|
||||||
m_opCall = m_config.opCall();
|
m_opCall = m_config.opCall();
|
||||||
@ -557,7 +557,7 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
|
|||||||
m_equalizationToolsDialog->show ();
|
m_equalizationToolsDialog->show ();
|
||||||
});
|
});
|
||||||
|
|
||||||
connect (&m_lotw_users, &LotWUsers::LotW_users_error, this, [this] (QString const& reason) {
|
connect (&m_config.lotw_users (), &LotWUsers::LotW_users_error, this, [this] (QString const& reason) {
|
||||||
MessageBox::warning_message (this, tr ("Error Loading LotW Users Data"), reason);
|
MessageBox::warning_message (this, tr ("Error Loading LotW Users Data"), reason);
|
||||||
}, Qt::QueuedConnection);
|
}, Qt::QueuedConnection);
|
||||||
|
|
||||||
|
@ -36,7 +36,6 @@
|
|||||||
#include "astro.h"
|
#include "astro.h"
|
||||||
#include "MessageBox.hpp"
|
#include "MessageBox.hpp"
|
||||||
#include "NetworkAccessManager.hpp"
|
#include "NetworkAccessManager.hpp"
|
||||||
#include "LotWUsers.hpp"
|
|
||||||
|
|
||||||
#define NUM_JT4_SYMBOLS 206 //(72+31)*2, embedded sync
|
#define NUM_JT4_SYMBOLS 206 //(72+31)*2, embedded sync
|
||||||
#define NUM_JT65_SYMBOLS 126 //63 data + 63 sync
|
#define NUM_JT65_SYMBOLS 126 //63 data + 63 sync
|
||||||
@ -343,7 +342,6 @@ private:
|
|||||||
QScopedPointer<Ui::MainWindow> ui;
|
QScopedPointer<Ui::MainWindow> ui;
|
||||||
|
|
||||||
Configuration m_config;
|
Configuration m_config;
|
||||||
LotWUsers m_lotw_users;
|
|
||||||
WSPRBandHopping m_WSPR_band_hopping;
|
WSPRBandHopping m_WSPR_band_hopping;
|
||||||
bool m_WSPR_tx_next;
|
bool m_WSPR_tx_next;
|
||||||
MessageBox m_rigErrorMessageBox;
|
MessageBox m_rigErrorMessageBox;
|
||||||
|
Loading…
Reference in New Issue
Block a user