Changeset faad0752ddb0433ae4b47b0f357f08c67b89cec6
- 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
| r9d7bb46 |
rfaad075 |
|
| 233 | 233 | VLC_EXPORT( update_t *, __update_New, ( vlc_object_t * ) ); |
|---|
| 234 | 234 | VLC_EXPORT( void, update_Delete, ( update_t * ) ); |
|---|
| 235 | | VLC_EXPORT( void, update_Check, ( update_t *, void (*callback)( void* ), void * ) ); |
|---|
| | 235 | VLC_EXPORT( void, update_Check, ( update_t *, void (*callback)( void*, vlc_bool_t ), void * ) ); |
|---|
| 236 | 236 | VLC_EXPORT( int, update_CompareReleaseToCurrent, ( update_t * ) ); |
|---|
| 237 | 237 | VLC_EXPORT( void, update_Download, ( update_t *, char* ) ); |
|---|
| r728a032 |
rfaad075 |
|
| 181 | 181 | *****************************************************************************/ |
|---|
| 182 | 182 | /* callback to get information from the core */ |
|---|
| 183 | | static void UpdateCallback( void *data ) |
|---|
| | 183 | static void UpdateCallback( void *data, vlc_bool_t b_ret ) |
|---|
| 184 | 184 | { |
|---|
| 185 | 185 | 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 | |
|---|
| 187 | 193 | QApplication::postEvent( UDialog, event ); |
|---|
| 188 | 194 | } |
|---|
| … | … | |
| 255 | 261 | void UpdateDialog::customEvent( QEvent *event ) |
|---|
| 256 | 262 | { |
|---|
| 257 | | updateNotify(); |
|---|
| | 263 | if( event->type() == UDOkEvent ) |
|---|
| | 264 | updateNotify( true ); |
|---|
| | 265 | else |
|---|
| | 266 | updateNotify( false ); |
|---|
| 258 | 267 | } |
|---|
| 259 | 268 | |
|---|
| 260 | 269 | /* Notify the end of the update_Check */ |
|---|
| 261 | | void UpdateDialog::updateNotify() |
|---|
| 262 | | { |
|---|
| 263 | | if( update_CompareReleaseToCurrent( p_update ) == UpdateReleaseStatusNewer ) |
|---|
| | 270 | void UpdateDialog::updateNotify( bool b_result ) |
|---|
| | 271 | { |
|---|
| | 272 | /* The update finish without errors */ |
|---|
| | 273 | if( b_result ) |
|---|
| 264 | 274 | { |
|---|
| 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" ) ); |
|---|
| 268 | 283 | } |
|---|
| 269 | 284 | 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 | |
|---|
| 273 | 287 | adjustSize(); |
|---|
| 274 | 288 | updateButton->setEnabled( true ); |
|---|
| r77c834e |
rfaad075 |
|
| 76 | 76 | #ifdef UPDATE_CHECK |
|---|
| 77 | 77 | |
|---|
| | 78 | static int UDOkEvent = QEvent::User + 1; |
|---|
| | 79 | static int UDErrorEvent = QEvent::User + 2; |
|---|
| | 80 | |
|---|
| 78 | 81 | class UpdateDialog : public QVLCFrame |
|---|
| 79 | 82 | { |
|---|
| … | … | |
| 87 | 90 | } |
|---|
| 88 | 91 | virtual ~UpdateDialog(); |
|---|
| 89 | | void updateNotify(); |
|---|
| | 92 | void updateNotify( bool ); |
|---|
| 90 | 93 | |
|---|
| 91 | 94 | private: |
|---|
| r3041078 |
rfaad075 |
|
| 1008 | 1008 | VLC_COMMON_MEMBERS |
|---|
| 1009 | 1009 | update_t *p_update; |
|---|
| 1010 | | void (*pf_callback)( void * ); |
|---|
| | 1010 | void (*pf_callback)( void *, vlc_bool_t ); |
|---|
| 1011 | 1011 | void *p_data; |
|---|
| 1012 | 1012 | } update_check_thread_t; |
|---|
| … | … | |
| 1022 | 1022 | * \returns nothing |
|---|
| 1023 | 1023 | */ |
|---|
| 1024 | | void update_Check( update_t *p_update, void (*pf_callback)( void* ), void *p_data ) |
|---|
| | 1024 | void update_Check( update_t *p_update, void (*pf_callback)( void*, vlc_bool_t ), void *p_data ) |
|---|
| 1025 | 1025 | { |
|---|
| 1026 | 1026 | assert( p_update ); |
|---|
| … | … | |
| 1045 | 1045 | vlc_mutex_unlock( &p_uct->p_update->lock ); |
|---|
| 1046 | 1046 | |
|---|
| 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 ); |
|---|
| 1050 | 1049 | |
|---|
| 1051 | 1050 | vlc_object_destroy( p_uct ); |
|---|