]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/dialogs/errors.cpp
Qt: standardbuttons are bad for win32 and translation. Only use custom
[vlc] / modules / gui / qt4 / dialogs / errors.cpp
index 3de1700e0522cf95b8bf24d0687dcb597b33d753..698c4c7d91f461a88cabacddd5cb518772104585 100644 (file)
 #include <QDialogButtonBox>
 #include <QPushButton>
 
-ErrorsDialog *ErrorsDialog::instance = NULL;
-
-ErrorsDialog::ErrorsDialog( QWidget *parent, intf_thread_t *_p_intf ) 
-            : QVLCDialog( parent, _p_intf )
+ErrorsDialog::ErrorsDialog( intf_thread_t *_p_intf )
+             : QVLCDialog( (QWidget*)_p_intf->p_sys->p_mi, _p_intf )
 {
     setWindowTitle( qtr( "Errors" ) );
+    setWindowRole( "vlc-errors" );
     resize( 500 , 300 );
 
-    setWindowModality( Qt::ApplicationModal );
-
     QGridLayout *layout = new QGridLayout( this );
 
-    QDialogButtonBox *buttonBox = new QDialogButtonBox;
-    QPushButton *closeButton = new QPushButton( qtr( "&Close" ) );
-    QPushButton *clearButton = new QPushButton( qtr( "&Clear" ) );
-    buttonBox->addButton( closeButton, QDialogButtonBox::AcceptRole );
+    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 );
@@ -59,25 +55,24 @@ ErrorsDialog::ErrorsDialog( QWidget *parent, intf_thread_t *_p_intf )
 
     layout->addWidget( messages, 0, 0, 1, 3 );
     layout->addWidget( stopShowing, 1, 0 );
-    layout->addItem( new QSpacerItem( 200, 20, QSizePolicy::Expanding ), 2,0 );
-    layout->addWidget( buttonBox, 2, 2 );
+    layout->addWidget( buttonBox, 1, 2 );
 
-    CONNECT( buttonBox, accepted(), this, close() );
+    CONNECT( buttonBox, rejected(), this, close() );
     BUTTONACT( clearButton, clear() );
     BUTTONACT( stopShowing, dontShow() );
 }
 
-void ErrorsDialog::addError( QString title, QString text )
+void ErrorsDialog::addError( const QString& title, const QString& text )
 {
     add( true, title, text );
 }
 
-void ErrorsDialog::addWarning( QString title, QString text )
+/*void ErrorsDialog::addWarning( QString title, QString text )
 {
     add( false, title, text );
-}
+}*/
 
-void ErrorsDialog::add( bool error, QString title, QString text )
+void ErrorsDialog::add( bool error, const QString& title, const QString& text )
 {
     if( stopShowing->isChecked() ) return;
     messages->textCursor().movePosition( QTextCursor::End );