[vlc-commits] Qt: add a new class helper to open files

Jean-Baptiste Kempf git at videolan.org
Sun May 18 16:42:52 CEST 2014


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Sun May 18 14:45:19 2014 +0200| [f2f7fd69c38def84c827bd2e051fed4308b1d0d4] | committer: Jean-Baptiste Kempf

Qt: add a new class helper to open files

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

 modules/gui/qt4/recents.cpp |   16 ++++++++++++++++
 modules/gui/qt4/recents.hpp |    9 +++++++++
 2 files changed, 25 insertions(+)

diff --git a/modules/gui/qt4/recents.cpp b/modules/gui/qt4/recents.cpp
index 3bb088f..7348602 100755
--- a/modules/gui/qt4/recents.cpp
+++ b/modules/gui/qt4/recents.cpp
@@ -22,6 +22,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
+#include "qt4.hpp"
 #include "recents.hpp"
 #include "dialogs_provider.hpp"
 #include "menus.hpp"
@@ -161,3 +162,18 @@ playlist_item_t *RecentsMRL::toPlaylist(int length)
 
     return p_node_recent;
 }
+
+void Open::openMRL( intf_thread_t *p_intf,
+                    const QString &mrl,
+                    bool b_start,
+                    bool b_playlist)
+{
+    playlist_Add( THEPL, qtu(mrl), NULL,
+                  PLAYLIST_APPEND | (b_start ? PLAYLIST_GO : PLAYLIST_PREPARSE),
+                  PLAYLIST_END,
+                  b_playlist,
+                  pl_Unlocked );
+
+    if( b_start && b_playlist )
+        RecentsMRL::getInstance( p_intf )->addRecent( mrl );
+}
diff --git a/modules/gui/qt4/recents.hpp b/modules/gui/qt4/recents.hpp
index 06c3d88..ad55562 100644
--- a/modules/gui/qt4/recents.hpp
+++ b/modules/gui/qt4/recents.hpp
@@ -35,6 +35,15 @@ class QSignalMapper;
 
 #define RECENTS_LIST_SIZE 10
 
+class Open
+{
+public:
+    void static openMRL( intf_thread_t*,
+                         const QString &,
+                         bool b_start = true,
+                         bool b_playlist = true);
+};
+
 class RecentsMRL : public QObject, public Singleton<RecentsMRL>
 {
     Q_OBJECT



More information about the vlc-commits mailing list