mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 16:39:00 +08:00
Merge branch 'feature_find_settings' of https://github.com/fieldOfView/Cura
This commit is contained in:
commit
9a81a24512
@ -118,6 +118,7 @@ Item {
|
|||||||
elide: Text.ElideMiddle;
|
elide: Text.ElideMiddle;
|
||||||
|
|
||||||
color: UM.Theme.getColor("setting_control_text");
|
color: UM.Theme.getColor("setting_control_text");
|
||||||
|
opacity: (definition.visible) ? 1 : 0.5
|
||||||
// emphasize the setting if it has a value in the user or quality profile
|
// emphasize the setting if it has a value in the user or quality profile
|
||||||
font: base.doQualityUserSettingEmphasis && base.stackLevel != undefined && base.stackLevel <= 1 ? UM.Theme.getFont("default_italic") : UM.Theme.getFont("default")
|
font: base.doQualityUserSettingEmphasis && base.stackLevel != undefined && base.stackLevel <= 1 ? UM.Theme.getFont("default_italic") : UM.Theme.getFont("default")
|
||||||
}
|
}
|
||||||
|
@ -9,30 +9,175 @@ import QtQuick.Layouts 1.1
|
|||||||
import UM 1.2 as UM
|
import UM 1.2 as UM
|
||||||
import Cura 1.0 as Cura
|
import Cura 1.0 as Cura
|
||||||
|
|
||||||
ScrollView
|
Item
|
||||||
{
|
{
|
||||||
id: base;
|
id: base;
|
||||||
|
|
||||||
style: UM.Theme.styles.scrollview;
|
|
||||||
flickableItem.flickableDirection: Flickable.VerticalFlick;
|
|
||||||
|
|
||||||
property Action configureSettings;
|
property Action configureSettings;
|
||||||
|
property bool findingSettings;
|
||||||
signal showTooltip(Item item, point location, string text);
|
signal showTooltip(Item item, point location, string text);
|
||||||
signal hideTooltip();
|
signal hideTooltip();
|
||||||
|
|
||||||
|
function toggleFilterField()
|
||||||
|
{
|
||||||
|
filterContainer.visible = !filterContainer.visible
|
||||||
|
if(filterContainer.visible)
|
||||||
|
{
|
||||||
|
filter.forceActiveFocus();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
filter.text = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle
|
||||||
|
{
|
||||||
|
id: filterContainer
|
||||||
|
visible: false
|
||||||
|
|
||||||
|
border.width: UM.Theme.getSize("default_lining").width
|
||||||
|
border.color:
|
||||||
|
{
|
||||||
|
if(hoverMouseArea.containsMouse || clearFilterButton.containsMouse)
|
||||||
|
{
|
||||||
|
return UM.Theme.getColor("setting_control_border_highlight");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return UM.Theme.getColor("setting_control_border");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
color: UM.Theme.getColor("setting_control")
|
||||||
|
|
||||||
|
anchors
|
||||||
|
{
|
||||||
|
top: parent.top
|
||||||
|
left: parent.left
|
||||||
|
leftMargin: UM.Theme.getSize("default_margin").width
|
||||||
|
right: parent.right
|
||||||
|
rightMargin: UM.Theme.getSize("default_margin").width
|
||||||
|
}
|
||||||
|
height: visible ? UM.Theme.getSize("setting_control").height : 0
|
||||||
|
Behavior on height { NumberAnimation { duration: 100 } }
|
||||||
|
|
||||||
|
TextField
|
||||||
|
{
|
||||||
|
id: filter;
|
||||||
|
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: clearFilterButton.left
|
||||||
|
anchors.rightMargin: UM.Theme.getSize("default_margin").width
|
||||||
|
|
||||||
|
placeholderText: catalog.i18nc("@label:textbox", "Filter...")
|
||||||
|
|
||||||
|
style: TextFieldStyle
|
||||||
|
{
|
||||||
|
textColor: UM.Theme.getColor("setting_control_text");
|
||||||
|
font: UM.Theme.getFont("default");
|
||||||
|
background: Item {}
|
||||||
|
}
|
||||||
|
|
||||||
|
property var expandedCategories
|
||||||
|
property bool lastFindingSettings: false
|
||||||
|
|
||||||
|
onTextChanged:
|
||||||
|
{
|
||||||
|
definitionsModel.filter = {"label": "*" + text};
|
||||||
|
findingSettings = (text.length > 0);
|
||||||
|
if(findingSettings != lastFindingSettings)
|
||||||
|
{
|
||||||
|
if(findingSettings)
|
||||||
|
{
|
||||||
|
expandedCategories = definitionsModel.expanded.slice();
|
||||||
|
definitionsModel.expanded = ["*"];
|
||||||
|
definitionsModel.showAncestors = true;
|
||||||
|
definitionsModel.showAll = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
definitionsModel.expanded = expandedCategories;
|
||||||
|
definitionsModel.showAncestors = false;
|
||||||
|
definitionsModel.showAll = false;
|
||||||
|
}
|
||||||
|
lastFindingSettings = findingSettings;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Keys.onEscapePressed:
|
||||||
|
{
|
||||||
|
filter.text = "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea
|
||||||
|
{
|
||||||
|
id: hoverMouseArea
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
acceptedButtons: Qt.NoButton
|
||||||
|
cursorShape: Qt.IBeamCursor
|
||||||
|
}
|
||||||
|
|
||||||
|
UM.SimpleButton
|
||||||
|
{
|
||||||
|
id: clearFilterButton
|
||||||
|
iconSource: UM.Theme.getIcon("cross1")
|
||||||
|
visible: findingSettings
|
||||||
|
|
||||||
|
height: parent.height * 0.4
|
||||||
|
width: visible ? height : 0
|
||||||
|
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: UM.Theme.getSize("default_margin").width
|
||||||
|
|
||||||
|
color: UM.Theme.getColor("setting_control_button")
|
||||||
|
hoverColor: UM.Theme.getColor("setting_control_button_hover")
|
||||||
|
|
||||||
|
onClicked:
|
||||||
|
{
|
||||||
|
filter.text = "";
|
||||||
|
filter.forceActiveFocus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ScrollView
|
||||||
|
{
|
||||||
|
anchors.top: filterContainer.bottom;
|
||||||
|
anchors.bottom: parent.bottom;
|
||||||
|
anchors.right: parent.right;
|
||||||
|
anchors.left: parent.left;
|
||||||
|
anchors.topMargin: filterContainer.visible ? UM.Theme.getSize("default_margin").width : 0
|
||||||
|
Behavior on anchors.topMargin { NumberAnimation { duration: 100 } }
|
||||||
|
|
||||||
|
style: UM.Theme.styles.scrollview;
|
||||||
|
flickableItem.flickableDirection: Flickable.VerticalFlick;
|
||||||
|
|
||||||
ListView
|
ListView
|
||||||
{
|
{
|
||||||
id: contents
|
id: contents
|
||||||
spacing: UM.Theme.getSize("default_lining").height;
|
spacing: UM.Theme.getSize("default_lining").height;
|
||||||
cacheBuffer: 1000000; // Set a large cache to effectively just cache every list item.
|
cacheBuffer: 1000000; // Set a large cache to effectively just cache every list item.
|
||||||
|
|
||||||
model: UM.SettingDefinitionsModel {
|
model: UM.SettingDefinitionsModel
|
||||||
|
{
|
||||||
id: definitionsModel;
|
id: definitionsModel;
|
||||||
containerId: Cura.MachineManager.activeDefinitionId
|
containerId: Cura.MachineManager.activeDefinitionId
|
||||||
visibilityHandler: UM.SettingPreferenceVisibilityHandler { }
|
visibilityHandler: UM.SettingPreferenceVisibilityHandler { }
|
||||||
exclude: ["machine_settings", "command_line_settings", "infill_mesh", "infill_mesh_order"] // TODO: infill_mesh settigns are excluded hardcoded, but should be based on the fact that settable_globally, settable_per_meshgroup and settable_per_extruder are false.
|
exclude: ["machine_settings", "command_line_settings", "infill_mesh", "infill_mesh_order"] // TODO: infill_mesh settigns are excluded hardcoded, but should be based on the fact that settable_globally, settable_per_meshgroup and settable_per_extruder are false.
|
||||||
expanded: Printer.expandedCategories
|
expanded: Printer.expandedCategories
|
||||||
onExpandedChanged: Printer.setExpandedCategories(expanded)
|
onExpandedChanged:
|
||||||
|
{
|
||||||
|
if(!findingSettings)
|
||||||
|
{
|
||||||
|
// Do not change expandedCategories preference while filtering settings
|
||||||
|
// because all categories are expanded while filtering
|
||||||
|
Printer.setExpandedCategories(expanded)
|
||||||
|
}
|
||||||
|
}
|
||||||
onVisibilityChanged: Cura.SettingInheritanceManager.forceUpdate()
|
onVisibilityChanged: Cura.SettingInheritanceManager.forceUpdate()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -147,6 +292,7 @@ ScrollView
|
|||||||
onContextMenuRequested:
|
onContextMenuRequested:
|
||||||
{
|
{
|
||||||
contextMenu.key = model.key;
|
contextMenu.key = model.key;
|
||||||
|
contextMenu.settingVisible = model.visible;
|
||||||
contextMenu.provider = provider
|
contextMenu.provider = provider
|
||||||
contextMenu.popup();
|
contextMenu.popup();
|
||||||
}
|
}
|
||||||
@ -194,6 +340,7 @@ ScrollView
|
|||||||
|
|
||||||
property string key
|
property string key
|
||||||
property var provider
|
property var provider
|
||||||
|
property bool settingVisible
|
||||||
|
|
||||||
MenuItem
|
MenuItem
|
||||||
{
|
{
|
||||||
@ -212,10 +359,38 @@ ScrollView
|
|||||||
MenuItem
|
MenuItem
|
||||||
{
|
{
|
||||||
//: Settings context menu action
|
//: Settings context menu action
|
||||||
|
visible: !findingSettings;
|
||||||
text: catalog.i18nc("@action:menu", "Hide this setting");
|
text: catalog.i18nc("@action:menu", "Hide this setting");
|
||||||
onTriggered: definitionsModel.hide(contextMenu.key);
|
onTriggered: definitionsModel.hide(contextMenu.key);
|
||||||
}
|
}
|
||||||
MenuItem
|
MenuItem
|
||||||
|
{
|
||||||
|
//: Settings context menu action
|
||||||
|
text:
|
||||||
|
{
|
||||||
|
if (contextMenu.settingVisible)
|
||||||
|
{
|
||||||
|
return catalog.i18nc("@action:menu", "Don't show this setting");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return catalog.i18nc("@action:menu", "Keep this setting visible");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
visible: findingSettings;
|
||||||
|
onTriggered:
|
||||||
|
{
|
||||||
|
if (contextMenu.settingVisible)
|
||||||
|
{
|
||||||
|
definitionsModel.hide(contextMenu.key);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
definitionsModel.show(contextMenu.key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
MenuItem
|
||||||
{
|
{
|
||||||
//: Settings context menu action
|
//: Settings context menu action
|
||||||
text: catalog.i18nc("@action:menu", "Configure setting visiblity...");
|
text: catalog.i18nc("@action:menu", "Configure setting visiblity...");
|
||||||
@ -234,4 +409,5 @@ ScrollView
|
|||||||
storeIndex: 0
|
storeIndex: 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -214,7 +214,7 @@ Rectangle
|
|||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.leftMargin: model.index * (settingsModeSelection.width / 2)
|
anchors.leftMargin: model.index * (settingsModeSelection.width / 2)
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
width: parent.width / 2
|
width: 0.5 * parent.width - (model.showFilterButton ? toggleFilterButton.width : 0)
|
||||||
text: model.text
|
text: model.text
|
||||||
exclusiveGroup: modeMenuGroup;
|
exclusiveGroup: modeMenuGroup;
|
||||||
checkable: true;
|
checkable: true;
|
||||||
@ -256,6 +256,44 @@ Rectangle
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Button
|
||||||
|
{
|
||||||
|
id: toggleFilterButton
|
||||||
|
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: UM.Theme.getSize("default_margin").width
|
||||||
|
anchors.top: headerSeparator.bottom
|
||||||
|
anchors.topMargin: UM.Theme.getSize("default_margin").height
|
||||||
|
|
||||||
|
height: settingsModeSelection.height
|
||||||
|
width: visible ? height : 0
|
||||||
|
|
||||||
|
visible: !monitoringPrint && modesListModel.get(base.currentModeIndex).showFilterButton
|
||||||
|
opacity: visible ? 1 : 0
|
||||||
|
|
||||||
|
onClicked: sidebarContents.currentItem.toggleFilterField()
|
||||||
|
|
||||||
|
style: ButtonStyle
|
||||||
|
{
|
||||||
|
background: Rectangle
|
||||||
|
{
|
||||||
|
border.width: UM.Theme.getSize("default_lining").width
|
||||||
|
border.color: UM.Theme.getColor("toggle_checked_border")
|
||||||
|
color: visible ? UM.Theme.getColor("toggle_checked") : UM.Theme.getColor("toggle_hovered")
|
||||||
|
Behavior on color { ColorAnimation { duration: 50; } }
|
||||||
|
}
|
||||||
|
label: UM.RecolorImage
|
||||||
|
{
|
||||||
|
anchors.verticalCenter: control.verticalCenter
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.rightMargin: UM.Theme.getSize("default_margin").width / 2
|
||||||
|
|
||||||
|
source: UM.Theme.getIcon("search")
|
||||||
|
color: UM.Theme.getColor("toggle_checked_text")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
id: monitorLabel
|
id: monitorLabel
|
||||||
text: catalog.i18nc("@label","Printer Monitor");
|
text: catalog.i18nc("@label","Printer Monitor");
|
||||||
@ -379,8 +417,8 @@ Rectangle
|
|||||||
|
|
||||||
Component.onCompleted:
|
Component.onCompleted:
|
||||||
{
|
{
|
||||||
modesListModel.append({ text: catalog.i18nc("@title:tab", "Recommended"), item: sidebarSimple })
|
modesListModel.append({ text: catalog.i18nc("@title:tab", "Recommended"), item: sidebarSimple, showFilterButton: false })
|
||||||
modesListModel.append({ text: catalog.i18nc("@title:tab", "Custom"), item: sidebarAdvanced })
|
modesListModel.append({ text: catalog.i18nc("@title:tab", "Custom"), item: sidebarAdvanced, showFilterButton: true })
|
||||||
sidebarContents.push({ "item": modesListModel.get(base.currentModeIndex).item, "immediate": true });
|
sidebarContents.push({ "item": modesListModel.get(base.currentModeIndex).item, "immediate": true });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
4
resources/themes/cura/icons/search.svg
Normal file
4
resources/themes/cura/icons/search.svg
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 30">
|
||||||
|
<path
|
||||||
|
d="m 20.769231,12.692308 q 0,-3.3353368 -2.370794,-5.7061301 -2.370793,-2.3707933 -5.706129,-2.3707933 -3.335337,0 -5.70613,2.3707933 -2.370793,2.3707933 -2.370793,5.7061301 0,3.335336 2.370793,5.706129 2.370793,2.370794 5.70613,2.370794 3.335336,0 5.706129,-2.370794 2.370794,-2.370793 2.370794,-5.706129 z m 9.230769,15 q 0,0.9375 -0.685096,1.622596 Q 28.629808,30 27.692308,30 26.71875,30 26.069712,29.314904 l -6.183895,-6.165866 q -3.227163,2.235577 -7.193509,2.235577 -2.578125,0 -4.93089,-1.000601 Q 5.408654,23.383413 3.704928,21.679687 2.001202,19.975962 1.000601,17.623197 0,15.270433 0,12.692308 0,10.114183 1.000601,7.7614183 2.001202,5.4086538 3.704928,3.7049279 5.408654,2.0012019 7.761418,1.000601 10.114183,0 12.692308,0 q 2.578125,0 4.930889,1.000601 2.352765,1.0006009 4.05649,2.7043269 1.703726,1.7037259 2.704327,4.0564904 1.000601,2.3527647 1.000601,4.9308897 0,3.966346 -2.235577,7.193509 l 6.183895,6.183895 Q 30,26.736779 30,27.692308 Z" />
|
||||||
|
</svg>
|
After Width: | Height: | Size: 1.0 KiB |
Loading…
x
Reference in New Issue
Block a user