diff --git a/include/aoscene.h b/include/aoscene.h index b58c0fd..ddbefe0 100644 --- a/include/aoscene.h +++ b/include/aoscene.h @@ -21,6 +21,7 @@ private: QWidget *m_parent; QMovie *m_movie; AOApplication *ao_app; + QString last_image; }; diff --git a/src/aoscene.cpp b/src/aoscene.cpp index 6d2dc89..0f4e745 100644 --- a/src/aoscene.cpp +++ b/src/aoscene.cpp @@ -7,6 +7,7 @@ AOScene::AOScene(QWidget *parent, AOApplication *p_ao_app) : QLabel(parent) m_parent = parent; ao_app = p_ao_app; m_movie = new QMovie(this); + last_image = ""; } void AOScene::set_image(QString p_image) @@ -15,6 +16,9 @@ void AOScene::set_image(QString p_image) QString default_path = ao_app->get_default_background_path(p_image + ".png"); QString animated_background_path = ao_app->get_image_suffix(ao_app->get_background_path(p_image)); + if (file_exists(animated_background_path) && animated_background_path == last_image) + return; + QPixmap background(background_path); QPixmap default_bg(default_path); @@ -32,11 +36,16 @@ void AOScene::set_image(QString p_image) { this->setMovie(m_movie); m_movie->start(); + last_image = animated_background_path; } else if (file_exists(background_path)) + { this->setPixmap(background.scaled(w, h)); + } else + { this->setPixmap(default_bg.scaled(w, h)); + } } void AOScene::set_legacy_desk(QString p_image) @@ -48,6 +57,9 @@ void AOScene::set_legacy_desk(QString p_image) QString animated_desk_path = ao_app->get_image_suffix(ao_app->get_background_path(p_image)); QString default_path = ao_app->get_image_suffix(ao_app->get_default_background_path(p_image)); + if (file_exists(animated_desk_path) && animated_desk_path == last_image) + return; + QPixmap f_desk; int vp_width = m_parent->width(); @@ -73,6 +85,7 @@ void AOScene::set_legacy_desk(QString p_image) { this->setMovie(m_movie); m_movie->start(); + last_image = animated_desk_path; } else {