[vlc-commits] Qt: use the provided Singleton class for ActionsManager

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 12:41:49 2014 +0200| [4bb2e6927655c51b3cbdfd998b3f3e06df6ad507] | committer: Jean-Baptiste Kempf

Qt: use the provided Singleton class for ActionsManager

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

 modules/gui/qt4/actions_manager.cpp |    5 +----
 modules/gui/qt4/actions_manager.hpp |   20 ++++++--------------
 2 files changed, 7 insertions(+), 18 deletions(-)

diff --git a/modules/gui/qt4/actions_manager.cpp b/modules/gui/qt4/actions_manager.cpp
index d5595fd..60bb433 100644
--- a/modules/gui/qt4/actions_manager.cpp
+++ b/modules/gui/qt4/actions_manager.cpp
@@ -35,10 +35,7 @@
 #include "main_interface.hpp" /* Show playlist */
 #include "components/controller.hpp" /* Toggle FSC controller width */
 
-ActionsManager * ActionsManager::instance = NULL;
-
-ActionsManager::ActionsManager( intf_thread_t * _p_i, QObject *_parent )
-               : QObject( _parent )
+ActionsManager::ActionsManager( intf_thread_t * _p_i )
 {
     p_intf = _p_i;
 }
diff --git a/modules/gui/qt4/actions_manager.hpp b/modules/gui/qt4/actions_manager.hpp
index a694579..e397ac2 100644
--- a/modules/gui/qt4/actions_manager.hpp
+++ b/modules/gui/qt4/actions_manager.hpp
@@ -29,6 +29,7 @@
 #endif
 
 #include "qt4.hpp"
+#include "util/singleton.hpp"
 
 #include <QObject>
 typedef enum actionType_e
@@ -58,28 +59,18 @@ typedef enum actionType_e
     OPEN_SUB_ACTION,
 } actionType_e;
 
-class ActionsManager : public QObject
+class ActionsManager : public QObject, public Singleton<ActionsManager>
 {
 
     Q_OBJECT
+    friend class Singleton<ActionsManager>;
+
 public:
-    static ActionsManager *getInstance( intf_thread_t *_p_intf, QObject *_parent = 0 )
-    {
-        if( !instance )
-            instance = new ActionsManager( _p_intf, _parent );
-        return instance;
-    }
-    static void killInstance()
-    {
-        delete instance;
-        instance = NULL;
-    }
 
 private:
+    ActionsManager( intf_thread_t  *_p_i );
     virtual ~ActionsManager();
 
-    static ActionsManager *instance;
-    ActionsManager( intf_thread_t  *_p_i, QObject *_parent );
     intf_thread_t       *p_intf;
 
 public slots:
@@ -90,6 +81,7 @@ public slots:
     void record();
     void skipForward();
     void skipBackward();
+
 protected slots:
     void fullscreen();
     void snapshot();



More information about the vlc-commits mailing list