Use new DownloadManager interface

This commit is contained in:
Vladimir Golovnev (Glassez) 2018-06-25 20:31:32 +03:00 committed by sledgehammer999
parent 409e73c074
commit 9b1fa3a5af
No known key found for this signature in database
GPG key ID: 6E4A2D025B7CC9A2
15 changed files with 47 additions and 57 deletions

View file

@ -2041,11 +2041,11 @@ void MainWindow::installPython()
{
setCursor(QCursor(Qt::WaitCursor));
// Download python
Net::DownloadHandler *handler = nullptr;
if (QSysInfo::windowsVersion() >= QSysInfo::WV_VISTA)
handler = Net::DownloadManager::instance()->downloadUrl("https://www.python.org/ftp/python/3.5.2/python-3.5.2.exe", true);
else
handler = Net::DownloadManager::instance()->downloadUrl("https://www.python.org/ftp/python/3.4.4/python-3.4.4.msi", true);
const QString installerURL = ((QSysInfo::windowsVersion() >= QSysInfo::WV_VISTA)
? "https://www.python.org/ftp/python/3.5.2/python-3.5.2.exe"
: "https://www.python.org/ftp/python/3.4.4/python-3.4.4.msi");
Net::DownloadHandler *handler = Net::DownloadManager::instance()->download(
Net::DownloadRequest(installerURL).saveToFile(true));
using Func = void (Net::DownloadHandler::*)(const QString &, const QString &);
connect(handler, static_cast<Func>(&Net::DownloadHandler::downloadFinished), this, &MainWindow::pythonDownloadSuccess);