]> git.sesse.net Git - vlc/commitdiff
Qt: store the filedialog path in Qt setings, instead of vlc config (internal option...
authorJean-Baptiste Kempf <jb@videolan.org>
Thu, 18 Jun 2009 23:05:58 +0000 (01:05 +0200)
committerJean-Baptiste Kempf <jb@videolan.org>
Fri, 19 Jun 2009 14:53:26 +0000 (16:53 +0200)
This simplifies a bit the code, should solve the issue reported over and over by the users.

modules/gui/qt4/qt4.cpp

index e79b14eeb41925f77b1fcc6818fbfdfe63340729..0db64c3b4d99957b3c7b6b4ac74debb0b9b70215 100644 (file)
@@ -95,8 +95,6 @@ static void ShowDialog   ( intf_thread_t *, int, int, intf_dialog_args_t * );
 #define TITLE_LONGTEXT N_( "Show the name of the song or video in the " \
                            "controler window title." )
 
-#define FILEDIALOG_PATH_TEXT N_( "Path to use in openfile dialog" )
-
 #define NOTIFICATION_TEXT N_( "Show notification popup on track change" )
 #define NOTIFICATION_LONGTEXT N_( \
     "Show a notification popup with the artist and track name when " \
@@ -198,10 +196,6 @@ vlc_module_begin ()
               COMPLETEVOL_LONGTEXT, true )
     add_bool( "qt-autosave-volume", false, NULL, SAVEVOL_TEXT,
               SAVEVOL_TEXT, true )
-    add_string( "qt-filedialog-path", NULL, NULL, FILEDIALOG_PATH_TEXT,
-                FILEDIALOG_PATH_TEXT, true )
-        change_autosave ()
-        change_internal ()
 
     add_bool( "qt-embedded-open", false, NULL, QT_NATIVEOPEN_TEXT,
                QT_NATIVEOPEN_TEXT, false )
@@ -446,12 +440,8 @@ static void *Thread( void *obj )
     app.setQuitOnLastWindowClosed( false );
 
     /* Retrieve last known path used in file browsing */
-    {
-        char *psz_path = config_GetPsz( p_intf, "qt-filedialog-path" );
-        p_intf->p_sys->filepath =
-            EMPTY_STR( psz_path ) ? config_GetHomeDir() : qfu( psz_path );
-        free( psz_path );
-    }
+    p_intf->p_sys->filepath =
+         getSettings()->value( "filedialog-path", config_GetHomeDir() ).toString();
 
     /* Launch */
     app.exec();
@@ -482,6 +472,9 @@ static void *Thread( void *obj )
     /* Delete the recentsMRL object before the configuration */
     RecentsMRL::killInstance();
 
+    /* Save the path */
+    getSettings()->setValue( "filedialog-path", p_intf->p_sys->filepath );
+
     /* Delete the configuration. Application has to be deleted after that. */
     delete p_intf->p_sys->mainSettings;
 
@@ -489,10 +482,6 @@ static void *Thread( void *obj )
     MainInputManager::killInstance();
 
 
-    /* Save the path */
-    config_PutPsz( p_intf->p_libvlc, "qt-filedialog-path",
-                   qtu( p_intf->p_sys->filepath ) );
-    msg_Dbg( p_intf, "%s", qtu( p_intf->p_sys->filepath ) );
 
     /* Delete the application automatically */
 #ifdef Q_WS_X11