Merge pull request #624 from Ultimaker/fast_advanced_switch

Fast Simple<->Advanced Switch
This commit is contained in:
Jaime van Kessel 2016-02-01 10:48:27 +01:00
commit d68e17c9f5
4 changed files with 48 additions and 21 deletions

View File

@ -47,7 +47,7 @@ Item {
options: UM.ProfilesModel { addUseGlobal: true } options: UM.ProfilesModel { addUseGlobal: true }
value: UM.ActiveTool.properties.Model.getItem(base.currentIndex).profile value: UM.ActiveTool.properties.getValue("Model").getItem(base.currentIndex).profile
onItemValueChanged: { onItemValueChanged: {
var item = UM.ActiveTool.properties.Model.getItem(base.currentIndex); var item = UM.ActiveTool.properties.Model.getItem(base.currentIndex);
@ -63,7 +63,7 @@ Item {
Repeater { Repeater {
id: settings; id: settings;
model: UM.ActiveTool.properties.Model.getItem(base.currentIndex).settings model: UM.ActiveTool.properties.getValue("Model").getItem(base.currentIndex).settings
UM.SettingItem { UM.SettingItem {
width: UM.Theme.sizes.setting.width; width: UM.Theme.sizes.setting.width;
@ -91,7 +91,7 @@ Item {
width: UM.Theme.sizes.setting.height; width: UM.Theme.sizes.setting.height;
height: UM.Theme.sizes.setting.height; height: UM.Theme.sizes.setting.height;
onClicked: UM.ActiveTool.properties.Model.removeSettingOverride(UM.ActiveTool.properties.Model.getItem(base.currentIndex).id, model.key) onClicked: UM.ActiveTool.properties.getValue("Model").removeSettingOverride(UM.ActiveTool.properties.getValue("Model").getItem(base.currentIndex).id, model.key)
style: ButtonStyle style: ButtonStyle
{ {

View File

@ -473,7 +473,7 @@ UM.MainWindow
height: childrenRect.height; height: childrenRect.height;
Label Label
{ {
text: UM.ActiveTool.properties.Rotation != undefined ? "%1°".arg(UM.ActiveTool.properties.Rotation) : ""; text: UM.ActiveTool.properties.getValue("Rotation") != undefined ? "%1°".arg(UM.ActiveTool.properties.Rotation) : "";
} }
visible: UM.ActiveTool.valid && UM.ActiveTool.properties.Rotation != undefined; visible: UM.ActiveTool.valid && UM.ActiveTool.properties.Rotation != undefined;

View File

@ -82,6 +82,10 @@ Rectangle
onCurrentModeIndexChanged: onCurrentModeIndexChanged:
{ {
UM.Preferences.setValue("cura/active_mode", currentModeIndex); UM.Preferences.setValue("cura/active_mode", currentModeIndex);
if(modesListModel.count > base.currentModeIndex)
{
sidebarContents.push({ "item": modesListModel.get(base.currentModeIndex).item, "replace": true });
}
} }
Label { Label {
@ -153,31 +157,40 @@ Rectangle
} }
} }
Loader StackView
{ {
id: sidebarContents; id: sidebarContents
anchors.bottom: footerSeparator.top anchors.bottom: footerSeparator.top
anchors.top: profileItem.bottom anchors.top: profileItem.bottom
anchors.topMargin: UM.Theme.sizes.default_margin.height anchors.topMargin: UM.Theme.sizes.default_margin.height
anchors.left: base.left anchors.left: base.left
anchors.right: base.right anchors.right: base.right
source: modesListModel.count > base.currentModeIndex ? modesListModel.get(base.currentModeIndex).file : ""; delegate: StackViewDelegate
property Item sidebar: base;
onLoaded:
{ {
if(item) function transitionFinished(properties)
{ {
item.configureSettings = base.configureMachinesAction; properties.exitItem.opacity = 1
if(item.onShowTooltip != undefined) }
pushTransition: StackViewTransition
{
PropertyAnimation
{ {
item.showTooltip.connect(base.showTooltip) target: enterItem
property: "opacity"
from: 0
to: 1
duration: 100
} }
if(item.onHideTooltip != undefined) PropertyAnimation
{ {
item.hideTooltip.connect(base.hideTooltip) target: exitItem
property: "opacity"
from: 1
to: 0
duration: 100
} }
} }
} }
@ -210,10 +223,25 @@ Rectangle
id: modesListModel; id: modesListModel;
} }
SidebarSimple
{
id: sidebarSimple;
visible: false;
}
SidebarAdvanced
{
id: sidebarAdvanced;
visible: false;
configureSettings: base.configureMachinesAction;
onShowTooltip: base.showTooltip(item, location, text)
onHideTooltip: base.hideTooltip()
}
Component.onCompleted: Component.onCompleted:
{ {
modesListModel.append({ text: catalog.i18nc("@title:tab", "Simple"), file: "SidebarSimple.qml" }) modesListModel.append({ text: catalog.i18nc("@title:tab", "Simple"), item: sidebarSimple })
modesListModel.append({ text: catalog.i18nc("@title:tab", "Advanced"), file: "SidebarAdvanced.qml" }) modesListModel.append({ text: catalog.i18nc("@title:tab", "Advanced"), item: sidebarAdvanced })
sidebarContents.setSource(modesListModel.get(base.currentModeIndex).file) sidebarContents.push({ "item": modesListModel.get(base.currentModeIndex).item, "immediate": true });
} }
} }

View File

@ -11,7 +11,6 @@ import UM 1.1 as UM
Item Item
{ {
id: base; id: base;
anchors.fill: parent;
signal showTooltip(Item item, point location, string text); signal showTooltip(Item item, point location, string text);
signal hideTooltip(); signal hideTooltip();