Qt4: podcast configuration, don't use a modal window, don't use a Qdailog but a QVLCF...
authorJean-Baptiste Kempf <jb@videolan.org>
Sat, 6 Oct 2007 13:40:16 +0000 (13:40 +0000)
committerJean-Baptiste Kempf <jb@videolan.org>
Sat, 6 Oct 2007 13:40:16 +0000 (13:40 +0000)
modules/gui/qt4/dialogs/podcast_configuration.cpp
modules/gui/qt4/dialogs/podcast_configuration.hpp
modules/gui/qt4/dialogs_provider.cpp
modules/gui/qt4/ui/podcast_configuration.ui

index a67148b..7a5ad8c 100644 (file)
 
 #include "podcast_configuration.hpp"
 
-PodcastConfigurationDialog::PodcastConfigurationDialog( intf_thread_t *_p_intf )
-    :p_intf( _p_intf )
+PodcastConfigDialog *PodcastConfigDialog::instance = NULL;
+
+PodcastConfigDialog::PodcastConfigDialog( intf_thread_t *_p_intf)
+                : QVLCFrame( _p_intf )
+
 {
     ui.setupUi( this );
+
     QPushButton *okButton = new QPushButton( qtr( "OK" ), this );
     QPushButton *cancelButton = new QPushButton( qtr( "Cancel" ), this );
     ui.okCancel->addButton( okButton, QDialogButtonBox::AcceptRole );
@@ -51,7 +54,11 @@ PodcastConfigurationDialog::PodcastConfigurationDialog( intf_thread_t *_p_intf )
     }
 }
 
-void PodcastConfigurationDialog::accept()
+PodcastConfigDialog::~PodcastConfigDialog()
+{
+}
+
+void PodcastConfigDialog::accept()
 {
     QString urls = "";
     for( int i = 0; i < ui.podcastList->count(); i++ )
@@ -74,11 +81,9 @@ void PodcastConfigurationDialog::accept()
     {
         msg_Dbg( p_intf, "You will need to reload the podcast module to take into account deleted podcast urls" );
     }
-
-    QDialog::accept();
 }
 
-void PodcastConfigurationDialog::add()
+void PodcastConfigDialog::add()
 {
     if( ui.podcastURL->text() != QString( "" ) )
     {
@@ -87,7 +92,7 @@ void PodcastConfigurationDialog::add()
     }
 }
 
-void PodcastConfigurationDialog::remove()
+void PodcastConfigDialog::remove()
 {
     delete ui.podcastList->currentItem();
 }
index 8a90866..ffb7164 100644 (file)
 #ifndef _PODCAST_CONFIGURATION_DIALOG_H_
 #define _PODCAST_CONFIGURATION_DIALOG_H_
 
-#include "qt4.hpp"
+#include "util/qvlcframe.hpp"
 #include "ui/podcast_configuration.h"
 
-class PodcastConfigurationDialog : public QDialog
+class PodcastConfigDialog : public QVLCFrame
 {
     Q_OBJECT;
-
 public:
-    PodcastConfigurationDialog( intf_thread_t *p_intf );
+    static PodcastConfigDialog * getInstance( intf_thread_t *p_intf )
+    {
+        if( !instance)
+            instance = new PodcastConfigDialog( p_intf );
+        return instance;
+    }
+    virtual ~PodcastConfigDialog();
 
 private:
+    PodcastConfigDialog( intf_thread_t *);
+    static PodcastConfigDialog *instance;
     Ui::PodcastConfiguration ui;
-    intf_thread_t *p_intf;
-
-private slots:
+public slots:
     void accept();
     void add();
     void remove();
index fe62045..7c4afca 100644 (file)
@@ -110,7 +110,10 @@ void DialogsProvider::customEvent( QEvent *event )
                bookmarksDialog(); break;
             case INTF_DIALOG_EXTENDED:
                extendedDialog(); break;
-               /* We might want to make it better with custom functions */
+            case INTF_DIALOG_VLM:
+               vlmDialog(); break;
+            case INTF_DIALOG_INTERACTION:
+               doInteraction( de->p_arg ); break;
             case INTF_DIALOG_POPUPMENU:
                QVLCMenu::PopupMenu( p_intf, (de->i_arg != 0) ); break;
             case INTF_DIALOG_AUDIOPOPUPMENU:
@@ -119,10 +122,6 @@ void DialogsProvider::customEvent( QEvent *event )
                QVLCMenu::VideoPopupMenu( p_intf ); break;
             case INTF_DIALOG_MISCPOPUPMENU:
                QVLCMenu::MiscPopupMenu( p_intf ); break;
-            case INTF_DIALOG_INTERACTION:
-               doInteraction( de->p_arg ); break;
-            case INTF_DIALOG_VLM:
-               vlmDialog(); break;
             case INTF_DIALOG_WIZARD:
             case INTF_DIALOG_STREAMWIZARD:
             case INTF_DIALOG_UPDATEVLC:
@@ -191,6 +190,12 @@ void DialogsProvider::bookmarksDialog()
     /*  BookmarkDialog::getInstance( p_intf )->toggleVisible(); */
 }
 
+void DialogsProvider::podcastConfigureDialog()
+{
+    PodcastConfigDialog::getInstance( p_intf )->toggleVisible();
+}
+
+
 /****************************************************************************
  * All the open/add stuff
  * Open Dialog first - Simple Open then
@@ -503,12 +508,6 @@ void DialogsProvider::doInteraction( intf_dialog_args_t *p_arg )
     }
 }
 
-void DialogsProvider::podcastConfigureDialog()
-{
-    PodcastConfigurationDialog c( p_intf );
-    c.exec();
-}
-
 void DialogsProvider::switchToSkins()
 {
     var_SetString( p_intf, "intf-switch", "skins2" );
index 2712e9d..d0ae57c 100644 (file)
@@ -1,6 +1,6 @@
 <ui version="4.0" >
  <class>PodcastConfiguration</class>
- <widget class="QDialog" name="PodcastConfiguration" >
+ <widget class="QWidget" name="PodcastConfiguration" >
   <property name="geometry" >
    <rect>
     <x>0</x>