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

Remove remaining / in folder names, and use normale DIR_SEP in all platforms.

This seems to have been an issue with many people on windows.
parent 3101cfab
......@@ -405,11 +405,11 @@ void DiscOpenPanel::updateMRL()
void DiscOpenPanel::browseDevice()
{
QString dir = QFileDialog::getExistingDirectory( 0,
QString dir = QFileDialog::getExistingDirectory( this,
qtr( I_DEVICE_TOOLTIP ) );
if (!dir.isEmpty()) {
ui.deviceCombo->setEditText( toNativeSeparators( dir ) );
}
if (!dir.isEmpty())
ui.deviceCombo->setEditText( toNativeSepNoSlash( dir ) );
updateMRL();
}
......
......@@ -304,7 +304,7 @@ void FileConfigControl::updateField()
QString file = QFileDialog::getOpenFileName( NULL,
qtr( "Select File" ), qfu( config_GetHomeDir() ) );
if( file.isNull() ) return;
text->setText( file );
text->setText( toNativeSeparators( file ) );
}
void FileConfigControl::finish()
......@@ -334,10 +334,10 @@ void DirectoryConfigControl::updateField()
qtr( "Select Directory" ),
text->text().isEmpty() ?
qfu( config_GetHomeDir() ) : text->text(),
QFileDialog::ShowDirsOnly |
QFileDialog::DontResolveSymlinks );
QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks );
if( dir.isNull() ) return;
text->setText( toNativeSeparators( dir ) );
text->setText( toNativeSepNoSlash( dir ) );
}
#if 0
......
......@@ -276,14 +276,9 @@ void UpdateDialog::UpdateOrDownload()
qtr( "Select a directory..." ),
qfu( config_GetHomeDir() ) );
if( dest_dir != "" )
if( !dest_dir.isEmpty() )
{
/*HACK: Qt4 isn't able to change the way OS deals with directories
names. Windows doesn't add an ending separator so we might add it.
*/
#if defined( WIN32 ) || defined( UNDER_CE )
dest_dir += DIR_SEP;
#endif
dest_dir = toNativeSepNoSlash( dest_dir ) + DIR_SEP;
msg_Dbg( p_intf, "Downloading to folder: %s", qtu( dest_dir ) );
toggleVisible();
update_Download( p_update, qtu( dest_dir ) );
......
......@@ -286,9 +286,9 @@ SoutDialog::SoutDialog( QWidget *parent, intf_thread_t *_p_intf,
void SoutDialog::fileBrowse()
{
QString fileName = QFileDialog::getSaveFileName( this, qtr( "Save file..." ), "",
qtr( "Containers (*.ps *.ts *.mpg *.ogg *.asf *.mp4 *.mov *.wav *.raw *.flv)" ) );
ui.fileEdit->setText( fileName );
QString fileName = QFileDialog::getSaveFileName( this, qtr( "Save file..." ),
"", qtr( "Containers (*.ps *.ts *.mpg *.ogg *.asf *.mp4 *.mov *.wav *.raw *.flv)" ) );
ui.fileEdit->setText( toNativeSeparators( fileName ) );
updateMRL();
}
......
......@@ -279,7 +279,7 @@ void DialogsProvider::openFileGenericDialog( intf_dialog_args_t *p_arg )
{
p_arg->i_results = 1;
p_arg->psz_results = (char **)malloc( p_arg->i_results * sizeof( char * ) );
p_arg->psz_results[0] = strdup( qtu( file ) );
p_arg->psz_results[0] = strdup( qtu( toNativeSepNoSlash( file ) ) );
}
else
p_arg->i_results = 0;
......@@ -293,7 +293,7 @@ void DialogsProvider::openFileGenericDialog( intf_dialog_args_t *p_arg )
p_arg->psz_results = (char **)malloc( p_arg->i_results * sizeof( char * ) );
i = 0;
foreach( QString file, files )
p_arg->psz_results[i++] = strdup( qtu( file ) );
p_arg->psz_results[i++] = strdup( qtu( toNativeSepNoSlash( file ) ) );
}
/* Callback */
......@@ -368,6 +368,7 @@ QStringList DialogsProvider::showSimpleOpen( QString help,
}
ADD_FILTER_ALL( fileTypes );
fileTypes.replace(QString(";*"), QString(" *"));
return QFileDialog::getOpenFileNames( NULL,
help.isNull() ? qfu(I_OP_SEL_FILES ) : help,
path.isNull() ? qfu( p_intf->p_sys->psz_filepath ) : path,
......@@ -385,7 +386,7 @@ void DialogsProvider::addFromSimple( bool pl, bool go)
int i = 0;
foreach( QString file, files )
{
const char * psz_utf8 = qtu( file );
const char * psz_utf8 = qtu( toNativeSeparators( file ) );
playlist_Add( THEPL, psz_utf8, NULL,
go ? ( PLAYLIST_APPEND | ( i ? 0 : PLAYLIST_GO ) |
( i ? PLAYLIST_PREPARSE : 0 ) )
......@@ -419,11 +420,13 @@ void DialogsProvider::simpleMLAppendDialog()
**/
static void openDirectory( intf_thread_t *p_intf, bool pl, bool go )
{
QString dir = QFileDialog::getExistingDirectory( 0, qtr("Open Directory") );
if (!dir.isEmpty()) {
QString dir = QFileDialog::getExistingDirectory( NULL, qtr("Open Directory") );
if (!dir.isEmpty() )
{
input_item_t *p_input = input_item_NewExt( THEPL,
qtu( "directory://" + dir ), NULL,
0, NULL, -1 );
qtu( "directory://" + toNativeSeparators(dir) ),
NULL, 0, NULL, -1 );
/* FIXME: playlist_AddInput() can fail */
playlist_AddInput( THEPL, p_input,
......@@ -459,7 +462,7 @@ void DialogsProvider::openAPlaylist()
EXT_FILTER_PLAYLIST );
foreach( QString file, files )
{
playlist_Import( THEPL, qtu(file) );
playlist_Import( THEPL, qtu( toNativeSeparators( file ) ) );
}
}
......@@ -499,8 +502,8 @@ void DialogsProvider::saveAPlaylist()
file.append( ".m3u" );
}
playlist_Export( THEPL, qtu( file ), THEPL->p_local_category,
psz_module);
playlist_Export( THEPL, qtu( toNativeSeparators( file ) ),
THEPL->p_local_category, psz_module);
}
}
delete qfd;
......@@ -633,7 +636,8 @@ void DialogsProvider::loadSubtitlesFile()
QString qsFile;
foreach( qsFile, qsl )
{
if( !input_AddSubtitles( p_input, qtu( qsFile ), true ) )
if( !input_AddSubtitles( p_input, qtu( toNativeSeparators( qsFile ) ),
true ) )
msg_Warn( p_intf, "unable to load subtitles from '%s'",
qtu( qsFile ) );
}
......
......@@ -132,6 +132,15 @@ static inline QString toNativeSeparators( QString s )
return s;
}
static inline QString removeTrailingSlash( QString s )
{
if( ( s.length() > 1 ) && ( s[s.length()-1] == QLatin1Char( '/' ) ) )
s.remove( s.length() - 1, 1 );
return s;
}
#define toNativeSepNoSlash( a ) toNativeSeparators( removeTrailingSlash( a ) )
static const int DialogEvent_Type = QEvent::User + DialogEventType + 1;
//static const int PLUndockEvent_Type = QEvent::User + DialogEventType + 2;
//static const int PLDockEvent_Type = QEvent::User + DialogEventType + 3;
......
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