Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Donald Haase
Cockatrice
Commits
0420f4f7
Commit
0420f4f7
authored
Jun 23, 2014
by
Daenyth
Browse files
Log download failures
parent
632e7f48
Changes
2
Hide whitespace changes
Inline
Side-by-side
cockatrice/src/carddatabase.cpp
View file @
0420f4f7
...
...
@@ -132,7 +132,7 @@ void PictureLoader::processLoadQueue()
}
continue
;
}
emit
imageLoaded
(
ptl
.
getCard
(),
image
);
}
}
...
...
@@ -176,6 +176,10 @@ void PictureLoader::startNextPicDownload()
void
PictureLoader
::
picDownloadFinished
(
QNetworkReply
*
reply
)
{
QString
picsPath
=
_picsPath
;
if
(
reply
->
error
())
{
qDebug
()
<<
"Download failed:"
<<
reply
->
errorString
();
}
const
QByteArray
&
picData
=
reply
->
readAll
();
QImage
testImage
;
if
(
testImage
.
loadFromData
(
picData
))
{
...
...
@@ -189,17 +193,17 @@ void PictureLoader::picDownloadFinished(QNetworkReply *reply)
QDir
dir
(
QString
(
picsPath
+
"/downloadedPics"
));
dir
.
mkdir
(
cardBeingDownloaded
.
getSetName
());
}
QString
suffix
;
if
(
!
cardBeingDownloaded
.
getStripped
())
suffix
=
".full"
;
QFile
newPic
(
picsPath
+
"/downloadedPics/"
+
cardBeingDownloaded
.
getSetName
()
+
"/"
+
cardBeingDownloaded
.
getCard
()
->
getCorrectedName
()
+
suffix
+
".jpg"
);
if
(
!
newPic
.
open
(
QIODevice
::
WriteOnly
))
return
;
newPic
.
write
(
picData
);
newPic
.
close
();
emit
imageLoaded
(
cardBeingDownloaded
.
getCard
(),
testImage
);
}
else
if
(
cardBeingDownloaded
.
getHq
())
{
qDebug
()
<<
"HQ: received invalid picture. URL:"
<<
reply
->
request
().
url
();
...
...
@@ -216,7 +220,7 @@ void PictureLoader::picDownloadFinished(QNetworkReply *reply)
}
else
emit
imageLoaded
(
cardBeingDownloaded
.
getCard
(),
QImage
());
}
reply
->
deleteLater
();
startNextPicDownload
();
}
...
...
@@ -224,7 +228,7 @@ void PictureLoader::picDownloadFinished(QNetworkReply *reply)
void
PictureLoader
::
loadImage
(
CardInfo
*
card
,
bool
stripped
)
{
QMutexLocker
locker
(
&
mutex
);
loadQueue
.
append
(
PictureToLoad
(
card
,
stripped
));
emit
startLoadQueue
();
}
...
...
cockatrice/src/carddatabase.h
View file @
0420f4f7
...
...
@@ -53,10 +53,8 @@ public:
bool
getStripped
()
const
{
return
stripped
;
}
QString
getSetName
()
const
{
return
sortedSets
[
setIndex
]
->
getShortName
();
}
bool
nextSet
();
bool
getHq
()
const
{
return
hq
;
}
void
setHq
(
bool
_hq
)
{
hq
=
_hq
;
}
};
class
PictureLoader
:
public
QObject
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment