aboutsummaryrefslogtreecommitdiff
path: root/aomovie.cpp
diff options
context:
space:
mode:
authorDavid Skoland <davidskoland@gmail.com>2017-02-03 17:07:05 +0100
committerDavid Skoland <davidskoland@gmail.com>2017-02-03 17:07:05 +0100
commit6a4657ceb92f391da012657239267d83762c937a (patch)
tree766ea3ecbe404bdb4522fb57ec81a402c20e7c22 /aomovie.cpp
parentde7d25962f62a62ba282c35d1a64c740affd53db (diff)
added viewport functionality
Diffstat (limited to 'aomovie.cpp')
-rw-r--r--aomovie.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/aomovie.cpp b/aomovie.cpp
index 2b4189e3..66effb12 100644
--- a/aomovie.cpp
+++ b/aomovie.cpp
@@ -17,6 +17,8 @@ AOMovie::AOMovie(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_parent)
void AOMovie::play(QString p_gif, QString p_char)
{
+ play_once = true;
+
m_movie->stop();
QString default_path = ao_app->get_default_theme_path() + p_gif + ".gif";
@@ -37,6 +39,24 @@ void AOMovie::play(QString p_gif, QString p_char)
m_movie->start();
}
+void AOMovie::play(QString p_gif, bool p_play_once)
+{
+ play_once = p_play_once;
+
+ m_movie->stop();
+
+ QString default_path = ao_app->get_default_theme_path() + p_gif + ".gif";
+ QString gif_path = ao_app->get_theme_path() + p_gif + ".gif";
+
+ if (file_exists(gif_path))
+ m_movie->setFileName(gif_path);
+ else
+ m_movie->setFileName(default_path);
+
+ this->show();
+ m_movie->start();
+}
+
void AOMovie::stop()
{
m_movie->stop();
@@ -45,7 +65,7 @@ void AOMovie::stop()
void AOMovie::frame_change(int n_frame)
{
- if (n_frame == (m_movie->frameCount() - 1))
+ if (n_frame == (m_movie->frameCount() - 1) && play_once)
{
//we need this or else the last frame wont show
delay(m_movie->nextFrameDelay());