[vlc-commits] Qt: MIM: Make use of singleton

Francois Cartegnie git at videolan.org
Fri Feb 18 17:26:51 CET 2011


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Feb 18 17:23:52 2011 +0100| [bfa0a5e1d675e9aed9c80380d1718def8db5d008] | committer: Francois Cartegnie

Qt: MIM: Make use of singleton

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

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

diff --git a/modules/gui/qt4/input_manager.cpp b/modules/gui/qt4/input_manager.cpp
index a33b360..c39b4bf 100644
--- a/modules/gui/qt4/input_manager.cpp
+++ b/modules/gui/qt4/input_manager.cpp
@@ -939,7 +939,6 @@ void InputManager::AtoBLoop( float, int64_t i_time, int )
  * take care of updating the main playlist input.
  * Used in the main playlist Dialog
  **********************************************************************/
-MainInputManager * MainInputManager::instance = NULL;
 
 MainInputManager::MainInputManager( intf_thread_t *_p_intf )
                  : QObject(NULL), p_intf( _p_intf )
diff --git a/modules/gui/qt4/input_manager.hpp b/modules/gui/qt4/input_manager.hpp
index fde6ae0..4701102 100644
--- a/modules/gui/qt4/input_manager.hpp
+++ b/modules/gui/qt4/input_manager.hpp
@@ -32,6 +32,7 @@
 #include <vlc_input.h>
 
 #include "qt4.hpp"
+#include "util/singleton.hpp"
 
 #include <QObject>
 #include <QEvent>
@@ -241,22 +242,11 @@ signals:
     void epgChanged();
 };
 
-class MainInputManager : public QObject
+class MainInputManager : public QObject, public Singleton<MainInputManager>
 {
     Q_OBJECT
+    friend class Singleton<MainInputManager>;
 public:
-    static MainInputManager *getInstance( intf_thread_t *_p_intf )
-    {
-        if( !instance )
-            instance = new MainInputManager( _p_intf );
-        return instance;
-    }
-    static void killInstance()
-    {
-        delete instance;
-        instance = NULL;
-    }
-
     input_thread_t *getInput() { return p_input; }
     InputManager *getIM() { return im; }
     inline input_item_t *currentInputItem()
@@ -272,8 +262,6 @@ private:
     MainInputManager( intf_thread_t * );
     virtual ~MainInputManager();
 
-    static MainInputManager *instance;
-
     void customEvent( QEvent * );
 
     InputManager            *im;



More information about the vlc-commits mailing list