From fb8bde6f76e4812968d8ffe4a7031c8ce2223705 Mon Sep 17 00:00:00 2001 From: Aleksei S Date: Fri, 3 Nov 2017 15:29:33 +0100 Subject: [PATCH] Added view rotation for each click CURA-4527 --- resources/qml/Cura.qml | 83 ++++++++++++++++++++ resources/themes/cura-light/styles.qml | 103 +++++++++++++++++++++++++ 2 files changed, 186 insertions(+) diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 2fd19a8a03..e6b30e8f5c 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -403,6 +403,89 @@ UM.MainWindow } } + + //View orientation Item + Item + { + height: 90 + width: 90 + + anchors.top: topbar.bottom; + anchors.topMargin: - UM.Theme.getSize("default_margin").height * 2; + anchors.right: sidebar.left + anchors.rightMargin: 250 + + //Rotate_top + Button + { + id: orientation_rotate_top; + iconSource: UM.Theme.getIcon("arrow_top") + style: UM.Theme.styles.orientation_button + anchors.top: parent.top + anchors.left: parent.left + anchors.leftMargin: 30 + + + } + + //Rotate_right + Button + { + id: orientation_rotate_right; + iconSource: UM.Theme.getIcon("arrow_right") + style: UM.Theme.styles.orientation_button + anchors.bottom: parent.bottom + anchors.bottomMargin: 30 + anchors.right: parent.right + onClicked:{ + UM.Controller.rotateView("x", -90); + } + } + + //Rotate_bottom + Button + { + id: orientation_rotate_bottom; + iconSource: UM.Theme.getIcon("arrow_bottom") + style: UM.Theme.styles.orientation_button + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.leftMargin: 30 + } + + //Rotate_left + Button + { + id: orientation_rotate_left; + iconSource: UM.Theme.getIcon("arrow_left") + style: UM.Theme.styles.orientation_button + anchors.bottom: parent.bottom + anchors.bottomMargin: 30 + anchors.left: parent.left + onClicked:{ + UM.Controller.rotateView("x", 90); + } + + } + + //Rotate_front + Button + { + id: orientation_rotate_front; + iconSource: UM.Theme.getIcon("category_machine") + style: UM.Theme.styles.orientation_button + anchors.bottom: parent.bottom + anchors.bottomMargin: 30 + anchors.left: parent.left + anchors.leftMargin: 30 + + onClicked:{ + UM.Controller.rotateView("home" , 0); + } + } + } + + Loader { sourceComponent: Cura.MachineManager.printerOutputDevices.length > 0 ? Cura.MachineManager.printerOutputDevices[0].monitorItem: null diff --git a/resources/themes/cura-light/styles.qml b/resources/themes/cura-light/styles.qml index 6d991c5541..160b41b1ab 100755 --- a/resources/themes/cura-light/styles.qml +++ b/resources/themes/cura-light/styles.qml @@ -380,6 +380,109 @@ QtObject { } } + property Component orientation_button: Component { + ButtonStyle { + background: Item { + implicitWidth: 30; + implicitHeight: 30; + + Rectangle { + id: buttonFace2; + + anchors.fill: parent; + property bool down: control.pressed || (control.checkable && control.checked); + + color: { + if(control.customColor !== undefined && control.customColor !== null) { + return control.customColor + } else if(control.checkable && control.checked && control.hovered) { + return Theme.getColor("button_active_hover"); + } else if(control.pressed || (control.checkable && control.checked)) { + return Theme.getColor("button_active"); + } else if(control.hovered) { + return Theme.getColor("button_hover"); + } else { + //return Theme.getColor("button"); + return "red" + } + } + Behavior on color { ColorAnimation { duration: 50; } } + + border.width: (control.hasOwnProperty("needBorder") && control.needBorder) ? 2 * screenScaleFactor : 0 + border.color: Theme.getColor("tool_button_border") + + UM.RecolorImage { + id: tool_button_arrow2 + //anchors.right: parent.right; + //anchors.rightMargin: (Theme.getSize("button").width - Theme.getSize("button_icon").width) / 4 + //anchors.bottom: parent.bottom; + //anchors.bottomMargin: (Theme.getSize("button").height - Theme.getSize("button_icon").height) / 4 + //width: Theme.getSize("standard_arrow").width + //height: Theme.getSize("standard_arrow").height + + width: 5 + height: 5 + + sourceSize.width: 5 + sourceSize.height: 5 + visible: control.menu != null; + color: + { + if(control.checkable && control.checked && control.hovered) + { + return Theme.getColor("button_text_active_hover"); + } + else if(control.pressed || (control.checkable && control.checked)) + { + return Theme.getColor("button_text_active"); + } + else if(control.hovered) + { + return Theme.getColor("button_text_hover"); + } + else + { + return Theme.getColor("button_text"); + } + } + source: Theme.getIcon("arrow_bottom") + } + } + } + + label: Item { + UM.RecolorImage { + anchors.centerIn: parent; + opacity: !control.enabled ? 0.2 : 1.0 + source: control.iconSource; + width: 20; + height: 20; + color: + { + if(control.checkable && control.checked && control.hovered) + { + return Theme.getColor("button_text_active_hover"); + } + else if(control.pressed || (control.checkable && control.checked)) + { + return Theme.getColor("button_text_active"); + } + else if(control.hovered) + { + return Theme.getColor("button_text_hover"); + } + else + { + return Theme.getColor("button_text"); + } + } + + sourceSize: Theme.getSize("button_icon") + } + } + } + } + property Component progressbar: Component{ ProgressBarStyle { background: Rectangle {