Filter bar is now always visible

CURA-3574
This commit is contained in:
Jaime van Kessel 2017-03-27 15:47:30 +02:00
parent f04d1efb8d
commit 88704051d1
2 changed files with 5 additions and 58 deletions

View File

@ -18,23 +18,10 @@ Item
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 Rectangle
{ {
id: filterContainer id: filterContainer
visible: false visible: true
border.width: UM.Theme.getSize("default_lining").width border.width: UM.Theme.getSize("default_lining").width
border.color: border.color:
@ -70,7 +57,7 @@ Item
anchors.right: clearFilterButton.left anchors.right: clearFilterButton.left
anchors.rightMargin: UM.Theme.getSize("default_margin").width anchors.rightMargin: UM.Theme.getSize("default_margin").width
placeholderText: catalog.i18nc("@label:textbox", "Filter...") placeholderText: catalog.i18nc("@label:textbox", "Search...")
style: TextFieldStyle style: TextFieldStyle
{ {

View File

@ -362,7 +362,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: 0.5 * parent.width - (model.showFilterButton ? toggleFilterButton.width : 0) width: 0.5 * parent.width
text: model.text text: model.text
exclusiveGroup: modeMenuGroup; exclusiveGroup: modeMenuGroup;
checkable: true; checkable: true;
@ -418,44 +418,6 @@ 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 && !hideSettings && modesListModel.get(base.currentModeIndex) != undefined && 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: parent.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")
}
}
}
StackView StackView
{ {
id: sidebarContents id: sidebarContents
@ -570,14 +532,12 @@ Rectangle
modesListModel.append({ modesListModel.append({
text: catalog.i18nc("@title:tab", "Recommended"), text: catalog.i18nc("@title:tab", "Recommended"),
tooltipText: catalog.i18nc("@tooltip", "<b>Recommended Print Setup</b><br/><br/>Print with the recommended settings for the selected printer, material and quality."), tooltipText: catalog.i18nc("@tooltip", "<b>Recommended Print Setup</b><br/><br/>Print with the recommended settings for the selected printer, material and quality."),
item: sidebarSimple, item: sidebarSimple
showFilterButton: false
}) })
modesListModel.append({ modesListModel.append({
text: catalog.i18nc("@title:tab", "Custom"), text: catalog.i18nc("@title:tab", "Custom"),
tooltipText: catalog.i18nc("@tooltip", "<b>Custom Print Setup</b><br/><br/>Print with finegrained control over every last bit of the slicing process."), tooltipText: catalog.i18nc("@tooltip", "<b>Custom Print Setup</b><br/><br/>Print with finegrained control over every last bit of the slicing process."),
item: sidebarAdvanced, item: sidebarAdvanced
showFilterButton: true
}) })
sidebarContents.push({ "item": modesListModel.get(base.currentModeIndex).item, "immediate": true }); sidebarContents.push({ "item": modesListModel.get(base.currentModeIndex).item, "immediate": true });