vlc | branch: master | Pierre Lamot <[email protected]> | Thu May 24 18:40:39 2018 +0200| [306e9cc9d53ef78640340835c9e97132a4e7e7cd] | committer: Jean-Baptiste Kempf
qt: remove useless QUrl conversions Signed-off-by: Jean-Baptiste Kempf <[email protected]> > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=306e9cc9d53ef78640340835c9e97132a4e7e7cd --- modules/gui/qt/dialogs_provider.cpp | 37 ++++++++++++------------------------- modules/gui/qt/dialogs_provider.hpp | 6 +----- 2 files changed, 13 insertions(+), 30 deletions(-) diff --git a/modules/gui/qt/dialogs_provider.cpp b/modules/gui/qt/dialogs_provider.cpp index d6edaa06d5..3061b2dad6 100644 --- a/modules/gui/qt/dialogs_provider.cpp +++ b/modules/gui/qt/dialogs_provider.cpp @@ -114,21 +114,6 @@ DialogsProvider::~DialogsProvider() delete miscPopupMenu; } -QStringList DialogsProvider::getOpenURL( QWidget *parent, - const QString &caption, - const QUrl &dir, - const QString &filter, - QString *selectedFilter ) -{ - QStringList res; - QList<QUrl> urls = QFileDialog::getOpenFileUrls( parent, caption, dir, filter, selectedFilter ); - - foreach( const QUrl& url, urls ) - res.append( url.toEncoded() ); - - return res; -} - QString DialogsProvider::getSaveFileName( QWidget *parent, const QString &caption, const QUrl &dir, @@ -405,17 +390,15 @@ void DialogsProvider::openFileGenericDialog( intf_dialog_args_t *p_arg ) } else /* non-save mode */ { - QStringList urls = getOpenURL( NULL, qfu( p_arg->psz_title ), + QList<QUrl> urls = QFileDialog::getOpenFileUrls( NULL, qfu( p_arg->psz_title ), p_intf->p_sys->filepath, extensions ); p_arg->i_results = urls.count(); p_arg->psz_results = (char **)vlc_alloc( p_arg->i_results, sizeof( char * ) ); i = 0; - foreach( const QString &uri, urls ) - p_arg->psz_results[i++] = strdup( qtu( uri ) ); - if(i == 0) - p_intf->p_sys->filepath = ""; - else - p_intf->p_sys->filepath = QUrl::fromEncoded(p_arg->psz_results[i-1]); + foreach( const QUrl &uri, urls ) + p_arg->psz_results[i++] = strdup( uri.toEncoded().constData() ); + if( !urls.isEmpty() ) + p_intf->p_sys->filepath = urls.last(); } /* Callback */ @@ -504,15 +487,19 @@ QStringList DialogsProvider::showSimpleOpen( const QString& help, fileTypes.replace( ";*", " *"); fileTypes.chop(2); //remove trailling ";;" - QStringList urls = getOpenURL( NULL, + QList<QUrl> urls = QFileDialog::getOpenFileUrls( NULL, help.isEmpty() ? qtr(I_OP_SEL_FILES ) : help, path.isEmpty() ? p_intf->p_sys->filepath : path, fileTypes ); if( !urls.isEmpty() ) - p_intf->p_sys->filepath = QUrl( urls.last() ); + p_intf->p_sys->filepath = urls.last(); - return urls; + QStringList res; + foreach( const QUrl &url, urls ) + res << url.toEncoded(); + + return res; } /** diff --git a/modules/gui/qt/dialogs_provider.hpp b/modules/gui/qt/dialogs_provider.hpp index 6476dbe124..8105c7f13d 100644 --- a/modules/gui/qt/dialogs_provider.hpp +++ b/modules/gui/qt/dialogs_provider.hpp @@ -91,11 +91,7 @@ public: const QUrl& path = QUrl() ); bool isDying() { return b_isDying; } static QString getDirectoryDialog( intf_thread_t *p_intf); - static QStringList getOpenURL(QWidget *parent = NULL, - const QString &caption = QString(), - const QUrl &dir = QUrl(), - const QString &filter = QString(), - QString *selectedFilter = NULL ); + static QString getSaveFileName(QWidget *parent = NULL, const QString &caption = QString(), const QUrl &dir = QUrl(), _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
