mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 12:17:45 +02:00
Cleanup running scripts
This commit is contained in:
parent
f352332924
commit
2ed54d8ea7
1 changed files with 3 additions and 38 deletions
|
@ -20,33 +20,6 @@ Window {
|
||||||
property var scriptsModel: scripts.scriptsModelFilter
|
property var scriptsModel: scripts.scriptsModelFilter
|
||||||
property var runningScriptsModel: ListModel { }
|
property var runningScriptsModel: ListModel { }
|
||||||
|
|
||||||
|
|
||||||
Component {
|
|
||||||
id: fileDialogCreator
|
|
||||||
OriginalDialogs.FileDialog {
|
|
||||||
id: fileDialog
|
|
||||||
modality: Qt.ApplicationModal
|
|
||||||
title: "Please choose a file"
|
|
||||||
nameFilters: [ "JavaScript files (*.js)" ]
|
|
||||||
folder: "file:///" + scripts.previousScriptLocation
|
|
||||||
onAccepted: {
|
|
||||||
var chosen = fileDialog.fileUrl;
|
|
||||||
console.log("You chose: " + chosen);
|
|
||||||
var chosenFolder = fileDialog.folder.toString();
|
|
||||||
// remove prefixed "file:///"
|
|
||||||
chosenFolder = chosenFolder.replace(/^(file:\/{3})/,"");
|
|
||||||
// unescape html codes like '%23' for '#'
|
|
||||||
var cleanPath = decodeURIComponent(chosenFolder);
|
|
||||||
scripts.previousScriptLocation = cleanPath;
|
|
||||||
scripts.loadOneScript(chosen);
|
|
||||||
}
|
|
||||||
onRejected: {
|
|
||||||
console.log("Canceled")
|
|
||||||
}
|
|
||||||
Component.onCompleted: visible = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Settings {
|
Settings {
|
||||||
category: "Overlay.RunningScripts"
|
category: "Overlay.RunningScripts"
|
||||||
property alias x: root.x
|
property alias x: root.x
|
||||||
|
@ -214,23 +187,15 @@ Window {
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
headerVisible: false
|
headerVisible: false
|
||||||
focus: true
|
focus: true
|
||||||
onClicked: {
|
// FIXME doesn't work?
|
||||||
console.log("treeview clicked " + scriptsModel.data(index, 0x100))
|
onDoubleClicked: isExpanded(index) ? collapse(index) : expand(index)
|
||||||
}
|
// FIXME not triggered by double click?
|
||||||
|
|
||||||
onDoubleClicked: {
|
|
||||||
console.log("treeview double clicked" + scriptsModel.data(index, 0x100))
|
|
||||||
isExpanded(index) ? collapse(index) : expand(index)
|
|
||||||
}
|
|
||||||
|
|
||||||
onActivated: {
|
onActivated: {
|
||||||
console.log("treeview activated!" + index)
|
|
||||||
var path = scriptsModel.data(index, 0x100)
|
var path = scriptsModel.data(index, 0x100)
|
||||||
if (path) {
|
if (path) {
|
||||||
loadScript(path)
|
loadScript(path)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
model: scriptsModel
|
model: scriptsModel
|
||||||
TableViewColumn { title: "Name"; role: "display"; }
|
TableViewColumn { title: "Name"; role: "display"; }
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue