+
+ if (m_status != Downloading) {
+
+ int neededBytes = (int) (bytesTotal * .001);
+ // qDebug() << bytesReceived << bytesTotal << neededBytes << m_downloadTime.elapsed();
+ int bufferSize = initialBufferSize();
+ if (bytesReceived > bufferSize
+ && bytesReceived > neededBytes
+ && (m_downloadTime.elapsed() > 1000)) {
+ emit bufferProgress(100);
+ m_status = Downloading;
+ emit statusChanged();
+ } else {
+ int bufferPercent = bytesReceived * 100 / qMax(bufferSize, neededBytes);
+ emit bufferProgress(bufferPercent);
+ }
+
+ } else {
+
+ if (bytesTotal > 0) {
+ int percent = bytesReceived * 100 / bytesTotal;
+ if (percent != this->percent) {
+ this->percent = percent;
+ emit progress(percent);
+ }
+ }
+