[vlc-devel] [PATCH 1/4] qt: remove qt-embedded-open mode
Pierre Lamot
pierre at videolabs.io
Fri Jan 19 18:10:21 CET 2018
widget creation was broken with Qt5
---
modules/gui/qt/components/open_panels.cpp | 75 ++-----------------------------
modules/gui/qt/components/open_panels.hpp | 14 ------
modules/gui/qt/qt.cpp | 5 ---
3 files changed, 4 insertions(+), 90 deletions(-)
diff --git a/modules/gui/qt/components/open_panels.cpp b/modules/gui/qt/components/open_panels.cpp
index 9b154322e5..8da218b321 100644
--- a/modules/gui/qt/components/open_panels.cpp
+++ b/modules/gui/qt/components/open_panels.cpp
@@ -78,7 +78,7 @@ static const char psz_devModule[][8] = { "v4l2", "pvr", "dtv",
* Open Files and subtitles *
**************************************************************************/
FileOpenPanel::FileOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
- OpenPanel( _parent, _p_intf ), dialogBox( NULL )
+ OpenPanel( _parent, _p_intf )
{
/* Classic UI Setup */
ui.setupUi( this );
@@ -100,11 +100,6 @@ FileOpenPanel::FileOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
QCompleter *fileCompleter = new QCompleter( fileCompleteList, this );
fileCompleter->setModel( new QDirModel( fileCompleter ) );
lineFileEdit->setCompleter( fileCompleter );*/
- if( var_InheritBool( p_intf, "qt-embedded-open" ) )
- {
- ui.tempWidget->hide();
- BuildOldPanel();
- }
/* Subtitles */
/* Deactivate the subtitles control by default. */
@@ -122,61 +117,8 @@ FileOpenPanel::FileOpenPanel( QWidget *_parent, intf_thread_t *_p_intf ) :
updateButtons();
}
-inline void FileOpenPanel::BuildOldPanel()
-{
- /** BEGIN QFileDialog tweaking **/
- /* Use a QFileDialog and customize it because we don't want to
- rewrite it all. Be careful to your eyes cause there are a few hacks.
- Be very careful and test correctly when you modify this. */
-
- /* Make this QFileDialog a child of tempWidget from the ui. */
- dialogBox = new FileOpenBox( ui.tempWidget, NULL,
- p_intf->p_sys->filepath, "" );
-
- dialogBox->setFileMode( QFileDialog::ExistingFiles );
- dialogBox->setAcceptMode( QFileDialog::AcceptOpen );
- dialogBox->restoreState(
- getSettings()->value( "file-dialog-state" ).toByteArray() );
-
- /* 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 =
- dialogBox->findChildren<QDialogButtonBox*>()[0];
- fileDialogAcceptBox->hide();
-
- /* Ugly hacks to get the good Widget */
- //This lineEdit is the normal line in the fileDialog.
- QLineEdit *lineFileEdit = dialogBox->findChildren<QLineEdit*>()[0];
- /* Make a list of QLabel inside the QFileDialog to access the good ones */
- QList<QLabel *> listLabel = dialogBox->findChildren<QLabel*>();
-
- /* Hide the FileNames one. Enable it for debug */
- listLabel[1]->setText( qtr( "File names:" ) );
- /* Change the text that was uncool in the usual box */
- listLabel[2]->setText( qtr( "Filter:" ) );
-
- dialogBox->layout()->setMargin( 0 );
- dialogBox->layout()->setSizeConstraint( QLayout::SetNoConstraint );
-
- /** END of QFileDialog tweaking **/
-
- // Add the DialogBox to the layout
- ui.gridLayout->addWidget( dialogBox, 0, 0, 1, 3 );
-
- CONNECT( lineFileEdit, textChanged( const QString& ), this, updateMRL() );
- dialogBox->installEventFilter( this );
-}
-
FileOpenPanel::~FileOpenPanel()
{
- if( dialogBox )
- getSettings()->setValue( "file-dialog-state", dialogBox->saveState() );
}
void FileOpenPanel::dragEnterEvent( QDragEnterEvent *event )
@@ -271,17 +213,10 @@ void FileOpenPanel::updateMRL()
QString mrl;
/* File Listing */
- if( dialogBox == NULL )
- for( int i = 0; i < ui.fileListWidg->count(); i++ )
- {
- if( !ui.fileListWidg->item( i )->text().isEmpty() )
- fileList << toURI(ui.fileListWidg->item( i )->text());
- }
- else
+ for( int i = 0; i < ui.fileListWidg->count(); i++ )
{
- QList<QUrl> urls = dialogBox->selectedUrls();
- foreach( const QUrl &url, urls )
- fileList.append( url.toEncoded() );
+ if( !ui.fileListWidg->item( i )->text().isEmpty() )
+ fileList << toURI(ui.fileListWidg->item( i )->text());
}
/* Options */
@@ -296,8 +231,6 @@ void FileOpenPanel::updateMRL()
/* Function called by Open Dialog when clicke on Play/Enqueue */
void FileOpenPanel::accept()
{
- if( dialogBox )
- p_intf->p_sys->filepath = dialogBox->directory().absolutePath();
ui.fileListWidg->clear();
}
diff --git a/modules/gui/qt/components/open_panels.hpp b/modules/gui/qt/components/open_panels.hpp
index d124a25ff6..b753087cf7 100644
--- a/modules/gui/qt/components/open_panels.hpp
+++ b/modules/gui/qt/components/open_panels.hpp
@@ -91,19 +91,6 @@ signals:
void methodChanged( const QString& method );
};
-class FileOpenBox: public QFileDialog
-{
- Q_OBJECT
-public:
- FileOpenBox( QWidget *parent, const QString &caption,
- const QString &directory, const QString &filter ):
- QFileDialog( parent, caption, directory, filter ) {}
-public slots:
- void accept(){}
- void reject(){}
-};
-
-
class FileOpenPanel: public OpenPanel
{
Q_OBJECT
@@ -129,7 +116,6 @@ protected:
void dragLeaveEvent( QDragLeaveEvent * ) Q_DECL_OVERRIDE;
private:
Ui::OpenFile ui;
- FileOpenBox *dialogBox;
void BuildOldPanel();
public slots:
void updateMRL() Q_DECL_OVERRIDE;
diff --git a/modules/gui/qt/qt.cpp b/modules/gui/qt/qt.cpp
index cbd197750a..c2075e52ae 100644
--- a/modules/gui/qt/qt.cpp
+++ b/modules/gui/qt/qt.cpp
@@ -149,7 +149,6 @@ static void ShowDialog ( intf_thread_t *, int, int, intf_dialog_args_t * );
" - minimal mode with limited controls" )
#define QT_FULLSCREEN_TEXT N_( "Show a controller in fullscreen mode" )
-#define QT_NATIVEOPEN_TEXT N_( "Embed the file browser in open dialog" )
#define FULLSCREEN_NUMBER_TEXT N_( "Define which screen fullscreen goes" )
#define FULLSCREEN_NUMBER_LONGTEXT N_( "Screennumber of fullscreen, instead of " \
@@ -272,10 +271,6 @@ vlc_module_begin ()
false /* advanced mode only */)
#endif
- add_bool( "qt-embedded-open", false, QT_NATIVEOPEN_TEXT,
- QT_NATIVEOPEN_TEXT, false )
-
-
add_bool( "qt-advanced-pref", false, ADVANCED_PREFS_TEXT,
ADVANCED_PREFS_LONGTEXT, false )
add_bool( "qt-error-dialogs", true, ERROR_TEXT,
--
2.14.1
More information about the vlc-devel
mailing list