Don't reset the cover image until scaling is done

This commit is contained in:
Slava Monich 2015-07-06 17:46:41 +03:00
parent 54247bb4d0
commit dfe56dcfc1

View file

@ -333,8 +333,7 @@ void BooksCoverWidget::onSizeChanged()
bool BooksCoverWidget::empty() const bool BooksCoverWidget::empty() const
{ {
return !iBook || !iBook->hasCoverImage() || return !iBook || !iBook->hasCoverImage() || iScaledImage.isNull();
iScaleTask || iScaledImage.isNull();
} }
bool BooksCoverWidget::loading() const bool BooksCoverWidget::loading() const
@ -347,7 +346,6 @@ void BooksCoverWidget::scaleImage(bool aWasEmpty)
const int w = width(); const int w = width();
const int h = height(); const int h = height();
iScaledImage = QImage();
if (iScaleTask) { if (iScaleTask) {
iScaleTask->release(this); iScaleTask->release(this);
iScaleTask = NULL; iScaleTask = NULL;
@ -370,14 +368,16 @@ void BooksCoverWidget::scaleImage(bool aWasEmpty)
iScaledImage = ScaleTask::scale(iCoverImage, w, h, iStretch); iScaledImage = ScaleTask::scale(iCoverImage, w, h, iStretch);
update(); update();
} else { } else {
iScaledImage = QImage();
iScaleTask = new ScaleTask(iCoverImage, w, h, iStretch); iScaleTask = new ScaleTask(iCoverImage, w, h, iStretch);
connect(iScaleTask, SIGNAL(done()), SLOT(onScaleTaskDone())); connect(iScaleTask, SIGNAL(done()), SLOT(onScaleTaskDone()));
iTaskQueue->submit(iScaleTask); iTaskQueue->submit(iScaleTask);
} }
} else { } else {
iScaledImage = QImage();
update(); update();
} }
} else {
iScaledImage = QImage();
} }
if (aWasEmpty != empty()) { if (aWasEmpty != empty()) {