mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-21 00:09:47 +01:00
Have collections provide some strings of their own.
This commit is contained in:
parent
65741c3658
commit
3a805cbe67
@ -64,10 +64,24 @@ Collection::prettyName() const
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
Collection::itemName() const
|
||||
{
|
||||
return tr( "Collection" );
|
||||
}
|
||||
|
||||
|
||||
QIcon
|
||||
Collection::icon() const
|
||||
{
|
||||
return ImageRegistry::instance()->icon( RESPATH "images/collection.svg" );
|
||||
return ImageRegistry::instance()->icon( RESPATH "images/collection.svg" );
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
Collection::emptyText() const
|
||||
{
|
||||
return tr( "This collection is empty." );
|
||||
}
|
||||
|
||||
|
||||
|
@ -52,8 +52,10 @@ public:
|
||||
|
||||
virtual QString name() const;
|
||||
virtual QString prettyName() const;
|
||||
virtual QString itemName() const;
|
||||
virtual QString type() const { return QString(); }
|
||||
virtual QIcon icon() const;
|
||||
virtual QString emptyText() const;
|
||||
|
||||
virtual void loadPlaylists() { qDebug() << Q_FUNC_INFO; }
|
||||
virtual void loadAutoPlaylists() { qDebug() << Q_FUNC_INFO; }
|
||||
|
@ -278,10 +278,8 @@ ViewManager::show( const Tomahawk::collection_ptr& collection )
|
||||
TreeModel* model = new TreeModel();
|
||||
view->setTreeModel( model );
|
||||
|
||||
if ( collection && collection->source()->isLocal() )
|
||||
view->setEmptyTip( tr( "After you have scanned your music collection you will find your tracks right here." ) );
|
||||
else
|
||||
view->setEmptyTip( tr( "This collection is empty." ) );
|
||||
if ( !collection.isNull() )
|
||||
view->setEmptyTip( collection->emptyText() );
|
||||
|
||||
model->addCollection( collection );
|
||||
|
||||
|
@ -36,6 +36,20 @@ LocalCollection::LocalCollection( const Tomahawk::source_ptr& source, QObject* p
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
LocalCollection::prettyName() const
|
||||
{
|
||||
return tr( "My Collection" );
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
LocalCollection::emptyText() const
|
||||
{
|
||||
return tr( "After you have scanned your music collection you will find your tracks right here." );
|
||||
}
|
||||
|
||||
|
||||
Tomahawk::playlist_ptr
|
||||
LocalCollection::bookmarksPlaylist()
|
||||
{
|
||||
|
@ -30,6 +30,9 @@ class DLLEXPORT LocalCollection : public DatabaseCollection
|
||||
public:
|
||||
explicit LocalCollection( const Tomahawk::source_ptr& source, QObject* parent = 0 );
|
||||
|
||||
virtual QString prettyName() const;
|
||||
virtual QString emptyText() const;
|
||||
|
||||
// gets the playlist used for storing stuff from the web, if it already exists. if the returned playlist
|
||||
// is invalid ask to create and listen to the signal
|
||||
Tomahawk::playlist_ptr bookmarksPlaylist();
|
||||
|
@ -30,6 +30,13 @@ RemoteCollection::RemoteCollection( source_ptr source, QObject* parent )
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
RemoteCollection::prettyName() const
|
||||
{
|
||||
return tr( "Collection of %1" ).arg( source()->friendlyName() );
|
||||
}
|
||||
|
||||
|
||||
// adding/removing is done by dbsyncconnection, and the dbcmd objects that modify
|
||||
// the database will make us emit the appropriate signals (tracksAdded etc.)
|
||||
void
|
||||
|
@ -37,6 +37,8 @@ public:
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
}
|
||||
|
||||
virtual QString prettyName() const;
|
||||
|
||||
public slots:
|
||||
virtual void addTracks( const QList<QVariant>& newitems );
|
||||
virtual void removeTracks( const QDir& dir );
|
||||
|
@ -262,10 +262,7 @@ TreeModel::addCollection( const collection_ptr& collection )
|
||||
if ( !collection->source()->avatar().isNull() )
|
||||
setIcon( collection->source()->avatar( TomahawkUtils::RoundedCorners ) );
|
||||
|
||||
if ( collection->source()->isLocal() )
|
||||
setTitle( tr( "My Collection" ) );
|
||||
else
|
||||
setTitle( tr( "Collection of %1" ).arg( collection->source()->friendlyName() ) );
|
||||
setTitle( collection->prettyName() );
|
||||
}
|
||||
|
||||
|
||||
|
@ -47,6 +47,20 @@ ScriptCollection::~ScriptCollection()
|
||||
|
||||
QString
|
||||
ScriptCollection::prettyName() const
|
||||
{
|
||||
if ( source()->isLocal() )
|
||||
return tr( "My %1 Collection",
|
||||
"Name of a collection based on a resolver, e.g. My Subsonic Collection" )
|
||||
.arg( m_resolver->name() );
|
||||
return tr( "%1 Collection of %2",
|
||||
"Name of a collection based on a resolver, e.g. Subsonic Collection of Some Dude" )
|
||||
.arg( m_resolver->name() )
|
||||
.arg( source()->friendlyName() );
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
ScriptCollection::itemName() const
|
||||
{
|
||||
return tr( "%1 Collection",
|
||||
"Name of a collection based on a resolver, e.g. Subsonic Collection" )
|
||||
|
@ -41,6 +41,7 @@ public:
|
||||
virtual ~ScriptCollection();
|
||||
|
||||
virtual QString prettyName() const;
|
||||
virtual QString itemName() const;
|
||||
virtual QString type() const { return "scriptcollection"; }
|
||||
virtual QIcon icon() const;
|
||||
|
||||
|
@ -371,7 +371,7 @@ SourceItem::performAddCollectionItem( const collection_ptr& collection )
|
||||
{
|
||||
GenericPageItem* item = new GenericPageItem( model(),
|
||||
this,
|
||||
collection->prettyName(),
|
||||
collection->itemName(),
|
||||
collection->icon(),
|
||||
boost::bind( &SourceItem::collectionClicked, this, collection ),
|
||||
boost::bind( &SourceItem::getCollectionPage, this, collection ) );
|
||||
|
Loading…
x
Reference in New Issue
Block a user