aboutsummaryrefslogtreecommitdiff
path: root/src/aoimage.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/aoimage.cpp')
-rw-r--r--src/aoimage.cpp36
1 files changed, 21 insertions, 15 deletions
diff --git a/src/aoimage.cpp b/src/aoimage.cpp
index e1bd8b8c..656528e3 100644
--- a/src/aoimage.cpp
+++ b/src/aoimage.cpp
@@ -4,18 +4,22 @@
#include <QBitmap>
-AOImage::AOImage(QWidget *parent, AOApplication *p_ao_app) : QLabel(parent)
+AOImage::AOImage(QWidget *parent, AOApplication *p_ao_app, bool make_static) : QLabel(parent)
{
m_parent = parent;
ao_app = p_ao_app;
- movie = new QMovie();
- connect(movie, &QMovie::frameChanged, [=]{
- QPixmap f_pixmap = movie->currentPixmap();
- f_pixmap =
- f_pixmap.scaled(this->size(), Qt::IgnoreAspectRatio);
- this->setPixmap(f_pixmap);
- this->setMask(f_pixmap.mask());
- });
+ is_static = make_static;
+ if (!is_static) // Only create the QMovie if we're non-static
+ {
+ movie = new QMovie(this);
+ connect(movie, &QMovie::frameChanged, [=]{
+ QPixmap f_pixmap = movie->currentPixmap();
+ f_pixmap =
+ f_pixmap.scaled(this->size(), Qt::IgnoreAspectRatio);
+ this->setPixmap(f_pixmap);
+ this->setMask(f_pixmap.mask());
+ });
+ }
}
AOImage::~AOImage() {}
@@ -23,7 +27,7 @@ AOImage::~AOImage() {}
bool AOImage::set_image(QString p_path, QString p_misc)
{
// Check if the user wants animated themes
- if (ao_app->get_animated_theme())
+ if (!is_static && ao_app->get_animated_theme())
// We want an animated image
p_path = ao_app->get_image(p_path, ao_app->current_theme, ao_app->get_subtheme(), ao_app->default_theme, p_misc);
else
@@ -35,12 +39,14 @@ bool AOImage::set_image(QString p_path, QString p_misc)
return false;
}
path = p_path;
- movie->stop();
- movie->setFileName(path);
- if (ao_app->get_animated_theme() && movie->frameCount() > 1) {
- movie->start();
+ if (!is_static) {
+ movie->stop();
+ movie->setFileName(path);
+ if (ao_app->get_animated_theme() && movie->frameCount() > 1) {
+ movie->start();
+ }
}
- else {
+ if (is_static || !ao_app->get_animated_theme() || movie->frameCount() <= 1) {
QPixmap f_pixmap(path);
f_pixmap =