]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/components/open.cpp
Don't commit stuff that shouldn't have been commited.
[vlc] / modules / gui / qt4 / components / open.cpp
index e54b732ddf667cb0d0dcb20f8850503129feb471..f5db04e704e97ca2eb2ae723faea49f3b62da172 100644 (file)
 #include <QStackedLayout>
 #include <QListView>
 
-#ifdef HAVE_LIMITS_H
-#   include <limits.h>
-#endif
-
 /**************************************************************************
  * Open Files and subtitles                                               *
  **************************************************************************/
@@ -91,7 +87,11 @@ FileOpenPanel::FileOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
 
     /* Ugly hacks to get the good Widget */
     //This lineEdit is the normal line in the fileDialog.
+#if QT_VERSION >= 0x040300
+    lineFileEdit = findChildren<QLineEdit*>()[2];
+#else
     lineFileEdit = findChildren<QLineEdit*>()[3];
+#endif
     lineFileEdit->hide();
 
     /* Make a list of QLabel inside the QFileDialog to access the good ones */
@@ -478,8 +478,6 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
 
 #define CuMRL( widget, slot ) CONNECT( widget , slot , this, updateMRL() );
 
-#define setMaxBound( spinbox ) spinbox->setRange ( 0, INT_MAX );
-
     /*******
      * V4L *
      *******/
@@ -512,6 +510,7 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
     v4lFreq = new QSpinBox;
     v4lFreq->setAlignment( Qt::AlignRight );
     v4lFreq->setSuffix(" kHz");
+    setSpinBoxFreq( v4lFreq );
     v4lPropLayout->addWidget( v4lFreq, 1 , 1 );
 
     /* v4l CONNECTs */
@@ -552,7 +551,7 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
     pvrFreq = new QSpinBox;
     pvrFreq->setAlignment( Qt::AlignRight );
     pvrFreq->setSuffix(" kHz");
-    setMaxBound( pvrFreq );
+    setSpinBoxFreq( pvrFreq );
     pvrPropLayout->addWidget( pvrFreq, 1, 1 );
 
     QLabel *pvrBitrLabel = new QLabel( qtr( "Bitrate" ) );
@@ -561,7 +560,7 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
     pvrBitr = new QSpinBox;
     pvrBitr->setAlignment( Qt::AlignRight );
     pvrBitr->setSuffix(" kHz");
-    setMaxBound( pvrBitr );
+    setSpinBoxFreq( pvrBitr );
     pvrPropLayout->addWidget( pvrBitr, 2, 1 );
 
     /* PVR CONNECTs */
@@ -643,7 +642,7 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
     bdaFreq->setAlignment( Qt::AlignRight );
     bdaFreq->setSuffix(" kHz");
     bdaFreq->setSingleStep( 1000 );
-    setMaxBound( bdaFreq )
+    setSpinBoxFreq( bdaFreq )
     bdaPropLayout->addWidget( bdaFreq, 0, 1 );
 
     bdaSrateLabel = new QLabel( qtr( "Transponder symbol rate" ) );
@@ -652,7 +651,7 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
     bdaSrate = new QSpinBox;
     bdaSrate->setAlignment( Qt::AlignRight );
     bdaSrate->setSuffix(" kHz");
-    setMaxBound( bdaSrate );
+    setSpinBoxFreq( bdaSrate );
     bdaPropLayout->addWidget( bdaSrate, 1, 1 );
 
     bdaBandLabel = new QLabel( qtr( "Bandwidth" ) );
@@ -710,7 +709,7 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
     dvbFreq = new QSpinBox;
     dvbFreq->setAlignment( Qt::AlignRight );
     dvbFreq->setSuffix(" kHz");
-    setMaxBound( dvbFreq  );
+    setSpinBoxFreq( dvbFreq  );
     dvbPropLayout->addWidget( dvbFreq, 0, 1 );
 
     QLabel *dvbSrateLabel = new QLabel( qtr( "Transponder symbol rate" ) );
@@ -719,7 +718,7 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
     dvbSrate = new QSpinBox;
     dvbSrate->setAlignment( Qt::AlignRight );
     dvbSrate->setSuffix(" kHz");
-    setMaxBound( dvbSrate );
+    setSpinBoxFreq( dvbSrate );
     dvbPropLayout->addWidget( dvbSrate, 1, 1 );
 
     /* DVB CONNECTs */
@@ -731,12 +730,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
 }
@@ -791,16 +802,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 )
     {
@@ -824,5 +848,9 @@ void CaptureOpenPanel::updateButtons()
             bdaBandLabel->show();
         }
         break;
+    case SCREEN_DEVICE:
+        ui.optionsBox->hide();
+        ui.advancedButton->hide();
+        break;
     }
 }