From aeb66e2b217d2793117db9bc63e53b3e7f268bfe Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Kempf Date: Mon, 19 Mar 2007 19:42:25 +0000 Subject: [PATCH] Qt4 - Open. Use a Frame and not a QComboBox for subtitles. (lacks still some toggle function). Catch event to avoid bug of hidding of QFileDialog. --- modules/gui/qt4/components/open.cpp | 23 ++- modules/gui/qt4/components/open.hpp | 2 + modules/gui/qt4/dialogs/open.cpp | 1 + modules/gui/qt4/ui/open_file.ui | 241 ++++++++++++++++------------ 4 files changed, 158 insertions(+), 109 deletions(-) diff --git a/modules/gui/qt4/components/open.cpp b/modules/gui/qt4/components/open.cpp index bc90e3a4e5..313c827342 100644 --- a/modules/gui/qt4/components/open.cpp +++ b/modules/gui/qt4/components/open.cpp @@ -71,9 +71,16 @@ FileOpenPanel::FileOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) : /* Change the text that was uncool in the usual box */ listLabel[5]->setText( qtr( "Filter:" ) ); + /* Hacks Continued Catch the close event */ + dialogBox->installEventFilter( this ); + + // Hide the subtitles control by default. + ui.subFrame->hide(); + + BUTTONACT( ui.subBrowseButton, browseFileSub() ); + BUTTONACT( ui.subCheckBox, updateMRL()); - BUTTONACT( ui.subGroupBox, updateMRL()); CONNECT( ui.fileInput, editTextChanged(QString ), this, updateMRL()); CONNECT( ui.subInput, editTextChanged(QString ), this, updateMRL()); CONNECT( ui.alignSubComboBox, currentIndexChanged(int), this, updateMRL()); @@ -109,7 +116,7 @@ void FileOpenPanel::updateMRL() { QString mrl = ui.fileInput->currentText(); - if( ui.subGroupBox->isChecked() ) { + if( ui.subCheckBox->isChecked() ) { mrl.append( " :sub-file=" + ui.subInput->currentText() ); mrl.append( " :subsdec-align=" + ui.alignSubComboBox->currentText() ); mrl.append( " :sub-rel-fontsize=" + ui.sizeSubComboBox->currentText() ); @@ -134,6 +141,18 @@ void FileOpenPanel::clear() ui.subInput->setEditText( "" ); } +bool FileOpenPanel::eventFilter(QObject *object, QEvent *event) +{ + printf( "coin\n" ); + if ( ( object == dialogBox ) && ( event->type() == QEvent::Hide ) ) + { + event->ignore(); + return true; + } + // standard event processing + else + return QObject::eventFilter(object, event); +} /************************************************************************** * Disk open diff --git a/modules/gui/qt4/components/open.hpp b/modules/gui/qt4/components/open.hpp index 81ec2b4c0a..d3e6334abd 100644 --- a/modules/gui/qt4/components/open.hpp +++ b/modules/gui/qt4/components/open.hpp @@ -68,11 +68,13 @@ private: QStringList browse( QString ); QFileDialog *dialogBox; QLineEdit *lineFileEdit; + bool eventFilter(QObject *, QEvent *); public slots: virtual void updateMRL(); private slots: void browseFile(); void browseFileSub(); + }; class NetOpenPanel: public OpenPanel diff --git a/modules/gui/qt4/dialogs/open.cpp b/modules/gui/qt4/dialogs/open.cpp index f23fe4e91e..4d0e4330b4 100644 --- a/modules/gui/qt4/dialogs/open.cpp +++ b/modules/gui/qt4/dialogs/open.cpp @@ -161,6 +161,7 @@ void OpenDialog::playOrEnqueue( bool b_enqueue = false ) void OpenDialog::toggleAdvancedPanel() { + //FIXME does not work under Windows if (ui.advancedFrame->isVisible()) { ui.advancedFrame->hide(); setMinimumHeight(1); diff --git a/modules/gui/qt4/ui/open_file.ui b/modules/gui/qt4/ui/open_file.ui index 1cdc5e1d9c..017f626529 100644 --- a/modules/gui/qt4/ui/open_file.ui +++ b/modules/gui/qt4/ui/open_file.ui @@ -6,8 +6,8 @@ 0 0 - 400 - 210 + 463 + 249 @@ -28,24 +28,8 @@ 6 - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 3 - 20 - - - - - - + + 1 @@ -54,148 +38,195 @@ 0 - - Use a subtitles file - - - true - - - false + + QFrame::StyledPanel - 6 + 9 - 5 + 6 - - - - Browse + + + + Qt::Horizontal - + + + 16 + 20 + + + - - - - - 7 - 0 - 0 - 0 - + + + + Qt::Horizontal - - true + + + 16 + 20 + - + - - + + - 100 + 80 0 + + 0 + + + QComboBox::NoInsert + + + 0 + - Very Small - - - - - Small - - - - - Normal + Left - Big + Center - Very Big + Right - + + + + Alignment: + + + alignSubLabel + + + + Qt::Horizontal - 40 - 20 + 71 + 26 - - + + - 80 + 100 0 - - 0 - - - QComboBox::NoInsert - - - 0 - - Left + Very Small - Center + Small - Right + Normal + + + + + Big + + + + + Very Big - + Size: - - - - Alignment: + + + + + 7 + 0 + 0 + 0 + - - alignSubLabel + + true + + + + + + + Browse - - + + + + Use a subtitles file + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 273 + 16 + + + + + + + + File / Directory Names; + + @@ -215,38 +246,34 @@ - - - - File / Directory Names; - - - - + Qt::Vertical - - QSizePolicy::Fixed - - 273 - 16 + 200 + 2 - + + + + - Qt::Vertical + Qt::Horizontal + + + QSizePolicy::Fixed - 200 - 2 + 16 + 26 -- 2.39.2