kopia lustrzana https://github.com/f4exb/sdrangel
Don't use WA_DeleteOnClose for progess dialogs, as a crash can occur if the user closes the window before the download is complete.
rodzic
5cbd607f4a
commit
af841dd88f
|
@ -1625,7 +1625,6 @@ void ADSBDemodGUI::on_getOSNDB_clicked()
|
||||||
// Download Opensky network database to a file
|
// Download Opensky network database to a file
|
||||||
QUrl dbURL(QString(OSNDB_URL));
|
QUrl dbURL(QString(OSNDB_URL));
|
||||||
m_progressDialog = new QProgressDialog(this);
|
m_progressDialog = new QProgressDialog(this);
|
||||||
m_progressDialog->setAttribute(Qt::WA_DeleteOnClose);
|
|
||||||
m_progressDialog->setCancelButton(nullptr);
|
m_progressDialog->setCancelButton(nullptr);
|
||||||
m_progressDialog->setLabelText(QString("Downloading %1.").arg(OSNDB_URL));
|
m_progressDialog->setLabelText(QString("Downloading %1.").arg(OSNDB_URL));
|
||||||
QNetworkReply *reply = m_dlm.download(dbURL, osnDBFilename);
|
QNetworkReply *reply = m_dlm.download(dbURL, osnDBFilename);
|
||||||
|
@ -1645,7 +1644,6 @@ void ADSBDemodGUI::on_getAirportDB_clicked()
|
||||||
// Download Opensky network database to a file
|
// Download Opensky network database to a file
|
||||||
QUrl dbURL(QString(AIRPORTS_URL));
|
QUrl dbURL(QString(AIRPORTS_URL));
|
||||||
m_progressDialog = new QProgressDialog(this);
|
m_progressDialog = new QProgressDialog(this);
|
||||||
m_progressDialog->setAttribute(Qt::WA_DeleteOnClose);
|
|
||||||
m_progressDialog->setCancelButton(nullptr);
|
m_progressDialog->setCancelButton(nullptr);
|
||||||
m_progressDialog->setLabelText(QString("Downloading %1.").arg(AIRPORTS_URL));
|
m_progressDialog->setLabelText(QString("Downloading %1.").arg(AIRPORTS_URL));
|
||||||
QNetworkReply *reply = m_dlm.download(dbURL, airportDBFile);
|
QNetworkReply *reply = m_dlm.download(dbURL, airportDBFile);
|
||||||
|
@ -1740,12 +1738,16 @@ bool ADSBDemodGUI::readFastDB(const QString& filename)
|
||||||
|
|
||||||
void ADSBDemodGUI::updateDownloadProgress(qint64 bytesRead, qint64 totalBytes)
|
void ADSBDemodGUI::updateDownloadProgress(qint64 bytesRead, qint64 totalBytes)
|
||||||
{
|
{
|
||||||
m_progressDialog->setMaximum(totalBytes);
|
if (m_progressDialog)
|
||||||
m_progressDialog->setValue(bytesRead);
|
{
|
||||||
|
m_progressDialog->setMaximum(totalBytes);
|
||||||
|
m_progressDialog->setValue(bytesRead);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ADSBDemodGUI::downloadFinished(const QString& filename, bool success)
|
void ADSBDemodGUI::downloadFinished(const QString& filename, bool success)
|
||||||
{
|
{
|
||||||
|
bool closeDialog = true;
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
if (filename == getOSNDBFilename())
|
if (filename == getOSNDBFilename())
|
||||||
|
@ -1754,8 +1756,6 @@ void ADSBDemodGUI::downloadFinished(const QString& filename, bool success)
|
||||||
// Convert to condensed format for faster loading later
|
// Convert to condensed format for faster loading later
|
||||||
m_progressDialog->setLabelText("Processing.");
|
m_progressDialog->setLabelText("Processing.");
|
||||||
AircraftInformation::writeFastDB(getFastDBFilename(), m_aircraftInfo);
|
AircraftInformation::writeFastDB(getFastDBFilename(), m_aircraftInfo);
|
||||||
m_progressDialog->close();
|
|
||||||
m_progressDialog = nullptr;
|
|
||||||
}
|
}
|
||||||
else if (filename == getAirportDBFilename())
|
else if (filename == getAirportDBFilename())
|
||||||
{
|
{
|
||||||
|
@ -1765,6 +1765,7 @@ void ADSBDemodGUI::downloadFinished(const QString& filename, bool success)
|
||||||
m_progressDialog->setLabelText(QString("Downloading %1.").arg(AIRPORT_FREQUENCIES_URL));
|
m_progressDialog->setLabelText(QString("Downloading %1.").arg(AIRPORT_FREQUENCIES_URL));
|
||||||
QNetworkReply *reply = m_dlm.download(dbURL, getAirportFrequenciesDBFilename());
|
QNetworkReply *reply = m_dlm.download(dbURL, getAirportFrequenciesDBFilename());
|
||||||
connect(reply, SIGNAL(downloadProgress(qint64,qint64)), this, SLOT(updateDownloadProgress(qint64,qint64)));
|
connect(reply, SIGNAL(downloadProgress(qint64,qint64)), this, SLOT(updateDownloadProgress(qint64,qint64)));
|
||||||
|
closeDialog = false;
|
||||||
}
|
}
|
||||||
else if (filename == getAirportFrequenciesDBFilename())
|
else if (filename == getAirportFrequenciesDBFilename())
|
||||||
{
|
{
|
||||||
|
@ -1774,19 +1775,16 @@ void ADSBDemodGUI::downloadFinished(const QString& filename, bool success)
|
||||||
// Update airports on map
|
// Update airports on map
|
||||||
updateAirports();
|
updateAirports();
|
||||||
}
|
}
|
||||||
m_progressDialog->close();
|
|
||||||
m_progressDialog = nullptr;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qDebug() << "ADSBDemodGUI::downloadFinished: Unexpected filename: " << filename;
|
qDebug() << "ADSBDemodGUI::downloadFinished: Unexpected filename: " << filename;
|
||||||
m_progressDialog->close();
|
|
||||||
m_progressDialog = nullptr;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
if (closeDialog && m_progressDialog)
|
||||||
{
|
{
|
||||||
m_progressDialog->close();
|
m_progressDialog->close();
|
||||||
|
delete m_progressDialog;
|
||||||
m_progressDialog = nullptr;
|
m_progressDialog = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -980,12 +980,16 @@ QString VORDemodGUI::getVORDBFilename()
|
||||||
|
|
||||||
void VORDemodGUI::updateDownloadProgress(qint64 bytesRead, qint64 totalBytes)
|
void VORDemodGUI::updateDownloadProgress(qint64 bytesRead, qint64 totalBytes)
|
||||||
{
|
{
|
||||||
m_progressDialog->setMaximum(totalBytes);
|
if (m_progressDialog)
|
||||||
m_progressDialog->setValue(bytesRead);
|
{
|
||||||
|
m_progressDialog->setMaximum(totalBytes);
|
||||||
|
m_progressDialog->setValue(bytesRead);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void VORDemodGUI::downloadFinished(const QString& filename, bool success)
|
void VORDemodGUI::downloadFinished(const QString& filename, bool success)
|
||||||
{
|
{
|
||||||
|
bool closeDialog = true;
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
if (filename == getVORDBFilename())
|
if (filename == getVORDBFilename())
|
||||||
|
@ -993,8 +997,6 @@ void VORDemodGUI::downloadFinished(const QString& filename, bool success)
|
||||||
m_vors = NavAid::readNavAidsDB(filename);
|
m_vors = NavAid::readNavAidsDB(filename);
|
||||||
if (m_vors != nullptr)
|
if (m_vors != nullptr)
|
||||||
updateVORs();
|
updateVORs();
|
||||||
m_progressDialog->close();
|
|
||||||
m_progressDialog = nullptr;
|
|
||||||
}
|
}
|
||||||
else if (filename == getOpenAIPVORDBFilename(m_countryIndex))
|
else if (filename == getOpenAIPVORDBFilename(m_countryIndex))
|
||||||
{
|
{
|
||||||
|
@ -1007,30 +1009,31 @@ void VORDemodGUI::downloadFinished(const QString& filename, bool success)
|
||||||
m_progressDialog->setLabelText(QString("Downloading %1.").arg(urlString));
|
m_progressDialog->setLabelText(QString("Downloading %1.").arg(urlString));
|
||||||
m_progressDialog->setValue(m_countryIndex);
|
m_progressDialog->setValue(m_countryIndex);
|
||||||
m_dlm.download(dbURL, vorDBFile);
|
m_dlm.download(dbURL, vorDBFile);
|
||||||
|
closeDialog = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
readNavAids();
|
readNavAids();
|
||||||
if (m_vors != nullptr)
|
if (m_vors != nullptr)
|
||||||
updateVORs();
|
updateVORs();
|
||||||
m_progressDialog->close();
|
|
||||||
m_progressDialog = nullptr;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qDebug() << "VORDemodGUI::downloadFinished: Unexpected filename: " << filename;
|
qDebug() << "VORDemodGUI::downloadFinished: Unexpected filename: " << filename;
|
||||||
m_progressDialog->close();
|
|
||||||
m_progressDialog = nullptr;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qDebug() << "VORDemodGUI::downloadFinished: Failed: " << filename;
|
qDebug() << "VORDemodGUI::downloadFinished: Failed: " << filename;
|
||||||
m_progressDialog->close();
|
|
||||||
m_progressDialog = nullptr;
|
|
||||||
QMessageBox::warning(this, "Download failed", QString("Failed to download %1").arg(filename));
|
QMessageBox::warning(this, "Download failed", QString("Failed to download %1").arg(filename));
|
||||||
}
|
}
|
||||||
|
if (closeDialog && m_progressDialog)
|
||||||
|
{
|
||||||
|
m_progressDialog->close();
|
||||||
|
delete m_progressDialog;
|
||||||
|
m_progressDialog = nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void VORDemodGUI::on_getOurAirportsVORDB_clicked(bool checked)
|
void VORDemodGUI::on_getOurAirportsVORDB_clicked(bool checked)
|
||||||
|
@ -1046,7 +1049,6 @@ void VORDemodGUI::on_getOurAirportsVORDB_clicked(bool checked)
|
||||||
// Download OurAirports navaid database to disk
|
// Download OurAirports navaid database to disk
|
||||||
QUrl dbURL(QString(OURAIRPORTS_NAVAIDS_URL));
|
QUrl dbURL(QString(OURAIRPORTS_NAVAIDS_URL));
|
||||||
m_progressDialog = new QProgressDialog(this);
|
m_progressDialog = new QProgressDialog(this);
|
||||||
m_progressDialog->setAttribute(Qt::WA_DeleteOnClose);
|
|
||||||
m_progressDialog->setCancelButton(nullptr);
|
m_progressDialog->setCancelButton(nullptr);
|
||||||
m_progressDialog->setMinimumDuration(500);
|
m_progressDialog->setMinimumDuration(500);
|
||||||
m_progressDialog->setLabelText(QString("Downloading %1.").arg(OURAIRPORTS_NAVAIDS_URL));
|
m_progressDialog->setLabelText(QString("Downloading %1.").arg(OURAIRPORTS_NAVAIDS_URL));
|
||||||
|
@ -1071,7 +1073,6 @@ void VORDemodGUI::on_getOpenAIPVORDB_clicked(bool checked)
|
||||||
QString urlString = getOpenAIPVORDBURL(m_countryIndex);
|
QString urlString = getOpenAIPVORDBURL(m_countryIndex);
|
||||||
QUrl dbURL(urlString);
|
QUrl dbURL(urlString);
|
||||||
m_progressDialog = new QProgressDialog(this);
|
m_progressDialog = new QProgressDialog(this);
|
||||||
m_progressDialog->setAttribute(Qt::WA_DeleteOnClose);
|
|
||||||
m_progressDialog->setCancelButton(nullptr);
|
m_progressDialog->setCancelButton(nullptr);
|
||||||
m_progressDialog->setMinimumDuration(500);
|
m_progressDialog->setMinimumDuration(500);
|
||||||
m_progressDialog->setMaximum(sizeof(countryCodes)/sizeof(countryCodes[0]));
|
m_progressDialog->setMaximum(sizeof(countryCodes)/sizeof(countryCodes[0]));
|
||||||
|
|
|
@ -113,8 +113,11 @@ bool MapBeaconDialog::confirmDownload(QString filename)
|
||||||
|
|
||||||
void MapBeaconDialog::updateDownloadProgress(qint64 bytesRead, qint64 totalBytes)
|
void MapBeaconDialog::updateDownloadProgress(qint64 bytesRead, qint64 totalBytes)
|
||||||
{
|
{
|
||||||
m_progressDialog->setMaximum(totalBytes);
|
if (m_progressDialog)
|
||||||
m_progressDialog->setValue(bytesRead);
|
{
|
||||||
|
m_progressDialog->setMaximum(totalBytes);
|
||||||
|
m_progressDialog->setValue(bytesRead);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapBeaconDialog::accept()
|
void MapBeaconDialog::accept()
|
||||||
|
@ -132,7 +135,6 @@ void MapBeaconDialog::on_downloadIARU_clicked()
|
||||||
// Download IARU beacons database to disk
|
// Download IARU beacons database to disk
|
||||||
QUrl dbURL(QString(IARU_BEACONS_URL));
|
QUrl dbURL(QString(IARU_BEACONS_URL));
|
||||||
m_progressDialog = new QProgressDialog(this);
|
m_progressDialog = new QProgressDialog(this);
|
||||||
m_progressDialog->setAttribute(Qt::WA_DeleteOnClose);
|
|
||||||
m_progressDialog->setCancelButton(nullptr);
|
m_progressDialog->setCancelButton(nullptr);
|
||||||
m_progressDialog->setMinimumDuration(500);
|
m_progressDialog->setMinimumDuration(500);
|
||||||
m_progressDialog->setLabelText(QString("Downloading %1.").arg(IARU_BEACONS_URL));
|
m_progressDialog->setLabelText(QString("Downloading %1.").arg(IARU_BEACONS_URL));
|
||||||
|
@ -151,23 +153,23 @@ void MapBeaconDialog::downloadFinished(const QString& filename, bool success)
|
||||||
QList<Beacon *> *beacons = Beacon::readIARUCSV(filename);
|
QList<Beacon *> *beacons = Beacon::readIARUCSV(filename);
|
||||||
if (beacons != nullptr)
|
if (beacons != nullptr)
|
||||||
m_gui->setBeacons(beacons);
|
m_gui->setBeacons(beacons);
|
||||||
m_progressDialog->close();
|
|
||||||
m_progressDialog = nullptr;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qDebug() << "MapBeaconDialog::downloadFinished: Unexpected filename: " << filename;
|
qDebug() << "MapBeaconDialog::downloadFinished: Unexpected filename: " << filename;
|
||||||
m_progressDialog->close();
|
|
||||||
m_progressDialog = nullptr;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qDebug() << "MapBeaconDialog::downloadFinished: Failed: " << filename;
|
qDebug() << "MapBeaconDialog::downloadFinished: Failed: " << filename;
|
||||||
m_progressDialog->close();
|
|
||||||
m_progressDialog = nullptr;
|
|
||||||
QMessageBox::warning(this, "Download failed", QString("Failed to download %1").arg(filename));
|
QMessageBox::warning(this, "Download failed", QString("Failed to download %1").arg(filename));
|
||||||
}
|
}
|
||||||
|
if (m_progressDialog)
|
||||||
|
{
|
||||||
|
m_progressDialog->close();
|
||||||
|
delete m_progressDialog;
|
||||||
|
m_progressDialog = nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapBeaconDialog::on_beacons_cellDoubleClicked(int row, int column)
|
void MapBeaconDialog::on_beacons_cellDoubleClicked(int row, int column)
|
||||||
|
|
|
@ -1013,12 +1013,16 @@ QString VORLocalizerGUI::getVORDBFilename()
|
||||||
|
|
||||||
void VORLocalizerGUI::updateDownloadProgress(qint64 bytesRead, qint64 totalBytes)
|
void VORLocalizerGUI::updateDownloadProgress(qint64 bytesRead, qint64 totalBytes)
|
||||||
{
|
{
|
||||||
m_progressDialog->setMaximum(totalBytes);
|
if (m_progressDialog)
|
||||||
m_progressDialog->setValue(bytesRead);
|
{
|
||||||
|
m_progressDialog->setMaximum(totalBytes);
|
||||||
|
m_progressDialog->setValue(bytesRead);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void VORLocalizerGUI::downloadFinished(const QString& filename, bool success)
|
void VORLocalizerGUI::downloadFinished(const QString& filename, bool success)
|
||||||
{
|
{
|
||||||
|
bool closeDialog = true;
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
if (filename == getVORDBFilename())
|
if (filename == getVORDBFilename())
|
||||||
|
@ -1028,9 +1032,6 @@ void VORLocalizerGUI::downloadFinished(const QString& filename, bool success)
|
||||||
if (m_vors != nullptr) {
|
if (m_vors != nullptr) {
|
||||||
updateVORs();
|
updateVORs();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_progressDialog->close();
|
|
||||||
m_progressDialog = nullptr;
|
|
||||||
}
|
}
|
||||||
else if (filename == getOpenAIPVORDBFilename(m_countryIndex))
|
else if (filename == getOpenAIPVORDBFilename(m_countryIndex))
|
||||||
{
|
{
|
||||||
|
@ -1044,6 +1045,7 @@ void VORLocalizerGUI::downloadFinished(const QString& filename, bool success)
|
||||||
m_progressDialog->setLabelText(QString("Downloading %1.").arg(urlString));
|
m_progressDialog->setLabelText(QString("Downloading %1.").arg(urlString));
|
||||||
m_progressDialog->setValue(m_countryIndex);
|
m_progressDialog->setValue(m_countryIndex);
|
||||||
m_dlm.download(dbURL, vorDBFile);
|
m_dlm.download(dbURL, vorDBFile);
|
||||||
|
closeDialog = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1052,25 +1054,24 @@ void VORLocalizerGUI::downloadFinished(const QString& filename, bool success)
|
||||||
if (m_vors) {
|
if (m_vors) {
|
||||||
updateVORs();
|
updateVORs();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_progressDialog->close();
|
|
||||||
m_progressDialog = nullptr;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qDebug() << "VORLocalizerGUI::downloadFinished: Unexpected filename: " << filename;
|
qDebug() << "VORLocalizerGUI::downloadFinished: Unexpected filename: " << filename;
|
||||||
m_progressDialog->close();
|
|
||||||
m_progressDialog = nullptr;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qDebug() << "VORLocalizerGUI::downloadFinished: Failed: " << filename;
|
qDebug() << "VORLocalizerGUI::downloadFinished: Failed: " << filename;
|
||||||
m_progressDialog->close();
|
|
||||||
m_progressDialog = nullptr;
|
|
||||||
QMessageBox::warning(this, "Download failed", QString("Failed to download %1").arg(filename));
|
QMessageBox::warning(this, "Download failed", QString("Failed to download %1").arg(filename));
|
||||||
}
|
}
|
||||||
|
if (closeDialog && m_progressDialog)
|
||||||
|
{
|
||||||
|
m_progressDialog->close();
|
||||||
|
delete m_progressDialog;
|
||||||
|
m_progressDialog = nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void VORLocalizerGUI::on_startStop_toggled(bool checked)
|
void VORLocalizerGUI::on_startStop_toggled(bool checked)
|
||||||
|
@ -1094,7 +1095,6 @@ void VORLocalizerGUI::on_getOurAirportsVORDB_clicked()
|
||||||
// Download OurAirports navaid database to disk
|
// Download OurAirports navaid database to disk
|
||||||
QUrl dbURL(QString(OURAIRPORTS_NAVAIDS_URL));
|
QUrl dbURL(QString(OURAIRPORTS_NAVAIDS_URL));
|
||||||
m_progressDialog = new QProgressDialog(this);
|
m_progressDialog = new QProgressDialog(this);
|
||||||
m_progressDialog->setAttribute(Qt::WA_DeleteOnClose);
|
|
||||||
m_progressDialog->setCancelButton(nullptr);
|
m_progressDialog->setCancelButton(nullptr);
|
||||||
m_progressDialog->setMinimumDuration(500);
|
m_progressDialog->setMinimumDuration(500);
|
||||||
m_progressDialog->setLabelText(QString("Downloading %1.").arg(OURAIRPORTS_NAVAIDS_URL));
|
m_progressDialog->setLabelText(QString("Downloading %1.").arg(OURAIRPORTS_NAVAIDS_URL));
|
||||||
|
@ -1118,7 +1118,6 @@ void VORLocalizerGUI::on_getOpenAIPVORDB_clicked()
|
||||||
QString urlString = getOpenAIPVORDBURL(m_countryIndex);
|
QString urlString = getOpenAIPVORDBURL(m_countryIndex);
|
||||||
QUrl dbURL(urlString);
|
QUrl dbURL(urlString);
|
||||||
m_progressDialog = new QProgressDialog(this);
|
m_progressDialog = new QProgressDialog(this);
|
||||||
m_progressDialog->setAttribute(Qt::WA_DeleteOnClose);
|
|
||||||
m_progressDialog->setCancelButton(nullptr);
|
m_progressDialog->setCancelButton(nullptr);
|
||||||
m_progressDialog->setMinimumDuration(500);
|
m_progressDialog->setMinimumDuration(500);
|
||||||
m_progressDialog->setMaximum(sizeof(countryCodes)/sizeof(countryCodes[0]));
|
m_progressDialog->setMaximum(sizeof(countryCodes)/sizeof(countryCodes[0]));
|
||||||
|
|
|
@ -32,14 +32,16 @@ QNetworkReply *HttpDownloadManagerGUI::download(const QUrl &url, const QString &
|
||||||
if (parent != nullptr)
|
if (parent != nullptr)
|
||||||
{
|
{
|
||||||
QProgressDialog *progressDialog = new QProgressDialog(parent);
|
QProgressDialog *progressDialog = new QProgressDialog(parent);
|
||||||
progressDialog->setAttribute(Qt::WA_DeleteOnClose);
|
|
||||||
progressDialog->setCancelButton(nullptr);
|
progressDialog->setCancelButton(nullptr);
|
||||||
progressDialog->setMinimumDuration(500);
|
progressDialog->setMinimumDuration(500);
|
||||||
progressDialog->setLabelText(QString("Downloading %1.").arg(url.toString()));
|
progressDialog->setLabelText(QString("Downloading %1.").arg(url.toString()));
|
||||||
m_progressDialogs.append(progressDialog);
|
m_progressDialogs.append(progressDialog);
|
||||||
connect(reply, &QNetworkReply::downloadProgress, this, [progressDialog](qint64 bytesRead, qint64 totalBytes) {
|
connect(reply, &QNetworkReply::downloadProgress, this, [progressDialog](qint64 bytesRead, qint64 totalBytes) {
|
||||||
progressDialog->setMaximum(totalBytes);
|
if (progressDialog)
|
||||||
progressDialog->setValue(bytesRead);
|
{
|
||||||
|
progressDialog->setMaximum(totalBytes);
|
||||||
|
progressDialog->setValue(bytesRead);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -75,7 +77,10 @@ void HttpDownloadManagerGUI::downloadCompleteGUI(const QString& filename, bool s
|
||||||
{
|
{
|
||||||
QProgressDialog *progressDialog = m_progressDialogs[idx];
|
QProgressDialog *progressDialog = m_progressDialogs[idx];
|
||||||
if (progressDialog != nullptr)
|
if (progressDialog != nullptr)
|
||||||
|
{
|
||||||
progressDialog->close();
|
progressDialog->close();
|
||||||
|
delete progressDialog;
|
||||||
|
}
|
||||||
m_filenames.remove(idx);
|
m_filenames.remove(idx);
|
||||||
m_progressDialogs.remove(idx);
|
m_progressDialogs.remove(idx);
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue