Commit e34daedf authored by Antoine Cellerier's avatar Antoine Cellerier

VLC update checker in the wxWidgets interface (in help menu)

xml files used for the updates are located at http://update.videolan.org

extensive testing ... code cleaning ... would be greatly appreciated
parent 5bbb4748
...@@ -157,6 +157,8 @@ VLC_EXPORT( void, intf_Destroy, ( intf_thread_t * ) ); ...@@ -157,6 +157,8 @@ VLC_EXPORT( void, intf_Destroy, ( intf_thread_t * ) );
#define INTF_DIALOG_FILE_GENERIC 30 #define INTF_DIALOG_FILE_GENERIC 30
#define INTF_DIALOG_UPDATEVLC 90
#define INTF_DIALOG_EXIT 99 #define INTF_DIALOG_EXIT 99
/* Useful text messages shared by interfaces */ /* Useful text messages shared by interfaces */
......
...@@ -17,6 +17,7 @@ SOURCES_wxwindows = \ ...@@ -17,6 +17,7 @@ SOURCES_wxwindows = \
preferences_widgets.h \ preferences_widgets.h \
timer.cpp \ timer.cpp \
fileinfo.cpp \ fileinfo.cpp \
updatevlc.cpp \
subtitles.cpp \ subtitles.cpp \
bookmarks.cpp \ bookmarks.cpp \
video.cpp \ video.cpp \
......
...@@ -50,6 +50,7 @@ private: ...@@ -50,6 +50,7 @@ private:
void Open( int i_access_method, int i_arg ); void Open( int i_access_method, int i_arg );
/* Event handlers (these functions should _not_ be virtual) */ /* Event handlers (these functions should _not_ be virtual) */
void OnUpdateVLC( wxCommandEvent& event );
void OnExit( wxCommandEvent& event ); void OnExit( wxCommandEvent& event );
void OnPlaylist( wxCommandEvent& event ); void OnPlaylist( wxCommandEvent& event );
void OnMessages( wxCommandEvent& event ); void OnMessages( wxCommandEvent& event );
...@@ -89,6 +90,7 @@ public: ...@@ -89,6 +90,7 @@ public:
wxFrame *p_prefs_dialog; wxFrame *p_prefs_dialog;
wxWindow *p_bookmarks_dialog; wxWindow *p_bookmarks_dialog;
wxFileDialog *p_file_generic_dialog; wxFileDialog *p_file_generic_dialog;
UpdateVLC *p_updatevlc_dialog;
}; };
DEFINE_LOCAL_EVENT_TYPE( wxEVT_DIALOG ); DEFINE_LOCAL_EVENT_TYPE( wxEVT_DIALOG );
...@@ -126,6 +128,8 @@ BEGIN_EVENT_TABLE(DialogsProvider, wxFrame) ...@@ -126,6 +128,8 @@ BEGIN_EVENT_TABLE(DialogsProvider, wxFrame)
DialogsProvider::OnPopupMenu) DialogsProvider::OnPopupMenu)
EVT_COMMAND(INTF_DIALOG_EXIT, wxEVT_DIALOG, EVT_COMMAND(INTF_DIALOG_EXIT, wxEVT_DIALOG,
DialogsProvider::OnExitThread) DialogsProvider::OnExitThread)
EVT_COMMAND(INTF_DIALOG_UPDATEVLC, wxEVT_DIALOG,
DialogsProvider::OnUpdateVLC)
END_EVENT_TABLE() END_EVENT_TABLE()
wxWindow *CreateDialogsProvider( intf_thread_t *p_intf, wxWindow *p_parent ) wxWindow *CreateDialogsProvider( intf_thread_t *p_intf, wxWindow *p_parent )
...@@ -151,6 +155,7 @@ DialogsProvider::DialogsProvider( intf_thread_t *_p_intf, wxWindow *p_parent ) ...@@ -151,6 +155,7 @@ DialogsProvider::DialogsProvider( intf_thread_t *_p_intf, wxWindow *p_parent )
p_wizard_dialog = NULL; p_wizard_dialog = NULL;
p_bookmarks_dialog = NULL; p_bookmarks_dialog = NULL;
p_dir_dialog = NULL; p_dir_dialog = NULL;
p_updatevlc_dialog = NULL;
/* Give our interface a nice little icon */ /* Give our interface a nice little icon */
p_intf->p_sys->p_icon = new wxIcon( vlc_xpm ); p_intf->p_sys->p_icon = new wxIcon( vlc_xpm );
...@@ -219,6 +224,7 @@ DialogsProvider::~DialogsProvider() ...@@ -219,6 +224,7 @@ DialogsProvider::~DialogsProvider()
if( p_file_generic_dialog ) delete p_file_generic_dialog; if( p_file_generic_dialog ) delete p_file_generic_dialog;
if( p_wizard_dialog ) delete p_wizard_dialog; if( p_wizard_dialog ) delete p_wizard_dialog;
if( p_bookmarks_dialog ) delete p_bookmarks_dialog; if( p_bookmarks_dialog ) delete p_bookmarks_dialog;
if( p_updatevlc_dialog ) delete p_updatevlc_dialog;
if( p_intf->p_sys->p_icon ) delete p_intf->p_sys->p_icon; if( p_intf->p_sys->p_icon ) delete p_intf->p_sys->p_icon;
...@@ -479,3 +485,15 @@ void DialogsProvider::OnExitThread( wxCommandEvent& WXUNUSED(event) ) ...@@ -479,3 +485,15 @@ void DialogsProvider::OnExitThread( wxCommandEvent& WXUNUSED(event) )
{ {
wxTheApp->ExitMainLoop(); wxTheApp->ExitMainLoop();
} }
void DialogsProvider::OnUpdateVLC( wxCommandEvent& WXUNUSED(event) )
{
/* Show/hide the file info window */
if( !p_updatevlc_dialog )
p_updatevlc_dialog = new UpdateVLC( p_intf, this );
if( p_updatevlc_dialog )
{
p_updatevlc_dialog->Show( !p_updatevlc_dialog->IsShown() );
}
}
...@@ -156,6 +156,7 @@ enum ...@@ -156,6 +156,7 @@ enum
* this standard value as otherwise it won't be handled properly under Mac * this standard value as otherwise it won't be handled properly under Mac
* (where it is special and put into the "Apple" menu) */ * (where it is special and put into the "Apple" menu) */
About_Event = wxID_ABOUT, About_Event = wxID_ABOUT,
UpdateVLC_Event,
Iconize_Event Iconize_Event
}; };
...@@ -164,6 +165,7 @@ BEGIN_EVENT_TABLE(Interface, wxFrame) ...@@ -164,6 +165,7 @@ BEGIN_EVENT_TABLE(Interface, wxFrame)
/* Menu events */ /* Menu events */
EVT_MENU(Exit_Event, Interface::OnExit) EVT_MENU(Exit_Event, Interface::OnExit)
EVT_MENU(About_Event, Interface::OnAbout) EVT_MENU(About_Event, Interface::OnAbout)
EVT_MENU(UpdateVLC_Event, Interface::OnShowDialog)
EVT_MENU(Playlist_Event, Interface::OnShowDialog) EVT_MENU(Playlist_Event, Interface::OnShowDialog)
EVT_MENU(Logs_Event, Interface::OnShowDialog) EVT_MENU(Logs_Event, Interface::OnShowDialog)
...@@ -432,6 +434,8 @@ void Interface::CreateOurMenuBar() ...@@ -432,6 +434,8 @@ void Interface::CreateOurMenuBar()
/* Create the "Help" menu */ /* Create the "Help" menu */
wxMenu *help_menu = new wxMenu; wxMenu *help_menu = new wxMenu;
help_menu->Append( About_Event, wxU(_("About VLC media player")) ); help_menu->Append( About_Event, wxU(_("About VLC media player")) );
help_menu->AppendSeparator();
help_menu->Append( UpdateVLC_Event, wxU(_("Check for updates ...")) );
/* Append the freshly created menus to the menu bar... */ /* Append the freshly created menus to the menu bar... */
wxMenuBar *menubar = new wxMenuBar(); wxMenuBar *menubar = new wxMenuBar();
...@@ -913,6 +917,9 @@ void Interface::OnShowDialog( wxCommandEvent& event ) ...@@ -913,6 +917,9 @@ void Interface::OnShowDialog( wxCommandEvent& event )
case Bookmarks_Event: case Bookmarks_Event:
i_id = INTF_DIALOG_BOOKMARKS; i_id = INTF_DIALOG_BOOKMARKS;
break; break;
case UpdateVLC_Event:
i_id = INTF_DIALOG_UPDATEVLC;
break;
default: default:
i_id = INTF_DIALOG_FILE; i_id = INTF_DIALOG_FILE;
break; break;
......
This diff is collapsed.
...@@ -29,6 +29,8 @@ ...@@ -29,6 +29,8 @@
/* Let vlc take care of the i18n stuff */ /* Let vlc take care of the i18n stuff */
#define WXINTL_NO_GETTEXT_MACRO #define WXINTL_NO_GETTEXT_MACRO
#include <list>
#include <wx/wxprec.h> #include <wx/wxprec.h>
#include <wx/wx.h> #include <wx/wx.h>
...@@ -1047,6 +1049,67 @@ private: ...@@ -1047,6 +1049,67 @@ private:
}; };
/* Update VLC */
class UpdateVLC: public wxFrame
{
public:
/* Constructor */
UpdateVLC( intf_thread_t *p_intf, wxWindow *p_parent );
virtual ~UpdateVLC();
private:
void OnButtonClose( wxCommandEvent& event );
void OnClose( wxCloseEvent& WXUNUSED(event) );
void GetData();
void OnCheckForUpdate( wxCommandEvent& event );
void OnMirrorChoice( wxCommandEvent& event );
void UpdateUpdatesTree();
void UpdateMirrorsChoice();
void OnUpdatesTreeActivate( wxTreeEvent& event );
void DownloadFile( wxString url, wxString dst );
DECLARE_EVENT_TABLE();
intf_thread_t *p_intf;
wxTreeCtrl *updates_tree;
wxTreeItemId updates_root;
wxChoice *mirrors_choice;
wxString release_type; /* could be "stable", "test", "nightly" ... */
struct update_file_t
{
wxString type;
wxString md5;
wxString size;
wxString url;
wxString description;
};
struct update_version_t
{
wxString type;
wxString major;
wxString minor;
wxString revision;
wxString extra;
std::list<update_file_t> m_files;
};
std::list<update_version_t> m_versions;
struct update_mirror_t
{
wxString name;
wxString location;
wxString type;
wxString base_url;
};
std::list<update_mirror_t> m_mirrors;
};
#if wxUSE_DRAG_AND_DROP #if wxUSE_DRAG_AND_DROP
/* Drag and Drop class */ /* Drag and Drop class */
class DragAndDrop: public wxFileDropTarget class DragAndDrop: public wxFileDropTarget
......
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