aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSalanto <62221668+Salanto@users.noreply.github.com>2021-12-24 21:05:01 +0100
committerGitHub <noreply@github.com>2021-12-24 14:05:01 -0600
commit5ce0e6416e9e821be69219cc8a949c00e2cb462c (patch)
tree63e21560ce7fda46b7f61e82d109a7aebfcb8510 /include
parentd1fb7fde16ec37dfa7b13e0a02489417655d315d (diff)
Fix animation freeze when loading music files (#609)
* Implement async music loading * Simplify music filename parsing and fix "missing" on streams Co-authored-by: oldmud0 <oldmud0@users.noreply.github.com>
Diffstat (limited to 'include')
-rw-r--r--include/aomusicplayer.h6
-rw-r--r--include/courtroom.h4
2 files changed, 9 insertions, 1 deletions
diff --git a/include/aomusicplayer.h b/include/aomusicplayer.h
index f899b9a2..7c9bfb34 100644
--- a/include/aomusicplayer.h
+++ b/include/aomusicplayer.h
@@ -10,6 +10,8 @@
#include <QDebug>
#include <QWidget>
#include <string.h>
+#include <QFuture>
+#include <QFutureWatcher>
class AOMusicPlayer {
public:
@@ -24,8 +26,10 @@ public:
int loop_start[4] = {0, 0, 0, 0};
int loop_end[4] = {0, 0, 0, 0};
+ QFutureWatcher<QString> music_watcher;
+
public slots:
- int play(QString p_song, int channel = 0, bool loop = false,
+ QString play(QString p_song, int channel = 0, bool loop = false,
int effect_flags = 0);
void stop(int channel = 0);
diff --git a/include/courtroom.h b/include/courtroom.h
index 4bc86242..9df3b901 100644
--- a/include/courtroom.h
+++ b/include/courtroom.h
@@ -57,6 +57,8 @@
#include <QTextCharFormat>
#include <QElapsedTimer>
+#include <QFuture>
+
#include <algorithm>
#include <stack>
@@ -814,6 +816,8 @@ public slots:
bool steno);
void on_reload_theme_clicked();
+ void update_ui_music_name();
+
private slots:
void start_chat_ticking();
void play_sfx();