Move the objectsList to the bottom

Now it appears as a panel that you can expand/collapse. For now the background is transparent waiting for the designs to be clear.
This commit is contained in:
Diego Prado Gesto 2019-03-03 20:10:14 +01:00
parent 3829eb0905
commit 7b030a8235
9 changed files with 104 additions and 429 deletions

View file

@ -29,7 +29,7 @@ class ObjectsModel(ListModel):
self.addRoleName(self.SelectedRole, "selected") self.addRoleName(self.SelectedRole, "selected")
self.addRoleName(self.OutsideAreaRole, "outside_build_area") self.addRoleName(self.OutsideAreaRole, "outside_build_area")
self.addRoleName(self.BuilplateNumberRole, "buildplate_number") self.addRoleName(self.BuilplateNumberRole, "buildplate_number")
self.addRoleName(self.SelectedRole, "node") self.addRoleName(self.NodeRole, "node")
Application.getInstance().getController().getScene().sceneChanged.connect(self._updateDelayed) Application.getInstance().getController().getScene().sceneChanged.connect(self._updateDelayed)
Application.getInstance().getPreferences().preferenceChanged.connect(self._updateDelayed) Application.getInstance().getPreferences().preferenceChanged.connect(self._updateDelayed)

View file

@ -24,14 +24,14 @@ Item
Item Item
{ {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
width: loader.width + itemRow.width + UM.Theme.getSize("default_margin").width width: openFileButton.width + itemRow.width + UM.Theme.getSize("default_margin").width
height: parent.height height: parent.height
RowLayout RowLayout
{ {
id: itemRow id: itemRow
anchors.left: loader.right anchors.left: openFileButton.right
anchors.leftMargin: UM.Theme.getSize("default_margin").width anchors.leftMargin: UM.Theme.getSize("default_margin").width
width: Math.round(0.9 * prepareMenu.width) width: Math.round(0.9 * prepareMenu.width)
@ -58,6 +58,7 @@ Item
Cura.ConfigurationMenu Cura.ConfigurationMenu
{ {
id: printerSetup
Layout.fillHeight: true Layout.fillHeight: true
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredWidth: itemRow.width - machineSelection.width - printSetupSelectorItem.width - 2 * UM.Theme.getSize("default_lining").width Layout.preferredWidth: itemRow.width - machineSelection.width - printSetupSelectorItem.width - 2 * UM.Theme.getSize("default_lining").width
@ -82,72 +83,52 @@ Item
} }
} }
Loader Button
{
id: loader
sourceComponent: UM.Preferences.getValue("cura/show_list_of_files") ? objectSelector : openFileButton
}
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 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 height: UM.Theme.getSize("stage_menu").height
width: UM.Theme.getSize("stage_menu").height width: UM.Theme.getSize("stage_menu").height
onClicked: Cura.Actions.open.trigger()
hoverEnabled: true
contentItem: Item radius: UM.Theme.getSize("default_radius").width
{ color: openFileButton.hovered ? UM.Theme.getColor("action_button_hovered") : UM.Theme.getColor("action_button")
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 DropShadow
} {
} id: shadow
// Don't blur the shadow
background: Rectangle radius: 0
{ anchors.fill: background
id: background source: background
height: UM.Theme.getSize("stage_menu").height verticalOffset: 2
width: UM.Theme.getSize("stage_menu").height visible: true
color: UM.Theme.getColor("action_button_shadow")
radius: UM.Theme.getSize("default_radius").width // Should always be drawn behind the background.
color: openFileButton.hovered ? UM.Theme.getColor("action_button_hovered") : UM.Theme.getColor("action_button") z: background.z - 1
}
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

@ -209,15 +209,17 @@ UM.MainWindow
visible: CuraApplication.platformActivity && !PrintInformation.preSliced visible: CuraApplication.platformActivity && !PrintInformation.preSliced
} }
ObjectsList ObjectSelector
{ {
id: objectsList id: objectSelector
visible: UM.Preferences.getValue("cura/use_multi_build_plate") visible: CuraApplication.platformActivity
anchors anchors
{ {
bottom: viewOrientationControls.top bottom: jobSpecs.top
left: toolbar.right left: toolbar.right
margins: UM.Theme.getSize("default_margin").width leftMargin: UM.Theme.getSize("default_margin").width
rightMargin: UM.Theme.getSize("default_margin").width
bottomMargin: UM.Theme.getSize("thin_margin").width
} }
} }
@ -227,10 +229,12 @@ UM.MainWindow
visible: CuraApplication.platformActivity visible: CuraApplication.platformActivity
anchors anchors
{ {
left: parent.left left: toolbar.right
bottom: viewOrientationControls.top bottom: viewOrientationControls.top
margins: UM.Theme.getSize("default_margin").width leftMargin: UM.Theme.getSize("default_margin").width
rightMargin: UM.Theme.getSize("default_margin").width
bottomMargin: UM.Theme.getSize("thin_margin").width bottomMargin: UM.Theme.getSize("thin_margin").width
topMargin: UM.Theme.getSize("thin_margin").width
} }
} }
@ -240,7 +244,7 @@ UM.MainWindow
anchors anchors
{ {
left: parent.left left: toolbar.right
bottom: parent.bottom bottom: parent.bottom
margins: UM.Theme.getSize("default_margin").width margins: UM.Theme.getSize("default_margin").width
} }

View file

@ -13,8 +13,8 @@ Button
width: parent.width width: parent.width
height: UM.Theme.getSize("action_button").height height: UM.Theme.getSize("action_button").height
leftPadding: UM.Theme.getSize("thick_margin").width leftPadding: UM.Theme.getSize("thin_margin").width
rightPadding: UM.Theme.getSize("thick_margin").width rightPadding: UM.Theme.getSize("thin_margin").width
checkable: true checkable: true
hoverEnabled: true hoverEnabled: true
@ -29,12 +29,12 @@ Button
anchors anchors
{ {
left: parent.left left: parent.left
right: printerTypes.left right: parent.right
verticalCenter: parent.verticalCenter verticalCenter: parent.verticalCenter
} }
text: objectItemButton.text text: objectItemButton.text
color: UM.Theme.getColor("text") font: UM.Theme.getFont("default")
font: UM.Theme.getFont("medium") color: UM.Theme.getColor("text_scene")
visible: text != "" visible: text != ""
renderType: Text.NativeRendering renderType: Text.NativeRendering
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter

View file

@ -7,34 +7,51 @@ import QtQuick.Controls 2.3
import UM 1.2 as UM import UM 1.2 as UM
import Cura 1.0 as Cura import Cura 1.0 as Cura
Cura.ExpandableComponent Item
{ {
id: base id: objectSelector
width: UM.Theme.getSize("objects_menu_size").width
// height: childrenRect.height
property bool opened: UM.Preferences.getValue("cura/show_list_of_files")
headerCornerSide: Cura.RoundedRectangle.Direction.All Button
contentAlignment: Cura.ExpandablePopup.ContentAlignment.AlignLeft
contentHeaderTitle: catalog.i18nc("@label", "Object list")
headerItem: Item
{ {
anchors.fill: parent id: openCloseButton
UM.RecolorImage width: UM.Theme.getSize("standard_arrow").width
{ height: UM.Theme.getSize("standard_arrow").height
id: buttonIcon hoverEnabled: true
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 anchors
{
bottom: contents.top
horizontalCenter: parent.horizontalCenter
}
contentItem: UM.RecolorImage
{
anchors.fill: parent
sourceSize.width: width
color: openCloseButton.hovered ? UM.Theme.getColor("small_button_text_hover") : UM.Theme.getColor("small_button_text")
source: objectSelector.opened ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_top")
}
background: Item {}
onClicked:
{
UM.Preferences.setValue("cura/show_list_of_files", !objectSelector.opened)
objectSelector.opened = UM.Preferences.getValue("cura/show_list_of_files")
} }
} }
contentItem: Item Item
{ {
id: popup id: contents
width: UM.Theme.getSize("machine_selector_widget_content").width width: parent.width
visible: objectSelector.opened
height: visible ? scroll.height : 0
anchors.bottom: parent.bottom
ScrollView ScrollView
{ {
@ -44,25 +61,23 @@ Cura.ExpandableComponent
leftPadding: UM.Theme.getSize("default_lining").width leftPadding: UM.Theme.getSize("default_lining").width
rightPadding: UM.Theme.getSize("default_lining").width rightPadding: UM.Theme.getSize("default_lining").width
ListView contentItem: ListView
{ {
id: listView id: listView
// Can't use parent.width since the parent is the flickable component and not the ScrollView // Can't use parent.width since the parent is the flickable component and not the ScrollView
width: scroll.width - scroll.leftPadding - scroll.rightPadding width: scroll.width - scroll.leftPadding - scroll.rightPadding
property real maximumHeight: UM.Theme.getSize("machine_selector_widget_content").height - buttonRow.height property real maximumHeight: UM.Theme.getSize("objects_menu_size").height
// We use an extra property here, since we only want to to be informed about the content size changes. // We use an extra property here, since we only want to to be informed about the content size changes.
onContentHeightChanged: onContentHeightChanged:
{ {
scroll.height = Math.min(contentHeight, maximumHeight) scroll.height = Math.min(contentHeight, maximumHeight)
popup.height = scroll.height + buttonRow.height
} }
Component.onCompleted: Component.onCompleted:
{ {
scroll.height = Math.min(contentHeight, maximumHeight) scroll.height = Math.min(contentHeight, maximumHeight)
popup.height = scroll.height + buttonRow.height
} }
model: Cura.ObjectsModel {} model: Cura.ObjectsModel {}
@ -75,34 +90,5 @@ Cura.ExpandableComponent
} }
} }
} }
Rectangle
{
id: separator
anchors.top: scroll.bottom
width: parent.width
height: UM.Theme.getSize("default_lining").height
color: UM.Theme.getColor("lining")
}
Row
{
id: buttonRow
// The separator is inside the buttonRow. This is to avoid some weird behaviours with the scroll bar.
anchors.top: separator.top
anchors.horizontalCenter: parent.horizontalCenter
padding: UM.Theme.getSize("default_margin").width
spacing: UM.Theme.getSize("default_margin").width
Cura.SecondaryButton
{
leftPadding: UM.Theme.getSize("default_margin").width
rightPadding: UM.Theme.getSize("default_margin").width
text: catalog.i18nc("@button", "Add file")
onClicked: Cura.Actions.open.trigger()
}
}
} }
} }

View file

@ -1,262 +0,0 @@
// Copyright (c) 2018 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.2
import QtQuick.Controls 1.1
import QtQuick.Controls.Styles 1.1
import QtQuick.Layouts 1.1
import QtQuick.Dialogs 1.1
import UM 1.3 as UM
import Cura 1.0 as Cura
import "Menus"
Rectangle
{
id: base;
color: UM.Theme.getColor("tool_panel_background")
width: UM.Theme.getSize("objects_menu_size").width
height: {
if (collapsed) {
return UM.Theme.getSize("objects_menu_size_collapsed").height;
} else {
return UM.Theme.getSize("objects_menu_size").height;
}
}
Behavior on height { NumberAnimation { duration: 100 } }
border.width: UM.Theme.getSize("default_lining").width
border.color: UM.Theme.getColor("lining")
property bool collapsed: true
property var multiBuildPlateModel: CuraApplication.getMultiBuildPlateModel()
SystemPalette { id: palette }
Button {
id: collapseButton
anchors.top: parent.top
anchors.topMargin: Math.round(UM.Theme.getSize("default_margin").height + (UM.Theme.getSize("layerview_row").height - UM.Theme.getSize("default_margin").height) / 2)
anchors.right: parent.right
anchors.rightMargin: UM.Theme.getSize("default_margin").width
width: UM.Theme.getSize("standard_arrow").width
height: UM.Theme.getSize("standard_arrow").height
onClicked: collapsed = !collapsed
style: ButtonStyle
{
background: UM.RecolorImage
{
width: control.width
height: control.height
sourceSize.height: width
color: UM.Theme.getColor("setting_control_text")
source: collapsed ? UM.Theme.getIcon("arrow_left") : UM.Theme.getIcon("arrow_bottom")
}
label: Label{ }
}
}
Component {
id: buildPlateDelegate
Rectangle
{
height: childrenRect.height
color: multiBuildPlateModel.getItem(index).buildPlateNumber == multiBuildPlateModel.activeBuildPlate ? palette.highlight : index % 2 ? palette.base : palette.alternateBase
width: parent.width
Label
{
id: buildPlateNameLabel
anchors.left: parent.left
anchors.leftMargin: UM.Theme.getSize("default_margin").width
width: parent.width - 2 * UM.Theme.getSize("default_margin").width - 30
text: multiBuildPlateModel.getItem(index) ? multiBuildPlateModel.getItem(index).name : "";
color: multiBuildPlateModel.activeBuildPlate == index ? palette.highlightedText : palette.text
elide: Text.ElideRight
}
MouseArea
{
anchors.fill: parent;
onClicked:
{
Cura.SceneController.setActiveBuildPlate(index);
}
}
}
}
ScrollView
{
id: buildPlateSelection
frameVisible: true
height: UM.Theme.getSize("build_plate_selection_size").height
width: parent.width - 2 * UM.Theme.getSize("default_margin").height
style: UM.Theme.styles.scrollview
anchors
{
top: collapseButton.bottom;
topMargin: UM.Theme.getSize("default_margin").height;
left: parent.left;
leftMargin: UM.Theme.getSize("default_margin").height;
bottomMargin: UM.Theme.getSize("default_margin").height;
}
Rectangle
{
parent: viewport
anchors.fill: parent
color: palette.light
}
ListView
{
id: buildPlateListView
model: multiBuildPlateModel
width: parent.width
delegate: buildPlateDelegate
}
}
Component {
id: objectDelegate
Rectangle
{
height: childrenRect.height
color: Cura.ObjectsModel.getItem(index).isSelected ? palette.highlight : index % 2 ? palette.base : palette.alternateBase
width: parent.width
Label
{
id: nodeNameLabel
anchors.left: parent.left
anchors.leftMargin: UM.Theme.getSize("default_margin").width
width: parent.width - 2 * UM.Theme.getSize("default_margin").width - 30
text: (index >= 0) && Cura.ObjectsModel.getItem(index) ? Cura.ObjectsModel.getItem(index).name : "";
color: Cura.ObjectsModel.getItem(index).isSelected ? palette.highlightedText : (Cura.ObjectsModel.getItem(index).isOutsideBuildArea ? palette.mid : palette.text)
elide: Text.ElideRight
}
Label
{
id: buildPlateNumberLabel
width: 20
anchors.left: nodeNameLabel.right
anchors.leftMargin: UM.Theme.getSize("default_margin").width
anchors.right: parent.right
text: Cura.ObjectsModel.getItem(index).buildPlateNumber != -1 ? Cura.ObjectsModel.getItem(index).buildPlateNumber + 1 : "";
color: Cura.ObjectsModel.getItem(index).isSelected ? palette.highlightedText : palette.text
elide: Text.ElideRight
}
MouseArea
{
anchors.fill: parent;
onClicked:
{
Cura.SceneController.changeSelection(index);
}
}
}
}
// list all the scene nodes
ScrollView
{
id: objectsList
frameVisible: true
visible: !collapsed
width: parent.width - 2 * UM.Theme.getSize("default_margin").height
anchors
{
top: buildPlateSelection.bottom;
topMargin: UM.Theme.getSize("default_margin").height;
left: parent.left;
leftMargin: UM.Theme.getSize("default_margin").height;
bottom: filterBuildPlateCheckbox.top;
bottomMargin: UM.Theme.getSize("default_margin").height;
}
Rectangle
{
parent: viewport
anchors.fill: parent
color: palette.light
}
ListView
{
id: listview
model: Cura.ObjectsModel
width: parent.width
delegate: objectDelegate
}
}
CheckBox
{
id: filterBuildPlateCheckbox
visible: !collapsed
checked: UM.Preferences.getValue("view/filter_current_build_plate")
onClicked: UM.Preferences.setValue("view/filter_current_build_plate", checked)
text: catalog.i18nc("@option:check","See only current build plate");
style: UM.Theme.styles.checkbox;
anchors
{
left: parent.left;
topMargin: UM.Theme.getSize("default_margin").height;
bottomMargin: UM.Theme.getSize("default_margin").height;
leftMargin: UM.Theme.getSize("default_margin").height;
bottom: arrangeAllBuildPlatesButton.top;
}
}
Button
{
id: arrangeAllBuildPlatesButton;
text: catalog.i18nc("@action:button","Arrange to all build plates");
style: UM.Theme.styles.print_setup_action_button
height: UM.Theme.getSize("objects_menu_button").height;
tooltip: '';
anchors
{
topMargin: UM.Theme.getSize("default_margin").height;
left: parent.left;
leftMargin: UM.Theme.getSize("default_margin").height;
right: parent.right;
rightMargin: UM.Theme.getSize("default_margin").height;
bottom: arrangeBuildPlateButton.top;
bottomMargin: UM.Theme.getSize("default_margin").height;
}
action: Cura.Actions.arrangeAllBuildPlates;
}
Button
{
id: arrangeBuildPlateButton;
text: catalog.i18nc("@action:button","Arrange current build plate");
style: UM.Theme.styles.print_setup_action_button
height: UM.Theme.getSize("objects_menu_button").height;
tooltip: '';
anchors
{
topMargin: UM.Theme.getSize("default_margin").height;
left: parent.left;
leftMargin: UM.Theme.getSize("default_margin").height;
right: parent.right;
rightMargin: UM.Theme.getSize("default_margin").height;
bottom: parent.bottom;
bottomMargin: UM.Theme.getSize("default_margin").height;
}
action: Cura.Actions.arrangeAll;
}
}

View file

@ -101,24 +101,10 @@ UM.PreferencesPage
UM.Preferences.resetPreference("cura/choice_on_open_project") UM.Preferences.resetPreference("cura/choice_on_open_project")
setDefaultOpenProjectOption(UM.Preferences.getValue("cura/choice_on_open_project")) setDefaultOpenProjectOption(UM.Preferences.getValue("cura/choice_on_open_project"))
if (pluginExistsAndEnabled("SliceInfoPlugin")) { UM.Preferences.resetPreference("info/send_slice_info")
UM.Preferences.resetPreference("info/send_slice_info") sendDataCheckbox.checked = boolCheck(UM.Preferences.getValue("info/send_slice_info"))
sendDataCheckbox.checked = boolCheck(UM.Preferences.getValue("info/send_slice_info")) UM.Preferences.resetPreference("info/automatic_update_check")
} checkUpdatesCheckbox.checked = boolCheck(UM.Preferences.getValue("info/automatic_update_check"))
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 ScrollView
@ -130,8 +116,6 @@ UM.PreferencesPage
Column Column
{ {
//: Model used to check if a plugin exists
UM.PluginsModel { id: plugins }
//: Language selection label //: Language selection label
UM.I18nCatalog{id: catalog; name: "cura"} UM.I18nCatalog{id: catalog; name: "cura"}
@ -672,7 +656,6 @@ UM.PreferencesPage
UM.TooltipArea UM.TooltipArea
{ {
visible: pluginExistsAndEnabled("UpdateChecker")
width: childrenRect.width width: childrenRect.width
height: visible ? childrenRect.height : 0 height: visible ? childrenRect.height : 0
text: catalog.i18nc("@info:tooltip","Should Cura check for updates when the program is started?") text: catalog.i18nc("@info:tooltip","Should Cura check for updates when the program is started?")
@ -688,7 +671,6 @@ UM.PreferencesPage
UM.TooltipArea UM.TooltipArea
{ {
visible: pluginExistsAndEnabled("SliceInfoPlugin")
width: childrenRect.width width: childrenRect.width
height: visible ? childrenRect.height : 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.") 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.")
@ -741,21 +723,6 @@ 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 Connections
{ {
target: UM.Preferences target: UM.Preferences

View file

@ -1,7 +1,6 @@
module Cura module Cura
MachineSelector 1.0 MachineSelector.qml MachineSelector 1.0 MachineSelector.qml
objectSelector 1.0 objectSelector.qml
CustomConfigurationSelector 1.0 CustomConfigurationSelector.qml CustomConfigurationSelector 1.0 CustomConfigurationSelector.qml
PrintSetupSelector 1.0 PrintSetupSelector.qml PrintSetupSelector 1.0 PrintSetupSelector.qml
ActionButton 1.0 ActionButton.qml ActionButton 1.0 ActionButton.qml

View file

@ -568,7 +568,7 @@
"jobspecs_line": [2.0, 2.0], "jobspecs_line": [2.0, 2.0],
"objects_menu_size": [20, 40], "objects_menu_size": [18, 18],
"objects_menu_size_collapsed": [20, 17], "objects_menu_size_collapsed": [20, 17],
"build_plate_selection_size": [15, 5], "build_plate_selection_size": [15, 5],
"objects_menu_button": [0.3, 2.7], "objects_menu_button": [0.3, 2.7],