mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-21 00:09:47 +01:00
* TrackView now has a default ViewPage implementation and inheritance.
This commit is contained in:
parent
f5bdc3a30b
commit
fad3c6d12a
@ -99,6 +99,8 @@ TrackView::TrackView( QWidget* parent )
|
||||
connect( this, SIGNAL( doubleClicked( QModelIndex ) ), SLOT( onItemActivated( QModelIndex ) ) );
|
||||
connect( this, SIGNAL( customContextMenuRequested( const QPoint& ) ), SLOT( onCustomContextMenu( const QPoint& ) ) );
|
||||
connect( m_contextMenu, SIGNAL( triggered( int ) ), SLOT( onMenuTriggered( int ) ) );
|
||||
|
||||
setProxyModel( new PlayableProxyModel( this ) );
|
||||
}
|
||||
|
||||
|
||||
@ -701,3 +703,39 @@ TrackView::mousePressEvent( QMouseEvent* event )
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Tomahawk::playlistinterface_ptr
|
||||
TrackView::playlistInterface() const
|
||||
{
|
||||
return proxyModel()->playlistInterface();
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
TrackView::title() const
|
||||
{
|
||||
return model()->title();
|
||||
}
|
||||
|
||||
|
||||
QString
|
||||
TrackView::description() const
|
||||
{
|
||||
return model()->description();
|
||||
}
|
||||
|
||||
|
||||
QPixmap
|
||||
TrackView::pixmap() const
|
||||
{
|
||||
return QPixmap( RESPATH "images/music-icon.png" );
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
TrackView::jumpToCurrentTrack()
|
||||
{
|
||||
scrollTo( proxyModel()->currentIndex(), QAbstractItemView::PositionAtCenter );
|
||||
return true;
|
||||
}
|
||||
|
@ -26,6 +26,7 @@
|
||||
|
||||
#include "ContextMenu.h"
|
||||
#include "PlaylistItemDelegate.h"
|
||||
#include "ViewPage.h"
|
||||
|
||||
#include "DllMacro.h"
|
||||
|
||||
@ -36,7 +37,7 @@ class PlayableModel;
|
||||
class PlayableProxyModel;
|
||||
class OverlayWidget;
|
||||
|
||||
class DLLEXPORT TrackView : public QTreeView
|
||||
class DLLEXPORT TrackView : public QTreeView, public Tomahawk::ViewPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -59,6 +60,18 @@ public:
|
||||
Tomahawk::ContextMenu* contextMenu() const { return m_contextMenu; }
|
||||
AnimatedSpinner* loadingSpinner() const { return m_loadingSpinner; }
|
||||
|
||||
virtual QWidget* widget() { return this; }
|
||||
virtual Tomahawk::playlistinterface_ptr playlistInterface() const;
|
||||
|
||||
virtual QString title() const;
|
||||
virtual QString description() const;
|
||||
virtual QPixmap pixmap() const;
|
||||
|
||||
virtual bool showModes() const { return true; }
|
||||
virtual bool showFilter() const { return true; }
|
||||
|
||||
virtual bool jumpToCurrentTrack();
|
||||
|
||||
QModelIndex hoveredIndex() const { return m_hoveredIndex; }
|
||||
QModelIndex contextMenuIndex() const { return m_contextMenuIndex; }
|
||||
void setContextMenuIndex( const QModelIndex& idx ) { m_contextMenuIndex = idx; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user