From 3de7f18a4cc4f264a571384437373bc255da0632 Mon Sep 17 00:00:00 2001 From: Francois Cartegnie Date: Mon, 27 Sep 2010 15:44:48 +0200 Subject: [PATCH] Qt: standardbuttons are bad for win32 and translation. Only use custom buttons in the managed layout. --- modules/gui/qt4/dialogs/errors.cpp | 6 +++--- modules/gui/qt4/dialogs/extended.cpp | 6 ++++-- modules/gui/qt4/dialogs/help.cpp | 32 ++++++++++++++-------------- modules/gui/qt4/ui/about.ui | 3 ++- modules/gui/qt4/ui/update.ui | 4 ++-- 5 files changed, 27 insertions(+), 24 deletions(-) diff --git a/modules/gui/qt4/dialogs/errors.cpp b/modules/gui/qt4/dialogs/errors.cpp index 797a67e14b..698c4c7d91 100644 --- a/modules/gui/qt4/dialogs/errors.cpp +++ b/modules/gui/qt4/dialogs/errors.cpp @@ -43,10 +43,10 @@ ErrorsDialog::ErrorsDialog( intf_thread_t *_p_intf ) QGridLayout *layout = new QGridLayout( this ); - QDialogButtonBox *buttonBox = - new QDialogButtonBox( QDialogButtonBox::Close, Qt::Horizontal, this ); - QPushButton *clearButton = new QPushButton( qtr( "&Clear" ) ); + QDialogButtonBox *buttonBox = new QDialogButtonBox( Qt::Horizontal, this ); + QPushButton *clearButton = new QPushButton( qtr( "Cl&ear" ), this ); buttonBox->addButton( clearButton, QDialogButtonBox::ActionRole ); + buttonBox->addButton( new QPushButton( qtr("&Close"), this ), QDialogButtonBox::RejectRole ); messages = new QTextEdit(); messages->setReadOnly( true ); diff --git a/modules/gui/qt4/dialogs/extended.cpp b/modules/gui/qt4/dialogs/extended.cpp index b527b4a254..11342f15e7 100644 --- a/modules/gui/qt4/dialogs/extended.cpp +++ b/modules/gui/qt4/dialogs/extended.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include ExtendedDialog::ExtendedDialog( intf_thread_t *_p_intf ): QVLCFrame( _p_intf ) @@ -87,8 +88,9 @@ ExtendedDialog::ExtendedDialog( intf_thread_t *_p_intf ): QVLCFrame( _p_intf ) layout->addWidget( mainTabW ); - QDialogButtonBox *closeButtonBox = - new QDialogButtonBox( QDialogButtonBox::Close, Qt::Horizontal, this ); + QDialogButtonBox *closeButtonBox = new QDialogButtonBox( Qt::Horizontal, this ); + closeButtonBox->addButton( + new QPushButton( qtr("&Close"), this ), QDialogButtonBox::RejectRole ); layout->addWidget( closeButtonBox ); CONNECT( closeButtonBox, rejected(), this, close() ); diff --git a/modules/gui/qt4/dialogs/help.cpp b/modules/gui/qt4/dialogs/help.cpp index fce2509c3e..3fef481ff2 100644 --- a/modules/gui/qt4/dialogs/help.cpp +++ b/modules/gui/qt4/dialogs/help.cpp @@ -59,8 +59,9 @@ HelpDialog::HelpDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf ) QTextBrowser *helpBrowser = new QTextBrowser( this ); helpBrowser->setOpenExternalLinks( true ); helpBrowser->setHtml( qtr(I_LONGHELP) ); - QDialogButtonBox *closeButtonBox = - new QDialogButtonBox( QDialogButtonBox::Close, Qt::Horizontal, this ); + QDialogButtonBox *closeButtonBox = new QDialogButtonBox( Qt::Horizontal, this ); + closeButtonBox->addButton( + new QPushButton( qtr("&Close"), this ), QDialogButtonBox::RejectRole ); closeButtonBox->setFocus(); layout->addWidget( helpBrowser ); @@ -85,6 +86,8 @@ AboutDialog::AboutDialog( intf_thread_t *_p_intf) { /* Build UI */ ui.setupUi( this ); + ui.closeButtonBox->addButton( + new QPushButton( qtr("&Close"), this ), QDialogButtonBox::RejectRole ); setWindowTitle( qtr( "About" ) ); setWindowRole( "vlc-about" ); @@ -161,23 +164,20 @@ UpdateDialog::UpdateDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf ) { /* build Ui */ ui.setupUi( this ); + ui.updateDialogButtonBox->addButton( new QPushButton( qtr("&Close"), this ), + QDialogButtonBox::RejectRole ); + QPushButton *recheckButton = new QPushButton( qtr("&Recheck version"), this ); + ui.updateDialogButtonBox->addButton( recheckButton, QDialogButtonBox::ActionRole ); + + ui.updateNotifyButtonBox->addButton( new QPushButton( qtr("&Yes"), this ), + QDialogButtonBox::AcceptRole ); + ui.updateNotifyButtonBox->addButton( new QPushButton( qtr("&No"), this ), + QDialogButtonBox::RejectRole ); + setWindowTitle( qtr( "VLC media player updates" ) ); setWindowRole( "vlc-update" ); - QList buttonsList = ui.updateDialogButtonBox->buttons(); - QAbstractButton *currentButton; - for ( int i = 0; i < buttonsList.size() ; ++i ) - { - currentButton = buttonsList.at( i ); - if ( ui.updateDialogButtonBox->standardButton( currentButton ) - == QDialogButtonBox::Retry ) - { - currentButton->setText( qtr( "&Recheck version" ) ); - qobject_cast(currentButton)->setDefault( true ); - } - } - - CONNECT( ui.updateDialogButtonBox, accepted(), this, UpdateOrDownload() ); + BUTTONACT( recheckButton, UpdateOrDownload() ); CONNECT( ui.updateDialogButtonBox, rejected(), this, close() ); CONNECT( ui.updateNotifyButtonBox, accepted(), this, UpdateOrDownload() ); diff --git a/modules/gui/qt4/ui/about.ui b/modules/gui/qt4/ui/about.ui index 6b6d990ad7..109853b061 100644 --- a/modules/gui/qt4/ui/about.ui +++ b/modules/gui/qt4/ui/about.ui @@ -149,6 +149,7 @@ p, li { white-space: pre-wrap; } <tr> <td style="border: none;"> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans'; font-size:10pt;"></p> <p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans'; font-size:10pt;"></p></td></tr></table></body></html> @@ -167,7 +168,7 @@ p, li { white-space: pre-wrap; } - QDialogButtonBox::Close + QDialogButtonBox::NoButton diff --git a/modules/gui/qt4/ui/update.ui b/modules/gui/qt4/ui/update.ui index 2401173691..ecfa28a483 100644 --- a/modules/gui/qt4/ui/update.ui +++ b/modules/gui/qt4/ui/update.ui @@ -34,7 +34,7 @@ - QDialogButtonBox::Close|QDialogButtonBox::Retry + QDialogButtonBox::NoButton @@ -122,7 +122,7 @@ - QDialogButtonBox::No|QDialogButtonBox::Yes + QDialogButtonBox::NoButton -- 2.39.2