Index: mythtv/libs/libmythui/mythuiimage.cpp =================================================================== --- mythtv/libs/libmythui/mythuiimage.cpp (revision 25434) +++ mythtv/libs/libmythui/mythuiimage.cpp (working copy) @@ -238,7 +238,7 @@ m_isGreyscale = false; m_preserveAspect = false; - + m_animationCycle = kCycleStart; m_animationReverse = false; } @@ -388,6 +388,8 @@ aSize = aSize.expandedTo(im->size()); } + SetImageCount(1, m_Images.size()); + if (m_ForceSize.isNull()) SetSize(aSize); @@ -518,6 +520,13 @@ Clear(); + QString extension = filename.section('.', -1); + if (extension == "gif") + { + if (QImageReader(filename).imageCount() > 1) + return LoadAnimatedImage(filename); + } + // SetRedraw(); // if (!IsVisible(true)) @@ -812,6 +821,40 @@ return image; } +bool MythUIImage::LoadAnimatedImage(const QString &imFile) +{ + QVector images; + QString filename = imFile; + if (!GetMythUI()->FindThemeFile(filename)) + return false; + + QImageReader reader(filename); + + if (!reader.supportsAnimation()) + return false; + + while (1) + { + MythImage *im = GetMythPainter()->GetFormatImage(); + reader.read(im); + if (im->isNull()) + { + im->DownRef(); + break; + } + images.append(im); + } + + if (images.size() > 0) + { + m_Delay = reader.nextImageDelay(); + SetImages(images); + return true; + } + + return true; +} + /** * \copydoc MythUIType::Pulse() */ @@ -845,7 +888,7 @@ else ++m_CurPos; } - + m_ImagesLock.unlock(); SetRedraw(); Index: mythtv/libs/libmythui/mythuiimage.h =================================================================== --- mythtv/libs/libmythui/mythuiimage.h (revision 25434) +++ mythtv/libs/libmythui/mythuiimage.h (working copy) @@ -66,6 +66,7 @@ void Clear(void); MythImage* LoadImage(const QString &imFile, int imageNumber, QSize bForceSize); + bool LoadAnimatedImage(const QString &filename); void customEvent(QEvent *event); virtual bool ParseElement( @@ -131,7 +132,7 @@ enum AnimationCycle {kCycleStart, kCycleReverse}; AnimationCycle m_animationCycle; bool m_animationReverse; - + friend class MythThemeBase; friend class MythUIButtonListItem; friend class MythUIProgressBar;