Added status icon

This commit is contained in:
Ian Paschal 2018-03-07 17:15:56 +01:00
parent 6abbe7381a
commit a02486e85a
3 changed files with 50 additions and 19 deletions

View file

@ -10,35 +10,28 @@ import UM 1.2 as UM
import Cura 1.0 as Cura
import "Menus"
ToolButton
{
ToolButton {
property bool printerConnected: Cura.MachineManager.printerOutputDevices.length != 0
text: Cura.MachineManager.activeMachineName
tooltip: Cura.MachineManager.activeMachineName
style: ButtonStyle
{
background: Rectangle
{
color:
{
if(control.pressed)
{
style: ButtonStyle {
background: Rectangle {
color: {
if (control.pressed) {
return UM.Theme.getColor("sidebar_header_active");
}
else if(control.hovered)
{
else if (control.hovered) {
return UM.Theme.getColor("sidebar_header_hover");
}
else
{
else {
return UM.Theme.getColor("sidebar_header_bar");
}
}
Behavior on color { ColorAnimation { duration: 50; } }
UM.RecolorImage
{
UM.RecolorImage {
id: downArrow
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
@ -50,14 +43,23 @@ ToolButton
color: UM.Theme.getColor("text_emphasis")
source: UM.Theme.getIcon("arrow_bottom")
}
Label
{
PrinterStatusIcon {
visible: printerConnected
anchors {
verticalCenter: parent.verticalCenter
left: parent.left
leftMargin: UM.Theme.getSize("default_margin").width
}
}
Label {
id: sidebarComboBoxLabel
color: UM.Theme.getColor("sidebar_header_text_active")
text: control.text;
elide: Text.ElideRight;
anchors.left: parent.left;
anchors.leftMargin: UM.Theme.getSize("default_margin").width * 2
anchors.leftMargin: printerConnected ? UM.Theme.getSize("default_margin").width * 3 : UM.Theme.getSize("default_margin").width * 2
anchors.right: downArrow.left;
anchors.rightMargin: control.rightMargin;
anchors.verticalCenter: parent.verticalCenter;

View file

@ -0,0 +1,27 @@
// Copyright (c) 2017 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.2
import QtQuick.Controls 1.1
import QtQuick.Controls.Styles 1.1
import QtQuick.Layouts 1.1
import UM 1.2 as UM
import Cura 1.0 as Cura
Item {
property bool printerConnected: Cura.MachineManager.printerOutputDevices.length != 0
width: childrenRect.width
height: childrenRect.height
Image {
id: statusIcon
width: UM.Theme.getSize("status_icon").width
height: UM.Theme.getSize("status_icon").height
sourceSize.width: width
sourceSize.height: width
source: printerConnected ? UM.Theme.getIcon("tab_status_connected") : UM.Theme.getIcon("tab_status_busy")
}
}

View file

@ -360,6 +360,8 @@
"small_button": [2, 2],
"small_button_icon": [1.5, 1.5],
"status_icon": [1.0, 1.0],
"topbar_logo_right_margin": [3, 0],
"topbar_button": [8, 4],
"topbar_button_icon": [1.2, 1.2],