Show settings in profile as a sorted list with section headers

CURA-1585
This commit is contained in:
fieldOfView 2016-06-07 11:18:09 +02:00
parent bbc33f5d70
commit ce388c4b23

View File

@ -91,70 +91,63 @@ UM.ManagementPage
elide: Text.ElideRight elide: Text.ElideRight
} }
ScrollView { Row {
id: currentSettingsActions
visible: base.currentItem.id == -1 || currentItem.id == Cura.MachineManager.activeQualityId
anchors.left: parent.left anchors.left: parent.left
anchors.top: profileName.bottom anchors.top: profileName.bottom
anchors.topMargin: UM.Theme.getSize("default_margin").height anchors.topMargin: UM.Theme.getSize("default_margin").height
Button
{
text: {
var profileName = Cura.MachineManager.activeQualityName;
profileName = (profileName.length > 20) ? profileName.substring(0, 20) + '...' : profileName;
return catalog.i18nc("@action:button", "Update \"%1\"".arg(profileName));
}
enabled: Cura.MachineManager.hasUserSettings && !Cura.MachineManager.isReadOnly(Cura.MachineManager.activeQualityId)
onClicked: Cura.MachineManager.updateUserContainerToQuality()
}
Button
{
text: catalog.i18nc("@action:button", "Discard changes");
enabled: Cura.MachineManager.hasUserSettings
onClicked: Cura.MachineManager.clearUserSettings();
}
}
ScrollView {
id: scrollView
anchors.left: parent.left
anchors.top: currentSettingsActions.visible ? currentSettingsActions.bottom : profileName.bottom
anchors.topMargin: UM.Theme.getSize("default_margin").height
anchors.right: parent.right anchors.right: parent.right
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
Column ListView {
{ model: base.currentItem ? base.currentItem.settings: null
spacing: UM.Theme.getSize("default_margin").height delegate: Row {
spacing: UM.Theme.getSize("default_margin").width
Row Label {
{ text: model.label
visible: base.currentItem.id == -1 || currentItem.id == Cura.MachineManager.activeQualityId elide: Text.ElideMiddle
Button width: scrollView.width / 100 * 40
{
text: {
var profileName = Cura.MachineManager.activeQualityName;
profileName = (profileName.length > 20) ? profileName.substring(0, 20) + '...' : profileName;
return catalog.i18nc("@action:button", "Update \"%1\"".arg(profileName));
}
enabled: Cura.MachineManager.hasUserSettings && !Cura.MachineManager.isReadOnly(Cura.MachineManager.activeQualityId)
onClicked: Cura.MachineManager.updateUserContainerToQuality()
} }
Label {
Button text: model.value.toString()
{ }
text: catalog.i18nc("@action:button", "Discard changes"); Label {
enabled: Cura.MachineManager.hasUserSettings text: model.unit
onClicked: Cura.MachineManager.clearUserSettings();
} }
} }
section.property: "category"
Grid section.criteria: ViewSection.FullString
{ section.delegate: Label {
id: containerGrid text: section
columns: 2 font.bold: true
spacing: UM.Theme.getSize("default_margin").width
Label {
text: base.currentItem == null ? "" :
base.currentItem.id == -1 ? catalog.i18nc("@label", "Based on") : catalog.i18nc("@label", "Profile type")
}
Label {
text: base.currentItem == null ? "" :
base.currentItem.id == -1 ? Cura.MachineManager.activeQualityName:
base.currentItem.metadata.read_only ? catalog.i18nc("@label", "Protected profile") : catalog.i18nc("@label", "Custom profile")
}
Column {
Repeater {
model: base.currentItem ? base.currentItem.settings : null
Label {
text: modelData.label
elide: Text.ElideMiddle;
}
}
}
Column {
Repeater {
model: base.currentItem ? base.currentItem.settings : null
Label { text: modelData.value.toString(); }
}
}
} }
} }
} }