diff --git a/data/images/star-hover.png b/data/images/star-hover.png
new file mode 100644
index 000000000..89efe2aef
Binary files /dev/null and b/data/images/star-hover.png differ
diff --git a/data/images/star-unstarred.png b/data/images/star-unstarred.png
new file mode 100644
index 000000000..75dc2b798
Binary files /dev/null and b/data/images/star-unstarred.png differ
diff --git a/data/images/starred.png b/data/images/starred.png
new file mode 100644
index 000000000..a93e9f6da
Binary files /dev/null and b/data/images/starred.png differ
diff --git a/data/images/supercollection.png b/data/images/supercollection.png
index 6c6f192d9..cefead535 100644
Binary files a/data/images/supercollection.png and b/data/images/supercollection.png differ
diff --git a/resources.qrc b/resources.qrc
index f994d9456..02ee5f9ab 100644
--- a/resources.qrc
+++ b/resources.qrc
@@ -92,6 +92,9 @@
data/images/artist-icon.png
data/images/album-icon.png
data/images/search-icon.png
+ data/images/star-hover.png
+ data/images/starred.png
+ data/images/star-unstarred.png
data/images/track-icon-22x22.png
data/images/track-icon-32x32.png
data/images/track-icon-16x16.png
diff --git a/src/GetNewStuffDelegate.cpp b/src/GetNewStuffDelegate.cpp
index 7ae0466f1..5329e0591 100644
--- a/src/GetNewStuffDelegate.cpp
+++ b/src/GetNewStuffDelegate.cpp
@@ -29,6 +29,7 @@
#define PADDING 4
#define PADDING_BETWEEN_STARS 2
+#define STAR_SIZE 12
#ifdef Q_WS_MAC
#define SIZEHINT_HEIGHT 70
@@ -41,11 +42,14 @@ GetNewStuffDelegate::GetNewStuffDelegate( QObject* parent )
, m_widestTextWidth( 0 )
{
m_defaultCover.load( RESPATH "images/sipplugin-online.png" );
- m_ratingStarPositive.load( RESPATH "images/loved.png" );
- m_ratingStarNegative.load( RESPATH "images/not-loved.png" );
+ m_ratingStarPositive.load( RESPATH "images/starred.png" );
+ m_ratingStarNegative.load( RESPATH "images/star-unstarred.png" );
+ m_onHoverStar.load( RESPATH "images/star-hover.png" );
+
+ m_ratingStarPositive = m_ratingStarPositive.scaled( STAR_SIZE, STAR_SIZE, Qt::KeepAspectRatio, Qt::SmoothTransformation );
+ m_ratingStarNegative = m_ratingStarNegative.scaled( STAR_SIZE, STAR_SIZE, Qt::KeepAspectRatio, Qt::SmoothTransformation );
+ m_onHoverStar = m_onHoverStar.scaled( STAR_SIZE, STAR_SIZE, Qt::KeepAspectRatio, Qt::SmoothTransformation );
- m_ratingStarPositive = m_ratingStarPositive.scaled( 8, 8, Qt::KeepAspectRatio, Qt::SmoothTransformation );
- m_ratingStarNegative = m_ratingStarNegative.scaled( 8, 8, Qt::KeepAspectRatio, Qt::SmoothTransformation );
const int w = SIZEHINT_HEIGHT - 2*PADDING;
m_defaultCover = m_defaultCover.scaled( w, w, Qt::KeepAspectRatio, Qt::SmoothTransformation );
@@ -175,6 +179,7 @@ GetNewStuffDelegate::paint( QPainter* painter, const QStyleOptionViewItem& optio
painter->drawText( btnRect, Qt::AlignCenter, actionText );
painter->setPen( saved );
+
// rating stars
int rating = index.data( GetNewStuffModel::RatingRole ).toInt();
const int ratingWidth = 5 * ( m_ratingStarPositive.width() + PADDING_BETWEEN_STARS );
@@ -185,10 +190,21 @@ GetNewStuffDelegate::paint( QPainter* painter, const QStyleOptionViewItem& optio
if ( i == 1 )
m_cachedStarRects[ QPair(index.row(), index.column()) ] = r;
- if ( i <= rating ) // positive star
- painter->drawPixmap( r, m_ratingStarPositive );
+ QPixmap pm;
+ if ( m_hoveringOver > -1 )
+ {
+ if ( i <= m_hoveringOver ) // positive star
+ painter->drawPixmap( r, m_onHoverStar );
+ else
+ painter->drawPixmap( r, m_ratingStarNegative );
+ }
else
- painter->drawPixmap( r, m_ratingStarNegative );
+ {
+ if ( i <= rating ) // positive star
+ painter->drawPixmap( r, m_ratingStarPositive );
+ else
+ painter->drawPixmap( r, m_ratingStarNegative );
+ }
runningEdge += m_ratingStarPositive.width() + PADDING_BETWEEN_STARS;
}
@@ -242,10 +258,13 @@ bool
GetNewStuffDelegate::editorEvent( QEvent* event, QAbstractItemModel* model, const QStyleOptionViewItem& option, const QModelIndex& index )
{
Q_UNUSED( option );
- if ( event->type() != QEvent::MouseButtonRelease )
+ m_hoveringOver = -1;
+
+ if ( event->type() != QEvent::MouseButtonRelease &&
+ event->type() != QEvent::MouseMove )
return false;
- if ( m_cachedButtonRects.contains( QPair( index.row(), index.column() ) ) )
+ if ( event->type() == QEvent::MouseButtonRelease && m_cachedButtonRects.contains( QPair( index.row(), index.column() ) ) )
{
QRect rect = m_cachedButtonRects[ QPair( index.row(), index.column() ) ];
QMouseEvent* me = static_cast< QMouseEvent* >( event );
@@ -273,8 +292,17 @@ GetNewStuffDelegate::editorEvent( QEvent* event, QAbstractItemModel* model, cons
const int eachStar = starsWidth / 5;
const int clickOffset = me->pos().x() - fullStars.x();
const int whichStar = (clickOffset / eachStar) + 1;
- tDebug() << "Clicked on:" << whichStar;
- model->setData( index, whichStar, GetNewStuffModel::RatingRole );
+
+ if ( event->type() == QEvent::MouseButtonRelease )
+ {
+ tDebug() << "Clicked on:" << whichStar;
+ model->setData( index, whichStar, GetNewStuffModel::RatingRole );
+ }
+ else if ( event->type() == QEvent::MouseMove )
+ {
+ // 0-indexed
+ m_hoveringOver = whichStar;
+ }
return true;
}
diff --git a/src/GetNewStuffDelegate.h b/src/GetNewStuffDelegate.h
index a1976a8b5..e2b71afaa 100644
--- a/src/GetNewStuffDelegate.h
+++ b/src/GetNewStuffDelegate.h
@@ -35,11 +35,10 @@ protected:
virtual bool editorEvent( QEvent* event, QAbstractItemModel* model, const QStyleOptionViewItem& option, const QModelIndex& index );
private:
- QPixmap m_defaultCover;
- QPixmap m_ratingStarPositive;
- QPixmap m_ratingStarNegative;
+ QPixmap m_defaultCover, m_onHoverStar, m_ratingStarPositive, m_ratingStarNegative;
int m_widestTextWidth;
+ int m_hoveringOver;
mutable QHash< QPair, QRect > m_cachedButtonRects;
mutable QHash< QPair, QRect > m_cachedStarRects;
};
diff --git a/src/GetNewStuffDialog.cpp b/src/GetNewStuffDialog.cpp
index d27604150..a0102c648 100644
--- a/src/GetNewStuffDialog.cpp
+++ b/src/GetNewStuffDialog.cpp
@@ -33,6 +33,8 @@ GetNewStuffDialog::GetNewStuffDialog( QWidget *parent, Qt::WindowFlags f )
ui->listView->setItemDelegate( new GetNewStuffDelegate( ui->listView ) );
ui->listView->setVerticalScrollMode( QAbstractItemView::ScrollPerPixel );
+ ui->listView->setMouseTracking( true );
+
#ifdef Q_WS_MAC
setMinimumSize( 510, 350 );
setMaximumSize( 510, 350 );
diff --git a/src/libtomahawk/playlist/customplaylistview.cpp b/src/libtomahawk/playlist/customplaylistview.cpp
index 625bce3d4..218b6ffb4 100644
--- a/src/libtomahawk/playlist/customplaylistview.cpp
+++ b/src/libtomahawk/playlist/customplaylistview.cpp
@@ -22,7 +22,8 @@
#include "database/databasecommand_genericselect.h"
#include "database/database.h"
#include "utils/tomahawkutils.h"
-#include
+#include "sourcelist.h"
+#include "audio/audioengine.h"
using namespace Tomahawk;
@@ -54,6 +55,19 @@ CustomPlaylistView::CustomPlaylistView( CustomPlaylistView::PlaylistType type, c
CustomPlaylistView::~CustomPlaylistView()
{}
+bool
+CustomPlaylistView::isBeingPlayed() const
+{
+ return AudioEngine::instance()->currentTrackPlaylist() == playlistInterface();
+}
+
+bool
+CustomPlaylistView::jumpToCurrentTrack()
+{
+ return PlaylistView::jumpToCurrentTrack();
+}
+
+
void
CustomPlaylistView::generateTracks()
{
diff --git a/src/libtomahawk/playlist/customplaylistview.h b/src/libtomahawk/playlist/customplaylistview.h
index 0ed8dba21..b7e0b659d 100644
--- a/src/libtomahawk/playlist/customplaylistview.h
+++ b/src/libtomahawk/playlist/customplaylistview.h
@@ -46,7 +46,10 @@ public:
virtual QPixmap pixmap() const;
virtual QString description() const;
virtual QString longDescription() const;
+
virtual bool isTemporaryPage() const { return false; }
+ virtual bool isBeingPlayed() const;
+ virtual bool jumpToCurrentTrack();
private slots:
void tracksGenerated( QList tracks );
diff --git a/src/libtomahawk/viewmanager.cpp b/src/libtomahawk/viewmanager.cpp
index 8822d5602..594abc40f 100644
--- a/src/libtomahawk/viewmanager.cpp
+++ b/src/libtomahawk/viewmanager.cpp
@@ -569,7 +569,6 @@ ViewManager::setPage( ViewPage* page, bool trackHistory )
}
m_stack->setCurrentWidget( page->widget() );
- page->widget()->setFocus();
updateView();
}
diff --git a/src/libtomahawk/viewpage.h b/src/libtomahawk/viewpage.h
index 4cf5f0a61..6e32bcef9 100644
--- a/src/libtomahawk/viewpage.h
+++ b/src/libtomahawk/viewpage.h
@@ -53,6 +53,7 @@ public:
virtual bool jumpToCurrentTrack() = 0;
virtual bool isTemporaryPage() const { return false; }
+ virtual bool isBeingPlayed() const { return false; }
virtual bool canAutoUpdate() const { return false; }
virtual void setAutoUpdate( bool ) {}
diff --git a/src/libtomahawk/widgets/infowidgets/AlbumInfoWidget.cpp b/src/libtomahawk/widgets/infowidgets/AlbumInfoWidget.cpp
index f4250afd6..975e2f605 100644
--- a/src/libtomahawk/widgets/infowidgets/AlbumInfoWidget.cpp
+++ b/src/libtomahawk/widgets/infowidgets/AlbumInfoWidget.cpp
@@ -19,6 +19,7 @@
#include "AlbumInfoWidget.h"
#include "ui_AlbumInfoWidget.h"
+#include "audio/audioengine.h"
#include "viewmanager.h"
#include "database/database.h"
#include "playlist/treemodel.h"
@@ -117,6 +118,18 @@ AlbumInfoWidget::onLoadingFinished()
m_button->show();
}
+bool
+AlbumInfoWidget::isBeingPlayed() const
+{
+ if ( ui->albumsView->playlistInterface() == AudioEngine::instance()->currentTrackPlaylist() )
+ return true;
+
+ if ( ui->tracksView->playlistInterface() == AudioEngine::instance()->currentTrackPlaylist() )
+ return true;
+
+ return false;
+}
+
void
AlbumInfoWidget::load( const album_ptr& album )
diff --git a/src/libtomahawk/widgets/infowidgets/AlbumInfoWidget.h b/src/libtomahawk/widgets/infowidgets/AlbumInfoWidget.h
index ca1bc8130..bb5c521d0 100644
--- a/src/libtomahawk/widgets/infowidgets/AlbumInfoWidget.h
+++ b/src/libtomahawk/widgets/infowidgets/AlbumInfoWidget.h
@@ -75,6 +75,7 @@ public:
virtual bool showStatsBar() const { return false; }
virtual bool jumpToCurrentTrack() { return false; }
+ virtual bool isBeingPlayed() const;
signals:
void longDescriptionChanged( const QString& description );
diff --git a/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.cpp b/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.cpp
index 553d93680..32a32b083 100644
--- a/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.cpp
+++ b/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.cpp
@@ -19,6 +19,7 @@
#include "ArtistInfoWidget.h"
#include "ui_ArtistInfoWidget.h"
+#include "audio/audioengine.h"
#include "viewmanager.h"
#include "playlist/treemodel.h"
#include "playlist/playlistmodel.h"
@@ -125,6 +126,36 @@ ArtistInfoWidget::onLoadingFinished()
m_button->show();
}
+bool
+ArtistInfoWidget::isBeingPlayed() const
+{
+ if ( ui->albums->playlistInterface() == AudioEngine::instance()->currentTrackPlaylist() )
+ return true;
+
+ if ( ui->relatedArtists->playlistInterface() == AudioEngine::instance()->currentTrackPlaylist() )
+ return true;
+
+ if ( ui->topHits->playlistInterface() == AudioEngine::instance()->currentTrackPlaylist() )
+ return true;
+
+ return false;
+}
+
+bool
+ArtistInfoWidget::jumpToCurrentTrack()
+{
+ if ( ui->albums->jumpToCurrentTrack() )
+ return true;
+
+ if ( ui->relatedArtists->jumpToCurrentTrack() )
+ return true;
+
+ if ( ui->topHits->jumpToCurrentTrack() )
+ return true;
+
+ return false;
+}
+
void
ArtistInfoWidget::load( const artist_ptr& artist )
@@ -168,7 +199,8 @@ ArtistInfoWidget::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestD
if ( output.canConvert< QVariantMap >() )
{
- if ( trackInfo["artist"] != m_artist->name() )
+ const QString artist = requestData.input.toString();
+ if ( trackInfo["artist"] != m_artist->name() && artist != m_artist->name() )
{
qDebug() << "Returned info was for:" << trackInfo["artist"] << "- was looking for:" << m_artist->name();
return;
diff --git a/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.h b/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.h
index 1f0a8a1d8..65ef84f29 100644
--- a/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.h
+++ b/src/libtomahawk/widgets/infowidgets/ArtistInfoWidget.h
@@ -76,7 +76,8 @@ public:
virtual bool isTemporaryPage() const { return true; }
virtual bool showStatsBar() const { return false; }
- virtual bool jumpToCurrentTrack() { return false; }
+ virtual bool jumpToCurrentTrack();
+ virtual bool isBeingPlayed() const;
signals:
void longDescriptionChanged( const QString& description );
diff --git a/src/libtomahawk/widgets/welcomewidget.cpp b/src/libtomahawk/widgets/welcomewidget.cpp
index 0e7992967..804d14d16 100644
--- a/src/libtomahawk/widgets/welcomewidget.cpp
+++ b/src/libtomahawk/widgets/welcomewidget.cpp
@@ -1,6 +1,7 @@
/* === This file is part of Tomahawk Player - ===
*
* Copyright 2010-2011, Christian Muehlhaeuser
+ * Copyright 2011, Leo Franchi
*
* Tomahawk is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -98,6 +99,12 @@ WelcomeWidget::~WelcomeWidget()
delete ui;
}
+bool
+WelcomeWidget::isBeingPlayed() const
+{
+ return AudioEngine::instance()->currentTrackPlaylist() == ui->tracksView->playlistInterface();
+}
+
void
WelcomeWidget::updateRecentTracks()
diff --git a/src/libtomahawk/widgets/welcomewidget.h b/src/libtomahawk/widgets/welcomewidget.h
index ccd8985e0..0dc92f040 100644
--- a/src/libtomahawk/widgets/welcomewidget.h
+++ b/src/libtomahawk/widgets/welcomewidget.h
@@ -93,6 +93,7 @@ public:
virtual bool showInfoBar() const { return false; }
virtual bool jumpToCurrentTrack() { return false; }
+ virtual bool isBeingPlayed() const;
protected:
void changeEvent( QEvent* e );
diff --git a/src/libtomahawk/widgets/whatshotwidget.cpp b/src/libtomahawk/widgets/whatshotwidget.cpp
index 3f2fb795c..89a113fa1 100644
--- a/src/libtomahawk/widgets/whatshotwidget.cpp
+++ b/src/libtomahawk/widgets/whatshotwidget.cpp
@@ -1,6 +1,7 @@
/* === This file is part of Tomahawk Player - ===
*
* Copyright 2010-2011, Christian Muehlhaeuser
+ * Copyright 2011, Leo Franchi
*
* Tomahawk is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -29,6 +30,7 @@
#include "RecentPlaylistsModel.h"
#include "audio/audioengine.h"
+#include "dynamic/GeneratorInterface.h"
#include "playlist/playlistmodel.h"
#include "playlist/treeproxymodel.h"
#include "widgets/overlaywidget.h"
@@ -36,7 +38,6 @@
#include "widgets/kbreadcrumbselectionmodel.h"
#include "utils/tomahawkutils.h"
#include "utils/logger.h"
-#include
#include
#define HISTORY_TRACK_ITEMS 25
@@ -99,6 +100,7 @@ WhatsHotWidget::WhatsHotWidget( QWidget* parent )
connect( Tomahawk::InfoSystem::InfoSystem::instance(), SIGNAL( finished( QString ) ), SLOT( infoSystemFinished( QString ) ) );
+ connect( AudioEngine::instance(), SIGNAL( playlistChanged( Tomahawk::PlaylistInterface* ) ), this, SLOT( playlistChanged( Tomahawk::PlaylistInterface* ) ) );
QTimer::singleShot( 0, this, SLOT( fetchData() ) );
}
@@ -109,6 +111,31 @@ WhatsHotWidget::~WhatsHotWidget()
}
+bool
+WhatsHotWidget::isBeingPlayed() const
+{
+ if ( AudioEngine::instance()->currentTrackPlaylist() == ui->artistsViewLeft->playlistInterface() )
+ return true;
+
+ if ( AudioEngine::instance()->currentTrackPlaylist() == ui->tracksViewLeft->playlistInterface() )
+ return true;
+
+ return false;
+}
+
+bool
+WhatsHotWidget::jumpToCurrentTrack()
+{
+ if ( ui->artistsViewLeft->jumpToCurrentTrack() )
+ return true;
+
+ if ( ui->tracksViewLeft->jumpToCurrentTrack() )
+ return true;
+
+ return false;
+}
+
+
void
WhatsHotWidget::fetchData()
{
diff --git a/src/libtomahawk/widgets/whatshotwidget.h b/src/libtomahawk/widgets/whatshotwidget.h
index 14286521e..e13c0421e 100644
--- a/src/libtomahawk/widgets/whatshotwidget.h
+++ b/src/libtomahawk/widgets/whatshotwidget.h
@@ -65,7 +65,8 @@ public:
virtual bool showStatsBar() const { return false; }
virtual bool showInfoBar() const { return false; }
- virtual bool jumpToCurrentTrack() { return false; }
+ virtual bool jumpToCurrentTrack();
+ virtual bool isBeingPlayed() const;
protected:
void changeEvent( QEvent* e );
@@ -80,7 +81,6 @@ private slots:
void infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, QVariant output );
void infoSystemFinished( QString target );
void leftCrumbIndexChanged( QModelIndex );
-
private:
void setLeftViewArtists( TreeModel* artistModel );
void setLeftViewAlbums( AlbumModel* albumModel );
diff --git a/src/sourcetree/items/collectionitem.cpp b/src/sourcetree/items/collectionitem.cpp
index f50361182..2cc950a87 100644
--- a/src/sourcetree/items/collectionitem.cpp
+++ b/src/sourcetree/items/collectionitem.cpp
@@ -409,7 +409,8 @@ CollectionItem::requestExpanding()
void
CollectionItem::tempPageActivated( Tomahawk::ViewPage* v )
{
- int idx = children().count();
+ const int idx = children().count();
+ const int latest = children().last()->IDValue();
foreach ( TemporaryPageItem* page, m_tempItems )
{
@@ -420,13 +421,28 @@ CollectionItem::tempPageActivated( Tomahawk::ViewPage* v )
}
}
+ // Only keep 5 temporary pages at once
+ while ( m_tempItems.size() > 4 )
+ {
+ TemporaryPageItem* item = m_tempItems.takeFirst();
+ QTimer::singleShot( 0, item, SLOT( removeFromList() ) );
+ }
emit beginRowsAdded( idx, idx );
- TemporaryPageItem* tempPage = new TemporaryPageItem( model(), this, v, idx );
+ TemporaryPageItem* tempPage = new TemporaryPageItem( model(), this, v, latest + 1 );
+ connect( tempPage, SIGNAL( removed() ), this, SLOT( temporaryPageDestroyed() ) );
m_tempItems << tempPage;
endRowsAdded();
emit selectRequest( tempPage );
}
+void
+CollectionItem::temporaryPageDestroyed()
+{
+ TemporaryPageItem* tempPage = qobject_cast< TemporaryPageItem* >( sender() );
+ Q_ASSERT( tempPage );
+ m_tempItems.removeAll( tempPage );
+}
+
ViewPage*
CollectionItem::sourceInfoClicked()
diff --git a/src/sourcetree/items/collectionitem.h b/src/sourcetree/items/collectionitem.h
index 9d991d228..e2ba91e10 100644
--- a/src/sourcetree/items/collectionitem.h
+++ b/src/sourcetree/items/collectionitem.h
@@ -65,6 +65,7 @@ private slots:
void requestExpanding();
void tempPageActivated( Tomahawk::ViewPage* );
+ void temporaryPageDestroyed();
Tomahawk::ViewPage* sourceInfoClicked();
Tomahawk::ViewPage* getSourceInfoPage() const;
diff --git a/src/sourcetree/items/genericpageitems.cpp b/src/sourcetree/items/genericpageitems.cpp
index d901fe4dc..eace899dc 100644
--- a/src/sourcetree/items/genericpageitems.cpp
+++ b/src/sourcetree/items/genericpageitems.cpp
@@ -85,9 +85,8 @@ GenericPageItem::setText( const QString &text )
bool
GenericPageItem::isBeingPlayed() const
{
- if ( dynamic_cast< PlaylistInterface* >( m_get() ) )
- {
- return AudioEngine::instance()->currentTrackPlaylist() == dynamic_cast< PlaylistInterface* >( m_get() );
- }
+ if ( m_get() )
+ return m_get()->isBeingPlayed();
+
return false;
}
diff --git a/src/sourcetree/items/temporarypageitem.cpp b/src/sourcetree/items/temporarypageitem.cpp
index ee86b03d6..39aee2d1b 100644
--- a/src/sourcetree/items/temporarypageitem.cpp
+++ b/src/sourcetree/items/temporarypageitem.cpp
@@ -17,7 +17,10 @@
*/
#include "temporarypageitem.h"
-#include
+#include "viewmanager.h"
+#include "widgets/infowidgets/AlbumInfoWidget.h"
+#include "widgets/infowidgets/ArtistInfoWidget.h"
+#include "widgets/searchwidget.h"
using namespace Tomahawk;
@@ -27,6 +30,13 @@ TemporaryPageItem::TemporaryPageItem ( SourcesModel* mdl, SourceTreeItem* parent
, m_icon( QIcon( RESPATH "images/playlist-icon.png" ) )
, m_sortValue( sortValue )
{
+ if ( dynamic_cast< ArtistInfoWidget* >( page ) )
+ m_icon = QIcon( RESPATH "images/artist-icon.png" );
+ else if ( dynamic_cast< AlbumInfoWidget* >( page ) )
+ m_icon = QIcon( RESPATH "images/album-icon.png" );
+ else if ( dynamic_cast< SearchWidget* >( page ) )
+ m_icon = QIcon( RESPATH "images/search-icon.png" );
+
model()->linkSourceItemToPage( this, page );
}
@@ -55,6 +65,13 @@ TemporaryPageItem::peerSortValue() const
return m_sortValue;
}
+int
+TemporaryPageItem::IDValue() const
+{
+ return m_sortValue;
+}
+
+
void
TemporaryPageItem::removeFromList()
{
@@ -67,5 +84,7 @@ TemporaryPageItem::removeFromList()
parent()->removeChild( this );
parent()->endRowsRemoved();
+ emit removed();
+
deleteLater();
}
diff --git a/src/sourcetree/items/temporarypageitem.h b/src/sourcetree/items/temporarypageitem.h
index 28e5f4821..c2864f218 100644
--- a/src/sourcetree/items/temporarypageitem.h
+++ b/src/sourcetree/items/temporarypageitem.h
@@ -20,6 +20,7 @@
#define TEMPORARYPAGEITEM_H
#include "items/sourcetreeitem.h"
+#include "viewpage.h"
class TemporaryPageItem : public SourceTreeItem
{
@@ -32,9 +33,16 @@ public:
virtual QIcon icon() const;
virtual int peerSortValue() const;
+ virtual int IDValue() const;
- void removeFromList();
Tomahawk::ViewPage* page() const { return m_page; }
+ virtual bool isBeingPlayed() const { return m_page->isBeingPlayed(); }
+
+public slots:
+ void removeFromList();
+
+signals:
+ bool removed();
private:
Tomahawk::ViewPage* m_page;
diff --git a/src/sourcetree/sourcedelegate.cpp b/src/sourcetree/sourcedelegate.cpp
index f24ba7080..99076ac92 100644
--- a/src/sourcetree/sourcedelegate.cpp
+++ b/src/sourcetree/sourcedelegate.cpp
@@ -140,6 +140,7 @@ SourceDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, co
const bool playable = ( type == SourcesModel::StaticPlaylist ||
type == SourcesModel::AutomaticPlaylist ||
type == SourcesModel::Station ||
+ type == SourcesModel::TemporaryPage ||
type == SourcesModel::GenericPage );
if ( playable && item->isBeingPlayed() )