[vlc-commits] commit: Qt4: add toURI() helper ( Rémi Denis-Courmont )

git at videolan.org git at videolan.org
Wed Nov 10 17:24:13 CET 2010


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Nov 10 18:05:47 2010 +0200| [1bd04d54d732fc71f70afbcb7dacf39a657ac4c9] | committer: Rémi Denis-Courmont 

Qt4: add toURI() helper

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1bd04d54d732fc71f70afbcb7dacf39a657ac4c9
---

 modules/gui/qt4/Modules.am       |    1 +
 modules/gui/qt4/util/qt_dirs.cpp |   40 ++++++++++++++++++++++++++++++++++++++
 modules/gui/qt4/util/qt_dirs.hpp |    3 +-
 3 files changed, 43 insertions(+), 1 deletions(-)

diff --git a/modules/gui/qt4/Modules.am b/modules/gui/qt4/Modules.am
index b361677..3d500fe 100644
--- a/modules/gui/qt4/Modules.am
+++ b/modules/gui/qt4/Modules.am
@@ -275,6 +275,7 @@ SOURCES_qt4 = 	qt4.cpp \
 		util/input_slider.cpp \
 		util/customwidgets.cpp \
 		util/registry.cpp \
+		util/qt_dirs.cpp \
 		util/pictureflow.cpp
 
 noinst_HEADERS = \
diff --git a/modules/gui/qt4/util/qt_dirs.cpp b/modules/gui/qt4/util/qt_dirs.cpp
new file mode 100644
index 0000000..5656941
--- /dev/null
+++ b/modules/gui/qt4/util/qt_dirs.cpp
@@ -0,0 +1,40 @@
+/*****************************************************************************
+ * dirs.cpp : file path helpers
+ ****************************************************************************
+ * Copyright (C) 2010 the VideoLAN team
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "qt4.hpp"
+#include "qt_dirs.hpp"
+#include <vlc_url.h>
+
+QString toURI( const QString& s )
+{
+    QString path = toNativeSeparators( s );
+
+    char *psz = make_URI( qtu(path), NULL );
+    if( psz == NULL )
+        return qfu("");
+
+    QString uri = qfu( psz );
+    free( psz );
+    return uri;
+}
diff --git a/modules/gui/qt4/util/qt_dirs.hpp b/modules/gui/qt4/util/qt_dirs.hpp
index 08cad1c..a6ea07c 100644
--- a/modules/gui/qt4/util/qt_dirs.hpp
+++ b/modules/gui/qt4/util/qt_dirs.hpp
@@ -47,5 +47,6 @@ static inline QString colon_unescape( QString s )
 {
     return s.replace( "\\:", ":" ).trimmed();
 }
-#endif
 
+QString toURI( const QString& s );
+#endif



More information about the vlc-commits mailing list