mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-05 13:47:26 +02:00
Have collections provide some strings of their own.
This commit is contained in:
@@ -64,6 +64,13 @@ Collection::prettyName() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString
|
||||||
|
Collection::itemName() const
|
||||||
|
{
|
||||||
|
return tr( "Collection" );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
QIcon
|
QIcon
|
||||||
Collection::icon() const
|
Collection::icon() const
|
||||||
{
|
{
|
||||||
@@ -71,6 +78,13 @@ Collection::icon() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
QString
|
||||||
|
Collection::emptyText() const
|
||||||
|
{
|
||||||
|
return tr( "This collection is empty." );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const
|
const
|
||||||
source_ptr& Collection::source() const
|
source_ptr& Collection::source() const
|
||||||
{
|
{
|
||||||
|
@@ -52,8 +52,10 @@ public:
|
|||||||
|
|
||||||
virtual QString name() const;
|
virtual QString name() const;
|
||||||
virtual QString prettyName() const;
|
virtual QString prettyName() const;
|
||||||
|
virtual QString itemName() const;
|
||||||
virtual QString type() const { return QString(); }
|
virtual QString type() const { return QString(); }
|
||||||
virtual QIcon icon() const;
|
virtual QIcon icon() const;
|
||||||
|
virtual QString emptyText() const;
|
||||||
|
|
||||||
virtual void loadPlaylists() { qDebug() << Q_FUNC_INFO; }
|
virtual void loadPlaylists() { qDebug() << Q_FUNC_INFO; }
|
||||||
virtual void loadAutoPlaylists() { 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();
|
TreeModel* model = new TreeModel();
|
||||||
view->setTreeModel( model );
|
view->setTreeModel( model );
|
||||||
|
|
||||||
if ( collection && collection->source()->isLocal() )
|
if ( !collection.isNull() )
|
||||||
view->setEmptyTip( tr( "After you have scanned your music collection you will find your tracks right here." ) );
|
view->setEmptyTip( collection->emptyText() );
|
||||||
else
|
|
||||||
view->setEmptyTip( tr( "This collection is empty." ) );
|
|
||||||
|
|
||||||
model->addCollection( collection );
|
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
|
Tomahawk::playlist_ptr
|
||||||
LocalCollection::bookmarksPlaylist()
|
LocalCollection::bookmarksPlaylist()
|
||||||
{
|
{
|
||||||
|
@@ -30,6 +30,9 @@ class DLLEXPORT LocalCollection : public DatabaseCollection
|
|||||||
public:
|
public:
|
||||||
explicit LocalCollection( const Tomahawk::source_ptr& source, QObject* parent = 0 );
|
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
|
// 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
|
// is invalid ask to create and listen to the signal
|
||||||
Tomahawk::playlist_ptr bookmarksPlaylist();
|
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
|
// adding/removing is done by dbsyncconnection, and the dbcmd objects that modify
|
||||||
// the database will make us emit the appropriate signals (tracksAdded etc.)
|
// the database will make us emit the appropriate signals (tracksAdded etc.)
|
||||||
void
|
void
|
||||||
|
@@ -37,6 +37,8 @@ public:
|
|||||||
qDebug() << Q_FUNC_INFO;
|
qDebug() << Q_FUNC_INFO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual QString prettyName() const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void addTracks( const QList<QVariant>& newitems );
|
virtual void addTracks( const QList<QVariant>& newitems );
|
||||||
virtual void removeTracks( const QDir& dir );
|
virtual void removeTracks( const QDir& dir );
|
||||||
|
@@ -262,10 +262,7 @@ TreeModel::addCollection( const collection_ptr& collection )
|
|||||||
if ( !collection->source()->avatar().isNull() )
|
if ( !collection->source()->avatar().isNull() )
|
||||||
setIcon( collection->source()->avatar( TomahawkUtils::RoundedCorners ) );
|
setIcon( collection->source()->avatar( TomahawkUtils::RoundedCorners ) );
|
||||||
|
|
||||||
if ( collection->source()->isLocal() )
|
setTitle( collection->prettyName() );
|
||||||
setTitle( tr( "My Collection" ) );
|
|
||||||
else
|
|
||||||
setTitle( tr( "Collection of %1" ).arg( collection->source()->friendlyName() ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -47,6 +47,20 @@ ScriptCollection::~ScriptCollection()
|
|||||||
|
|
||||||
QString
|
QString
|
||||||
ScriptCollection::prettyName() const
|
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",
|
return tr( "%1 Collection",
|
||||||
"Name of a collection based on a resolver, e.g. Subsonic Collection" )
|
"Name of a collection based on a resolver, e.g. Subsonic Collection" )
|
||||||
|
@@ -41,6 +41,7 @@ public:
|
|||||||
virtual ~ScriptCollection();
|
virtual ~ScriptCollection();
|
||||||
|
|
||||||
virtual QString prettyName() const;
|
virtual QString prettyName() const;
|
||||||
|
virtual QString itemName() const;
|
||||||
virtual QString type() const { return "scriptcollection"; }
|
virtual QString type() const { return "scriptcollection"; }
|
||||||
virtual QIcon icon() const;
|
virtual QIcon icon() const;
|
||||||
|
|
||||||
|
@@ -371,7 +371,7 @@ SourceItem::performAddCollectionItem( const collection_ptr& collection )
|
|||||||
{
|
{
|
||||||
GenericPageItem* item = new GenericPageItem( model(),
|
GenericPageItem* item = new GenericPageItem( model(),
|
||||||
this,
|
this,
|
||||||
collection->prettyName(),
|
collection->itemName(),
|
||||||
collection->icon(),
|
collection->icon(),
|
||||||
boost::bind( &SourceItem::collectionClicked, this, collection ),
|
boost::bind( &SourceItem::collectionClicked, this, collection ),
|
||||||
boost::bind( &SourceItem::getCollectionPage, this, collection ) );
|
boost::bind( &SourceItem::getCollectionPage, this, collection ) );
|
||||||
|
Reference in New Issue
Block a user