Update some USB printing items to controls 2

This commit is contained in:
Jaime van Kessel 2022-02-22 11:58:14 +01:00
parent f347c6aedf
commit 2c6ba3cd5d
4 changed files with 25 additions and 36 deletions

View file

@ -3,7 +3,6 @@
import QtQuick 2.10 import QtQuick 2.10
import QtQuick.Controls 2.0 import QtQuick.Controls 2.0
import QtQuick.Layouts 1.3
import UM 1.2 as UM import UM 1.2 as UM
import Cura 1.0 as Cura import Cura 1.0 as Cura

View file

@ -2,15 +2,13 @@
//Cura is released under the terms of the LGPLv3 or higher. //Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.2 import QtQuick 2.2
import QtQuick.Controls 1.1
import QtQuick.Layouts 1.1
import UM 1.5 as UM import UM 1.5 as UM
import Cura 1.0 as Cura import Cura 1.0 as Cura
Item Item
{ {
id: base; id: base
UM.I18nCatalog { id: catalog; name: "cura"} UM.I18nCatalog { id: catalog; name: "cura"}
height: childrenRect.height + UM.Theme.getSize("thick_margin").height height: childrenRect.height + UM.Theme.getSize("thick_margin").height
@ -157,7 +155,7 @@ Item
} }
} }
Label UM.Label
{ {
id: statusLabel id: statusLabel
width: parent.width - 2 * UM.Theme.getSize("thick_margin").width width: parent.width - 2 * UM.Theme.getSize("thick_margin").width
@ -170,7 +168,7 @@ Item
text: statusText text: statusText
} }
Label UM.Label
{ {
id: percentageLabel id: percentageLabel
anchors.top: parent.top anchors.top: parent.top
@ -184,20 +182,20 @@ Item
UM.ProgressBar UM.ProgressBar
{ {
id: progressBar; id: progressBar
minimumValue: 0; minimumValue: 0
maximumValue: 100; maximumValue: 100
value: 0; value: 0
//Doing this in an explicit binding since the implicit binding breaks on occasion. //Doing this in an explicit binding since the implicit binding breaks on occasion.
Binding Binding
{ {
target: progressBar; target: progressBar
property: "value"; property: "value"
value: base.progress; value: base.progress
} }
visible: showProgress; visible: showProgress
indeterminate: indeterminate:
{ {
if(!printerConnected) if(!printerConnected)
@ -217,15 +215,15 @@ Item
return false; return false;
} }
} }
property string backgroundColor: UM.Theme.getColor("progressbar_background"); property string backgroundColor: UM.Theme.getColor("progressbar_background")
property string controlColor: base.statusColor; property string controlColor: base.statusColor
width: parent.width - 2 * UM.Theme.getSize("thick_margin").width; width: parent.width - 2 * UM.Theme.getSize("thick_margin").width
height: UM.Theme.getSize("progressbar").height; height: UM.Theme.getSize("progressbar").height
anchors.top: statusLabel.bottom; anchors.top: statusLabel.bottom
anchors.topMargin: Math.round(UM.Theme.getSize("thick_margin").height / 4); anchors.topMargin: Math.round(UM.Theme.getSize("thick_margin").height / 4)
anchors.left: parent.left; anchors.left: parent.left
anchors.leftMargin: UM.Theme.getSize("thick_margin").width; anchors.leftMargin: UM.Theme.getSize("thick_margin").width
} }
Row Row

View file

@ -2,18 +2,16 @@
// Cura is released under the terms of the LGPLv3 or higher. // Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.2 import QtQuick 2.2
import QtQuick.Controls 1.1
import QtQuick.Controls.Styles 1.1
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
import UM 1.2 as UM import UM 1.5 as UM
import Cura 1.0 as Cura import Cura 1.0 as Cura
Item Item
{ {
property string label: "" property string label: ""
property string value: "" property string value: ""
height: childrenRect.height; height: childrenRect.height
property var connectedPrinter: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null property var connectedPrinter: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null
@ -24,22 +22,20 @@ Item
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: UM.Theme.getSize("default_margin").width anchors.leftMargin: UM.Theme.getSize("default_margin").width
Label UM.Label
{ {
width: Math.floor(parent.width * 0.4) width: Math.floor(parent.width * 0.4)
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
text: label text: label
color: connectedPrinter != null && connectedPrinter.acceptsCommands ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text") color: connectedPrinter != null && connectedPrinter.acceptsCommands ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text")
font: UM.Theme.getFont("default")
elide: Text.ElideRight elide: Text.ElideRight
} }
Label UM.Label
{ {
width: Math.floor(parent.width * 0.6) width: Math.floor(parent.width * 0.6)
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
text: value text: value
color: connectedPrinter != null && connectedPrinter.acceptsCommands ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text") color: connectedPrinter != null && connectedPrinter.acceptsCommands ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text")
font: UM.Theme.getFont("default")
elide: Text.ElideRight elide: Text.ElideRight
} }
} }

View file

@ -2,10 +2,8 @@
// Cura is released under the terms of the LGPLv3 or higher. // Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.10 import QtQuick 2.10
import QtQuick.Controls 1.4
import QtQuick.Layouts 1.3
import UM 1.2 as UM import UM 1.5 as UM
import Cura 1.0 as Cura import Cura 1.0 as Cura
Item Item
@ -20,14 +18,12 @@ Item
width: base.width width: base.width
height: UM.Theme.getSize("section").height height: UM.Theme.getSize("section").height
Label UM.Label
{ {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: UM.Theme.getSize("default_margin").width anchors.leftMargin: UM.Theme.getSize("default_margin").width
text: label text: label
font: UM.Theme.getFont("default")
color: UM.Theme.getColor("setting_category_text")
} }
} }
} }