Use new DownloadManager interface

This commit is contained in:
Vladimir Golovnev (Glassez) 2018-06-25 20:31:32 +03:00
parent 8d438e159c
commit 112a9bcfa2
No known key found for this signature in database
GPG key ID: 52A2C7DEE2DFA6F7
15 changed files with 47 additions and 57 deletions

View file

@ -2043,11 +2043,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);