blob: 66effb123ff72e3ab20c342f39b4eae074e64151 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
#include "aomovie.h"
#include "file_functions.h"
#include "courtroom.h"
#include "misc_functions.h"
AOMovie::AOMovie(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_parent)
{
ao_app = p_ao_app;
m_movie = new QMovie();
this->setMovie(m_movie);
connect(m_movie, SIGNAL(frameChanged(int)), this, SLOT(frame_change(int)));
}
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";
QString gif_path;
if (p_gif == "custom")
gif_path = ao_app->get_character_path(p_char) + "custom.gif";
else
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::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();
this->hide();
}
void AOMovie::frame_change(int n_frame)
{
if (n_frame == (m_movie->frameCount() - 1) && play_once)
{
//we need this or else the last frame wont show
delay(m_movie->nextFrameDelay());
this->stop();
//signal connected to courtroom object, let it figure out what to do
done();
}
}
void AOMovie::combo_resize(int w, int h)
{
QSize f_size(w, h);
this->resize(f_size);
m_movie->setScaledSize(f_size);
}
|