Commit 8462c96d authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Separate the label and the message in update dialog to fix the confusion created before.

parent 8152480b
...@@ -215,11 +215,24 @@ UpdateDialog::UpdateDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf ) ...@@ -215,11 +215,24 @@ UpdateDialog::UpdateDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
buttonBox->addButton( updateButton, QDialogButtonBox::ActionRole ); buttonBox->addButton( updateButton, QDialogButtonBox::ActionRole );
buttonBox->addButton( closeButton, QDialogButtonBox::AcceptRole ); buttonBox->addButton( closeButton, QDialogButtonBox::AcceptRole );
updateLabel = new QLabel( qtr( "Checking for an update..." ) ); updateLabelTop = new QLabel( qtr( "Checking for an update..." ) );
updateLabel->setWordWrap( true ); updateLabelTop->setWordWrap( true );
updateLabelTop->setMargin( 8 );
layout->addWidget( updateLabel, 0, 0, Qt::AlignTop ); updateLabelDown = new QLabel( qtr( "\nDo you want to download it?\n" ) );
layout->addWidget( buttonBox, 1, 0 ); updateLabelDown->setWordWrap( true );
updateLabelDown->hide();
updateText = new QTextEdit;
updateText->setAcceptRichText(false);
updateText->setTextInteractionFlags( Qt::TextSelectableByKeyboard|
Qt::TextSelectableByMouse);
updateText->setEnabled( false );
layout->addWidget( updateLabelTop, 0, 0 );
layout->addWidget( updateText, 1, 0 );
layout->addWidget( updateLabelDown, 2, 0 );
layout->addWidget( buttonBox, 3, 0 );
BUTTONACT( updateButton, UpdateOrDownload() ); BUTTONACT( updateButton, UpdateOrDownload() );
BUTTONACT( closeButton, close() ); BUTTONACT( closeButton, close() );
...@@ -228,8 +241,10 @@ UpdateDialog::UpdateDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf ) ...@@ -228,8 +241,10 @@ UpdateDialog::UpdateDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
p_update = update_New( p_intf ); p_update = update_New( p_intf );
b_checked = false; b_checked = false;
setMinimumSize( 200, 100 ); setMinimumSize( 300, 100 );
readSettings( "Update", QSize( 200, 100 ) ); setMaximumSize( 400, 300 );
readSettings( "Update", QSize( 300, 100 ) );
/* Check for updates */ /* Check for updates */
UpdateOrDownload(); UpdateOrDownload();
...@@ -252,7 +267,7 @@ void UpdateDialog::UpdateOrDownload() ...@@ -252,7 +267,7 @@ void UpdateDialog::UpdateOrDownload()
if( !b_checked ) if( !b_checked )
{ {
updateButton->setEnabled( false ); updateButton->setEnabled( false );
updateLabel->setText( qtr( "Launching an update request..." ) ); updateLabelTop->setText( qtr( "Launching an update request..." ) );
update_Check( p_update, UpdateCallback, this ); update_Check( p_update, UpdateCallback, this );
} }
else else
...@@ -296,30 +311,32 @@ void UpdateDialog::updateNotify( bool b_result ) ...@@ -296,30 +311,32 @@ void UpdateDialog::updateNotify( bool b_result )
update_release_t *p_release = update_GetRelease( p_update ); update_release_t *p_release = update_GetRelease( p_update );
assert( p_release ); assert( p_release );
b_checked = true; b_checked = true;
updateButton->setText( "Ok" ); updateButton->setText( "Yes" );
QString message = qtr( "A new version of VLC(" ) QString message = qtr( "A new version of VLC(" )
+ QString::number( p_release->i_major ) + "." + QString::number( p_release->i_major ) + "."
+ QString::number( p_release->i_minor ) + "." + QString::number( p_release->i_minor ) + "."
+ QString::number( p_release->i_revision ); + QString::number( p_release->i_revision );
if( p_release->extra ) if( p_release->extra )
message += p_release->extra; message += p_release->extra;
message += qtr( ") is available.\nDo you want to download it?\n" ) message += qtr( ") is available.");
+ qfu( p_release->psz_desc ); updateLabelTop->setText( message );
updateText->setText( qfu( p_release->psz_desc ) );
updateText->setEnabled( true );
updateLabel->setText( message ); updateLabelDown->show();
/* Force the dialog to be shown */ /* Force the dialog to be shown */
this->show(); this->show();
} }
else else
updateLabel->setText( updateLabelTop->setText(
qtr( "You have the latest version of VLC media player." ) ); qtr( "You have the latest version of VLC media player." ) );
} }
else else
updateLabel->setText( updateLabelTop->setText(
qtr( "An error occurred while checking for updates..." ) ); qtr( "An error occurred while checking for updates..." ) );
adjustSize();
updateButton->setEnabled( true ); updateButton->setEnabled( true );
} }
......
...@@ -37,6 +37,7 @@ class QTextBrowser; ...@@ -37,6 +37,7 @@ class QTextBrowser;
class QLabel; class QLabel;
class QEvent; class QEvent;
class QPushButton; class QPushButton;
class QTextEdit;
class HelpDialog : public QVLCFrame class HelpDialog : public QVLCFrame
{ {
...@@ -110,7 +111,9 @@ private: ...@@ -110,7 +111,9 @@ private:
update_t *p_update; update_t *p_update;
QPushButton *updateButton; QPushButton *updateButton;
QLabel *updateLabel; QLabel *updateLabelTop;
QLabel *updateLabelDown;
QTextEdit *updateText;
void customEvent( QEvent * ); void customEvent( QEvent * );
bool b_checked; bool b_checked;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment