| 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" ) ) ) ); |
|---|
| 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 | | } |
|---|