Changeset faad0752ddb0433ae4b47b0f357f08c67b89cec6

Show
Ignore:
Timestamp:
14/01/08 00:04:23 (9 months ago)
Author:
Rémi Duraffort <ivoire@videolan.org>
git-committer:
Rémi Duraffort <ivoire@videolan.org> 1200265463 +0000
git-parent:

[6162f8941794fbd2cb1f64bf2e9ccf0ced430e47]

git-author:
Rémi Duraffort <ivoire@videolan.org> 1200265463 +0000
Message:

Alert the user when something wrong accure during the update.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • include/vlc_update.h

    r9d7bb46 rfaad075  
    233233VLC_EXPORT( update_t *, __update_New, ( vlc_object_t * ) ); 
    234234VLC_EXPORT( void, update_Delete, ( update_t * ) ); 
    235 VLC_EXPORT( void, update_Check, ( update_t *, void (*callback)( void* ), void * ) ); 
     235VLC_EXPORT( void, update_Check, ( update_t *, void (*callback)( void*, vlc_bool_t ), void * ) ); 
    236236VLC_EXPORT( int, update_CompareReleaseToCurrent, ( update_t * ) ); 
    237237VLC_EXPORT( void, update_Download, ( update_t *, char* ) ); 
  • modules/gui/qt4/dialogs/help.cpp

    r728a032 rfaad075  
    181181 *****************************************************************************/ 
    182182/* callback to get information from the core */ 
    183 static void UpdateCallback( void *data
     183static void UpdateCallback( void *data, vlc_bool_t b_ret
    184184{ 
    185185    UpdateDialog* UDialog = (UpdateDialog *)data; 
    186     QEvent *event = new QEvent( QEvent::User ); 
     186    QEvent* event; 
     187 
     188    if( b_ret ) 
     189        event = new QEvent( (QEvent::Type)UDOkEvent ); 
     190    else 
     191        event = new QEvent( (QEvent::Type)UDErrorEvent ); 
     192 
    187193    QApplication::postEvent( UDialog, event ); 
    188194} 
     
    255261void UpdateDialog::customEvent( QEvent *event ) 
    256262{ 
    257     updateNotify(); 
     263    if( event->type() == UDOkEvent ) 
     264        updateNotify( true ); 
     265    else 
     266        updateNotify( false ); 
    258267} 
    259268 
    260269/* Notify the end of the update_Check */ 
    261 void UpdateDialog::updateNotify() 
    262 
    263     if( update_CompareReleaseToCurrent( p_update ) == UpdateReleaseStatusNewer ) 
     270void UpdateDialog::updateNotify( bool b_result ) 
     271
     272    /* The update finish without errors */ 
     273    if( b_result ) 
    264274    { 
    265         b_checked = true; 
    266         updateButton->setText( "Download" ); 
    267         updateLabel->setText( qtr( "There is a new version of vlc :\n" ) + qfu( p_update->release.psz_desc )  ); 
     275        if( update_CompareReleaseToCurrent( p_update ) == UpdateReleaseStatusNewer ) 
     276        { 
     277            b_checked = true; 
     278            updateButton->setText( "Download" ); 
     279            updateLabel->setText( qtr( "There is a new version of vlc :\n" ) + qfu( p_update->release.psz_desc )  ); 
     280        } 
     281        else 
     282            updateLabel->setText( qtr( "You have the latest version of vlc" ) ); 
    268283    } 
    269284    else 
    270     { 
    271         updateLabel->setText( qtr( "You have the latest version of vlc" ) ); 
    272     } 
     285        updateLabel->setText( qtr( "An error occure while checking for updates" ) ); 
     286 
    273287    adjustSize(); 
    274288    updateButton->setEnabled( true ); 
  • modules/gui/qt4/dialogs/help.hpp

    r77c834e rfaad075  
    7676#ifdef UPDATE_CHECK 
    7777 
     78static int UDOkEvent = QEvent::User + 1; 
     79static int UDErrorEvent = QEvent::User + 2; 
     80 
    7881class UpdateDialog : public QVLCFrame 
    7982{ 
     
    8790    } 
    8891    virtual ~UpdateDialog(); 
    89     void updateNotify(); 
     92    void updateNotify( bool ); 
    9093 
    9194private: 
  • src/misc/update.c

    r3041078 rfaad075  
    10081008    VLC_COMMON_MEMBERS 
    10091009    update_t *p_update; 
    1010     void (*pf_callback)( void * ); 
     1010    void (*pf_callback)( void *, vlc_bool_t ); 
    10111011    void *p_data; 
    10121012} update_check_thread_t; 
     
    10221022 * \returns nothing 
    10231023 */ 
    1024 void update_Check( update_t *p_update, void (*pf_callback)( void* ), void *p_data ) 
     1024void update_Check( update_t *p_update, void (*pf_callback)( void*, vlc_bool_t ), void *p_data ) 
    10251025{ 
    10261026    assert( p_update ); 
     
    10451045    vlc_mutex_unlock( &p_uct->p_update->lock ); 
    10461046 
    1047     /* FIXME: return b_ret in pf_callback */ 
    1048     if( b_ret && p_uct->pf_callback ) 
    1049         (p_uct->pf_callback)( p_uct->p_data ); 
     1047    if( p_uct->pf_callback ) 
     1048        (p_uct->pf_callback)( p_uct->p_data, b_ret ); 
    10501049 
    10511050    vlc_object_destroy( p_uct );