diff --git a/src/libtomahawk/playlist/TrackView.cpp b/src/libtomahawk/playlist/TrackView.cpp index d0431ef97..2065d8078 100644 --- a/src/libtomahawk/playlist/TrackView.cpp +++ b/src/libtomahawk/playlist/TrackView.cpp @@ -25,8 +25,6 @@ #include "PlayableProxyModel.h" #include "PlayableItem.h" #include "DropJob.h" -#include "Artist.h" -#include "Album.h" #include "Source.h" #include "TomahawkSettings.h" #include "audio/AudioEngine.h" @@ -684,105 +682,6 @@ TrackView::onMenuTriggered( int action ) } -void -TrackView::updateHoverIndex( const QPoint& pos ) -{ - QModelIndex idx = indexAt( pos ); - - if ( idx != m_hoveredIndex ) - { - m_hoveredIndex = idx; - repaint(); - } - - if ( !m_model || m_proxyModel->style() != PlayableProxyModel::Detailed ) - return; - - if ( idx.column() == PlayableModel::Artist || idx.column() == PlayableModel::Album || idx.column() == PlayableModel::Track ) - { - if ( pos.x() > header()->sectionViewportPosition( idx.column() ) + header()->sectionSize( idx.column() ) - 16 && - pos.x() < header()->sectionViewportPosition( idx.column() ) + header()->sectionSize( idx.column() ) ) - { - setCursor( Qt::PointingHandCursor ); - return; - } - } - - if ( cursor().shape() != Qt::ArrowCursor ) - setCursor( Qt::ArrowCursor ); -} - - -void -TrackView::wheelEvent( QWheelEvent* event ) -{ - QTreeView::wheelEvent( event ); - - if ( m_hoveredIndex.isValid() ) - { - m_hoveredIndex = QModelIndex(); - repaint(); - } -} - - -void -TrackView::leaveEvent( QEvent* event ) -{ - QTreeView::leaveEvent( event ); - updateHoverIndex( QPoint( -1, -1 ) ); -} - - -void -TrackView::mouseMoveEvent( QMouseEvent* event ) -{ - QTreeView::mouseMoveEvent( event ); - updateHoverIndex( event->pos() ); -} - - -void -TrackView::mousePressEvent( QMouseEvent* event ) -{ - QTreeView::mousePressEvent( event ); - - if ( !m_model || m_proxyModel->style() != PlayableProxyModel::Detailed ) - return; - - QModelIndex idx = indexAt( event->pos() ); - if ( event->pos().x() > header()->sectionViewportPosition( idx.column() ) + header()->sectionSize( idx.column() ) - 16 && - event->pos().x() < header()->sectionViewportPosition( idx.column() ) + header()->sectionSize( idx.column() ) ) - { - PlayableItem* item = proxyModel()->itemFromIndex( proxyModel()->mapToSource( idx ) ); - switch ( idx.column() ) - { - case PlayableModel::Artist: - { - ViewManager::instance()->show( Artist::get( item->query()->displayQuery()->artist() ) ); - break; - } - - case PlayableModel::Album: - { - artist_ptr artist = Artist::get( item->query()->displayQuery()->artist() ); - ViewManager::instance()->show( Album::get( artist, item->query()->displayQuery()->album() ) ); - break; - } - - case PlayableModel::Track: - { - ViewManager::instance()->show( item->query()->displayQuery() ); - break; - } - - default: - break; - } - } -} - - Tomahawk::playlistinterface_ptr TrackView::playlistInterface() const { diff --git a/src/libtomahawk/playlist/TrackView.h b/src/libtomahawk/playlist/TrackView.h index 4991d4662..ef6a91717 100644 --- a/src/libtomahawk/playlist/TrackView.h +++ b/src/libtomahawk/playlist/TrackView.h @@ -75,7 +75,6 @@ public: virtual bool setFilter( const QString& filter ); virtual bool jumpToCurrentTrack(); - QModelIndex hoveredIndex() const { return m_hoveredIndex; } QModelIndex contextMenuIndex() const { return m_contextMenuIndex; } void setContextMenuIndex( const QModelIndex& idx ) { m_contextMenuIndex = idx; } @@ -112,10 +111,6 @@ protected: virtual void dragMoveEvent( QDragMoveEvent* event ); virtual void dropEvent( QDropEvent* event ); - virtual void wheelEvent( QWheelEvent* event ); - virtual void mouseMoveEvent( QMouseEvent* event ); - virtual void mousePressEvent( QMouseEvent* event ); - virtual void leaveEvent( QEvent* event ); virtual void paintEvent( QPaintEvent* event ); virtual void keyPressEvent( QKeyEvent* event ); @@ -131,7 +126,7 @@ private slots: void autoPlayResolveFinished( const Tomahawk::query_ptr& query, int row ); void verifySize(); - + private: void startAutoPlay( const QModelIndex& index ); bool tryToPlayItem( const QModelIndex& index ); @@ -153,7 +148,6 @@ private: bool m_updateContextView; bool m_autoResize; - QModelIndex m_hoveredIndex; QModelIndex m_contextMenuIndex; Tomahawk::query_ptr m_autoPlaying; diff --git a/src/libtomahawk/playlist/TreeView.cpp b/src/libtomahawk/playlist/TreeView.cpp index ffb5e6b9b..5d3d716e3 100644 --- a/src/libtomahawk/playlist/TreeView.cpp +++ b/src/libtomahawk/playlist/TreeView.cpp @@ -427,96 +427,6 @@ TreeView::jumpToCurrentTrack() } -void -TreeView::updateHoverIndex( const QPoint& pos ) -{ - QModelIndex idx = indexAt( pos ); - - if ( idx != m_hoveredIndex ) - { - m_hoveredIndex = idx; - repaint(); - } - - if ( !m_model || m_proxyModel->style() != PlayableProxyModel::Collection ) - return; - - PlayableItem* item = proxyModel()->itemFromIndex( proxyModel()->mapToSource( idx ) ); - if ( idx.column() == 0 && !item->query().isNull() ) - { - if ( pos.x() > header()->sectionViewportPosition( idx.column() ) + header()->sectionSize( idx.column() ) - 16 && - pos.x() < header()->sectionViewportPosition( idx.column() ) + header()->sectionSize( idx.column() ) ) - { - setCursor( Qt::PointingHandCursor ); - return; - } - } - - if ( cursor().shape() != Qt::ArrowCursor ) - setCursor( Qt::ArrowCursor ); -} - - -void -TreeView::wheelEvent( QWheelEvent* event ) -{ - QTreeView::wheelEvent( event ); - - if ( m_hoveredIndex.isValid() ) - { - m_hoveredIndex = QModelIndex(); - repaint(); - } -} - - -void -TreeView::leaveEvent( QEvent* event ) -{ - QTreeView::leaveEvent( event ); - updateHoverIndex( QPoint( -1, -1 ) ); -} - - -void -TreeView::mouseMoveEvent( QMouseEvent* event ) -{ - QTreeView::mouseMoveEvent( event ); - updateHoverIndex( event->pos() ); -} - - -void -TreeView::mousePressEvent( QMouseEvent* event ) -{ - QTreeView::mousePressEvent( event ); - - if ( !m_model || m_proxyModel->style() != PlayableProxyModel::Collection ) - return; - - QModelIndex idx = indexAt( event->pos() ); - if ( event->pos().x() > header()->sectionViewportPosition( idx.column() ) + header()->sectionSize( idx.column() ) - 16 && - event->pos().x() < header()->sectionViewportPosition( idx.column() ) + header()->sectionSize( idx.column() ) ) - { - PlayableItem* item = proxyModel()->itemFromIndex( proxyModel()->mapToSource( idx ) ); - if ( item->query().isNull() ) - return; - - switch ( idx.column() ) - { - case 0: - { - ViewManager::instance()->show( item->query()->displayQuery() ); - break; - } - - default: - break; - } - } -} - - QString TreeView::guid() const { diff --git a/src/libtomahawk/playlist/TreeView.h b/src/libtomahawk/playlist/TreeView.h index 217579bb2..222e3da80 100644 --- a/src/libtomahawk/playlist/TreeView.h +++ b/src/libtomahawk/playlist/TreeView.h @@ -65,8 +65,6 @@ public: virtual bool jumpToCurrentTrack(); - QModelIndex hoveredIndex() const { return m_hoveredIndex; } - bool updatesContextView() const { return m_updateContextView; } void setUpdatesContextView( bool b ) { m_updateContextView = b; } @@ -81,10 +79,6 @@ protected: virtual void resizeEvent( QResizeEvent* event ); virtual void keyPressEvent( QKeyEvent* event ); - void wheelEvent( QWheelEvent* event ); - void mouseMoveEvent( QMouseEvent* event ); - void mousePressEvent( QMouseEvent* event ); - void leaveEvent( QEvent* event ); protected slots: virtual void currentChanged( const QModelIndex& current, const QModelIndex& previous ); @@ -99,8 +93,6 @@ private slots: void onMenuTriggered( int action ); private: - void updateHoverIndex( const QPoint& pos ); - ViewHeader* m_header; OverlayWidget* m_overlay; TreeModel* m_model; @@ -109,7 +101,6 @@ private: bool m_updateContextView; - QModelIndex m_hoveredIndex; QModelIndex m_contextMenuIndex; Tomahawk::ContextMenu* m_contextMenu;