[vlc-commits] Qt: use provided Singleton util for RecentsMRL

Jean-Baptiste Kempf git at videolan.org
Sun May 18 13:13:29 CEST 2014


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Sun May 18 13:12:40 2014 +0200| [f9bab4b46cf70f0ebd5947448588a6aff55e4f4f] | committer: Jean-Baptiste Kempf

Qt: use provided Singleton util for RecentsMRL

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

 modules/gui/qt4/recents.cpp |    2 --
 modules/gui/qt4/recents.hpp |   18 +++---------------
 2 files changed, 3 insertions(+), 17 deletions(-)

diff --git a/modules/gui/qt4/recents.cpp b/modules/gui/qt4/recents.cpp
index 316b6ee..cac31b5 100755
--- a/modules/gui/qt4/recents.cpp
+++ b/modules/gui/qt4/recents.cpp
@@ -50,8 +50,6 @@
 #endif
 
 
-RecentsMRL* RecentsMRL::instance = NULL;
-
 RecentsMRL::RecentsMRL( intf_thread_t *_p_intf ) : p_intf( _p_intf )
 {
     stack = new QStringList;
diff --git a/modules/gui/qt4/recents.hpp b/modules/gui/qt4/recents.hpp
index ebcf747..0db9fea 100644
--- a/modules/gui/qt4/recents.hpp
+++ b/modules/gui/qt4/recents.hpp
@@ -25,6 +25,7 @@
 #define QVLC_RECENTS_H_
 
 #include "qt4.hpp"
+#include "util/singleton.hpp"
 
 #include <QObject>
 class QStringList;
@@ -33,23 +34,12 @@ class QSignalMapper;
 
 #define RECENTS_LIST_SIZE 10
 
-class RecentsMRL : public QObject
+class RecentsMRL : public QObject, public Singleton<RecentsMRL>
 {
     Q_OBJECT
+    friend class Singleton<RecentsMRL>;
 
 public:
-    static RecentsMRL* getInstance( intf_thread_t* p_intf )
-    {
-        if(!instance)
-            instance = new RecentsMRL( p_intf );
-        return instance;
-    }
-    static void killInstance()
-    {
-        delete instance;
-        instance = NULL;
-    }
-
     void addRecent( const QString & );
     QStringList recents();
     playlist_item_t *toPlaylist(int length);
@@ -59,8 +49,6 @@ private:
     RecentsMRL( intf_thread_t* _p_intf );
     virtual ~RecentsMRL();
 
-    static RecentsMRL *instance;
-
     intf_thread_t *p_intf;
     QStringList   *stack;
     QRegExp       *filter;



More information about the vlc-commits mailing list