diff options
| author | Crystalwarrior <varsash@gmail.com> | 2021-04-23 16:12:35 +0300 |
|---|---|---|
| committer | Crystalwarrior <varsash@gmail.com> | 2021-04-23 16:12:35 +0300 |
| commit | de4115e20ab800e7ebd639cd37de6df0cd7c72f9 (patch) | |
| tree | ca681bc94843767afdec4a0c21af8e294e8a707e /src/aoimage.cpp | |
| parent | 43340e88695b2adc7b8fc8141540178727fd8869 (diff) | |
| parent | 5fca08537b6f2c6c581156c4dc07bc9ba61b17ef (diff) | |
Merge branch 'master' into crystalwarrior/demo-reload
Diffstat (limited to 'src/aoimage.cpp')
| -rw-r--r-- | src/aoimage.cpp | 36 |
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 = |
