Grey-out buttons when using cloud connection

Contributes to CL-1247
(includes some boyscoutin')
This commit is contained in:
Ian Paschal 2019-02-19 12:23:33 +01:00
parent c14aa3686c
commit e23dd2dd6b
2 changed files with 26 additions and 21 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