|
@@ -9,118 +9,110 @@ import QtQuick.Layouts 1.1
|
|
|
import UM 1.1 as UM
|
|
|
import Cura 1.0 as Cura
|
|
|
|
|
|
-Item {
|
|
|
+Item
|
|
|
+{
|
|
|
id: base
|
|
|
|
|
|
property bool activity: CuraApplication.platformActivity
|
|
|
property string fileBaseName: PrintInformation.baseName
|
|
|
|
|
|
- UM.I18nCatalog { id: catalog; name: "cura"}
|
|
|
+ UM.I18nCatalog
|
|
|
+ {
|
|
|
+ id: catalog
|
|
|
+ name: "cura"
|
|
|
+ }
|
|
|
|
|
|
+ width: childrenRect.width
|
|
|
height: childrenRect.height
|
|
|
|
|
|
- onActivityChanged: {
|
|
|
- if (activity == false) {
|
|
|
+ onActivityChanged:
|
|
|
+ {
|
|
|
+ if (!activity)
|
|
|
+ {
|
|
|
//When there is no mesh in the buildplate; the printJobTextField is set to an empty string so it doesn't set an empty string as a jobName (which is later used for saving the file)
|
|
|
- PrintInformation.baseName = ''
|
|
|
+ PrintInformation.baseName = ""
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- Rectangle
|
|
|
+ Item
|
|
|
{
|
|
|
id: jobNameRow
|
|
|
anchors.top: parent.top
|
|
|
- anchors.right: parent.right
|
|
|
+ anchors.left: parent.left
|
|
|
height: UM.Theme.getSize("jobspecs_line").height
|
|
|
- visible: base.activity
|
|
|
|
|
|
- Item
|
|
|
+ Button
|
|
|
{
|
|
|
- width: parent.width
|
|
|
- height: parent.height
|
|
|
+ id: printJobPencilIcon
|
|
|
+ anchors.left: parent.left
|
|
|
+ anchors.verticalCenter: parent.verticalCenter
|
|
|
+ width: UM.Theme.getSize("save_button_specs_icons").width
|
|
|
+ height: UM.Theme.getSize("save_button_specs_icons").height
|
|
|
|
|
|
- Button
|
|
|
+ onClicked:
|
|
|
{
|
|
|
- id: printJobPencilIcon
|
|
|
- anchors.right: parent.right
|
|
|
- anchors.verticalCenter: parent.verticalCenter
|
|
|
- width: UM.Theme.getSize("save_button_specs_icons").width
|
|
|
- height: UM.Theme.getSize("save_button_specs_icons").height
|
|
|
+ printJobTextfield.selectAll()
|
|
|
+ printJobTextfield.focus = true
|
|
|
+ }
|
|
|
|
|
|
- onClicked:
|
|
|
- {
|
|
|
- printJobTextfield.selectAll();
|
|
|
- printJobTextfield.focus = true;
|
|
|
- }
|
|
|
- style: ButtonStyle
|
|
|
+ style: ButtonStyle
|
|
|
+ {
|
|
|
+ background: Item
|
|
|
{
|
|
|
- background: Item
|
|
|
+ UM.RecolorImage
|
|
|
{
|
|
|
- UM.RecolorImage
|
|
|
- {
|
|
|
- width: UM.Theme.getSize("save_button_specs_icons").width;
|
|
|
- height: UM.Theme.getSize("save_button_specs_icons").height;
|
|
|
- sourceSize.height: width;
|
|
|
- color: control.hovered ? UM.Theme.getColor("text_scene_hover") : UM.Theme.getColor("text_scene");
|
|
|
- source: UM.Theme.getIcon("pencil");
|
|
|
- }
|
|
|
+ width: UM.Theme.getSize("save_button_specs_icons").width
|
|
|
+ height: UM.Theme.getSize("save_button_specs_icons").height
|
|
|
+ sourceSize.width: width
|
|
|
+ sourceSize.height: width
|
|
|
+ color: control.hovered ? UM.Theme.getColor("text_scene_hover") : UM.Theme.getColor("text_scene")
|
|
|
+ source: UM.Theme.getIcon("pencil")
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ }
|
|
|
+
|
|
|
+ TextField
|
|
|
+ {
|
|
|
+ id: printJobTextfield
|
|
|
+ anchors.left: printJobPencilIcon.right
|
|
|
+ anchors.leftMargin: UM.Theme.getSize("narrow_margin").width
|
|
|
+ height: UM.Theme.getSize("jobspecs_line").height
|
|
|
+ width: Math.max(__contentWidth + UM.Theme.getSize("default_margin").width, 50)
|
|
|
+ maximumLength: 120
|
|
|
+ text: PrintInformation.jobName
|
|
|
+ horizontalAlignment: TextInput.AlignLeft
|
|
|
+
|
|
|
+ onEditingFinished:
|
|
|
+ {
|
|
|
+ var new_name = text == "" ? catalog.i18nc("@text Print job name", "Untitled") : text
|
|
|
+ PrintInformation.setJobName(new_name, true)
|
|
|
+ printJobTextfield.focus = false
|
|
|
+ }
|
|
|
+
|
|
|
+ validator: RegExpValidator {
|
|
|
+ regExp: /^[^\\\/\*\?\|\[\]]*$/
|
|
|
+ }
|
|
|
|
|
|
- TextField
|
|
|
+ style: TextFieldStyle
|
|
|
{
|
|
|
- id: printJobTextfield
|
|
|
- anchors.right: printJobPencilIcon.left
|
|
|
- anchors.rightMargin: Math.round(UM.Theme.getSize("default_margin").width / 2)
|
|
|
- height: UM.Theme.getSize("jobspecs_line").height
|
|
|
- width: Math.max(__contentWidth + UM.Theme.getSize("default_margin").width, 50)
|
|
|
- maximumLength: 120
|
|
|
- property int unremovableSpacing: 5
|
|
|
- text: PrintInformation.jobName
|
|
|
- horizontalAlignment: TextInput.AlignRight
|
|
|
- onEditingFinished: {
|
|
|
- var new_name = text == "" ? catalog.i18nc("@text Print job name", "Untitled") : text;
|
|
|
- PrintInformation.setJobName(new_name, true);
|
|
|
- printJobTextfield.focus = false;
|
|
|
- }
|
|
|
- validator: RegExpValidator {
|
|
|
- regExp: /^[^\\\/\*\?\|\[\]]*$/
|
|
|
- }
|
|
|
- style: TextFieldStyle{
|
|
|
- textColor: UM.Theme.getColor("text_scene");
|
|
|
- font: UM.Theme.getFont("default_bold");
|
|
|
- background: Rectangle {
|
|
|
- opacity: 0
|
|
|
- border.width: 0
|
|
|
- }
|
|
|
+ textColor: UM.Theme.getColor("text_scene")
|
|
|
+ font: UM.Theme.getFont("default_bold")
|
|
|
+ background: Rectangle
|
|
|
+ {
|
|
|
+ opacity: 0
|
|
|
+ border.width: 0
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- Row {
|
|
|
- id: additionalComponentsRow
|
|
|
- anchors.top: jobNameRow.bottom
|
|
|
- anchors.right: parent.right
|
|
|
- }
|
|
|
-
|
|
|
Label
|
|
|
{
|
|
|
id: boundingSpec
|
|
|
anchors.top: jobNameRow.bottom
|
|
|
- anchors.right: additionalComponentsRow.left
|
|
|
- anchors.rightMargin:
|
|
|
- {
|
|
|
- if (additionalComponentsRow.width > 0)
|
|
|
- {
|
|
|
- return UM.Theme.getSize("default_margin").width
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- return 0;
|
|
|
- }
|
|
|
- }
|
|
|
+ anchors.left: parent.left
|
|
|
+
|
|
|
height: UM.Theme.getSize("jobspecs_line").height
|
|
|
verticalAlignment: Text.AlignVCenter
|
|
|
font: UM.Theme.getFont("default_bold")
|
|
@@ -128,21 +120,34 @@ Item {
|
|
|
text: CuraApplication.getSceneBoundingBoxString
|
|
|
}
|
|
|
|
|
|
- Component.onCompleted: {
|
|
|
+ Row
|
|
|
+ {
|
|
|
+ id: additionalComponentsRow
|
|
|
+ anchors.top: boundingSpec.top
|
|
|
+ anchors.bottom: boundingSpec.bottom
|
|
|
+ anchors.left: boundingSpec.right
|
|
|
+ anchors.leftMargin: UM.Theme.getSize("default_margin").width
|
|
|
+ }
|
|
|
+
|
|
|
+ Component.onCompleted:
|
|
|
+ {
|
|
|
base.addAdditionalComponents("jobSpecsButton")
|
|
|
}
|
|
|
|
|
|
- Connections {
|
|
|
+ Connections
|
|
|
+ {
|
|
|
target: CuraApplication
|
|
|
onAdditionalComponentsChanged: base.addAdditionalComponents("jobSpecsButton")
|
|
|
}
|
|
|
|
|
|
- function addAdditionalComponents (areaId) {
|
|
|
- if(areaId == "jobSpecsButton") {
|
|
|
- for (var component in CuraApplication.additionalComponents["jobSpecsButton"]) {
|
|
|
+ function addAdditionalComponents(areaId)
|
|
|
+ {
|
|
|
+ if (areaId == "jobSpecsButton")
|
|
|
+ {
|
|
|
+ for (var component in CuraApplication.additionalComponents["jobSpecsButton"])
|
|
|
+ {
|
|
|
CuraApplication.additionalComponents["jobSpecsButton"][component].parent = additionalComponentsRow
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
}
|