Revision control

+ // Copyright (C) 2022 The Qt Company Ltd.
+ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
+
+ import QtQuick
+ import QtQuick.Layouts
+ import QtQuick.Controls
+ import QtQuick.Window
+ import QtQuick.Dialogs
+ import QtCore
+
+ CustomDialog {
+ id: root
+
+ property string defaultPath: StandardPaths.standardLocations(StandardPaths.DesktopLocation)[0]
+ property bool clearNodeView: false
+ title: qsTr("New Effect Project")
+ width: 540
+ height: 400
+ modal: true
+ focus: true
+ standardButtons: Dialog.Ok | Dialog.Cancel
+ closePolicy: Popup.NoAutoClose
+
+ Component.onCompleted: {
+ pathTextEdit.text = g_propertyData["effects_path"]
+ ? g_propertyData["effects_path"]
+ : effectManager.stripFileFromURL(defaultPath);
+ pathTextEdit.enabled = true;
+ nameTextEdit.text = "Effect01"
+ }
+
+ FolderDialog {
+ id: projectPathDialog
+ currentFolder: defaultPath
+ onAccepted: {
+ if (currentFolder) {
+ // Remove file start
+ var usedFolder = effectManager.stripFileFromURL(currentFolder.toString());
+ pathTextEdit.text = usedFolder;
+ }
+ }
+ }
+
+ GridLayout {
+ width: parent.width
+ columns: 3
+ columnSpacing: 20
+ Label {
+ text: qsTr("Name:")
+ font.bold: true
+ font.pixelSize: 14
+ color: mainView.foregroundColor2
+ }
+ TextField {
+ id: nameTextEdit
+ Layout.columnSpan: 2
+ Layout.fillWidth: true
+ text: effectManager.projectName
+ }
+ Label {
+ text: qsTr("Create in:")
+ font.bold: true
+ font.pixelSize: 14
+ color: mainView.foregroundColor2
+ }
+ TextField {
+ id: pathTextEdit
+ Layout.fillWidth: true
+ text: effectManager.projectFilename
+ }
+ Button {
+ text: qsTr("Browse");
+ onClicked: {
+ projectPathDialog.open();
+ }
+ }
+ }
+ onAccepted: {
+ g_propertyData.effects_path = pathTextEdit.text
+ g_propertyData.effects_project_path = nameTextEdit.text
+ mainView.mainToolbar.setDesignModeInstantly(true);
+ effectManager.newProject(pathTextEdit.text, nameTextEdit.text, clearNodeView, true);
+ }
+ }