mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-13 23:45:59 +08:00
Make printer carousel more flexible/robust
Contributes to CL-1157
This commit is contained in:
parent
94ad0a81a2
commit
e62ce0e4ca
@ -14,7 +14,12 @@ Item
|
|||||||
property var tileWidth: 834 * screenScaleFactor // TODO: Theme!
|
property var tileWidth: 834 * screenScaleFactor // TODO: Theme!
|
||||||
property var tileHeight: 216 * screenScaleFactor // TODO: Theme!
|
property var tileHeight: 216 * screenScaleFactor // TODO: Theme!
|
||||||
property var tileSpacing: 60 * screenScaleFactor // TODO: Theme!
|
property var tileSpacing: 60 * screenScaleFactor // TODO: Theme!
|
||||||
property var maxOffset: (OutputDevice.printers.length - 1) * (tileWidth + tileSpacing)
|
|
||||||
|
// 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
|
height: centerSection.height
|
||||||
width: maximumWidth
|
width: maximumWidth
|
||||||
@ -129,7 +134,7 @@ Item
|
|||||||
|
|
||||||
Repeater
|
Repeater
|
||||||
{
|
{
|
||||||
model: OutputDevice.printers
|
model: printers
|
||||||
MonitorPrinterCard
|
MonitorPrinterCard
|
||||||
{
|
{
|
||||||
printer: modelData
|
printer: modelData
|
||||||
@ -151,7 +156,7 @@ Item
|
|||||||
width: 36 * screenScaleFactor // TODO: Theme!
|
width: 36 * screenScaleFactor // TODO: Theme!
|
||||||
height: 72 * screenScaleFactor // TODO: Theme!
|
height: 72 * screenScaleFactor // TODO: Theme!
|
||||||
z: 10
|
z: 10
|
||||||
visible: currentIndex < OutputDevice.printers.length - 1
|
visible: currentIndex < printers.length - 1
|
||||||
onClicked: navigateTo(currentIndex + 1)
|
onClicked: navigateTo(currentIndex + 1)
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
background: Rectangle
|
background: Rectangle
|
||||||
@ -227,7 +232,7 @@ Item
|
|||||||
spacing: 8 * screenScaleFactor // TODO: Theme!
|
spacing: 8 * screenScaleFactor // TODO: Theme!
|
||||||
Repeater
|
Repeater
|
||||||
{
|
{
|
||||||
model: OutputDevice.printers
|
model: printers
|
||||||
Button
|
Button
|
||||||
{
|
{
|
||||||
background: Rectangle
|
background: Rectangle
|
||||||
@ -243,7 +248,7 @@ Item
|
|||||||
}
|
}
|
||||||
|
|
||||||
function navigateTo( i ) {
|
function navigateTo( i ) {
|
||||||
if (i >= 0 && i < OutputDevice.printers.length)
|
if (i >= 0 && i < printers.length)
|
||||||
{
|
{
|
||||||
tiles.x = -1 * i * (tileWidth + tileSpacing)
|
tiles.x = -1 * i * (tileWidth + tileSpacing)
|
||||||
currentIndex = i
|
currentIndex = i
|
||||||
|
@ -64,8 +64,10 @@ Component
|
|||||||
}
|
}
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: 264 * screenScaleFactor // TODO: Theme!
|
height: 264 * screenScaleFactor // TODO: Theme!
|
||||||
MonitorCarousel {
|
MonitorCarousel
|
||||||
|
{
|
||||||
id: carousel
|
id: carousel
|
||||||
|
printers: OutputDevice.printers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user