Merge pull request #5329 from Ultimaker/CL-1247_improve_cloud_disabled_states

CL-1247 Improve cloud disabled states
This commit is contained in:
Simon Edwards 2019-02-20 13:17:11 +01:00 committed by GitHub
commit 60547b4265
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 39 additions and 24 deletions

View file

@ -7,34 +7,39 @@ import QtQuick.Controls.Styles 1.3
import UM 1.3 as UM import UM 1.3 as UM
import Cura 1.0 as Cura import Cura 1.0 as Cura
Rectangle { Rectangle
{
id: base id: base
property var enabled: true property var enabled: true
property var iconSource: null; property var iconSource: null
color: UM.Theme.getColor("monitor_icon_primary") color: enabled ? UM.Theme.getColor("monitor_icon_primary") : UM.Theme.getColor("monitor_icon_disabled")
height: width; height: width
radius: Math.round(0.5 * width); radius: Math.round(0.5 * width)
width: 24 * screenScaleFactor; width: 24 * screenScaleFactor
UM.RecolorImage { UM.RecolorImage
id: icon; {
anchors { id: icon
horizontalCenter: parent.horizontalCenter; anchors
verticalCenter: parent.verticalCenter; {
horizontalCenter: parent.horizontalCenter
verticalCenter: parent.verticalCenter
} }
color: UM.Theme.getColor("monitor_icon_accent"); color: UM.Theme.getColor("monitor_icon_accent")
height: width; height: width
source: iconSource; source: iconSource
width: Math.round(parent.width / 2); width: Math.round(parent.width / 2)
} }
MouseArea { MouseArea
id: clickArea; {
anchors.fill: parent; id: clickArea
anchors.fill: parent
hoverEnabled: base.enabled hoverEnabled: base.enabled
onClicked: { onClicked:
{
if (base.enabled) if (base.enabled)
{ {
if (OutputDevice.activeCameraUrl != "") if (OutputDevice.activeCameraUrl != "")

View file

@ -11,14 +11,14 @@ Button
id: base id: base
background: Rectangle background: Rectangle
{ {
color: UM.Theme.getColor("viewport_background") // TODO: Theme! color: enabled ? UM.Theme.getColor("viewport_background") : "transparent"
height: base.height height: base.height
opacity: base.down || base.hovered ? 1 : 0 opacity: base.down || base.hovered ? 1 : 0
radius: Math.round(0.5 * width) radius: Math.round(0.5 * width)
width: base.width width: base.width
} }
contentItem: Label { contentItem: Label {
color: UM.Theme.getColor("monitor_text_primary") color: enabled ? UM.Theme.getColor("monitor_text_primary") : UM.Theme.getColor("monitor_text_disabled")
font.pixelSize: 32 * screenScaleFactor font.pixelSize: 32 * screenScaleFactor
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
text: base.text text: base.text

View file

@ -14,6 +14,10 @@ import Cura 1.0 as Cura
*/ */
Item Item
{ {
// If the printer is a cloud printer or not. Other items base their enabled state off of this boolean. In the future
// they might not need to though.
property bool cloudConnection: Cura.MachineManager.activeMachineIsUsingCloudConnection
Label Label
{ {
id: queuedLabel id: queuedLabel
@ -37,6 +41,7 @@ Item
} }
height: 18 * screenScaleFactor // TODO: Theme! height: 18 * screenScaleFactor // TODO: Theme!
width: childrenRect.width width: childrenRect.width
visible: !cloudConnection
UM.RecolorImage UM.RecolorImage
{ {
@ -67,7 +72,8 @@ Item
MouseArea MouseArea
{ {
anchors.fill: manageQueueLabel anchors.fill: manageQueueLabel
hoverEnabled: true enabled: !cloudConnection
hoverEnabled: !cloudConnection
onClicked: Cura.MachineManager.printerOutputDevices[0].openPrintJobControlPanel() onClicked: Cura.MachineManager.printerOutputDevices[0].openPrintJobControlPanel()
onEntered: onEntered:
{ {

View file

@ -481,8 +481,10 @@ class UM3OutputDevicePlugin(OutputDevicePlugin):
"resources", "svg", "cloud-flow-completed.svg")), "resources", "svg", "cloud-flow-completed.svg")),
image_caption = i18n_catalog.i18nc("@info:status", "Connected!") image_caption = i18n_catalog.i18nc("@info:status", "Connected!")
) )
self._cloud_flow_complete_message.addAction("", i18n_catalog.i18nc("@action", "Review your connection"), "", "", 1) # TODO: Icon # Don't show the review connection link if we're not on the local network
self._cloud_flow_complete_message.actionTriggered.connect(self._onReviewCloudConnection) if self._application.getMachineManager().activeMachineHasNetworkConnection:
self._cloud_flow_complete_message.addAction("", i18n_catalog.i18nc("@action", "Review your connection"), "", "", 1) # TODO: Icon
self._cloud_flow_complete_message.actionTriggered.connect(self._onReviewCloudConnection)
self._cloud_flow_complete_message.show() self._cloud_flow_complete_message.show()
# Set the machine's cloud flow as complete so we don't ask the user again and again for cloud connected printers # Set the machine's cloud flow as complete so we don't ask the user again and again for cloud connected printers

View file

@ -222,6 +222,7 @@
"monitor_text_link": [103, 160, 252, 255], "monitor_text_link": [103, 160, 252, 255],
"monitor_icon_primary": [229, 229, 229, 255], "monitor_icon_primary": [229, 229, 229, 255],
"monitor_icon_accent": [51, 53, 54, 255], "monitor_icon_accent": [51, 53, 54, 255],
"monitor_icon_disabled": [102, 102, 102, 255],
"monitor_secondary_button_hover": [80, 80, 80, 255], "monitor_secondary_button_hover": [80, 80, 80, 255],
"monitor_secondary_button": [92, 92, 92, 255], "monitor_secondary_button": [92, 92, 92, 255],

View file

@ -397,6 +397,7 @@
"monitor_text_link": [50, 130, 255, 255], "monitor_text_link": [50, 130, 255, 255],
"monitor_icon_primary": [10, 8, 80, 255], "monitor_icon_primary": [10, 8, 80, 255],
"monitor_icon_accent": [255, 255, 255, 255], "monitor_icon_accent": [255, 255, 255, 255],
"monitor_icon_disabled": [238, 238, 238, 255],
"monitor_secondary_button_hover": [228, 228, 228, 255], "monitor_secondary_button_hover": [228, 228, 228, 255],
"monitor_secondary_button": [240, 240, 240, 255], "monitor_secondary_button": [240, 240, 240, 255],