From 5f24b70453d11fa17f6b746afe425d6841c37dd8 Mon Sep 17 00:00:00 2001 From: Tamara Hogenhout Date: Wed, 10 Jun 2015 14:57:37 +0200 Subject: [PATCH] Highlight Open button when no files are loaded This helps with first-run to make it clear where to start. Fixes #37 --- resources/qml/Cura.qml | 3 +- resources/themes/cura/styles.qml | 49 ++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 1 deletion(-) diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index e0caf4d83d..8c5c43d83c 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -192,7 +192,7 @@ UM.MainWindow { id: openFileButton; iconSource: UM.Theme.icons.open; - style: UM.Theme.styles.tool_button; + style: UM.Backend.progress < 0 ? UM.Theme.styles.open_file_button : UM.Theme.styles.tool_button; anchors { top: parent.top; @@ -433,3 +433,4 @@ UM.MainWindow { Component.onCompleted: UM.Theme.load(UM.Resources.getPath(UM.Resources.ThemesLocation, "cura")) } + diff --git a/resources/themes/cura/styles.qml b/resources/themes/cura/styles.qml index b7db374da1..e6c08b381c 100644 --- a/resources/themes/cura/styles.qml +++ b/resources/themes/cura/styles.qml @@ -35,6 +35,55 @@ QtObject { } } + property Component open_file_button: Component { + ButtonStyle { + background: UM.AngledCornerRectangle { + implicitWidth: UM.Theme.sizes.button.width; + implicitHeight: UM.Theme.sizes.button.height; + color: { + if(control.hovered) { + return UM.Theme.colors.button_active_hover; + } else { + return UM.Theme.colors.button_active; + } + } + Behavior on color { ColorAnimation { duration: 50; } } + cornerSize: UM.Theme.sizes.default_margin.width; + + Rectangle { + anchors.bottom: parent.top; + + width: parent.width; + height: control.hovered ? label.height : 0; + Behavior on height { NumberAnimation { duration: 75; } } + + opacity: control.hovered ? 1.0 : 0.0; + Behavior on opacity { NumberAnimation { duration: 75; } } + + Label { + id: label + anchors.horizontalCenter: parent.horizontalCenter; + text: control.text; + font: UM.Theme.fonts.button_tooltip; + color: UM.Theme.colors.button_tooltip_text; + } + } + } + + label: Item { + Image { + anchors.centerIn: parent; + + source: control.iconSource; + width: UM.Theme.sizes.button_icon.width; + height: UM.Theme.sizes.button_icon.height; + + sourceSize: UM.Theme.sizes.button_icon; + } + } + } + } + property Component tool_button: Component { ButtonStyle { background: UM.AngledCornerRectangle {