1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-09-02 18:33:16 +02:00

hooked up the setuppage and smaller cleanups

This commit is contained in:
Michael Zanetti
2012-11-25 20:02:19 +01:00
parent 014f598dd2
commit b20c81a071
4 changed files with 62 additions and 49 deletions

View File

@@ -34,64 +34,64 @@ PathView {
width: root.coverSize
scale: PathView.itemScale
// itemBrightness: PathView.itemBrightness - ((coverView.itemHovered && !coverDelegate.containsMouse) ? .4 : 0)
// itemBrightness: PathView.itemBrightness - ((coverView.itemHovered && !coverDelegate.containsMouse) ? .4 : 0)
property double itemBrightness: PathView.itemBrightness
property double itemOpacity: PathView.itemOpacity
property int _origZ
z: coverView.width - x
CoverImage {
id: coverDelegate
height: root.coverSize
width: root.coverSize
anchors {
top: parent.top
right: parent.right
}
backgroundColor: coverView.backgroundColor
showLabels: true
showMirror: true
artistName: model.artistName
trackName: model.trackName
artworkId: model.coverID
showPlayButton: true
currentlyPlaying: isPlaying
// itemBrightness: PathView.itemBrightness - ((coverView.itemHovered && !coverDelegate.containsMouse) ? .4 : 0)
itemBrightness: coverDelegate.containsMouse ? 1 : parent.itemBrightness * (coverView.itemHovered ? .5 : 1)
opacity: parent.itemOpacity
z: coverView.width - x
property int _origZ
onPlayClicked: {
console.log("***************")
coverView.itemPlayPauseClicked(index)
}
onClicked: {
coverView.itemClicked(index)
}
onContainsMouseChanged: {
if (containsMouse) {
_origZ = z;
coverView.itemHovered = true
} else {
coverView.itemHovered = false
id: coverDelegate
height: root.coverSize
width: root.coverSize
anchors {
top: parent.top
right: parent.right
}
backgroundColor: coverView.backgroundColor
showLabels: true
showMirror: true
artistName: model.artistName
trackName: model.trackName
artworkId: model.coverID
showPlayButton: true
currentlyPlaying: isPlaying
// itemBrightness: PathView.itemBrightness - ((coverView.itemHovered && !coverDelegate.containsMouse) ? .4 : 0)
itemBrightness: coverDelegate.containsMouse ? 1 : parent.itemBrightness * (coverView.itemHovered ? .5 : 1)
opacity: parent.itemOpacity
z: coverView.width - x
onPlayClicked: {
console.log("***************")
coverView.itemPlayPauseClicked(index)
}
onClicked: {
coverView.itemClicked(index)
}
onContainsMouseChanged: {
if (containsMouse) {
delegateItem._origZ = delegateItem.z;
coverView.itemHovered = true
} else {
coverView.itemHovered = false
}
}
}
}
states: [
State {
name: "hovered"; when: coverDelegate.containsMouse && !coverView.moving && index !== currentIndex
PropertyChanges {
target: delegateItem
width: root.coverSize * 2
z: _origZ
z: coverDelegate._origZ
}
}
]

View File

@@ -103,6 +103,10 @@ Rectangle {
InputField {
anchors.centerIn: parent
width: parent.width
onAccepted: {
rootView.startStationFromArtist(text)
stationListView.incrementCurrentIndex();
}
}
}
@@ -116,7 +120,7 @@ Rectangle {
opacity: echonestStation.configured ? 0 : 1
onTagClicked: {
echonestStation.setMainControl( EchonestStation.StationTypeStyle, item );
rootView.startStationFromGenre(item)
stationListView.incrementCurrentIndex();
}
@@ -140,6 +144,10 @@ Rectangle {
InputField {
anchors.centerIn: parent
width: parent.width
onAccepted: {
rootView.startStationFromGenre(text)
stationListView.incrementCurrentIndex();
}
}
}
}

View File

@@ -128,9 +128,13 @@ void DynamicQmlWidget::pause()
void DynamicQmlWidget::startStationFromArtist(const QString &artist)
{
tDebug() << "should start startion from artist" << artist;
// m_playlist->generator()->startFromArtist(Artist::get(artist));
m_playlist->generator()->startFromGenre( "rock" );
m_playlist->generator()->startFromArtist(Artist::get(artist));
}
void DynamicQmlWidget::startStationFromGenre(const QString &genre)
{
tDebug() << "should start startion from genre" << genre;
m_playlist->generator()->startFromGenre( genre );
}
void DynamicQmlWidget::currentIndexChanged( const QPersistentModelIndex &currentIndex )

View File

@@ -61,6 +61,7 @@ public slots:
void playItem(int index);
void pause();
void startStationFromArtist(const QString &artist);
void startStationFromGenre(const QString &genre);
private slots:
void currentIndexChanged( const QPersistentModelIndex &currentIndex );