mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-08-06 10:18:42 +02:00
[ui] ScriptEditor: ScriptEditor gets new icons
Updated Icons for ScriptEditor Script Editor shows a confirmation dialog before clearing history
This commit is contained in:
parent
8207e84a41
commit
49052dfc0f
2 changed files with 40 additions and 11 deletions
|
@ -1269,6 +1269,7 @@ Page {
|
||||||
ScriptEditor {
|
ScriptEditor {
|
||||||
id: scriptEditor
|
id: scriptEditor
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
rootApplication: root
|
||||||
|
|
||||||
visible: graphEditorPanel.currentTab === 2
|
visible: graphEditorPanel.currentTab === 2
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,8 +14,26 @@ import ScriptEditor 1.0
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
// Defines the parent or the root Application of which this script editor is a part of
|
||||||
|
property var rootApplication: undefined;
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: clearConfirmationDialog
|
||||||
|
|
||||||
|
MessageDialog {
|
||||||
|
title: "Clear history"
|
||||||
|
|
||||||
|
preset: "Warning"
|
||||||
|
text: "This will clear all history of executed scripts."
|
||||||
|
helperText: "Are you sure you would like to continue?."
|
||||||
|
|
||||||
|
standardButtons: Dialog.Ok | Dialog.Cancel
|
||||||
|
onClosed: destroy()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function replace(text, string, replacement) {
|
function replace(text, string, replacement) {
|
||||||
/*
|
/**
|
||||||
* Replaces all occurences of the string in the text
|
* Replaces all occurences of the string in the text
|
||||||
* @param text - overall text
|
* @param text - overall text
|
||||||
* @param string - the string to be replaced in the text
|
* @param string - the string to be replaced in the text
|
||||||
|
@ -28,7 +46,7 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatInput(text) {
|
function formatInput(text) {
|
||||||
/*
|
/**
|
||||||
* Formats the text to be displayed as the input script executed
|
* Formats the text to be displayed as the input script executed
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -37,7 +55,7 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatOutput(text) {
|
function formatOutput(text) {
|
||||||
/*
|
/**
|
||||||
* Formats the text to be displayed as the result of the script executed
|
* Formats the text to be displayed as the result of the script executed
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -45,6 +63,15 @@ Item {
|
||||||
return "<font color=#49a1f3>" + "Result: " + replace(text, "\n", "<br>") + "</font><br><br>"
|
return "<font color=#49a1f3>" + "Result: " + replace(text, "\n", "<br>") + "</font><br><br>"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function clearHistory() {
|
||||||
|
/**
|
||||||
|
* Clears all of the executed history from the script editor
|
||||||
|
*/
|
||||||
|
ScriptEditorManager.clearHistory()
|
||||||
|
input.clear()
|
||||||
|
output.clear()
|
||||||
|
}
|
||||||
|
|
||||||
function processScript(text = "") {
|
function processScript(text = "") {
|
||||||
// Use either the provided/selected or the entire script
|
// Use either the provided/selected or the entire script
|
||||||
text = text || input.text
|
text = text || input.text
|
||||||
|
@ -117,7 +144,7 @@ Item {
|
||||||
|
|
||||||
MaterialToolButton {
|
MaterialToolButton {
|
||||||
font.pointSize: 18
|
font.pointSize: 18
|
||||||
text: MaterialIcons.download
|
text: MaterialIcons.file_open
|
||||||
ToolTip.text: "Load Script"
|
ToolTip.text: "Load Script"
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
@ -127,7 +154,7 @@ Item {
|
||||||
|
|
||||||
MaterialToolButton {
|
MaterialToolButton {
|
||||||
font.pointSize: 18
|
font.pointSize: 18
|
||||||
text: MaterialIcons.upload
|
text: MaterialIcons.save
|
||||||
ToolTip.text: "Save Script"
|
ToolTip.text: "Save Script"
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
@ -142,7 +169,7 @@ Item {
|
||||||
MaterialToolButton {
|
MaterialToolButton {
|
||||||
id: executeButton
|
id: executeButton
|
||||||
font.pointSize: 18
|
font.pointSize: 18
|
||||||
text: MaterialIcons.slideshow
|
text: MaterialIcons.play_arrow
|
||||||
ToolTip.text: "Execute Script"
|
ToolTip.text: "Execute Script"
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
@ -152,7 +179,7 @@ Item {
|
||||||
|
|
||||||
MaterialToolButton {
|
MaterialToolButton {
|
||||||
font.pointSize: 18
|
font.pointSize: 18
|
||||||
text: MaterialIcons.cancel_presentation
|
text: MaterialIcons.backspace
|
||||||
ToolTip.text: "Clear Output Window"
|
ToolTip.text: "Clear Output Window"
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
@ -196,13 +223,14 @@ Item {
|
||||||
|
|
||||||
MaterialToolButton {
|
MaterialToolButton {
|
||||||
font.pointSize: 18
|
font.pointSize: 18
|
||||||
text: MaterialIcons.backspace
|
text: MaterialIcons.delete_sweep
|
||||||
ToolTip.text: "Clear History"
|
ToolTip.text: "Clear History"
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
ScriptEditorManager.clearHistory()
|
// Confirm from the user before clearing out any history
|
||||||
input.clear()
|
const confirmationDialog = clearConfirmationDialog.createObject(rootApplication ? rootApplication : root);
|
||||||
output.clear()
|
confirmationDialog.accepted.connect(clearHistory);
|
||||||
|
confirmationDialog.open();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue