mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-07 22:13:58 -06:00
Added topbar to Cura
CURA-3964
This commit is contained in:
parent
8776cedd27
commit
7e07482dec
5 changed files with 264 additions and 241 deletions
|
@ -88,221 +88,6 @@ Rectangle
|
|||
}
|
||||
}
|
||||
|
||||
// Printer selection and mode selection buttons for changing between Setting & Monitor print mode
|
||||
Rectangle
|
||||
{
|
||||
id: sidebarHeaderBar
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
height: childrenRect.height
|
||||
color: UM.Theme.getColor("sidebar_header_bar")
|
||||
|
||||
Row
|
||||
{
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: UM.Theme.getSize("default_margin").width
|
||||
spacing: UM.Theme.getSize("default_margin").width
|
||||
|
||||
ToolButton
|
||||
{
|
||||
id: machineSelection
|
||||
text: Cura.MachineManager.activeMachineName
|
||||
|
||||
width: parent.width - (showSettings.width + showMonitor.width + 2 * UM.Theme.getSize("default_margin").width)
|
||||
height: UM.Theme.getSize("sidebar_header").height
|
||||
tooltip: Cura.MachineManager.activeMachineName
|
||||
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
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_reversed")
|
||||
source: UM.Theme.getIcon("arrow_bottom")
|
||||
}
|
||||
Label {
|
||||
id: sidebarComboBoxLabel
|
||||
color: UM.Theme.getColor("text_reversed")
|
||||
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 { }
|
||||
}
|
||||
|
||||
Button
|
||||
{
|
||||
id: showSettings
|
||||
width: height
|
||||
height: UM.Theme.getSize("sidebar_header").height
|
||||
onClicked: monitoringPrint = false
|
||||
iconSource: UM.Theme.getIcon("tab_settings");
|
||||
property color overlayColor: "transparent"
|
||||
property string overlayIconSource: ""
|
||||
|
||||
checkable: true
|
||||
checked: !monitoringPrint
|
||||
exclusiveGroup: sidebarHeaderBarGroup
|
||||
property string tooltipText: catalog.i18nc("@tooltip", "<b>Print Setup</b><br/><br/>Edit or review the settings for the active print job.")
|
||||
|
||||
onHoveredChanged: {
|
||||
if (hovered)
|
||||
{
|
||||
tooltipDelayTimer.item = showSettings
|
||||
tooltipDelayTimer.text = tooltipText
|
||||
tooltipDelayTimer.start();
|
||||
}
|
||||
else
|
||||
{
|
||||
tooltipDelayTimer.stop();
|
||||
base.hideTooltip();
|
||||
}
|
||||
}
|
||||
|
||||
style: UM.Theme.styles.sidebar_header_tab
|
||||
}
|
||||
|
||||
Button
|
||||
{
|
||||
id: showMonitor
|
||||
width: height
|
||||
height: UM.Theme.getSize("sidebar_header").height
|
||||
onClicked: monitoringPrint = true
|
||||
iconSource: printerConnected ? UM.Theme.getIcon("tab_monitor_with_status") : 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_reversed");
|
||||
}
|
||||
}
|
||||
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: monitoringPrint
|
||||
exclusiveGroup: sidebarHeaderBarGroup
|
||||
property string tooltipText: catalog.i18nc("@tooltip", "<b>Print Monitor</b><br/><br/>Monitor the state of the connected printer and the print job in progress.")
|
||||
|
||||
onHoveredChanged: {
|
||||
if (hovered)
|
||||
{
|
||||
tooltipDelayTimer.item = showMonitor
|
||||
tooltipDelayTimer.text = tooltipText
|
||||
tooltipDelayTimer.start();
|
||||
}
|
||||
else
|
||||
{
|
||||
tooltipDelayTimer.stop();
|
||||
base.hideTooltip();
|
||||
}
|
||||
}
|
||||
|
||||
style: UM.Theme.styles.sidebar_header_tab
|
||||
}
|
||||
ExclusiveGroup { id: sidebarHeaderBarGroup }
|
||||
}
|
||||
}
|
||||
|
||||
SidebarHeader {
|
||||
id: header
|
||||
width: parent.width
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue