mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 06:57:28 -06:00
Make printer name field look less like a search field
This commit is contained in:
parent
8ce5593eec
commit
7c8c1838e0
1 changed files with 99 additions and 49 deletions
|
@ -29,7 +29,7 @@ Item
|
||||||
"Custom": -1
|
"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
|
// User-editable printer name
|
||||||
property alias printerName: printerNameTextField.text
|
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:
|
Component.onCompleted:
|
||||||
{
|
{
|
||||||
updateCurrentItemUponSectionChange()
|
updateCurrentItemUponSectionChange()
|
||||||
}
|
}
|
||||||
|
|
||||||
Item
|
Row
|
||||||
{
|
{
|
||||||
id: localPrinterSelectionItem
|
id: localPrinterSelectionItem
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
|
@ -71,16 +86,9 @@ Item
|
||||||
Cura.ScrollView
|
Cura.ScrollView
|
||||||
{
|
{
|
||||||
id: 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
|
height: (maxItemCountAtOnce * UM.Theme.getSize("action_button").height) - UM.Theme.getSize("default_margin").height
|
||||||
|
width: Math.floor(parent.width * 0.4)
|
||||||
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
|
||||||
ScrollBar.vertical.policy: ScrollBar.AsNeeded
|
|
||||||
|
|
||||||
clip: true
|
|
||||||
|
|
||||||
ListView
|
ListView
|
||||||
{
|
{
|
||||||
|
@ -183,45 +191,83 @@ Item
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Horizontal line
|
// Vertical line
|
||||||
Rectangle
|
Rectangle
|
||||||
{
|
{
|
||||||
id: horizontalLine
|
id: verticalLine
|
||||||
anchors.top: localPrinterSelectionItem.bottom
|
anchors.top: parent.top
|
||||||
anchors.left: parent.left
|
anchors.bottom: parent.bottom
|
||||||
anchors.right: parent.right
|
width: UM.Theme.getSize("default_lining").height
|
||||||
height: UM.Theme.getSize("default_lining").height
|
|
||||||
color: UM.Theme.getColor("lining")
|
color: UM.Theme.getColor("lining")
|
||||||
}
|
}
|
||||||
|
|
||||||
// User-editable printer name row
|
// User-editable printer name row
|
||||||
Row
|
Column
|
||||||
{
|
{
|
||||||
anchors.top: horizontalLine.bottom
|
width: Math.floor(parent.width * 0.6)
|
||||||
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
|
spacing: UM.Theme.getSize("default_margin").width
|
||||||
|
padding: UM.Theme.getSize("default_margin").width
|
||||||
|
|
||||||
|
Label
|
||||||
|
{
|
||||||
|
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
|
Label
|
||||||
{
|
{
|
||||||
text: catalog.i18nc("@label", "Printer name")
|
text: catalog.i18nc("@label", "Printer name")
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
font: UM.Theme.getFont("default")
|
||||||
font: UM.Theme.getFont("medium")
|
|
||||||
color: UM.Theme.getColor("text")
|
color: UM.Theme.getColor("text")
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
renderType: Text.NativeRendering
|
renderType: Text.NativeRendering
|
||||||
}
|
}
|
||||||
|
|
||||||
Cura.TextField
|
Cura.TextField
|
||||||
{
|
{
|
||||||
id: printerNameTextField
|
id: printerNameTextField
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
width: (parent.width / 2) | 0
|
|
||||||
placeholderText: catalog.i18nc("@text", "Please give your printer a name")
|
placeholderText: catalog.i18nc("@text", "Please give your printer a name")
|
||||||
maximumLength: 40
|
maximumLength: 40
|
||||||
validator: RegExpValidator
|
validator: RegExpValidator
|
||||||
|
@ -232,3 +278,7 @@ Item
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue