Don't show the corresponding element in the general preference panel

if the related plugin is not enabled.
Contributes to CURA-5204
This commit is contained in:
Diego Prado Gesto 2018-04-20 11:56:59 +02:00
parent 4e53f219f0
commit 121d1806be

View file

@ -98,16 +98,26 @@ UM.PreferencesPage
UM.Preferences.resetPreference("cura/choice_on_open_project")
setDefaultOpenProjectOption(UM.Preferences.getValue("cura/choice_on_open_project"))
if (plugins.find("id", "SliceInfoPlugin") > -1) {
if (pluginExistsAndEnabled("SliceInfoPlugin")) {
UM.Preferences.resetPreference("info/send_slice_info")
sendDataCheckbox.checked = boolCheck(UM.Preferences.getValue("info/send_slice_info"))
}
if (plugins.find("id", "UpdateChecker") > -1) {
if (pluginExistsAndEnabled("UpdateChecker")) {
UM.Preferences.resetPreference("info/automatic_update_check")
checkUpdatesCheckbox.checked = boolCheck(UM.Preferences.getValue("info/automatic_update_check"))
}
}
function pluginExistsAndEnabled(pluginName)
{
var pluginItem = plugins.find("id", pluginName)
if (pluginItem > -1)
{
return plugins.getItem(pluginItem).enabled
}
return false
}
ScrollView
{
width: parent.width
@ -633,7 +643,7 @@ UM.PreferencesPage
}
UM.TooltipArea {
visible: plugins.find("id", "UpdateChecker") > -1
visible: pluginExistsAndEnabled("UpdateChecker")
width: childrenRect.width
height: visible ? childrenRect.height : 0
text: catalog.i18nc("@info:tooltip","Should Cura check for updates when the program is started?")
@ -642,34 +652,29 @@ UM.PreferencesPage
{
id: checkUpdatesCheckbox
text: catalog.i18nc("@option:check","Check for updates on start")
checked: boolCheck(UM.Preferences.getValue("info/automatic_update_check"))
checked: parent.visible ? boolCheck(UM.Preferences.getValue("info/automatic_update_check")): false
onCheckedChanged: UM.Preferences.setValue("info/automatic_update_check", checked)
}
}
UM.TooltipArea {
visible: plugins.find("id", "SliceInfoPlugin") > -1
visible: pluginExistsAndEnabled("SliceInfoPlugin")
width: childrenRect.width
height: visible ? childrenRect.height * 2 : 0
height: visible ? childrenRect.height : 0
text: catalog.i18nc("@info:tooltip","Should anonymous data about your print be sent to Ultimaker? Note, no models, IP addresses or other personally identifiable information is sent or stored.")
CheckBox
{
id: sendDataCheckbox
text: catalog.i18nc("@option:check","Send (anonymous) print information")
checked: boolCheck(UM.Preferences.getValue("info/send_slice_info"))
checked: parent.visible ? boolCheck(UM.Preferences.getValue("info/send_slice_info")) : false
onCheckedChanged: UM.Preferences.setValue("info/send_slice_info", checked)
}
Button
{
id: showMoreInfo
anchors
{
top: sendDataCheckbox.bottom
bottom: parent.bottom
}
anchors.top: sendDataCheckbox.bottom
text: catalog.i18nc("@action:button", "More information")
onClicked:
{
@ -718,8 +723,6 @@ UM.PreferencesPage
onCheckedChanged: UM.Preferences.setValue("cura/not_arrange_objects_on_load", checked)
}
}
}
}
}