mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-19 15:29:42 +01:00
* Added a few overlay info messages.
This commit is contained in:
parent
7b96505d27
commit
b86c0f5c5e
@ -226,6 +226,8 @@ AlbumModel::removeIndex( const QModelIndex& index )
|
||||
delete item;
|
||||
emit endRemoveRows();
|
||||
}
|
||||
|
||||
emit itemCountChanged( rowCount( QModelIndex() ) );
|
||||
}
|
||||
|
||||
|
||||
@ -259,7 +261,7 @@ AlbumModel::addCollection( const collection_ptr& collection, bool overwrite )
|
||||
|
||||
if ( collection.isNull() )
|
||||
{
|
||||
connect( SourceList::instance(), SIGNAL( sourceAdded( Tomahawk::source_ptr ) ), SLOT( onSourceAdded( Tomahawk::source_ptr ) ) );
|
||||
connect( SourceList::instance(), SIGNAL( sourceAdded( Tomahawk::source_ptr ) ), SLOT( onSourceAdded( Tomahawk::source_ptr ) ), Qt::UniqueConnection );
|
||||
|
||||
QList<Tomahawk::source_ptr> sources = SourceList::instance()->sources();
|
||||
foreach ( const source_ptr& source, sources )
|
||||
@ -289,6 +291,7 @@ AlbumModel::addFilteredCollection( const collection_ptr& collection, unsigned in
|
||||
cmd->setSortOrder( order );
|
||||
cmd->setSortDescending( true );
|
||||
m_overwriteOnAdd = overwrite;
|
||||
m_collection = collection;
|
||||
|
||||
connect( cmd, SIGNAL( albums( QList<Tomahawk::album_ptr>, QVariant ) ),
|
||||
SLOT( addAlbums( QList<Tomahawk::album_ptr> ) ) );
|
||||
@ -313,7 +316,10 @@ AlbumModel::addAlbums( const QList<Tomahawk::album_ptr>& albums )
|
||||
clear();
|
||||
|
||||
if ( !albums.count() )
|
||||
{
|
||||
emit itemCountChanged( rowCount( QModelIndex() ) );
|
||||
return;
|
||||
}
|
||||
|
||||
int c = rowCount( QModelIndex() );
|
||||
QPair< int, int > crows;
|
||||
@ -332,6 +338,7 @@ AlbumModel::addAlbums( const QList<Tomahawk::album_ptr>& albums )
|
||||
}
|
||||
|
||||
emit endInsertRows();
|
||||
emit itemCountChanged( rowCount( QModelIndex() ) );
|
||||
}
|
||||
|
||||
|
||||
@ -345,10 +352,7 @@ AlbumModel::onSourceAdded( const Tomahawk::source_ptr& source )
|
||||
void
|
||||
AlbumModel::onCollectionChanged()
|
||||
{
|
||||
if ( m_collection )
|
||||
addCollection( m_collection, true );
|
||||
else
|
||||
addCollection( m_collection, true );
|
||||
addCollection( m_collection, true );
|
||||
}
|
||||
|
||||
|
||||
@ -395,7 +399,6 @@ AlbumModel::infoSystemInfo( Tomahawk::InfoSystem::InfoRequestData requestData, Q
|
||||
if ( requestData.caller != s_tmInfoIdentifier ||
|
||||
( requestData.type != Tomahawk::InfoSystem::InfoAlbumCoverArt && requestData.type != Tomahawk::InfoSystem::InfoArtistImages ) )
|
||||
{
|
||||
// qDebug() << "Info of wrong type or not with our identifier";
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -61,6 +61,8 @@ public:
|
||||
virtual QStringList mimeTypes() const;
|
||||
virtual Qt::ItemFlags flags( const QModelIndex& index ) const;
|
||||
|
||||
Tomahawk::collection_ptr collection() const { return m_collection; }
|
||||
|
||||
void clear();
|
||||
void addCollection( const Tomahawk::collection_ptr& collection, bool overwrite = false );
|
||||
void addFilteredCollection( const Tomahawk::collection_ptr& collection, unsigned int amount, DatabaseCommand_AllAlbums::SortOrder order, bool overwrite = false );
|
||||
@ -92,7 +94,7 @@ signals:
|
||||
void repeatModeChanged( Tomahawk::PlaylistInterface::RepeatMode mode );
|
||||
void shuffleModeChanged( bool enabled );
|
||||
|
||||
void trackCountChanged( unsigned int tracks );
|
||||
void itemCountChanged( unsigned int items );
|
||||
|
||||
void loadingStarted();
|
||||
void loadingFinished();
|
||||
|
@ -45,6 +45,7 @@ AlbumView::AlbumView( QWidget* parent )
|
||||
, m_proxyModel( 0 )
|
||||
, m_delegate( 0 )
|
||||
, m_loadingSpinner( new LoadingSpinner( this ) )
|
||||
, m_overlay( new OverlayWidget( this ) )
|
||||
{
|
||||
setDragEnabled( true );
|
||||
setDropIndicatorShown( false );
|
||||
@ -111,6 +112,7 @@ AlbumView::setAlbumModel( AlbumModel* model )
|
||||
connect( m_proxyModel, SIGNAL( filterChanged( QString ) ), SLOT( onFilterChanged( QString ) ) );
|
||||
connect( m_proxyModel, SIGNAL( rowsInserted( QModelIndex, int, int ) ), SLOT( onViewChanged() ) );
|
||||
|
||||
connect( m_model, SIGNAL( itemCountChanged( unsigned int ) ), SLOT( onItemCountChanged( unsigned int ) ) );
|
||||
connect( m_model, SIGNAL( loadingStarted() ), m_loadingSpinner, SLOT( fadeIn() ) );
|
||||
connect( m_model, SIGNAL( loadingFinished() ), m_loadingSpinner, SLOT( fadeOut() ) );
|
||||
|
||||
@ -143,6 +145,23 @@ AlbumView::onViewChanged()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
AlbumView::onItemCountChanged( unsigned int items )
|
||||
{
|
||||
if ( items == 0 )
|
||||
{
|
||||
if ( m_model->collection().isNull() || ( !m_model->collection().isNull() && m_model->collection()->source()->isLocal() ) )
|
||||
m_overlay->setText( tr( "After you have scanned your music collection you will find your latest album additions right here." ) );
|
||||
else
|
||||
m_overlay->setText( tr( "This collection doesn't have any recent albums." ) );
|
||||
|
||||
m_overlay->show();
|
||||
}
|
||||
else
|
||||
m_overlay->hide();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
AlbumView::onScrollTimeout()
|
||||
{
|
||||
|
@ -24,8 +24,9 @@
|
||||
#include <QTimer>
|
||||
|
||||
#include "viewpage.h"
|
||||
#include "dllmacro.h"
|
||||
#include "albumproxymodel.h"
|
||||
#include "widgets/overlaywidget.h"
|
||||
#include "dllmacro.h"
|
||||
|
||||
class AlbumModel;
|
||||
class LoadingSpinner;
|
||||
@ -68,6 +69,8 @@ protected:
|
||||
void resizeEvent( QResizeEvent* event );
|
||||
|
||||
private slots:
|
||||
void onItemCountChanged( unsigned int items );
|
||||
|
||||
void onFilterChanged( const QString& filter );
|
||||
|
||||
void onViewChanged();
|
||||
@ -78,6 +81,7 @@ private:
|
||||
AlbumProxyModel* m_proxyModel;
|
||||
AlbumItemDelegate* m_delegate;
|
||||
LoadingSpinner* m_loadingSpinner;
|
||||
OverlayWidget* m_overlay;
|
||||
|
||||
QTimer m_timer;
|
||||
};
|
||||
|
@ -130,6 +130,7 @@ ArtistView::setTreeModel( TreeModel* model )
|
||||
connect( m_proxyModel, SIGNAL( filteringStarted() ), SLOT( onFilteringStarted() ) );
|
||||
connect( m_proxyModel, SIGNAL( filteringFinished() ), m_loadingSpinner, SLOT( fadeOut() ) );
|
||||
|
||||
connect( m_model, SIGNAL( itemCountChanged( unsigned int ) ), SLOT( onItemCountChanged( unsigned int ) ) );
|
||||
connect( m_proxyModel, SIGNAL( filterChanged( QString ) ), SLOT( onFilterChanged( QString ) ) );
|
||||
connect( m_proxyModel, SIGNAL( rowsInserted( QModelIndex, int, int ) ), SLOT( onViewChanged() ) );
|
||||
|
||||
@ -167,6 +168,7 @@ ArtistView::onItemActivated( const QModelIndex& index )
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ArtistView::keyPressEvent( QKeyEvent* event )
|
||||
{
|
||||
@ -206,6 +208,23 @@ ArtistView::resizeEvent( QResizeEvent* event )
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ArtistView::onItemCountChanged( unsigned int items )
|
||||
{
|
||||
if ( items == 0 )
|
||||
{
|
||||
if ( m_model->collection().isNull() || ( !m_model->collection().isNull() && m_model->collection()->source()->isLocal() ) )
|
||||
m_overlay->setText( tr( "After you have scanned your music collection you will find your tracks right here." ) );
|
||||
else
|
||||
m_overlay->setText( tr( "This collection is currently empty." ) );
|
||||
|
||||
m_overlay->show();
|
||||
}
|
||||
else
|
||||
m_overlay->hide();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ArtistView::onFilterChanged( const QString& )
|
||||
{
|
||||
|
@ -81,6 +81,7 @@ protected:
|
||||
void keyPressEvent( QKeyEvent* event );
|
||||
|
||||
private slots:
|
||||
void onItemCountChanged( unsigned int items );
|
||||
void onFilterChanged( const QString& filter );
|
||||
void onFilteringStarted();
|
||||
void onViewChanged();
|
||||
|
@ -192,9 +192,6 @@ PlaylistModel::insert( const Tomahawk::query_ptr& query, int row )
|
||||
void
|
||||
PlaylistModel::insert( const QList< Tomahawk::query_ptr >& queries, int row )
|
||||
{
|
||||
if ( !queries.count() )
|
||||
return;
|
||||
|
||||
QList< Tomahawk::plentry_ptr > entries;
|
||||
foreach( const query_ptr& query, queries )
|
||||
{
|
||||
@ -221,7 +218,10 @@ void
|
||||
PlaylistModel::insert( const QList< Tomahawk::plentry_ptr >& entries, int row )
|
||||
{
|
||||
if ( !entries.count() )
|
||||
{
|
||||
emit trackCountChanged( rowCount( QModelIndex() ) );
|
||||
return;
|
||||
}
|
||||
|
||||
int c = row;
|
||||
QPair< int, int > crows;
|
||||
|
@ -81,7 +81,6 @@ PlaylistView::setPlaylistModel( PlaylistModel* model )
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
PlaylistView::keyPressEvent( QKeyEvent* event )
|
||||
{
|
||||
|
@ -52,7 +52,6 @@ public:
|
||||
virtual bool jumpToCurrentTrack();
|
||||
virtual bool isTemporaryPage() const;
|
||||
|
||||
|
||||
signals:
|
||||
void nameChanged( const QString& title );
|
||||
void destroyed( QWidget* widget );
|
||||
@ -60,7 +59,6 @@ signals:
|
||||
protected:
|
||||
void keyPressEvent( QKeyEvent* event );
|
||||
|
||||
|
||||
private slots:
|
||||
void onTrackCountChanged( unsigned int tracks );
|
||||
void onMenuTriggered( int action );
|
||||
@ -73,7 +71,6 @@ private:
|
||||
PlaylistModel* m_model;
|
||||
QString m_customTitle;
|
||||
QString m_customDescripton;
|
||||
|
||||
};
|
||||
|
||||
#endif // PLAYLISTVIEW_H
|
||||
|
@ -367,7 +367,10 @@ void
|
||||
TrackModel::insert( const QList< Tomahawk::query_ptr >& queries, int row )
|
||||
{
|
||||
if ( !queries.count() )
|
||||
{
|
||||
emit trackCountChanged( rowCount( QModelIndex() ) );
|
||||
return;
|
||||
}
|
||||
|
||||
int c = row;
|
||||
QPair< int, int > crows;
|
||||
|
@ -568,8 +568,6 @@ TreeModel::removeIndexes( const QList<QModelIndex>& indexes )
|
||||
void
|
||||
TreeModel::addAllCollections()
|
||||
{
|
||||
qDebug() << Q_FUNC_INFO;
|
||||
|
||||
emit loadingStarted();
|
||||
DatabaseCommand_AllArtists* cmd = new DatabaseCommand_AllArtists();
|
||||
|
||||
@ -578,7 +576,7 @@ TreeModel::addAllCollections()
|
||||
|
||||
Database::instance()->enqueue( QSharedPointer<DatabaseCommand>( cmd ) );
|
||||
|
||||
connect( SourceList::instance(), SIGNAL( sourceAdded( Tomahawk::source_ptr ) ), SLOT( onSourceAdded( Tomahawk::source_ptr ) ) );
|
||||
connect( SourceList::instance(), SIGNAL( sourceAdded( Tomahawk::source_ptr ) ), SLOT( onSourceAdded( Tomahawk::source_ptr ) ), Qt::UniqueConnection );
|
||||
|
||||
QList<Tomahawk::source_ptr> sources = SourceList::instance()->sources();
|
||||
foreach ( const source_ptr& source, sources )
|
||||
@ -753,7 +751,10 @@ TreeModel::onArtistsAdded( const QList<Tomahawk::artist_ptr>& artists )
|
||||
{
|
||||
emit loadingFinished();
|
||||
if ( !artists.count() )
|
||||
{
|
||||
emit itemCountChanged( rowCount( QModelIndex() ) );
|
||||
return;
|
||||
}
|
||||
|
||||
int c = rowCount( QModelIndex() );
|
||||
QPair< int, int > crows;
|
||||
@ -771,6 +772,7 @@ TreeModel::onArtistsAdded( const QList<Tomahawk::artist_ptr>& artists )
|
||||
}
|
||||
|
||||
emit endInsertRows();
|
||||
emit itemCountChanged( rowCount( QModelIndex() ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -132,7 +132,7 @@ signals:
|
||||
void repeatModeChanged( Tomahawk::PlaylistInterface::RepeatMode mode );
|
||||
void shuffleModeChanged( bool enabled );
|
||||
|
||||
void trackCountChanged( unsigned int tracks );
|
||||
void itemCountChanged( unsigned int items );
|
||||
|
||||
void loadingStarted();
|
||||
void loadingFinished();
|
||||
|
Loading…
x
Reference in New Issue
Block a user