X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fgui%2Fqt4%2Fdialogs%2Ferrors.cpp;h=698c4c7d91f461a88cabacddd5cb518772104585;hb=9cc1540b8c973407d32c013489e2e1277141ef1e;hp=fa0a4868f4193713abbe4ee3451eafde2e7de7b4;hpb=6992b1a5f786fdebba13b0dcbed9b6194d655e4b;p=vlc diff --git a/modules/gui/qt4/dialogs/errors.cpp b/modules/gui/qt4/dialogs/errors.cpp index fa0a4868f4..698c4c7d91 100644 --- a/modules/gui/qt4/dialogs/errors.cpp +++ b/modules/gui/qt4/dialogs/errors.cpp @@ -5,6 +5,7 @@ * $Id$ * * Authors: Clément Stenac + * Jean-Baptiste Kempf * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +21,9 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif #include "dialogs/errors.hpp" @@ -27,20 +31,23 @@ #include #include #include +#include #include -ErrorsDialog *ErrorsDialog::instance = NULL; - -ErrorsDialog::ErrorsDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf ) +ErrorsDialog::ErrorsDialog( intf_thread_t *_p_intf ) + : QVLCDialog( (QWidget*)_p_intf->p_sys->p_mi, _p_intf ) { setWindowTitle( qtr( "Errors" ) ); - resize( 500 , 200 ); - - setWindowModality( Qt::ApplicationModal ); + setWindowRole( "vlc-errors" ); + resize( 500 , 300 ); QGridLayout *layout = new QGridLayout( this ); - QPushButton *closeButton = new QPushButton( qtr( "&Close" ) ); - 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 ); messages->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff ); @@ -48,26 +55,24 @@ ErrorsDialog::ErrorsDialog( intf_thread_t *_p_intf ) : QVLCFrame( _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( clearButton, 2, 1 ); - layout->addWidget( closeButton, 2, 2 ); + layout->addWidget( buttonBox, 1, 2 ); - BUTTONACT( closeButton, 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 );