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

259 lines
7.3 KiB
QML

// Copyright (c) 2019 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.3
import QtQuick.Controls 2.0
import QtGraphicalEffects 1.0
import UM 1.3 as UM
Item
{
id: base
property var currentIndex: 0
property var tileWidth: 834 * screenScaleFactor // TODO: Theme!
property var tileHeight: 216 * screenScaleFactor // TODO: Theme!
property var tileSpacing: 60 * screenScaleFactor // TODO: Theme!
// Array/model of printers to populate the carousel with
property var printers: []
// Maximum distance the carousel can be shifted
property var maxOffset: (printers.length - 1) * (tileWidth + tileSpacing)
height: centerSection.height
width: maximumWidth
// Enable keyboard navigation
Keys.onLeftPressed: navigateTo(currentIndex - 1)
Keys.onRightPressed: navigateTo(currentIndex + 1)
Item
{
id: leftHint
anchors
{
right: leftButton.left
rightMargin: 12 * screenScaleFactor // TODO: Theme!
left: parent.left
}
height: parent.height
z: 10
LinearGradient
{
anchors.fill: parent
start: Qt.point(0, 0)
end: Qt.point(leftHint.width, 0)
gradient: Gradient
{
GradientStop
{
position: 0.0
color: UM.Theme.getColor("monitor_stage_background")
}
GradientStop
{
position: 1.0
color: UM.Theme.getColor("monitor_stage_background_fade")
}
}
}
MouseArea
{
anchors.fill: parent
onClicked: navigateTo(currentIndex - 1)
}
}
Button
{
id: leftButton
anchors
{
verticalCenter: parent.verticalCenter
right: centerSection.left
rightMargin: 12 * screenScaleFactor // TODO: Theme!
}
width: 36 * screenScaleFactor // TODO: Theme!
height: 72 * screenScaleFactor // TODO: Theme!
visible: currentIndex > 0
hoverEnabled: true
z: 10
onClicked: navigateTo(currentIndex - 1)
background: Rectangle
{
color: leftButton.hovered ? UM.Theme.getColor("monitor_card_hover") : UM.Theme.getColor("monitor_card_background")
border.width: 1 * screenScaleFactor // TODO: Theme!
border.color: UM.Theme.getColor("monitor_card_border")
radius: 2 * screenScaleFactor // TODO: Theme!
}
contentItem: Item
{
anchors.fill: parent
UM.RecolorImage
{
anchors.centerIn: parent
width: 18 // TODO: Theme!
height: width // TODO: Theme!
sourceSize.width: width // TODO: Theme!
sourceSize.height: width // TODO: Theme!
color: UM.Theme.getColor("text")
source: UM.Theme.getIcon("ChevronSingleLeft")
}
}
}
Item
{
id: centerSection
anchors
{
verticalCenter: parent.verticalCenter
horizontalCenter: parent.horizontalCenter
}
width: tileWidth
height: tiles.height
z: 1
Row
{
id: tiles
height: childrenRect.height
width: 5 * tileWidth + 4 * tileSpacing // TODO: Theme!
x: 0
z: 0
Behavior on x
{
NumberAnimation
{
duration: 200
easing.type: Easing.InOutCubic
}
}
spacing: 60 * screenScaleFactor // TODO: Theme!
Repeater
{
model: printers
MonitorPrinterCard
{
printer: modelData
enabled: model.index == currentIndex
}
}
}
}
Button
{
id: rightButton
anchors
{
verticalCenter: parent.verticalCenter
left: centerSection.right
leftMargin: 12 * screenScaleFactor // TODO: Theme!
}
width: 36 * screenScaleFactor // TODO: Theme!
height: 72 * screenScaleFactor // TODO: Theme!
z: 10
visible: currentIndex < printers.length - 1
onClicked: navigateTo(currentIndex + 1)
hoverEnabled: true
background: Rectangle
{
color: rightButton.hovered ? UM.Theme.getColor("monitor_card_hover") : UM.Theme.getColor("monitor_card_background")
border.width: 1 * screenScaleFactor // TODO: Theme!
border.color: UM.Theme.getColor("monitor_card_border")
radius: 2 * screenScaleFactor // TODO: Theme!
}
contentItem: Item
{
anchors.fill: parent
UM.RecolorImage
{
anchors.centerIn: parent
width: 18 // TODO: Theme!
height: width // TODO: Theme!
sourceSize.width: width // TODO: Theme!
sourceSize.height: width // TODO: Theme!
color: UM.Theme.getColor("text")
source: UM.Theme.getIcon("ChevronSingleRight")
}
}
}
Item
{
id: rightHint
anchors
{
left: rightButton.right
leftMargin: 12 * screenScaleFactor // TODO: Theme!
right: parent.right
}
height: centerSection.height
z: 10
LinearGradient
{
anchors.fill: parent
start: Qt.point(0, 0)
end: Qt.point(rightHint.width, 0)
gradient: Gradient
{
GradientStop
{
position: 0.0
color: UM.Theme.getColor("monitor_stage_background_fade")
}
GradientStop
{
position: 1.0
color: UM.Theme.getColor("monitor_stage_background")
}
}
}
MouseArea
{
anchors.fill: parent
onClicked: navigateTo(currentIndex + 1)
}
}
Row
{
id: navigationDots
anchors
{
horizontalCenter: centerSection.horizontalCenter
top: centerSection.bottom
topMargin: 36 * screenScaleFactor // TODO: Theme!
}
spacing: 8 * screenScaleFactor // TODO: Theme!
visible: printers.length > 1
Repeater
{
model: printers
Button
{
background: Rectangle
{
color: model.index == currentIndex ? UM.Theme.getColor("monitor_carousel_dot_current") : UM.Theme.getColor("monitor_carousel_dot")
radius: Math.floor(width / 2)
width: 12 * screenScaleFactor // TODO: Theme!
height: width // TODO: Theme!
}
onClicked: navigateTo(model.index)
}
}
}
function navigateTo( i ) {
if (i >= 0 && i < printers.length)
{
tiles.x = -1 * i * (tileWidth + tileSpacing)
currentIndex = i
}
}
}