Commit 74b58b62 authored by Fabian Riethmayer's avatar Fabian Riethmayer
Browse files

new search field

parent 29670aec
......@@ -38,6 +38,7 @@ Item {
placeholderText: "Search Artists"
onSearch: {
console.log(term)
rootRow.backend.searchArtist(term)
}
onItemSelected: {
......@@ -45,6 +46,10 @@ Item {
rootRow.backend.artistFilter = eventParams.resourceId
mediaBrowser.activateTab(2)
}
onItemAdded: {
console.log("item add" + eventParams.resourceId);
playlistModel.addToPlaylist(eventParams.mediaUrl, eventParams.display);
}
}
MediaGridBrowser {
......@@ -61,6 +66,10 @@ Item {
rootRow.backend.albumFilter = eventParams.resourceId
mediaBrowser.activateTab(2)
}
onItemAdded: {
console.log("item add" + eventParams.mediaUrl);
playlistModel.addToPlaylist(eventParams.mediaUrl, eventParams.display);
}
}
MediaListBrowser {
......@@ -76,7 +85,8 @@ Item {
mediaBrowser.playRequested(0, eventParams.mediaUrl, eventParams.mediaType)
}
onItemAdded: {
playlistModel.addToPlaylist (mediaUrl, display);
console.log("item add" + eventParams.mediaUrl);
playlistModel.addToPlaylist(eventParams.mediaUrl, eventParams.display);
}
onPlayAll: {
rootRow.backend.addAllSongsToPlaylist(playlistModel);
......
......@@ -54,7 +54,7 @@ PlasmaComponents.Page {
}
// Searchfield
PlasmaComponents.TextField {
/*PlasmaComponents.TextField {
id: search
width: parent.width
height: 30
......@@ -65,6 +65,12 @@ PlasmaComponents.Page {
interval: 2000
onTriggered: page.search(parent.text)
}
}*/
Search {
id: search
onSearch: {
page.search(term)
}
}
GridView {
......@@ -84,23 +90,25 @@ PlasmaComponents.Page {
snapMode: GridView.SnapToRow
highlight: Rectangle {
color: theme.viewBackgroundColor
color: "transparent" //theme.viewBackgroundColor
width: mediaView.cellWidth
height: mediaView.cellHeight
PlasmaCore.FrameSvgItem {
PlasmaComponents.Highlight {
id: hover
anchors {
fill: parent
leftMargin: -margins.left
topMargin: -margins.top
rightMargin: -margins.right
bottomMargin: -margins.bottom
}
imagePath: "widgets/button"
prefix: "hover"
//visible:mediaView.focus || (mediaView.currentItem && mediaView.currentItem.focus) // this does not get updated
}
PlasmaComponents.ToolButton {
id: addToPlaylistButton
iconSource: "list-add"
anchors { right: parent.right; top: parent.top }
visible: !isExpandable && mediaType != "image" && mediaItem.GridView.isCurrentItem
onClicked: {
mediaView.currentItem.itemAdded(mediaView.currentItem.getEventParams())
}
}
}
delegate: MediaGridItemDelegate {
onItemSelected: {
......@@ -123,6 +131,7 @@ PlasmaComponents.Page {
if (event.key == Qt.Key_Up && currentIndex === 0) {
forceFocus(false);
}
// TODO Shortcuts for search
}
onFocusChanged: {
......
......@@ -217,17 +217,6 @@ Rectangle {
onTextChanged: iconImageLoader.checkAndLoad()
}
PlasmaComponents.ToolButton {
id: addToPlaylistButton
iconSource: "list-add"
anchors { right: parent.right; top: parent.top }
visible: !isExpandable && mediaType != "image" && mediaItem.GridView.isCurrentItem
onClicked: {
mediaItem.itemAdded(getEventParams())
}
}
}
Keys.onReturnPressed: {
......
......@@ -44,16 +44,10 @@ PlasmaComponents.Page {
width: parent.width
height: 30
// Searchfield
PlasmaComponents.TextField {
Search {
id: search
width: parent.width - playAllButton.width;
height: parent.height
clearButtonShown: true
onTextChanged: timer.restart()
Timer {
id: timer
interval: 2000
onTriggered: page.search(parent.text)
onSearch: {
page.search(term)
}
}
PlasmaComponents.Button {
......
/***************************************************************************
* Copyright 2012 Shantanu Tushar <shantanu@kde.org> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
***************************************************************************/
import QtQuick 1.1
import org.kde.qtextracomponents 0.1 as QtExtraComponents
import org.kde.plasma.components 0.1 as PlasmaComponents
import org.kde.plasma.core 0.1 as PlasmaCore
Item {
property alias placeholderText: searchField.placeholderText
signal search(string term)
id: search
height: 32
width: 32 + __theme.margin
PlasmaComponents.ToolButton {
id: icon
iconSource: "edit-find"
width: parent.height
height: parent.height
onClicked: {
if (search.state == "active") {
search.state = ""
}
else {
search.state = "active"
searchField.focus = true
}
}
}
// Searchfield
PlasmaComponents.TextField {
id: searchField
anchors {
left: icon.right
right: parent.right
leftMargin: __theme.margin
}
clearButtonShown: true
onTextChanged: timer.restart()
width: 0
Timer {
id: timer
interval: 500
onTriggered: search.search(parent.text)
}
visible: false
}
PlasmaCore.FrameSvgItem {
id: hover
anchors {
fill: searchField
leftMargin: -margins.left
topMargin: -margins.top
rightMargin: -margins.right
bottomMargin: -margins.bottom
}
imagePath: "widgets/button"
prefix: "hover"
//visible:mediaView.focus || (mediaView.currentItem && mediaView.currentItem.focus) // this does not get updated
visible: false
}
states: [
State {
name: "active"
PropertyChanges {
target: search;
//width: parent.width - icon.width - __theme.margin
width: 600
}
PropertyChanges {
visible: true
target: searchField;
//width: parent.width - icon.width - __theme.margin
}
PropertyChanges {
target: hover;
visible: true
}
}
]
Behavior on width {
NumberAnimation {
duration: 500
}
}
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment