Advertisement
Guest User

Untitled

a guest
Jul 15th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void Downloader::startDownloading(){
  2.     QNetworkAccessManager mgr;
  3.     //QNetworkRequest req( getDownloadUrl() );
  4.     QNetworkRequest req( QUrl("https://www.dropbox.com/s/g29l7e7j59lrhv1/MTA%2025_06_2017.zip?dl=1") );
  5.  
  6.  
  7.  
  8.     QSslConfiguration conf = req.sslConfiguration();
  9.     conf.setPeerVerifyMode(QSslSocket::VerifyNone);
  10.     req.setSslConfiguration(conf);
  11.  
  12.  
  13.     QNetworkReply *reply = mgr.get(req);
  14.     connect(reply, SIGNAL(downloadProgress(qint64,qint64)), this, SLOT(networkReplyProgress(qint64,qint64)));
  15.     eventLoop.exec();
  16.     if (reply->error() == QNetworkReply::NoError) {
  17.         QString url = getSteamFolder().append("/paczka.zip");
  18.         url.remove(0,8);
  19.         QFile file(url);
  20.  
  21.         file.open(QIODevice::WriteOnly );
  22.         file.write(reply->readAll());
  23.         file.close();
  24.         qDebug() << "File downloaded.";
  25.         delete reply;
  26.     }
  27.     else {
  28.         qDebug() << "Error while downloading file " <<reply->errorString();
  29.         delete reply;
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement