]> git.sesse.net Git - vlc/commitdiff
Qt4- Playlist Model. Save the showColumn flags in the configuration ONLY during distr...
authorJean-Baptiste Kempf <jb@videolan.org>
Sat, 26 Jan 2008 06:11:20 +0000 (06:11 +0000)
committerJean-Baptiste Kempf <jb@videolan.org>
Sat, 26 Jan 2008 06:11:20 +0000 (06:11 +0000)
modules/gui/qt4/components/playlist/playlist_item.cpp
modules/gui/qt4/components/playlist/playlist_model.cpp

index 8bedd90b38bbbf08765003b959c387b689bf2d08..65e731ca7a65f807ad8e720a7c8d1601e29509ac 100644 (file)
@@ -29,7 +29,6 @@
 
 #include "qt4.hpp"
 #include "components/playlist/playlist_model.hpp"
-#include "dialogs/mediainfo.hpp"
 #include <vlc_intf_strings.h>
 
 #include "pixmaps/type_unknown.xpm"
@@ -60,7 +59,7 @@ void PLItem::init( int _i_id, int _i_input_id, PLItem *parent, PLModel *m )
     /* No parent, should be the main one */
     if( parentItem == NULL )
     {
-        i_showflags = config_GetInt( model->p_intf, "qt-pl-showflags" );
+        i_showflags = model->shownFlags();
         updateColumnHeaders();
     }
     else
@@ -98,7 +97,7 @@ void PLItem::updateColumnHeaders()
 {
     item_col_strings.clear();
 
-    if( model->i_depth == 1 )  /* Selector Panel */
+    if( model->i_depth == DEPTH_SEL )  /* Selector Panel */
     {
         item_col_strings.append( "" );
         return;
@@ -175,6 +174,13 @@ int PLItem::row() const
 }
 
 /* update the PL Item, get the good names and so on */
+/* This function may not be the best way to do it
+   It destroys everything and gets everything again instead of just
+   building the necessary columns.
+   This does extra work if you re-display the same column. Slower...
+   On the other hand, this way saves memory.
+   There must be a more clever way.
+   */
 void PLItem::update( playlist_item_t *p_item, bool iscurrent )
 {
     char psz_duration[MSTRTIME_MAX_SIZE];
index 7802f388754ea0305663494f9c168b764bee6264..994b39b76704bf6010a8f7393b05ef6268effb69 100644 (file)
@@ -98,6 +98,8 @@ PLModel::PLModel( playlist_t *_p_playlist,  /* THEPL */
 
 PLModel::~PLModel()
 {
+    config_PutInt( p_intf, "qt-pl-showflags", rootItem->i_showflags );
+    config_SaveConfigFile( p_intf, NULL );
     delCallbacks();
     delete rootItem;
 }
@@ -835,8 +837,6 @@ void PLModel::viewchanged( int meta )
            endInsertColumns();
        }
        rebuild();
-       config_PutInt( p_intf, "qt-pl-showflags", rootItem->i_showflags );
-       config_SaveConfigFile( p_intf, NULL );
    }
 }