top bar improvements

This commit is contained in:
ChrisTerBeke 2017-09-11 15:08:06 +02:00
parent 4507f6c8e2
commit 485b71c010
2 changed files with 19 additions and 8 deletions

View file

@ -16,13 +16,16 @@ Rectangle
anchors.left: parent.left
anchors.right: parent.right
height: UM.Theme.getSize("sidebar_header").height
color: "transparent"
color: base.monitoringPrint ? UM.Theme.getColor("topbar_background_color_monitoring") : UM.Theme.getColor("topbar_background_color")
Behavior on color { ColorAnimation { duration: 100; } }
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
@ -76,21 +79,21 @@ Rectangle
text: catalog.i18nc("@title:tab", "Monitor")
property string iconSource:
{
if(!printerConnected)
if (!printerConnected)
{
return UM.Theme.getIcon("tab_status_unknown");
}
else if(!printerAcceptsCommands)
else if (!printerAcceptsCommands)
{
return UM.Theme.getIcon("tab_status_unknown");
}
if(Cura.MachineManager.printerOutputDevices[0].printerState == "maintenance")
if (Cura.MachineManager.printerOutputDevices[0].printerState == "maintenance")
{
return UM.Theme.getIcon("tab_status_busy");
}
switch(Cura.MachineManager.printerOutputDevices[0].jobState)
switch (Cura.MachineManager.printerOutputDevices[0].jobState)
{
case "printing":
case "pre_print":
@ -121,7 +124,6 @@ Rectangle
ExclusiveGroup { id: sidebarHeaderBarGroup }
}
ToolButton
{
id: machineSelection
@ -142,10 +144,12 @@ Rectangle
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");
}
@ -207,12 +211,15 @@ Rectangle
rightMargin: UM.Theme.getSize("sidebar").width + UM.Theme.getSize("default_margin").width
}
style: UM.Theme.styles.combobox
visible: !base.monitoringPrint
model: UM.ViewModel { }
textRole: "name"
onCurrentIndexChanged:
{
UM.Controller.setActiveView(model.getItem(currentIndex).id);
// Update the active flag
for (var i = 0; i < model.rowCount; ++i)
{
@ -220,6 +227,7 @@ Rectangle
model.getItem(i).active = is_active;
}
}
currentIndex:
{
for (var i = 0; i < model.rowCount; ++i)