]> git.sesse.net Git - vlc/commitdiff
Qt4 - Open Capture: add screen://
authorJean-Baptiste Kempf <jb@videolan.org>
Wed, 6 Jun 2007 21:15:13 +0000 (21:15 +0000)
committerJean-Baptiste Kempf <jb@videolan.org>
Wed, 6 Jun 2007 21:15:13 +0000 (21:15 +0000)
modules/gui/qt4/components/open.cpp
modules/gui/qt4/components/open.hpp

index 164e5da49bfeb37d288653ebe72ad74bb93c7172..e804166f3b67f8315a59f339b1625cf0701f221b 100644 (file)
@@ -474,7 +474,6 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
 
 #define CuMRL( widget, slot ) CONNECT( widget , slot , this, updateMRL() );
 
-
     /*******
      * V4L *
      *******/
@@ -727,12 +726,24 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
     BUTTONACT( dvbt, updateButtons() );
     BUTTONACT( dvbc, updateButtons() );
 
+    /**********
+     * Screen *
+     **********/
+
+    addModuleAndLayouts( SCREEN_DEVICE, screen, "Desktop" );
+    QLabel *screenLabel = new QLabel( "This option will open your own "
+            "desktop in order to save or stream it.");
+    screenLabel->setWordWrap( true );
+    screenDevLayout->addWidget( screenLabel, 0, 0 );
+
+
     /* General connects */
     connect( ui.deviceCombo, SIGNAL( activated( int ) ),
                      stackedDevLayout, SLOT( setCurrentIndex( int ) ) );
     connect( ui.deviceCombo, SIGNAL( activated( int ) ),
                      stackedPropLayout, SLOT( setCurrentIndex( int ) ) );
     CONNECT( ui.deviceCombo, activated( int ), this, updateMRL() );
+    CONNECT( ui.deviceCombo, activated( int ), this, updateButtons() );
 
 #undef addModule
 }
@@ -787,16 +798,29 @@ void CaptureOpenPanel::updateMRL()
                 QString("%1").arg( bdaBandBox->itemData(
                     bdaBandBox->currentIndex() ).toInt() );
         break;
-  case DSHOW_DEVICE:
+    case DSHOW_DEVICE:
+        break;
+    case SCREEN_DEVICE:
+        mrl = "screen://";
+        updateButtons();
         break;
     }
     emit mrlUpdated( mrl );
 }
 
+/**
+ * Update the Buttons (show/hide) for the GUI as all device type don't 
+ * use the same ui. elements.
+ **/
 void CaptureOpenPanel::updateButtons()
 {
+    /*  Be sure to display the ui Elements in case they were hidden by
+     *  some Device Type (like Screen://) */
+    ui.optionsBox->show();
+    ui.advancedButton->show();
+    /* Get the current Device Number */
     int i_devicetype = ui.deviceCombo->itemData(
-            ui.deviceCombo->currentIndex() ).toInt();
+                                ui.deviceCombo->currentIndex() ).toInt();
     msg_Dbg( p_intf, "Capture Type: %i", i_devicetype );
     switch( i_devicetype )
     {
@@ -820,5 +844,9 @@ void CaptureOpenPanel::updateButtons()
             bdaBandLabel->show();
         }
         break;
+    case SCREEN_DEVICE:
+        ui.optionsBox->hide();
+        ui.advancedButton->hide();
+        break;
     }
 }
index 9f3d51e8954c1c9251159cc847b53968cf0a3e5d..6b5bc54d013074bf327ed4246d121228aba28c91 100644 (file)
@@ -46,6 +46,7 @@
 #define DVB_DEVICE         0x2
 #define BDA_DEVICE         0x4
 #define DSHOW_DEVICE       0x8
+#define SCREEN_DEVICE      0x16
 
 class QWidget;
 class QLineEdit;