Skip to content

Commit 71c4e33

Browse files
committed
ProjectPlayer: Add stopLoading() function
1 parent fa6f240 commit 71c4e33

File tree

1 file changed

+27
-4
lines changed

1 file changed

+27
-4
lines changed

src/ProjectPlayer.qml

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ ProjectScene {
2727
readonly property Rectangle stageRect: contentRect
2828
signal loaded()
2929
signal failedToLoad()
30+
signal loadingAborted()
3031

3132
id: root
3233
engine: loader.engine
@@ -39,6 +40,11 @@ ProjectScene {
3940
loader.fileName = fileName;
4041
}
4142

43+
function stopLoading() {
44+
if (priv.loading)
45+
loader.stopLoading();
46+
}
47+
4248
QtObject {
4349
id: priv
4450
property bool loading: false
@@ -54,10 +60,27 @@ ProjectScene {
5460
onLoadingFinished: {
5561
priv.loading = false;
5662

57-
if(loadStatus)
58-
loaded();
59-
else
60-
failedToLoad();
63+
switch (loadStatus) {
64+
case ProjectLoader.Loaded:
65+
loaded();
66+
break;
67+
68+
case ProjectLoader.Failed:
69+
failedToLoad();
70+
break;
71+
72+
case ProjectLoader.Aborted:
73+
loadingAborted();
74+
break;
75+
76+
default:
77+
break;
78+
}
79+
}
80+
81+
onLoadStatusChanged: {
82+
if (loadStatus === ProjectLoader.Loading)
83+
priv.loading = true;
6184
}
6285

6386
onStageChanged: stage.loadCostume();

0 commit comments

Comments
 (0)