Merge pull request #4942 from Ultimaker/place_print_info_back

Place print info back
This commit is contained in:
alekseisasin 2018-12-07 13:39:12 +01:00 committed by GitHub
commit c232107e95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 118 additions and 109 deletions

View File

@ -4,19 +4,19 @@
import QtQuick 2.2 import QtQuick 2.2
import QtQuick.Controls 1.1 import QtQuick.Controls 1.1
import QtQuick.Controls.Styles 1.1 import QtQuick.Controls.Styles 1.1
import QtQuick.Layouts 1.1
import QtQuick.Dialogs 1.1
import QtQuick.Window 2.2
import UM 1.2 as UM import UM 1.2 as UM
import Cura 1.0 as Cura
Button Button
{ {
id: modelCheckerButton id: modelCheckerButton
UM.I18nCatalog{id: catalog; name: "cura"} UM.I18nCatalog
{
id: catalog
name: "cura"
}
visible: manager.hasWarnings visible: manager.hasWarnings
tooltip: catalog.i18nc("@info:tooltip", "Some things could be problematic in this print. Click to see tips for adjustment.") tooltip: catalog.i18nc("@info:tooltip", "Some things could be problematic in this print. Click to see tips for adjustment.")
@ -25,6 +25,8 @@ Button
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
anchors.verticalCenter: parent ? parent.verticalCenter : undefined
style: ButtonStyle style: ButtonStyle
{ {
background: Item background: Item

View File

@ -192,16 +192,6 @@ UM.MainWindow
} }
} }
JobSpecs
{
id: jobSpecs
anchors
{
bottom: parent.bottom
bottomMargin: UM.Theme.getSize("default_margin").height
}
}
Toolbar Toolbar
{ {
// The toolbar is the left bar that is populated by all the tools (which are dynamicly populated by // The toolbar is the left bar that is populated by all the tools (which are dynamicly populated by
@ -231,6 +221,19 @@ UM.MainWindow
} }
} }
JobSpecs
{
id: jobSpecs
visible: CuraApplication.platformActivity
anchors
{
left: parent.left
bottom: viewOrientationControls.top
margins: UM.Theme.getSize("default_margin").width
bottomMargin: UM.Theme.getSize("thin_margin").width
}
}
ViewOrientationControls ViewOrientationControls
{ {
id: viewOrientationControls id: viewOrientationControls
@ -238,9 +241,8 @@ UM.MainWindow
anchors anchors
{ {
left: parent.left left: parent.left
margins: UM.Theme.getSize("default_margin").width
bottom: parent.bottom bottom: parent.bottom
margins: UM.Theme.getSize("default_margin").width
} }
} }

View File

@ -111,7 +111,7 @@ Item
visible: source != "" && base.enabled visible: source != "" && base.enabled
width: UM.Theme.getSize("standard_arrow").width width: UM.Theme.getSize("standard_arrow").width
height: UM.Theme.getSize("standard_arrow").height height: UM.Theme.getSize("standard_arrow").height
color: UM.Theme.getColor("text") color: UM.Theme.getColor("small_button_text")
} }
MouseArea MouseArea

View File

@ -131,7 +131,7 @@ Item
visible: source != "" && base.enabled visible: source != "" && base.enabled
width: UM.Theme.getSize("standard_arrow").width width: UM.Theme.getSize("standard_arrow").width
height: UM.Theme.getSize("standard_arrow").height height: UM.Theme.getSize("standard_arrow").height
color: UM.Theme.getColor("text") color: UM.Theme.getColor("small_button_text")
} }
MouseArea MouseArea

View File

