[vlc-commits] Qt4: add size-scale into playlist model

Ilkka Ollakka git at videolan.org
Thu Jul 7 15:46:54 CEST 2011


vlc | branch: master | Ilkka Ollakka <ileoo at videolan.org> | Thu Jul  7 16:45:01 2011 +0300| [bdd0c1e14f78691b42febbcea0f2a8f37031fc99] | committer: Ilkka Ollakka

Qt4: add size-scale into playlist model

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

 .../gui/qt4/components/playlist/playlist_model.cpp |    5 ++++-
 .../gui/qt4/components/playlist/playlist_model.hpp |   12 ++++++++++++
 2 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/modules/gui/qt4/components/playlist/playlist_model.cpp b/modules/gui/qt4/components/playlist/playlist_model.cpp
index 6d5d0c3..606069f 100644
--- a/modules/gui/qt4/components/playlist/playlist_model.cpp
+++ b/modules/gui/qt4/components/playlist/playlist_model.cpp
@@ -88,6 +88,8 @@ PLModel::PLModel( playlist_t *_p_playlist,  /* THEPL */
     ADD_ICON( NODE, ":/type/node" );
 #undef ADD_ICON
 
+    i_zoom = getSettings()->value( "Playlist/zoom", 0 ).toInt();
+
     rebuild( p_root );
     DCONNECT( THEMIM->getIM(), metaChanged( input_item_t *),
               this, processInputItemUpdate( input_item_t *) );
@@ -101,6 +103,7 @@ PLModel::PLModel( playlist_t *_p_playlist,  /* THEPL */
 
 PLModel::~PLModel()
 {
+    getSettings()->setValue( "Playlist/zoom", i_zoom );
     delete rootItem;
     delete sortingMenu;
 }
@@ -367,7 +370,7 @@ QVariant PLModel::data( const QModelIndex &index, const int role ) const
     else if( role == Qt::FontRole )
     {
         QFont f;
-        f.setPointSize( f.pointSize() - 1 );
+        f.setPointSize( f.pointSize() - 1 + i_zoom );
         if( isCurrent( index ) )
             f.setBold( true );
         return QVariant( f );
diff --git a/modules/gui/qt4/components/playlist/playlist_model.hpp b/modules/gui/qt4/components/playlist/playlist_model.hpp
index 925b129..d1bf758 100644
--- a/modules/gui/qt4/components/playlist/playlist_model.hpp
+++ b/modules/gui/qt4/components/playlist/playlist_model.hpp
@@ -104,6 +104,10 @@ public:
     {
         return getItem( index )->id();
     }
+    inline int getZoom() const
+    {
+        return i_zoom;
+    }
 
 signals:
     void currentChanged( const QModelIndex& );
@@ -112,6 +116,11 @@ signals:
 public slots:
     virtual void activateItem( const QModelIndex &index );
     void activateItem( playlist_item_t *p_item );
+    inline void changeZoom( const int zoom )
+    {
+        i_zoom = zoom;
+        emit layoutChanged();
+    }
 
 private:
     /* General */
@@ -153,6 +162,9 @@ private:
     int i_cached_id;
     int i_cached_input_id;
 
+    /* Zoom factor for font-size */
+    int i_zoom;
+
 private slots:
     void popupPlay();
     void popupDel();



More information about the vlc-commits mailing list