Skip to content

Commit c055d42

Browse files
authored
Merge pull request #121 from scratchcpp/projectplayer_load
Add load() function to ProjectPlayer
2 parents 2bb29e8 + 81f19c7 commit c055d42

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/ProjectPlayer.qml

+5-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import ScratchCPP.Render
88
import "internal"
99

1010
ProjectScene {
11-
property string fileName
11+
readonly property string fileName: loader.fileName
1212
property int stageWidth: 480
1313
property int stageHeight: 360
1414
property alias fps: loader.fps
@@ -28,6 +28,10 @@ ProjectScene {
2828
stageScale: (stageWidth == 0 || stageHeight == 0) ? 1 : Math.min(width / stageWidth, height / stageHeight)
2929
onFileNameChanged: priv.loading = true;
3030

31+
function load(fileName) {
32+
loader.fileName = fileName;
33+
}
34+
3135
QtObject {
3236
id: priv
3337
property bool loading: false

src/projectloader.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ void ProjectLoader::setFileName(const QString &newFileName)
5959
if (m_loadThread.isRunning())
6060
m_loadThread.waitForFinished();
6161

62-
if (m_fileName == newFileName)
62+
if (newFileName.isEmpty())
6363
return;
6464

6565
m_fileName = newFileName;

0 commit comments

Comments
 (0)