]> git.sesse.net Git - vlc/commitdiff
Qt: standardbuttons are bad for win32 and translation. Only use custom
authorFrancois Cartegnie <fcvlcdev@free.fr>
Mon, 27 Sep 2010 13:44:48 +0000 (15:44 +0200)
committerFrancois Cartegnie <fcvlcdev@free.fr>
Mon, 27 Sep 2010 15:56:38 +0000 (17:56 +0200)
buttons in the managed layout.

modules/gui/qt4/dialogs/errors.cpp
modules/gui/qt4/dialogs/extended.cpp
modules/gui/qt4/dialogs/help.cpp
modules/gui/qt4/ui/about.ui
modules/gui/qt4/ui/update.ui

index 797a67e14bfac59bb1d902e0365d5a2b56f7b796..698c4c7d91f461a88cabacddd5cb518772104585 100644 (file)
@@ -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 );
index b527b4a254a4a9a001ccb07659c078651f18c41a..11342f15e75baa32afea0eade5de3aea03fd0af6 100644 (file)
@@ -33,6 +33,7 @@
 #include <QTabWidget>
 #include <QGridLayout>
 #include <QDialogButtonBox>
+#include <QPushButton>
 #include <vlc_modules.h>
 
 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() );
 
index fce2509c3ea90ec92a63c57001106ca7dd6ba1ab..3fef481ff20cf6f472cd49e01b3f276406abcc22 100644 (file)
@@ -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<QAbstractButton *> 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<QPushButton *>(currentButton)->setDefault( true );
-        }
-    }
-
-    CONNECT( ui.updateDialogButtonBox, accepted(), this, UpdateOrDownload() );
+    BUTTONACT( recheckButton, UpdateOrDownload() );
     CONNECT( ui.updateDialogButtonBox, rejected(), this, close() );
 
     CONNECT( ui.updateNotifyButtonBox, accepted(), this, UpdateOrDownload() );
index 6b6d990ad74930ed53758cb9f4c6fe208a3a3287..109853b06144148d70634fb7cab09f73546c1559 100644 (file)
@@ -149,6 +149,7 @@ p, li { white-space: pre-wrap; }
 &lt;tr&gt;
 &lt;td style=&quot;border: none;&quot;&gt;
 &lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;/p&gt;
+&lt;p style=&quot;-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;/p&gt;
 &lt;p style=&quot;-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;&quot;&gt;&lt;/p&gt;
 &lt;p style=&quot;-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;&quot;&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/body&gt;&lt;/html&gt;</string>
          </property>
@@ -167,7 +168,7 @@ p, li { white-space: pre-wrap; }
    <item row="1" column="0">
     <widget class="QDialogButtonBox" name="closeButtonBox">
      <property name="standardButtons">
-      <set>QDialogButtonBox::Close</set>
+      <set>QDialogButtonBox::NoButton</set>
      </property>
     </widget>
    </item>
index 24011736917dd5e2fd70fab2945c272ce3b91e37..ecfa28a483cebd43379209a757b7314d0a4403aa 100644 (file)
@@ -34,7 +34,7 @@
        <item>
         <widget class="QDialogButtonBox" name="updateDialogButtonBox">
          <property name="standardButtons">
-          <set>QDialogButtonBox::Close|QDialogButtonBox::Retry</set>
+          <set>QDialogButtonBox::NoButton</set>
          </property>
         </widget>
        </item>
        <item>
         <widget class="QDialogButtonBox" name="updateNotifyButtonBox">
          <property name="standardButtons">
-          <set>QDialogButtonBox::No|QDialogButtonBox::Yes</set>
+          <set>QDialogButtonBox::NoButton</set>
          </property>
         </widget>
        </item>