mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-12 09:04:33 +02:00
add icon for playlists
add recently played item in source list add create playlist icon, show playlists node for local source remove H ome from toolbar as it's in the sidebar now
This commit is contained in:
BIN
data/images/create-playlist.png
Normal file
BIN
data/images/create-playlist.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.0 KiB |
@@ -75,6 +75,7 @@
|
||||
<file>./data/images/forward.png</file>
|
||||
<file>./data/images/music-icon.png</file>
|
||||
<file>./data/images/configure.png</file>
|
||||
<file>./data/images/create-playlist.png</file>
|
||||
<file>./data/topbar-radiobuttons.css</file>
|
||||
<file>./data/icons/tomahawk-icon-16x16.png</file>
|
||||
<file>./data/icons/tomahawk-icon-32x32.png</file>
|
||||
|
@@ -577,8 +577,9 @@ PlaylistManager::setPage( ViewPage* page, bool trackHistory )
|
||||
emit superCollectionActivated();
|
||||
else if( isNewPlaylistPageVisible() )
|
||||
emit newPlaylistActivated();
|
||||
/* TODO refactor. now we have rows in the sourcetreeview that are connected to pages, e.g. Stations, Recently Updated, etc
|
||||
else if ( !currentPlaylistInterface() )
|
||||
emit tempPageActivated();
|
||||
emit tempPageActivated();*/
|
||||
|
||||
if ( !AudioEngine::instance()->isPlaying() )
|
||||
AudioEngine::instance()->setPlaylist( currentPlaylistInterface() );
|
||||
|
@@ -23,9 +23,11 @@
|
||||
#include "playlist.h"
|
||||
#include "collection.h"
|
||||
#include "source.h"
|
||||
#include "tomahawk/tomahawkapp.h"
|
||||
|
||||
#include <QMimeData>
|
||||
#include <QSize>
|
||||
#include <playlist/playlistmanager.h>
|
||||
|
||||
using namespace Tomahawk;
|
||||
|
||||
@@ -36,6 +38,10 @@ SourcesModel::SourcesModel( QObject* parent )
|
||||
|
||||
appendItem( source_ptr() );
|
||||
|
||||
// add misc children of root node
|
||||
GenericPageItem* recent = new GenericPageItem( this, m_rootItem->children().at( 0 ), tr( "Recently Played" ), QIcon( RESPATH "images/home.png" ) );
|
||||
connect( recent, SIGNAL( activated() ), PlaylistManager::instance(), SLOT( showWelcomePage() ) );
|
||||
|
||||
onSourcesAdded( SourceList::instance()->sources() );
|
||||
|
||||
connect( SourceList::instance(), SIGNAL( sourceAdded( Tomahawk::source_ptr ) ), SLOT( onSourceAdded( Tomahawk::source_ptr ) ) );
|
||||
|
@@ -51,6 +51,8 @@ public:
|
||||
AutomaticPlaylist = 4,
|
||||
|
||||
Stations = 5,
|
||||
|
||||
GenericPage = 6
|
||||
};
|
||||
|
||||
enum CategoryType {
|
||||
|
@@ -174,6 +174,12 @@ PlaylistItem::dropMimeData( const QMimeData* data, Qt::DropAction action )
|
||||
return false;
|
||||
}
|
||||
|
||||
QIcon
|
||||
PlaylistItem::icon() const
|
||||
{
|
||||
return QIcon( RESPATH "images/playlist-icon.png" );
|
||||
}
|
||||
|
||||
|
||||
/// Dynamic Playlist Item
|
||||
/*
|
||||
@@ -270,7 +276,7 @@ CategoryAddItem::flags() const
|
||||
QIcon
|
||||
CategoryAddItem::icon() const
|
||||
{
|
||||
return QIcon( RESPATH "images/list-add.png" );
|
||||
return QIcon( RESPATH "images/create-playlist.png" );
|
||||
}
|
||||
|
||||
// CategoryItem
|
||||
@@ -316,19 +322,26 @@ CategoryItem::insertItems( QList< SourceTreeItem* > items )
|
||||
CollectionItem::CollectionItem( SourcesModel* mdl, SourceTreeItem* parent, const Tomahawk::source_ptr& source )
|
||||
: SourceTreeItem( mdl, parent, SourcesModel::Collection )
|
||||
, m_source( source )
|
||||
, m_playlists( 0 )
|
||||
, m_stations( 0 )
|
||||
{
|
||||
if( m_source.isNull() ) { // super collection
|
||||
return;
|
||||
}
|
||||
// create category item
|
||||
// create category items if there are playlists to show, or stations to show
|
||||
QList< playlist_ptr > playlists = source->collection()->playlists();
|
||||
|
||||
if( !playlists.isEmpty() || source->isLocal() ) {
|
||||
m_playlists = new CategoryItem( model(), this, SourcesModel::PlaylistsCategory, source->isLocal() );
|
||||
|
||||
m_stations = new CategoryItem( model(), this, SourcesModel::StationsCategory, source->isLocal() );
|
||||
|
||||
// ugh :( we're being added by the model, no need to notify for added rows now
|
||||
m_playlists->blockSignals( true );
|
||||
// m_playlists->blockSignals( true );
|
||||
onPlaylistsAdded( source->collection()->playlists() );
|
||||
m_playlists->blockSignals( false );
|
||||
// m_playlists->blockSignals( false );
|
||||
}
|
||||
|
||||
// TODO always show for now, till we actually support stations
|
||||
// m_stations = new CategoryItem( model(), this, SourcesModel::StationsCategory, source->isLocal() );
|
||||
|
||||
|
||||
// HACK to load only for now
|
||||
source->collection()->dynamicPlaylists();
|
||||
@@ -368,6 +381,10 @@ CollectionItem::onPlaylistsAdded( const QList< playlist_ptr >& playlists )
|
||||
if( playlists.isEmpty() )
|
||||
return;
|
||||
|
||||
if( !m_playlists ) { // add the category too
|
||||
m_playlists = new CategoryItem( model(), this, SourcesModel::PlaylistsCategory, source()->isLocal() );
|
||||
}
|
||||
|
||||
QList< SourceTreeItem* > items;
|
||||
int addOffset = playlists.first()->author()->isLocal() ? 1 : 0;
|
||||
|
||||
@@ -386,6 +403,7 @@ CollectionItem::onPlaylistsAdded( const QList< playlist_ptr >& playlists )
|
||||
void
|
||||
CollectionItem::onPlaylistsDeleted( const QList< playlist_ptr >& playlists )
|
||||
{
|
||||
Q_ASSERT( m_playlists ); // How can we delete playlists if we have none?
|
||||
QList< SourceTreeItem* > items;
|
||||
foreach( const playlist_ptr& playlist, playlists ) {
|
||||
int curCount = m_playlists->children().count();
|
||||
@@ -400,3 +418,43 @@ CollectionItem::onPlaylistsDeleted( const QList< playlist_ptr >& playlists )
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Generic page item
|
||||
GenericPageItem::GenericPageItem( SourcesModel* model, SourceTreeItem* parent, const QString& text, const QIcon& icon )
|
||||
: SourceTreeItem( model, parent, SourcesModel::GenericPage )
|
||||
, m_icon( icon )
|
||||
, m_text( text )
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
GenericPageItem::~GenericPageItem()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
GenericPageItem::activate()
|
||||
{
|
||||
emit activated();
|
||||
}
|
||||
|
||||
QString
|
||||
GenericPageItem::text() const
|
||||
{
|
||||
return m_text;
|
||||
}
|
||||
|
||||
QIcon
|
||||
GenericPageItem::icon() const
|
||||
{
|
||||
return m_icon;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
GenericPageItem::willAcceptDrag(const QMimeData* data) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@@ -154,6 +154,7 @@ public:
|
||||
virtual void activate();
|
||||
virtual bool willAcceptDrag( const QMimeData* data ) const;
|
||||
virtual bool dropMimeData( const QMimeData* data, Qt::DropAction action );
|
||||
virtual QIcon icon() const;
|
||||
|
||||
protected:
|
||||
void setLoaded( bool loaded );
|
||||
@@ -186,6 +187,27 @@ private:
|
||||
Tomahawk::dynplaylist_ptr m_dynplaylist;
|
||||
};*/
|
||||
|
||||
// generic item that has some name, some text, and calls a certain slot when activated. badabing!
|
||||
class GenericPageItem : public SourceTreeItem
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
GenericPageItem( SourcesModel* model, SourceTreeItem* parent, const QString& text, const QIcon& icon );
|
||||
virtual ~GenericPageItem();
|
||||
|
||||
virtual QString text() const;
|
||||
virtual void activate();
|
||||
virtual bool willAcceptDrag( const QMimeData* data ) const;
|
||||
virtual QIcon icon() const;
|
||||
|
||||
signals:
|
||||
void activated();
|
||||
|
||||
private:
|
||||
QIcon m_icon;
|
||||
QString m_text;
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE( SourceTreeItem* );
|
||||
|
||||
#endif // SOURCETREEITEM_H
|
||||
|
@@ -169,7 +169,6 @@ TomahawkWindow::TomahawkWindow( QWidget* parent )
|
||||
|
||||
m_backAvailable = toolbar->addAction( QIcon( RESPATH "images/back.png" ), tr( "Back" ), PlaylistManager::instance(), SLOT( historyBack() ) );
|
||||
m_forwardAvailable = toolbar->addAction( QIcon( RESPATH "images/forward.png" ), tr( "Forward" ), PlaylistManager::instance(), SLOT( historyForward() ) );
|
||||
toolbar->addAction( QIcon( RESPATH "images/home.png" ), tr( "Home" ), PlaylistManager::instance(), SLOT( showWelcomePage() ) );
|
||||
|
||||
statusBar()->addPermanentWidget( m_audioControls, 1 );
|
||||
|
||||
|
Reference in New Issue
Block a user