mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-09 07:36:48 +02:00
Adapt to new FlexibleView API.
This commit is contained in:
@@ -403,15 +403,15 @@ ContextMenu::addToQueue()
|
|||||||
{
|
{
|
||||||
foreach ( const query_ptr& query, m_queries )
|
foreach ( const query_ptr& query, m_queries )
|
||||||
{
|
{
|
||||||
ViewManager::instance()->queue()->trackView()->model()->appendQuery( query );
|
ViewManager::instance()->queue()->view()->trackView()->model()->appendQuery( query );
|
||||||
}
|
}
|
||||||
foreach ( const artist_ptr& artist, m_artists )
|
foreach ( const artist_ptr& artist, m_artists )
|
||||||
{
|
{
|
||||||
ViewManager::instance()->queue()->trackView()->model()->appendArtist( artist );
|
ViewManager::instance()->queue()->view()->trackView()->model()->appendArtist( artist );
|
||||||
}
|
}
|
||||||
foreach ( const album_ptr& album, m_albums )
|
foreach ( const album_ptr& album, m_albums )
|
||||||
{
|
{
|
||||||
ViewManager::instance()->queue()->trackView()->model()->appendAlbum( album );
|
ViewManager::instance()->queue()->view()->trackView()->model()->appendAlbum( album );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -638,7 +638,7 @@ GlobalActionManager::handleLoveCommand( const QUrl& url )
|
|||||||
void
|
void
|
||||||
GlobalActionManager::handleOpenTrack( const query_ptr& q )
|
GlobalActionManager::handleOpenTrack( const query_ptr& q )
|
||||||
{
|
{
|
||||||
ViewManager::instance()->queue()->trackView()->model()->appendQuery( q );
|
ViewManager::instance()->queue()->view()->trackView()->model()->appendQuery( q );
|
||||||
ViewManager::instance()->showQueuePage();
|
ViewManager::instance()->showQueuePage();
|
||||||
|
|
||||||
if ( !AudioEngine::instance()->isPlaying() && !AudioEngine::instance()->isPaused() )
|
if ( !AudioEngine::instance()->isPlaying() && !AudioEngine::instance()->isPaused() )
|
||||||
@@ -655,7 +655,7 @@ GlobalActionManager::handleOpenTracks( const QList< query_ptr >& queries )
|
|||||||
if ( queries.isEmpty() )
|
if ( queries.isEmpty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ViewManager::instance()->queue()->trackView()->model()->appendQueries( queries );
|
ViewManager::instance()->queue()->view()->trackView()->model()->appendQueries( queries );
|
||||||
ViewManager::instance()->showQueuePage();
|
ViewManager::instance()->showQueuePage();
|
||||||
|
|
||||||
if ( !AudioEngine::instance()->isPlaying() && !AudioEngine::instance()->isPaused() )
|
if ( !AudioEngine::instance()->isPlaying() && !AudioEngine::instance()->isPaused() )
|
||||||
@@ -855,7 +855,7 @@ GlobalActionManager::doQueueAdd( const QStringList& parts, const QList< QPair< Q
|
|||||||
|
|
||||||
Pipeline::instance()->resolve( q );
|
Pipeline::instance()->resolve( q );
|
||||||
|
|
||||||
ViewManager::instance()->queue()->trackView()->model()->appendQuery( q );
|
ViewManager::instance()->queue()->view()->trackView()->model()->appendQuery( q );
|
||||||
ViewManager::instance()->showQueuePage();
|
ViewManager::instance()->showQueuePage();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -1330,7 +1330,7 @@ GlobalActionManager::waitingForResolved( bool /* success */ )
|
|||||||
AudioEngine::instance()->playItem( AudioEngine::instance()->playlist(), m_waitingToPlay->results().first() );
|
AudioEngine::instance()->playItem( AudioEngine::instance()->playlist(), m_waitingToPlay->results().first() );
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ViewManager::instance()->queue()->trackView()->model()->appendQuery( m_waitingToPlay );
|
ViewManager::instance()->queue()->view()->trackView()->model()->appendQuery( m_waitingToPlay );
|
||||||
AudioEngine::instance()->play();
|
AudioEngine::instance()->play();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -20,10 +20,12 @@
|
|||||||
|
|
||||||
#include "InboxView.h"
|
#include "InboxView.h"
|
||||||
#include "InboxModel.h"
|
#include "InboxModel.h"
|
||||||
|
#include "ContextView.h"
|
||||||
#include "PlayableProxyModel.h"
|
#include "PlayableProxyModel.h"
|
||||||
#include "ContextMenu.h"
|
#include "ContextMenu.h"
|
||||||
#include "playlist/TrackItemDelegate.h"
|
#include "playlist/TrackItemDelegate.h"
|
||||||
#include "ViewManager.h"
|
#include "ViewManager.h"
|
||||||
|
#include "utils/TomahawkUtilsGui.h"
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
|
|
||||||
InboxView::InboxView( QWidget* parent ) :
|
InboxView::InboxView( QWidget* parent ) :
|
||||||
@@ -77,14 +79,13 @@ InboxView::onMenuTriggered( int action )
|
|||||||
InboxPage::InboxPage( QWidget* parent ) :
|
InboxPage::InboxPage( QWidget* parent ) :
|
||||||
FlexibleView( parent )
|
FlexibleView( parent )
|
||||||
{
|
{
|
||||||
InboxView* inboxView = new InboxView( this );
|
view()->setCaption( tr( "Inbox Details" ) );
|
||||||
setTrackView( inboxView );
|
|
||||||
setCurrentMode( Flat );
|
|
||||||
// setCaption( tr( "Inbox Details" ) );
|
|
||||||
|
|
||||||
setPlayableModel( ViewManager::instance()->inboxModel() );
|
setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::Inbox ) );
|
||||||
setEmptyTip( tr( "Your friends have not shared any recommendations with you yet. Connect with them and share your musical gems!" ) );
|
|
||||||
|
|
||||||
TrackItemDelegate* delegate = new TrackItemDelegate( TrackItemDelegate::Inbox, inboxView, inboxView->proxyModel() );
|
view()->trackView()->setPlayableModel( ViewManager::instance()->inboxModel() );
|
||||||
inboxView->setPlaylistItemDelegate( delegate );
|
view()->trackView()->setEmptyTip( tr( "Your friends have not shared any recommendations with you yet. Connect with them and share your musical gems!" ) );
|
||||||
|
|
||||||
|
TrackItemDelegate* delegate = new TrackItemDelegate( TrackItemDelegate::Inbox, view()->trackView(), view()->trackView()->proxyModel() );
|
||||||
|
view()->trackView()->setPlaylistItemDelegate( delegate );
|
||||||
}
|
}
|
||||||
|
@@ -36,23 +36,24 @@ using namespace Tomahawk;
|
|||||||
QueueView::QueueView( QWidget* parent )
|
QueueView::QueueView( QWidget* parent )
|
||||||
: FlexibleView( parent )
|
: FlexibleView( parent )
|
||||||
{
|
{
|
||||||
// setCaption( tr( "Queue Details" ) );
|
view()->setCaption( tr( "Queue Details" ) );
|
||||||
|
|
||||||
trackView()->setProxyModel( new QueueProxyModel( trackView() ) );
|
view()->trackView()->setProxyModel( new QueueProxyModel( view()->trackView() ) );
|
||||||
trackView()->proxyModel()->setStyle( PlayableProxyModel::Fancy );
|
view()->trackView()->proxyModel()->setStyle( PlayableProxyModel::Fancy );
|
||||||
trackView()->setHeaderHidden( true );
|
view()->trackView()->setHeaderHidden( true );
|
||||||
trackView()->setUniformRowHeights( false );
|
view()->trackView()->setUniformRowHeights( false );
|
||||||
|
|
||||||
PlaylistModel* queueModel = new PlaylistModel( trackView() );
|
PlaylistModel* queueModel = new PlaylistModel( view()->trackView() );
|
||||||
queueModel->setAcceptPlayableQueriesOnly( true );
|
queueModel->setAcceptPlayableQueriesOnly( true );
|
||||||
queueModel->setReadOnly( false );
|
queueModel->setReadOnly( false );
|
||||||
queueModel->setTitle( tr( "Queue" ) );
|
queueModel->setTitle( tr( "Queue" ) );
|
||||||
|
setPixmap( TomahawkUtils::defaultPixmap( TomahawkUtils::Queue ) );
|
||||||
|
|
||||||
setPlayableModel( queueModel );
|
view()->trackView()->setPlayableModel( queueModel );
|
||||||
setEmptyTip( tr( "The queue is currently empty. Drop something to enqueue it!" ) );
|
view()->setEmptyTip( tr( "The queue is currently empty. Drop something to enqueue it!" ) );
|
||||||
|
|
||||||
TrackItemDelegate* delegate = new TrackItemDelegate( TrackItemDelegate::LovedTracks, trackView(), trackView()->proxyModel() );
|
TrackItemDelegate* delegate = new TrackItemDelegate( TrackItemDelegate::LovedTracks, view()->trackView(), view()->trackView()->proxyModel() );
|
||||||
trackView()->setPlaylistItemDelegate( delegate );
|
view()->trackView()->setPlaylistItemDelegate( delegate );
|
||||||
|
|
||||||
if ( Pipeline::instance()->isRunning() && SourceList::instance()->isReady() )
|
if ( Pipeline::instance()->isRunning() && SourceList::instance()->isReady() )
|
||||||
{
|
{
|
||||||
@@ -91,7 +92,7 @@ QueueView::restoreState()
|
|||||||
|
|
||||||
if ( !ql.isEmpty() )
|
if ( !ql.isEmpty() )
|
||||||
{
|
{
|
||||||
trackView()->model()->appendQueries( ql );
|
view()->trackView()->model()->appendQueries( ql );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,7 +101,7 @@ void
|
|||||||
QueueView::saveState()
|
QueueView::saveState()
|
||||||
{
|
{
|
||||||
QVariantList vl;
|
QVariantList vl;
|
||||||
foreach ( const query_ptr& query, trackView()->model()->queries() )
|
foreach ( const query_ptr& query, view()->trackView()->model()->queries() )
|
||||||
{
|
{
|
||||||
vl << query->toVariant();
|
vl << query->toVariant();
|
||||||
}
|
}
|
||||||
|
@@ -50,14 +50,14 @@ HistoryWidget::HistoryWidget( const source_ptr& source, QWidget* parent )
|
|||||||
else
|
else
|
||||||
m_model->setDescription( tr( "%1's recently played tracks" ).arg( source->friendlyName() ) );
|
m_model->setDescription( tr( "%1's recently played tracks" ).arg( source->friendlyName() ) );
|
||||||
|
|
||||||
trackView()->setIndentation( 0 );
|
view()->trackView()->setIndentation( 0 );
|
||||||
trackView()->setUniformRowHeights( false );
|
view()->trackView()->setUniformRowHeights( false );
|
||||||
|
|
||||||
setPlayableModel( m_model );
|
view()->trackView()->setPlayableModel( m_model );
|
||||||
setEmptyTip( tr( "Sorry, we could not find any recent plays!" ) );
|
view()->setEmptyTip( tr( "Sorry, we could not find any recent plays!" ) );
|
||||||
m_model->setSource( source );
|
m_model->setSource( source );
|
||||||
|
|
||||||
setGuid( QString( "recentplays/%1" ).arg( source->nodeId() ) );
|
view()->setGuid( QString( "recentplays/%1" ).arg( source->nodeId() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -747,7 +747,7 @@ AudioControls::droppedTracks( QList< query_ptr > tracks )
|
|||||||
{
|
{
|
||||||
// queue and play the first no matter what
|
// queue and play the first no matter what
|
||||||
GlobalActionManager::instance()->handlePlayTrack( tracks.first() );
|
GlobalActionManager::instance()->handlePlayTrack( tracks.first() );
|
||||||
ViewManager::instance()->queue()->trackView()->model()->appendQueries( tracks );
|
ViewManager::instance()->queue()->view()->trackView()->model()->appendQueries( tracks );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -119,7 +119,7 @@ TomahawkWindow::TomahawkWindow( QWidget* parent )
|
|||||||
new ViewManager( this );
|
new ViewManager( this );
|
||||||
QueueView* queueView = new QueueView();
|
QueueView* queueView = new QueueView();
|
||||||
ViewManager::instance()->setQueue( queueView );
|
ViewManager::instance()->setQueue( queueView );
|
||||||
AudioEngine::instance()->setQueue( queueView->trackView()->proxyModel()->playlistInterface() );
|
AudioEngine::instance()->setQueue( queueView->view()->trackView()->proxyModel()->playlistInterface() );
|
||||||
|
|
||||||
m_audioControls = new AudioControls( this );
|
m_audioControls = new AudioControls( this );
|
||||||
|
|
||||||
|
@@ -80,14 +80,14 @@ LovedTracksItem::activate()
|
|||||||
TopLovedTracksModel* raModel = new TopLovedTracksModel( pv );
|
TopLovedTracksModel* raModel = new TopLovedTracksModel( pv );
|
||||||
raModel->setTitle( text() );
|
raModel->setTitle( text() );
|
||||||
|
|
||||||
TrackItemDelegate* del = new TrackItemDelegate( TrackItemDelegate::LovedTracks, pv->trackView(), pv->trackView()->proxyModel() );
|
TrackItemDelegate* del = new TrackItemDelegate( TrackItemDelegate::LovedTracks, pv->view()->trackView(), pv->view()->trackView()->proxyModel() );
|
||||||
pv->trackView()->setPlaylistItemDelegate( del );
|
pv->view()->trackView()->setPlaylistItemDelegate( del );
|
||||||
|
|
||||||
pv->setEmptyTip( tr( "Sorry, we could not find any of your Favorites!" ) );
|
pv->view()->trackView()->setEmptyTip( tr( "Sorry, we could not find any of your Favorites!" ) );
|
||||||
if ( !par )
|
if ( !par )
|
||||||
{
|
{
|
||||||
raModel->setDescription( tr( "The most loved tracks from all your friends" ) );
|
raModel->setDescription( tr( "The most loved tracks from all your friends" ) );
|
||||||
pv->setGuid( QString( "lovedtracks" ) );
|
pv->view()->setGuid( QString( "lovedtracks" ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -96,10 +96,10 @@ LovedTracksItem::activate()
|
|||||||
else
|
else
|
||||||
raModel->setDescription( tr( "All of %1's loved tracks" ).arg( par->source()->friendlyName() ) );
|
raModel->setDescription( tr( "All of %1's loved tracks" ).arg( par->source()->friendlyName() ) );
|
||||||
|
|
||||||
pv->setGuid( QString( "lovedtracks/%1" ).arg( par->source()->nodeId() ) );
|
pv->view()->setGuid( QString( "lovedtracks/%1" ).arg( par->source()->nodeId() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
pv->setPlaylistModel( raModel );
|
pv->view()->trackView()->setPlayableModel( raModel );
|
||||||
raModel->setSource( !par ? source_ptr() : par->source() );
|
raModel->setSource( !par ? source_ptr() : par->source() );
|
||||||
|
|
||||||
m_lovedTracksPage = pv;
|
m_lovedTracksPage = pv;
|
||||||
|
@@ -152,7 +152,7 @@ PlaylistItem::doubleClicked()
|
|||||||
ViewPage* p = ViewManager::instance()->currentPage();
|
ViewPage* p = ViewManager::instance()->currentPage();
|
||||||
if ( FlexibleView* view = dynamic_cast< FlexibleView* >( p ) )
|
if ( FlexibleView* view = dynamic_cast< FlexibleView* >( p ) )
|
||||||
{
|
{
|
||||||
view->trackView()->startPlayingFromStart();
|
view->view()->trackView()->startPlayingFromStart();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -39,12 +39,13 @@ QueueItem::QueueItem( SourcesModel* model, SourceTreeItem* parent )
|
|||||||
m_text = tr( "Queue" );
|
m_text = tr( "Queue" );
|
||||||
m_icon = ImageRegistry::instance()->icon( RESPATH "images/queue.svg" );
|
m_icon = ImageRegistry::instance()->icon( RESPATH "images/queue.svg" );
|
||||||
|
|
||||||
connect( ViewManager::instance()->queue()->trackView()->proxyModel(), SIGNAL( itemCountChanged( uint ) ), SIGNAL( updated() ) );
|
connect( ViewManager::instance()->queue()->view()->trackView()->proxyModel(), SIGNAL( itemCountChanged( uint ) ), SIGNAL( updated() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QueueItem::~QueueItem()
|
QueueItem::~QueueItem()
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
QString
|
QString
|
||||||
@@ -78,7 +79,7 @@ QueueItem::setSortValue( int value )
|
|||||||
int
|
int
|
||||||
QueueItem::unlistenedCount() const
|
QueueItem::unlistenedCount() const
|
||||||
{
|
{
|
||||||
return ViewManager::instance()->queue()->trackView()->proxyModel()->rowCount();
|
return ViewManager::instance()->queue()->view()->trackView()->proxyModel()->rowCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -170,7 +171,7 @@ QueueItem::parsedDroppedTracks( const QList< Tomahawk::query_ptr >& tracks )
|
|||||||
{
|
{
|
||||||
if ( tracks.count() )
|
if ( tracks.count() )
|
||||||
{
|
{
|
||||||
ViewManager::instance()->queue()->trackView()->model()->appendQueries( tracks );
|
ViewManager::instance()->queue()->view()->trackView()->model()->appendQueries( tracks );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
tDebug() << "ERROR: Could not add empty track list to queue!";
|
tDebug() << "ERROR: Could not add empty track list to queue!";
|
||||||
|
@@ -619,13 +619,12 @@ SourceItem::latestAdditionsClicked()
|
|||||||
else
|
else
|
||||||
raModel->setDescription( tr( "Latest additions to %1's collection" ).arg( m_source->friendlyName() ) );
|
raModel->setDescription( tr( "Latest additions to %1's collection" ).arg( m_source->friendlyName() ) );
|
||||||
|
|
||||||
pv->setPlayableModel( raModel );
|
pv->view()->trackView()->setPlayableModel( raModel );
|
||||||
pv->trackView()->sortByColumn( PlayableModel::Age, Qt::DescendingOrder );
|
pv->view()->trackView()->sortByColumn( PlayableModel::Age, Qt::DescendingOrder );
|
||||||
pv->detailedView()->sortByColumn( PlayableModel::Age, Qt::DescendingOrder );
|
pv->view()->trackView()->setEmptyTip( tr( "Sorry, we could not find any recent additions!" ) );
|
||||||
pv->setEmptyTip( tr( "Sorry, we could not find any recent additions!" ) );
|
|
||||||
raModel->setSource( m_source );
|
raModel->setSource( m_source );
|
||||||
|
|
||||||
pv->setGuid( QString( "latestadditions/%1" ).arg( m_source->nodeId() ) );
|
pv->view()->setGuid( QString( "latestadditions/%1" ).arg( m_source->nodeId() ) );
|
||||||
|
|
||||||
m_latestAdditionsPage = pv;
|
m_latestAdditionsPage = pv;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user