diff options
| author | oldmud0 <oldmud0@users.noreply.github.com> | 2021-06-06 23:23:33 -0500 |
|---|---|---|
| committer | oldmud0 <oldmud0@users.noreply.github.com> | 2021-06-06 23:23:33 -0500 |
| commit | 9ecd7c453c3b34a976869e517f9414a4b91fdb0f (patch) | |
| tree | 8a901493f6ebf1dee5792bfa2d24b60fb90cdfba /src/aoimage.cpp | |
| parent | 2ef7b206e24d9af112c8b466c006aa98e072e235 (diff) | |
| parent | 97f3d7a8bc43ee78691153bb60993ba734dbefde (diff) | |
Merge branch 'master' into feature/mounting
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 fbf8c992..82e17b98 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,19 +27,21 @@ AOImage::~AOImage() {} bool AOImage::set_image(QString p_image, QString p_misc) { p_image = ao_app->get_image(p_image, ao_app->current_theme, ao_app->get_subtheme(), - ao_app->default_theme, p_misc, "", "", !ao_app->get_animated_theme()); + ao_app->default_theme, p_misc, "", "", is_static || !ao_app->get_animated_theme()); if (!file_exists(p_image)) { qDebug() << "Warning: Image" << p_image << "not found! Can't set!"; return false; } path = p_image; - 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 = |
