From e76a83ddfe8f6fe16ee7e2a91d3ac30e89f80345 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Thu, 12 Sep 2019 18:28:08 +0300 Subject: Allow AOMovie to have timers that take priority over the animated image frame count Set it up so feeding the timer value when playing the AOMovie would use the timer but only in cases where a non-animated image is used Update shouts and wtce to pass the 'duration' argument which will be used if the image used is non-animated. Otherwise, prioritize the animated image duration. --- src/aomovie.cpp | 87 +++++++++++++++++++++++++++++++-------------------------- 1 file changed, 48 insertions(+), 39 deletions(-) (limited to 'src/aomovie.cpp') diff --git a/src/aomovie.cpp b/src/aomovie.cpp index edf5bdb..2598bb7 100644 --- a/src/aomovie.cpp +++ b/src/aomovie.cpp @@ -12,7 +12,11 @@ AOMovie::AOMovie(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_parent) this->setMovie(m_movie); + timer = new QTimer(this); + timer->setSingleShot(true); + connect(m_movie, SIGNAL(frameChanged(int)), this, SLOT(frame_change(int))); + connect(timer, SIGNAL(timeout()), this, SLOT(timer_done())); } void AOMovie::set_play_once(bool p_play_once) @@ -20,46 +24,44 @@ void AOMovie::set_play_once(bool p_play_once) play_once = p_play_once; } -void AOMovie::play(QString p_gif, QString p_char, QString p_custom_theme) +void AOMovie::start_timer(int delay) { - m_movie->stop(); + timer->start(delay); +} - QString gif_path; +void AOMovie::play(QString p_gif, QString p_char, QString p_custom_theme, int duration) +{ + m_movie->stop(); - QString custom_path; + QString shout_path; + QList pathlist; if (p_gif == "custom") - custom_path = ao_app->get_image_suffix(ao_app->get_character_path(p_char, p_gif)); - else - custom_path = ao_app->get_image_suffix(ao_app->get_character_path(p_char, p_gif + "_bubble")); - - QString misc_path = ao_app->get_base_path() + "misc/" + p_custom_theme + "/" + p_gif + "_bubble.gif"; - QString custom_theme_path = ao_app->get_custom_theme_path(p_custom_theme, p_gif + ".gif"); - QString theme_path = ao_app->get_theme_path(p_gif + ".gif"); - QString default_theme_path = ao_app->get_default_theme_path(p_gif + ".gif"); - QString placeholder_path = ao_app->get_theme_path("placeholder.gif"); - QString default_placeholder_path = ao_app->get_default_theme_path("placeholder.gif"); - - if (file_exists(custom_path)) - gif_path = custom_path; - else if (file_exists(misc_path)) - gif_path = misc_path; - else if (file_exists(custom_theme_path)) - gif_path = custom_theme_path; - else if (file_exists(theme_path)) - gif_path = theme_path; - else if (file_exists(default_theme_path)) - gif_path = default_theme_path; - else if (file_exists(placeholder_path)) - gif_path = placeholder_path; - else if (file_exists(default_placeholder_path)) - gif_path = default_placeholder_path; + pathlist << ao_app->get_image_suffix(ao_app->get_character_path(p_char, p_gif)); else - gif_path = ""; + pathlist << ao_app->get_image_suffix(ao_app->get_character_path(p_char, p_gif + "_bubble")); - m_movie->setFileName(gif_path); + pathlist << ao_app->get_image_suffix(ao_app->get_base_path() + "misc/" + p_custom_theme + "/" + p_gif + "_bubble") << //Misc path + ao_app->get_image_suffix(ao_app->get_custom_theme_path(p_custom_theme, p_gif)) << //Custom theme path + ao_app->get_image_suffix(ao_app->get_theme_path(p_gif)) << //Theme path + ao_app->get_image_suffix(ao_app->get_default_theme_path(p_gif)) << //Default theme path + ao_app->get_image_suffix(ao_app->get_theme_path("placeholder")) << //Placeholder path + ao_app->get_image_suffix( ao_app->get_default_theme_path("placeholder")); //Default placeholder path + + for (QString path : pathlist) + { + if (file_exists(path)) + { + shout_path = path; + break; + } + } + + m_movie->setFileName(shout_path); this->show(); m_movie->start(); + if (m_movie->frameCount() == 0 && duration > 0) + this->start_timer(duration); } void AOMovie::stop() @@ -70,16 +72,23 @@ void AOMovie::stop() 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()); + //If it's a "static movie" (only one frame - png image), we can't change frames - ignore this function (use timer instead). + //If the frame didn't reach the last frame or the movie is continuous, don't stop the movie. + if (m_movie->frameCount() == 0 || n_frame < (m_movie->frameCount() - 1) || !play_once) + return; + //we need this or else the last frame wont show + delay(m_movie->nextFrameDelay()); - this->stop(); + this->stop(); - //signal connected to courtroom object, let it figure out what to do - done(); - } + //signal connected to courtroom object, let it figure out what to do + done(); +} + +void AOMovie::timer_done() +{ + this->stop(); + done(); } void AOMovie::combo_resize(int w, int h) -- cgit From 9aa88b1d6e84538761a963249d8c8029314e26d7 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Fri, 13 Sep 2019 11:37:06 +0300 Subject: Use brace constructors instead of << append operator for path lists Rename gif_path into emote_path for charmovie.cpp Rename p_gif into p_image for aomovie.cpp --- src/aomovie.cpp | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'src/aomovie.cpp') diff --git a/src/aomovie.cpp b/src/aomovie.cpp index 2598bb7..851ae57 100644 --- a/src/aomovie.cpp +++ b/src/aomovie.cpp @@ -29,23 +29,27 @@ void AOMovie::start_timer(int delay) timer->start(delay); } -void AOMovie::play(QString p_gif, QString p_char, QString p_custom_theme, int duration) +void AOMovie::play(QString p_image, QString p_char, QString p_custom_theme, int duration) { m_movie->stop(); QString shout_path; QList pathlist; - if (p_gif == "custom") - pathlist << ao_app->get_image_suffix(ao_app->get_character_path(p_char, p_gif)); + + pathlist = { + ao_app->get_image_suffix(ao_app->get_base_path() + "misc/" + p_custom_theme + "/" + p_image + "_bubble"), //Misc path + ao_app->get_image_suffix(ao_app->get_custom_theme_path(p_custom_theme, p_image)), //Custom theme path + ao_app->get_image_suffix(ao_app->get_theme_path(p_image)), //Theme path + ao_app->get_image_suffix(ao_app->get_default_theme_path(p_image)), //Default theme path + ao_app->get_image_suffix(ao_app->get_theme_path("placeholder")), //Placeholder path + ao_app->get_image_suffix( ao_app->get_default_theme_path("placeholder")), //Default placeholder path + }; + + //Add this at the beginning of the list - order matters. + if (p_image == "custom") + pathlist.prepend(ao_app->get_image_suffix(ao_app->get_character_path(p_char, p_image))); else - pathlist << ao_app->get_image_suffix(ao_app->get_character_path(p_char, p_gif + "_bubble")); - - pathlist << ao_app->get_image_suffix(ao_app->get_base_path() + "misc/" + p_custom_theme + "/" + p_gif + "_bubble") << //Misc path - ao_app->get_image_suffix(ao_app->get_custom_theme_path(p_custom_theme, p_gif)) << //Custom theme path - ao_app->get_image_suffix(ao_app->get_theme_path(p_gif)) << //Theme path - ao_app->get_image_suffix(ao_app->get_default_theme_path(p_gif)) << //Default theme path - ao_app->get_image_suffix(ao_app->get_theme_path("placeholder")) << //Placeholder path - ao_app->get_image_suffix( ao_app->get_default_theme_path("placeholder")); //Default placeholder path + pathlist.prepend(ao_app->get_image_suffix(ao_app->get_character_path(p_char, p_image + "_bubble"))); for (QString path : pathlist) { -- cgit From a2f9df4042585ab0849b54e2bb0b9699f9064aed Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Sun, 15 Sep 2019 17:44:02 +0300 Subject: Finally implement frame-specific effects such as screenshake, realization flash, sound effects, etc. Fix screenshake animation modifying the default positions of shook elements Fix aomovie sometimes not playing the last frame and causing lagspikes due to the delay() method --- src/aomovie.cpp | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'src/aomovie.cpp') diff --git a/src/aomovie.cpp b/src/aomovie.cpp index 851ae57..7f7fb20 100644 --- a/src/aomovie.cpp +++ b/src/aomovie.cpp @@ -13,6 +13,7 @@ AOMovie::AOMovie(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_parent) this->setMovie(m_movie); timer = new QTimer(this); + timer->setTimerType(Qt::PreciseTimer); timer->setSingleShot(true); connect(m_movie, SIGNAL(frameChanged(int)), this, SLOT(frame_change(int))); @@ -24,11 +25,6 @@ void AOMovie::set_play_once(bool p_play_once) play_once = p_play_once; } -void AOMovie::start_timer(int delay) -{ - timer->start(delay); -} - void AOMovie::play(QString p_image, QString p_char, QString p_custom_theme, int duration) { m_movie->stop(); @@ -65,7 +61,7 @@ void AOMovie::play(QString p_image, QString p_char, QString p_custom_theme, int this->show(); m_movie->start(); if (m_movie->frameCount() == 0 && duration > 0) - this->start_timer(duration); + timer->start(duration); } void AOMovie::stop() @@ -81,17 +77,13 @@ void AOMovie::frame_change(int n_frame) if (m_movie->frameCount() == 0 || n_frame < (m_movie->frameCount() - 1) || !play_once) return; //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(); + timer->start(m_movie->nextFrameDelay()); } void AOMovie::timer_done() { this->stop(); + //signal connected to courtroom object, let it figure out what to do done(); } -- cgit From 605e15bb8c0ad103fb0f75454d8912ba83ba7a17 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Wed, 18 Sep 2019 04:14:52 +0300 Subject: Implement effects system that reads your folder in theme/effects, or misc// Add an effect packet Allow aomovie to be fed a direct path Add some really terrible helper functions that shouldn't exist, sorry. --- src/aomovie.cpp | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) (limited to 'src/aomovie.cpp') diff --git a/src/aomovie.cpp b/src/aomovie.cpp index 7f7fb20..fff8014 100644 --- a/src/aomovie.cpp +++ b/src/aomovie.cpp @@ -29,35 +29,41 @@ void AOMovie::play(QString p_image, QString p_char, QString p_custom_theme, int { m_movie->stop(); - QString shout_path; - QList pathlist; + QString shout_path = p_image; + if (!file_exists(p_image)) + { + QList pathlist; - pathlist = { + pathlist = { ao_app->get_image_suffix(ao_app->get_base_path() + "misc/" + p_custom_theme + "/" + p_image + "_bubble"), //Misc path ao_app->get_image_suffix(ao_app->get_custom_theme_path(p_custom_theme, p_image)), //Custom theme path ao_app->get_image_suffix(ao_app->get_theme_path(p_image)), //Theme path ao_app->get_image_suffix(ao_app->get_default_theme_path(p_image)), //Default theme path ao_app->get_image_suffix(ao_app->get_theme_path("placeholder")), //Placeholder path ao_app->get_image_suffix( ao_app->get_default_theme_path("placeholder")), //Default placeholder path - }; + }; - //Add this at the beginning of the list - order matters. - if (p_image == "custom") - pathlist.prepend(ao_app->get_image_suffix(ao_app->get_character_path(p_char, p_image))); - else - pathlist.prepend(ao_app->get_image_suffix(ao_app->get_character_path(p_char, p_image + "_bubble"))); + //Add this at the beginning of the list - order matters. + if (p_image == "custom") + pathlist.prepend(ao_app->get_image_suffix(ao_app->get_character_path(p_char, p_image))); + else + pathlist.prepend(ao_app->get_image_suffix(ao_app->get_character_path(p_char, p_image + "_bubble"))); - for (QString path : pathlist) - { + for (QString path : pathlist) + { if (file_exists(path)) { - shout_path = path; - break; + shout_path = path; + break; } + } } m_movie->setFileName(shout_path); + if (m_movie->loopCount() == 0) + play_once = true; + this->show(); m_movie->start(); if (m_movie->frameCount() == 0 && duration > 0) -- cgit From 3fd93ab34118cfb5041b1be77e50e14658627a82 Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Fri, 20 Sep 2019 17:26:41 +0300 Subject: Make ui_additive_button insert a whitespace character at the start of the message when you use it (to make it so by default, the added message will have that space, but you can safely remove it if you need to) Support for aomovie to check inside the character folder for relevant stuff if p_char is provided --- src/aomovie.cpp | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'src/aomovie.cpp') diff --git a/src/aomovie.cpp b/src/aomovie.cpp index fff8014..561f5ef 100644 --- a/src/aomovie.cpp +++ b/src/aomovie.cpp @@ -35,20 +35,15 @@ void AOMovie::play(QString p_image, QString p_char, QString p_custom_theme, int QList pathlist; pathlist = { - ao_app->get_image_suffix(ao_app->get_base_path() + "misc/" + p_custom_theme + "/" + p_image + "_bubble"), //Misc path - ao_app->get_image_suffix(ao_app->get_custom_theme_path(p_custom_theme, p_image)), //Custom theme path - ao_app->get_image_suffix(ao_app->get_theme_path(p_image)), //Theme path - ao_app->get_image_suffix(ao_app->get_default_theme_path(p_image)), //Default theme path - ao_app->get_image_suffix(ao_app->get_theme_path("placeholder")), //Placeholder path - ao_app->get_image_suffix( ao_app->get_default_theme_path("placeholder")), //Default placeholder path + ao_app->get_image_suffix(ao_app->get_character_path(p_char, p_image)), //Character folder + ao_app->get_image_suffix(ao_app->get_base_path() + "misc/" + p_custom_theme + "/" + p_image), //Misc path + ao_app->get_image_suffix(ao_app->get_custom_theme_path(p_custom_theme, p_image)), //Custom theme path + ao_app->get_image_suffix(ao_app->get_theme_path(p_image)), //Theme path + ao_app->get_image_suffix(ao_app->get_default_theme_path(p_image)), //Default theme path + ao_app->get_image_suffix(ao_app->get_theme_path("placeholder")), //Placeholder path + ao_app->get_image_suffix( ao_app->get_default_theme_path("placeholder")), //Default placeholder path }; - //Add this at the beginning of the list - order matters. - if (p_image == "custom") - pathlist.prepend(ao_app->get_image_suffix(ao_app->get_character_path(p_char, p_image))); - else - pathlist.prepend(ao_app->get_image_suffix(ao_app->get_character_path(p_char, p_image + "_bubble"))); - for (QString path : pathlist) { if (file_exists(path)) -- cgit From c8e12558cdd3fd0769b81679ad09edf1f29b780f Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Fri, 22 May 2020 01:18:24 +0300 Subject: Clang-ify the code with this styling using Visual Studio Code: { BasedOnStyle: LLVM, UseTab: Never, IndentWidth: 4, TabWidth: 4, BreakBeforeBraces: Stroustrup, AllowShortIfStatementsOnASingleLine: false, IndentCaseLabels: false, ColumnLimit: 0, AccessModifierOffset: -4, NamespaceIndentation: All } (this is the Visual Studio preset with only "BreakBeforeBraces" changed from Allman to Stroustrup) --- src/aomovie.cpp | 109 +++++++++++++++++++++++++++----------------------------- 1 file changed, 53 insertions(+), 56 deletions(-) (limited to 'src/aomovie.cpp') diff --git a/src/aomovie.cpp b/src/aomovie.cpp index 561f5ef..7e3bbae 100644 --- a/src/aomovie.cpp +++ b/src/aomovie.cpp @@ -1,96 +1,93 @@ #include "aomovie.h" -#include "file_functions.h" #include "courtroom.h" +#include "file_functions.h" #include "misc_functions.h" AOMovie::AOMovie(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_parent) { - ao_app = p_ao_app; + ao_app = p_ao_app; - m_movie = new QMovie(); + m_movie = new QMovie(); - this->setMovie(m_movie); + this->setMovie(m_movie); - timer = new QTimer(this); - timer->setTimerType(Qt::PreciseTimer); - timer->setSingleShot(true); + timer = new QTimer(this); + timer->setTimerType(Qt::PreciseTimer); + timer->setSingleShot(true); - connect(m_movie, SIGNAL(frameChanged(int)), this, SLOT(frame_change(int))); - connect(timer, SIGNAL(timeout()), this, SLOT(timer_done())); + connect(m_movie, SIGNAL(frameChanged(int)), this, SLOT(frame_change(int))); + connect(timer, SIGNAL(timeout()), this, SLOT(timer_done())); } void AOMovie::set_play_once(bool p_play_once) { - play_once = p_play_once; + play_once = p_play_once; } void AOMovie::play(QString p_image, QString p_char, QString p_custom_theme, int duration) { - m_movie->stop(); - - QString shout_path = p_image; - if (!file_exists(p_image)) - { - QList pathlist; - - pathlist = { - ao_app->get_image_suffix(ao_app->get_character_path(p_char, p_image)), //Character folder - ao_app->get_image_suffix(ao_app->get_base_path() + "misc/" + p_custom_theme + "/" + p_image), //Misc path - ao_app->get_image_suffix(ao_app->get_custom_theme_path(p_custom_theme, p_image)), //Custom theme path - ao_app->get_image_suffix(ao_app->get_theme_path(p_image)), //Theme path - ao_app->get_image_suffix(ao_app->get_default_theme_path(p_image)), //Default theme path - ao_app->get_image_suffix(ao_app->get_theme_path("placeholder")), //Placeholder path - ao_app->get_image_suffix( ao_app->get_default_theme_path("placeholder")), //Default placeholder path - }; - - for (QString path : pathlist) - { - if (file_exists(path)) - { - shout_path = path; - break; - } + m_movie->stop(); + + QString shout_path = p_image; + if (!file_exists(p_image)) { + QList pathlist; + + pathlist = { + ao_app->get_image_suffix(ao_app->get_character_path(p_char, p_image)), //Character folder + ao_app->get_image_suffix(ao_app->get_base_path() + "misc/" + p_custom_theme + "/" + p_image), //Misc path + ao_app->get_image_suffix(ao_app->get_custom_theme_path(p_custom_theme, p_image)), //Custom theme path + ao_app->get_image_suffix(ao_app->get_theme_path(p_image)), //Theme path + ao_app->get_image_suffix(ao_app->get_default_theme_path(p_image)), //Default theme path + ao_app->get_image_suffix(ao_app->get_theme_path("placeholder")), //Placeholder path + ao_app->get_image_suffix(ao_app->get_default_theme_path("placeholder")), //Default placeholder path + }; + + for (QString path : pathlist) { + if (file_exists(path)) { + shout_path = path; + break; + } + } } - } - m_movie->setFileName(shout_path); + m_movie->setFileName(shout_path); - if (m_movie->loopCount() == 0) - play_once = true; + if (m_movie->loopCount() == 0) + play_once = true; - this->show(); - m_movie->start(); - if (m_movie->frameCount() == 0 && duration > 0) - timer->start(duration); + this->show(); + m_movie->start(); + if (m_movie->frameCount() == 0 && duration > 0) + timer->start(duration); } void AOMovie::stop() { - m_movie->stop(); - this->hide(); + m_movie->stop(); + this->hide(); } void AOMovie::frame_change(int n_frame) { - //If it's a "static movie" (only one frame - png image), we can't change frames - ignore this function (use timer instead). - //If the frame didn't reach the last frame or the movie is continuous, don't stop the movie. - if (m_movie->frameCount() == 0 || n_frame < (m_movie->frameCount() - 1) || !play_once) - return; - //we need this or else the last frame wont show - timer->start(m_movie->nextFrameDelay()); + //If it's a "static movie" (only one frame - png image), we can't change frames - ignore this function (use timer instead). + //If the frame didn't reach the last frame or the movie is continuous, don't stop the movie. + if (m_movie->frameCount() == 0 || n_frame < (m_movie->frameCount() - 1) || !play_once) + return; + //we need this or else the last frame wont show + timer->start(m_movie->nextFrameDelay()); } void AOMovie::timer_done() { - this->stop(); - //signal connected to courtroom object, let it figure out what to do - done(); + 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); + QSize f_size(w, h); + this->resize(f_size); + m_movie->setScaledSize(f_size); } -- cgit From 88de4cde0433ef5e606f38a2f1e6041f0d24a87e Mon Sep 17 00:00:00 2001 From: Crystalwarrior Date: Fri, 22 May 2020 02:14:54 +0300 Subject: clang 2 electric boogaloo { BasedOnStyle: LLVM, BreakBeforeBraces: Stroustrup} --- src/aomovie.cpp | 118 +++++++++++++++++++++++++++++--------------------------- 1 file changed, 62 insertions(+), 56 deletions(-) (limited to 'src/aomovie.cpp') diff --git a/src/aomovie.cpp b/src/aomovie.cpp index 7e3bbae..ac94921 100644 --- a/src/aomovie.cpp +++ b/src/aomovie.cpp @@ -6,88 +6,94 @@ AOMovie::AOMovie(QWidget *p_parent, AOApplication *p_ao_app) : QLabel(p_parent) { - ao_app = p_ao_app; + ao_app = p_ao_app; - m_movie = new QMovie(); + m_movie = new QMovie(); - this->setMovie(m_movie); + this->setMovie(m_movie); - timer = new QTimer(this); - timer->setTimerType(Qt::PreciseTimer); - timer->setSingleShot(true); + timer = new QTimer(this); + timer->setTimerType(Qt::PreciseTimer); + timer->setSingleShot(true); - connect(m_movie, SIGNAL(frameChanged(int)), this, SLOT(frame_change(int))); - connect(timer, SIGNAL(timeout()), this, SLOT(timer_done())); + connect(m_movie, SIGNAL(frameChanged(int)), this, SLOT(frame_change(int))); + connect(timer, SIGNAL(timeout()), this, SLOT(timer_done())); } -void AOMovie::set_play_once(bool p_play_once) -{ - play_once = p_play_once; -} +void AOMovie::set_play_once(bool p_play_once) { play_once = p_play_once; } -void AOMovie::play(QString p_image, QString p_char, QString p_custom_theme, int duration) +void AOMovie::play(QString p_image, QString p_char, QString p_custom_theme, + int duration) { - m_movie->stop(); - - QString shout_path = p_image; - if (!file_exists(p_image)) { - QList pathlist; - - pathlist = { - ao_app->get_image_suffix(ao_app->get_character_path(p_char, p_image)), //Character folder - ao_app->get_image_suffix(ao_app->get_base_path() + "misc/" + p_custom_theme + "/" + p_image), //Misc path - ao_app->get_image_suffix(ao_app->get_custom_theme_path(p_custom_theme, p_image)), //Custom theme path - ao_app->get_image_suffix(ao_app->get_theme_path(p_image)), //Theme path - ao_app->get_image_suffix(ao_app->get_default_theme_path(p_image)), //Default theme path - ao_app->get_image_suffix(ao_app->get_theme_path("placeholder")), //Placeholder path - ao_app->get_image_suffix(ao_app->get_default_theme_path("placeholder")), //Default placeholder path - }; - - for (QString path : pathlist) { - if (file_exists(path)) { - shout_path = path; - break; - } - } + m_movie->stop(); + + QString shout_path = p_image; + if (!file_exists(p_image)) { + QList pathlist; + + pathlist = { + ao_app->get_image_suffix( + ao_app->get_character_path(p_char, p_image)), // Character folder + ao_app->get_image_suffix(ao_app->get_base_path() + "misc/" + + p_custom_theme + "/" + p_image), // Misc path + ao_app->get_image_suffix(ao_app->get_custom_theme_path( + p_custom_theme, p_image)), // Custom theme path + ao_app->get_image_suffix(ao_app->get_theme_path(p_image)), // Theme path + ao_app->get_image_suffix( + ao_app->get_default_theme_path(p_image)), // Default theme path + ao_app->get_image_suffix( + ao_app->get_theme_path("placeholder")), // Placeholder path + ao_app->get_image_suffix(ao_app->get_default_theme_path( + "placeholder")), // Default placeholder path + }; + + for (QString path : pathlist) { + if (file_exists(path)) { + shout_path = path; + break; + } } + } - m_movie->setFileName(shout_path); + m_movie->setFileName(shout_path); - if (m_movie->loopCount() == 0) - play_once = true; + if (m_movie->loopCount() == 0) + play_once = true; - this->show(); - m_movie->start(); - if (m_movie->frameCount() == 0 && duration > 0) - timer->start(duration); + this->show(); + m_movie->start(); + if (m_movie->frameCount() == 0 && duration > 0) + timer->start(duration); } void AOMovie::stop() { - m_movie->stop(); - this->hide(); + m_movie->stop(); + this->hide(); } void AOMovie::frame_change(int n_frame) { - //If it's a "static movie" (only one frame - png image), we can't change frames - ignore this function (use timer instead). - //If the frame didn't reach the last frame or the movie is continuous, don't stop the movie. - if (m_movie->frameCount() == 0 || n_frame < (m_movie->frameCount() - 1) || !play_once) - return; - //we need this or else the last frame wont show - timer->start(m_movie->nextFrameDelay()); + // If it's a "static movie" (only one frame - png image), we can't change + // frames - ignore this function (use timer instead). If the frame didn't reach + // the last frame or the movie is continuous, don't stop the movie. + if (m_movie->frameCount() == 0 || n_frame < (m_movie->frameCount() - 1) || + !play_once) + return; + // we need this or else the last frame wont show + timer->start(m_movie->nextFrameDelay()); } void AOMovie::timer_done() { - this->stop(); - //signal connected to courtroom object, let it figure out what to do - done(); + 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); + QSize f_size(w, h); + this->resize(f_size); + m_movie->setScaledSize(f_size); } -- cgit