Skip to content

Commit

Permalink
feat: add new button to QML to exclude tag from query
Browse files Browse the repository at this point in the history
  • Loading branch information
Bionus committed Dec 31, 2022
1 parent d575eb4 commit ce074e8
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions src/gui-qml/src/components/TagView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ Item {

width: parent.width
height: 34
spacing: 0

Label {
text: modelData
Expand All @@ -75,20 +76,39 @@ Item {
}

ToolButton {
icon.source: "/images/icons/" + (pageLoader.query.split(' ').indexOf(tag) === -1 ? "add" : "remove") + ".png"
property bool isInQuery: pageLoader.query.split(' ').indexOf(tag) >= 0

icon.source: "/images/icons/" + (!isInQuery ? "add" : "remove") + ".png"
Layout.fillHeight: true
Layout.preferredWidth: 34

onClicked: {
root.closed()
if (pageLoader.query.split(' ').indexOf(tag) === -1) {
if (!isInQuery) {
searchTab.load(pageLoader.query + ' ' + tag)
} else {
searchTab.load(pageLoader.query.split(' ').filter(t => t !== tag).join(' '))
}
}
}

ToolButton {
property bool isInQuery: pageLoader.query.split(' ').indexOf('-' + tag) >= 0

icon.source: "/images/icons/" + (!isInQuery ? "remove" : "add") + ".png"
Layout.fillHeight: true
Layout.preferredWidth: 34

onClicked: {
root.closed()
if (!isInQuery) {
searchTab.load(pageLoader.query + ' -' + tag)
} else {
searchTab.load(pageLoader.query.split(' ').filter(t => t !== '-' + tag).join(' '))
}
}
}

ToolButton {
icon.source: "/images/icons/menu.png"
Layout.fillHeight: true
Expand Down

0 comments on commit ce074e8

Please sign in to comment.