[vlc-commits] Qt4: simplify and improve playlist item folder exploration
Rémi Denis-Courmont
git at videolan.org
Sun Sep 25 16:04:12 CEST 2011
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Sep 25 15:48:34 2011 +0300| [629242be8991e0005db9d6b61e79e15c89b10793] | committer: Rémi Denis-Courmont
Qt4: simplify and improve playlist item folder exploration
Unfortunately, there is currently no way to determine whether the
MRL scheme uses file paths (e.g. file, dir, vdr, zip...) or not, so
we always try.
Anyway, the folder browsing menu item should not be visible at all when
the item is not a local file. So there is no need to deal with that
failure care here.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=629242be8991e0005db9d6b61e79e15c89b10793
---
.../gui/qt4/components/playlist/playlist_model.cpp | 42 +++++++------------
1 files changed, 16 insertions(+), 26 deletions(-)
diff --git a/modules/gui/qt4/components/playlist/playlist_model.cpp b/modules/gui/qt4/components/playlist/playlist_model.cpp
index 1985a2d..7b36a06 100644
--- a/modules/gui/qt4/components/playlist/playlist_model.cpp
+++ b/modules/gui/qt4/components/playlist/playlist_model.cpp
@@ -1045,39 +1045,29 @@ void PLModel::popupSave()
void PLModel::popupExplore()
{
+ char *uri = NULL, *path = NULL;
+
PL_LOCK;
playlist_item_t *p_item = playlist_ItemGetById( p_playlist, i_popup_item );
if( p_item )
{
input_item_t *p_input = p_item->p_input;
- char *psz_meta = input_item_GetURI( p_input );
- PL_UNLOCK;
- if( psz_meta )
- {
- const char *psz_access;
- const char *psz_demux;
- char *psz_path;
- input_SplitMRL( &psz_access, &psz_demux, &psz_path, psz_meta );
-
- if( !EMPTY_STR( psz_access ) && (
- !strncasecmp( psz_access, "file", 4 ) ||
- !strncasecmp( psz_access, "dire", 4 ) ))
- {
-#if defined( WIN32 ) || defined( __OS2__ )
- /* Qt openURL doesn't know to open files that starts with a / or \ */
- if( psz_path[0] == '/' || psz_path[0] == '\\' )
- psz_path++;
-#endif
+ uri = input_item_GetURI( p_input );
+ }
+ PL_UNLOCK;
- QFileInfo info( qfu( decode_URI( psz_path ) ) );
- QDesktopServices::openUrl(
- QUrl::fromLocalFile( info.absolutePath() ) );
- }
- free( psz_meta );
- }
+ if( uri != NULL )
+ {
+ path = make_path( uri );
+ free( uri );
}
- else
- PL_UNLOCK;
+ if( path == NULL )
+ return;
+
+ QFileInfo info( qfu( path ) );
+ free( path );
+
+ QDesktopServices::openUrl( QUrl::fromLocalFile( info.absolutePath() ) );
}
void PLModel::popupAddNode()
More information about the vlc-commits
mailing list