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 * ) );
#define INTF_DIALOG_FILE_GENERIC 30
#define INTF_DIALOG_UPDATEVLC 90
#define INTF_DIALOG_EXIT 99
/* Useful text messages shared by interfaces */
......
......@@ -17,6 +17,7 @@ SOURCES_wxwindows = \
preferences_widgets.h \
timer.cpp \
fileinfo.cpp \
updatevlc.cpp \
subtitles.cpp \
bookmarks.cpp \
video.cpp \
......
......@@ -50,6 +50,7 @@ private:
void Open( int i_access_method, int i_arg );
/* Event handlers (these functions should _not_ be virtual) */
void OnUpdateVLC( wxCommandEvent& event );
void OnExit( wxCommandEvent& event );
void OnPlaylist( wxCommandEvent& event );
void OnMessages( wxCommandEvent& event );
......@@ -89,6 +90,7 @@ public:
wxFrame *p_prefs_dialog;
wxWindow *p_bookmarks_dialog;
wxFileDialog *p_file_generic_dialog;
UpdateVLC *p_updatevlc_dialog;
};
DEFINE_LOCAL_EVENT_TYPE( wxEVT_DIALOG );
......@@ -126,6 +128,8 @@ BEGIN_EVENT_TABLE(DialogsProvider, wxFrame)
DialogsProvider::OnPopupMenu)
EVT_COMMAND(INTF_DIALOG_EXIT, wxEVT_DIALOG,
DialogsProvider::OnExitThread)
EVT_COMMAND(INTF_DIALOG_UPDATEVLC, wxEVT_DIALOG,
DialogsProvider::OnUpdateVLC)
END_EVENT_TABLE()
wxWindow *CreateDialogsProvider( 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_bookmarks_dialog = NULL;
p_dir_dialog = NULL;
p_updatevlc_dialog = NULL;
/* Give our interface a nice little icon */
p_intf->p_sys->p_icon = new wxIcon( vlc_xpm );
......@@ -219,6 +224,7 @@ DialogsProvider::~DialogsProvider()
if( p_file_generic_dialog ) delete p_file_generic_dialog;
if( p_wizard_dialog ) delete p_wizard_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;
......@@ -479,3 +485,15 @@ void DialogsProvider::OnExitThread( wxCommandEvent& WXUNUSED(event) )
{
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
* this standard value as otherwise it won't be handled properly under Mac
* (where it is special and put into the "Apple" menu) */
About_Event = wxID_ABOUT,
UpdateVLC_Event,
Iconize_Event
};
......@@ -164,6 +165,7 @@ BEGIN_EVENT_TABLE(Interface, wxFrame)
/* Menu events */
EVT_MENU(Exit_Event, Interface::OnExit)
EVT_MENU(About_Event, Interface::OnAbout)
EVT_MENU(UpdateVLC_Event, Interface::OnShowDialog)
EVT_MENU(Playlist_Event, Interface::OnShowDialog)
EVT_MENU(Logs_Event, Interface::OnShowDialog)
......@@ -432,6 +434,8 @@ void Interface::CreateOurMenuBar()
/* Create the "Help" menu */
wxMenu *help_menu = new wxMenu;
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... */
wxMenuBar *menubar = new wxMenuBar();
......@@ -913,6 +917,9 @@ void Interface::OnShowDialog( wxCommandEvent& event )
case Bookmarks_Event:
i_id = INTF_DIALOG_BOOKMARKS;
break;
case UpdateVLC_Event:
i_id = INTF_DIALOG_UPDATEVLC;
break;
default:
i_id = INTF_DIALOG_FILE;
break;
......
This diff is collapsed.
......@@ -29,6 +29,8 @@
/* Let vlc take care of the i18n stuff */
#define WXINTL_NO_GETTEXT_MACRO
#include <list>
#include <wx/wxprec.h>
#include <wx/wx.h>
......@@ -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
/* Drag and Drop class */
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