Warning, /multimedia/audiotube/src/contents/ui/SearchHistoryPage.qml is written in an unsupported language. File is not indexed.

0001 // SPDX-FileCopyrightText: Mathis BrĂ¼chert <mbb@kaidan.im>
0002 //
0003 // SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0004 
0005 import org.kde.kirigami 2.12 as Kirigami
0006 import QtQuick.Controls 2.15 as Controls
0007 
0008 import QtQuick 2.15
0009 import QtQuick.Layouts 1.15
0010 
0011 import org.kde.ytmusic 1.0
0012 
0013 Kirigami.ScrollablePage {
0014     objectName: "searchPage"
0015 
0016     topPadding: 0
0017     bottomPadding: 0
0018     leftPadding: 0
0019     rightPadding: 0
0020 
0021     Kirigami.Theme.colorSet: Kirigami.Theme.View
0022 
0023     ColumnLayout {
0024         Controls.ScrollView {
0025             Layout.fillWidth: true
0026 
0027             id: recents
0028             visible: searchLoader.text && recentsRepeater.count > 0
0029             leftPadding: 10
0030             topPadding: 10
0031             Controls.ScrollBar.horizontal.policy: Controls.ScrollBar.AlwaysOff
0032 
0033             RowLayout {
0034                 id: recentsLayout
0035                 spacing: 10
0036                 Layout.fillWidth: true
0037 
0038                 Repeater {
0039                     id: recentsRepeater
0040                     Layout.fillWidth: true
0041                     model: LocalSearchModel {
0042                         searchQuery: searchLoader.text
0043                     }
0044 
0045                     delegate: searchAlbum
0046                 }
0047             }
0048         }
0049 
0050         Kirigami.Separator {
0051             Layout.fillWidth: true
0052             visible: recents.visible
0053         }
0054 
0055         id: completionList
0056 
0057         Repeater {
0058             Layout.fillHeight: true
0059             Layout.fillWidth: true
0060             model: Library.searches
0061 
0062             delegate: Controls.ItemDelegate {
0063                 implicitHeight: Kirigami.Units.gridUnit * 2
0064                 Layout.fillWidth: true
0065 
0066                 required property string searchQuery
0067 
0068                 contentItem: RowLayout {
0069                     Kirigami.Icon {
0070                         source: "search"
0071                         implicitHeight: Kirigami.Units.gridUnit
0072                         implicitWidth: Kirigami.Units.gridUnit
0073                         color: Kirigami.Theme.disabledTextColor
0074                     }
0075                     Controls.Label {
0076                         text: searchQuery
0077                         Layout.fillWidth: true
0078                         elide: Text.ElideRight
0079                     }
0080                     Controls.ToolButton {
0081                         icon.name: "list-remove"
0082                         text: i18n("remove from search history")
0083                         display: Controls.AbstractButton.IconOnly
0084                         onClicked: {
0085                             Library.removeSearch(model.display)
0086                         }
0087                     }
0088 
0089                 }
0090                 onClicked: {
0091                     searchLoader.text = searchQuery
0092                     searchLoader.accepted()
0093                 }
0094             }
0095         }
0096     }
0097 }