Commit 36cb61ac authored by Rémi Duraffort's avatar Rémi Duraffort

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

parent 09b9702d
......@@ -50,9 +50,6 @@ BEGIN_EVENT_TABLE(UpdateVLC, wxFrame)
EVT_BUTTON(wxID_OK, UpdateVLC::OnButtonClose)
EVT_BUTTON(CheckForUpdate_Event, UpdateVLC::OnCheckForUpdate)
/* CtrlList events */
EVT_LIST_ITEM_ACTIVATED( ChooseItem_Event, UpdateVLC::OnChooseItem )
/* Hide the window when the user closes the window */
EVT_CLOSE(UpdateVLC::OnClose)
......@@ -79,13 +76,13 @@ UpdateVLC::UpdateVLC( intf_thread_t *_p_intf, wxWindow *p_parent ):
main_sizer->Add( update_button );
SetSizerAndFit( main_sizer );
p_u = update_New( p_intf );
p_update = update_New( p_intf );
}
UpdateVLC::~UpdateVLC()
{
update_Delete( p_u );
update_Delete( p_update );
}
void UpdateVLC::OnButtonClose( wxCommandEvent& event )
......@@ -101,108 +98,25 @@ void UpdateVLC::OnClose( wxCloseEvent& WXUNUSED(event) )
void UpdateVLC::OnCheckForUpdate( wxCommandEvent& event )
{
update_Check( p_u, VLC_FALSE );
update_iterator_t *p_uit = update_iterator_New( p_u );
if( p_uit )
{
update_Check( p_update );
wxBoxSizer *main_sizer = new wxBoxSizer( wxVERTICAL );
p_uit->i_rs = UPDATE_RELEASE_STATUS_NEWER;
p_uit->i_t = UPDATE_FILE_TYPE_ALL;
update_iterator_Action( p_uit, UPDATE_MIRROR );
DestroyChildren();
wxListCtrl *list =
new wxListCtrl( this, ChooseItem_Event,
wxDefaultPosition, wxSize( 400, 300 ),
wxLC_SINGLE_SEL|wxLC_LIST );
wxImageList *images = new wxImageList( 32, 32, TRUE );
images->Add( wxIcon( update_ascii_xpm ) );
images->Add( wxIcon( update_info_xpm ) );
images->Add( wxIcon( update_source_xpm ) );
images->Add( wxIcon( update_binary_xpm ) );
images->Add( wxIcon( update_document_xpm ) );
list->AssignImageList( images, wxIMAGE_LIST_SMALL );
while( update_iterator_Action( p_uit, UPDATE_FILE ) != UPDATE_FAIL )
{
int i_image;
switch( p_uit->file.i_type )
{
case UPDATE_FILE_TYPE_INFO:
i_image = 1;
break;
case UPDATE_FILE_TYPE_SOURCE:
i_image = 2;
break;
case UPDATE_FILE_TYPE_BINARY:
i_image = 3;
break;
case UPDATE_FILE_TYPE_PLUGIN:
i_image = 4;
break;
default:
i_image = 0;
}
char *psz_tmp = NULL;
if( p_uit->file.l_size )
{
if( p_uit->file.l_size > 1024 * 1024 * 1024 )
asprintf( &psz_tmp, "(%ld GB)",
p_uit->file.l_size / (1024*1024*1024) );
if( p_uit->file.l_size > 1024 * 1024 )
asprintf( &psz_tmp, "(%ld MB)",
p_uit->file.l_size / (1024*1024) );
else if( p_uit->file.l_size > 1024 )
asprintf( &psz_tmp, "(%ld kB)",
p_uit->file.l_size / 1024 );
else
asprintf( &psz_tmp, "(%ld B)", p_uit->file.l_size );
}
list->InsertItem( list->GetItemCount(),
/*list->InsertItem( list->GetItemCount(),
wxU(p_uit->file.psz_description)+wxU("\n")
+ wxU(p_uit->release.psz_version)+wxU(" ")
+ wxU(psz_tmp),
i_image );
if( psz_tmp ) free( psz_tmp );
}
main_sizer->Add( new wxStaticText( this, -1, wxU( _("\nAvailable "
"updates and related downloads.\n"
"(Double click on a file to download it)\n" ) ) ) );
main_sizer->Add( list );
i_image );*/
if( update_CompareReleaseToCurrent( p_update ) == UpdateReleaseStatusNewer )
main_sizer->Add( new wxStaticText( this, -1, wxU( p_update->release.psz_desc )
+ wxU( "\nYou can download the latest version of VLC at the adress :\n" )
+ wxU( p_update->release.psz_url ) ) );
else
main_sizer->Add( new wxStaticText( this, -1,
wxU( _( "\nYou have the latest version of VLC\n" ) ) ) );
SetSizerAndFit( main_sizer );
Layout();
update_iterator_Delete( p_uit );
}
}
void UpdateVLC::OnChooseItem( wxListEvent& event )
{
update_iterator_t *p_uit = update_iterator_New( p_u );
if( p_uit )
{
p_uit->i_rs = UPDATE_RELEASE_STATUS_NEWER;
p_uit->i_t = UPDATE_FILE_TYPE_ALL;
update_iterator_Action( p_uit, UPDATE_MIRROR );
int i_count = 0;
while( update_iterator_Action( p_uit, UPDATE_FILE ) != UPDATE_FAIL )
{
if( i_count == event.GetIndex() )
break;
i_count++;
}
wxString url = wxU( p_uit->file.psz_url );
wxFileDialog *filedialog =
new wxFileDialog( this, wxU(_("Save file...")),
wxT(""), url.AfterLast( '/' ), wxT("*.*"),
wxSAVE | wxOVERWRITE_PROMPT );
if( filedialog->ShowModal() == wxID_OK )
{
update_download( p_uit, filedialog->GetPath().mb_str(wxConvUTF8) );
}
update_iterator_Delete( p_uit );
delete filedialog;
}
}
......@@ -49,7 +49,7 @@ namespace wxvlc
DECLARE_EVENT_TABLE();
intf_thread_t *p_intf;
update_t *p_u;
update_t *p_update;
};
};
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment