mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-06-04 11:14:21 +08:00
Make printer name field look less like a search field
This commit is contained in:
parent
8ce5593eec
commit
7c8c1838e0
@ -29,7 +29,7 @@ Item
|
||||
"Custom": -1
|
||||
}
|
||||
|
||||
property int maxItemCountAtOnce: 10 // show at max 10 items at once, otherwise you need to scroll.
|
||||
property int maxItemCountAtOnce: 11 // show at max 11 items at once, otherwise you need to scroll.
|
||||
|
||||
// User-editable printer name
|
||||
property alias printerName: printerNameTextField.text
|
||||
@ -54,12 +54,27 @@ Item
|
||||
}
|
||||
}
|
||||
|
||||
function getMachineName()
|
||||
{
|
||||
return machineList.model.getItem(machineList.currentIndex) != undefined ? machineList.model.getItem(machineList.currentIndex).name : "";
|
||||
}
|
||||
|
||||
function getMachineMetaDataEntry(key)
|
||||
{
|
||||
var metadata = machineList.model.getItem(machineList.currentIndex) != undefined ? machineList.model.getItem(machineList.currentIndex).metadata : undefined;
|
||||
if (metadata)
|
||||
{
|
||||
return metadata[key];
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
Component.onCompleted:
|
||||
{
|
||||
updateCurrentItemUponSectionChange()
|
||||
}
|
||||
|
||||
Item
|
||||
Row
|
||||
{
|
||||
id: localPrinterSelectionItem
|
||||
anchors.left: parent.left
|
||||
@ -71,16 +86,9 @@ Item
|
||||
Cura.ScrollView
|
||||
{
|
||||
id: scrollView
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.top: parent.top
|
||||
|
||||
height: (maxItemCountAtOnce * UM.Theme.getSize("action_button").height) - UM.Theme.getSize("default_margin").height
|
||||
|
||||
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
||||
ScrollBar.vertical.policy: ScrollBar.AsNeeded
|
||||
|
||||
clip: true
|
||||
width: Math.floor(parent.width * 0.4)
|
||||
|
||||
ListView
|
||||
{
|
||||
@ -183,52 +191,94 @@ Item
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Horizontal line
|
||||
Rectangle
|
||||
{
|
||||
id: horizontalLine
|
||||
anchors.top: localPrinterSelectionItem.bottom
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
height: UM.Theme.getSize("default_lining").height
|
||||
color: UM.Theme.getColor("lining")
|
||||
}
|
||||
|
||||
// User-editable printer name row
|
||||
Row
|
||||
{
|
||||
anchors.top: horizontalLine.bottom
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.topMargin: UM.Theme.getSize("default_lining").height
|
||||
anchors.leftMargin: UM.Theme.getSize("default_margin").width
|
||||
|
||||
spacing: UM.Theme.getSize("default_margin").width
|
||||
|
||||
Label
|
||||
// Vertical line
|
||||
Rectangle
|
||||
{
|
||||
text: catalog.i18nc("@label", "Printer name")
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
font: UM.Theme.getFont("medium")
|
||||
color: UM.Theme.getColor("text")
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
renderType: Text.NativeRendering
|
||||
id: verticalLine
|
||||
anchors.top: parent.top
|
||||
anchors.bottom: parent.bottom
|
||||
width: UM.Theme.getSize("default_lining").height
|
||||
color: UM.Theme.getColor("lining")
|
||||
}
|
||||
|
||||
Cura.TextField
|
||||
// User-editable printer name row
|
||||
Column
|
||||
{
|
||||
id: printerNameTextField
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
width: (parent.width / 2) | 0
|
||||
placeholderText: catalog.i18nc("@text", "Please give your printer a name")
|
||||
maximumLength: 40
|
||||
validator: RegExpValidator
|
||||
width: Math.floor(parent.width * 0.6)
|
||||
|
||||
spacing: UM.Theme.getSize("default_margin").width
|
||||
padding: UM.Theme.getSize("default_margin").width
|
||||
|
||||
Label
|
||||
{
|
||||
regExp: printerNameTextField.machineNameValidator.machineNameRegex
|
||||
width: parent.width
|
||||
wrapMode: Text.WordWrap
|
||||
text: base.getMachineName()
|
||||
color: UM.Theme.getColor("primary_button")
|
||||
font: UM.Theme.getFont("huge")
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
Grid
|
||||
{
|
||||
width: parent.width
|
||||
columns: 2
|
||||
rowSpacing: UM.Theme.getSize("default_lining").height
|
||||
columnSpacing: UM.Theme.getSize("default_margin").width
|
||||
|
||||
verticalItemAlignment: Grid.AlignVCenter
|
||||
|
||||
Label
|
||||
{
|
||||
text: catalog.i18nc("@label", "Manufacturer")
|
||||
font: UM.Theme.getFont("default")
|
||||
color: UM.Theme.getColor("text")
|
||||
renderType: Text.NativeRendering
|
||||
}
|
||||
Label
|
||||
{
|
||||
text: base.getMachineMetaDataEntry("manufacturer")
|
||||
font: UM.Theme.getFont("default")
|
||||
color: UM.Theme.getColor("text")
|
||||
renderType: Text.NativeRendering
|
||||
}
|
||||
Label
|
||||
{
|
||||
text: catalog.i18nc("@label", "Author")
|
||||
font: UM.Theme.getFont("default")
|
||||
color: UM.Theme.getColor("text")
|
||||
renderType: Text.NativeRendering
|
||||
}
|
||||
Label
|
||||
{
|
||||
text: base.getMachineMetaDataEntry("author")
|
||||
font: UM.Theme.getFont("default")
|
||||
color: UM.Theme.getColor("text")
|
||||
renderType: Text.NativeRendering
|
||||
}
|
||||
|
||||
Label
|
||||
{
|
||||
text: catalog.i18nc("@label", "Printer name")
|
||||
font: UM.Theme.getFont("default")
|
||||
color: UM.Theme.getColor("text")
|
||||
renderType: Text.NativeRendering
|
||||
}
|
||||
|
||||
Cura.TextField
|
||||
{
|
||||
id: printerNameTextField
|
||||
placeholderText: catalog.i18nc("@text", "Please give your printer a name")
|
||||
maximumLength: 40
|
||||
validator: RegExpValidator
|
||||
{
|
||||
regExp: printerNameTextField.machineNameValidator.machineNameRegex
|
||||
}
|
||||
property var machineNameValidator: Cura.MachineNameValidator { }
|
||||
}
|
||||
}
|
||||
property var machineNameValidator: Cura.MachineNameValidator { }
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user