mirror of
https://github.com/iDescriptor/iDescriptor.git
synced 2026-06-22 03:45:51 +08:00
pass correct args to startDownloadProcess
This commit is contained in:
@@ -123,5 +123,5 @@ void AppDownloadDialog::onDownloadClicked()
|
||||
m_actionButton->deleteLater();
|
||||
qDebug() << "Starting download to" << m_outputDir;
|
||||
qDebug() << "Bundle ID:" << m_bundleId;
|
||||
startDownloadProcess(m_bundleId, m_outputDir, buttonIndex);
|
||||
startDownloadProcess(m_bundleId, m_outputDir, buttonIndex, true, true);
|
||||
}
|
||||
|
||||
@@ -262,7 +262,7 @@ void AppInstallDialog::onInstallClicked()
|
||||
}
|
||||
|
||||
startDownloadProcess(m_bundleId, m_tempDir->path(), buttonIndex, false,
|
||||
true);
|
||||
false);
|
||||
|
||||
connect(
|
||||
this, &AppDownloadBaseDialog::downloadFinished, this,
|
||||
|
||||
@@ -69,13 +69,14 @@ void AppDownloadBaseDialog::startDownloadProcess(const QString &bundleId,
|
||||
bool promptToOpenDir,
|
||||
bool close)
|
||||
{
|
||||
|
||||
if (bundleId.isEmpty()) {
|
||||
QMessageBox::critical(this, "Error", "Bundle ID not provided.");
|
||||
reject();
|
||||
return;
|
||||
}
|
||||
|
||||
m_tries = 0;
|
||||
|
||||
addProgressBar(index);
|
||||
if (m_actionButton)
|
||||
m_actionButton->setEnabled(false);
|
||||
@@ -117,10 +118,12 @@ void AppDownloadBaseDialog::tryToDownload(const QString &bundleId,
|
||||
return;
|
||||
}
|
||||
safeThis->m_operationInProgress = false;
|
||||
if (result == 0) { // Success
|
||||
|
||||
if (result == 0) {
|
||||
emit safeThis->downloadFinished(true, "Success");
|
||||
if (safeThis->m_progressBar)
|
||||
safeThis->m_progressBar->setValue(100);
|
||||
|
||||
if (promptToOpenDir) {
|
||||
|
||||
if (QMessageBox::Yes ==
|
||||
@@ -141,19 +144,20 @@ void AppDownloadBaseDialog::tryToDownload(const QString &bundleId,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (close)
|
||||
safeThis->accept();
|
||||
} else { // Failure
|
||||
// 3 attempts
|
||||
} else {
|
||||
if (safeThis->m_tries < 3) {
|
||||
safeThis->m_tries++;
|
||||
qDebug()
|
||||
<< "Retrying download for" + safeThis->m_bundleId +
|
||||
"Attempt:" + QString::number(safeThis->m_tries);
|
||||
qDebug() << "Retrying download for" << safeThis->m_bundleId
|
||||
<< "Attempt:" << safeThis->m_tries;
|
||||
|
||||
safeThis->tryToDownload(safeThis->m_bundleId, outputDir,
|
||||
promptToOpenDir);
|
||||
promptToOpenDir, close);
|
||||
return;
|
||||
}
|
||||
|
||||
emit safeThis->downloadFinished(false, "Failed");
|
||||
// if (promptToOpenDir)
|
||||
QMessageBox::critical(
|
||||
|
||||
Reference in New Issue
Block a user