MCPcopy Create free account
hub / github.com/c3d/tao3D / checkReply

Method checkReply

tao/texture_cache.cpp:932–985  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

930
931
932void CachedTexture::checkReply(QNetworkReply *reply)
933// ----------------------------------------------------------------------------
934// Process network reply completion (success or error)
935// ----------------------------------------------------------------------------
936{
937 // Check if this is for me
938 if (reply != networkReply)
939 return;
940
941 if (networked &&
942 image.isNull())
943 {
944 QNetworkRequest::Attribute
945 attr = QNetworkRequest::HttpStatusCodeAttribute;
946 int code = networkReply->attribute(attr).toInt();
947
948 if (reply->error() == QNetworkReply::NoError)
949 {
950 IFTRACE(texturecache)
951 {
952 debug() << "Received response for: '" << +path << "' (HTTP "
953 << "status: " << code << ")\n";
954 }
955 if (code >= 300 && code <= 400)
956 {
957 // Redirected
958 networkReply->deleteLater();
959 QNetworkRequest::Attribute
960 attr = QNetworkRequest::RedirectionTargetAttribute;
961 QUrl url = reply->attribute(attr).toUrl();
962 IFTRACE(texturecache)
963 debug() << "Redirected to: '" << +url.toString() << "'\n";
964 QNetworkRequest req(url);
965 networkReply = cache.network.get(req);
966 return;
967 }
968 }
969 else
970 {
971 IFTRACE(texturecache)
972 {
973 debug() << "Error downloading '" << +path << "' ("
974 << +reply->errorString() << ")\n";
975 }
976 }
977 // Show received image, or error placeholder
978 reload();
979 networkReply->deleteLater();
980 networkReply = NULL;
981 // A simple update is not enough here: the texture id has not yet been
982 // returned, so a XL refresh is needed
983 Widget::postEventAPI(cache.textureChangedEvent());
984 }
985}
986
987
988void CachedTexture::reload()

Callers

nothing calls this directly

Calls 5

isNullMethod · 0.80
textureChangedEventMethod · 0.80
IFTRACEFunction · 0.70
toStringMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected