Commit a7838c2b authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt4 - unification of the common used path for QFileDialogs...

parent d64f6aac
......@@ -65,14 +65,9 @@ FileOpenPanel::FileOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
ADD_FILTER_ALL( fileTypes );
fileTypes.replace( QString(";*"), QString(" *"));
/* retrieve last known path used in file browsing */
char *psz_filepath = config_GetPsz( p_intf, "qt-filedialog-path" );
// Make this QFileDialog a child of tempWidget from the ui.
dialogBox = new FileOpenBox( ui.tempWidget, NULL,
qfu( EMPTY_STR( psz_filepath ) ?
psz_filepath : p_intf->p_libvlc->psz_homedir ), fileTypes );
delete psz_filepath;
qfu( p_intf->p_sys->psz_filepath ), fileTypes );
dialogBox->setFileMode( QFileDialog::ExistingFiles );
dialogBox->setAcceptMode( QFileDialog::AcceptOpen );
......@@ -138,7 +133,9 @@ FileOpenPanel::FileOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
CONNECT( ui.sizeSubComboBox, currentIndexChanged( int ), this, updateMRL() );
}
FileOpenPanel::~FileOpenPanel(){}
FileOpenPanel::~FileOpenPanel()
{
}
/* Show a fileBrowser to select a subtitle */
void FileOpenPanel::browseFileSub()
......@@ -178,15 +175,7 @@ void FileOpenPanel::updateMRL()
void FileOpenPanel::accept()
{
//TODO set the completer
const char *psz_filepath = config_GetPsz( p_intf, "qt-filedialog-path" );
if( ( NULL == psz_filepath )
|| strcmp( psz_filepath, qtu( dialogBox->directory().absolutePath() )) )
{
/* set dialog box current directory as last known path */
config_PutPsz( p_intf, "qt-filedialog-path",
qtu( dialogBox->directory().absolutePath() ) );
}
delete psz_filepath;
p_intf->p_sys->psz_filepath = qtu( dialogBox->directory().absolutePath() );
}
void FileOpenBox::accept()
......
......@@ -284,7 +284,7 @@ QStringList DialogsProvider::showSimpleOpen( QString help,
fileTypes.replace(QString(";*"), QString(" *"));
return QFileDialog::getOpenFileNames( NULL,
help.isNull() ? qfu(I_OP_SEL_FILES ) : help,
path.isNull() ? qfu( p_intf->p_libvlc->psz_homedir ) : path,
path.isNull() ? qfu( p_intf->p_sys->psz_filepath ) : path,
fileTypes );
}
......@@ -373,7 +373,7 @@ void DialogsProvider::saveAPlaylist()
{
QFileDialog *qfd = new QFileDialog( NULL,
qtr( "Choose a filename to save playlist" ),
qfu( p_intf->p_libvlc->psz_homedir ),
qfu( p_intf->p_sys->psz_filepath ),
qtr( "XSPF playlist (*.xspf);; " ) +
qtr( "M3U playlist (*.m3u);; Any (*.*) " ) );
qfd->setFileMode( QFileDialog::AnyFile );
......
......@@ -331,6 +331,12 @@ static void Init( intf_thread_t *p_intf )
/* Last settings */
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->psz_filepath = EMPTY_STR( psz_path ) ? psz_path
: p_intf->p_libvlc->psz_homedir;
delete psz_path;
/* Launch */
app->exec();
......@@ -347,6 +353,8 @@ static void Init( intf_thread_t *p_intf )
/* Destroy the MainInputManager */
MainInputManager::killInstance();
delete p_intf->p_sys->psz_filepath;
delete app;
}
......
......@@ -51,8 +51,8 @@ struct intf_sys_t
msg_subscription_t *p_sub; ///< Subscription to the message bank
VideoWidget *p_video;
int i_saved_height, i_saved_width;
char *psz_filepath;
QMenu * p_popup_menu;
};
......
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