1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-04-13 04:21:51 +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 {
background-image: url(:/data/images/view-toggle-inactive-centre.png);
image: url(:/data/images/view-toggle-icon-artist-inactive.png);
background-image: url(:/data/images/view-toggle-inactive-right.png);
image: url(:/data/images/view-toggle-icon-list-inactive.png);
}
QRadioButton::indicator::checked {
background-image: url(:/data/images/view-toggle-active-centre.png);
image: url(:/data/images/view-toggle-icon-artist-active.png);
background-image: url(:/data/images/view-toggle-active-right.png);
image: url(:/data/images/view-toggle-icon-list-active.png);
}
QRadioButton::indicator::pressed {
background-image: url(:/data/images/view-toggle-pressed-centre.png);
image: url(:/data/images/view-toggle-icon-artist-active.png);
background-image: url(:/data/images/view-toggle-pressed-right.png);
image: url(:/data/images/view-toggle-icon-list-active.png);
}
QRadioButton#radioNormal::indicator::unchecked {
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 {
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 {
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 {
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/resolvers-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-32x32.png</file>
<file>./data/icons/tomahawk-icon-64x64.png</file>

View File

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

View File

@ -55,7 +55,10 @@ public:
virtual QPixmap pixmap() const { return QPixmap( RESPATH "images/music-icon.png" ); }
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();
@ -83,6 +86,7 @@ private:
LoadingSpinner* m_loadingSpinner;
bool m_showModes;
QTimer m_timer;
};

View File

@ -1,5 +1,5 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
*
* Tomahawk is free software: you can redistribute it and/or modify
@ -45,8 +45,9 @@ public:
virtual QString title() const { return model()->title(); }
virtual QString description() const { return model()->description(); }
virtual QPixmap pixmap() const { return QPixmap( RESPATH "images/music-icon.png" ); }
virtual bool showModes() const { return true; }
virtual bool showFilter() const { return true; }
virtual bool jumpToCurrentTrack();

View File

@ -45,6 +45,8 @@ public:
virtual QWidget* widget() { return this; }
virtual PlaylistInterface* playlistInterface() const { return proxyModel(); }
virtual bool showFilter() const { return true; }
virtual QString title() const { return playlistModel()->title(); }
virtual QString description() const { return m_model->description(); }
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 );
}
QFile f( RESPATH "topbar-radiobuttons.css" );
QFile f( RESPATH "stylesheets/topbar-radiobuttons.css" );
f.open( QFile::ReadOnly );
QString css = QString::fromAscii( f.readAll() );
f.close();
@ -72,8 +72,10 @@ TopBar::TopBar( QWidget* parent )
ui->radioDetailed->setFocusPolicy( Qt::NoFocus );
ui->radioCloud->setFocusPolicy( Qt::NoFocus );
connect( ui->radioNormal, SIGNAL( clicked() ), SIGNAL( flatMode() ) );
connect( ui->radioDetailed, SIGNAL( clicked() ), SIGNAL( artistMode() ) );
ui->radioCloud->hide();
connect( ui->radioNormal, SIGNAL( clicked() ), SIGNAL( artistMode() ) );
connect( ui->radioDetailed, SIGNAL( clicked() ), SIGNAL( flatMode() ) );
connect( ui->radioCloud, SIGNAL( clicked() ), SIGNAL( albumMode() ) );
setNumSources( 0 );
@ -81,28 +83,31 @@ TopBar::TopBar( QWidget* parent )
setNumArtists( 0 );
setNumShown( 0 );
onFlatMode();
onArtistMode();
connect( ViewManager::instance(), SIGNAL( numSourcesChanged( unsigned int ) ),
SLOT( setNumSources( unsigned int ) ) );
SLOT( setNumSources( unsigned int ) ) );
connect( ViewManager::instance(), SIGNAL( numTracksChanged( unsigned int ) ),
SLOT( setNumTracks( unsigned int ) ) );
SLOT( setNumTracks( unsigned int ) ) );
connect( ViewManager::instance(), SIGNAL( numArtistsChanged( unsigned int ) ),
SLOT( setNumArtists( unsigned int ) ) );
SLOT( setNumArtists( unsigned int ) ) );
connect( ViewManager::instance(), SIGNAL( numShownChanged( unsigned int ) ),
SLOT( setNumShown( unsigned int ) ) );
SLOT( setNumShown( unsigned int ) ) );
connect( ViewManager::instance(), SIGNAL( statsAvailable( bool ) ),
SLOT( setStatsVisible( bool ) ) );
SLOT( setStatsVisible( 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 ) ),
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
TopBar::setFilter( const QString& filter )
{
@ -304,14 +316,14 @@ TopBar::onModeChanged( PlaylistInterface::ViewMode mode )
void
TopBar::onFlatMode()
{
ui->radioNormal->setChecked( true );
ui->radioDetailed->setChecked( true );
}
void
TopBar::onArtistMode()
{
ui->radioDetailed->setChecked( true );
ui->radioNormal->setChecked( true );
}

View File

@ -1,5 +1,5 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
*
* Tomahawk is free software: you can redistribute it and/or modify
@ -55,6 +55,7 @@ public slots:
void setStatsVisible( bool b );
void setModesVisible( bool b );
void setFilterVisible( bool b );
void addSource();
void removeSource();
@ -66,7 +67,7 @@ private slots:
void onFlatMode();
void onArtistMode();
void onAlbumMode();
protected:
void changeEvent( QEvent* e );
void resizeEvent( QResizeEvent* e );

View File

@ -1,5 +1,5 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
*
* Tomahawk is free software: you can redistribute it and/or modify
@ -31,8 +31,8 @@ class DLLEXPORT PlaylistInterface
{
public:
enum RepeatMode { NoRepeat, RepeatOne, RepeatAll };
enum ViewMode { Unknown, Flat, Tree, Album };
enum ViewMode { Unknown, Tree, Flat, Album };
PlaylistInterface( QObject* parent = 0 ) : m_object( parent ) {}
virtual ~PlaylistInterface() {}

View File

@ -67,7 +67,7 @@ ViewManager::ViewManager( QObject* parent )
: QObject( parent )
, m_widget( new QWidget() )
, m_welcomeWidget( new WelcomeWidget() )
, m_currentMode( 0 )
, m_currentMode( PlaylistInterface::Tree )
{
s_instance = this;
@ -107,6 +107,7 @@ ViewManager::ViewManager( QObject* parent )
m_superCollectionView->setModel( m_superCollectionModel );
m_superCollectionView->setFrameShape( QFrame::NoFrame );
m_superCollectionView->setAttribute( Qt::WA_MacShowFocusRect, 0 );
m_superCollectionView->setShowModes( false );
// m_superCollectionView->proxyModel()->setShowOfflineResults( false );
m_superAlbumView = new AlbumView();
@ -275,7 +276,7 @@ ViewManager::show( const Tomahawk::collection_ptr& collection )
qDebug() << Q_FUNC_INFO << m_currentMode;
m_currentCollection = collection;
ViewPage* shown = 0;
if ( m_currentMode == 0 )
if ( m_currentMode == PlaylistInterface::Flat )
{
CollectionView* view;
if ( !m_collectionViews.contains( collection ) )
@ -299,7 +300,7 @@ ViewManager::show( const Tomahawk::collection_ptr& collection )
setPage( view );
}
if ( m_currentMode == 1 )
if ( m_currentMode == PlaylistInterface::Tree )
{
ArtistView* view;
if ( !m_treeViews.contains( collection ) )
@ -323,7 +324,7 @@ ViewManager::show( const Tomahawk::collection_ptr& collection )
setPage( view );
}
if ( m_currentMode == 2 )
if ( m_currentMode == PlaylistInterface::Album )
{
AlbumView* aview;
if ( !m_collectionAlbumViews.contains( collection ) )
@ -401,17 +402,17 @@ ViewManager::showSuperCollection()
m_superAlbumModel->setTitle( tr( "All available albums" ) );
ViewPage* shown = 0;
if ( m_currentMode == 0 )
if ( m_currentMode == PlaylistInterface::Tree )
{
shown = m_superCollectionView;
setPage( m_superCollectionView );
}
else if ( m_currentMode == 1 )
else if ( m_currentMode == PlaylistInterface::Flat )
{
shown = m_superCollectionView;
setPage( m_superCollectionView );
}
else if ( m_currentMode == 2 )
else if ( m_currentMode == PlaylistInterface::Album )
{
shown = m_superAlbumView;
setPage( m_superAlbumView );
@ -450,7 +451,7 @@ ViewManager::setTableMode()
{
qDebug() << Q_FUNC_INFO;
m_currentMode = 0;
m_currentMode = PlaylistInterface::Flat;
if ( isSuperCollectionVisible() )
showSuperCollection();
@ -464,7 +465,7 @@ ViewManager::setTreeMode()
{
qDebug() << Q_FUNC_INFO;
m_currentMode = 1;
m_currentMode = PlaylistInterface::Tree;
if ( isSuperCollectionVisible() )
showSuperCollection();
@ -478,7 +479,7 @@ ViewManager::setAlbumMode()
{
qDebug() << Q_FUNC_INFO;
m_currentMode = 2;
m_currentMode = PlaylistInterface::Album;
if ( isSuperCollectionVisible() )
showSuperCollection();
@ -705,8 +706,9 @@ ViewManager::updateView()
emit statsAvailable( currentPage()->showStatsBar() );
emit modesAvailable( currentPage()->showModes() );
emit filterAvailable( currentPage()->showFilter() );
if ( !currentPage()->showStatsBar() && !currentPage()->showModes() )
if ( !currentPage()->showStatsBar() && !currentPage()->showModes() && !currentPage()->showFilter() )
m_topbar->setVisible( false );
else
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
// linked to the sidebar. call it right after creating the playlist
PlaylistView* createPageForPlaylist( const Tomahawk::playlist_ptr& pl );
signals:
void numSourcesChanged( unsigned int sources );
void numTracksChanged( unsigned int tracks );
@ -101,6 +102,7 @@ signals:
void statsAvailable( bool b );
void modesAvailable( bool b );
void filterAvailable( bool b );
void modeChanged( PlaylistInterface::ViewMode mode );
void playClicked();

View File

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