Qt: plugins dialog as a toggle one.
authorJean-Baptiste Kempf <jb@videolan.org>
Wed, 1 Jul 2009 22:57:15 +0000 (00:57 +0200)
committerJean-Baptiste Kempf <jb@videolan.org>
Wed, 1 Jul 2009 22:57:15 +0000 (00:57 +0200)
Close #2900

modules/gui/qt4/dialogs/plugins.cpp
modules/gui/qt4/dialogs/plugins.hpp
modules/gui/qt4/dialogs_provider.cpp

index e8fa2df..722ea0f 100644 (file)
@@ -38,6 +38,8 @@
 #include <QLineEdit>
 #include <QLabel>
 
 #include <QLineEdit>
 #include <QLabel>
 
+PluginDialog *PluginDialog::instance = NULL;
+
 PluginDialog::PluginDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
 {
     setAttribute( Qt::WA_DeleteOnClose );
 PluginDialog::PluginDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
 {
     setAttribute( Qt::WA_DeleteOnClose );
index 798f01f..1a243a8 100644 (file)
@@ -34,11 +34,23 @@ class PluginDialog : public QVLCFrame
 {
     Q_OBJECT;
 public:
 {
     Q_OBJECT;
 public:
-    PluginDialog( intf_thread_t * );
+    static PluginDialog * getInstance( intf_thread_t *p_intf )
+    {
+        if( !instance)
+            instance = new PluginDialog( p_intf );
+        return instance;
+    }
+    static void killInstance()
+    {
+        delete instance;
+        instance = NULL;
+    }
 private:
 private:
-    void FillTree();
+    PluginDialog( intf_thread_t * );
     virtual ~PluginDialog();
     virtual ~PluginDialog();
+    static PluginDialog *instance;
 
 
+    void FillTree();
     QTreeWidget *treePlugins;
     SearchLineEdit *edit;
 private slots:
     QTreeWidget *treePlugins;
     SearchLineEdit *edit;
 private slots:
index dad8834..9a954e9 100644 (file)
@@ -259,8 +259,7 @@ void DialogsProvider::toolbarDialog()
 
 void DialogsProvider::pluginDialog()
 {
 
 void DialogsProvider::pluginDialog()
 {
-    PluginDialog *diag = new PluginDialog( p_intf );
-    diag->show();
+    PluginDialog::getInstance( p_intf )->toggleVisible();
 }
 
 /* Generic open file */
 }
 
 /* Generic open file */