More gracefully handle cases where no profile is selected in the profiles list

This commit is contained in:
fieldOfView 2016-07-11 15:48:41 +02:00
parent 4d2d889604
commit 7a63f957cb

View File

@ -140,7 +140,7 @@ UM.ManagementPage
Row {
id: currentSettingsActions
visible: currentItem.id == Cura.MachineManager.activeQualityId
visible: currentItem && currentItem.id == Cura.MachineManager.activeQualityId
anchors.left: parent.left
anchors.top: profileName.bottom
@ -173,14 +173,14 @@ UM.ManagementPage
Label {
id: defaultsMessage
visible: !currentItem.metadata.has_settings
visible: currentItem && !currentItem.metadata.has_settings
text: catalog.i18nc("@action:label", "This profile has no settings and uses the defaults specified by the printer.")
wrapMode: Text.WordWrap
width: parent.width
}
Label {
id: noCurrentSettingsMessage
visible: currentItem.id == Cura.MachineManager.activeQualityId && !Cura.MachineManager.hasUserSettings
visible: currentItem && currentItem.id == Cura.MachineManager.activeQualityId && !Cura.MachineManager.hasUserSettings
text: catalog.i18nc("@action:label", "Your current settings match the selected profile.")
wrapMode: Text.WordWrap
width: parent.width
@ -197,7 +197,17 @@ UM.ManagementPage
anchors.bottom: parent.bottom
ListView {
model: Cura.ContainerSettingsModel{ containers: (currentItem.id == Cura.MachineManager.activeQualityId) ? [base.currentItem.id, Cura.MachineManager.activeUserProfileId] : [base.currentItem.id] }
model: Cura.ContainerSettingsModel{ containers:
{
if (!currentItem) {
return []
} else if (currentItem.id == Cura.MachineManager.activeQualityId) {
return [base.currentItem.id, Cura.MachineManager.activeUserProfileId]
} else {
return [base.currentItem.id]
}
}
}
delegate: Row {
property variant setting: model
spacing: UM.Theme.getSize("default_margin").width/2
@ -221,7 +231,7 @@ UM.ManagementPage
}
}
header: Row {
visible: currentItem.id == Cura.MachineManager.activeQualityId
visible: currentItem && currentItem.id == Cura.MachineManager.activeQualityId
spacing: UM.Theme.getSize("default_margin").width
Label {
text: catalog.i18nc("@action:label", "Profile:")
@ -231,7 +241,7 @@ UM.ManagementPage
}
Label {
text: catalog.i18nc("@action:label", "Current:")
visible: currentItem.id == Cura.MachineManager.activeQualityId
visible: currentItem && currentItem.id == Cura.MachineManager.activeQualityId
font.bold: true
}
}