Skip to content

Commit c66917a

Browse files
KenJyn76JonathanFeenstra
authored andcommitted
Add warning message for dialog box
1 parent 76512fa commit c66917a

File tree

1 file changed

+23
-5
lines changed

1 file changed

+23
-5
lines changed

src/downloadmanager.cpp

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -444,20 +444,38 @@ void DownloadManager::queryDownloadListInfo()
444444
{
445445
TimeThis tt("DownloadManager::queryDownloadListInfos()");
446446

447-
startDisableDirWatcher();
448-
449447
log::info("Retrieving infos from every download (if possible)...");
450448

449+
int incompleteInfos = 0;
450+
451451
// Just go through all active downloads to query infos
452452
for (size_t i = 0; i < m_ActiveDownloads.size(); i++) {
453453
if (isInfoIncomplete(i)) {
454-
queryInfoMd5(i);
454+
incompleteInfos++;
455455
}
456456
}
457457

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

460-
endDisableDirWatcher();
478+
log::info("Files infos have been retrieved successfully!");
461479
}
462480

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

0 commit comments

Comments
 (0)