[vlc-devel] commit: qt4: cleaning the singletons implementation. ( Rémi Duraffort )
git version control
git at videolan.org
Mon Mar 16 10:25:33 CET 2009
vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Sun Mar 15 22:57:48 2009 +0100| [e0a09aa309ec492aed298dbde9193884048b6aef] | committer: Rémi Duraffort
qt4: cleaning the singletons implementation.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e0a09aa309ec492aed298dbde9193884048b6aef
---
modules/gui/qt4/actions_manager.hpp | 6 ++++--
modules/gui/qt4/components/extended_panels.cpp | 3 +--
modules/gui/qt4/dialogs/bookmarks.hpp | 5 +++--
modules/gui/qt4/dialogs/extended.hpp | 5 +++--
modules/gui/qt4/dialogs/help.hpp | 8 +++++---
modules/gui/qt4/dialogs/mediainfo.hpp | 6 +++---
modules/gui/qt4/dialogs/messages.hpp | 5 +++--
modules/gui/qt4/dialogs/open.hpp | 4 ++--
modules/gui/qt4/dialogs/playlist.hpp | 4 ++--
modules/gui/qt4/dialogs/toolbar.hpp | 5 +++--
modules/gui/qt4/dialogs_provider.hpp | 7 ++++---
modules/gui/qt4/input_manager.hpp | 6 ++++--
modules/gui/qt4/main_interface.cpp | 2 +-
modules/gui/qt4/recents.hpp | 8 +++++---
14 files changed, 43 insertions(+), 31 deletions(-)
diff --git a/modules/gui/qt4/actions_manager.hpp b/modules/gui/qt4/actions_manager.hpp
index 97870b3..d42519e 100644
--- a/modules/gui/qt4/actions_manager.hpp
+++ b/modules/gui/qt4/actions_manager.hpp
@@ -66,11 +66,13 @@ public:
}
static void killInstance()
{
- if( instance ) delete instance;
+ delete instance;
+ instance = NULL;
}
- virtual ~ActionsManager();
private:
+ virtual ~ActionsManager();
+
static ActionsManager *instance;
ActionsManager( intf_thread_t *_p_i, QObject *_parent );
intf_thread_t *p_intf;
diff --git a/modules/gui/qt4/components/extended_panels.cpp b/modules/gui/qt4/components/extended_panels.cpp
index b78a3ba..0a303c0 100644
--- a/modules/gui/qt4/components/extended_panels.cpp
+++ b/modules/gui/qt4/components/extended_panels.cpp
@@ -615,8 +615,7 @@ ExtV4l2::ExtV4l2( intf_thread_t *_p_intf, QWidget *_parent )
ExtV4l2::~ExtV4l2()
{
- if( box )
- delete box;
+ delete box;
}
void ExtV4l2::showEvent( QShowEvent *event )
diff --git a/modules/gui/qt4/dialogs/bookmarks.hpp b/modules/gui/qt4/dialogs/bookmarks.hpp
index eb85f7e..3f77d92 100644
--- a/modules/gui/qt4/dialogs/bookmarks.hpp
+++ b/modules/gui/qt4/dialogs/bookmarks.hpp
@@ -42,12 +42,13 @@ public:
}
static void killInstance()
{
- if( instance ) delete instance;
+ delete instance;
instance = NULL;
}
- virtual ~BookmarksDialog();
private:
BookmarksDialog( intf_thread_t * );
+ virtual ~BookmarksDialog();
+
static BookmarksDialog *instance;
void update();
QTreeWidget *bookmarksList;
diff --git a/modules/gui/qt4/dialogs/extended.hpp b/modules/gui/qt4/dialogs/extended.hpp
index 93a23ff..da5e29a 100644
--- a/modules/gui/qt4/dialogs/extended.hpp
+++ b/modules/gui/qt4/dialogs/extended.hpp
@@ -42,13 +42,14 @@ public:
}
static void killInstance()
{
- if( instance ) delete instance;
+ delete instance;
instance = NULL;
}
- virtual ~ExtendedDialog();
void showTab( int i );
private:
ExtendedDialog( intf_thread_t * );
+ virtual ~ExtendedDialog();
+
static ExtendedDialog *instance;
SyncControls *syncW;
diff --git a/modules/gui/qt4/dialogs/help.hpp b/modules/gui/qt4/dialogs/help.hpp
index af4ea4f..c6cde3a 100644
--- a/modules/gui/qt4/dialogs/help.hpp
+++ b/modules/gui/qt4/dialogs/help.hpp
@@ -50,12 +50,14 @@ public:
return instance;
}
static void killInstance()
- { if( instance ) delete instance; instance = NULL;}
- virtual ~HelpDialog();
+ { delete instance; instance = NULL;}
private:
HelpDialog( intf_thread_t * );
+ virtual ~HelpDialog();
+
static HelpDialog *instance;
+
public slots:
void close();
};
@@ -99,7 +101,7 @@ public:
return instance;
}
static void killInstance()
- { if( instance ) delete instance; instance = NULL;}
+ { delete instance; instance = NULL;}
void updateNotify( bool );
diff --git a/modules/gui/qt4/dialogs/mediainfo.hpp b/modules/gui/qt4/dialogs/mediainfo.hpp
index 98851d3..8b591c7 100644
--- a/modules/gui/qt4/dialogs/mediainfo.hpp
+++ b/modules/gui/qt4/dialogs/mediainfo.hpp
@@ -45,18 +45,18 @@ public:
static void killInstance()
{
- if( instance ) delete instance;
+ delete instance;
instance = NULL;
}
- virtual ~MediaInfoDialog();
-
void showTab( int );
#if 0
void setInput( input_item_t * );
#endif
private:
+ virtual ~MediaInfoDialog();
+
static MediaInfoDialog *instance;
bool isMainInputInfo;
diff --git a/modules/gui/qt4/dialogs/messages.hpp b/modules/gui/qt4/dialogs/messages.hpp
index 3b311db..def795d 100644
--- a/modules/gui/qt4/dialogs/messages.hpp
+++ b/modules/gui/qt4/dialogs/messages.hpp
@@ -47,14 +47,15 @@ public:
}
static void killInstance()
{
- if( instance ) delete instance;
+ delete instance;
instance = NULL;
}
- virtual ~MessagesDialog();
private:
MessagesDialog( intf_thread_t * );
+ virtual ~MessagesDialog();
+
static MessagesDialog *instance;
QTabWidget *mainTab;
QSpinBox *verbosityBox;
diff --git a/modules/gui/qt4/dialogs/open.hpp b/modules/gui/qt4/dialogs/open.hpp
index 4b791e0..bdaaa33 100644
--- a/modules/gui/qt4/dialogs/open.hpp
+++ b/modules/gui/qt4/dialogs/open.hpp
@@ -64,10 +64,9 @@ public:
static void killInstance()
{
- if( instance ) delete instance;
+ delete instance;
instance = NULL;
}
- virtual ~OpenDialog();
void showTab( int = OPEN_FILE_TAB );
QString getMRL( bool b = true );
@@ -82,6 +81,7 @@ public slots:
private:
OpenDialog( QWidget *parent, intf_thread_t *, bool b_selectMode,
int _action_flag = 0, bool b_pl = true );
+ virtual ~OpenDialog();
static OpenDialog *instance;
input_thread_t *p_input;
diff --git a/modules/gui/qt4/dialogs/playlist.hpp b/modules/gui/qt4/dialogs/playlist.hpp
index 1aabccf..a27ed8e 100644
--- a/modules/gui/qt4/dialogs/playlist.hpp
+++ b/modules/gui/qt4/dialogs/playlist.hpp
@@ -48,12 +48,12 @@ public:
}
static void killInstance()
{
- if( instance ) delete instance;
+ delete instance;
instance = NULL;
}
- virtual ~PlaylistDialog();
private:
PlaylistDialog( intf_thread_t * );
+ virtual ~PlaylistDialog();
void dropEvent( QDropEvent *);
void dragEnterEvent( QDragEnterEvent * );
diff --git a/modules/gui/qt4/dialogs/toolbar.hpp b/modules/gui/qt4/dialogs/toolbar.hpp
index d0d13d9..3fbb82f 100644
--- a/modules/gui/qt4/dialogs/toolbar.hpp
+++ b/modules/gui/qt4/dialogs/toolbar.hpp
@@ -69,13 +69,14 @@ public:
return instance;
}
static void killInstance()
- { if( instance ) delete instance; instance = NULL;}
- virtual ~ToolbarEditDialog();
+ { delete instance; instance = NULL;}
int getOptions() { return flatBox->isChecked() * WIDGET_FLAT +
bigBox->isChecked() * WIDGET_BIG +
!shinyBox->isChecked() * WIDGET_SHINY; }
private:
ToolbarEditDialog( intf_thread_t * );
+ virtual ~ToolbarEditDialog();
+
static ToolbarEditDialog *instance;
QCheckBox *flatBox, *bigBox, *shinyBox;
diff --git a/modules/gui/qt4/dialogs_provider.hpp b/modules/gui/qt4/dialogs_provider.hpp
index 4ba6155..d9854b8 100644
--- a/modules/gui/qt4/dialogs_provider.hpp
+++ b/modules/gui/qt4/dialogs_provider.hpp
@@ -103,14 +103,13 @@ public:
}
static void killInstance()
{
- if( instance ) delete instance;
+ delete instance;
instance = NULL;
}
static bool isAlive()
{
return ( instance != NULL );
}
- virtual ~DialogsProvider();
QStringList showSimpleOpen( QString help = QString(),
int filters = EXT_FILTER_MEDIA |
@@ -126,8 +125,10 @@ protected:
private:
DialogsProvider( intf_thread_t *);
- intf_thread_t *p_intf;
+ virtual ~DialogsProvider();
static DialogsProvider *instance;
+
+ intf_thread_t *p_intf;
bool b_isDying;
void openDialog( int );
diff --git a/modules/gui/qt4/input_manager.hpp b/modules/gui/qt4/input_manager.hpp
index 0f81dab..56f2c36 100644
--- a/modules/gui/qt4/input_manager.hpp
+++ b/modules/gui/qt4/input_manager.hpp
@@ -213,9 +213,9 @@ public:
}
static void killInstance()
{
- if( instance ) delete instance;
+ delete instance;
+ instance = NULL;
}
- virtual ~MainInputManager();
input_thread_t *getInput() { return p_input; };
InputManager *getIM() { return im; };
@@ -225,6 +225,8 @@ public:
private:
MainInputManager( intf_thread_t * );
+ virtual ~MainInputManager();
+
static MainInputManager *instance;
void customEvent( QEvent * );
diff --git a/modules/gui/qt4/main_interface.cpp b/modules/gui/qt4/main_interface.cpp
index 4d2b622..6a89479 100644
--- a/modules/gui/qt4/main_interface.cpp
+++ b/modules/gui/qt4/main_interface.cpp
@@ -291,7 +291,7 @@ MainInterface::~MainInterface()
ActionsManager::killInstance();
/* Delete the FSC controller */
- if( fullscreenControls ) delete fullscreenControls;
+ delete fullscreenControls;
/* Save states */
settings->beginGroup( "MainWindow" );
diff --git a/modules/gui/qt4/recents.hpp b/modules/gui/qt4/recents.hpp
index d850519..d3deb95 100644
--- a/modules/gui/qt4/recents.hpp
+++ b/modules/gui/qt4/recents.hpp
@@ -47,10 +47,9 @@ public:
}
static void killInstance()
{
- if( instance ) delete instance;
+ delete instance;
instance = NULL;
}
- virtual ~RecentsMRL();
void addRecent( const QString & );
QList<QString> recents();
@@ -58,9 +57,12 @@ public:
private:
RecentsMRL( intf_thread_t* _p_intf );
+ virtual ~RecentsMRL();
+
+ static RecentsMRL *instance;
+
void load();
void save();
- static RecentsMRL *instance;
intf_thread_t* p_intf;
QList<QString> *stack;
bool isActive;
More information about the vlc-devel
mailing list