Move sidebar target for plugins to only middle section

This commit is contained in:
ChrisTerBeke 2017-12-05 10:56:59 +01:00
parent 5673a834bc
commit e33288b7c8
7 changed files with 67 additions and 92 deletions

View file

@ -395,30 +395,6 @@ UM.MainWindow
width: parent.width
z: 1
monitoringPrint: base.showPrintMonitor
visible: Cura.SidebarController.activeSidebarId == "default"
}
// The sidebarRepeater exposes sidebar views provided by plugins.
// Whenever a plugin sidebar view is active (e.g. not "default"), that sidebar view is shown.
Repeater
{
id: sidebarRepeater
model: Cura.SidebarViewModel { }
delegate: Loader
{
id: delegate
asynchronous: true
visible: model.active
// dynamically get the component from the sidebar controller or set the default sidebar
sourceComponent: {
if (model.id !== "default") {
return Cura.SidebarController.getSidebarComponent(model.id)
}
}
}
}
}

View file

@ -87,25 +87,6 @@ Rectangle
}
}
SidebarHeader {
id: header
width: parent.width
visible: machineExtruderCount.properties.value > 1 || Cura.MachineManager.hasMaterials || Cura.MachineManager.hasVariants
onShowTooltip: base.showTooltip(item, location, text)
onHideTooltip: base.hideTooltip()
}
Rectangle {
id: headerSeparator
width: parent.width
visible: settingsModeSelection.visible && header.visible
height: visible ? UM.Theme.getSize("sidebar_lining").height : 0
color: UM.Theme.getColor("sidebar_lining")
anchors.top: header.bottom
anchors.topMargin: visible ? UM.Theme.getSize("sidebar_margin").height : 0
}
onCurrentModeIndexChanged:
{
UM.Preferences.setValue("cura/active_mode", currentModeIndex);
@ -115,6 +96,24 @@ Rectangle
}
}
SidebarHeader {
id: header
width: parent.width
visible: (machineExtruderCount.properties.value > 1 || Cura.MachineManager.hasMaterials || Cura.MachineManager.hasVariants) && Cura.SidebarController.activeSidebarId == "default"
onShowTooltip: base.showTooltip(item, location, text)
onHideTooltip: base.hideTooltip()
}
Rectangle {
id: headerSeparator
width: parent.width
visible: settingsModeSelection.visible && header.visible && Cura.SidebarController.activeSidebarId == "default"
height: visible ? UM.Theme.getSize("sidebar_lining").height : 0
color: UM.Theme.getColor("sidebar_lining")
anchors.top: header.bottom
anchors.topMargin: visible ? UM.Theme.getSize("sidebar_margin").height : 0
}
Label {
id: settingsModeLabel
text: !hideSettings ? catalog.i18nc("@label:listbox", "Print Setup") : catalog.i18nc("@label:listbox","Print Setup disabled\nG-code files cannot be modified");
@ -125,7 +124,7 @@ Rectangle
width: Math.floor(parent.width * 0.45)
font: UM.Theme.getFont("large")
color: UM.Theme.getColor("text")
visible: !monitoringPrint && !hideView
visible: !monitoringPrint && !hideView && Cura.SidebarController.activeSidebarId == "default"
}
Rectangle {
@ -147,7 +146,7 @@ Rectangle
}
}
anchors.topMargin: UM.Theme.getSize("sidebar_margin").height
visible: !monitoringPrint && !hideSettings && !hideView
visible: !monitoringPrint && !hideSettings && !hideView && Cura.SidebarController.activeSidebarId == "default"
Component{
id: wizardDelegate
Button {
@ -228,7 +227,7 @@ Rectangle
anchors.topMargin: UM.Theme.getSize("sidebar_margin").height
anchors.left: base.left
anchors.right: base.right
visible: !monitoringPrint && !hideSettings
visible: !monitoringPrint && !hideSettings && Cura.SidebarController.activeSidebarId == "default"
delegate: StackViewDelegate
{
@ -259,6 +258,29 @@ Rectangle
}
}
// The sidebarRepeater exposes sidebar views provided by plugins.
// Whenever a plugin sidebar view is active (e.g. not "default"), that sidebar view is shown.
Repeater
{
id: sidebarRepeater
model: Cura.SidebarViewModel { }
delegate: Loader
{
id: delegate
asynchronous: true
visible: model.active
// dynamically get the component from the sidebar controller or set the default sidebar
sourceComponent: {
if (model.id !== "default") {
return Cura.SidebarController.getSidebarComponent(model.id)
}
}
}
}
Loader
{
id: controlItem