Add a preference check to enable or disable the experimental feature

This commit is contained in:
Diego Prado Gesto 2019-02-17 19:22:54 +01:00
parent 86c7d3e5ab
commit 3829eb0905
4 changed files with 84 additions and 58 deletions

View File

@ -499,6 +499,7 @@ class CuraApplication(QtApplication):
preferences.addPreference("cura/choice_on_profile_override", "always_ask")
preferences.addPreference("cura/choice_on_open_project", "always_ask")
preferences.addPreference("cura/use_multi_build_plate", False)
preferences.addPreference("cura/show_list_of_files", False)
preferences.addPreference("view/settings_list_height", 400)
preferences.addPreference("view/settings_visible", False)
preferences.addPreference("cura/currency", "")

View File

@ -24,14 +24,14 @@ Item
Item
{
anchors.horizontalCenter: parent.horizontalCenter
width: objectSelector.width + itemRow.width + UM.Theme.getSize("default_margin").width
width: loader.width + itemRow.width + UM.Theme.getSize("default_margin").width
height: parent.height
RowLayout
{
id: itemRow
anchors.left: objectSelector.right
anchors.left: loader.right
anchors.leftMargin: UM.Theme.getSize("default_margin").width
width: Math.round(0.9 * prepareMenu.width)
@ -82,60 +82,73 @@ Item
}
}
Cura.ObjectSelector
Loader
{
id: objectSelector
height: UM.Theme.getSize("stage_menu").height
width: UM.Theme.getSize("stage_menu").height
id: loader
sourceComponent: UM.Preferences.getValue("cura/show_list_of_files") ? objectSelector : openFileButton
}
// Button
// {
// id: openFileButton
// height: UM.Theme.getSize("stage_menu").height
// width: UM.Theme.getSize("stage_menu").height
// onClicked: Cura.Actions.open.trigger()
// hoverEnabled: true
//
// contentItem: Item
// {
// anchors.fill: parent
// UM.RecolorImage
// {
// id: buttonIcon
// anchors.centerIn: parent
// source: UM.Theme.getIcon("load")
// width: UM.Theme.getSize("button_icon").width
// height: UM.Theme.getSize("button_icon").height
// color: UM.Theme.getColor("icon")
//
// sourceSize.height: height
// }
// }
//
// background: Rectangle
// {
// id: background
// height: UM.Theme.getSize("stage_menu").height
// width: UM.Theme.getSize("stage_menu").height
//
// radius: UM.Theme.getSize("default_radius").width
// color: openFileButton.hovered ? UM.Theme.getColor("action_button_hovered") : UM.Theme.getColor("action_button")
// }
//
// DropShadow
// {
// id: shadow
// // Don't blur the shadow
// radius: 0
// anchors.fill: background
// source: background
// verticalOffset: 2
// visible: true
// color: UM.Theme.getColor("action_button_shadow")
// // Should always be drawn behind the background.
// z: background.z - 1
// }
// }
Component
{
id: objectSelector
Cura.ObjectSelector
{
height: UM.Theme.getSize("stage_menu").height
width: 1.5 * UM.Theme.getSize("stage_menu").height | 0
}
}
Component
{
id: openFileButton
Button
{
height: UM.Theme.getSize("stage_menu").height
width: UM.Theme.getSize("stage_menu").height
onClicked: Cura.Actions.open.trigger()
hoverEnabled: true
contentItem: Item
{
anchors.fill: parent
UM.RecolorImage
{
id: buttonIcon
anchors.centerIn: parent
source: UM.Theme.getIcon("load")
width: UM.Theme.getSize("button_icon").width
height: UM.Theme.getSize("button_icon").height
color: UM.Theme.getColor("icon")
sourceSize.height: height
}
}
background: Rectangle
{
id: background
height: UM.Theme.getSize("stage_menu").height
width: UM.Theme.getSize("stage_menu").height
radius: UM.Theme.getSize("default_radius").width
color: openFileButton.hovered ? UM.Theme.getColor("action_button_hovered") : UM.Theme.getColor("action_button")
}
DropShadow
{
id: shadow
// Don't blur the shadow
radius: 0
anchors.fill: background
source: background
verticalOffset: 2
visible: true
color: UM.Theme.getColor("action_button_shadow")
// Should always be drawn behind the background.
z: background.z - 1
}
}
}
}
}

View File

@ -32,10 +32,7 @@ Button
right: printerTypes.left
verticalCenter: parent.verticalCenter
}
text: {
print("HOLAAAAAAAA", objectItemButton.text)
return objectItemButton.text
}
text: objectItemButton.text
color: UM.Theme.getColor("text")
font: UM.Theme.getFont("medium")
visible: text != ""

View File

@ -741,6 +741,21 @@ UM.PreferencesPage
}
}
UM.TooltipArea
{
width: childrenRect.width
height: childrenRect.height
text: catalog.i18nc("@info:tooltip", "This option enables a panel showing the list of loaded models")
CheckBox
{
id: showListOfFilesCheckbox
text: catalog.i18nc("@option:check", "Show list of loaded models")
checked: boolCheck(UM.Preferences.getValue("cura/show_list_of_files"))
onCheckedChanged: UM.Preferences.setValue("cura/show_list_of_files", checked)
}
}
Connections
{
target: UM.Preferences