void DownloadManager::startDownload(){ if (downloadUrl.isEmpty()) { emit errordownload(1); return; } output.setFileName(filename); if (!output.open(QIODevice::WriteOnly)) { emit errordownload(2); return; } QNetworkRequest request(downloadUrl); currentDownload = manager.get(request); currentDownload->setReadBufferSize(100*1024); this->downloadTimer = new QTimer(this); this->downloadTimer->start(1000); connect(currentDownload, SIGNAL(finished()),SLOT(downloadFinished())); connect(downloadTimer, SIGNAL(timeout()),SLOT(downloadReadyRead()));}void DownloadManager::downloadReadyRead(){ output.write(currentDownload->readAll()); }
QNetworkRequest request(QUrl("http://127.0.0.1/Video/Films/Fytyrama-Igra-Bendera-www.Rouminga.Ru.avi"));request.setRawHeader("Range","bytes=502400000");
QNetworkRequest request(QUrl("ftp://127.0.0.1/Video/Films/Fytyrama-Igra-Bendera-www.Rouminga.Ru.avi"));request.setRawHeader("REST","502400000");
QNetworkRequest request(QUrl("ftp://127.0.0.1/Video/Films/"));request.setRawHeader("REST","502400000");request.setRawHeader("RETR","Fytyrama-Igra-Bendera-www.Rouminga.Ru.avi");