void HttpDownloadSection::run(){ qDebug() << "Start thread download section"; QNetworkRequest request; request.setUrl(download_url); manager = new QNetworkAccessManager(0); manager->moveToThread(this); connect(manager,SIGNAL(finished(QNetworkReply*)),this,SLOT(finished(QNetworkReply*))); reply = manager->get(QNetworkRequest(QUrl(download_url))); connect(reply,SIGNAL(downloadProgress(qint64,qint64)),this,SLOT(downloadProgress(qint64,qint64))); connect(reply,SIGNAL(error(QNetworkReply::NetworkError)),this,SLOT(errorDonload(QNetworkReply::NetworkError))); exec();}
manager->get(QNetworkRequest(QUrl(download_url)));
C++ (Qt)int index = 0; for (index ; index < storage.size();) { if (storage[index].url == handle.url) { storage[index] = handle; break; } ++index; if (storage[index].url == handle.url) { storage[index] = handle; break; } ++index; if (storage[index].url == handle.url) { storage[index] = handle; break; } ++index; if (storage[index].url == handle.url) { storage[index] = handle; break; } ++index; }
C++ (Qt)int index; for (index = 0; index < storage.size(); ++index) { if (storage[index].url == handle.url) { storage[index] = handle; break; } }
C++ (Qt)if (storage[index].status != HandleFile::Error)
C++ (Qt) if ((i+1)*h_file.length > h_file.length) { listDownloadSection.append(new HttpDownloadSection(h_file.url,i*(h_file.length / h_file.count_thread ), h_file.length,h_file.accept_range,0)); listDownloadSection[listDownloadSection.count()-1]->moveToThread(this); listDownloadSection[listDownloadSection.count()-1]->start(); } else { listDownloadSection.append(new HttpDownloadSection(h_file.url,i*(h_file.length / h_file.count_thread ), (i+1)*(h_file.length / h_file.count_thread ),h_file.accept_range,0)); listDownloadSection[listDownloadSection.count()-1]->moveToThread(this); listDownloadSection[listDownloadSection.count()-1]->start(); } }
C++ (Qt)int size;if ((i+1)*h_file.length > h_file.length) size = h_file.length;else size = (i+1)*(h_file.length / h_file.count_thread ); listDownloadSection.append(new HttpDownloadSection(h_file.url,i*(h_file.length / h_file.count_thread ), size ,h_file.accept_range,0));listDownloadSection.last()->moveToThread(this);listDownloadSection.last()->start();
index < storage.size()
C++ (Qt)while (__first != __last && !(*__first == __val)) ++__first;return __first;