[vlc-commits] commit: Qt4: render artists/title on pictureflow (Ilkka Ollakka )

git at videolan.org git at videolan.org
Sun Oct 31 16:42:56 CET 2010


vlc | branch: master | Ilkka Ollakka <ileoo at videolan.org> | Sun Oct 31 17:40:55 2010 +0200| [451e40d90b16845871cc8a8a043d0fb0d3d4be92] | committer: Ilkka Ollakka 

Qt4: render artists/title on pictureflow

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=451e40d90b16845871cc8a8a043d0fb0d3d4be92
---

 modules/gui/qt4/util/pictureflow.cpp |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/modules/gui/qt4/util/pictureflow.cpp b/modules/gui/qt4/util/pictureflow.cpp
index 34fe4c2..c43e685 100644
--- a/modules/gui/qt4/util/pictureflow.cpp
+++ b/modules/gui/qt4/util/pictureflow.cpp
@@ -43,6 +43,7 @@
 #include <QVector>
 #include <QWidget>
 #include "../components/playlist/playlist_model.hpp" /* getArtPixmap etc */
+#include "../components/playlist/sorting.h"          /* Columns List */
 
 // for fixed-point arithmetic, we need minimum 32-bit long
 // long long (64-bit) might be useful for multiplication and division
@@ -444,6 +445,24 @@ void PictureFlowSoftwareRenderer::paint()
 
     QPainter painter(widget);
     painter.drawImage(QPoint(0, 0), buffer);
+
+    QModelIndex index = state->model->index( state->centerIndex, 0, state->model->currentIndex().parent() );
+
+    QString title = PLModel::getMeta( index, COLUMN_TITLE );
+    QString artist = PLModel::getMeta( index, COLUMN_ARTIST );
+    QFont font( index.data( Qt::FontRole ).value<QFont>() );
+    painter.setFont( font );
+    painter.setBrush( QBrush( Qt::lightGray ) );
+    painter.setPen( QColor( Qt::lightGray ) );
+    QFontMetrics fm = painter.fontMetrics();
+
+    QPoint textstart( buffer.width() / 2 - state->slideWidth/2 , buffer.height() / 2 + state->slideWidth/2 + 5 );
+    QPoint artiststart( 0, fm.xHeight() * 2 );
+
+    painter.drawText( textstart, title );
+
+    textstart += artiststart;
+    painter.drawText( textstart, artist);
 }
 
 void PictureFlowSoftwareRenderer::init()



More information about the vlc-commits mailing list