X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fgui%2Fqt4%2Fcomponents%2Fopen_panels.cpp;h=a3b100ec5836fd7066c1be755834d60123cfd9e7;hb=4b531b445fa95a23c25942042e1c7402b96764d6;hp=88294c5d7e7f6df7f37e7fda5aa14bd7d1fe2ea6;hpb=185b2a6c6bd8c66c573fe081eec88c37fee75ad7;p=vlc diff --git a/modules/gui/qt4/components/open_panels.cpp b/modules/gui/qt4/components/open_panels.cpp index 88294c5d7e..a3b100ec58 100644 --- a/modules/gui/qt4/components/open_panels.cpp +++ b/modules/gui/qt4/components/open_panels.cpp @@ -44,7 +44,8 @@ #include #include #include -#include + +#define I_DEVICE_TOOLTIP N_("Select the device or the VIDEO_TS directory") /************************************************************************** * Open Files and subtitles * @@ -76,18 +77,16 @@ FileOpenPanel::FileOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : dialogBox->setFileMode( QFileDialog::ExistingFiles ); dialogBox->setAcceptMode( QFileDialog::AcceptOpen ); #if HAS_QT43 - QSettings settings( "vlc", "vlc-qt-interface" ); dialogBox->restoreState( - settings.value( "file-dialog-state" ).toByteArray() ); + getSettings()->value( "file-dialog-state" ).toByteArray() ); #endif - dialogBox->setViewMode( config_GetInt( p_intf, "qt-open-detail" ) ? - QFileDialog::Detail : QFileDialog::List ); /* We don't want to see a grip in the middle of the window, do we? */ dialogBox->setSizeGripEnabled( false ); /* Add a tooltip */ dialogBox->setToolTip( qtr( "Select one or multiple files" ) ); + dialogBox->setMinimumHeight( 250 ); // But hide the two OK/Cancel buttons. Enable them for debug. QDialogButtonBox *fileDialogAcceptBox = @@ -145,8 +144,7 @@ FileOpenPanel::FileOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : FileOpenPanel::~FileOpenPanel() { #if HAS_QT43 - QSettings settings( "vlc", "vlc-qt-interface" ); - settings.setValue( "file-dialog-state", dialogBox->saveState() ); + getSettings()->setValue( "file-dialog-state", dialogBox->saveState() ); #endif } @@ -196,6 +194,11 @@ void FileOpenBox::accept() OpenDialog::getInstance( NULL, NULL, true )->selectSlots(); } +void FileOpenBox::reject() +{ + OpenDialog::getInstance( NULL, NULL, true )->cancel(); +} + /* Function called by Open Dialog when clicked on cancel */ void FileOpenPanel::clear() { @@ -229,7 +232,10 @@ DiscOpenPanel::DiscOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : b_firstvcd = true; b_firstcdda = true; -#if WIN32 /* Disc drives probing for Windows */ + ui.browseDiscButton->setToolTip( qtr( I_DEVICE_TOOLTIP )); + ui.deviceCombo->setToolTip( I_DEVICE_TOOLTIP ); + +#ifdef WIN32 /* Disc drives probing for Windows */ char szDrives[512]; szDrives[0] = '\0'; if( GetLogicalDriveStringsA( sizeof( szDrives ) - 1, szDrives ) ) @@ -258,7 +264,8 @@ DiscOpenPanel::DiscOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : BUTTONACT( ui.audioCDRadioButton, updateButtons() ); BUTTONACT( ui.dvdsimple, updateButtons() ); BUTTONACT( ui.browseDiscButton, browseDevice() ); - BUTTONACT( ui.ejectButton, eject() ); + BUTTON_SET_ACT_I( ui.ejectButton, "", eject, qtr( "Eject the disc" ), + eject() ); CONNECT( ui.deviceCombo, editTextChanged( QString ), this, updateMRL()); CONNECT( ui.titleSpin, valueChanged( int ), this, updateMRL()); @@ -272,9 +279,9 @@ DiscOpenPanel::DiscOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : DiscOpenPanel::~DiscOpenPanel() { - delete psz_dvddiscpath; - delete psz_vcddiscpath; - delete psz_cddadiscpath; + free( psz_dvddiscpath ); + free( psz_vcddiscpath ); + free( psz_cddadiscpath ); } void DiscOpenPanel::clear() @@ -398,11 +405,11 @@ void DiscOpenPanel::updateMRL() void DiscOpenPanel::browseDevice() { - QString dir = QFileDialog::getExistingDirectory( 0, - qtr("Open a device or a VIDEO_TS directory") ); - if (!dir.isEmpty()) { - ui.deviceCombo->setEditText( dir ); - } + QString dir = QFileDialog::getExistingDirectory( this, + qtr( I_DEVICE_TOOLTIP ) ); + if (!dir.isEmpty()) + ui.deviceCombo->setEditText( toNativeSepNoSlash( dir ) ); + updateMRL(); } @@ -550,6 +557,16 @@ void NetOpenPanel::updateMRL() { CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : OpenPanel( _parent, _p_intf ) { + isInitialized = false; +} + +void CaptureOpenPanel::initialize() +{ + if( isInitialized ) return; + + msg_Dbg( p_intf, "Initialization of Capture device panel" ); + isInitialized = true; + ui.setupUi( this ); BUTTONACT( ui.advancedButton, advancedDialog() ); @@ -579,7 +596,7 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : /********************* * DirectShow Stuffs * *********************/ - if( module_Exists( p_intf, "dshow" ) ){ + if( module_exists( "dshow" ) ){ addModuleAndLayouts( DSHOW_DEVICE, dshow, "DirectShow" ); /* dshow Main */ @@ -613,7 +630,7 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : /************** * BDA Stuffs * **************/ - if( module_Exists( p_intf, "bda" ) ){ + if( module_exists( "bda" ) ){ addModuleAndLayouts( BDA_DEVICE, bda, "DVB DirectShow" ); /* bda Main */ @@ -678,7 +695,7 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : /******* * V4L2* *******/ - if( module_Exists( p_intf, "v4l2" ) ){ + if( module_exists( "v4l2" ) ){ addModuleAndLayouts( V4L2_DEVICE, v4l2, "Video for Linux 2" ); /* V4l Main panel */ @@ -713,7 +730,7 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : /******* * V4L * *******/ - if( module_Exists( p_intf, "v4l" ) ){ + if( module_exists( "v4l" ) ){ addModuleAndLayouts( V4L_DEVICE, v4l, "Video for Linux" ); /* V4l Main panel */ @@ -758,7 +775,7 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : /******* * JACK * *******/ - if( module_Exists( p_intf, "jack" ) ){ + if( module_exists( "jack" ) ){ addModuleAndLayouts( JACK_DEVICE, jack, "JACK Audio Connection Kit" ); /* Jack Main panel */ @@ -812,7 +829,7 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : /************ * PVR * ************/ - if( module_Exists( p_intf, "pvr" ) ){ + if( module_exists( "pvr" ) ){ addModuleAndLayouts( PVR_DEVICE, pvr, "PVR" ); /* PVR Main panel */ @@ -868,7 +885,7 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : /************** * DVB Stuffs * **************/ - if( module_Exists( p_intf, "dvb" ) ){ + if( module_exists( "dvb" ) ){ addModuleAndLayouts( DVB_DEVICE, dvb, "DVB" ); /* DVB Main */ @@ -936,6 +953,15 @@ CaptureOpenPanel::CaptureOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : screenLabel->setWordWrap( true ); screenDevLayout->addWidget( screenLabel, 0, 0 ); + QLabel *screenFPSLabel = new QLabel( + qtr( "Desired frame rate for the capture." ) ); + screenPropLayout->addWidget( screenFPSLabel, 0, 0 ); + + screenFPS = new QSpinBox; + screenFPS->setValue( 1 ); + screenFPS->setAlignment( Qt::AlignRight ); + screenPropLayout->addWidget( screenFPS, 0, 1 ); + /* General connects */ CONNECT( ui.deviceCombo, activated( int ) , stackedDevLayout, setCurrentIndex( int ) ); @@ -1031,6 +1057,7 @@ void CaptureOpenPanel::updateMRL() #endif case SCREEN_DEVICE: mrl = "screen://"; + mrl += " :screen-fps=" + QString("%1").arg( screenFPS->value() ); updateButtons(); break; } @@ -1079,7 +1106,7 @@ void CaptureOpenPanel::updateButtons() break; #endif case SCREEN_DEVICE: - ui.optionsBox->hide(); + //ui.optionsBox->hide(); ui.advancedButton->hide(); break; } @@ -1095,7 +1122,7 @@ void CaptureOpenPanel::advancedDialog() /* Get the corresponding module */ module_t *p_module = - module_Find( VLC_OBJECT(p_intf), psz_devModule[i_devicetype] ); + module_find( psz_devModule[i_devicetype] ); if( NULL == p_module ) return; /* Init */ @@ -1104,7 +1131,7 @@ void CaptureOpenPanel::advancedDialog() /* Get the confsize */ unsigned int i_confsize; module_config_t *p_config; - p_config = module_GetConfig( p_module, &i_confsize ); + p_config = module_config_get( p_module, &i_confsize ); /* New Adv Prop dialog */ adv = new QDialog( this ); @@ -1112,15 +1139,13 @@ void CaptureOpenPanel::advancedDialog() /* A main Layout with a Frame */ QVBoxLayout *mainLayout = new QVBoxLayout( adv ); - QFrame *advFrame = new QFrame; QScrollArea *scroll = new QScrollArea; mainLayout->addWidget( scroll ); + QFrame *advFrame = new QFrame; /* GridLayout inside the Frame */ QGridLayout *gLayout = new QGridLayout( advFrame ); - gLayout->setSizeConstraint( QLayout::SetFixedSize ); - scroll->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); scroll->setWidgetResizable( true ); scroll->setWidget( advFrame ); @@ -1188,5 +1213,7 @@ void CaptureOpenPanel::advancedDialog() msg_Dbg( p_intf, "%s", qtu( advMRL ) ); } delete adv; + module_config_free( p_config ); + module_release (p_module); }