Skip to content

Commit

Permalink
LOV Download: Download is not interrupted if one of many fails
Browse files Browse the repository at this point in the history
  • Loading branch information
foldynl committed Jan 1, 2025
1 parent 3aeea83 commit 29ae151
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 23 deletions.
30 changes: 8 additions & 22 deletions core/Migration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -348,25 +348,18 @@ bool Migration::updateExternalResource()
connect(&progress, &QProgressDialog::canceled,
&downloader, &LOVDownloader::abortRequest);

if ( ! updateExternalResourceProgress(progress, downloader, LOVDownloader::CTY, "(1/7)") )
return false;
if ( ! updateExternalResourceProgress(progress, downloader, LOVDownloader::SATLIST, "(2/7)") )
return false;
if ( ! updateExternalResourceProgress(progress, downloader, LOVDownloader::SOTASUMMITS, "(3/7)") )
return false;
if ( ! updateExternalResourceProgress(progress, downloader, LOVDownloader::WWFFDIRECTORY, "(4/7)") )
return false;
if ( ! updateExternalResourceProgress(progress, downloader, LOVDownloader::IOTALIST, "(5/7)") )
return false;
if ( ! updateExternalResourceProgress(progress, downloader, LOVDownloader::POTADIRECTORY, "(6/7)") )
return false;
if ( ! updateExternalResourceProgress(progress, downloader, LOVDownloader::MEMBERSHIPCONTENTLIST, "(7/7)") )
return false;
updateExternalResourceProgress(progress, downloader, LOVDownloader::CTY, "(1/7)");
updateExternalResourceProgress(progress, downloader, LOVDownloader::SATLIST, "(2/7)");
updateExternalResourceProgress(progress, downloader, LOVDownloader::SOTASUMMITS, "(3/7)");
updateExternalResourceProgress(progress, downloader, LOVDownloader::WWFFDIRECTORY, "(4/7)");
updateExternalResourceProgress(progress, downloader, LOVDownloader::IOTALIST, "(5/7)");
updateExternalResourceProgress(progress, downloader, LOVDownloader::POTADIRECTORY, "(6/7)");
updateExternalResourceProgress(progress, downloader, LOVDownloader::MEMBERSHIPCONTENTLIST, "(7/7)");

return true;
}

bool Migration::updateExternalResourceProgress(QProgressDialog& progress,
void Migration::updateExternalResourceProgress(QProgressDialog& progress,
LOVDownloader& downloader,
const LOVDownloader::SourceType & sourceType,
const QString &counter)
Expand Down Expand Up @@ -412,20 +405,13 @@ bool Migration::updateExternalResourceProgress(QProgressDialog& progress,
downloader.update(sourceType);

if ( progress.wasCanceled() )
{
qCDebug(runtime) << "Update was canceled";
}
else
{
if ( !progress.exec() )
{
QMessageBox::warning(nullptr, QMessageBox::tr("QLog Warning"),
stringInfo + tr(" Update Failed"));
return false;
}
}

return true;
}

/* Fixing error when QLog stored UTF characters to non-Intl field of ADIF (contact) table */
Expand Down
2 changes: 1 addition & 1 deletion core/Migration.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Migration : public QObject
bool runSqlFile(QString filename);
int tableRows(QString name);
bool updateExternalResource();
bool updateExternalResourceProgress(QProgressDialog&,
void updateExternalResourceProgress(QProgressDialog&,
LOVDownloader&,
const LOVDownloader::SourceType & sourceType,
const QString &counter);
Expand Down

0 comments on commit 29ae151

Please sign in to comment.