From c45048df5ea0ac61f646433b99d7731cb4140792 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Kempf Date: Thu, 13 Mar 2008 17:21:39 -0700 Subject: [PATCH] Change button layout and behaviour in the open dialog. This avoid the Windows issue and should close #1455 --- modules/gui/qt4/dialogs/open.cpp | 24 +--- modules/gui/qt4/dialogs/open.hpp | 5 +- modules/gui/qt4/ui/open.ui | 184 +++++++++++++++++++++---------- 3 files changed, 131 insertions(+), 82 deletions(-) diff --git a/modules/gui/qt4/dialogs/open.cpp b/modules/gui/qt4/dialogs/open.cpp index db9fa45c87..1ff123b975 100644 --- a/modules/gui/qt4/dialogs/open.cpp +++ b/modules/gui/qt4/dialogs/open.cpp @@ -91,27 +91,14 @@ OpenDialog::OpenDialog( QWidget *parent, ui.slaveBrowseButton->hide(); /* Buttons Creation */ - QSizePolicy buttonSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ); - buttonSizePolicy.setHorizontalStretch( 0 ); - buttonSizePolicy.setVerticalStretch( 0 ); - /* Play Button */ - playButton = new QToolButton; - playButton->setText( qtr( "&Play" ) ); - playButton->setSizePolicy( buttonSizePolicy ); - playButton->setMinimumSize( QSize( 90, 0 ) ); - playButton->setPopupMode( QToolButton::MenuButtonPopup ); - playButton->setToolButtonStyle( Qt::ToolButtonTextOnly ); + playButton = ui.playButton; /* Cancel Button */ - cancelButton = new QToolButton; - cancelButton->setText( qtr( "&Cancel" ) ); - cancelButton->setSizePolicy( buttonSizePolicy ); + cancelButton = new QPushButton( qtr( "&Cancel" ) ); /* Select Button */ - selectButton = new QToolButton; - selectButton->setText( qtr( "Select" ) ); - selectButton->setSizePolicy( buttonSizePolicy ); + selectButton = new QPushButton( qtr( "Select" ) ); /* Menu for the Play button */ QMenu * openButtonMenu = new QMenu( "Open" ); @@ -124,10 +111,9 @@ OpenDialog::OpenDialog( QWidget *parent, openButtonMenu->addAction( qtr( "&Convert" ), this, SLOT( transcode() ) , QKeySequence( "Alt+C" ) ); - playButton->setMenu( openButtonMenu ); + ui.menuButton->setMenu( openButtonMenu ); /* Add the three Buttons */ - ui.buttonsBox->addButton( playButton, QDialogButtonBox::ActionRole ); ui.buttonsBox->addButton( selectButton, QDialogButtonBox::AcceptRole ); ui.buttonsBox->addButton( cancelButton, QDialogButtonBox::RejectRole ); @@ -183,6 +169,7 @@ void OpenDialog::setMenuAction() { playButton->hide(); selectButton->show(); + selectButton->setDefault( true ); } else { @@ -202,6 +189,7 @@ void OpenDialog::setMenuAction() playButton->setText( qtr( "&Play" ) ); } playButton->show(); + playButton->setDefault( true ); selectButton->hide(); } } diff --git a/modules/gui/qt4/dialogs/open.hpp b/modules/gui/qt4/dialogs/open.hpp index 6399068f47..3af33971fe 100644 --- a/modules/gui/qt4/dialogs/open.hpp +++ b/modules/gui/qt4/dialogs/open.hpp @@ -36,7 +36,6 @@ #include "components/open_panels.hpp" class QString; -class QToolButton; class QTabWidget; class OpenDialog : public QVLCDialog @@ -83,8 +82,8 @@ private: int i_action_flag; QStringList SeparateEntries( QString ); - QToolButton *cancelButton, *selectButton; - QToolButton *playButton; + QPushButton *cancelButton, *selectButton; + QPushButton *playButton; void finish( bool ); diff --git a/modules/gui/qt4/ui/open.ui b/modules/gui/qt4/ui/open.ui index 3a445ee3e4..0acf4ea44c 100644 --- a/modules/gui/qt4/ui/open.ui +++ b/modules/gui/qt4/ui/open.ui @@ -9,8 +9,8 @@ 0 0 - 432 - 285 + 518 + 300 @@ -23,7 +23,7 @@ Dialog - + @@ -36,7 +36,7 @@ - + _("Show extended options") @@ -46,7 +46,7 @@ - + @@ -58,73 +58,89 @@ QFrame::StyledPanel - - + + - _("Start Time") + _("Caching") - - - - - 0 - 0 - - + + - _("Change the start time for the media") + _("Change the caching for the media") Qt::AlignRight - s + ms 999999 - - - - - 0 - 0 - + + + + Qt::Horizontal + + + 16 + 24 + + + + + + - _("Caching") + _("Start Time") - - + + - _("Complete MRL for VLC internal") + _("Change the start time for the media") + + + Qt::AlignRight + + + s + + + 999999 - - - - _("Play another media synchronously (extra audio file, ...)") + + + + Qt::Horizontal - + + + 40 + 20 + + + - + Qt::Horizontal - - + + - _("Customize") + _("Play another media synchronously (extra audio file, ...)") @@ -135,11 +151,11 @@ - + - - + + _("Select the file") @@ -148,32 +164,24 @@ - + Qt::Horizontal - - - - - 0 - 0 - + + + + _("Customize") + + + + - _("Change the caching for the media") - - - Qt::AlignRight - - - ms - - - 999999 + _("Complete MRL for VLC internal") @@ -186,18 +194,72 @@ Qt::Horizontal - QSizePolicy::Minimum + QSizePolicy::MinimumExpanding - 240 + 151 20 + + + 0 + + + + + + 0 + 0 + + + + + 20 + 16777215 + + + + Qt::ClickFocus + + + Qt::NoContextMenu + + + true + + + + + + + + 0 + 0 + + + + Play + + + true + + + + + + + + + 0 + 0 + + Qt::Horizontal -- GitLab