[vlc-commits] Qt: PLModel: Don't overpass pixmap cache for fetching image
Francois Cartegnie
git at videolan.org
Sun Aug 19 16:14:43 CEST 2012
vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sun Aug 19 16:11:40 2012 +0200| [c36afbf5452122071d264cb7d5e8131b0a828234] | committer: Francois Cartegnie
Qt: PLModel: Don't overpass pixmap cache for fetching image
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c36afbf5452122071d264cb7d5e8131b0a828234
---
modules/gui/qt4/components/playlist/playlist_model.cpp | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/modules/gui/qt4/components/playlist/playlist_model.cpp b/modules/gui/qt4/components/playlist/playlist_model.cpp
index 84e1ee8..86045bc 100644
--- a/modules/gui/qt4/components/playlist/playlist_model.cpp
+++ b/modules/gui/qt4/components/playlist/playlist_model.cpp
@@ -41,6 +41,7 @@
#include <QFont>
#include <QTimer>
#include <QAction>
+#include <QBuffer>
QIcon PLModel::icons[ITEM_TYPE_NUMBER];
@@ -390,8 +391,13 @@ QVariant PLModel::data( const QModelIndex &index, const int role ) const
}
name = qfu( p_item->psz_name );
PL_UNLOCK;
- return QVariant( QString("<img width=\"128\" height=\"128\" align=\"left\" src=\"%1\"/><div><b>%2</b><br/>%3</div>")
- .arg( artUrl )
+ QPixmap image = getArtPixmap( index, QSize( 128, 128 ) );
+ QByteArray bytes;
+ QBuffer buffer( &bytes );
+ buffer.open( QIODevice::WriteOnly );
+ image.save(&buffer, "BMP"); /* uncompressed, see qpixmap#reading-and-writing-image-files */
+ return QVariant( QString("<img width=\"128\" height=\"128\" align=\"left\" src=\"data:image/bmp;base64,%1\"/><div><b>%2</b><br/>%3</div>")
+ .arg( bytes.toBase64().constData() )
.arg( name )
.arg( qtr("Duration") + ": " + duration )
);
More information about the vlc-commits
mailing list