fixed a code error and renamed flipped_movie
This commit is contained in:
parent
1e0531a3d3
commit
b30131a922
@ -16,8 +16,6 @@ AOCharMovie::AOCharMovie(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_
|
|||||||
preanim_timer = new QTimer(this);
|
preanim_timer = new QTimer(this);
|
||||||
preanim_timer->setSingleShot(true);
|
preanim_timer->setSingleShot(true);
|
||||||
|
|
||||||
this->setMovie(m_movie);
|
|
||||||
|
|
||||||
connect(m_movie, SIGNAL(frameChanged(int)), this, SLOT(frame_change(int)));
|
connect(m_movie, SIGNAL(frameChanged(int)), this, SLOT(frame_change(int)));
|
||||||
connect(preanim_timer, SIGNAL(timeout()), this, SLOT(timer_done()));
|
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);
|
QImageReader *reader = new QImageReader(gif_path);
|
||||||
|
|
||||||
flipped_movie.clear();
|
movie_frames.clear();
|
||||||
QImage f_image = reader->read();
|
QImage f_image = reader->read();
|
||||||
while (!f_image.isNull())
|
while (!f_image.isNull())
|
||||||
{
|
{
|
||||||
if (m_flipped)
|
if (m_flipped)
|
||||||
flipped_movie.append(f_image.mirrored(true, false));
|
movie_frames.append(f_image.mirrored(true, false));
|
||||||
else
|
else
|
||||||
flipped_movie.append(f_image);
|
movie_frames.append(f_image);
|
||||||
f_image = reader->read();
|
f_image = reader->read();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -153,9 +151,9 @@ void AOCharMovie::combo_resize(int w, int h)
|
|||||||
|
|
||||||
void AOCharMovie::frame_change(int n_frame)
|
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()));
|
this->setPixmap(f_pixmap.scaled(this->width(), this->height()));
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ private:
|
|||||||
AOApplication *ao_app;
|
AOApplication *ao_app;
|
||||||
|
|
||||||
QMovie *m_movie;
|
QMovie *m_movie;
|
||||||
QVector<QImage> flipped_movie;
|
QVector<QImage> movie_frames;
|
||||||
QTimer *preanim_timer;
|
QTimer *preanim_timer;
|
||||||
|
|
||||||
const int time_mod = 62;
|
const int time_mod = 62;
|
||||||
|
@ -10,6 +10,8 @@ AOMovie::AOMovie(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_parent)
|
|||||||
|
|
||||||
m_movie = new QMovie();
|
m_movie = new QMovie();
|
||||||
|
|
||||||
|
this->setMovie(m_movie);
|
||||||
|
|
||||||
connect(m_movie, SIGNAL(frameChanged(int)), this, SLOT(frame_change(int)));
|
connect(m_movie, SIGNAL(frameChanged(int)), this, SLOT(frame_change(int)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user