[vlc-commits] commit: Qt/ML: Pictureflow should work with VLCModel (Srikanth Raju )
git at videolan.org
git at videolan.org
Mon Jan 17 16:38:54 CET 2011
vlc | branch: master | Srikanth Raju <srikiraju at gmail.com> | Mon Jan 17 20:46:34 2011 +0530| [90b6e3dc3a2f54eda54e8a25644537a9700d657c] | committer: Srikanth Raju
Qt/ML: Pictureflow should work with VLCModel
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=90b6e3dc3a2f54eda54e8a25644537a9700d657c
---
modules/gui/qt4/util/pictureflow.cpp | 41 +++++++++++++++++++++++++--------
modules/gui/qt4/util/pictureflow.hpp | 2 +-
2 files changed, 32 insertions(+), 11 deletions(-)
diff --git a/modules/gui/qt4/util/pictureflow.cpp b/modules/gui/qt4/util/pictureflow.cpp
index 39cf780..c856314 100644
--- a/modules/gui/qt4/util/pictureflow.cpp
+++ b/modules/gui/qt4/util/pictureflow.cpp
@@ -26,6 +26,7 @@
*/
#include "pictureflow.hpp"
+#include "components/playlist/ml_model.hpp"
// detect Qt version
#if QT_VERSION < 0x040300
@@ -144,7 +145,7 @@ public:
PFreal offsetX;
PFreal offsetY;
- PLModel *model;
+ VLCModel *model;
SlideInfo centerSlide;
QVector<SlideInfo> leftSlides;
QVector<SlideInfo> rightSlides;
@@ -596,8 +597,8 @@ static QImage* prepareSurface(const QImage* slideImage, int w, int h, QRgb bgcol
imagePainter.setBrush( QBrush( Qt::lightGray ) );
imagePainter.setPen( QColor( Qt::lightGray ) );
QFontMetrics fm = imagePainter.fontMetrics();
- imagePainter.drawText( 0, img.height()+ 13, PLModel::getMeta( index, COLUMN_TITLE ) );
- imagePainter.drawText( 0, img.height()+ 13 + fm.xHeight()*2, PLModel::getMeta( index, COLUMN_ARTIST ) );
+ imagePainter.drawText( 0, img.height()+ 13, VLCModel::getMeta( index, COLUMN_TITLE ) );
+ imagePainter.drawText( 0, img.height()+ 13 + fm.xHeight()*2, VLCModel::getMeta( index, COLUMN_ARTIST ) );
/*
for (int x = 0; x < w; x++)
for (int y = 0; y < h; y++)
@@ -614,7 +615,7 @@ QImage* PictureFlowSoftwareRenderer::surface(QModelIndex index)
if (!state || !index.isValid())
return 0;
- QImage* img = new QImage(PLModel::getArtPixmap( index,
+ QImage* img = new QImage(VLCModel::getArtPixmap( index,
QSize( state->slideWidth, state->slideHeight ) ).toImage());
QImage* sr = prepareSurface(img, state->slideWidth, state->slideHeight, bgcolor, state->reflectionEffect, index );
@@ -633,13 +634,33 @@ QRect PictureFlowSoftwareRenderer::renderSlide(const SlideInfo &slide, int col1,
QModelIndex index;
- index = state->model->index( slide.slideIndex, 0, state->model->currentIndex().parent() );
- if( !index.isValid() )
- return QRect();
+ QString artURL;
+
+ PLModel* plm = dynamic_cast<PLModel*>( state->model );
+#ifdef MEDIA_LIBRARY
+ MLModel* mlm = dynamic_cast<MLModel*>( state->model );
+#endif
+ if( plm != 0 )
+ {
+ index = ((PLModel*)state->model)->index( slide.slideIndex, 0, state->model->currentIndex().parent() );
+ if( !index.isValid() )
+ return QRect();
- PLItem *item = static_cast<PLItem*>( index.internalPointer() );
+ PLItem *item = static_cast<PLItem*>( index.internalPointer() );
+ artURL = InputManager::decodeArtURL( item->inputItem() );
+ }
+#ifdef MEDIA_LIBRARY
+ else if( mlm != 0 )
+ {
+ index = ((MLModel*)state->model)->index( slide.slideIndex, 0, QModelIndex() );
+ if( !index.isValid() )
+ return QRect();
- QString key = QString("%1%2%3%4").arg(PLModel::getMeta( index, COLUMN_TITLE )).arg( PLModel::getMeta( index, COLUMN_ARTIST ) ).arg(index.data( PLModel::IsCurrentRole ).toBool() ).arg( InputManager::decodeArtURL( item->inputItem() ) );
+ MLItem *item = static_cast<MLItem*>( index.internalPointer() );
+ artURL = qfu( item->getMedia()->psz_cover );
+ }
+#endif
+ QString key = QString("%1%2%3%4").arg(VLCModel::getMeta( index, COLUMN_TITLE )).arg( VLCModel::getMeta( index, COLUMN_ARTIST ) ).arg(index.data( VLCModel::IsCurrentRole ).toBool() ).arg( artURL );
QImage* src;
if( cache.contains( key ) )
@@ -796,7 +817,7 @@ public:
};
-PictureFlow::PictureFlow(QWidget* parent, PLModel* _p_model): QWidget(parent)
+PictureFlow::PictureFlow(QWidget* parent, VLCModel* _p_model): QWidget(parent)
{
d = new PictureFlowPrivate;
d->state = new PictureFlowState;
diff --git a/modules/gui/qt4/util/pictureflow.hpp b/modules/gui/qt4/util/pictureflow.hpp
index d30dddc..da10990 100644
--- a/modules/gui/qt4/util/pictureflow.hpp
+++ b/modules/gui/qt4/util/pictureflow.hpp
@@ -63,7 +63,7 @@ public:
/*!
Creates a new PictureFlow widget.
*/
- PictureFlow(QWidget* parent = 0, PLModel *model = 0);
+ PictureFlow(QWidget* parent = 0, VLCModel *model = 0);
/*!
Destroys the widget.
More information about the vlc-commits
mailing list