mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-04-30 15:54:32 +08:00
Use new ScrollBar for material sync dialogue
Contributes to issue CURA-8686.
This commit is contained in:
parent
52f5b91621
commit
4d9039288b
@ -1,4 +1,4 @@
|
|||||||
//Copyright (c) 2021 Ultimaker B.V.
|
//Copyright (c) 2022 Ultimaker B.V.
|
||||||
//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.15
|
import QtQuick 2.15
|
||||||
@ -253,204 +253,202 @@ Window
|
|||||||
onClicked: Qt.openUrlExternally("https://support.ultimaker.com/hc/en-us/articles/360012019239?utm_source=cura&utm_medium=software&utm_campaign=sync-material-wizard-troubleshoot-cloud-printer")
|
onClicked: Qt.openUrlExternally("https://support.ultimaker.com/hc/en-us/articles/360012019239?utm_source=cura&utm_medium=software&utm_campaign=sync-material-wizard-troubleshoot-cloud-printer")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ScrollView
|
ListView
|
||||||
{
|
{
|
||||||
id: printerListScrollView
|
id: printerList
|
||||||
width: parent.width
|
width: parent.width
|
||||||
Layout.preferredWidth: width
|
Layout.preferredWidth: width
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
|
|
||||||
clip: true
|
clip: true
|
||||||
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
ScrollBar.vertical: UM.ScrollBar
|
||||||
|
|
||||||
ListView
|
|
||||||
{
|
{
|
||||||
id: printerList
|
id: printerListScrollBar
|
||||||
width: parent.width
|
}
|
||||||
spacing: UM.Theme.getSize("default_margin").height
|
spacing: UM.Theme.getSize("default_margin").height
|
||||||
|
|
||||||
model: cloudPrinterList
|
model: cloudPrinterList
|
||||||
delegate: Rectangle
|
delegate: Rectangle
|
||||||
|
{
|
||||||
|
id: delegateContainer
|
||||||
|
color: "transparent"
|
||||||
|
border.color: UM.Theme.getColor("lining")
|
||||||
|
border.width: UM.Theme.getSize("default_lining").width
|
||||||
|
width: printerList.width - printerListScrollBar.width
|
||||||
|
height: UM.Theme.getSize("card").height
|
||||||
|
|
||||||
|
property string syncStatus:
|
||||||
{
|
{
|
||||||
id: delegateContainer
|
var printer_id = model.metadata["host_guid"]
|
||||||
color: "transparent"
|
if(syncModel.printerStatus[printer_id] === undefined) //No status information available. Could be added after we started syncing.
|
||||||
border.color: UM.Theme.getColor("lining")
|
|
||||||
border.width: UM.Theme.getSize("default_lining").width
|
|
||||||
width: printerListScrollView.width
|
|
||||||
height: UM.Theme.getSize("card").height
|
|
||||||
|
|
||||||
property string syncStatus:
|
|
||||||
{
|
{
|
||||||
var printer_id = model.metadata["host_guid"]
|
return "idle";
|
||||||
if(syncModel.printerStatus[printer_id] === undefined) //No status information available. Could be added after we started syncing.
|
}
|
||||||
{
|
return syncModel.printerStatus[printer_id];
|
||||||
return "idle";
|
}
|
||||||
}
|
|
||||||
return syncModel.printerStatus[printer_id];
|
Cura.IconWithText
|
||||||
|
{
|
||||||
|
anchors
|
||||||
|
{
|
||||||
|
verticalCenter: parent.verticalCenter
|
||||||
|
left: parent.left
|
||||||
|
leftMargin: Math.round(parent.height - height) / 2 //Equal margin on the left as above and below.
|
||||||
|
right: parent.right
|
||||||
|
rightMargin: Math.round(parent.height - height) / 2
|
||||||
}
|
}
|
||||||
|
|
||||||
Cura.IconWithText
|
text: model.name
|
||||||
{
|
font: UM.Theme.getFont("medium")
|
||||||
anchors
|
|
||||||
{
|
|
||||||
verticalCenter: parent.verticalCenter
|
|
||||||
left: parent.left
|
|
||||||
leftMargin: Math.round(parent.height - height) / 2 //Equal margin on the left as above and below.
|
|
||||||
right: parent.right
|
|
||||||
rightMargin: Math.round(parent.height - height) / 2
|
|
||||||
}
|
|
||||||
|
|
||||||
text: model.name
|
source: UM.Theme.getIcon("Printer", "medium")
|
||||||
font: UM.Theme.getFont("medium")
|
iconColor: UM.Theme.getColor("machine_selector_printer_icon")
|
||||||
|
iconSize: UM.Theme.getSize("machine_selector_icon").width
|
||||||
source: UM.Theme.getIcon("Printer", "medium")
|
|
||||||
iconColor: UM.Theme.getColor("machine_selector_printer_icon")
|
|
||||||
iconSize: UM.Theme.getSize("machine_selector_icon").width
|
|
||||||
|
|
||||||
//Printer status badge (always cloud, but whether it's online or offline).
|
|
||||||
UM.RecolorImage
|
|
||||||
{
|
|
||||||
width: UM.Theme.getSize("printer_status_icon").width
|
|
||||||
height: UM.Theme.getSize("printer_status_icon").height
|
|
||||||
anchors
|
|
||||||
{
|
|
||||||
bottom: parent.bottom
|
|
||||||
bottomMargin: -Math.round(height / 6)
|
|
||||||
left: parent.left
|
|
||||||
leftMargin: parent.iconSize - Math.round(width * 5 / 6)
|
|
||||||
}
|
|
||||||
|
|
||||||
source: UM.Theme.getIcon("CloudBadge", "low")
|
|
||||||
color: UM.Theme.getColor("primary")
|
|
||||||
|
|
||||||
//Make a themeable circle in the background so we can change it in other themes.
|
|
||||||
Rectangle
|
|
||||||
{
|
|
||||||
anchors.centerIn: parent
|
|
||||||
width: parent.width - 1.5 //1.5 pixels smaller (at least sqrt(2), regardless of pixel scale) so that the circle doesn't show up behind the icon due to anti-aliasing.
|
|
||||||
height: parent.height - 1.5
|
|
||||||
radius: width / 2
|
|
||||||
color: UM.Theme.getColor("connection_badge_background")
|
|
||||||
z: parent.z - 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
//Printer status badge (always cloud, but whether it's online or offline).
|
||||||
UM.RecolorImage
|
UM.RecolorImage
|
||||||
{
|
{
|
||||||
id: printerSpinner
|
width: UM.Theme.getSize("printer_status_icon").width
|
||||||
width: UM.Theme.getSize("section_icon").width
|
height: UM.Theme.getSize("printer_status_icon").height
|
||||||
height: width
|
anchors
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
{
|
||||||
anchors.right: parent.right
|
bottom: parent.bottom
|
||||||
anchors.rightMargin: Math.round((parent.height - height) / 2) //Same margin on the right as above and below.
|
bottomMargin: -Math.round(height / 6)
|
||||||
|
left: parent.left
|
||||||
|
leftMargin: parent.iconSize - Math.round(width * 5 / 6)
|
||||||
|
}
|
||||||
|
|
||||||
visible: delegateContainer.syncStatus === "uploading"
|
source: UM.Theme.getIcon("CloudBadge", "low")
|
||||||
source: UM.Theme.getIcon("ArrowDoubleCircleRight")
|
|
||||||
color: UM.Theme.getColor("primary")
|
color: UM.Theme.getColor("primary")
|
||||||
|
|
||||||
RotationAnimator
|
//Make a themeable circle in the background so we can change it in other themes.
|
||||||
|
Rectangle
|
||||||
{
|
{
|
||||||
target: printerSpinner
|
anchors.centerIn: parent
|
||||||
from: 0
|
width: parent.width - 1.5 //1.5 pixels smaller (at least sqrt(2), regardless of pixel scale) so that the circle doesn't show up behind the icon due to anti-aliasing.
|
||||||
to: 360
|
height: parent.height - 1.5
|
||||||
duration: 1000
|
radius: width / 2
|
||||||
loops: Animation.Infinite
|
color: UM.Theme.getColor("connection_badge_background")
|
||||||
running: true
|
z: parent.z - 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
UM.StatusIcon
|
|
||||||
{
|
|
||||||
width: UM.Theme.getSize("section_icon").width
|
|
||||||
height: width
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.rightMargin: Math.round((parent.height - height) / 2) //Same margin on the right as above and below.
|
|
||||||
|
|
||||||
visible: delegateContainer.syncStatus === "failed" || delegateContainer.syncStatus === "success"
|
|
||||||
status: delegateContainer.syncStatus === "success" ? UM.StatusIcon.Status.POSITIVE : UM.StatusIcon.Status.ERROR
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
footer: Item
|
UM.RecolorImage
|
||||||
{
|
{
|
||||||
width: printerListScrollView.width
|
id: printerSpinner
|
||||||
height: {
|
width: UM.Theme.getSize("section_icon").width
|
||||||
if(!visible)
|
height: width
|
||||||
{
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
return 0;
|
anchors.right: parent.right
|
||||||
}
|
anchors.rightMargin: Math.round((parent.height - height) / 2) //Same margin on the right as above and below.
|
||||||
let h = UM.Theme.getSize("card").height + printerListTroubleshooting.height + UM.Theme.getSize("default_margin").height * 2; //1 margin between content and footer, 1 for troubleshooting link.
|
|
||||||
return h;
|
visible: delegateContainer.syncStatus === "uploading"
|
||||||
}
|
source: UM.Theme.getIcon("ArrowDoubleCircleRight")
|
||||||
visible: includeOfflinePrinterList.count - cloudPrinterList.count > 0 && typeof syncModel !== "undefined" && syncModel.exportUploadStatus === "idle"
|
color: UM.Theme.getColor("primary")
|
||||||
Rectangle
|
|
||||||
|
RotationAnimator
|
||||||
{
|
{
|
||||||
anchors.fill: parent
|
target: printerSpinner
|
||||||
anchors.topMargin: UM.Theme.getSize("default_margin").height
|
from: 0
|
||||||
|
to: 360
|
||||||
|
duration: 1000
|
||||||
|
loops: Animation.Infinite
|
||||||
|
running: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
UM.StatusIcon
|
||||||
|
{
|
||||||
|
width: UM.Theme.getSize("section_icon").width
|
||||||
|
height: width
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: Math.round((parent.height - height) / 2) //Same margin on the right as above and below.
|
||||||
|
|
||||||
border.color: UM.Theme.getColor("lining")
|
visible: delegateContainer.syncStatus === "failed" || delegateContainer.syncStatus === "success"
|
||||||
border.width: UM.Theme.getSize("default_lining").width
|
status: delegateContainer.syncStatus === "success" ? UM.StatusIcon.Status.POSITIVE : UM.StatusIcon.Status.ERROR
|
||||||
color: "transparent"
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Row
|
footer: Item
|
||||||
|
{
|
||||||
|
width: printerList.width - printerListScrollBar
|
||||||
|
height: {
|
||||||
|
if(!visible)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
let h = UM.Theme.getSize("card").height + printerListTroubleshooting.height + UM.Theme.getSize("default_margin").height * 2; //1 margin between content and footer, 1 for troubleshooting link.
|
||||||
|
return h;
|
||||||
|
}
|
||||||
|
visible: includeOfflinePrinterList.count - cloudPrinterList.count > 0 && typeof syncModel !== "undefined" && syncModel.exportUploadStatus === "idle"
|
||||||
|
Rectangle
|
||||||
|
{
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.topMargin: UM.Theme.getSize("default_margin").height
|
||||||
|
|
||||||
|
border.color: UM.Theme.getColor("lining")
|
||||||
|
border.width: UM.Theme.getSize("default_lining").width
|
||||||
|
color: "transparent"
|
||||||
|
|
||||||
|
Row
|
||||||
|
{
|
||||||
|
anchors
|
||||||
{
|
{
|
||||||
anchors
|
fill: parent
|
||||||
|
margins: Math.round(UM.Theme.getSize("card").height - UM.Theme.getSize("machine_selector_icon").width) / 2 //Same margin as in other cards.
|
||||||
|
}
|
||||||
|
spacing: UM.Theme.getSize("default_margin").width
|
||||||
|
|
||||||
|
UM.StatusIcon
|
||||||
|
{
|
||||||
|
id: infoIcon
|
||||||
|
width: UM.Theme.getSize("section_icon").width
|
||||||
|
height: width
|
||||||
|
//Fake anchor.verticalCenter: printersMissingText.verticalCenter, since we can't anchor to things that aren't siblings.
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.topMargin: Math.round(printersMissingText.height / 2 - height / 2)
|
||||||
|
|
||||||
|
status: UM.StatusIcon.Status.WARNING
|
||||||
|
}
|
||||||
|
|
||||||
|
Column
|
||||||
|
{
|
||||||
|
//Fill the total width. Can't use layouts because we need the anchors for vertical alignment.
|
||||||
|
width: parent.width - infoIcon.width - refreshListButton.width - parent.spacing * 2
|
||||||
|
|
||||||
|
spacing: UM.Theme.getSize("default_margin").height
|
||||||
|
|
||||||
|
UM.Label
|
||||||
{
|
{
|
||||||
fill: parent
|
id: printersMissingText
|
||||||
margins: Math.round(UM.Theme.getSize("card").height - UM.Theme.getSize("machine_selector_icon").width) / 2 //Same margin as in other cards.
|
text: catalog.i18nc("@text Asking the user whether printers are missing in a list.", "Printers missing?")
|
||||||
|
+ "\n"
|
||||||
|
+ catalog.i18nc("@text", "Make sure all your printers are turned ON and connected to Digital Factory.")
|
||||||
|
font: UM.Theme.getFont("medium")
|
||||||
|
elide: Text.ElideRight
|
||||||
}
|
}
|
||||||
spacing: UM.Theme.getSize("default_margin").width
|
Cura.TertiaryButton
|
||||||
|
|
||||||
UM.StatusIcon
|
|
||||||
{
|
{
|
||||||
id: infoIcon
|
id: printerListTroubleshooting
|
||||||
width: UM.Theme.getSize("section_icon").width
|
leftPadding: 0 //Want to visually align this to the text.
|
||||||
height: width
|
|
||||||
//Fake anchor.verticalCenter: printersMissingText.verticalCenter, since we can't anchor to things that aren't siblings.
|
|
||||||
anchors.top: parent.top
|
|
||||||
anchors.topMargin: Math.round(printersMissingText.height / 2 - height / 2)
|
|
||||||
|
|
||||||
status: UM.StatusIcon.Status.WARNING
|
text: catalog.i18nc("@button", "Troubleshooting")
|
||||||
|
iconSource: UM.Theme.getIcon("LinkExternal")
|
||||||
|
onClicked: Qt.openUrlExternally("https://support.ultimaker.com/hc/en-us/articles/360012019239?utm_source=cura&utm_medium=software&utm_campaign=sync-material-wizard-troubleshoot-cloud-printer")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Column
|
Cura.SecondaryButton
|
||||||
{
|
{
|
||||||
//Fill the total width. Can't use layouts because we need the anchors for vertical alignment.
|
id: refreshListButton
|
||||||
width: parent.width - infoIcon.width - refreshListButton.width - parent.spacing * 2
|
//Fake anchor.verticalCenter: printersMissingText.verticalCenter, since we can't anchor to things that aren't siblings.
|
||||||
|
anchors.top: parent.top
|
||||||
|
anchors.topMargin: Math.round(printersMissingText.height / 2 - height / 2)
|
||||||
|
|
||||||
spacing: UM.Theme.getSize("default_margin").height
|
text: catalog.i18nc("@button", "Refresh List")
|
||||||
|
iconSource: UM.Theme.getIcon("ArrowDoubleCircleRight")
|
||||||
UM.Label
|
onClicked: Cura.API.account.sync(true)
|
||||||
{
|
|
||||||
id: printersMissingText
|
|
||||||
text: catalog.i18nc("@text Asking the user whether printers are missing in a list.", "Printers missing?")
|
|
||||||
+ "\n"
|
|
||||||
+ catalog.i18nc("@text", "Make sure all your printers are turned ON and connected to Digital Factory.")
|
|
||||||
font: UM.Theme.getFont("medium")
|
|
||||||
elide: Text.ElideRight
|
|
||||||
}
|
|
||||||
Cura.TertiaryButton
|
|
||||||
{
|
|
||||||
id: printerListTroubleshooting
|
|
||||||
leftPadding: 0 //Want to visually align this to the text.
|
|
||||||
|
|
||||||
text: catalog.i18nc("@button", "Troubleshooting")
|
|
||||||
iconSource: UM.Theme.getIcon("LinkExternal")
|
|
||||||
onClicked: Qt.openUrlExternally("https://support.ultimaker.com/hc/en-us/articles/360012019239?utm_source=cura&utm_medium=software&utm_campaign=sync-material-wizard-troubleshoot-cloud-printer")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Cura.SecondaryButton
|
|
||||||
{
|
|
||||||
id: refreshListButton
|
|
||||||
//Fake anchor.verticalCenter: printersMissingText.verticalCenter, since we can't anchor to things that aren't siblings.
|
|
||||||
anchors.top: parent.top
|
|
||||||
anchors.topMargin: Math.round(printersMissingText.height / 2 - height / 2)
|
|
||||||
|
|
||||||
text: catalog.i18nc("@button", "Refresh List")
|
|
||||||
iconSource: UM.Theme.getIcon("ArrowDoubleCircleRight")
|
|
||||||
onClicked: Cura.API.account.sync(true)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user