mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-23 14:44:13 -06:00

This theme item is broken by nature since the theme itself allows you to change the colours such that these text elements don't get inversed colours at all. Instead I'm going to use text_emphasis for these which is currently the same. If ever they need to get different colours for these items than the normal colour, the theme item will have to be split up. Contributes to issue CURA-4148.
216 lines
7.5 KiB
QML
216 lines
7.5 KiB
QML
// Copyright (c) 2017 Ultimaker B.V.
|
|
// Cura is released under the terms of the AGPLv3 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
|
|
import "Menus"
|
|
|
|
Rectangle
|
|
{
|
|
id: base
|
|
anchors.left: parent.left
|
|
anchors.right: parent.right
|
|
height: UM.Theme.getSize("sidebar_header").height
|
|
color: UM.Theme.getColor("sidebar_header_bar")
|
|
|
|
property bool printerConnected: Cura.MachineManager.printerOutputDevices.length != 0
|
|
property bool printerAcceptsCommands: printerConnected && Cura.MachineManager.printerOutputDevices[0].acceptsCommands
|
|
property bool monitoringPrint: false
|
|
signal startMonitoringPrint()
|
|
signal stopMonitoringPrint()
|
|
UM.I18nCatalog
|
|
{
|
|
id: catalog
|
|
name:"cura"
|
|
}
|
|
|
|
Row
|
|
{
|
|
anchors.left: parent.left
|
|
anchors.right: machineSelection.left
|
|
anchors.rightMargin: UM.Theme.getSize("default_margin").width
|
|
spacing: UM.Theme.getSize("default_margin").width
|
|
|
|
Button
|
|
{
|
|
id: showSettings
|
|
height: UM.Theme.getSize("sidebar_header").height
|
|
onClicked: base.stopMonitoringPrint()
|
|
iconSource: UM.Theme.getIcon("tab_settings");
|
|
property color overlayColor: "transparent"
|
|
property string overlayIconSource: ""
|
|
text: catalog.i18nc("@title:tab", "Prepare")
|
|
checkable: true
|
|
checked: !base.monitoringPrint
|
|
exclusiveGroup: sidebarHeaderBarGroup
|
|
|
|
style: UM.Theme.styles.topbar_header_tab
|
|
}
|
|
|
|
Button
|
|
{
|
|
id: showMonitor
|
|
height: UM.Theme.getSize("sidebar_header").height
|
|
onClicked: base.startMonitoringPrint()
|
|
text: catalog.i18nc("@title:tab", "Print")
|
|
iconSource: UM.Theme.getIcon("tab_monitor")
|
|
property color overlayColor:
|
|
{
|
|
if(!printerAcceptsCommands)
|
|
{
|
|
return UM.Theme.getColor("status_unknown");
|
|
}
|
|
|
|
if(Cura.MachineManager.printerOutputDevices[0].printerState == "maintenance")
|
|
{
|
|
return UM.Theme.getColor("status_busy");
|
|
}
|
|
switch(Cura.MachineManager.printerOutputDevices[0].jobState)
|
|
{
|
|
case "printing":
|
|
case "pre_print":
|
|
case "wait_cleanup":
|
|
case "pausing":
|
|
case "resuming":
|
|
return UM.Theme.getColor("status_busy");
|
|
case "ready":
|
|
case "":
|
|
return UM.Theme.getColor("status_ready");
|
|
case "paused":
|
|
return UM.Theme.getColor("status_paused");
|
|
case "error":
|
|
return UM.Theme.getColor("status_stopped");
|
|
case "offline":
|
|
return UM.Theme.getColor("status_offline");
|
|
default:
|
|
return UM.Theme.getColor("text_emphasis");
|
|
}
|
|
}
|
|
property string overlayIconSource:
|
|
{
|
|
if(!printerConnected)
|
|
{
|
|
return "";
|
|
}
|
|
else if(!printerAcceptsCommands)
|
|
{
|
|
return UM.Theme.getIcon("tab_status_unknown");
|
|
}
|
|
|
|
if(Cura.MachineManager.printerOutputDevices[0].printerState == "maintenance")
|
|
{
|
|
return UM.Theme.getIcon("tab_status_busy");
|
|
}
|
|
|
|
switch(Cura.MachineManager.printerOutputDevices[0].jobState)
|
|
{
|
|
case "printing":
|
|
case "pre_print":
|
|
case "wait_cleanup":
|
|
case "pausing":
|
|
case "resuming":
|
|
return UM.Theme.getIcon("tab_status_busy");
|
|
case "ready":
|
|
case "":
|
|
return UM.Theme.getIcon("tab_status_connected")
|
|
case "paused":
|
|
return UM.Theme.getIcon("tab_status_paused")
|
|
case "error":
|
|
return UM.Theme.getIcon("tab_status_stopped")
|
|
case "offline":
|
|
return UM.Theme.getIcon("tab_status_offline")
|
|
default:
|
|
return ""
|
|
}
|
|
}
|
|
|
|
checkable: true
|
|
checked: base.monitoringPrint
|
|
exclusiveGroup: sidebarHeaderBarGroup
|
|
|
|
style: UM.Theme.styles.topbar_header_tab
|
|
}
|
|
|
|
ExclusiveGroup { id: sidebarHeaderBarGroup }
|
|
}
|
|
|
|
ToolButton
|
|
{
|
|
id: machineSelection
|
|
text: Cura.MachineManager.activeMachineName
|
|
|
|
width: UM.Theme.getSize("sidebar").width;
|
|
height: UM.Theme.getSize("sidebar_header").height
|
|
tooltip: Cura.MachineManager.activeMachineName
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
anchors.right: parent.right
|
|
style: ButtonStyle
|
|
{
|
|
background: Rectangle
|
|
{
|
|
color:
|
|
{
|
|
if(control.pressed)
|
|
{
|
|
return UM.Theme.getColor("sidebar_header_active");
|
|
} else if(control.hovered)
|
|
{
|
|
return UM.Theme.getColor("sidebar_header_hover");
|
|
} else
|
|
{
|
|
return UM.Theme.getColor("sidebar_header_bar");
|
|
}
|
|
}
|
|
Behavior on color { ColorAnimation { duration: 50; } }
|
|
|
|
Rectangle
|
|
{
|
|
id: underline;
|
|
|
|
anchors.left: parent.left
|
|
anchors.right: parent.right
|
|
anchors.bottom: parent.bottom
|
|
height: UM.Theme.getSize("sidebar_header_highlight").height
|
|
color: UM.Theme.getColor("sidebar_header_highlight_hover")
|
|
visible: control.hovered || control.pressed
|
|
}
|
|
|
|
UM.RecolorImage
|
|
{
|
|
id: downArrow
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
anchors.right: parent.right
|
|
anchors.rightMargin: UM.Theme.getSize("default_margin").width
|
|
width: UM.Theme.getSize("standard_arrow").width
|
|
height: UM.Theme.getSize("standard_arrow").height
|
|
sourceSize.width: width
|
|
sourceSize.height: width
|
|
color: UM.Theme.getColor("text_emphasis")
|
|
source: UM.Theme.getIcon("arrow_bottom")
|
|
}
|
|
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
|
|
anchors.right: downArrow.left;
|
|
anchors.rightMargin: control.rightMargin;
|
|
anchors.verticalCenter: parent.verticalCenter;
|
|
font: UM.Theme.getFont("large")
|
|
}
|
|
}
|
|
label: Label {}
|
|
}
|
|
|
|
menu: PrinterMenu { }
|
|
}
|
|
}
|