WIP: Add label for no discovered network printer

This commit is contained in:
Lipu Fei 2019-03-13 14:12:02 +01:00
parent 764f7281c2
commit 20933e8bef
2 changed files with 67 additions and 42 deletions

View file

@ -18,7 +18,7 @@ import "../PrinterSelector"
Item
{
id: base
height: networkPrinterScrollView.height + controlsRectangle.height
height: networkPrinterInfo.height + controlsRectangle.height
property alias maxItemCountAtOnce: networkPrinterScrollView.maxItemCountAtOnce
property var currentItem: (networkPrinterListView.currentIndex >= 0)
@ -28,10 +28,32 @@ Item
signal refreshButtonClicked()
signal addByIpButtonClicked()
Item
{
id: networkPrinterInfo
height: networkPrinterScrollView.visible ? networkPrinterScrollView.height : noPrinterLabel.height
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
Label
{
id: noPrinterLabel
height: UM.Theme.getSize("setting_control").height + UM.Theme.getSize("default_margin").height
anchors.left: parent.left
anchors.leftMargin: UM.Theme.getSize("default_margin").width
text: catalog.i18nc("@label", "There is no printer found over your network.")
renderType: Text.NativeRendering
verticalAlignment: Text.AlignVCenter
visible: !networkPrinterScrollView.visible
}
ScrollView
{
id: networkPrinterScrollView
anchors.fill: parent
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
ScrollBar.horizontal.policy: ScrollBar.AsNeeded
ScrollBar.vertical.policy: ScrollBar.AlwaysOn
@ -39,6 +61,8 @@ Item
property int maxItemCountAtOnce: 8 // show at max 8 items at once, otherwise you need to scroll.
height: maxItemCountAtOnce * UM.Theme.getSize("action_button").height
visible: networkPrinterListView.model.length > 0
clip: true
ListView
@ -46,7 +70,7 @@ Item
id: networkPrinterListView
anchors.fill: parent
model: CuraApplication.getDiscoveredPrinterModel().discovered_printers
visible: model.length > 0
//visible: base.visible && model.length > 0
delegate: MachineSelectorButton
{
@ -77,13 +101,14 @@ Item
}
}
}
}
Cura.RoundedRectangle
{
id: controlsRectangle
anchors.left: parent.left
anchors.right: parent.right
anchors.top: networkPrinterScrollView.bottom
anchors.top: networkPrinterInfo.bottom
// Make sure that the left, right, and bottom borders do not show up, otherwise you see double
// borders.
anchors.bottomMargin: -border.width
@ -159,7 +184,7 @@ Item
hoverEnabled: true
onClicked:
{
// open the material URL with web browser
// open the throubleshooting URL with web browser
var url = "https://ultimaker.com/incoming-links/cura/material-compatibilty" // TODO
Qt.openUrlExternally(url)
}

View file

@ -37,7 +37,7 @@ Item
anchors.right: parent.right
anchors.margins: 20
title: catalog.i18nc("@label", "Add a network printer")
title: catalog.i18nc("@label", "Add a networked printer")
contentShown: true // by default expand the network printer list
onClicked:
@ -82,7 +82,7 @@ Item
anchors.right: parent.right
anchors.margins: 20
title: catalog.i18nc("@label", "Add a non-network printer")
title: catalog.i18nc("@label", "Add a non-networked printer")
onClicked:
{