Commit b216a623 authored by Damien Fouilleul's avatar Damien Fouilleul

- Qt4: remember last directory browsed in file dialog

parent d4c99c42
...@@ -61,6 +61,14 @@ FileOpenPanel::FileOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : ...@@ -61,6 +61,14 @@ FileOpenPanel::FileOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
/* dialogBox->setFileMode( QFileDialog::ExistingFiles );*/ /* dialogBox->setFileMode( QFileDialog::ExistingFiles );*/
dialogBox->setAcceptMode( QFileDialog::AcceptOpen ); dialogBox->setAcceptMode( QFileDialog::AcceptOpen );
/* retrieve last known path used in file browsing */
char *psz_filepath = config_GetPsz( p_intf, "qt-filedialog-path" );
if( psz_filepath )
{
dialogBox->setDirectory( QString::fromUtf8(psz_filepath) );
delete psz_filepath;
}
/* We don't want to see a grip in the middle of the window, do we? */ /* We don't want to see a grip in the middle of the window, do we? */
dialogBox->setSizeGripEnabled( false ); dialogBox->setSizeGripEnabled( false );
dialogBox->setToolTip( qtr( "Select one or multiple files, or a folder" )); dialogBox->setToolTip( qtr( "Select one or multiple files, or a folder" ));
...@@ -172,6 +180,17 @@ void FileOpenPanel::updateMRL() ...@@ -172,6 +180,17 @@ void FileOpenPanel::updateMRL()
int size = ui.sizeSubComboBox->itemData( ui.sizeSubComboBox->currentIndex() ).toInt(); int size = ui.sizeSubComboBox->itemData( ui.sizeSubComboBox->currentIndex() ).toInt();
mrl.append( " :freetype-rel-fontsize=" + QString().setNum( size ) ); mrl.append( " :freetype-rel-fontsize=" + QString().setNum( size ) );
} }
const char *psz_filepath = config_GetPsz( p_intf, "qt-filedialog-path" );
if( (NULL == psz_filepath)
|| strcmp(psz_filepath,dialogBox->directory().absolutePath().toUtf8()) )
{
/* set dialog box current directory as last known path */
config_PutPsz( p_intf, "qt-filedialog-path",
dialogBox->directory().absolutePath().toUtf8() );
}
delete psz_filepath;
emit mrlUpdated( mrl ); emit mrlUpdated( mrl );
emit methodChanged( "file-caching" ); emit methodChanged( "file-caching" );
} }
......
...@@ -57,6 +57,10 @@ static void ShowDialog ( intf_thread_t *, int, int, intf_dialog_args_t * ); ...@@ -57,6 +57,10 @@ static void ShowDialog ( intf_thread_t *, int, int, intf_dialog_args_t * );
#define MINIMIZED_LONGTEXT N_("When you launch VLC with that option" \ #define MINIMIZED_LONGTEXT N_("When you launch VLC with that option" \
"VLC will start just with an icon in" \ "VLC will start just with an icon in" \
"your taskbar") "your taskbar")
#define FILEDIALOG_PATH_TEXT N_("path to use in file dialog")
#define FILEDIALOG_PATH_LONGTEXT N_("path to use in file dialog")
vlc_module_begin(); vlc_module_begin();
set_shortname( (char *)"Qt" ); set_shortname( (char *)"Qt" );
set_description( (char*)_("Qt interface") ); set_description( (char*)_("Qt interface") );
...@@ -79,6 +83,10 @@ vlc_module_begin(); ...@@ -79,6 +83,10 @@ vlc_module_begin();
SYSTRAY_LONGTEXT, VLC_FALSE); SYSTRAY_LONGTEXT, VLC_FALSE);
add_bool( "qt-start-mininimized", VLC_FALSE, NULL, MINIMIZED_TEXT, add_bool( "qt-start-mininimized", VLC_FALSE, NULL, MINIMIZED_TEXT,
MINIMIZED_LONGTEXT, VLC_TRUE); MINIMIZED_LONGTEXT, VLC_TRUE);
add_string( "qt-filedialog-path", NULL, NULL, FILEDIALOG_PATH_TEXT,
FILEDIALOG_PATH_LONGTEXT, VLC_TRUE);
change_autosave();
change_internal();
set_callbacks( OpenDialogs, Close ); set_callbacks( OpenDialogs, Close );
vlc_module_end(); vlc_module_end();
......
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