Welcome to mirror list, hosted at ThFree Co, Russian Federation.

CreateNewProjectPopup.qml « qml « resources « DigitalLibrary « plugins - github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 75fb8d58117a6192f3f7cdbd95bf49f0bf77221a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
// Copyright (C) 2021 Ultimaker B.V.

import QtQuick 2.10
import QtQuick.Window 2.2
import QtQuick.Controls 1.4 as OldControls // TableView doesn't exist in the QtQuick Controls 2.x in 5.10, so use the old one
import QtQuick.Controls 2.3
import QtQuick.Controls.Styles 1.4

import UM 1.2 as UM
import Cura 1.6 as Cura

import DigitalFactory 1.0 as DF


Popup
{
    id: base

    padding: UM.Theme.getSize("default_margin").width

    closePolicy: Popup.CloseOnEscape
    focus: true
    modal: true
    background: Cura.RoundedRectangle
    {
        cornerSide: Cura.RoundedRectangle.Direction.All
        border.color: UM.Theme.getColor("lining")
        border.width: UM.Theme.getSize("default_lining").width
        radius: UM.Theme.getSize("default_radius").width
        width: parent.width
        height: parent.height
        color: UM.Theme.getColor("main_background")
    }

    Connections
    {
        target: manager

        function onCreatingNewProjectStatusChanged(status)
        {
            if (status == DF.RetrievalStatus.Success)
            {
                base.close();
            }
        }
    }

    onOpened:
    {
        newProjectNameTextField.text = ""
        newProjectNameTextField.focus = true
    }

    Label
    {
        id: createNewLibraryProjectLabel
        text: "Create new Library project"
        font: UM.Theme.getFont("medium")
        color: UM.Theme.getColor("small_button_text")
        anchors
        {
            top: parent.top
            left: parent.left
            right: parent.right
        }
    }

    Label
    {
        id: projectNameLabel
        text: "Project Name"
        font: UM.Theme.getFont("default")
        color: UM.Theme.getColor("text")
        anchors
        {
            top: createNewLibraryProjectLabel.bottom
            topMargin: UM.Theme.getSize("default_margin").width
            left: parent.left
            right: parent.right
        }
    }

    Cura.TextField
    {
        id: newProjectNameTextField
        width: parent.width
        anchors
        {
            top: projectNameLabel.bottom
            topMargin: UM.Theme.getSize("thin_margin").width
            left: parent.left
            right: parent.right
        }
        validator: RegExpValidator
        {
            regExp: /^[^\\\/\*\?\|\[\]]{0,96}$/
        }

        text: PrintInformation.jobName
        font: UM.Theme.getFont("default")
        placeholderText: "Enter a name for your new project."
        onAccepted:
        {
            if (verifyProjectCreationButton.enabled)
            {
                verifyProjectCreationButton.clicked()
            }
        }
    }

    Label
    {
        id: errorWhileCreatingProjectLabel
        text: manager.projectCreationErrorText
        width: parent.width
        wrapMode: Text.WordWrap
        font: UM.Theme.getFont("default")
        color: UM.Theme.getColor("error")
        visible: manager.creatingNewProjectStatus == DF.RetrievalStatus.Failed
        anchors
        {
            top: newProjectNameTextField.bottom
            left: parent.left
            right: parent.right
        }
    }

    Cura.SecondaryButton
    {
        id: cancelProjectCreationButton

        anchors.bottom: parent.bottom
        anchors.left: parent.left

        text: "Cancel"

        onClicked:
        {
            base.close()
        }
        busy: false
    }

    Cura.PrimaryButton
    {
        id: verifyProjectCreationButton

        anchors.bottom: parent.bottom
        anchors.right: parent.right
        text: "Create"
        enabled: newProjectNameTextField.text != "" && !busy

        onClicked:
        {
            manager.createLibraryProjectAndSetAsPreselected(newProjectNameTextField.text)
        }
        busy: manager.creatingNewProjectStatus == DF.RetrievalStatus.InProgress
    }
}