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

RecommendedQualityProfileSelector.qml « Recommended « PrintSetupSelector « qml « resources - github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7c527f9448b083115d1e60185bf250b3535bc19f (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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
// Copyright (c) 2019 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.

import QtQuick 2.10
import QtQuick.Controls 1.4
import QtQuick.Controls 2.3 as Controls2
import QtQuick.Controls.Styles 1.4

import UM 1.2 as UM
import Cura 1.6 as Cura
import ".."

Item
{
    id: qualityRow
    height: childrenRect.height

    property real labelColumnWidth: Math.round(width / 3)
    property real settingsColumnWidth: width - labelColumnWidth

    // Here are the elements that are shown in the left column

    Column
    {
        anchors
        {
            left: parent.left
            right: parent.right
        }

        spacing: UM.Theme.getSize("default_margin").height

        Controls2.ButtonGroup
        {
            id: activeProfileButtonGroup
            exclusive: true
            onClicked: Cura.IntentManager.selectIntent(button.modelData.intent_category, button.modelData.quality_type)
        }

        Item
        {
            height: childrenRect.height
            anchors
            {
                left: parent.left
                right: parent.right
            }
            Cura.IconWithText
            {
                id: profileLabel
                source: UM.Theme.getIcon("category_layer_height")
                text: catalog.i18nc("@label", "Profiles")
                font: UM.Theme.getFont("medium")
                width: labelColumnWidth
            }
            UM.SimpleButton
            {
                id: resetToDefaultQualityButton

                visible: Cura.SimpleModeSettingsManager.isProfileCustomized || Cura.MachineManager.hasCustomQuality
                height: visible ? UM.Theme.getSize("print_setup_icon").height : 0
                width: height
                anchors
                {
                    right: profileLabel.right
                    rightMargin: UM.Theme.getSize("default_margin").width
                    leftMargin: UM.Theme.getSize("default_margin").width
                    verticalCenter: parent.verticalCenter
                }

                color: hovered ? UM.Theme.getColor("setting_control_button_hover") : UM.Theme.getColor("setting_control_button")
                iconSource: UM.Theme.getIcon("reset")

                onClicked:
                {
                    // if the current profile is user-created, switch to a built-in quality
                    Cura.MachineManager.resetToUseDefaultQuality()
                }
                onEntered:
                {
                    var tooltipContent = catalog.i18nc("@tooltip","You have modified some profile settings. If you want to change these go to custom mode.")
                    base.showTooltip(qualityRow, Qt.point(-UM.Theme.getSize("thick_margin").width, 0),  tooltipContent)
                }
                onExited: base.hideTooltip()
            }

            Cura.LabelBar
            {
                id: labelbar
                anchors
                {
                    left: profileLabel.right
                    right: parent.right
                }

                model: Cura.QualityProfilesDropDownMenuModel
                modelKey: "layer_height"
            }
        }


        Repeater
        {
            model: Cura.IntentCategoryModel {}
            Item
            {
                anchors
                {
                    left: parent.left
                    right: parent.right
                }
                height: intentCategoryLabel.height

                Label
                {
                    id: intentCategoryLabel
                    text: model.name
                    width: labelColumnWidth - UM.Theme.getSize("section_icon").width
                    anchors.left: parent.left
                    anchors.leftMargin: UM.Theme.getSize("section_icon").width + UM.Theme.getSize("narrow_margin").width
                    font: UM.Theme.getFont("medium")
                    color: UM.Theme.getColor("text")
                    renderType: Text.NativeRendering
                    elide: Text.ElideRight
                }

                Cura.RadioCheckbar
                {
                    anchors
                    {
                        left: intentCategoryLabel.right
                        right: parent.right
                    }
                    dataModel: model["qualities"]
                    buttonGroup: activeProfileButtonGroup

                    function checkedFunction(modelItem)
                    {
                        if(Cura.MachineManager.hasCustomQuality)
                        {
                            // When user created profile is active, no quality tickbox should be active.
                            return false
                        }

                        if(modelItem === null)
                        {
                            return false
                        }
                        return Cura.MachineManager.activeQualityType == modelItem.quality_type && Cura.MachineManager.activeIntentCategory == modelItem.intent_category
                    }

                    isCheckedFunction: checkedFunction
                }

                MouseArea // Intent description tooltip hover area
                {
                    id: intentDescriptionHoverArea
                    anchors.fill: parent
                    hoverEnabled: true
                    enabled: model.description !== undefined
                    acceptedButtons: Qt.NoButton // react to hover only, don't steal clicks

                    Timer
                    {
                        id: intentTooltipTimer
                        interval: 500
                        running: false
                        repeat: false
                        onTriggered: base.showTooltip(
                            intentCategoryLabel,
                            Qt.point(-(intentCategoryLabel.x - qualityRow.x) - UM.Theme.getSize("thick_margin").width, 0),
                            model.description
                        )
                    }

                    onEntered: intentTooltipTimer.start()
                    onExited: base.hideTooltip()
                }

                NoIntentIcon // This icon has hover priority over intentDescriptionHoverArea, so draw it above it.
                {
                    affected_extruders: Cura.MachineManager.extruderPositionsWithNonActiveIntent
                    intent_type: model.name
                    anchors.right: intentCategoryLabel.right
                    anchors.rightMargin: UM.Theme.getSize("narrow_margin").width
                    width: intentCategoryLabel.height * 0.75
                    anchors.verticalCenter: parent.verticalCenter
                    height: width
                    visible: Cura.MachineManager.activeIntentCategory == model.intent_category && affected_extruders.length
                }


            }

        }
    }
}