setWindowRole( "vlc-help" );
setMinimumSize( 350, 300 );
- QGridLayout *layout = new QGridLayout( this );
+ QVBoxLayout *layout = new QVBoxLayout( this );
QTextBrowser *helpBrowser = new QTextBrowser( this );
helpBrowser->setOpenExternalLinks( true );
helpBrowser->setHtml( qtr(I_LONGHELP) );
- QPushButton *closeButton = new QPushButton( qtr( "&Close" ) );
- closeButton->setDefault( true );
+ QDialogButtonBox *closeButtonBox = new QDialogButtonBox( Qt::Horizontal, this );
+ closeButtonBox->addButton(
+ new QPushButton( qtr("&Close"), this ), QDialogButtonBox::RejectRole );
+ closeButtonBox->setFocus();
- layout->addWidget( helpBrowser, 0, 0, 1, 0 );
- layout->addWidget( closeButton, 1, 3 );
+ layout->addWidget( helpBrowser );
+ layout->addWidget( closeButtonBox );
- BUTTONACT( closeButton, close() );
+ CONNECT( closeButtonBox, rejected(), this, close() );
readSettings( "Help", QSize( 500, 450 ) );
}
{
/* Build UI */
ui.setupUi( this );
+ ui.closeButtonBox->addButton(
+ new QPushButton( qtr("&Close"), this ), QDialogButtonBox::RejectRole );
setWindowTitle( qtr( "About" ) );
setWindowRole( "vlc-about" );
UpdateDialog::UpdateDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
{
- setWindowTitle( qtr( "VLC media player updates" ) );
- setWindowRole( "vlc-update" );
-
- QGridLayout *layout = new QGridLayout( this );
-
- QPushButton *closeButton = new QPushButton( qtr( "&Cancel" ) );
- updateButton = new QPushButton( qtr( "&Recheck version" ) );
- updateButton->setDefault( true );
-
- QDialogButtonBox *buttonBox = new QDialogButtonBox( Qt::Horizontal );
- buttonBox->addButton( updateButton, QDialogButtonBox::ActionRole );
- buttonBox->addButton( closeButton, QDialogButtonBox::AcceptRole );
-
- updateLabelTop = new QLabel( qtr( "Checking for an update..." ) );
- updateLabelTop->setWordWrap( true );
- updateLabelTop->setMargin( 8 );
+ /* 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 );
- updateLabelDown = new QLabel( qtr( "\nDo you want to download it?\n" ) );
- updateLabelDown->setWordWrap( true );
- updateLabelDown->hide();
+ ui.updateNotifyButtonBox->addButton( new QPushButton( qtr("&Yes"), this ),
+ QDialogButtonBox::AcceptRole );
+ ui.updateNotifyButtonBox->addButton( new QPushButton( qtr("&No"), this ),
+ QDialogButtonBox::RejectRole );
- updateText = new QTextEdit( this );
- updateText->setAcceptRichText(false);
- updateText->setTextInteractionFlags( Qt::TextSelectableByKeyboard|
- Qt::TextSelectableByMouse);
- updateText->setEnabled( false );
+ setWindowTitle( qtr( "VLC media player updates" ) );
+ setWindowRole( "vlc-update" );
- layout->addWidget( updateLabelTop, 0, 0 );
- layout->addWidget( updateText, 1, 0 );
- layout->addWidget( updateLabelDown, 2, 0 );
- layout->addWidget( buttonBox, 3, 0 );
+ BUTTONACT( recheckButton, UpdateOrDownload() );
+ CONNECT( ui.updateDialogButtonBox, rejected(), this, close() );
- BUTTONACT( updateButton, UpdateOrDownload() );
- BUTTONACT( closeButton, close() );
+ CONNECT( ui.updateNotifyButtonBox, accepted(), this, UpdateOrDownload() );
+ CONNECT( ui.updateNotifyButtonBox, rejected(), this, close() );
/* Create the update structure */
p_update = update_New( p_intf );
{
if( !b_checked )
{
- updateButton->setEnabled( false );
- updateLabelTop->setText( qtr( "Launching an update request..." ) );
+ ui.stackedWidget->setCurrentWidget( ui.updateRequestPage );
update_Check( p_update, UpdateCallback, this );
}
else
msg_Dbg( p_intf, "Downloading to folder: %s", qtu( dest_dir ) );
toggleVisible();
update_Download( p_update, qtu( dest_dir ) );
+ /* FIXME: We should trigger a change to another dialog here ! */
}
}
}
{
if( update_NeedUpgrade( p_update ) )
{
+ ui.stackedWidget->setCurrentWidget( ui.updateNotifyPage );
update_release_t *p_release = update_GetRelease( p_update );
assert( p_release );
b_checked = true;
- updateButton->setText( qtr( "&Yes" ) );
- QString message = qtr( "A new version of VLC(" )
- + QString::number( p_release->i_major ) + "."
- + QString::number( p_release->i_minor ) + "."
- + QString::number( p_release->i_revision );
- if( p_release->extra )
- message += p_release->extra;
- message += qtr( ") is available.");
- updateLabelTop->setText( message );
-
- updateText->setText( qfu( p_release->psz_desc ) );
- updateText->setEnabled( true );
+ QString message = QString(
+ qtr( "A new version of VLC (%1.%2.%3%4) is available." ) )
+ .arg( QString::number( p_release->i_major ) )
+ .arg( QString::number( p_release->i_minor ) )
+ .arg( QString::number( p_release->i_revision ) )
+ .arg( ( p_release->extra )?QString( p_release->extra ):"" );
- updateLabelDown->show();
+ ui.updateNotifyLabel->setText( message );
+ ui.updateNotifyTextEdit->setText( qfu( p_release->psz_desc ) );
/* Force the dialog to be shown */
this->show();
}
else
- updateLabelTop->setText(
+ {
+ ui.stackedWidget->setCurrentWidget( ui.updateDialogPage );
+ ui.updateDialogLabel->setText(
qtr( "You have the latest version of VLC media player." ) );
+ }
}
else
- updateLabelTop->setText(
+ {
+ ui.stackedWidget->setCurrentWidget( ui.updateDialogPage );
+ ui.updateDialogLabel->setText(
qtr( "An error occurred while checking for updates..." ) );
-
- updateButton->setEnabled( true );
+ }
}
#endif