1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-08 23:26:40 +02:00

* Made Artist- / TreeView the default view. Disabled album mode for this release.

This commit is contained in:
Christian Muehlhaeuser
2011-05-19 08:00:57 +02:00
parent c2982e7312
commit 03451c9197
12 changed files with 68 additions and 42 deletions

View File

@@ -18,28 +18,28 @@ QRadioButton::indicator {
} }
QRadioButton::indicator::unchecked { QRadioButton::indicator::unchecked {
background-image: url(:/data/images/view-toggle-inactive-centre.png); background-image: url(:/data/images/view-toggle-inactive-right.png);
image: url(:/data/images/view-toggle-icon-artist-inactive.png); image: url(:/data/images/view-toggle-icon-list-inactive.png);
} }
QRadioButton::indicator::checked { QRadioButton::indicator::checked {
background-image: url(:/data/images/view-toggle-active-centre.png); background-image: url(:/data/images/view-toggle-active-right.png);
image: url(:/data/images/view-toggle-icon-artist-active.png); image: url(:/data/images/view-toggle-icon-list-active.png);
} }
QRadioButton::indicator::pressed { QRadioButton::indicator::pressed {
background-image: url(:/data/images/view-toggle-pressed-centre.png); background-image: url(:/data/images/view-toggle-pressed-right.png);
image: url(:/data/images/view-toggle-icon-artist-active.png); image: url(:/data/images/view-toggle-icon-list-active.png);
} }
QRadioButton#radioNormal::indicator::unchecked { QRadioButton#radioNormal::indicator::unchecked {
background-image: url(:/data/images/view-toggle-inactive-left.png); background-image: url(:/data/images/view-toggle-inactive-left.png);
image: url(:/data/images/view-toggle-icon-list-inactive.png); image: url(:/data/images/view-toggle-icon-artist-inactive.png);
} }
QRadioButton#radioNormal::indicator::checked { QRadioButton#radioNormal::indicator::checked {
background-image: url(:/data/images/view-toggle-active-left.png); background-image: url(:/data/images/view-toggle-active-left.png);
image: url(:/data/images/view-toggle-icon-list-active.png); image: url(:/data/images/view-toggle-icon-artist-active.png);
} }
QRadioButton#radioNormal::indicator::pressed { QRadioButton#radioNormal::indicator::pressed {
background-image: url(:/data/images/view-toggle-pressed-left.png); background-image: url(:/data/images/view-toggle-pressed-left.png);
image: url(:/data/images/view-toggle-icon-list-active.png); image: url(:/data/images/view-toggle-icon-artist-active.png);
} }
QRadioButton#radioCloud::indicator::unchecked { QRadioButton#radioCloud::indicator::unchecked {
background-image: url(:/data/images/view-toggle-inactive-right.png); background-image: url(:/data/images/view-toggle-inactive-right.png);

View File

@@ -88,7 +88,7 @@
<file>./data/images/music-settings.png</file> <file>./data/images/music-settings.png</file>
<file>./data/images/resolvers-settings.png</file> <file>./data/images/resolvers-settings.png</file>
<file>./data/images/lastfm-settings.png</file> <file>./data/images/lastfm-settings.png</file>
<file>./data/topbar-radiobuttons.css</file> <file>./data/stylesheets/topbar-radiobuttons.css</file>
<file>./data/icons/tomahawk-icon-16x16.png</file> <file>./data/icons/tomahawk-icon-16x16.png</file>
<file>./data/icons/tomahawk-icon-32x32.png</file> <file>./data/icons/tomahawk-icon-32x32.png</file>
<file>./data/icons/tomahawk-icon-64x64.png</file> <file>./data/icons/tomahawk-icon-64x64.png</file>

View File

@@ -46,6 +46,7 @@ ArtistView::ArtistView( QWidget* parent )
, m_proxyModel( 0 ) , m_proxyModel( 0 )
// , m_delegate( 0 ) // , m_delegate( 0 )
, m_loadingSpinner( new LoadingSpinner( this ) ) , m_loadingSpinner( new LoadingSpinner( this ) )
, m_showModes( true )
{ {
setAlternatingRowColors( true ); setAlternatingRowColors( true );
setDragEnabled( true ); setDragEnabled( true );

View File

@@ -55,7 +55,10 @@ public:
virtual QPixmap pixmap() const { return QPixmap( RESPATH "images/music-icon.png" ); } virtual QPixmap pixmap() const { return QPixmap( RESPATH "images/music-icon.png" ); }
virtual bool showStatsBar() const { return false; } virtual bool showStatsBar() const { return false; }
virtual bool showModes() const { return true; } virtual bool showFilter() const { return false; }
virtual void setShowModes( bool b ) { m_showModes = b; }
virtual bool showModes() const { return m_showModes; }
virtual bool jumpToCurrentTrack(); virtual bool jumpToCurrentTrack();
@@ -83,6 +86,7 @@ private:
LoadingSpinner* m_loadingSpinner; LoadingSpinner* m_loadingSpinner;
bool m_showModes;
QTimer m_timer; QTimer m_timer;
}; };

View File

@@ -47,6 +47,7 @@ public:
virtual QPixmap pixmap() const { return QPixmap( RESPATH "images/music-icon.png" ); } virtual QPixmap pixmap() const { return QPixmap( RESPATH "images/music-icon.png" ); }
virtual bool showModes() const { return true; } virtual bool showModes() const { return true; }
virtual bool showFilter() const { return true; }
virtual bool jumpToCurrentTrack(); virtual bool jumpToCurrentTrack();

View File

@@ -45,6 +45,8 @@ public:
virtual QWidget* widget() { return this; } virtual QWidget* widget() { return this; }
virtual PlaylistInterface* playlistInterface() const { return proxyModel(); } virtual PlaylistInterface* playlistInterface() const { return proxyModel(); }
virtual bool showFilter() const { return true; }
virtual QString title() const { return playlistModel()->title(); } virtual QString title() const { return playlistModel()->title(); }
virtual QString description() const { return m_model->description(); } virtual QString description() const { return m_model->description(); }
virtual QPixmap pixmap() const { return QPixmap( RESPATH "images/playlist-icon.png" ); } virtual QPixmap pixmap() const { return QPixmap( RESPATH "images/playlist-icon.png" ); }

View File

@@ -61,7 +61,7 @@ TopBar::TopBar( QWidget* parent )
m_dudes.append( manlbl ); m_dudes.append( manlbl );
} }
QFile f( RESPATH "topbar-radiobuttons.css" ); QFile f( RESPATH "stylesheets/topbar-radiobuttons.css" );
f.open( QFile::ReadOnly ); f.open( QFile::ReadOnly );
QString css = QString::fromAscii( f.readAll() ); QString css = QString::fromAscii( f.readAll() );
f.close(); f.close();
@@ -72,8 +72,10 @@ TopBar::TopBar( QWidget* parent )
ui->radioDetailed->setFocusPolicy( Qt::NoFocus ); ui->radioDetailed->setFocusPolicy( Qt::NoFocus );
ui->radioCloud->setFocusPolicy( Qt::NoFocus ); ui->radioCloud->setFocusPolicy( Qt::NoFocus );
connect( ui->radioNormal, SIGNAL( clicked() ), SIGNAL( flatMode() ) ); ui->radioCloud->hide();
connect( ui->radioDetailed, SIGNAL( clicked() ), SIGNAL( artistMode() ) );
connect( ui->radioNormal, SIGNAL( clicked() ), SIGNAL( artistMode() ) );
connect( ui->radioDetailed, SIGNAL( clicked() ), SIGNAL( flatMode() ) );
connect( ui->radioCloud, SIGNAL( clicked() ), SIGNAL( albumMode() ) ); connect( ui->radioCloud, SIGNAL( clicked() ), SIGNAL( albumMode() ) );
setNumSources( 0 ); setNumSources( 0 );
@@ -81,7 +83,7 @@ TopBar::TopBar( QWidget* parent )
setNumArtists( 0 ); setNumArtists( 0 );
setNumShown( 0 ); setNumShown( 0 );
onFlatMode(); onArtistMode();
connect( ViewManager::instance(), SIGNAL( numSourcesChanged( unsigned int ) ), connect( ViewManager::instance(), SIGNAL( numSourcesChanged( unsigned int ) ),
SLOT( setNumSources( unsigned int ) ) ); SLOT( setNumSources( unsigned int ) ) );
@@ -101,6 +103,9 @@ TopBar::TopBar( QWidget* parent )
connect( ViewManager::instance(), SIGNAL( modesAvailable( bool ) ), connect( ViewManager::instance(), SIGNAL( modesAvailable( bool ) ),
SLOT( setModesVisible( bool ) ) ); SLOT( setModesVisible( bool ) ) );
connect( ViewManager::instance(), SIGNAL( filterAvailable( bool ) ),
SLOT( setFilterVisible( bool ) ) );
connect( ViewManager::instance(), SIGNAL( modeChanged( PlaylistInterface::ViewMode ) ), connect( ViewManager::instance(), SIGNAL( modeChanged( PlaylistInterface::ViewMode ) ),
SLOT( onModeChanged( PlaylistInterface::ViewMode ) ) ); SLOT( onModeChanged( PlaylistInterface::ViewMode ) ) );
} }
@@ -270,6 +275,13 @@ TopBar::setModesVisible( bool b )
} }
void
TopBar::setFilterVisible( bool b )
{
ui->filterEdit->setEnabled( b );
}
void void
TopBar::setFilter( const QString& filter ) TopBar::setFilter( const QString& filter )
{ {
@@ -304,14 +316,14 @@ TopBar::onModeChanged( PlaylistInterface::ViewMode mode )
void void
TopBar::onFlatMode() TopBar::onFlatMode()
{ {
ui->radioNormal->setChecked( true ); ui->radioDetailed->setChecked( true );
} }
void void
TopBar::onArtistMode() TopBar::onArtistMode()
{ {
ui->radioDetailed->setChecked( true ); ui->radioNormal->setChecked( true );
} }

View File

@@ -55,6 +55,7 @@ public slots:
void setStatsVisible( bool b ); void setStatsVisible( bool b );
void setModesVisible( bool b ); void setModesVisible( bool b );
void setFilterVisible( bool b );
void addSource(); void addSource();
void removeSource(); void removeSource();

View File

@@ -31,7 +31,7 @@ class DLLEXPORT PlaylistInterface
{ {
public: public:
enum RepeatMode { NoRepeat, RepeatOne, RepeatAll }; enum RepeatMode { NoRepeat, RepeatOne, RepeatAll };
enum ViewMode { Unknown, Flat, Tree, Album }; enum ViewMode { Unknown, Tree, Flat, Album };
PlaylistInterface( QObject* parent = 0 ) : m_object( parent ) {} PlaylistInterface( QObject* parent = 0 ) : m_object( parent ) {}
virtual ~PlaylistInterface() {} virtual ~PlaylistInterface() {}

View File

@@ -67,7 +67,7 @@ ViewManager::ViewManager( QObject* parent )
: QObject( parent ) : QObject( parent )
, m_widget( new QWidget() ) , m_widget( new QWidget() )
, m_welcomeWidget( new WelcomeWidget() ) , m_welcomeWidget( new WelcomeWidget() )
, m_currentMode( 0 ) , m_currentMode( PlaylistInterface::Tree )
{ {
s_instance = this; s_instance = this;
@@ -107,6 +107,7 @@ ViewManager::ViewManager( QObject* parent )
m_superCollectionView->setModel( m_superCollectionModel ); m_superCollectionView->setModel( m_superCollectionModel );
m_superCollectionView->setFrameShape( QFrame::NoFrame ); m_superCollectionView->setFrameShape( QFrame::NoFrame );
m_superCollectionView->setAttribute( Qt::WA_MacShowFocusRect, 0 ); m_superCollectionView->setAttribute( Qt::WA_MacShowFocusRect, 0 );
m_superCollectionView->setShowModes( false );
// m_superCollectionView->proxyModel()->setShowOfflineResults( false ); // m_superCollectionView->proxyModel()->setShowOfflineResults( false );
m_superAlbumView = new AlbumView(); m_superAlbumView = new AlbumView();
@@ -275,7 +276,7 @@ ViewManager::show( const Tomahawk::collection_ptr& collection )
qDebug() << Q_FUNC_INFO << m_currentMode; qDebug() << Q_FUNC_INFO << m_currentMode;
m_currentCollection = collection; m_currentCollection = collection;
ViewPage* shown = 0; ViewPage* shown = 0;
if ( m_currentMode == 0 ) if ( m_currentMode == PlaylistInterface::Flat )
{ {
CollectionView* view; CollectionView* view;
if ( !m_collectionViews.contains( collection ) ) if ( !m_collectionViews.contains( collection ) )
@@ -299,7 +300,7 @@ ViewManager::show( const Tomahawk::collection_ptr& collection )
setPage( view ); setPage( view );
} }
if ( m_currentMode == 1 ) if ( m_currentMode == PlaylistInterface::Tree )
{ {
ArtistView* view; ArtistView* view;
if ( !m_treeViews.contains( collection ) ) if ( !m_treeViews.contains( collection ) )
@@ -323,7 +324,7 @@ ViewManager::show( const Tomahawk::collection_ptr& collection )
setPage( view ); setPage( view );
} }
if ( m_currentMode == 2 ) if ( m_currentMode == PlaylistInterface::Album )
{ {
AlbumView* aview; AlbumView* aview;
if ( !m_collectionAlbumViews.contains( collection ) ) if ( !m_collectionAlbumViews.contains( collection ) )
@@ -401,17 +402,17 @@ ViewManager::showSuperCollection()
m_superAlbumModel->setTitle( tr( "All available albums" ) ); m_superAlbumModel->setTitle( tr( "All available albums" ) );
ViewPage* shown = 0; ViewPage* shown = 0;
if ( m_currentMode == 0 ) if ( m_currentMode == PlaylistInterface::Tree )
{ {
shown = m_superCollectionView; shown = m_superCollectionView;
setPage( m_superCollectionView ); setPage( m_superCollectionView );
} }
else if ( m_currentMode == 1 ) else if ( m_currentMode == PlaylistInterface::Flat )
{ {
shown = m_superCollectionView; shown = m_superCollectionView;
setPage( m_superCollectionView ); setPage( m_superCollectionView );
} }
else if ( m_currentMode == 2 ) else if ( m_currentMode == PlaylistInterface::Album )
{ {
shown = m_superAlbumView; shown = m_superAlbumView;
setPage( m_superAlbumView ); setPage( m_superAlbumView );
@@ -450,7 +451,7 @@ ViewManager::setTableMode()
{ {
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
m_currentMode = 0; m_currentMode = PlaylistInterface::Flat;
if ( isSuperCollectionVisible() ) if ( isSuperCollectionVisible() )
showSuperCollection(); showSuperCollection();
@@ -464,7 +465,7 @@ ViewManager::setTreeMode()
{ {
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
m_currentMode = 1; m_currentMode = PlaylistInterface::Tree;
if ( isSuperCollectionVisible() ) if ( isSuperCollectionVisible() )
showSuperCollection(); showSuperCollection();
@@ -478,7 +479,7 @@ ViewManager::setAlbumMode()
{ {
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
m_currentMode = 2; m_currentMode = PlaylistInterface::Album;
if ( isSuperCollectionVisible() ) if ( isSuperCollectionVisible() )
showSuperCollection(); showSuperCollection();
@@ -705,8 +706,9 @@ ViewManager::updateView()
emit statsAvailable( currentPage()->showStatsBar() ); emit statsAvailable( currentPage()->showStatsBar() );
emit modesAvailable( currentPage()->showModes() ); emit modesAvailable( currentPage()->showModes() );
emit filterAvailable( currentPage()->showFilter() );
if ( !currentPage()->showStatsBar() && !currentPage()->showModes() ) if ( !currentPage()->showStatsBar() && !currentPage()->showModes() && !currentPage()->showFilter() )
m_topbar->setVisible( false ); m_topbar->setVisible( false );
else else
m_topbar->setVisible( true ); m_topbar->setVisible( true );

View File

@@ -90,6 +90,7 @@ public:
// only use this is you need to create a playlist and show it directly and want it to be // only use this is you need to create a playlist and show it directly and want it to be
// linked to the sidebar. call it right after creating the playlist // linked to the sidebar. call it right after creating the playlist
PlaylistView* createPageForPlaylist( const Tomahawk::playlist_ptr& pl ); PlaylistView* createPageForPlaylist( const Tomahawk::playlist_ptr& pl );
signals: signals:
void numSourcesChanged( unsigned int sources ); void numSourcesChanged( unsigned int sources );
void numTracksChanged( unsigned int tracks ); void numTracksChanged( unsigned int tracks );
@@ -101,6 +102,7 @@ signals:
void statsAvailable( bool b ); void statsAvailable( bool b );
void modesAvailable( bool b ); void modesAvailable( bool b );
void filterAvailable( bool b );
void modeChanged( PlaylistInterface::ViewMode mode ); void modeChanged( PlaylistInterface::ViewMode mode );
void playClicked(); void playClicked();

View File

@@ -46,6 +46,7 @@ public:
virtual bool showStatsBar() const { return true; } virtual bool showStatsBar() const { return true; }
virtual bool showModes() const { return false; } virtual bool showModes() const { return false; }
virtual bool showFilter() const { return false; }
virtual bool queueVisible() const { return true; } virtual bool queueVisible() const { return true; }
virtual bool jumpToCurrentTrack() = 0; virtual bool jumpToCurrentTrack() = 0;