mirror of
https://github.com/overte-org/overte.git
synced 2025-07-23 09:03:53 +02:00
Make Ctrl-O and 'Running Scripts->load file' follow the same code path
This commit is contained in:
parent
1324525ecc
commit
db7e4eee8f
1 changed files with 25 additions and 35 deletions
|
@ -72,23 +72,6 @@ Window {
|
||||||
scripts.stopAllScripts();
|
scripts.stopAllScripts();
|
||||||
}
|
}
|
||||||
|
|
||||||
Component {
|
|
||||||
id: fileDialogBuilder
|
|
||||||
FileDialog { }
|
|
||||||
}
|
|
||||||
|
|
||||||
function loadFromFile() {
|
|
||||||
var fileDialog = fileDialogBuilder.createObject(desktop, { filterModel: fileFilters });
|
|
||||||
fileDialog.canceled.connect(function(){
|
|
||||||
console.debug("Cancelled file open")
|
|
||||||
})
|
|
||||||
|
|
||||||
fileDialog.selectedFile.connect(function(file){
|
|
||||||
console.debug("Selected " + file)
|
|
||||||
scripts.loadOneScript(file);
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
color: "white"
|
color: "white"
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
@ -201,31 +184,38 @@ Window {
|
||||||
anchors.bottomMargin: 8
|
anchors.bottomMargin: 8
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
|
|
||||||
// For some reason trigginer an API that enters
|
|
||||||
// an internal event loop directly from the button clicked
|
|
||||||
// trigger below causes the appliction to behave oddly.
|
|
||||||
// Most likely because the button onClicked handling is never
|
|
||||||
// completed until the function returns.
|
|
||||||
// FIXME find a better way of handling the input dialogs that
|
|
||||||
// doesn't trigger this.
|
|
||||||
Timer {
|
|
||||||
id: asyncAction
|
|
||||||
interval: 50
|
|
||||||
repeat: false
|
|
||||||
running: false
|
|
||||||
onTriggered: ApplicationInterface.loadScriptURLDialog();
|
|
||||||
}
|
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
text: "from URL";
|
text: "from URL";
|
||||||
onClicked: {
|
onClicked: fromUrlTimer.running = true;
|
||||||
focus = false;
|
|
||||||
asyncAction.running = true;
|
// For some reason trigginer an API that enters
|
||||||
|
// an internal event loop directly from the button clicked
|
||||||
|
// trigger below causes the appliction to behave oddly.
|
||||||
|
// Most likely because the button onClicked handling is never
|
||||||
|
// completed until the function returns.
|
||||||
|
// FIXME find a better way of handling the input dialogs that
|
||||||
|
// doesn't trigger this.
|
||||||
|
Timer {
|
||||||
|
id: fromUrlTimer
|
||||||
|
interval: 5
|
||||||
|
repeat: false
|
||||||
|
running: false
|
||||||
|
onTriggered: ApplicationInterface.loadScriptURLDialog();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Button {
|
Button {
|
||||||
text: "from Disk"
|
text: "from Disk"
|
||||||
onClicked: loadFromFile();
|
onClicked: fromDiskTimer.running = true;
|
||||||
|
|
||||||
|
Timer {
|
||||||
|
id: fromDiskTimer
|
||||||
|
interval: 5
|
||||||
|
repeat: false
|
||||||
|
running: false
|
||||||
|
onTriggered: ApplicationInterface.loadDialog();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue