Commit c36afbf5 authored by Francois Cartegnie's avatar Francois Cartegnie

Qt: PLModel: Don't overpass pixmap cache for fetching image

parent 42961aca
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#include <QFont> #include <QFont>
#include <QTimer> #include <QTimer>
#include <QAction> #include <QAction>
#include <QBuffer>
QIcon PLModel::icons[ITEM_TYPE_NUMBER]; QIcon PLModel::icons[ITEM_TYPE_NUMBER];
...@@ -390,8 +391,13 @@ QVariant PLModel::data( const QModelIndex &index, const int role ) const ...@@ -390,8 +391,13 @@ QVariant PLModel::data( const QModelIndex &index, const int role ) const
} }
name = qfu( p_item->psz_name ); name = qfu( p_item->psz_name );
PL_UNLOCK; PL_UNLOCK;
return QVariant( QString("<img width=\"128\" height=\"128\" align=\"left\" src=\"%1\"/><div><b>%2</b><br/>%3</div>") QPixmap image = getArtPixmap( index, QSize( 128, 128 ) );
.arg( artUrl ) 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( name )
.arg( qtr("Duration") + ": " + duration ) .arg( qtr("Duration") + ": " + duration )
); );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment