mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 20:48:59 +08:00
Code style in JobSpecs
This commit is contained in:
parent
537929893f
commit
5b57e6bf30
@ -9,20 +9,27 @@ import QtQuick.Layouts 1.1
|
|||||||
import UM 1.1 as UM
|
import UM 1.1 as UM
|
||||||
import Cura 1.0 as Cura
|
import Cura 1.0 as Cura
|
||||||
|
|
||||||
Item {
|
Item
|
||||||
|
{
|
||||||
id: base
|
id: base
|
||||||
|
|
||||||
property bool activity: CuraApplication.platformActivity
|
property bool activity: CuraApplication.platformActivity
|
||||||
property string fileBaseName: PrintInformation.baseName
|
property string fileBaseName: PrintInformation.baseName
|
||||||
|
|
||||||
UM.I18nCatalog { id: catalog; name: "cura"}
|
UM.I18nCatalog
|
||||||
|
{
|
||||||
|
id: catalog
|
||||||
|
name:"cura"
|
||||||
|
}
|
||||||
|
|
||||||
height: childrenRect.height
|
height: childrenRect.height
|
||||||
|
|
||||||
onActivityChanged: {
|
onActivityChanged:
|
||||||
if (activity == false) {
|
{
|
||||||
|
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)
|
//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 = ""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,21 +56,22 @@ Item {
|
|||||||
|
|
||||||
onClicked:
|
onClicked:
|
||||||
{
|
{
|
||||||
printJobTextfield.selectAll();
|
printJobTextfield.selectAll()
|
||||||
printJobTextfield.focus = true;
|
printJobTextfield.focus = true
|
||||||
}
|
}
|
||||||
|
|
||||||
style: ButtonStyle
|
style: ButtonStyle
|
||||||
{
|
{
|
||||||
background: Item
|
background: Item
|
||||||
{
|
{
|
||||||
UM.RecolorImage
|
UM.RecolorImage
|
||||||
{
|
{
|
||||||
width: UM.Theme.getSize("save_button_specs_icons").width;
|
width: UM.Theme.getSize("save_button_specs_icons").width
|
||||||
height: UM.Theme.getSize("save_button_specs_icons").height;
|
height: UM.Theme.getSize("save_button_specs_icons").height
|
||||||
sourceSize.width: width;
|
sourceSize.width: width
|
||||||
sourceSize.height: width;
|
sourceSize.height: width
|
||||||
color: control.hovered ? UM.Theme.getColor("text_scene_hover") : UM.Theme.getColor("text_scene");
|
color: control.hovered ? UM.Theme.getColor("text_scene_hover") : UM.Theme.getColor("text_scene")
|
||||||
source: UM.Theme.getIcon("pencil");
|
source: UM.Theme.getIcon("pencil")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -73,25 +81,31 @@ Item {
|
|||||||
{
|
{
|
||||||
id: printJobTextfield
|
id: printJobTextfield
|
||||||
anchors.right: printJobPencilIcon.left
|
anchors.right: printJobPencilIcon.left
|
||||||
anchors.rightMargin: Math.round(UM.Theme.getSize("default_margin").width / 2)
|
anchors.rightMargin: UM.Theme.getSize("narrow_margin").width
|
||||||
height: UM.Theme.getSize("jobspecs_line").height
|
height: UM.Theme.getSize("jobspecs_line").height
|
||||||
width: Math.max(__contentWidth + UM.Theme.getSize("default_margin").width, 50)
|
width: Math.max(__contentWidth + UM.Theme.getSize("default_margin").width, 50)
|
||||||
maximumLength: 120
|
maximumLength: 120
|
||||||
property int unremovableSpacing: 5
|
property int unremovableSpacing: 5
|
||||||
text: PrintInformation.jobName
|
text: PrintInformation.jobName
|
||||||
horizontalAlignment: TextInput.AlignRight
|
horizontalAlignment: TextInput.AlignRight
|
||||||
onEditingFinished: {
|
|
||||||
var new_name = text == "" ? catalog.i18nc("@text Print job name", "Untitled") : text;
|
onEditingFinished:
|
||||||
PrintInformation.setJobName(new_name, true);
|
{
|
||||||
printJobTextfield.focus = false;
|
var new_name = text == "" ? catalog.i18nc("@text Print job name", "Untitled") : text
|
||||||
|
PrintInformation.setJobName(new_name, true)
|
||||||
|
printJobTextfield.focus = false
|
||||||
}
|
}
|
||||||
|
|
||||||
validator: RegExpValidator {
|
validator: RegExpValidator {
|
||||||
regExp: /^[^\\\/\*\?\|\[\]]*$/
|
regExp: /^[^\\\/\*\?\|\[\]]*$/
|
||||||
}
|
}
|
||||||
style: TextFieldStyle{
|
|
||||||
textColor: UM.Theme.getColor("text_scene");
|
style: TextFieldStyle
|
||||||
font: UM.Theme.getFont("default_bold");
|
{
|
||||||
background: Rectangle {
|
textColor: UM.Theme.getColor("text_scene")
|
||||||
|
font: UM.Theme.getFont("default_bold")
|
||||||
|
background: Rectangle
|
||||||
|
{
|
||||||
opacity: 0
|
opacity: 0
|
||||||
border.width: 0
|
border.width: 0
|
||||||
}
|
}
|
||||||
@ -100,7 +114,8 @@ Item {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Row {
|
Row
|
||||||
|
{
|
||||||
id: additionalComponentsRow
|
id: additionalComponentsRow
|
||||||
anchors.top: jobNameRow.bottom
|
anchors.top: jobNameRow.bottom
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
@ -117,10 +132,7 @@ Item {
|
|||||||
{
|
{
|
||||||
return UM.Theme.getSize("default_margin").width
|
return UM.Theme.getSize("default_margin").width
|
||||||
}
|
}
|
||||||
else
|
return 0
|
||||||
{
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
height: UM.Theme.getSize("jobspecs_line").height
|
height: UM.Theme.getSize("jobspecs_line").height
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
@ -129,21 +141,25 @@ Item {
|
|||||||
text: CuraApplication.getSceneBoundingBoxString
|
text: CuraApplication.getSceneBoundingBoxString
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted:
|
||||||
|
{
|
||||||
base.addAdditionalComponents("jobSpecsButton")
|
base.addAdditionalComponents("jobSpecsButton")
|
||||||
}
|
}
|
||||||
|
|
||||||
Connections {
|
Connections
|
||||||
|
{
|
||||||
target: CuraApplication
|
target: CuraApplication
|
||||||
onAdditionalComponentsChanged: base.addAdditionalComponents("jobSpecsButton")
|
onAdditionalComponentsChanged: base.addAdditionalComponents("jobSpecsButton")
|
||||||
}
|
}
|
||||||
|
|
||||||
function addAdditionalComponents (areaId) {
|
function addAdditionalComponents (areaId)
|
||||||
if(areaId == "jobSpecsButton") {
|
{
|
||||||
for (var component in CuraApplication.additionalComponents["jobSpecsButton"]) {
|
if (areaId == "jobSpecsButton")
|
||||||
|
{
|
||||||
|
for (var component in CuraApplication.additionalComponents["jobSpecsButton"])
|
||||||
|
{
|
||||||
CuraApplication.additionalComponents["jobSpecsButton"][component].parent = additionalComponentsRow
|
CuraApplication.additionalComponents["jobSpecsButton"][component].parent = additionalComponentsRow
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user