mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-09-03 05:38:01 -04:00
Load LoTW Users data if CSV file exists at startup
This commit is contained in:
parent
1786d7e8f8
commit
f63c5e14bb
@ -1012,6 +1012,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});
|
||||||
@ -2155,7 +2158,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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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)
|
||||||
|
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user