Add connection status message

CURA-7437
This commit is contained in:
Nino van Hooff 2020-05-26 13:50:15 +02:00
parent de5c6f9318
commit 4d5ef91c43

View file

@ -16,7 +16,7 @@ Cura.ExpandablePopup
property bool isCloudRegistered: Cura.MachineManager.activeMachineHasCloudRegistration property bool isCloudRegistered: Cura.MachineManager.activeMachineHasCloudRegistration
property bool isGroup: Cura.MachineManager.activeMachineIsGroup property bool isGroup: Cura.MachineManager.activeMachineIsGroup
property string connectionStatus: { readonly property string connectionStatus: {
if (isNetworkPrinter) if (isNetworkPrinter)
{ {
return "printer_connected" return "printer_connected"
@ -35,6 +35,15 @@ Cura.ExpandablePopup
} }
} }
readonly property string connectionStatusMessage: {
if (connectionStatus == "printer_cloud_not_available")
{
return "The cloud connection is currently unavailable. Please check your internet connection and sign in to connect to the cloud printer"
} else {
return ""
}
}
contentPadding: UM.Theme.getSize("default_lining").width contentPadding: UM.Theme.getSize("default_lining").width
contentAlignment: Cura.ExpandablePopup.ContentAlignment.AlignLeft contentAlignment: Cura.ExpandablePopup.ContentAlignment.AlignLeft
@ -113,8 +122,7 @@ Cura.ExpandablePopup
{ {
id: connectionStatusTooltipHoverArea id: connectionStatusTooltipHoverArea
anchors.fill: parent anchors.fill: parent
hoverEnabled: true hoverEnabled: connectionStatusMessage !== ""
enabled: true // todo
acceptedButtons: Qt.NoButton // react to hover only, don't steal clicks acceptedButtons: Qt.NoButton // react to hover only, don't steal clicks
onEntered: onEntered:
@ -122,8 +130,8 @@ Cura.ExpandablePopup
base.showTooltip( base.showTooltip(
connectionStatusImage, connectionStatusImage,
Qt.point(0, 0), Qt.point(0, 0),
"blaat blaat" connectionStatusMessage
); //todo ); //todo: positioning
machineSelector.mouseArea.entered() // we want both this and the outer area to be entered machineSelector.mouseArea.entered() // we want both this and the outer area to be entered
} }
onExited: base.hideTooltip() onExited: base.hideTooltip()