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

Qt: Forgotten native separators in open panel (cosmetic) and in preferences.

Should repair skins options.

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.

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