Add sidebar_collapse to the saved preferences, typos, move back machine selection to the top bar

CURA-4234
This commit is contained in:
Aleksei S 2017-12-12 11:26:17 +01:00
parent 00529f37d9
commit 6968c089db
5 changed files with 72 additions and 73 deletions

View file

@ -384,6 +384,8 @@ class CuraApplication(QtApplication):
self._plugin_registry.addSupportedPluginExtension("curaplugin", "Cura Plugin") self._plugin_registry.addSupportedPluginExtension("curaplugin", "Cura Plugin")
preferences.addPreference("general/sidebar_collapse", False)
def _onEngineCreated(self): def _onEngineCreated(self):
self._engine.addImageProvider("camera", CameraImageProvider.CameraImageProvider()) self._engine.addImageProvider("camera", CameraImageProvider.CameraImageProvider())

View file

@ -394,7 +394,7 @@ Item
Action Action
{ {
id: expandSidebarAction; id: expandSidebarAction;
text: catalog.i18nc("@action:inmenu menubar:view","Expand/Collapse sidebar"); text: catalog.i18nc("@action:inmenu menubar:view","Expand/Collapse Sidebar");
shortcut: "Ctrl+E"; shortcut: "Ctrl+E";
} }
} }

View file

@ -401,12 +401,12 @@ UM.MainWindow
collapsSidebarAnimation.start(); collapsSidebarAnimation.start();
} }
collapsed = !collapsed; collapsed = !collapsed;
UM.Preferences.setValue("general/sidebar_collaps", collapsed); UM.Preferences.setValue("general/sidebar_collapse", collapsed);
} }
anchors anchors
{ {
top: topbar.top top: topbar.bottom
bottom: parent.bottom bottom: parent.bottom
} }
@ -419,7 +419,7 @@ UM.MainWindow
target: sidebar target: sidebar
properties: "x" properties: "x"
to: base.width to: base.width
duration: 500 duration: 100
} }
NumberAnimation { NumberAnimation {
@ -427,12 +427,12 @@ UM.MainWindow
target: sidebar target: sidebar
properties: "x" properties: "x"
to: base.width - sidebar.width to: base.width - sidebar.width
duration: 500 duration: 100
} }
Component.onCompleted: Component.onCompleted:
{ {
var sidebarCollaps = UM.Preferences.getValue("general/sidebar_collaps") var sidebarCollaps = UM.Preferences.getValue("general/sidebar_collapse")
if (sidebarCollaps == true){ if (sidebarCollaps == true){
sidebar.collapsed = true; sidebar.collapsed = true;

View file

@ -87,77 +87,10 @@ Rectangle
} }
} }
ToolButton
{
id: machineSelection
text: Cura.MachineManager.activeMachineName
width: base.width
height: UM.Theme.getSize("sidebar_header").height
tooltip: Cura.MachineManager.activeMachineName
anchors.top: base.top
//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; } }
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 * 2
anchors.right: downArrow.left;
anchors.rightMargin: control.rightMargin;
anchors.verticalCenter: parent.verticalCenter;
font: UM.Theme.getFont("large")
}
}
label: Label {}
}
menu: PrinterMenu { }
}
SidebarHeader { SidebarHeader {
id: header id: header
width: parent.width width: parent.width
visible: machineExtruderCount.properties.value > 1 || Cura.MachineManager.hasMaterials || Cura.MachineManager.hasVariants visible: machineExtruderCount.properties.value > 1 || Cura.MachineManager.hasMaterials || Cura.MachineManager.hasVariants
anchors.top: machineSelection.bottom
onShowTooltip: base.showTooltip(item, location, text) onShowTooltip: base.showTooltip(item, location, text)
onHideTooltip: base.hideTooltip() onHideTooltip: base.hideTooltip()

View file

@ -76,6 +76,70 @@ Rectangle
ExclusiveGroup { id: topbarMenuGroup } ExclusiveGroup { id: topbarMenuGroup }
} }
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; } }
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 * 2
anchors.right: downArrow.left;
anchors.rightMargin: control.rightMargin;
anchors.verticalCenter: parent.verticalCenter;
font: UM.Theme.getFont("large")
}
}
label: Label {}
}
menu: PrinterMenu { }
}
// View orientation Item // View orientation Item
Row Row