Replace usage of controls label with our custom label

This prevents copy pasting a bunch of parameters that we set by default
This commit is contained in:
Jaime van Kessel 2021-11-10 16:37:26 +01:00
parent 0bb09a4783
commit 83be495414
68 changed files with 225 additions and 572 deletions

View file

@ -3,7 +3,7 @@
import QtQuick 2.2
import QtQuick.Controls 2.0
import UM 1.3 as UM
import UM 1.5 as UM
/**
* This component comprises a buildplate icon and the buildplate name. It is
@ -57,19 +57,15 @@ Item
}
}
Label
UM.Label
{
id: buildplateLabel
color: UM.Theme.getColor("text")
elide: Text.ElideRight
font: UM.Theme.getFont("default") // 12pt, regular
text: buildplate ? buildplate : ""
visible: text !== ""
// FIXED-LINE-HEIGHT:
height: 18 * screenScaleFactor // TODO: Theme!
verticalAlignment: Text.AlignVCenter
renderType: Text.NativeRendering
}
}
}

View file

@ -5,7 +5,7 @@ import QtQuick 2.3
import QtQuick.Controls 1.4
import QtQuick.Layouts 1.3
import QtQuick.Dialogs 1.2
import UM 1.3 as UM
import UM 1.5 as UM
UM.Dialog
{
@ -63,7 +63,7 @@ UM.Dialog
}
]
Label
UM.Label
{
anchors
{
@ -72,7 +72,6 @@ UM.Dialog
bottomMargin: 56 * screenScaleFactor // TODO: Theme!
}
wrapMode: Text.WordWrap
renderType: Text.NativeRendering
text:
{
if (!printer || !printer.activePrintJob)

View file

@ -3,7 +3,7 @@
import QtQuick 2.3
import QtQuick.Controls 2.0
import UM 1.3 as UM
import UM 1.5 as UM
import Cura 1.0 as Cura
Button
@ -17,13 +17,12 @@ Button
radius: Math.round(0.5 * width)
width: base.width
}
contentItem: Label {
contentItem: UM.Label
{
color: enabled ? UM.Theme.getColor("text") : UM.Theme.getColor("monitor_text_disabled")
font.pixelSize: 32 * screenScaleFactor
horizontalAlignment: Text.AlignHCenter
text: base.text
verticalAlignment: Text.AlignVCenter
renderType: Text.NativeRendering;
}
height: width
hoverEnabled: enabled

View file

@ -3,7 +3,7 @@
import QtQuick 2.2
import QtQuick.Controls 2.0
import UM 1.3 as UM
import UM 1.5 as UM
/**
* This component is a sort of "super icon" which includes a colored SVG image
@ -35,18 +35,16 @@ Item
width: size
}
Label
UM.Label
{
id: positionLabel
anchors.centerIn: icon
font: UM.Theme.getFont("small")
color: UM.Theme.getColor("text")
height: Math.round(size / 2)
horizontalAlignment: Text.AlignHCenter
text: position + 1
verticalAlignment: Text.AlignVCenter
width: Math.round(size / 2)
visible: position >= 0
renderType: Text.NativeRendering
}
}

View file

@ -2,7 +2,7 @@
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.2
import QtQuick.Controls 2.0
import UM 1.3 as UM
import UM 1.5 as UM
import Cura 1.0 as Cura
/**
@ -55,10 +55,9 @@ Item
visible: !printJob
radius: 2 * screenScaleFactor // TODO: Theme!
}
Label
UM.Label
{
text: printJob && printJob.name ? printJob.name : ""
color: UM.Theme.getColor("text")
elide: Text.ElideRight
font: UM.Theme.getFont("medium") // 14pt, regular
visible: printJob
@ -66,8 +65,6 @@ Item
// FIXED-LINE-HEIGHT:
width: parent.width
height: parent.height
verticalAlignment: Text.AlignVCenter
renderType: Text.NativeRendering
}
}
@ -86,18 +83,15 @@ Item
radius: 2 * screenScaleFactor // TODO: Theme!
}
Label
UM.Label
{
text: printJob ? OutputDevice.formatDuration(printJob.timeTotal) : ""
color: UM.Theme.getColor("text")
elide: Text.ElideRight
font: UM.Theme.getFont("medium") // 14pt, regular
visible: printJob
// FIXED-LINE-HEIGHT:
height: Math.round(18 * screenScaleFactor) // TODO: Theme!
verticalAlignment: Text.AlignVCenter
renderType: Text.NativeRendering
}
}
@ -116,11 +110,10 @@ Item
radius: 2 * screenScaleFactor // TODO: Theme!
}
Label
UM.Label
{
id: printerAssignmentLabel
anchors.verticalCenter: parent.verticalCenter
color: UM.Theme.getColor("text")
elide: Text.ElideRight
font: UM.Theme.getFont("medium") // 14pt, regular
text: {
@ -143,8 +136,6 @@ Item
// FIXED-LINE-HEIGHT:
height: parent.height
verticalAlignment: Text.AlignVCenter
renderType: Text.NativeRendering
}
Row
@ -186,17 +177,15 @@ Item
height: Math.round(72 * screenScaleFactor) // TODO: Theme!
}
Label {
UM.Label
{
text: printJob && printJob.owner ? printJob.owner : ""
color: UM.Theme.getColor("text")
elide: Text.ElideRight
font: UM.Theme.getFont("medium") // 14pt, regular
anchors.top: printerConfiguration.top
// FIXED-LINE-HEIGHT:
height: Math.round(18 * screenScaleFactor) // TODO: Theme!
verticalAlignment: Text.AlignVCenter
renderType: Text.NativeRendering
}
}
}

View file

@ -4,7 +4,7 @@
import QtQuick 2.3
import QtQuick.Controls.Styles 1.3
import QtQuick.Controls 1.4
import UM 1.3 as UM
import UM 1.5 as UM
/**
* NOTE: For most labels, a fixed height with vertical alignment is used to make
@ -34,7 +34,7 @@ Item
width: UM.Theme.getSize("monitor_progress_bar").width
}
Label
UM.Label
{
id: percentLabel
anchors
@ -46,14 +46,11 @@ Item
text: printJob ? Math.round(printJob.progress * 100) + "%" : "0%"
color: printJob && printJob.isActive ? UM.Theme.getColor("text") : UM.Theme.getColor("monitor_text_disabled")
width: contentWidth
font: UM.Theme.getFont("default") // 12pt, regular
// FIXED-LINE-HEIGHT:
height: UM.Theme.getSize("monitor_text_line").height
verticalAlignment: Text.AlignVCenter
renderType: Text.NativeRendering
}
Label
UM.Label
{
id: statusLabel
anchors
@ -62,8 +59,6 @@ Item
leftMargin: UM.Theme.getSize("monitor_margin").width
verticalCenter: parent.verticalCenter
}
color: UM.Theme.getColor("text")
font: UM.Theme.getFont("default")
text:
{
if (!printJob)
@ -104,7 +99,5 @@ Item
// FIXED-LINE-HEIGHT:
height: UM.Theme.getSize("monitor_text_line").height
verticalAlignment: Text.AlignVCenter
renderType: Text.NativeRendering
}
}

View file

@ -4,7 +4,7 @@
import QtQuick 2.3
import QtQuick.Controls 2.0
import QtQuick.Dialogs 1.1
import UM 1.3 as UM
import UM 1.5 as UM
import Cura 1.0 as Cura
/**
@ -100,10 +100,9 @@ Item
width: parent.width
radius: 2 * screenScaleFactor // TODO: Theme!
Label
UM.Label
{
text: printer && printer.name ? printer.name : ""
color: UM.Theme.getColor("text")
elide: Text.ElideRight
font: UM.Theme.getFont("large") // 16pt, bold
width: parent.width
@ -111,8 +110,6 @@ Item
// FIXED-LINE-HEIGHT:
height: parent.height
verticalAlignment: Text.AlignVCenter
renderType: Text.NativeRendering
}
}
@ -138,21 +135,20 @@ Item
Item
{
id: managePrinterLink
anchors {
anchors
{
top: printerFamilyPill.bottom
topMargin: UM.Theme.getSize("narrow_margin").height
}
height: 18 * screenScaleFactor // TODO: Theme!
width: childrenRect.width
Label
UM.Label
{
id: managePrinterText
anchors.verticalCenter: managePrinterLink.verticalCenter
color: UM.Theme.getColor("text_link")
font: UM.Theme.getFont("default")
text: catalog.i18nc("@label link to Connect and Cloud interfaces", "Manage printer")
renderType: Text.NativeRendering
}
UM.RecolorImage
{
@ -334,7 +330,7 @@ Item
height: childrenRect.height
spacing: 18 * screenScaleFactor // TODO: Theme!
Label
UM.Label
{
id: printerStatus
anchors
@ -371,7 +367,6 @@ Item
return ""
}
visible: text !== ""
renderType: Text.NativeRendering
}
Item
@ -401,7 +396,7 @@ Item
height: printerNameLabel.height + printerFamilyPill.height + 6 * screenScaleFactor // TODO: Theme!
visible: printer && printer.activePrintJob && !printerStatus.visible
Label
UM.Label
{
id: printerJobNameLabel
color: printer && printer.activePrintJob && printer.activePrintJob.isActive ? UM.Theme.getColor("text") : UM.Theme.getColor("monitor_text_disabled")
@ -412,11 +407,9 @@ Item
// FIXED-LINE-HEIGHT:
height: 18 * screenScaleFactor // TODO: Theme!
verticalAlignment: Text.AlignVCenter
renderType: Text.NativeRendering
}
Label
UM.Label
{
id: printerJobOwnerLabel
anchors
@ -427,14 +420,11 @@ Item
}
color: printer && printer.activePrintJob && printer.activePrintJob.isActive ? UM.Theme.getColor("text") : UM.Theme.getColor("monitor_text_disabled")
elide: Text.ElideRight
font: UM.Theme.getFont("default") // 12pt, regular
text: printer && printer.activePrintJob ? printer.activePrintJob.owner : catalog.i18nc("@label", "Anonymous")
width: parent.width
// FIXED-LINE-HEIGHT:
height: 18 * screenScaleFactor // TODO: Theme!
verticalAlignment: Text.AlignVCenter
renderType: Text.NativeRendering
}
}
@ -448,21 +438,17 @@ Item
visible: printer && printer.activePrintJob && printer.activePrintJob.configurationChanges.length === 0 && !printerStatus.visible
}
Label
UM.Label
{
anchors
{
verticalCenter: parent.verticalCenter
}
font: UM.Theme.getFont("default")
text: catalog.i18nc("@label:status", "Requires configuration changes")
visible: printer && printer.activePrintJob && printer.activePrintJob.configurationChanges.length > 0 && !printerStatus.visible
color: UM.Theme.getColor("text")
// FIXED-LINE-HEIGHT:
height: 18 * screenScaleFactor // TODO: Theme!
verticalAlignment: Text.AlignVCenter
renderType: Text.NativeRendering
}
}
@ -487,17 +473,15 @@ Item
radius: 2 * screenScaleFactor // Todo: Theme!
}
}
contentItem: Label
contentItem: UM.Label
{
anchors.fill: parent
anchors.bottomMargin: 2 * screenScaleFactor // TODO: Theme!
color: UM.Theme.getColor("monitor_secondary_button_text")
font: UM.Theme.getFont("medium") // 14pt, regular
text: catalog.i18nc("@action:button", "Details");
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
height: 18 * screenScaleFactor // TODO: Theme!
renderType: Text.NativeRendering
}
implicitHeight: 32 * screenScaleFactor // TODO: Theme!
implicitWidth: 96 * screenScaleFactor // TODO: Theme!

View file

@ -1,24 +1,25 @@
// Copyright (c) 2019 Ultimaker B.V.
// Copyright (c) 2021 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.2
import QtQuick.Controls 2.0
import QtQuick.Controls.Styles 1.4
import UM 1.3 as UM
import UM 1.5 as UM
Button {
background: Rectangle {
opacity: parent.down || parent.hovered ? 1 : 0;
Button
{
background: Rectangle
{
opacity: parent.down || parent.hovered ? 1 : 0
color: UM.Theme.getColor("monitor_context_menu_hover")
}
contentItem: Label {
color: enabled ? UM.Theme.getColor("text") : UM.Theme.getColor("monitor_text_disabled");
contentItem: UM.Label
{
color: enabled ? UM.Theme.getColor("text") : UM.Theme.getColor("monitor_text_disabled")
text: parent.text
horizontalAlignment: Text.AlignLeft;
verticalAlignment: Text.AlignVCenter;
renderType: Text.NativeRendering;
horizontalAlignment: Text.AlignLeft
}
height: visible ? 39 * screenScaleFactor : 0; // TODO: Theme!
hoverEnabled: true;
width: parent.width;
height: visible ? 39 * screenScaleFactor : 0 // TODO: Theme!
hoverEnabled: true
width: parent.width
}