mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-09-02 02:12:47 +02:00
replace GridView with QmlGridView in FlexibleView
This commit is contained in:
@@ -20,6 +20,8 @@ Rectangle {
|
||||
cellHeight: cellWidth
|
||||
cellWidth: calculateCoverSize(gridView.width - 3)
|
||||
|
||||
cacheBuffer: cellHeight * 5
|
||||
|
||||
function calculateCoverSize(rectWidth) {
|
||||
var itemWidth = fontMetrics.width;
|
||||
var itemsPerRow = Math.max( 1, Math.floor( rectWidth / itemWidth ) );
|
||||
|
@@ -26,7 +26,7 @@
|
||||
#include "playlist/PlayableModel.h"
|
||||
#include "playlist/PlaylistModel.h"
|
||||
#include "playlist/TrackView.h"
|
||||
#include "playlist/GridView.h"
|
||||
#include "playlist/QmlGridView.h"
|
||||
#include "playlist/PlaylistLargeItemDelegate.h"
|
||||
#include "PlayableProxyModelPlaylistInterface.h"
|
||||
#include "utils/TomahawkUtilsGui.h"
|
||||
@@ -40,7 +40,7 @@ FlexibleView::FlexibleView( QWidget* parent )
|
||||
, m_header( new DeclarativeHeader( this ) )
|
||||
, m_trackView( new TrackView() )
|
||||
, m_detailedView( new TrackView() )
|
||||
, m_gridView( new GridView() )
|
||||
, m_gridView( new QmlGridView() )
|
||||
, m_model( 0 )
|
||||
{
|
||||
qRegisterMetaType< TomahawkUtils::ViewMode >( "TomahawkUtils::ViewMode" );
|
||||
@@ -125,7 +125,7 @@ FlexibleView::setDetailedView( TrackView* view )
|
||||
|
||||
|
||||
void
|
||||
FlexibleView::setGridView( GridView* view )
|
||||
FlexibleView::setGridView( QmlGridView *view )
|
||||
{
|
||||
if ( m_gridView )
|
||||
{
|
||||
@@ -271,7 +271,7 @@ FlexibleView::setEmptyTip( const QString& tip )
|
||||
{
|
||||
m_trackView->setEmptyTip( tip );
|
||||
m_detailedView->setEmptyTip( tip );
|
||||
m_gridView->setEmptyTip( tip );
|
||||
// m_gridView->setEmptyTip( tip );
|
||||
}
|
||||
|
||||
|
||||
|
@@ -25,7 +25,7 @@
|
||||
|
||||
class QStackedWidget;
|
||||
|
||||
class GridView;
|
||||
class QmlGridView;
|
||||
class TrackView;
|
||||
class PlayableModel;
|
||||
class PlaylistModel;
|
||||
@@ -57,13 +57,13 @@ public:
|
||||
|
||||
TrackView* trackView() const { return m_trackView; }
|
||||
TrackView* detailedView() const { return m_detailedView; }
|
||||
GridView* gridView() const { return m_gridView; }
|
||||
QmlGridView* gridView() const { return m_gridView; }
|
||||
|
||||
void setGuid( const QString& guid );
|
||||
|
||||
void setTrackView( TrackView* view );
|
||||
void setDetailedView( TrackView* view );
|
||||
void setGridView( GridView* view );
|
||||
void setGridView( QmlGridView* view );
|
||||
|
||||
void setPlayableModel( PlayableModel* model );
|
||||
void setPlaylistModel( PlaylistModel* model );
|
||||
@@ -89,7 +89,7 @@ private:
|
||||
|
||||
TrackView* m_trackView;
|
||||
TrackView* m_detailedView;
|
||||
GridView* m_gridView;
|
||||
QmlGridView* m_gridView;
|
||||
|
||||
PlayableModel* m_model;
|
||||
QStackedWidget* m_stack;
|
||||
|
@@ -87,6 +87,12 @@ void QmlGridView::setPlayableModel(PlayableModel *model)
|
||||
}
|
||||
|
||||
|
||||
void QmlGridView::setPlaylistInterface(playlistinterface_ptr playlistInterface)
|
||||
{
|
||||
proxyModel()->setPlaylistInterface( playlistInterface );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
QmlGridView::onItemClicked( int index )
|
||||
{
|
||||
|
@@ -52,6 +52,7 @@ public:
|
||||
|
||||
|
||||
QWidget *widget() { return this; }
|
||||
virtual void setPlaylistInterface(Tomahawk::playlistinterface_ptr playlistInterface);
|
||||
virtual Tomahawk::playlistinterface_ptr playlistInterface() const { return m_playlistInterface; }
|
||||
virtual QString title() const { return m_model->title(); }
|
||||
virtual QString description() const { return m_model->description(); }
|
||||
|
Reference in New Issue
Block a user