From b30131a922290da9e9f83d09e0ee33bcfb29db30 Mon Sep 17 00:00:00 2001 From: OmniTroid Date: Sun, 21 May 2017 21:44:41 +0200 Subject: [PATCH] fixed a code error and renamed flipped_movie --- aocharmovie.cpp | 12 +++++------- aocharmovie.h | 2 +- aomovie.cpp | 2 ++ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/aocharmovie.cpp b/aocharmovie.cpp index d77ecb2..6ad2969 100644 --- a/aocharmovie.cpp +++ b/aocharmovie.cpp @@ -16,8 +16,6 @@ AOCharMovie::AOCharMovie(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_ preanim_timer = new QTimer(this); preanim_timer->setSingleShot(true); - this->setMovie(m_movie); - connect(m_movie, SIGNAL(frameChanged(int)), this, SLOT(frame_change(int))); connect(preanim_timer, SIGNAL(timeout()), this, SLOT(timer_done())); } @@ -44,14 +42,14 @@ void AOCharMovie::play(QString p_char, QString p_emote, QString emote_prefix) QImageReader *reader = new QImageReader(gif_path); - flipped_movie.clear(); + movie_frames.clear(); QImage f_image = reader->read(); while (!f_image.isNull()) { if (m_flipped) - flipped_movie.append(f_image.mirrored(true, false)); + movie_frames.append(f_image.mirrored(true, false)); else - flipped_movie.append(f_image); + movie_frames.append(f_image); f_image = reader->read(); } @@ -153,9 +151,9 @@ void AOCharMovie::combo_resize(int w, int h) void AOCharMovie::frame_change(int n_frame) { - if (flipped_movie.size() > n_frame) + if (movie_frames.size() > n_frame) { - QPixmap f_pixmap = QPixmap::fromImage(flipped_movie.at(n_frame)); + QPixmap f_pixmap = QPixmap::fromImage(movie_frames.at(n_frame)); this->setPixmap(f_pixmap.scaled(this->width(), this->height())); } diff --git a/aocharmovie.h b/aocharmovie.h index 4cb4f26..8bc0bc1 100644 --- a/aocharmovie.h +++ b/aocharmovie.h @@ -29,7 +29,7 @@ private: AOApplication *ao_app; QMovie *m_movie; - QVector flipped_movie; + QVector movie_frames; QTimer *preanim_timer; const int time_mod = 62; diff --git a/aomovie.cpp b/aomovie.cpp index 5714704..90c3701 100644 --- a/aomovie.cpp +++ b/aomovie.cpp @@ -10,6 +10,8 @@ AOMovie::AOMovie(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_parent) m_movie = new QMovie(); + this->setMovie(m_movie); + connect(m_movie, SIGNAL(frameChanged(int)), this, SLOT(frame_change(int))); }