mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-21 00:09:47 +01:00
* Renamed AlbumItemDelegate to GridItemDelegate.
This commit is contained in:
parent
a61f602855
commit
75991dca18
@ -61,7 +61,7 @@ set( libGuiSources
|
||||
playlist/TrackView.cpp
|
||||
playlist/TrackHeader.cpp
|
||||
playlist/AlbumModel.cpp
|
||||
playlist/AlbumItemDelegate.cpp
|
||||
playlist/GridItemDelegate.cpp
|
||||
playlist/GridView.cpp
|
||||
playlist/ArtistView.cpp
|
||||
playlist/CustomPlaylistView.cpp
|
||||
|
@ -17,7 +17,7 @@
|
||||
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "AlbumItemDelegate.h"
|
||||
#include "GridItemDelegate.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QPainter>
|
||||
@ -48,7 +48,7 @@ namespace {
|
||||
};
|
||||
|
||||
|
||||
AlbumItemDelegate::AlbumItemDelegate( QAbstractItemView* parent, PlayableProxyModel* proxy )
|
||||
GridItemDelegate::GridItemDelegate( QAbstractItemView* parent, PlayableProxyModel* proxy )
|
||||
: QStyledItemDelegate( (QObject*)parent )
|
||||
, m_view( parent )
|
||||
, m_model( proxy )
|
||||
@ -61,7 +61,7 @@ AlbumItemDelegate::AlbumItemDelegate( QAbstractItemView* parent, PlayableProxyMo
|
||||
|
||||
|
||||
QSize
|
||||
AlbumItemDelegate::sizeHint( const QStyleOptionViewItem& option, const QModelIndex& index ) const
|
||||
GridItemDelegate::sizeHint( const QStyleOptionViewItem& option, const QModelIndex& index ) const
|
||||
{
|
||||
QSize size = QStyledItemDelegate::sizeHint( option, index );
|
||||
return size;
|
||||
@ -69,7 +69,7 @@ AlbumItemDelegate::sizeHint( const QStyleOptionViewItem& option, const QModelInd
|
||||
|
||||
|
||||
void
|
||||
AlbumItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const
|
||||
GridItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const
|
||||
{
|
||||
PlayableItem* item = m_model->sourceModel()->itemFromIndex( m_model->mapToSource( index ) );
|
||||
if ( !item )
|
||||
@ -116,7 +116,7 @@ AlbumItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option,
|
||||
m_covers.insert( index, QSharedPointer< Tomahawk::PixmapDelegateFader >( new Tomahawk::PixmapDelegateFader( item->query(), r.size(), TomahawkUtils::Grid ) ) );
|
||||
}
|
||||
|
||||
_detail::Closure* closure = NewClosure( m_covers[ index ], SIGNAL( repaintRequest() ), const_cast<AlbumItemDelegate*>(this), SLOT( doUpdateIndex( QPersistentModelIndex ) ), QPersistentModelIndex( index ) );
|
||||
_detail::Closure* closure = NewClosure( m_covers[ index ], SIGNAL( repaintRequest() ), const_cast<GridItemDelegate*>(this), SLOT( doUpdateIndex( QPersistentModelIndex ) ), QPersistentModelIndex( index ) );
|
||||
closure->setAutoDelete( false );
|
||||
}
|
||||
|
||||
@ -218,7 +218,7 @@ AlbumItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option,
|
||||
|
||||
|
||||
void
|
||||
AlbumItemDelegate::onPlayClicked( const QPersistentModelIndex& index )
|
||||
GridItemDelegate::onPlayClicked( const QPersistentModelIndex& index )
|
||||
{
|
||||
QPoint pos = m_playButton[ index ]->pos();
|
||||
foreach ( ImageButton* button, m_playButton )
|
||||
@ -240,10 +240,10 @@ AlbumItemDelegate::onPlayClicked( const QPersistentModelIndex& index )
|
||||
_detail::Closure* closure;
|
||||
|
||||
closure = NewClosure( AudioEngine::instance(), SIGNAL( loading( Tomahawk::result_ptr ) ),
|
||||
const_cast<AlbumItemDelegate*>(this), SLOT( onPlaybackStarted( QPersistentModelIndex ) ), QPersistentModelIndex( index ) );
|
||||
const_cast<GridItemDelegate*>(this), SLOT( onPlaybackStarted( QPersistentModelIndex ) ), QPersistentModelIndex( index ) );
|
||||
|
||||
closure = NewClosure( AudioEngine::instance(), SIGNAL( started( Tomahawk::result_ptr ) ),
|
||||
const_cast<AlbumItemDelegate*>(this), SLOT( onPlaylistChanged( QPersistentModelIndex ) ), QPersistentModelIndex( index ) );
|
||||
const_cast<GridItemDelegate*>(this), SLOT( onPlaylistChanged( QPersistentModelIndex ) ), QPersistentModelIndex( index ) );
|
||||
closure->setAutoDelete( false );
|
||||
|
||||
connect( AudioEngine::instance(), SIGNAL( stopped() ), SLOT( onPlaybackFinished() ) );
|
||||
@ -259,7 +259,7 @@ AlbumItemDelegate::onPlayClicked( const QPersistentModelIndex& index )
|
||||
|
||||
|
||||
bool
|
||||
AlbumItemDelegate::editorEvent( QEvent* event, QAbstractItemModel* model, const QStyleOptionViewItem& option, const QModelIndex& index )
|
||||
GridItemDelegate::editorEvent( QEvent* event, QAbstractItemModel* model, const QStyleOptionViewItem& option, const QModelIndex& index )
|
||||
{
|
||||
Q_UNUSED( model );
|
||||
Q_UNUSED( option );
|
||||
@ -308,7 +308,7 @@ AlbumItemDelegate::editorEvent( QEvent* event, QAbstractItemModel* model, const
|
||||
button->show();
|
||||
|
||||
NewClosure( button, SIGNAL( clicked( bool ) ),
|
||||
const_cast<AlbumItemDelegate*>(this), SLOT( onPlayClicked( QPersistentModelIndex ) ), QPersistentModelIndex( index ) );
|
||||
const_cast<GridItemDelegate*>(this), SLOT( onPlayClicked( QPersistentModelIndex ) ), QPersistentModelIndex( index ) );
|
||||
|
||||
m_playButton[ index ] = button;
|
||||
}
|
||||
@ -390,7 +390,7 @@ AlbumItemDelegate::editorEvent( QEvent* event, QAbstractItemModel* model, const
|
||||
|
||||
|
||||
void
|
||||
AlbumItemDelegate::modelChanged()
|
||||
GridItemDelegate::modelChanged()
|
||||
{
|
||||
m_artistNameRects.clear();
|
||||
m_hoveringOver = QPersistentModelIndex();
|
||||
@ -412,7 +412,7 @@ AlbumItemDelegate::modelChanged()
|
||||
|
||||
|
||||
void
|
||||
AlbumItemDelegate::doUpdateIndex( const QPersistentModelIndex& idx )
|
||||
GridItemDelegate::doUpdateIndex( const QPersistentModelIndex& idx )
|
||||
{
|
||||
if ( !idx.isValid() )
|
||||
return;
|
||||
@ -421,7 +421,7 @@ AlbumItemDelegate::doUpdateIndex( const QPersistentModelIndex& idx )
|
||||
|
||||
|
||||
void
|
||||
AlbumItemDelegate::onScrolled( int dx, int dy )
|
||||
GridItemDelegate::onScrolled( int dx, int dy )
|
||||
{
|
||||
foreach ( QWidget* widget, m_spinner.values() )
|
||||
{
|
||||
@ -439,7 +439,7 @@ AlbumItemDelegate::onScrolled( int dx, int dy )
|
||||
|
||||
|
||||
void
|
||||
AlbumItemDelegate::onPlaybackFinished()
|
||||
GridItemDelegate::onPlaybackFinished()
|
||||
{
|
||||
foreach ( ImageButton* button, m_pauseButton )
|
||||
button->deleteLater();
|
||||
@ -448,7 +448,7 @@ AlbumItemDelegate::onPlaybackFinished()
|
||||
|
||||
|
||||
void
|
||||
AlbumItemDelegate::onPlaylistChanged( const QPersistentModelIndex& index )
|
||||
GridItemDelegate::onPlaylistChanged( const QPersistentModelIndex& index )
|
||||
{
|
||||
PlayableItem* item = m_model->sourceModel()->itemFromIndex( m_model->mapToSource( index ) );
|
||||
if ( item )
|
||||
@ -484,7 +484,7 @@ AlbumItemDelegate::onPlaylistChanged( const QPersistentModelIndex& index )
|
||||
|
||||
|
||||
void
|
||||
AlbumItemDelegate::onPlaybackStarted( const QPersistentModelIndex& index )
|
||||
GridItemDelegate::onPlaybackStarted( const QPersistentModelIndex& index )
|
||||
{
|
||||
if ( !m_spinner.contains( index ) )
|
||||
return;
|
||||
@ -513,14 +513,14 @@ AlbumItemDelegate::onPlaybackStarted( const QPersistentModelIndex& index )
|
||||
|
||||
|
||||
void
|
||||
AlbumItemDelegate::fadingFrameChanged( const QPersistentModelIndex& idx )
|
||||
GridItemDelegate::fadingFrameChanged( const QPersistentModelIndex& idx )
|
||||
{
|
||||
emit updateIndex( idx );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
AlbumItemDelegate::fadingFrameFinished( const QPersistentModelIndex& idx )
|
||||
GridItemDelegate::fadingFrameFinished( const QPersistentModelIndex& idx )
|
||||
{
|
||||
if ( m_hoverFaders.contains( idx ) )
|
||||
{
|
||||
@ -531,7 +531,7 @@ AlbumItemDelegate::fadingFrameFinished( const QPersistentModelIndex& idx )
|
||||
|
||||
|
||||
QTimeLine*
|
||||
AlbumItemDelegate::createTimeline( QTimeLine::Direction direction )
|
||||
GridItemDelegate::createTimeline( QTimeLine::Direction direction )
|
||||
{
|
||||
QTimeLine* timeline = new QTimeLine( FADE_DURATION, this );
|
||||
timeline->setDirection( direction );
|
||||
@ -545,7 +545,7 @@ AlbumItemDelegate::createTimeline( QTimeLine::Direction direction )
|
||||
|
||||
|
||||
bool
|
||||
AlbumItemDelegate::eventFilter( QObject* obj, QEvent* event )
|
||||
GridItemDelegate::eventFilter( QObject* obj, QEvent* event )
|
||||
{
|
||||
if ( event->type() == QEvent::Wheel )
|
||||
{
|
@ -17,8 +17,8 @@
|
||||
* along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef ALBUMITEMDELEGATE_H
|
||||
#define ALBUMITEMDELEGATE_H
|
||||
#ifndef GRIDITEMDELEGATE_H
|
||||
#define GRIDITEMDELEGATE_H
|
||||
|
||||
#include <QStyledItemDelegate>
|
||||
#include <QTimeLine>
|
||||
@ -34,12 +34,12 @@ class QTimeLine;
|
||||
class PlayableProxyModel;
|
||||
class ImageButton;
|
||||
|
||||
class DLLEXPORT AlbumItemDelegate : public QStyledItemDelegate
|
||||
class DLLEXPORT GridItemDelegate : public QStyledItemDelegate
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
AlbumItemDelegate( QAbstractItemView* parent = 0, PlayableProxyModel* proxy = 0 );
|
||||
GridItemDelegate( QAbstractItemView* parent = 0, PlayableProxyModel* proxy = 0 );
|
||||
|
||||
protected:
|
||||
void paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const;
|
||||
@ -85,4 +85,4 @@ private:
|
||||
mutable QHash< QPersistentModelIndex, QTimeLine* > m_hoverFaders;
|
||||
};
|
||||
|
||||
#endif // ALBUMITEMDELEGATE_H
|
||||
#endif // GRIDITEMDELEGATE_H
|
@ -31,7 +31,7 @@
|
||||
#include "Artist.h"
|
||||
#include "Source.h"
|
||||
#include "PlayableItem.h"
|
||||
#include "AlbumItemDelegate.h"
|
||||
#include "GridItemDelegate.h"
|
||||
#include "AlbumModel.h"
|
||||
#include "PlayableModel.h"
|
||||
#include "ContextMenu.h"
|
||||
@ -98,7 +98,7 @@ void
|
||||
GridView::setProxyModel( PlayableProxyModel* model )
|
||||
{
|
||||
m_proxyModel = model;
|
||||
m_delegate = new AlbumItemDelegate( this, m_proxyModel );
|
||||
m_delegate = new GridItemDelegate( this, m_proxyModel );
|
||||
connect( m_delegate, SIGNAL( updateIndex( QModelIndex ) ), this, SLOT( update( QModelIndex ) ) );
|
||||
setItemDelegate( m_delegate );
|
||||
|
||||
|
@ -35,7 +35,7 @@ namespace Tomahawk
|
||||
};
|
||||
|
||||
class AnimatedSpinner;
|
||||
class AlbumItemDelegate;
|
||||
class GridItemDelegate;
|
||||
class PlayableModel;
|
||||
|
||||
class DLLEXPORT GridView : public QListView, public Tomahawk::ViewPage
|
||||
@ -93,7 +93,7 @@ private slots:
|
||||
private:
|
||||
PlayableModel* m_model;
|
||||
PlayableProxyModel* m_proxyModel;
|
||||
AlbumItemDelegate* m_delegate;
|
||||
GridItemDelegate* m_delegate;
|
||||
AnimatedSpinner* m_loadingSpinner;
|
||||
OverlayWidget* m_overlay;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user