Merge branch 'materials_sync' of github.com:Ultimaker/Cura into replace_controls_1_for_controls_2

This commit is contained in:
Jaime van Kessel 2022-02-17 15:13:15 +01:00
commit f7dc2fc2d1

View file

@ -20,6 +20,7 @@ Window
width: minimumWidth width: minimumWidth
height: minimumHeight height: minimumHeight
modality: Qt.ApplicationModal modality: Qt.ApplicationModal
color: UM.Theme.getColor("main_background")
property variant syncModel property variant syncModel
property alias pageIndex: swipeView.currentIndex property alias pageIndex: swipeView.currentIndex
@ -32,11 +33,11 @@ Window
anchors.fill: parent anchors.fill: parent
interactive: false interactive: false
Rectangle Item
{ {
id: introPage id: introPage
color: UM.Theme.getColor("main_background")
Column ColumnLayout
{ {
spacing: UM.Theme.getSize("default_margin").height spacing: UM.Theme.getSize("default_margin").height
anchors.fill: parent anchors.fill: parent
@ -46,66 +47,64 @@ Window
{ {
text: catalog.i18nc("@title:header", "Sync materials with printers") text: catalog.i18nc("@title:header", "Sync materials with printers")
font: UM.Theme.getFont("large_bold") font: UM.Theme.getFont("large_bold")
Layout.fillWidth: true
} }
UM.Label UM.Label
{ {
text: catalog.i18nc("@text", "Following a few simple steps, you will be able to synchronize all your material profiles with your printers.") text: catalog.i18nc("@text", "Following a few simple steps, you will be able to synchronize all your material profiles with your printers.")
font: UM.Theme.getFont("medium") font: UM.Theme.getFont("medium")
wrapMode: Text.Wrap Layout.fillWidth: true
width: parent.width
} }
Image Image
{ {
Layout.fillWidth: true
Layout.fillHeight: true
source: UM.Theme.getImage("material_ecosystem") source: UM.Theme.getImage("material_ecosystem")
width: parent.width fillMode: Image.PreserveAspectFit
sourceSize.width: width sourceSize.width: width
} }
}
Cura.PrimaryButton Item
{
id: startButton
anchors
{ {
right: parent.right Layout.preferredHeight: childrenRect.height
rightMargin: UM.Theme.getSize("default_margin").width Layout.alignment: Qt.AlignBottom
bottom: parent.bottom Layout.fillWidth: true
bottomMargin: UM.Theme.getSize("default_margin").height
} Cura.TertiaryButton
text: catalog.i18nc("@button", "Start")
onClicked:
{
if(Cura.API.account.isLoggedIn)
{ {
swipeView.currentIndex += 2; //Skip sign in page. text: catalog.i18nc("@button", "Why do I need to sync material profiles?")
iconSource: UM.Theme.getIcon("LinkExternal")
isIconOnRightSide: true
onClicked: Qt.openUrlExternally("https://support.ultimaker.com/hc/en-us/articles/360013137919?utm_source=cura&utm_medium=software&utm_campaign=sync-material-printer-why")
} }
else
Cura.PrimaryButton
{ {
swipeView.currentIndex += 1; anchors.right: parent.right
text: catalog.i18nc("@button", "Start")
onClicked:
{
if(Cura.API.account.isLoggedIn)
{
swipeView.currentIndex += 2; //Skip sign in page.
}
else
{
swipeView.currentIndex += 1;
}
}
} }
} }
} }
Cura.TertiaryButton
{
anchors
{
left: parent.left
leftMargin: UM.Theme.getSize("default_margin").width
verticalCenter: startButton.verticalCenter
}
text: catalog.i18nc("@button", "Why do I need to sync material profiles?")
iconSource: UM.Theme.getIcon("LinkExternal")
isIconOnRightSide: true
onClicked: Qt.openUrlExternally("https://support.ultimaker.com/hc/en-us/articles/360013137919?utm_source=cura&utm_medium=software&utm_campaign=sync-material-printer-why")
}
} }
Rectangle Item
{ {
id: signinPage id: signinPage
color: UM.Theme.getColor("main_background")
Connections //While this page is active, continue to the next page if the user logs in. // While this page is active, continue to the next page if the user logs in.
Connections
{ {
target: Cura.API.account target: Cura.API.account
function onLoginStateChanged(is_logged_in) function onLoginStateChanged(is_logged_in)
@ -127,34 +126,31 @@ Window
{ {
text: catalog.i18nc("@title:header", "Sign in") text: catalog.i18nc("@title:header", "Sign in")
font: UM.Theme.getFont("large_bold") font: UM.Theme.getFont("large_bold")
Layout.preferredHeight: height Layout.fillWidth: true
} }
UM.Label UM.Label
{ {
text: catalog.i18nc("@text", "To automatically sync the material profiles with all your printers connected to Digital Factory you need to be signed in in Cura.") text: catalog.i18nc("@text", "To automatically sync the material profiles with all your printers connected to Digital Factory you need to be signed in in Cura.")
font: UM.Theme.getFont("medium") font: UM.Theme.getFont("medium")
wrapMode: Text.Wrap Layout.fillWidth: true
width: parent.width
Layout.maximumWidth: width
Layout.preferredHeight: height
} }
Item
Image
{ {
Layout.preferredWidth: parent.width Layout.alignment: Qt.AlignCenter
Layout.preferredWidth: parent.width / 2
source: UM.Theme.getImage("first_run_ultimaker_cloud")
Layout.fillHeight: true Layout.fillHeight: true
Image sourceSize.width: width
{ fillMode: Image.PreserveAspectFit
source: UM.Theme.getImage("first_run_ultimaker_cloud")
width: parent.width / 2
sourceSize.width: width
anchors.centerIn: parent
}
} }
Item Item
{ {
width: parent.width Layout.preferredHeight: childrenRect.height
height: childrenRect.height Layout.alignment: Qt.AlignBottom
Layout.preferredHeight: height Layout.fillWidth: true
Cura.SecondaryButton Cura.SecondaryButton
{ {
anchors.left: parent.left anchors.left: parent.left
@ -171,10 +167,9 @@ Window
} }
} }
Rectangle Item
{ {
id: printerListPage id: printerListPage
color: UM.Theme.getColor("main_background")
ColumnLayout ColumnLayout
{ {
@ -185,7 +180,6 @@ Window
Row Row
{ {
Layout.preferredHeight: childrenRect.height
spacing: UM.Theme.getSize("default_margin").width spacing: UM.Theme.getSize("default_margin").width
states: [ states: [
@ -216,7 +210,7 @@ Window
{ {
id: printerListHeaderIcon id: printerListHeaderIcon
width: UM.Theme.getSize("section_icon").width width: UM.Theme.getSize("section_icon").width
height: width height: UM.Theme.getSize("section_icon").height
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
} }
UM.Label UM.Label
@ -229,24 +223,22 @@ Window
} }
Row Row
{ {
Layout.preferredWidth: parent.width Layout.fillWidth: true
Layout.preferredHeight: childrenRect.height Layout.preferredHeight: childrenRect.height
UM.Label UM.Label
{ {
id: syncStatusLabel id: syncStatusLabel
anchors.left: parent.left
width: parent.width - UM.Theme.getSize("default_margin").width - troubleshootingLink.width
wrapMode: Text.Wrap wrapMode: Text.Wrap
elide: Text.ElideRight elide: Text.ElideRight
visible: text !== "" visible: text !== ""
text: ""
font: UM.Theme.getFont("medium") font: UM.Theme.getFont("medium")
} }
Cura.TertiaryButton Cura.TertiaryButton
{ {
id: troubleshootingLink id: troubleshootingLink
anchors.right: parent.right
text: catalog.i18nc("@button", "Troubleshooting") text: catalog.i18nc("@button", "Troubleshooting")
visible: typeof syncModel !== "undefined" && syncModel.exportUploadStatus == "error" visible: typeof syncModel !== "undefined" && syncModel.exportUploadStatus == "error"
iconSource: UM.Theme.getIcon("LinkExternal") iconSource: UM.Theme.getIcon("LinkExternal")
@ -256,8 +248,7 @@ Window
ListView ListView
{ {
id: printerList id: printerList
width: parent.width Layout.fillWidth: true
Layout.preferredWidth: width
Layout.fillHeight: true Layout.fillHeight: true
clip: true clip: true
@ -372,94 +363,82 @@ Window
footer: Item footer: Item
{ {
width: printerList.width - printerListScrollBar width: printerList.width - printerListScrollBar.width
height: { height: childrenRect.height + UM.Theme.getSize("default_margin").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" visible: includeOfflinePrinterList.count - cloudPrinterList.count > 0 && typeof syncModel !== "undefined" && syncModel.exportUploadStatus === "idle"
Rectangle Rectangle
{ {
anchors.fill: parent anchors.top: parent.top
anchors.topMargin: UM.Theme.getSize("default_margin").height anchors.left: parent.left
anchors.right: parent.right
border.color: UM.Theme.getColor("lining") border.color: UM.Theme.getColor("lining")
border.width: UM.Theme.getSize("default_lining").width border.width: UM.Theme.getSize("default_lining").width
anchors.topMargin: UM.Theme.getSize("default_margin").height
height: childrenRect.height + 2 * UM.Theme.getSize("thick_margin").height
color: "transparent" color: "transparent"
Row GridLayout
{ {
anchors columns: 3
{ rows: 2
fill: parent anchors.top: parent.top
margins: Math.round(UM.Theme.getSize("card").height - UM.Theme.getSize("machine_selector_icon").width) / 2 //Same margin as in other cards. anchors.left: parent.left
} anchors.right: parent.right
spacing: UM.Theme.getSize("default_margin").width anchors.leftMargin: UM.Theme.getSize("thick_margin").width
anchors.rightMargin: UM.Theme.getSize("thick_margin").width
anchors.topMargin: UM.Theme.getSize("thick_margin").height
anchors.bottomMargin: UM.Theme.getSize("thick_margin").height
columnSpacing: UM.Theme.getSize("default_margin").width
rowSpacing: UM.Theme.getSize("default_margin").height
UM.StatusIcon UM.StatusIcon
{ {
id: infoIcon Layout.preferredWidth: UM.Theme.getSize("section_icon").width
width: UM.Theme.getSize("section_icon").width Layout.preferredHeight: UM.Theme.getSize("section_icon").height
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 status: UM.StatusIcon.Status.WARNING
} }
Column UM.Label
{ {
//Fill the total width. Can't use layouts because we need the anchors for vertical alignment. Layout.fillWidth: true
width: parent.width - infoIcon.width - refreshListButton.width - parent.spacing * 2 Layout.alignment: Qt.AlignVCenter
text: catalog.i18nc("@text Asking the user whether printers are missing in a list.", "Printers missing?")
spacing: UM.Theme.getSize("default_margin").height + "\n"
+ catalog.i18nc("@text", "Make sure all your printers are turned ON and connected to Digital Factory.")
UM.Label font: UM.Theme.getFont("medium")
{ elide: Text.ElideRight
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 Cura.SecondaryButton
{ {
id: refreshListButton id: refreshListButton
//Fake anchor.verticalCenter: printersMissingText.verticalCenter, since we can't anchor to things that aren't siblings. Layout.alignment: Qt.AlignVCenter
anchors.top: parent.top
anchors.topMargin: Math.round(printersMissingText.height / 2 - height / 2)
text: catalog.i18nc("@button", "Refresh List") text: catalog.i18nc("@button", "Refresh List")
iconSource: UM.Theme.getIcon("ArrowDoubleCircleRight") iconSource: UM.Theme.getIcon("ArrowDoubleCircleRight")
onClicked: Cura.API.account.sync(true) onClicked: Cura.API.account.sync(true)
} }
Cura.TertiaryButton
{
id: printerListTroubleshooting
Layout.column: 1
Layout.row: 1
Layout.fillWidth: true
leftPadding: 0
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")
}
} }
} }
} }
} }
Item Item
{ {
width: parent.width Layout.fillWidth: true
height: childrenRect.height Layout.preferredHeight: childrenRect.height
Layout.preferredWidth: width Layout.alignment: Qt.AlignBottom
Layout.preferredHeight: height
Cura.SecondaryButton Cura.SecondaryButton
{ {
@ -545,7 +524,8 @@ Window
} }
} }
ColumnLayout //Placeholder for when the user has no cloud printers. // Placeholder for when the user has no cloud printers.
ColumnLayout
{ {
spacing: UM.Theme.getSize("default_margin").height spacing: UM.Theme.getSize("default_margin").height
anchors.fill: parent anchors.fill: parent
@ -556,44 +536,50 @@ Window
{ {
text: catalog.i18nc("@title:header", "No printers found") text: catalog.i18nc("@title:header", "No printers found")
font: UM.Theme.getFont("large_bold") font: UM.Theme.getFont("large_bold")
Layout.preferredWidth: width Layout.fillWidth: true
Layout.preferredHeight: height
} }
Image
Item
{ {
source: UM.Theme.getImage("3d_printer_faded") Layout.fillWidth: true
sourceSize.width: width Layout.fillHeight: true
fillMode: Image.PreserveAspectFit
Layout.alignment: Qt.AlignHCenter Image
Layout.preferredWidth: parent.width / 3 {
anchors.fill: parent
source: UM.Theme.getImage("3d_printer_faded")
sourceSize.width: width
fillMode: Image.PreserveAspectFit
}
} }
UM.Label UM.Label
{ {
text: catalog.i18nc("@text", "It seems like you don't have any compatible printers connected to Digital Factory. Make sure your printer is connected and it's running the latest firmware.") text: catalog.i18nc("@text", "It seems like you don't have any compatible printers connected to Digital Factory. Make sure your printer is connected and it's running the latest firmware.")
width: parent.width Layout.fillWidth: true
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
wrapMode: Text.Wrap wrapMode: Text.Wrap
Layout.preferredWidth: width
Layout.preferredHeight: height
} }
Item Item
{ {
Layout.preferredWidth: parent.width Layout.fillWidth: true
Layout.fillHeight: true Layout.preferredHeight: parent.height / 4
Cura.TertiaryButton Cura.TertiaryButton
{ {
text: catalog.i18nc("@button", "Learn how to connect your printer to Digital Factory") text: catalog.i18nc("@button", "Learn how to connect your printer to Digital Factory")
iconSource: UM.Theme.getIcon("LinkExternal") 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-add-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-add-cloud-printer")
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
maximumWidth: parent.width
} }
} }
Item Item
{ {
width: parent.width Layout.preferredHeight: childrenRect.height
height: childrenRect.height Layout.alignment: Qt.AlignBottom
Layout.preferredWidth: width Layout.fillWidth: true
Layout.preferredHeight: height
Cura.SecondaryButton Cura.SecondaryButton
{ {
@ -601,30 +587,34 @@ Window
text: catalog.i18nc("@button", "Sync materials with USB") text: catalog.i18nc("@button", "Sync materials with USB")
onClicked: swipeView.currentIndex = removableDriveSyncPage.SwipeView.index onClicked: swipeView.currentIndex = removableDriveSyncPage.SwipeView.index
} }
Cura.PrimaryButton
RowLayout
{ {
id: disabledSyncButton
anchors.right: parent.right anchors.right: parent.right
text: catalog.i18nc("@button", "Sync") spacing: UM.Theme.getSize("default_margin").width
enabled: false //If there are no printers, always disable this button.
} Cura.SecondaryButton
Cura.SecondaryButton {
{ text: catalog.i18nc("@button", "Refresh")
anchors.right: disabledSyncButton.left iconSource: UM.Theme.getIcon("ArrowDoubleCircleRight")
anchors.rightMargin: UM.Theme.getSize("default_margin").width outlineColor: "transparent"
text: catalog.i18nc("@button", "Refresh") onClicked: Cura.API.account.sync(true)
iconSource: UM.Theme.getIcon("ArrowDoubleCircleRight") }
outlineColor: "transparent"
onClicked: Cura.API.account.sync(true) Cura.PrimaryButton
{
id: disabledSyncButton
text: catalog.i18nc("@button", "Sync")
enabled: false // If there are no printers, always disable this button.
}
} }
} }
} }
} }
Rectangle Item
{ {
id: removableDriveSyncPage id: removableDriveSyncPage
color: UM.Theme.getColor("main_background")
ColumnLayout ColumnLayout
{ {
@ -636,46 +626,52 @@ Window
{ {
text: catalog.i18nc("@title:header", "Sync material profiles via USB") text: catalog.i18nc("@title:header", "Sync material profiles via USB")
font: UM.Theme.getFont("large_bold") font: UM.Theme.getFont("large_bold")
Layout.preferredHeight: height Layout.fillWidth: true
} }
UM.Label UM.Label
{ {
text: catalog.i18nc("@text In the UI this is followed by a list of steps the user needs to take.", "Follow the following steps to load the new material profiles to your printer.") text: catalog.i18nc("@text In the UI this is followed by a list of steps the user needs to take.", "Follow the following steps to load the new material profiles to your printer.")
font: UM.Theme.getFont("medium") font: UM.Theme.getFont("medium")
wrapMode: Text.Wrap wrapMode: Text.Wrap
width: parent.width Layout.fillWidth: true
Layout.maximumWidth: width
Layout.preferredHeight: height
} }
Row
RowLayout
{ {
width: parent.width Layout.fillWidth: true
Layout.preferredWidth: width
Layout.fillHeight: true Layout.fillHeight: true
spacing: UM.Theme.getSize("default_margin").width spacing: UM.Theme.getSize("default_margin").width
Image Item
{ {
source: UM.Theme.getImage("insert_usb") Layout.preferredWidth: parent.width / 3
width: parent.width / 3 Layout.fillHeight: true
height: width
anchors.verticalCenter: parent.verticalCenter Image
sourceSize.width: width {
anchors.fill: parent
source: UM.Theme.getImage("insert_usb")
verticalAlignment: Image.AlignVCenter
horizontalAlignment: Image.AlignHCenter
fillMode: Image.PreserveAspectFit
sourceSize.width: width
}
} }
UM.Label UM.Label
{ {
Layout.alignment: Qt.AlignCenter
Layout.fillWidth: true
text: "1. " + catalog.i18nc("@text", "Click the export material archive button.") text: "1. " + catalog.i18nc("@text", "Click the export material archive button.")
+ "\n2. " + catalog.i18nc("@text", "Save the .umm file on a USB stick.") + "\n2. " + catalog.i18nc("@text", "Save the .umm file on a USB stick.")
+ "\n3. " + catalog.i18nc("@text", "Insert the USB stick into your printer and launch the procedure to load new material profiles.") + "\n3. " + catalog.i18nc("@text", "Insert the USB stick into your printer and launch the procedure to load new material profiles.")
font: UM.Theme.getFont("medium") font: UM.Theme.getFont("medium")
wrapMode: Text.Wrap
width: parent.width * 2 / 3 - UM.Theme.getSize("default_margin").width
anchors.verticalCenter: parent.verticalCenter
} }
} }
Cura.TertiaryButton Cura.TertiaryButton
{ {
Layout.fillWidth: true
text: catalog.i18nc("@button", "How to load new material profiles to my printer") text: catalog.i18nc("@button", "How to load new material profiles to my printer")
iconSource: UM.Theme.getIcon("LinkExternal") iconSource: UM.Theme.getIcon("LinkExternal")
onClicked: Qt.openUrlExternally("https://support.ultimaker.com/hc/en-us/articles/4403319801106/?utm_source=cura&utm_medium=software&utm_campaign=add-material-profiles-via-usb") onClicked: Qt.openUrlExternally("https://support.ultimaker.com/hc/en-us/articles/4403319801106/?utm_source=cura&utm_medium=software&utm_campaign=add-material-profiles-via-usb")
@ -683,10 +679,9 @@ Window
Item Item
{ {
width: parent.width Layout.preferredHeight: childrenRect.height
height: childrenRect.height Layout.alignment: Qt.AlignBottom
Layout.preferredWidth: width Layout.fillWidth: true
Layout.preferredHeight: height
Cura.SecondaryButton Cura.SecondaryButton
{ {
@ -719,24 +714,22 @@ Window
} }
} }
Cura.GlobalStacksModel property variant cloudPrinterList: Cura.GlobalStacksModel
{ {
id: cloudPrinterList
filterConnectionType: 3 //Only show cloud connections. filterConnectionType: 3 //Only show cloud connections.
filterOnlineOnly: true //Only show printers that are online. filterOnlineOnly: true //Only show printers that are online.
filterCapabilities: ["import_material"] //Only show printers that can receive the material profiles. filterCapabilities: ["import_material"] //Only show printers that can receive the material profiles.
} }
Cura.GlobalStacksModel
property variant includeOfflinePrinterList: Cura.GlobalStacksModel
{ {
//In order to show a refresh button only when there are offline cloud printers, we need to know if there are any offline printers. //In order to show a refresh button only when there are offline cloud printers, we need to know if there are any offline printers.
//A global stacks model without the filter for online-only printers allows this. //A global stacks model without the filter for online-only printers allows this.
id: includeOfflinePrinterList
filterConnectionType: 3 //Still only show cloud connections. filterConnectionType: 3 //Still only show cloud connections.
} }
FileDialog property variant exportUsbDialog: FileDialog
{ {
id: exportUsbDialog
title: catalog.i18nc("@title:window", "Export All Materials") title: catalog.i18nc("@title:window", "Export All Materials")
selectExisting: false selectExisting: false
nameFilters: ["Material archives (*.umm)", "All files (*)"] nameFilters: ["Material archives (*.umm)", "All files (*)"]