Cura/resources/qml/Menus/ConfigurationMenu/ConfigurationListView.qml
Ghostkeeper 0a75c772ed
Unrevert new icon set for all of Cura's interface
We created a new set of icons for Cura. These icons had to be reverted though because they weren't working out in the interface for the last release yet.
This unreverts them, basically adding them back hoping that we'll get them fixed in time for the next release.

Contributes to issue CURA-8342.

Revert "Revert "Fix merge conflict""

This reverts commit bb20e3307f43edc1ff53cb154d2351ddfe39e158.

Revert "Revert "Merge pull request #9716 from Ultimaker/CURA-8010_new_icons""

This reverts commit 70e4e9640e561e18a12870f30c905203ce8ccee7.

Revert "Revert "Fix typo in icon name""

This reverts commit 38ce22ba7c3f40b971bc6e1e0a8e776ca9d51512.

Revert "Revert "Add list for deprecated icons""

This reverts commit 119a957e7f978dbf1ddbcb3b0005bf38e8fed943.

Revert "Revert "Add Function icon""

This reverts commit 760726cf0bb953bb1b0fc277b448f419d4bd2544.

Revert "Revert "Switch out inherit icon""

This reverts commit 26afff609381e2004d194c280f504b6226859bd3.

Revert "Revert "Merge branch 'CURA-8205_Introduce_new_icons_in_Cura' of github.com:Ultimaker/Cura""

This reverts commit 6483db3d47ee052c1a966cdee3af7190577a5769.

Revert "Fix incorrect icons"

This reverts commit 02a4ade2a50a943ff36fd4895bdc9261cf2133eb.
2021-06-28 17:16:56 +02:00

144 lines
4.8 KiB
QML

// Copyright (c) 2018 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.7
import QtQuick.Controls 2.3
import UM 1.2 as UM
import Cura 1.0 as Cura
Item
{
id: base
property var outputDevice: null
height: childrenRect.height
function forceModelUpdate()
{
// FIXME For now the model has to be removed and then created again, otherwise changes in the printer don't automatically update the UI
configurationList.model = []
if (outputDevice)
{
configurationList.model = outputDevice.uniqueConfigurations
}
}
// This component will appear when there are no configurations (e.g. when losing connection or when they are being loaded)
Item
{
width: parent.width
visible: configurationList.model.length == 0
height: label.height + UM.Theme.getSize("wide_margin").height
anchors.top: parent.top
anchors.topMargin: UM.Theme.getSize("default_margin").height
UM.RecolorImage
{
id: icon
anchors.left: parent.left
anchors.verticalCenter: label.verticalCenter
source: UM.Theme.getIcon("Warning")
color: UM.Theme.getColor("warning")
width: UM.Theme.getSize("section_icon").width
height: width
}
Label
{
id: label
anchors.left: icon.right
anchors.right: parent.right
anchors.leftMargin: UM.Theme.getSize("default_margin").width
// There are two cases that we want to diferenciate, one is when Cura is loading the configurations and the
// other when the connection was lost
text: Cura.MachineManager.printerConnected ?
catalog.i18nc("@label", "Loading available configurations from the printer...") :
catalog.i18nc("@label", "The configurations are not available because the printer is disconnected.")
color: UM.Theme.getColor("text")
font: UM.Theme.getFont("default")
renderType: Text.NativeRendering
wrapMode: Text.WordWrap
}
}
ScrollView
{
id: container
width: parent.width
readonly property int maximumHeight: 350 * screenScaleFactor
height: Math.round(Math.min(configurationList.height, maximumHeight))
contentHeight: configurationList.height
clip: true
ScrollBar.vertical.policy: (configurationList.height > maximumHeight) ? ScrollBar.AlwaysOn : ScrollBar.AlwaysOff //The AsNeeded policy also hides it when the cursor is away, and we don't want that.
ScrollBar.vertical.background: Rectangle
{
implicitWidth: UM.Theme.getSize("scrollbar").width
radius: width / 2
color: UM.Theme.getColor("scrollbar_background")
}
ScrollBar.vertical.contentItem: Rectangle
{
implicitWidth: UM.Theme.getSize("scrollbar").width
radius: width / 2
color: UM.Theme.getColor(parent.pressed ? "scrollbar_handle_down" : parent.hovered ? "scrollbar_handle_hover" : "scrollbar_handle")
}
ButtonGroup
{
buttons: configurationList.children
}
ListView
{
id: configurationList
spacing: UM.Theme.getSize("narrow_margin").height
width: container.width - ((height > container.maximumHeight) ? container.ScrollBar.vertical.background.width : 0) //Make room for scroll bar if there is any.
height: contentHeight
interactive: false // let the ScrollView process scroll events.
section.property: "modelData.printerType"
section.criteria: ViewSection.FullString
section.delegate: Item
{
height: printerTypeLabel.height + UM.Theme.getSize("wide_margin").height //Causes a default margin above the label and a default margin below the label.
Cura.PrinterTypeLabel
{
id: printerTypeLabel
text: section
anchors.verticalCenter: parent.verticalCenter //One default margin above and one below.
autoFit: true
}
}
model: (outputDevice != null) ? outputDevice.uniqueConfigurations : []
delegate: ConfigurationItem
{
width: parent.width
configuration: modelData
}
}
}
Connections
{
target: outputDevice
function onUniqueConfigurationsChanged()
{
forceModelUpdate()
}
}
Connections
{
target: Cura.MachineManager
function onOutputDevicesChanged()
{
forceModelUpdate()
}
}
}