Use downloadProgress rather than isFinished (which worked on files, but didn't

on HTTP URLs).
This commit is contained in:
Andrzej Kapolka 2013-06-04 17:44:19 -07:00
parent f403fc33f7
commit b30b64c5b5
2 changed files with 4 additions and 4 deletions

View file

@ -88,7 +88,7 @@ void AvatarVoxelSystem::loadVoxelsFromURL(const QUrl& url) {
return; return;
} }
_voxelReply = Application::getInstance()->getNetworkAccessManager()->get(QNetworkRequest(url)); _voxelReply = Application::getInstance()->getNetworkAccessManager()->get(QNetworkRequest(url));
connect(_voxelReply, SIGNAL(readyRead()), SLOT(readVoxelDataFromReply())); connect(_voxelReply, SIGNAL(downloadProgress(qint64,qint64)), SLOT(handleVoxelDownloadProgress(qint64,qint64)));
connect(_voxelReply, SIGNAL(error(QNetworkReply::NetworkError)), SLOT(handleVoxelReplyError())); connect(_voxelReply, SIGNAL(error(QNetworkReply::NetworkError)), SLOT(handleVoxelReplyError()));
} }
@ -181,9 +181,9 @@ void AvatarVoxelSystem::removeScaleAndReleaseProgram(bool texture) {
_skinProgram->disableAttributeArray(_boneWeightsLocation); _skinProgram->disableAttributeArray(_boneWeightsLocation);
} }
void AvatarVoxelSystem::readVoxelDataFromReply() { void AvatarVoxelSystem::handleVoxelDownloadProgress(qint64 bytesReceived, qint64 bytesTotal) {
// for now, just wait until we have the full business // for now, just wait until we have the full business
if (!_voxelReply->isFinished()) { if (bytesReceived < bytesTotal) {
return; return;
} }
QByteArray entirety = _voxelReply->readAll(); QByteArray entirety = _voxelReply->readAll();

View file

@ -46,7 +46,7 @@ protected:
private slots: private slots:
void readVoxelDataFromReply(); void handleVoxelDownloadProgress(qint64 bytesReceived, qint64 bytesTotal);
void handleVoxelReplyError(); void handleVoxelReplyError();
private: private: