Add dropdown to per object settings for quick access to mesh types

(not yet functional)
This commit is contained in:
fieldOfView 2017-11-09 17:15:56 +01:00
parent 3251e5915b
commit 7bf40ef82b

View file

@ -26,17 +26,62 @@ Item {
spacing: UM.Theme.getSize("default_margin").height spacing: UM.Theme.getSize("default_margin").height
Row
{
spacing: UM.Theme.getSize("default_margin").width
Label
{
text: catalog.i18nc("@label","Mesh Type")
font: UM.Theme.getFont("default")
color: UM.Theme.getColor("text")
height: UM.Theme.getSize("setting").height
verticalAlignment: Text.AlignVCenter
}
ComboBox
{
id: meshTypeSelection
style: UM.Theme.styles.combobox
model: ListModel
{
id: meshTypeModel
Component.onCompleted:
{
meshTypeModel.append({
type: "",
text: catalog.i18nc("@label", "Normal model")
});
meshTypeModel.append({
type: "support_mesh",
text: catalog.i18nc("@label", "Print as support")
});
meshTypeModel.append({
type: "anti_overhang_mesh",
text: catalog.i18nc("@label", "Remove support for overlap with other models")
});
meshTypeModel.append({
type: "cutting_mesh",
text: catalog.i18nc("@label", "Modify extruder or settings for overlap with other models")
});
}
}
}
}
Column Column
{ {
// This is to ensure that the panel is first increasing in size up to 200 and then shows a scrollbar. // This is to ensure that the panel is first increasing in size up to 200 and then shows a scrollbar.
// It kinda looks ugly otherwise (big panel, no content on it) // It kinda looks ugly otherwise (big panel, no content on it)
id: currentSettings
property int maximumHeight: 200 * screenScaleFactor property int maximumHeight: 200 * screenScaleFactor
height: Math.min(contents.count * (UM.Theme.getSize("section").height + UM.Theme.getSize("default_lining").height), maximumHeight) height: Math.min(contents.count * (UM.Theme.getSize("section").height + UM.Theme.getSize("default_lining").height), maximumHeight)
visible: ["support_mesh", "anti_overhang_mesh"].indexOf(meshTypeSelection.model.get(meshTypeSelection.currentIndex).type) == -1
ScrollView ScrollView
{ {
height: parent.height height: parent.height
width: UM.Theme.getSize("setting").width + UM.Theme.getSize("setting").height width: UM.Theme.getSize("setting").width
style: UM.Theme.styles.scrollview style: UM.Theme.styles.scrollview
ListView ListView
@ -58,6 +103,7 @@ Item {
delegate: Row delegate: Row
{ {
spacing: - UM.Theme.getSize("default_margin").width
Loader Loader
{ {
id: settingLoader id: settingLoader
@ -112,7 +158,7 @@ Item {
Button Button
{ {
width: (UM.Theme.getSize("setting").height / 2) | 0 width: Math.floor(UM.Theme.getSize("setting").height / 2)
height: UM.Theme.getSize("setting").height height: UM.Theme.getSize("setting").height
onClicked: addedSettingsModel.setVisible(model.key, false) onClicked: addedSettingsModel.setVisible(model.key, false)
@ -125,7 +171,7 @@ Item {
{ {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
width: parent.width width: parent.width
height: parent.height / 2 height: width
sourceSize.width: width sourceSize.width: width
sourceSize.height: width sourceSize.height: width
color: control.hovered ? UM.Theme.getColor("setting_control_button_hover") : UM.Theme.getColor("setting_control_button") color: control.hovered ? UM.Theme.getColor("setting_control_button_hover") : UM.Theme.getColor("setting_control_button")
@ -201,9 +247,9 @@ Item {
Button Button
{ {
id: customise_settings_button; id: customiseSettingsButton;
height: UM.Theme.getSize("setting").height; height: UM.Theme.getSize("setting_control").height;
visible: parseInt(UM.Preferences.getValue("cura/active_mode")) == 1 visible: currentSettings.visible
text: catalog.i18nc("@action:button", "Select settings"); text: catalog.i18nc("@action:button", "Select settings");
@ -223,21 +269,12 @@ Item {
{ {
text: control.text; text: control.text;
color: UM.Theme.getColor("setting_control_text"); color: UM.Theme.getColor("setting_control_text");
font: UM.Theme.getFont("default")
anchors.centerIn: parent anchors.centerIn: parent
} }
} }
onClicked: settingPickDialog.visible = true; onClicked: settingPickDialog.visible = true;
Connections
{
target: UM.Preferences;
onPreferenceChanged:
{
customise_settings_button.visible = parseInt(UM.Preferences.getValue("cura/active_mode"))
}
}
} }
} }
@ -325,7 +362,7 @@ Item {
} }
visibilityHandler: UM.SettingPreferenceVisibilityHandler {} visibilityHandler: UM.SettingPreferenceVisibilityHandler {}
expanded: [ "*" ] expanded: [ "*" ]
exclude: [ "machine_settings", "command_line_settings" ] exclude: [ "machine_settings", "command_line_settings", "support_mesh", "anti_overhang_mesh", "cutting_mesh", "infill_mesh" ]
} }
delegate:Loader delegate:Loader
{ {