Skip to content

Commit

Permalink
Add warning message for dialog box
Browse files Browse the repository at this point in the history
  • Loading branch information
KenJyn76 authored and JonathanFeenstra committed Oct 5, 2024
1 parent 76512fa commit c66917a
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions src/downloadmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -444,20 +444,38 @@ void DownloadManager::queryDownloadListInfo()
{
TimeThis tt("DownloadManager::queryDownloadListInfos()");

startDisableDirWatcher();

log::info("Retrieving infos from every download (if possible)...");

int incompleteInfos = 0;

// Just go through all active downloads to query infos
for (size_t i = 0; i < m_ActiveDownloads.size(); i++) {
if (isInfoIncomplete(i)) {
queryInfoMd5(i);
incompleteInfos++;
}
}

log::info("Files infos have been retrived successfully!");
// Warn the user if the number of incomplete infos is over 5
if (incompleteInfos > 5) {
QString message = tr("There %1 incomplete download meta files.\n\n"
"Do you want to fetch metadata for all incomplete downloads?\n"
"API uses will be consumed, and Mod Organizer may stutter.");
message = message.arg(incompleteInfos);
if (QMessageBox::question(m_ParentWidget, tr("Incomplete Download Infos"), message,
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
// Fetch metadata for incomplete download infos
startDisableDirWatcher();
for (size_t i = 0; i < m_ActiveDownloads.size(); i++) {
if (isInfoIncomplete(i)) {
queryInfoMd5(i);
}
}
endDisableDirWatcher();
}
return;
}

endDisableDirWatcher();
log::info("Files infos have been retrieved successfully!");
}

bool DownloadManager::addDownload(const QStringList& URLs, QString gameName, int modID,
Expand Down

0 comments on commit c66917a

Please sign in to comment.