Commit e0a09aa3 authored by Rémi Duraffort's avatar Rémi Duraffort

qt4: cleaning the singletons implementation.

parent ef65c998
...@@ -66,11 +66,13 @@ public: ...@@ -66,11 +66,13 @@ public:
} }
static void killInstance() static void killInstance()
{ {
if( instance ) delete instance; delete instance;
instance = NULL;
} }
virtual ~ActionsManager();
private: private:
virtual ~ActionsManager();
static ActionsManager *instance; static ActionsManager *instance;
ActionsManager( intf_thread_t *_p_i, QObject *_parent ); ActionsManager( intf_thread_t *_p_i, QObject *_parent );
intf_thread_t *p_intf; intf_thread_t *p_intf;
......
...@@ -615,8 +615,7 @@ ExtV4l2::ExtV4l2( intf_thread_t *_p_intf, QWidget *_parent ) ...@@ -615,8 +615,7 @@ ExtV4l2::ExtV4l2( intf_thread_t *_p_intf, QWidget *_parent )
ExtV4l2::~ExtV4l2() ExtV4l2::~ExtV4l2()
{ {
if( box ) delete box;
delete box;
} }
void ExtV4l2::showEvent( QShowEvent *event ) void ExtV4l2::showEvent( QShowEvent *event )
......
...@@ -42,12 +42,13 @@ public: ...@@ -42,12 +42,13 @@ public:
} }
static void killInstance() static void killInstance()
{ {
if( instance ) delete instance; delete instance;
instance = NULL; instance = NULL;
} }
virtual ~BookmarksDialog();
private: private:
BookmarksDialog( intf_thread_t * ); BookmarksDialog( intf_thread_t * );
virtual ~BookmarksDialog();
static BookmarksDialog *instance; static BookmarksDialog *instance;
void update(); void update();
QTreeWidget *bookmarksList; QTreeWidget *bookmarksList;
......
...@@ -42,13 +42,14 @@ public: ...@@ -42,13 +42,14 @@ public:
} }
static void killInstance() static void killInstance()
{ {
if( instance ) delete instance; delete instance;
instance = NULL; instance = NULL;
} }
virtual ~ExtendedDialog();
void showTab( int i ); void showTab( int i );
private: private:
ExtendedDialog( intf_thread_t * ); ExtendedDialog( intf_thread_t * );
virtual ~ExtendedDialog();
static ExtendedDialog *instance; static ExtendedDialog *instance;
SyncControls *syncW; SyncControls *syncW;
......
...@@ -50,12 +50,14 @@ public: ...@@ -50,12 +50,14 @@ public:
return instance; return instance;
} }
static void killInstance() static void killInstance()
{ if( instance ) delete instance; instance = NULL;} { delete instance; instance = NULL;}
virtual ~HelpDialog();
private: private:
HelpDialog( intf_thread_t * ); HelpDialog( intf_thread_t * );
virtual ~HelpDialog();
static HelpDialog *instance; static HelpDialog *instance;
public slots: public slots:
void close(); void close();
}; };
...@@ -99,7 +101,7 @@ public: ...@@ -99,7 +101,7 @@ public:
return instance; return instance;
} }
static void killInstance() static void killInstance()
{ if( instance ) delete instance; instance = NULL;} { delete instance; instance = NULL;}
void updateNotify( bool ); void updateNotify( bool );
......
...@@ -45,18 +45,18 @@ public: ...@@ -45,18 +45,18 @@ public:
static void killInstance() static void killInstance()
{ {
if( instance ) delete instance; delete instance;
instance = NULL; instance = NULL;
} }
virtual ~MediaInfoDialog();
void showTab( int ); void showTab( int );
#if 0 #if 0
void setInput( input_item_t * ); void setInput( input_item_t * );
#endif #endif
private: private:
virtual ~MediaInfoDialog();
static MediaInfoDialog *instance; static MediaInfoDialog *instance;
bool isMainInputInfo; bool isMainInputInfo;
......
...@@ -47,14 +47,15 @@ public: ...@@ -47,14 +47,15 @@ public:
} }
static void killInstance() static void killInstance()
{ {
if( instance ) delete instance; delete instance;
instance = NULL; instance = NULL;
} }
virtual ~MessagesDialog();
private: private:
MessagesDialog( intf_thread_t * ); MessagesDialog( intf_thread_t * );
virtual ~MessagesDialog();
static MessagesDialog *instance; static MessagesDialog *instance;
QTabWidget *mainTab; QTabWidget *mainTab;
QSpinBox *verbosityBox; QSpinBox *verbosityBox;
......
...@@ -64,10 +64,9 @@ public: ...@@ -64,10 +64,9 @@ public:
static void killInstance() static void killInstance()
{ {
if( instance ) delete instance; delete instance;
instance = NULL; instance = NULL;
} }
virtual ~OpenDialog();
void showTab( int = OPEN_FILE_TAB ); void showTab( int = OPEN_FILE_TAB );
QString getMRL( bool b = true ); QString getMRL( bool b = true );
...@@ -82,6 +81,7 @@ public slots: ...@@ -82,6 +81,7 @@ public slots:
private: private:
OpenDialog( QWidget *parent, intf_thread_t *, bool b_selectMode, OpenDialog( QWidget *parent, intf_thread_t *, bool b_selectMode,
int _action_flag = 0, bool b_pl = true ); int _action_flag = 0, bool b_pl = true );
virtual ~OpenDialog();
static OpenDialog *instance; static OpenDialog *instance;
input_thread_t *p_input; input_thread_t *p_input;
......
...@@ -48,12 +48,12 @@ public: ...@@ -48,12 +48,12 @@ public:
} }
static void killInstance() static void killInstance()
{ {
if( instance ) delete instance; delete instance;
instance = NULL; instance = NULL;
} }
virtual ~PlaylistDialog();
private: private:
PlaylistDialog( intf_thread_t * ); PlaylistDialog( intf_thread_t * );
virtual ~PlaylistDialog();
void dropEvent( QDropEvent *); void dropEvent( QDropEvent *);
void dragEnterEvent( QDragEnterEvent * ); void dragEnterEvent( QDragEnterEvent * );
......
...@@ -69,13 +69,14 @@ public: ...@@ -69,13 +69,14 @@ public:
return instance; return instance;
} }
static void killInstance() static void killInstance()
{ if( instance ) delete instance; instance = NULL;} { delete instance; instance = NULL;}
virtual ~ToolbarEditDialog();
int getOptions() { return flatBox->isChecked() * WIDGET_FLAT + int getOptions() { return flatBox->isChecked() * WIDGET_FLAT +
bigBox->isChecked() * WIDGET_BIG + bigBox->isChecked() * WIDGET_BIG +
!shinyBox->isChecked() * WIDGET_SHINY; } !shinyBox->isChecked() * WIDGET_SHINY; }
private: private:
ToolbarEditDialog( intf_thread_t * ); ToolbarEditDialog( intf_thread_t * );
virtual ~ToolbarEditDialog();
static ToolbarEditDialog *instance; static ToolbarEditDialog *instance;
QCheckBox *flatBox, *bigBox, *shinyBox; QCheckBox *flatBox, *bigBox, *shinyBox;
......
...@@ -103,14 +103,13 @@ public: ...@@ -103,14 +103,13 @@ public:
} }
static void killInstance() static void killInstance()
{ {
if( instance ) delete instance; delete instance;
instance = NULL; instance = NULL;
} }
static bool isAlive() static bool isAlive()
{ {
return ( instance != NULL ); return ( instance != NULL );
} }
virtual ~DialogsProvider();
QStringList showSimpleOpen( QString help = QString(), QStringList showSimpleOpen( QString help = QString(),
int filters = EXT_FILTER_MEDIA | int filters = EXT_FILTER_MEDIA |
...@@ -126,8 +125,10 @@ protected: ...@@ -126,8 +125,10 @@ protected:
private: private:
DialogsProvider( intf_thread_t *); DialogsProvider( intf_thread_t *);
intf_thread_t *p_intf; virtual ~DialogsProvider();
static DialogsProvider *instance; static DialogsProvider *instance;
intf_thread_t *p_intf;
bool b_isDying; bool b_isDying;
void openDialog( int ); void openDialog( int );
......
...@@ -213,9 +213,9 @@ public: ...@@ -213,9 +213,9 @@ public:
} }
static void killInstance() static void killInstance()
{ {
if( instance ) delete instance; delete instance;
instance = NULL;
} }
virtual ~MainInputManager();
input_thread_t *getInput() { return p_input; }; input_thread_t *getInput() { return p_input; };
InputManager *getIM() { return im; }; InputManager *getIM() { return im; };
...@@ -225,6 +225,8 @@ public: ...@@ -225,6 +225,8 @@ public:
private: private:
MainInputManager( intf_thread_t * ); MainInputManager( intf_thread_t * );
virtual ~MainInputManager();
static MainInputManager *instance; static MainInputManager *instance;
void customEvent( QEvent * ); void customEvent( QEvent * );
......
...@@ -291,7 +291,7 @@ MainInterface::~MainInterface() ...@@ -291,7 +291,7 @@ MainInterface::~MainInterface()
ActionsManager::killInstance(); ActionsManager::killInstance();
/* Delete the FSC controller */ /* Delete the FSC controller */
if( fullscreenControls ) delete fullscreenControls; delete fullscreenControls;
/* Save states */ /* Save states */
settings->beginGroup( "MainWindow" ); settings->beginGroup( "MainWindow" );
......
...@@ -47,10 +47,9 @@ public: ...@@ -47,10 +47,9 @@ public:
} }
static void killInstance() static void killInstance()
{ {
if( instance ) delete instance; delete instance;
instance = NULL; instance = NULL;
} }
virtual ~RecentsMRL();
void addRecent( const QString & ); void addRecent( const QString & );
QList<QString> recents(); QList<QString> recents();
...@@ -58,9 +57,12 @@ public: ...@@ -58,9 +57,12 @@ public:
private: private:
RecentsMRL( intf_thread_t* _p_intf ); RecentsMRL( intf_thread_t* _p_intf );
virtual ~RecentsMRL();
static RecentsMRL *instance;
void load(); void load();
void save(); void save();
static RecentsMRL *instance;
intf_thread_t* p_intf; intf_thread_t* p_intf;
QList<QString> *stack; QList<QString> *stack;
bool isActive; bool isActive;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment