gwenview: adjust to Katie changes

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2024-04-11 00:29:47 +03:00
parent cd96e2b642
commit 3d8fd628df
2 changed files with 6 additions and 33 deletions

View file

@ -96,12 +96,6 @@ bool AnimatedDocumentLoadedImpl::isAnimated() const
void AnimatedDocumentLoadedImpl::startAnimation()
{
d->mMovie.start();
if (d->mMovie.state() == QMovie::NotRunning) {
// This is true with qt-copy as of 2008.08.23
kDebug() << "QMovie didn't start. This can happen in some cases when starting for the second time.";
kDebug() << "Trying to start again, it usually fixes the bug.";
d->mMovie.start();
}
}
void AnimatedDocumentLoadedImpl::stopAnimation()

View file

@ -208,40 +208,19 @@ struct LoadingDocumentImplPrivate
}
}
bool ok = reader.read(&mImage);
if (!ok) {
kDebug() << "QImageReader::read() failed";
return;
}
if (reader.supportsAnimation()
&& reader.nextImageDelay() > 0 // Assume delay == 0 <=> only one frame
) {
if (reader.supportsAnimation() && reader.jumpToImage(0)) {
if (reader.imageCount() > 0) {
kDebug() << "Really an animated image";
mAnimated = true;
return;
}
/*
* QImageReader is not really helpful to detect animated images:
* - QImageReader::imageCount() returns 0
* - QImageReader::nextImageDelay() may return something > 0 if the
* image consists of only one frame but includes a "Graphic
* Control Extension" (usually only present if we have an
* animation) (Bug #185523)
*
* Decoding the next frame is the only reliable way I found to
* detect an animated images
*/
kDebug() << "May be an animated image. delay:" << reader.nextImageDelay();
QImage nextImage;
if (reader.read(&nextImage)) {
kDebug() << "Really an animated image (more than one frame)";
mAnimated = true;
} else {
kWarning() << q->document()->url() << "is not really an animated image (only one frame)";
}
}
bool ok = reader.read(&mImage);
if (!ok) {
kWarning() << "QImageReader::read() failed";
}
}
};