]> git.sesse.net Git - vlc/commitdiff
Add the modification to the wxwidget interface and make the buildbot happy
authorRémi Duraffort <ivoire@videolan.org>
Tue, 11 Dec 2007 00:52:05 +0000 (00:52 +0000)
committerRémi Duraffort <ivoire@videolan.org>
Tue, 11 Dec 2007 00:52:05 +0000 (00:52 +0000)
modules/gui/wxwidgets/dialogs/updatevlc.cpp
modules/gui/wxwidgets/dialogs/updatevlc.hpp

index fa2ad5307fa27926be66de7dd342e40f26fb3819..b4e0f6d6f6cdc185e192ed7d46d95ea10f34af64 100644 (file)
@@ -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 )
-    {
-        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(),
-                              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 );
-        SetSizerAndFit( main_sizer );
-        Layout();
-        update_iterator_Delete( p_uit );
-    }
-}
+    update_Check( p_update );
+    wxBoxSizer *main_sizer = new wxBoxSizer( wxVERTICAL );
 
-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;
-    }
+    DestroyChildren();
+
+    /*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( 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();
 }
index cc069acd4e2c6842207532454e5f8170a1ea927a..29cf974a36a0cceb9ea5bdda5c11b3790aa18440 100644 (file)
@@ -49,7 +49,7 @@ namespace wxvlc
         DECLARE_EVENT_TABLE();
 
         intf_thread_t *p_intf;
-        update_t *p_u;
+        update_t *p_update;
     };
 };