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" ); BUTTONACT( recheckButton, UpdateOrDownload() ); CONNECT( ui.updateDialogButtonBox, rejected(), this, close() ); CONNECT( ui.updateNotifyButtonBox, accepted(), this, UpdateOrDownload() ); CONNECT( ui.updateNotifyButtonBox, rejected(), this, close() ); /* Create the update structure */ p_update = update_New( p_intf ); b_checked = false; setMinimumSize( 300, 300 ); setMaximumSize( 400, 300 ); restoreWidgetPosition( "Update", QSize( 300, 250 ) ); /* Check for updates */ UpdateOrDownload(); }
UpdateDialog::UpdateDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf ) { setWindowTitle( qtr( "VLC media player updates" ) ); 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 ); updateLabelDown = new QLabel( qtr( "\nDo you want to download it?\n" ) ); updateLabelDown->setWordWrap( true ); updateLabelDown->hide(); updateText = new QTextEdit( this ); 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( closeButton, close() ); /* Create the update structure */ p_update = update_New( p_intf ); b_checked = false; setMinimumSize( 300, 300 ); setMaximumSize( 400, 300 ); readSettings( "Update", QSize( 300, 250 ) ); /* Check for updates */ UpdateOrDownload(); }
int UpdateDialog::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QVLCFrame::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: close(); break; case 1: UpdateOrDownload(); break; default: ; } _id -= 2; } return _id; }