Changeset 36cb61acf8426c9886461bee4dfaf4b53637692f

Show
Ignore:
Timestamp:
11/12/07 01:52:05 (1 year ago)
Author:
Rémi Duraffort <ivoire@videolan.org>
git-committer:
Rémi Duraffort <ivoire@videolan.org> 1197334325 +0000
git-parent:

[09b9702d80aeb29444eeea7166165f114dee5f41]

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

Add the modification to the wxwidget interface and make the buildbot happy

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/gui/wxwidgets/dialogs/updatevlc.cpp

    r6ee1e19 r36cb61a  
    5151    EVT_BUTTON(CheckForUpdate_Event, UpdateVLC::OnCheckForUpdate) 
    5252 
    53     /* CtrlList events */ 
    54     EVT_LIST_ITEM_ACTIVATED( ChooseItem_Event, UpdateVLC::OnChooseItem ) 
    55  
    5653    /* Hide the window when the user closes the window */ 
    5754    EVT_CLOSE(UpdateVLC::OnClose) 
     
    8077    SetSizerAndFit( main_sizer ); 
    8178 
    82     p_u = update_New( p_intf ); 
     79    p_update = update_New( p_intf ); 
    8380} 
    8481 
     
    8683UpdateVLC::~UpdateVLC() 
    8784{ 
    88     update_Delete( p_u ); 
     85    update_Delete( p_update ); 
    8986} 
    9087 
     
    10299void UpdateVLC::OnCheckForUpdate( wxCommandEvent& event ) 
    103100{ 
    104     update_Check( p_u, VLC_FALSE ); 
    105     update_iterator_t *p_uit = update_iterator_New( p_u ); 
    106     if( p_uit ) 
    107     { 
    108         wxBoxSizer *main_sizer = new wxBoxSizer( wxVERTICAL ); 
     101    update_Check( p_update ); 
     102    wxBoxSizer *main_sizer = new wxBoxSizer( wxVERTICAL ); 
    109103 
    110         p_uit->i_rs = UPDATE_RELEASE_STATUS_NEWER; 
    111         p_uit->i_t = UPDATE_FILE_TYPE_ALL; 
    112         update_iterator_Action( p_uit, UPDATE_MIRROR ); 
     104    DestroyChildren(); 
    113105 
    114         DestroyChildren(); 
     106    /*list->InsertItem( list->GetItemCount(), 
     107                      wxU(p_uit->file.psz_description)+wxU("\n") 
     108                      + wxU(p_uit->release.psz_version)+wxU(" ") 
     109                      + wxU(psz_tmp), 
     110                      i_image );*/ 
    115111 
    116         wxListCtrl *list = 
    117             new wxListCtrl( this, ChooseItem_Event, 
    118                             wxDefaultPosition, wxSize( 400, 300 ), 
    119                             wxLC_SINGLE_SEL|wxLC_LIST ); 
    120         wxImageList *images = new wxImageList( 32, 32, TRUE ); 
    121         images->Add( wxIcon( update_ascii_xpm ) ); 
    122         images->Add( wxIcon( update_info_xpm ) ); 
    123         images->Add( wxIcon( update_source_xpm ) ); 
    124         images->Add( wxIcon( update_binary_xpm ) ); 
    125         images->Add( wxIcon( update_document_xpm ) ); 
    126         list->AssignImageList( images, wxIMAGE_LIST_SMALL ); 
    127         while( update_iterator_Action( p_uit, UPDATE_FILE ) != UPDATE_FAIL ) 
    128         { 
    129             int i_image; 
    130             switch( p_uit->file.i_type ) 
    131             { 
    132                 case UPDATE_FILE_TYPE_INFO: 
    133                     i_image = 1; 
    134                     break; 
    135                 case UPDATE_FILE_TYPE_SOURCE: 
    136                     i_image = 2; 
    137                     break; 
    138                 case UPDATE_FILE_TYPE_BINARY: 
    139                     i_image = 3; 
    140                     break; 
    141                 case UPDATE_FILE_TYPE_PLUGIN: 
    142                     i_image = 4; 
    143                     break; 
    144                 default: 
    145                     i_image = 0; 
    146             } 
    147             char *psz_tmp = NULL; 
    148             if( p_uit->file.l_size ) 
    149             { 
    150                 if( p_uit->file.l_size > 1024 * 1024 * 1024 ) 
    151                      asprintf( &psz_tmp, "(%ld GB)", 
    152                                 p_uit->file.l_size / (1024*1024*1024) ); 
    153                 if( p_uit->file.l_size > 1024 * 1024 ) 
    154                     asprintf( &psz_tmp, "(%ld MB)", 
    155                                 p_uit->file.l_size / (1024*1024) ); 
    156                 else if( p_uit->file.l_size > 1024 ) 
    157                     asprintf( &psz_tmp, "(%ld kB)", 
    158                                 p_uit->file.l_size / 1024 ); 
    159                 else 
    160                     asprintf( &psz_tmp, "(%ld B)", p_uit->file.l_size ); 
    161             } 
    162             list->InsertItem( list->GetItemCount(), 
    163                               wxU(p_uit->file.psz_description)+wxU("\n") 
    164                               + wxU(p_uit->release.psz_version)+wxU(" ") 
    165                               + wxU(psz_tmp), 
    166                               i_image ); 
    167             if( psz_tmp ) free( psz_tmp ); 
    168         } 
     112    if( update_CompareReleaseToCurrent( p_update ) == UpdateReleaseStatusNewer ) 
     113        main_sizer->Add( new wxStaticText( this, -1, wxU( p_update->release.psz_desc ) 
     114                         + wxU( "\nYou can download the latest version of VLC at the adress :\n" ) 
     115                         + wxU( p_update->release.psz_url ) ) ); 
     116    else 
     117        main_sizer->Add( new wxStaticText( this, -1, 
     118                         wxU( _( "\nYou have the latest version of VLC\n" ) ) ) ); 
    169119 
    170         main_sizer->Add( new wxStaticText( this, -1, wxU( _("\nAvailable " 
    171                 "updates and related downloads.\n" 
    172                 "(Double click on a file to download it)\n" ) ) ) ); 
    173         main_sizer->Add( list ); 
    174         SetSizerAndFit( main_sizer ); 
    175         Layout(); 
    176         update_iterator_Delete( p_uit ); 
    177     } 
     120    SetSizerAndFit( main_sizer ); 
     121    Layout(); 
    178122} 
    179  
    180 void UpdateVLC::OnChooseItem( wxListEvent& event ) 
    181 { 
    182     update_iterator_t *p_uit = update_iterator_New( p_u ); 
    183     if( p_uit ) 
    184     { 
    185         p_uit->i_rs = UPDATE_RELEASE_STATUS_NEWER; 
    186         p_uit->i_t = UPDATE_FILE_TYPE_ALL; 
    187         update_iterator_Action( p_uit, UPDATE_MIRROR ); 
    188  
    189         int i_count = 0; 
    190         while( update_iterator_Action( p_uit, UPDATE_FILE ) != UPDATE_FAIL ) 
    191         { 
    192             if( i_count == event.GetIndex() ) 
    193                 break; 
    194             i_count++; 
    195         } 
    196         wxString url = wxU( p_uit->file.psz_url ); 
    197         wxFileDialog *filedialog = 
    198                     new wxFileDialog( this, wxU(_("Save file...")), 
    199                         wxT(""), url.AfterLast( '/' ), wxT("*.*"), 
    200                         wxSAVE | wxOVERWRITE_PROMPT ); 
    201         if( filedialog->ShowModal() == wxID_OK ) 
    202         { 
    203             update_download( p_uit, filedialog->GetPath().mb_str(wxConvUTF8) ); 
    204         } 
    205         update_iterator_Delete( p_uit ); 
    206         delete filedialog; 
    207     } 
    208 } 
  • modules/gui/wxwidgets/dialogs/updatevlc.hpp

    rc0dd3f0 r36cb61a  
    5050 
    5151        intf_thread_t *p_intf; 
    52         update_t *p_u
     52        update_t *p_update
    5353    }; 
    5454};