1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-07-31 11:20:22 +02:00

* Renamed AlbumView to GridView.

This commit is contained in:
Christian Muehlhaeuser
2012-06-01 05:19:43 +02:00
parent 6d9b41dc02
commit a61f602855
15 changed files with 71 additions and 71 deletions

View File

@@ -62,7 +62,7 @@ set( libGuiSources
playlist/TrackHeader.cpp playlist/TrackHeader.cpp
playlist/AlbumModel.cpp playlist/AlbumModel.cpp
playlist/AlbumItemDelegate.cpp playlist/AlbumItemDelegate.cpp
playlist/AlbumView.cpp playlist/GridView.cpp
playlist/ArtistView.cpp playlist/ArtistView.cpp
playlist/CustomPlaylistView.cpp playlist/CustomPlaylistView.cpp
playlist/ViewHeader.cpp playlist/ViewHeader.cpp

View File

@@ -33,7 +33,7 @@
#include "PlayableProxyModel.h" #include "PlayableProxyModel.h"
#include "PlayableModel.h" #include "PlayableModel.h"
#include "ArtistView.h" #include "ArtistView.h"
#include "AlbumView.h" #include "GridView.h"
#include "AlbumModel.h" #include "AlbumModel.h"
#include "SourceList.h" #include "SourceList.h"
#include "TomahawkSettings.h" #include "TomahawkSettings.h"
@@ -99,9 +99,9 @@ ViewManager::ViewManager( QObject* parent )
m_superCollectionView->setShowModes( false ); m_superCollectionView->setShowModes( false );
// m_superCollectionView->proxyModel()->setShowOfflineResults( false ); // m_superCollectionView->proxyModel()->setShowOfflineResults( false );
m_superAlbumView = new AlbumView(); m_superGridView = new GridView();
m_superAlbumModel = new AlbumModel( m_superAlbumView ); m_superAlbumModel = new AlbumModel( m_superGridView );
m_superAlbumView->setPlayableModel( m_superAlbumModel ); m_superGridView->setPlayableModel( m_superAlbumModel );
m_stack->setContentsMargins( 0, 0, 0, 0 ); m_stack->setContentsMargins( 0, 0, 0, 0 );
m_widget->setContentsMargins( 0, 0, 0, 0 ); m_widget->setContentsMargins( 0, 0, 0, 0 );
@@ -321,19 +321,19 @@ ViewManager::show( const Tomahawk::collection_ptr& collection )
if ( m_currentMode == PlaylistModes::Album ) if ( m_currentMode == PlaylistModes::Album )
{ {
AlbumView* aview; GridView* aview;
if ( !m_collectionAlbumViews.contains( collection ) || m_collectionAlbumViews.value( collection ).isNull() ) if ( !m_collectionGridViews.contains( collection ) || m_collectionGridViews.value( collection ).isNull() )
{ {
aview = new AlbumView(); aview = new GridView();
AlbumModel* amodel = new AlbumModel( aview ); AlbumModel* amodel = new AlbumModel( aview );
aview->setPlayableModel( amodel ); aview->setPlayableModel( amodel );
amodel->addCollection( collection ); amodel->addCollection( collection );
m_collectionAlbumViews.insert( collection, aview ); m_collectionGridViews.insert( collection, aview );
} }
else else
{ {
aview = m_collectionAlbumViews.value( collection ).data(); aview = m_collectionGridViews.value( collection ).data();
} }
shown = aview; shown = aview;
@@ -406,8 +406,8 @@ ViewManager::showSuperCollection()
} }
else if ( m_currentMode == PlaylistModes::Album ) else if ( m_currentMode == PlaylistModes::Album )
{ {
shown = m_superAlbumView; shown = m_superGridView;
setPage( m_superAlbumView ); setPage( m_superGridView );
} }
emit numSourcesChanged( m_superCollections.count() ); emit numSourcesChanged( m_superCollections.count() );
@@ -993,11 +993,11 @@ ViewManager::dynamicPlaylistForInterface( Tomahawk::playlistinterface_ptr interf
Tomahawk::collection_ptr Tomahawk::collection_ptr
ViewManager::collectionForInterface( Tomahawk::playlistinterface_ptr interface ) const ViewManager::collectionForInterface( Tomahawk::playlistinterface_ptr interface ) const
{ {
foreach ( QWeakPointer<AlbumView> view, m_collectionAlbumViews.values() ) foreach ( QWeakPointer<GridView> view, m_collectionGridViews.values() )
{ {
if ( view.data()->playlistInterface() == interface ) if ( view.data()->playlistInterface() == interface )
{ {
return m_collectionAlbumViews.key( view ); return m_collectionGridViews.key( view );
} }
} }
@@ -1010,7 +1010,7 @@ ViewManager::isSuperCollectionVisible() const
{ {
return ( currentPage() != 0 && return ( currentPage() != 0 &&
( currentPage()->playlistInterface() == m_superCollectionView->playlistInterface() || ( currentPage()->playlistInterface() == m_superCollectionView->playlistInterface() ||
currentPage()->playlistInterface() == m_superAlbumView->playlistInterface() ) ); currentPage()->playlistInterface() == m_superGridView->playlistInterface() ) );
} }
@@ -1028,7 +1028,7 @@ ViewManager::showCurrentTrack()
if ( dynamic_cast< TrackView* >( page ) ) if ( dynamic_cast< TrackView* >( page ) )
m_currentMode = PlaylistModes::Flat; m_currentMode = PlaylistModes::Flat;
else if ( dynamic_cast< AlbumView* >( page ) ) else if ( dynamic_cast< GridView* >( page ) )
m_currentMode = PlaylistModes::Album; m_currentMode = PlaylistModes::Album;
else if ( dynamic_cast< ArtistView* >( page ) ) else if ( dynamic_cast< ArtistView* >( page ) )
m_currentMode = PlaylistModes::Tree; m_currentMode = PlaylistModes::Tree;

View File

@@ -34,7 +34,7 @@
class AnimatedSplitter; class AnimatedSplitter;
class AlbumModel; class AlbumModel;
class AlbumView; class GridView;
class AlbumInfoWidget; class AlbumInfoWidget;
class ArtistInfoWidget; class ArtistInfoWidget;
class ArtistView; class ArtistView;
@@ -202,7 +202,7 @@ private:
AnimatedSplitter* m_splitter; AnimatedSplitter* m_splitter;
AlbumModel* m_superAlbumModel; AlbumModel* m_superAlbumModel;
AlbumView* m_superAlbumView; GridView* m_superGridView;
TreeModel* m_superCollectionModel; TreeModel* m_superCollectionModel;
ArtistView* m_superCollectionView; ArtistView* m_superCollectionView;
QueueView* m_queue; QueueView* m_queue;
@@ -216,7 +216,7 @@ private:
QHash< Tomahawk::dynplaylist_ptr, QWeakPointer<Tomahawk::DynamicWidget> > m_dynamicWidgets; QHash< Tomahawk::dynplaylist_ptr, QWeakPointer<Tomahawk::DynamicWidget> > m_dynamicWidgets;
QHash< Tomahawk::collection_ptr, QWeakPointer<ArtistView> > m_treeViews; QHash< Tomahawk::collection_ptr, QWeakPointer<ArtistView> > m_treeViews;
QHash< Tomahawk::collection_ptr, QWeakPointer<AlbumView> > m_collectionAlbumViews; QHash< Tomahawk::collection_ptr, QWeakPointer<GridView> > m_collectionGridViews;
QHash< Tomahawk::artist_ptr, QWeakPointer<ArtistInfoWidget> > m_artistViews; QHash< Tomahawk::artist_ptr, QWeakPointer<ArtistInfoWidget> > m_artistViews;
QHash< Tomahawk::album_ptr, QWeakPointer<AlbumInfoWidget> > m_albumViews; QHash< Tomahawk::album_ptr, QWeakPointer<AlbumInfoWidget> > m_albumViews;
QHash< Tomahawk::query_ptr, QWeakPointer<TrackInfoWidget> > m_trackViews; QHash< Tomahawk::query_ptr, QWeakPointer<TrackInfoWidget> > m_trackViews;

View File

@@ -37,7 +37,7 @@
#include "playlist/PlayableItem.h" #include "playlist/PlayableItem.h"
#include "playlist/PlayableProxyModel.h" #include "playlist/PlayableProxyModel.h"
#include "AlbumView.h" #include "GridView.h"
#include "ViewManager.h" #include "ViewManager.h"
#include "utils/AnimatedSpinner.h" #include "utils/AnimatedSpinner.h"
#include "widgets/ImageButton.h" #include "widgets/ImageButton.h"
@@ -406,7 +406,7 @@ AlbumItemDelegate::modelChanged()
widget->deleteLater(); widget->deleteLater();
m_spinner.clear(); m_spinner.clear();
if ( AlbumView* view = qobject_cast< AlbumView* >( m_view ) ) if ( GridView* view = qobject_cast< GridView* >( m_view ) )
m_model = view->proxyModel(); m_model = view->proxyModel();
} }

View File

@@ -17,7 +17,7 @@
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>. * along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include "AlbumView.h" #include "GridView.h"
#include <QHeaderView> #include <QHeaderView>
#include <QKeyEvent> #include <QKeyEvent>
@@ -45,7 +45,7 @@
using namespace Tomahawk; using namespace Tomahawk;
AlbumView::AlbumView( QWidget* parent ) GridView::GridView( QWidget* parent )
: QListView( parent ) : QListView( parent )
, m_model( 0 ) , m_model( 0 )
, m_proxyModel( 0 ) , m_proxyModel( 0 )
@@ -88,14 +88,14 @@ AlbumView::AlbumView( QWidget* parent )
} }
AlbumView::~AlbumView() GridView::~GridView()
{ {
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
} }
void void
AlbumView::setProxyModel( PlayableProxyModel* model ) GridView::setProxyModel( PlayableProxyModel* model )
{ {
m_proxyModel = model; m_proxyModel = model;
m_delegate = new AlbumItemDelegate( this, m_proxyModel ); m_delegate = new AlbumItemDelegate( this, m_proxyModel );
@@ -107,7 +107,7 @@ AlbumView::setProxyModel( PlayableProxyModel* model )
void void
AlbumView::setModel( QAbstractItemModel* model ) GridView::setModel( QAbstractItemModel* model )
{ {
Q_UNUSED( model ); Q_UNUSED( model );
qDebug() << "Explicitly use setAlbumModel instead"; qDebug() << "Explicitly use setAlbumModel instead";
@@ -116,7 +116,7 @@ AlbumView::setModel( QAbstractItemModel* model )
void void
AlbumView::setPlayableModel( PlayableModel* model ) GridView::setPlayableModel( PlayableModel* model )
{ {
m_inited = false; m_inited = false;
m_model = model; m_model = model;
@@ -134,7 +134,7 @@ AlbumView::setPlayableModel( PlayableModel* model )
void void
AlbumView::currentChanged( const QModelIndex& current, const QModelIndex& previous ) GridView::currentChanged( const QModelIndex& current, const QModelIndex& previous )
{ {
QListView::currentChanged( current, previous ); QListView::currentChanged( current, previous );
@@ -148,7 +148,7 @@ AlbumView::currentChanged( const QModelIndex& current, const QModelIndex& previo
void void
AlbumView::onItemActivated( const QModelIndex& index ) GridView::onItemActivated( const QModelIndex& index )
{ {
PlayableItem* item = m_model->itemFromIndex( m_proxyModel->mapToSource( index ) ); PlayableItem* item = m_model->itemFromIndex( m_proxyModel->mapToSource( index ) );
if ( item ) if ( item )
@@ -167,7 +167,7 @@ AlbumView::onItemActivated( const QModelIndex& index )
void void
AlbumView::scrollContentsBy( int dx, int dy ) GridView::scrollContentsBy( int dx, int dy )
{ {
QListView::scrollContentsBy( dx, dy ); QListView::scrollContentsBy( dx, dy );
emit scrolledContents( dx, dy ); emit scrolledContents( dx, dy );
@@ -175,7 +175,7 @@ AlbumView::scrollContentsBy( int dx, int dy )
void void
AlbumView::paintEvent( QPaintEvent* event ) GridView::paintEvent( QPaintEvent* event )
{ {
if ( !autoFitItems() || m_inited || !m_proxyModel->rowCount() ) if ( !autoFitItems() || m_inited || !m_proxyModel->rowCount() )
QListView::paintEvent( event ); QListView::paintEvent( event );
@@ -183,7 +183,7 @@ AlbumView::paintEvent( QPaintEvent* event )
void void
AlbumView::resizeEvent( QResizeEvent* event ) GridView::resizeEvent( QResizeEvent* event )
{ {
QListView::resizeEvent( event ); QListView::resizeEvent( event );
layoutItems(); layoutItems();
@@ -191,7 +191,7 @@ AlbumView::resizeEvent( QResizeEvent* event )
void void
AlbumView::layoutItems() GridView::layoutItems()
{ {
if ( autoFitItems() && m_model ) if ( autoFitItems() && m_model )
{ {
@@ -225,7 +225,7 @@ AlbumView::layoutItems()
void void
AlbumView::onFilterChanged( const QString& ) GridView::onFilterChanged( const QString& )
{ {
if ( selectedIndexes().count() ) if ( selectedIndexes().count() )
scrollTo( selectedIndexes().at( 0 ), QAbstractItemView::PositionAtCenter ); scrollTo( selectedIndexes().at( 0 ), QAbstractItemView::PositionAtCenter );
@@ -233,7 +233,7 @@ AlbumView::onFilterChanged( const QString& )
void void
AlbumView::startDrag( Qt::DropActions supportedActions ) GridView::startDrag( Qt::DropActions supportedActions )
{ {
QList<QPersistentModelIndex> pindexes; QList<QPersistentModelIndex> pindexes;
QModelIndexList indexes; QModelIndexList indexes;
@@ -265,7 +265,7 @@ AlbumView::startDrag( Qt::DropActions supportedActions )
void void
AlbumView::onCustomContextMenu( const QPoint& pos ) GridView::onCustomContextMenu( const QPoint& pos )
{ {
m_contextMenu->clear(); m_contextMenu->clear();

View File

@@ -17,8 +17,8 @@
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>. * along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef ALBUMVIEW_H #ifndef GRIDVIEW_H
#define ALBUMVIEW_H #define GRIDVIEW_H
#include <QListView> #include <QListView>
#include <QSortFilterProxyModel> #include <QSortFilterProxyModel>
@@ -38,13 +38,13 @@ class AnimatedSpinner;
class AlbumItemDelegate; class AlbumItemDelegate;
class PlayableModel; class PlayableModel;
class DLLEXPORT AlbumView : public QListView, public Tomahawk::ViewPage class DLLEXPORT GridView : public QListView, public Tomahawk::ViewPage
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit AlbumView( QWidget* parent = 0 ); explicit GridView( QWidget* parent = 0 );
~AlbumView(); ~GridView();
void setProxyModel( PlayableProxyModel* model ); void setProxyModel( PlayableProxyModel* model );
@@ -106,4 +106,4 @@ private:
QRect m_paintRect; QRect m_paintRect;
}; };
#endif // ALBUMVIEW_H #endif // GRIDVIEW_H

View File

@@ -16,7 +16,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="AlbumView" name="albumsView"> <widget class="GridView" name="albumsView">
<property name="dragEnabled"> <property name="dragEnabled">
<bool>true</bool> <bool>true</bool>
</property> </property>
@@ -29,9 +29,9 @@
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget> <customwidget>
<class>AlbumView</class> <class>GridView</class>
<extends>QListView</extends> <extends>QListView</extends>
<header location="global">playlist/AlbumView.h</header> <header location="global">playlist/GridView.h</header>
</customwidget> </customwidget>
<customwidget> <customwidget>
<class>Tomahawk::Breadcrumb</class> <class>Tomahawk::Breadcrumb</class>

View File

@@ -29,8 +29,8 @@
<property name="handleWidth"> <property name="handleWidth">
<number>1</number> <number>1</number>
</property> </property>
<widget class="AlbumView" name="artistView"/> <widget class="GridView" name="artistView"/>
<widget class="AlbumView" name="albumView"/> <widget class="GridView" name="albumView"/>
</widget> </widget>
<widget class="PlaylistView" name="resultsView"/> <widget class="PlaylistView" name="resultsView"/>
</widget> </widget>
@@ -44,9 +44,9 @@
<header>playlist/PlaylistView.h</header> <header>playlist/PlaylistView.h</header>
</customwidget> </customwidget>
<customwidget> <customwidget>
<class>AlbumView</class> <class>GridView</class>
<extends>QListView</extends> <extends>QListView</extends>
<header>playlist/AlbumView.h</header> <header>playlist/GridView.h</header>
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<resources/> <resources/>

View File

@@ -36,7 +36,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="AlbumView" name="newAlbumsView"/> <widget class="GridView" name="newAlbumsView"/>
</item> </item>
</layout> </layout>
</widget> </widget>
@@ -92,9 +92,9 @@
<header location="global">widgets/HeaderLabel.h</header> <header location="global">widgets/HeaderLabel.h</header>
</customwidget> </customwidget>
<customwidget> <customwidget>
<class>AlbumView</class> <class>GridView</class>
<extends>QListView</extends> <extends>QListView</extends>
<header location="global">playlist/AlbumView.h</header> <header location="global">playlist/GridView.h</header>
</customwidget> </customwidget>
<customwidget> <customwidget>
<class>PlaylistWidget</class> <class>PlaylistWidget</class>

View File

@@ -36,7 +36,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="AlbumView" name="additionsView"> <widget class="GridView" name="additionsView">
<property name="dragEnabled"> <property name="dragEnabled">
<bool>true</bool> <bool>true</bool>
</property> </property>
@@ -94,9 +94,9 @@
<header location="global">widgets/HeaderLabel.h</header> <header location="global">widgets/HeaderLabel.h</header>
</customwidget> </customwidget>
<customwidget> <customwidget>
<class>AlbumView</class> <class>GridView</class>
<extends>QListView</extends> <extends>QListView</extends>
<header>playlist/AlbumView.h</header> <header>playlist/GridView.h</header>
</customwidget> </customwidget>
<customwidget> <customwidget>
<class>PlaylistView</class> <class>PlaylistView</class>

View File

@@ -47,7 +47,7 @@
<widget class="QWidget" name="page2"> <widget class="QWidget" name="page2">
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item> <item>
<widget class="AlbumView" name="albumsView"> <widget class="GridView" name="albumsView">
<property name="dragEnabled"> <property name="dragEnabled">
<bool>true</bool> <bool>true</bool>
</property> </property>
@@ -64,9 +64,9 @@
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget> <customwidget>
<class>AlbumView</class> <class>GridView</class>
<extends>QListView</extends> <extends>QListView</extends>
<header location="global">playlist/AlbumView.h</header> <header location="global">playlist/GridView.h</header>
</customwidget> </customwidget>
<customwidget> <customwidget>
<class>ArtistView</class> <class>ArtistView</class>

View File

@@ -33,7 +33,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="AlbumView" name="albumsView"/> <widget class="GridView" name="albumsView"/>
</item> </item>
</layout> </layout>
</widget> </widget>
@@ -53,9 +53,9 @@
<header location="global">ArtistView.h</header> <header location="global">ArtistView.h</header>
</customwidget> </customwidget>
<customwidget> <customwidget>
<class>AlbumView</class> <class>GridView</class>
<extends>QListView</extends> <extends>QListView</extends>
<header>playlist/AlbumView.h</header> <header>playlist/GridView.h</header>
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<resources/> <resources/>

View File

@@ -57,7 +57,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="AlbumView" name="relatedArtists"> <widget class="GridView" name="relatedArtists">
</widget> </widget>
</item> </item>
</layout> </layout>
@@ -79,7 +79,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="AlbumView" name="albums"/> <widget class="GridView" name="albums"/>
</item> </item>
</layout> </layout>
</widget> </widget>
@@ -114,9 +114,9 @@
<header location="global">ArtistView.h</header> <header location="global">ArtistView.h</header>
</customwidget> </customwidget>
<customwidget> <customwidget>
<class>AlbumView</class> <class>GridView</class>
<extends>QListView</extends> <extends>QListView</extends>
<header location="global">AlbumView.h</header> <header location="global">GridView.h</header>
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<resources/> <resources/>

View File

@@ -32,7 +32,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="AlbumView" name="recentAlbumView"> <widget class="GridView" name="recentAlbumView">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@@ -107,9 +107,9 @@
<header location="global">widgets/HeaderLabel.h</header> <header location="global">widgets/HeaderLabel.h</header>
</customwidget> </customwidget>
<customwidget> <customwidget>
<class>AlbumView</class> <class>GridView</class>
<extends>QListView</extends> <extends>QListView</extends>
<header>playlist/AlbumView.h</header> <header>playlist/GridView.h</header>
</customwidget> </customwidget>
<customwidget> <customwidget>
<class>PlaylistView</class> <class>PlaylistView</class>

View File

@@ -208,7 +208,7 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="AlbumView" name="similarTracksView"> <widget class="GridView" name="similarTracksView">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding"> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@@ -224,9 +224,9 @@
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget> <customwidget>
<class>AlbumView</class> <class>GridView</class>
<extends>QListView</extends> <extends>QListView</extends>
<header>playlist/AlbumView.h</header> <header>playlist/GridView.h</header>
</customwidget> </customwidget>
<customwidget> <customwidget>
<class>HeaderLabel</class> <class>HeaderLabel</class>