@ -9,60 +9,64 @@ 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"
}
width: childrenRect.width
height: childrenRect.height height: childrenRect.height
onActivityChanged: { onActivityChanged:
if (activity == false) {
//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 = ''
}
}
Rectangle
{ {
id: jobNameRow if (!activity)
anchors.top: parent.top {
anchors.right: parent.right //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)
height: UM.Theme.getSize("jobspecs_line").height PrintInformation.baseName = ""
visible: base.activity }
}
Item Item
{ {
width: parent.width id: jobNameRow
height: parent.height anchors.top: parent.top
anchors.left: parent.left
height: UM.Theme.getSize("jobspecs_line").height
Button Button
{ {
id: printJobPencilIcon id: printJobPencilIcon
anchors.right: parent.right anchors.left: parent.left
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
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
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.height: width; sourceSize.width: width
color: control.hovered ? UM.Theme.getColor("text_scene_hover") : UM.Theme.getColor("text_scene"); sourceSize.height: width
source: UM.Theme.getIcon("pencil"); color: control.hovered ? UM.Theme.getColor("text_scene_hover") : UM.Theme.getColor("text_scene")
source: UM.Theme.getIcon("pencil")
} }
} }
} }
@ -71,56 +75,44 @@ Item {
TextField TextField
{ {
id: printJobTextfield id: printJobTextfield
anchors.right: printJobPencilIcon.left anchors.left: printJobPencilIcon.right
anchors.rightMargin: Math.round(UM.Theme.getSize("default_margin").width / 2) anchors.leftMargin: 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
text: PrintInformation.jobName text: PrintInformation.jobName
horizontalAlignment: TextInput.AlignRight horizontalAlignment: TextInput.AlignLeft
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
} }
} }
} }
} }
}
Row {
id: additionalComponentsRow
anchors.top: jobNameRow.bottom
anchors.right: parent.right
}
Label Label
{ {
id: boundingSpec id: boundingSpec
anchors.top: jobNameRow.bottom anchors.top: jobNameRow.bottom
anchors.right: additionalComponentsRow.left anchors.left: parent.left
anchors.rightMargin:
{
if (additionalComponentsRow.width > 0)
{
return UM.Theme.getSize("default_margin").width
}
else
{
return 0;
}
}
height: UM.Theme.getSize("jobspecs_line").height height: UM.Theme.getSize("jobspecs_line").height
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
font: UM.Theme.getFont("default_bold") font: UM.Theme.getFont("default_bold")
@ -128,21 +120,34 @@ Item {
text: CuraApplication.getSceneBoundingBoxString 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") 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
} }
} }
} }
} }

View File

@ -124,8 +124,8 @@
"text_subtext": [0, 0, 0, 255], "text_subtext": [0, 0, 0, 255],
"text_medium": [128, 128, 128, 255], "text_medium": [128, 128, 128, 255],
"text_emphasis": [255, 255, 255, 255], "text_emphasis": [255, 255, 255, 255],
"text_scene": [31, 36, 39, 255], "text_scene": [102, 102, 102, 255],
"text_scene_hover": [70, 84, 113, 255], "text_scene_hover": [123, 123, 113, 255],
"error": [255, 140, 0, 255], "error": [255, 140, 0, 255],
"warning": [245, 166, 35, 255], "warning": [245, 166, 35, 255],
@ -145,10 +145,10 @@
"button_text_active_hover": [255, 255, 255, 255], "button_text_active_hover": [255, 255, 255, 255],
"small_button": [0, 0, 0, 0], "small_button": [0, 0, 0, 0],
"small_button_hover": [8, 7, 63, 255], "small_button_hover": [102, 102, 102, 255],
"small_button_active": [8, 7, 63, 255], "small_button_active": [10, 8, 80, 255],
"small_button_active_hover": [8, 7, 63, 255], "small_button_active_hover": [10, 8, 80, 255],
"small_button_text": [171, 171, 191, 255], "small_button_text": [102, 102, 102, 255],
"small_button_text_hover": [255, 255, 255, 255], "small_button_text_hover": [255, 255, 255, 255],
"small_button_text_active": [255, 255, 255, 255], "small_button_text_active": [255, 255, 255, 255],
"small_button_text_active_hover": [255, 255, 255, 255], "small_button_text_active_hover": [255, 255, 255, 255],