mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-05-03 01:04:35 +08:00

Having a separate class for the AbstractMachine complicated things; it's behaviour was extremely similar to the GlobalStack so adding one more stack container type in addition to the many similar setting container types we already have adds complexity to the system. Having these different classes for machines and abstract machines also add complexity to the update script as the abstract machines were stored in a separate folder from the machine types. Because of these reasons we decided to replace the AbstractMachine by a GlobalStack where the is_abstract_machine property metadata property is set to True. CURA-9514, CURA-9277 Co-authored-by: joeydelarago <joeydelarago@gmail.com>
88 lines
2.5 KiB
QML
88 lines
2.5 KiB
QML
// Copyright (c) 2022 Ultimaker B.V.
|
|
// Cura is released under the terms of the LGPLv3 or higher.
|
|
|
|
import QtQuick 2.10
|
|
import QtQuick.Controls 2.3
|
|
|
|
import UM 1.5 as UM
|
|
import Cura 1.0 as Cura
|
|
|
|
|
|
Button
|
|
{
|
|
id: machineListButton
|
|
|
|
width: parent.width
|
|
height: UM.Theme.getSize("large_button").height
|
|
leftPadding: UM.Theme.getSize("default_margin").width
|
|
rightPadding: UM.Theme.getSize("default_margin").width
|
|
checkable: true
|
|
hoverEnabled: true
|
|
|
|
contentItem: Item
|
|
{
|
|
width: machineListButton.width - machineListButton.leftPadding - machineListButton.rightPadding
|
|
height: UM.Theme.getSize("action_button").height
|
|
|
|
UM.ColorImage
|
|
{
|
|
id: printerIcon
|
|
height: UM.Theme.getSize("medium_button").height
|
|
width: UM.Theme.getSize("medium_button").width
|
|
color: UM.Theme.getColor("machine_selector_printer_icon")
|
|
visible: model.isAbstractMachine || !model.isOnline
|
|
source: model.isAbstractMachine ? UM.Theme.getIcon("PrinterTriple", "medium") : UM.Theme.getIcon("Printer", "medium")
|
|
|
|
anchors
|
|
{
|
|
left: parent.left
|
|
verticalCenter: parent.verticalCenter
|
|
}
|
|
}
|
|
|
|
UM.Label
|
|
{
|
|
id: buttonText
|
|
anchors
|
|
{
|
|
left: printerIcon.right
|
|
right: printerCount.left
|
|
verticalCenter: parent.verticalCenter
|
|
leftMargin: UM.Theme.getSize("default_margin").width
|
|
}
|
|
text: machineListButton.text
|
|
font: model.isAbstractMachine ? UM.Theme.getFont("medium_bold") : UM.Theme.getFont("medium")
|
|
visible: text != ""
|
|
elide: Text.ElideRight
|
|
}
|
|
|
|
Rectangle
|
|
{
|
|
id: printerCount
|
|
color: UM.Theme.getColor("background_2")
|
|
radius: height
|
|
width: height
|
|
anchors
|
|
{
|
|
right: parent.right
|
|
top: buttonText.top
|
|
bottom: buttonText.bottom
|
|
}
|
|
visible: model.isAbstractMachine
|
|
|
|
UM.Label
|
|
{
|
|
text: model.machineCount
|
|
anchors.centerIn: parent
|
|
font: UM.Theme.getFont("default_bold")
|
|
}
|
|
}
|
|
}
|
|
|
|
background: Rectangle
|
|
{
|
|
id: backgroundRect
|
|
color: machineListButton.hovered ? UM.Theme.getColor("action_button_hovered") : "transparent"
|
|
}
|
|
}
|