mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-13 20:39:57 +01:00
Show currently playing icon and support jumping for grid views
This commit is contained in:
parent
3e315f3a4a
commit
813e657ee4
@ -459,6 +459,8 @@ GridItemDelegate::onPlaybackFinished()
|
||||
foreach ( ImageButton* button, m_pauseButton )
|
||||
button->deleteLater();
|
||||
m_pauseButton.clear();
|
||||
|
||||
emit stoppedPlaying( QModelIndex() );
|
||||
}
|
||||
|
||||
|
||||
@ -501,6 +503,8 @@ GridItemDelegate::onPlaylistChanged( const QPersistentModelIndex& index )
|
||||
m_spinner[ index ]->deleteLater();
|
||||
m_spinner.remove( index );
|
||||
}
|
||||
|
||||
emit stoppedPlaying( index );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -532,6 +536,8 @@ GridItemDelegate::onPlaybackStarted( const QPersistentModelIndex& index )
|
||||
connect( button, SIGNAL( clicked( bool ) ), AudioEngine::instance(), SLOT( playPause() ) );
|
||||
|
||||
m_pauseButton[ index ] = button;
|
||||
|
||||
emit startedPlaying( index );
|
||||
}
|
||||
|
||||
|
||||
|
@ -58,6 +58,9 @@ protected:
|
||||
signals:
|
||||
void updateIndex( const QModelIndex& idx );
|
||||
|
||||
void startedPlaying( const QPersistentModelIndex& );
|
||||
void stoppedPlaying( const QPersistentModelIndex& );
|
||||
|
||||
private slots:
|
||||
void modelChanged();
|
||||
void doUpdateIndex( const QPersistentModelIndex& idx );
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "GridItemDelegate.h"
|
||||
#include "AlbumModel.h"
|
||||
#include "PlayableModel.h"
|
||||
#include "PlayableProxyModelPlaylistInterface.h"
|
||||
#include "ContextMenu.h"
|
||||
#include "ViewManager.h"
|
||||
#include "utils/Logger.h"
|
||||
@ -44,6 +45,32 @@
|
||||
|
||||
using namespace Tomahawk;
|
||||
|
||||
class GridPlaylistInterface : public PlayableProxyModelPlaylistInterface {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit GridPlaylistInterface( PlayableProxyModel* proxy, GridView* view ) : PlayableProxyModelPlaylistInterface( proxy ), m_view( view ) {}
|
||||
|
||||
virtual bool hasChildInterface( playlistinterface_ptr playlistInterface )
|
||||
{
|
||||
if ( m_view.isNull() || !m_view.data()->m_playing.isValid() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
PlayableItem* item = m_view.data()->model()->itemFromIndex( m_view.data()->proxyModel()->mapToSource( m_view.data()->m_playing ) );
|
||||
if ( item )
|
||||
{
|
||||
if ( !item->album().isNull() )
|
||||
return item->album()->playlistInterface( Tomahawk::Mixed ) == playlistInterface;
|
||||
else if ( !item->artist().isNull() )
|
||||
return item->artist()->playlistInterface( Tomahawk::Mixed ) == playlistInterface;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
private:
|
||||
QWeakPointer<GridView> m_view;
|
||||
};
|
||||
|
||||
GridView::GridView( QWidget* parent )
|
||||
: QListView( parent )
|
||||
@ -77,6 +104,8 @@ GridView::GridView( QWidget* parent )
|
||||
setAutoResize( false );
|
||||
setProxyModel( new PlayableProxyModel( this ) );
|
||||
|
||||
m_playlistInterface = playlistinterface_ptr( new GridPlaylistInterface( m_proxyModel, this ) );
|
||||
|
||||
connect( this, SIGNAL( doubleClicked( QModelIndex ) ), SLOT( onItemActivated( QModelIndex ) ) );
|
||||
connect( this, SIGNAL( customContextMenuRequested( QPoint ) ), SLOT( onCustomContextMenu( QPoint ) ) );
|
||||
|
||||
@ -103,6 +132,8 @@ GridView::setProxyModel( PlayableProxyModel* model )
|
||||
|
||||
m_delegate = new GridItemDelegate( this, m_proxyModel );
|
||||
connect( m_delegate, SIGNAL( updateIndex( QModelIndex ) ), this, SLOT( update( QModelIndex ) ) );
|
||||
connect( m_delegate, SIGNAL( startedPlaying( QPersistentModelIndex ) ), this, SLOT( onDelegatePlaying( QPersistentModelIndex ) ) );
|
||||
connect( m_delegate, SIGNAL( stoppedPlaying( QPersistentModelIndex ) ), this, SLOT( onDelegateStopped( QPersistentModelIndex ) ) );
|
||||
setItemDelegate( m_delegate );
|
||||
|
||||
QListView::setModel( m_proxyModel );
|
||||
@ -238,6 +269,21 @@ GridView::verifySize()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
GridView::onDelegatePlaying( const QPersistentModelIndex& index )
|
||||
{
|
||||
m_playing = index;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
GridView::onDelegateStopped( const QPersistentModelIndex& index )
|
||||
{
|
||||
if ( m_playing == index )
|
||||
m_playing = QPersistentModelIndex();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
GridView::layoutItems()
|
||||
{
|
||||
@ -356,3 +402,16 @@ GridView::setFilter( const QString& filter )
|
||||
m_proxyModel->setFilter( filter );
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
GridView::jumpToCurrentTrack()
|
||||
{
|
||||
if ( !m_playing.isValid() )
|
||||
return false;
|
||||
|
||||
scrollTo( m_playing, QListView::PositionAtCenter );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#include "GridView.moc"
|
||||
|
@ -37,6 +37,7 @@ namespace Tomahawk
|
||||
class AnimatedSpinner;
|
||||
class GridItemDelegate;
|
||||
class PlayableModel;
|
||||
class GridPlaylistInterface;
|
||||
|
||||
class DLLEXPORT GridView : public QListView, public Tomahawk::ViewPage
|
||||
{
|
||||
@ -64,13 +65,15 @@ public:
|
||||
void setEmptyTip( const QString& tip );
|
||||
|
||||
virtual QWidget* widget() { return this; }
|
||||
virtual Tomahawk::playlistinterface_ptr playlistInterface() const { return proxyModel()->playlistInterface(); }
|
||||
virtual Tomahawk::playlistinterface_ptr playlistInterface() const { return m_playlistInterface; }
|
||||
|
||||
virtual QString title() const { return m_model->title(); }
|
||||
virtual QString description() const { return m_model->description(); }
|
||||
|
||||
virtual bool setFilter( const QString& filter );
|
||||
virtual bool jumpToCurrentTrack() { return false; }
|
||||
virtual bool jumpToCurrentTrack();
|
||||
|
||||
virtual bool isBeingPlayed() const { return m_playing.isValid(); }
|
||||
|
||||
public slots:
|
||||
void onItemActivated( const QModelIndex& index );
|
||||
@ -94,6 +97,9 @@ private slots:
|
||||
void onFilterChanged( const QString& filter );
|
||||
void onCustomContextMenu( const QPoint& pos );
|
||||
|
||||
void onDelegatePlaying( const QPersistentModelIndex& idx );
|
||||
void onDelegateStopped( const QPersistentModelIndex& idx );
|
||||
|
||||
void layoutItems();
|
||||
void verifySize();
|
||||
|
||||
@ -103,8 +109,11 @@ private:
|
||||
GridItemDelegate* m_delegate;
|
||||
AnimatedSpinner* m_loadingSpinner;
|
||||
OverlayWidget* m_overlay;
|
||||
Tomahawk::playlistinterface_ptr m_playlistInterface;
|
||||
|
||||
QModelIndex m_contextMenuIndex;
|
||||
QPersistentModelIndex m_playing;
|
||||
|
||||
Tomahawk::ContextMenu* m_contextMenu;
|
||||
|
||||
QString m_emptyTip;
|
||||
@ -113,6 +122,8 @@ private:
|
||||
bool m_autoResize;
|
||||
|
||||
QRect m_paintRect;
|
||||
|
||||
friend ::GridPlaylistInterface;
|
||||
};
|
||||
|
||||
#endif // GRIDVIEW_H
|
||||
|
@ -43,6 +43,54 @@
|
||||
using namespace Tomahawk;
|
||||
|
||||
|
||||
class WelcomeWidgetInterface : public Tomahawk::PlaylistInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit WelcomeWidgetInterface( WelcomeWidget* w )
|
||||
: PlaylistInterface()
|
||||
, m_w( w )
|
||||
{
|
||||
connect( m_w->ui->tracksView->proxyModel()->playlistInterface().data(), SIGNAL( repeatModeChanged( Tomahawk::PlaylistModes::RepeatMode ) ),
|
||||
SIGNAL( repeatModeChanged( Tomahawk::PlaylistModes::RepeatMode ) ) );
|
||||
|
||||
connect( m_w->ui->tracksView->proxyModel()->playlistInterface().data(), SIGNAL( shuffleModeChanged( bool ) ),
|
||||
SIGNAL( shuffleModeChanged( bool ) ) );
|
||||
}
|
||||
virtual ~WelcomeWidgetInterface() {}
|
||||
|
||||
|
||||
virtual Tomahawk::PlaylistModes::RepeatMode repeatMode() const { return m_w->ui->tracksView->proxyModel()->playlistInterface()->repeatMode(); }
|
||||
virtual bool shuffled() const { return m_w->ui->tracksView->proxyModel()->playlistInterface()->shuffled(); }
|
||||
|
||||
virtual Tomahawk::result_ptr currentItem() const { return m_w->ui->tracksView->proxyModel()->playlistInterface()->currentItem(); }
|
||||
virtual Tomahawk::result_ptr siblingItem( int itemsAway ) { return m_w->ui->tracksView->proxyModel()->playlistInterface()->siblingItem( itemsAway ); }
|
||||
virtual int trackCount() const { return m_w->ui->tracksView->proxyModel()->playlistInterface()->trackCount(); }
|
||||
virtual QList< Tomahawk::query_ptr > tracks() { return m_w->ui->tracksView->proxyModel()->playlistInterface()->tracks(); }
|
||||
|
||||
virtual bool hasChildInterface( Tomahawk::playlistinterface_ptr other )
|
||||
{
|
||||
return m_w->ui->tracksView->proxyModel()->playlistInterface() == other ||
|
||||
m_w->ui->tracksView->proxyModel()->playlistInterface()->hasChildInterface( other ) ||
|
||||
m_w->ui->additionsView->playlistInterface()->hasChildInterface( other );
|
||||
}
|
||||
|
||||
virtual void setRepeatMode( Tomahawk::PlaylistModes::RepeatMode mode )
|
||||
{
|
||||
m_w->ui->tracksView->proxyModel()->playlistInterface()->setRepeatMode( mode );
|
||||
}
|
||||
|
||||
virtual void setShuffled( bool enabled )
|
||||
{
|
||||
m_w->ui->tracksView->proxyModel()->playlistInterface()->setShuffled( enabled );
|
||||
}
|
||||
|
||||
private:
|
||||
WelcomeWidget* m_w;
|
||||
|
||||
};
|
||||
|
||||
|
||||
WelcomeWidget::WelcomeWidget( QWidget* parent )
|
||||
: QWidget( parent )
|
||||
, ui( new Ui::WelcomeWidget )
|
||||
@ -78,6 +126,8 @@ WelcomeWidget::WelcomeWidget( QWidget* parent )
|
||||
ui->additionsView->setPlayableModel( m_recentAlbumsModel );
|
||||
ui->additionsView->proxyModel()->sort( -1 );
|
||||
|
||||
m_playlistInterface = playlistinterface_ptr( new WelcomeWidgetInterface( this ) );
|
||||
|
||||
connect( SourceList::instance(), SIGNAL( ready() ), SLOT( onSourcesReady() ) );
|
||||
connect( SourceList::instance(), SIGNAL( sourceAdded( Tomahawk::source_ptr ) ), SLOT( onSourceAdded( Tomahawk::source_ptr ) ) );
|
||||
connect( ui->playlistWidget, SIGNAL( activated( QModelIndex ) ), SLOT( onPlaylistActivated( QModelIndex ) ) );
|
||||
@ -101,20 +151,29 @@ WelcomeWidget::loadData()
|
||||
Tomahawk::playlistinterface_ptr
|
||||
WelcomeWidget::playlistInterface() const
|
||||
{
|
||||
return ui->tracksView->playlistInterface();
|
||||
return m_playlistInterface;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
WelcomeWidget::jumpToCurrentTrack()
|
||||
{
|
||||
return ui->tracksView->jumpToCurrentTrack();
|
||||
if ( ui->tracksView->jumpToCurrentTrack() )
|
||||
return true;
|
||||
|
||||
if ( ui->additionsView->jumpToCurrentTrack() )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
WelcomeWidget::isBeingPlayed() const
|
||||
{
|
||||
if ( ui->additionsView->isBeingPlayed() )
|
||||
return true;
|
||||
|
||||
return AudioEngine::instance()->currentTrackPlaylist() == ui->tracksView->playlistInterface();
|
||||
}
|
||||
|
||||
@ -320,3 +379,4 @@ PlaylistWidget::setModel( QAbstractItemModel* model )
|
||||
emit modelChanged();
|
||||
}
|
||||
|
||||
#include "WelcomeWidget.moc"
|
||||
|
@ -37,6 +37,7 @@
|
||||
class AlbumModel;
|
||||
class RecentlyPlayedModel;
|
||||
class OverlayWidget;
|
||||
class WelcomeWidgetInterface;
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
@ -125,6 +126,9 @@ private:
|
||||
|
||||
RecentlyPlayedModel* m_tracksModel;
|
||||
AlbumModel* m_recentAlbumsModel;
|
||||
Tomahawk::playlistinterface_ptr m_playlistInterface;
|
||||
|
||||
friend class ::WelcomeWidgetInterface;
|
||||
};
|
||||
|
||||
#endif // WELCOMEWIDGET_H
|
||||
|
@ -130,6 +130,9 @@ WhatsHotWidget::isBeingPlayed() const
|
||||
if ( AudioEngine::instance()->currentTrackPlaylist() == ui->tracksViewLeft->playlistInterface() )
|
||||
return true;
|
||||
|
||||
if ( ui->albumsView->isBeingPlayed() )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -137,10 +140,13 @@ WhatsHotWidget::isBeingPlayed() const
|
||||
bool
|
||||
WhatsHotWidget::jumpToCurrentTrack()
|
||||
{
|
||||
if ( ui->artistsViewLeft->jumpToCurrentTrack() )
|
||||
if ( ui->artistsViewLeft->model() && ui->artistsViewLeft->jumpToCurrentTrack() )
|
||||
return true;
|
||||
|
||||
if ( ui->tracksViewLeft->jumpToCurrentTrack() )
|
||||
if ( ui->tracksViewLeft->model() && ui->tracksViewLeft->jumpToCurrentTrack() )
|
||||
return true;
|
||||
|
||||
if ( ui->albumsView->model() && ui->albumsView->jumpToCurrentTrack() )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
@ -65,7 +65,8 @@ public:
|
||||
virtual bool hasChildInterface( Tomahawk::playlistinterface_ptr other )
|
||||
{
|
||||
return m_w->ui->tracksViewLeft->playlistInterface() == other ||
|
||||
m_w->ui->artistsViewLeft->playlistInterface() == other;
|
||||
m_w->ui->artistsViewLeft->playlistInterface() == other ||
|
||||
m_w->ui->albumsView->playlistInterface()->hasChildInterface( other );
|
||||
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include "AlbumInfoWidget.h"
|
||||
#include "ui_AlbumInfoWidget.h"
|
||||
#include "AlbumInfoWidget_p.h"
|
||||
|
||||
#include "audio/AudioEngine.h"
|
||||
#include "ViewManager.h"
|
||||
@ -61,6 +62,7 @@ AlbumInfoWidget::AlbumInfoWidget( const Tomahawk::album_ptr& album, QWidget* par
|
||||
|
||||
m_pixmap = TomahawkUtils::defaultPixmap( TomahawkUtils::DefaultAlbumCover, TomahawkUtils::ScaledCover, QSize( 48, 48 ) );
|
||||
|
||||
m_playlistInterface = playlistinterface_ptr( new MetaAlbumInfoInterface( this ) );
|
||||
load( album );
|
||||
}
|
||||
|
||||
@ -74,7 +76,7 @@ AlbumInfoWidget::~AlbumInfoWidget()
|
||||
Tomahawk::playlistinterface_ptr
|
||||
AlbumInfoWidget::playlistInterface() const
|
||||
{
|
||||
return ui->tracksView->playlistInterface();
|
||||
return m_playlistInterface;
|
||||
}
|
||||
|
||||
|
||||
@ -84,6 +86,10 @@ AlbumInfoWidget::isBeingPlayed() const
|
||||
//tDebug() << Q_FUNC_INFO << "audioengine playlistInterface = " << AudioEngine::instance()->currentTrackPlaylist()->id();
|
||||
//tDebug() << Q_FUNC_INFO << "albumsView playlistInterface = " << ui->albumsView->playlistInterface()->id();
|
||||
//tDebug() << Q_FUNC_INFO << "tracksView playlistInterface = " << ui->tracksView->playlistInterface()->id();
|
||||
|
||||
if ( ui->albumsView->isBeingPlayed() )
|
||||
return true;
|
||||
|
||||
if ( ui->albumsView->playlistInterface() == AudioEngine::instance()->currentTrackPlaylist() )
|
||||
return true;
|
||||
|
||||
@ -94,6 +100,13 @@ AlbumInfoWidget::isBeingPlayed() const
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
AlbumInfoWidget::jumpToCurrentTrack()
|
||||
{
|
||||
return ui->albumsView->jumpToCurrentTrack();
|
||||
}
|
||||
|
||||
|
||||
artist_ptr AlbumInfoWidget::descriptionArtist() const
|
||||
{
|
||||
if ( !m_album.isNull() && !m_album->artist().isNull() )
|
||||
|
@ -41,6 +41,7 @@
|
||||
|
||||
class PlayableModel;
|
||||
class TreeModel;
|
||||
class MetaAlbumInfoInterface;
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
@ -70,7 +71,7 @@ public:
|
||||
virtual bool isTemporaryPage() const { return true; }
|
||||
virtual bool isBeingPlayed() const;
|
||||
|
||||
virtual bool jumpToCurrentTrack() { return false; }
|
||||
virtual bool jumpToCurrentTrack();
|
||||
|
||||
public slots:
|
||||
/** \brief Loads information for a given album.
|
||||
@ -104,10 +105,14 @@ private:
|
||||
PlayableModel* m_albumsModel;
|
||||
TreeModel* m_tracksModel;
|
||||
|
||||
Tomahawk::playlistinterface_ptr m_playlistInterface;
|
||||
|
||||
QString m_title;
|
||||
QString m_description;
|
||||
QString m_longDescription;
|
||||
QPixmap m_pixmap;
|
||||
|
||||
friend class MetaAlbumInfoInterface;
|
||||
};
|
||||
|
||||
#endif // ALBUMINFOWIDGET_H
|
||||
|
78
src/libtomahawk/widgets/infowidgets/AlbumInfoWidget_p.h
Normal file
78
src/libtomahawk/widgets/infowidgets/AlbumInfoWidget_p.h
Normal file
@ -0,0 +1,78 @@
|
||||
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
|
||||
*
|
||||
* Copyright 2012, Leo Franchi <lfranchi@kde.org>
|
||||
*
|
||||
* Tomahawk is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Tomahawk is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef ALBUMINFOWIDGET_P_H
|
||||
#define ALBUMINFOWIDGET_P_H
|
||||
|
||||
#include "AlbumInfoWidget.h"
|
||||
#include "ui_AlbumInfoWidget.h"
|
||||
#include "PlaylistInterface.h"
|
||||
#include "TreeProxyModel.h"
|
||||
#include "Result.h"
|
||||
#include "Typedefs.h"
|
||||
|
||||
#include <QObject>
|
||||
|
||||
class MetaAlbumInfoInterface : public Tomahawk::PlaylistInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit MetaAlbumInfoInterface( AlbumInfoWidget* w )
|
||||
: PlaylistInterface()
|
||||
, m_w( w )
|
||||
{
|
||||
connect( m_w->ui->tracksView->proxyModel()->playlistInterface().data(), SIGNAL( repeatModeChanged( Tomahawk::PlaylistModes::RepeatMode ) ),
|
||||
SIGNAL( repeatModeChanged( Tomahawk::PlaylistModes::RepeatMode ) ) );
|
||||
|
||||
connect( m_w->ui->tracksView->proxyModel()->playlistInterface().data(), SIGNAL( shuffleModeChanged( bool ) ),
|
||||
SIGNAL( shuffleModeChanged( bool ) ) );
|
||||
}
|
||||
virtual ~MetaAlbumInfoInterface() {}
|
||||
|
||||
|
||||
virtual Tomahawk::PlaylistModes::RepeatMode repeatMode() const { return m_w->ui->tracksView->proxyModel()->playlistInterface()->repeatMode(); }
|
||||
virtual bool shuffled() const { return m_w->ui->tracksView->proxyModel()->playlistInterface()->shuffled(); }
|
||||
|
||||
virtual Tomahawk::result_ptr currentItem() const { return m_w->ui->tracksView->proxyModel()->playlistInterface()->currentItem(); }
|
||||
virtual Tomahawk::result_ptr siblingItem( int itemsAway ) { return m_w->ui->tracksView->proxyModel()->playlistInterface()->siblingItem( itemsAway ); }
|
||||
virtual int trackCount() const { return m_w->ui->tracksView->proxyModel()->playlistInterface()->trackCount(); }
|
||||
virtual QList< Tomahawk::query_ptr > tracks() { return m_w->ui->tracksView->proxyModel()->playlistInterface()->tracks(); }
|
||||
|
||||
virtual bool hasChildInterface( Tomahawk::playlistinterface_ptr other )
|
||||
{
|
||||
return m_w->ui->tracksView->proxyModel()->playlistInterface() == other ||
|
||||
m_w->ui->tracksView->proxyModel()->playlistInterface()->hasChildInterface( other ) ||
|
||||
m_w->ui->albumsView->playlistInterface()->hasChildInterface( other );
|
||||
}
|
||||
|
||||
virtual void setRepeatMode( Tomahawk::PlaylistModes::RepeatMode mode )
|
||||
{
|
||||
m_w->ui->tracksView->proxyModel()->playlistInterface()->setRepeatMode( mode );
|
||||
}
|
||||
|
||||
virtual void setShuffled( bool enabled )
|
||||
{
|
||||
m_w->ui->tracksView->proxyModel()->playlistInterface()->setShuffled( enabled );
|
||||
}
|
||||
|
||||
private:
|
||||
AlbumInfoWidget* m_w;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
@ -57,7 +57,7 @@ ArtistInfoWidget::ArtistInfoWidget( const Tomahawk::artist_ptr& artist, QWidget*
|
||||
widget->setPalette( pal );
|
||||
widget->setAutoFillBackground( true );
|
||||
|
||||
m_plInterface = Tomahawk::playlistinterface_ptr( new MetaPlaylistInterface( this ) );
|
||||
m_plInterface = Tomahawk::playlistinterface_ptr( new MetaArtistInfoInterface( this ) );
|
||||
|
||||
/* TomahawkUtils::unmarginLayout( ui->layoutWidget->layout() );
|
||||
TomahawkUtils::unmarginLayout( ui->layoutWidget1->layout() );
|
||||
@ -173,6 +173,12 @@ ArtistInfoWidget::playlistInterface() const
|
||||
bool
|
||||
ArtistInfoWidget::isBeingPlayed() const
|
||||
{
|
||||
if ( ui->albums->isBeingPlayed() )
|
||||
return true;
|
||||
|
||||
if ( ui->relatedArtists->isBeingPlayed() )
|
||||
return true;
|
||||
|
||||
if ( ui->albums->playlistInterface() == AudioEngine::instance()->currentTrackPlaylist() )
|
||||
return true;
|
||||
|
||||
@ -198,6 +204,12 @@ ArtistInfoWidget::jumpToCurrentTrack()
|
||||
if ( ui->topHits->jumpToCurrentTrack() )
|
||||
return true;
|
||||
|
||||
if ( ui->albums->jumpToCurrentTrack() )
|
||||
return true;
|
||||
|
||||
if ( ui->relatedArtists->jumpToCurrentTrack() )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,7 @@ namespace Ui
|
||||
class ArtistInfoWidget;
|
||||
}
|
||||
|
||||
class MetaPlaylistInterface;
|
||||
class MetaArtistInfoInterface;
|
||||
|
||||
class DLLEXPORT ArtistInfoWidget : public QWidget, public Tomahawk::ViewPage
|
||||
{
|
||||
@ -113,7 +113,7 @@ private:
|
||||
QString m_longDescription;
|
||||
QPixmap m_pixmap;
|
||||
|
||||
friend class MetaPlaylistInterface;
|
||||
friend class ::MetaArtistInfoInterface;
|
||||
};
|
||||
|
||||
#endif // ARTISTINFOWIDGET_H
|
||||
|
@ -29,11 +29,11 @@
|
||||
|
||||
#include <QObject>
|
||||
|
||||
class MetaPlaylistInterface : public Tomahawk::PlaylistInterface
|
||||
class MetaArtistInfoInterface : public Tomahawk::PlaylistInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit MetaPlaylistInterface( ArtistInfoWidget* w )
|
||||
explicit MetaArtistInfoInterface( ArtistInfoWidget* w )
|
||||
: PlaylistInterface()
|
||||
, m_w( w )
|
||||
{
|
||||
@ -51,7 +51,7 @@ public:
|
||||
connect( m_w->ui->topHits->proxyModel()->playlistInterface().data(), SIGNAL( shuffleModeChanged( bool ) ),
|
||||
SLOT( anyShuffleChanged( bool ) ) );
|
||||
}
|
||||
virtual ~MetaPlaylistInterface() {}
|
||||
virtual ~MetaArtistInfoInterface() {}
|
||||
|
||||
|
||||
// Any one is fine, we keep them all synched
|
||||
@ -70,7 +70,9 @@ public:
|
||||
{
|
||||
return ( m_w->ui->albums->playlistInterface() == other ) ||
|
||||
( m_w->ui->relatedArtists->playlistInterface() == other ) ||
|
||||
( m_w->ui->topHits->playlistInterface() == other );
|
||||
( m_w->ui->topHits->playlistInterface() == other ) ||
|
||||
( m_w->ui->albums->playlistInterface()->hasChildInterface( other ) ) ||
|
||||
( m_w->ui->relatedArtists->playlistInterface()->hasChildInterface( other ) );
|
||||
}
|
||||
|
||||
public slots:
|
||||
|
Loading…
x
Reference in New Issue
Block a user