Commit 237f16e4 authored by Yoann Peronneau's avatar Yoann Peronneau

* wx/vlm: add "Load" & "Save" buttons

parent 9dcfbd36
...@@ -30,10 +30,16 @@ enum ...@@ -30,10 +30,16 @@ enum
{ {
Notebook_Event, Notebook_Event,
Timer_Event, Timer_Event,
Close_Event,
Load_Event,
Save_Event,
}; };
BEGIN_EVENT_TABLE( VLMPanel, wxPanel) BEGIN_EVENT_TABLE( VLMPanel, wxPanel)
EVT_TIMER( Timer_Event, VLMPanel::OnTimer ) EVT_TIMER( Timer_Event, VLMPanel::OnTimer )
EVT_BUTTON( Close_Event, VLMPanel::OnClose )
EVT_BUTTON( Load_Event, VLMPanel::OnLoad )
EVT_BUTTON( Save_Event, VLMPanel::OnSave )
END_EVENT_TABLE() END_EVENT_TABLE()
...@@ -42,6 +48,7 @@ VLMPanel::VLMPanel( intf_thread_t *_p_intf, wxWindow *_p_parent ) : ...@@ -42,6 +48,7 @@ VLMPanel::VLMPanel( intf_thread_t *_p_intf, wxWindow *_p_parent ) :
timer( this, Timer_Event ) timer( this, Timer_Event )
{ {
p_intf = _p_intf; p_intf = _p_intf;
p_parent = _p_parent;
p_vlm = new VLMWrapper( p_intf ); p_vlm = new VLMWrapper( p_intf );
p_vlm->AttachVLM(); p_vlm->AttachVLM();
...@@ -62,6 +69,13 @@ VLMPanel::VLMPanel( intf_thread_t *_p_intf, wxWindow *_p_parent ) : ...@@ -62,6 +69,13 @@ VLMPanel::VLMPanel( intf_thread_t *_p_intf, wxWindow *_p_parent ) :
panel_sizer->Add( p_notebook, 1 , wxEXPAND | wxALL, 5 ); panel_sizer->Add( p_notebook, 1 , wxEXPAND | wxALL, 5 );
#endif #endif
wxBoxSizer *button_sizer = new wxBoxSizer( wxHORIZONTAL );
button_sizer->Add( new wxButton( this, Close_Event, wxU(_("Close") ) ) );
button_sizer->Add( 0, 0, 1 );
button_sizer->Add( new wxButton( this, Load_Event, wxU(_("Load") ) ), 0, wxRIGHT, 10 );
button_sizer->Add( new wxButton( this, Save_Event, wxU(_("Save") ) ) );
panel_sizer->Add( button_sizer, 0 , wxEXPAND | wxALL, 5 );
panel_sizer->Layout(); panel_sizer->Layout();
SetSizerAndFit( panel_sizer ); SetSizerAndFit( panel_sizer );
...@@ -186,6 +200,38 @@ void VLMPanel::Update() ...@@ -186,6 +200,38 @@ void VLMPanel::Update()
p_vlm->UnlockVLM(); p_vlm->UnlockVLM();
} }
void VLMPanel::OnClose( wxCommandEvent &event )
{
((VLMFrame*)p_parent)->OnClose( *( new wxCloseEvent() ) );
}
void VLMPanel::OnLoad( wxCommandEvent &event )
{
p_file_dialog = new wxFileDialog( NULL, wxT(""), wxT(""), wxT(""),
wxT("*"), wxOPEN | wxMULTIPLE );
if( p_file_dialog == NULL ) return;
p_file_dialog->SetTitle( wxU(_("Load configuration") ) );
if( p_file_dialog->ShowModal() == wxID_OK )
{
vlm_Load( p_vlm->GetVLM(), p_file_dialog->GetPath().mb_str() );
}
Update();
}
void VLMPanel::OnSave( wxCommandEvent &event )
{
p_file_dialog = new wxFileDialog( NULL, wxT(""), wxT(""), wxT(""),
wxT("*"), wxSAVE | wxOVERWRITE_PROMPT );
if( p_file_dialog == NULL ) return;
p_file_dialog->SetTitle( wxU(_("Save configuration") ) );
if( p_file_dialog->ShowModal() == wxID_OK )
{
vlm_Save( p_vlm->GetVLM(), p_file_dialog->GetPath().mb_str() );
}
}
/************************* /*************************
* Broadcasts management * Broadcasts management
*************************/ *************************/
...@@ -444,7 +490,6 @@ void VLMAddStreamPanel::OnChooseOutput( wxCommandEvent &event ) ...@@ -444,7 +490,6 @@ void VLMAddStreamPanel::OnChooseOutput( wxCommandEvent &event )
****************************************************************************/ ****************************************************************************/
enum enum
{ {
Close_Event,
}; };
BEGIN_EVENT_TABLE( VLMFrame, wxFrame ) BEGIN_EVENT_TABLE( VLMFrame, wxFrame )
......
...@@ -74,7 +74,6 @@ namespace wxvlc ...@@ -74,7 +74,6 @@ namespace wxvlc
OpenDialog *p_open_dialog; OpenDialog *p_open_dialog;
SoutDialog *p_sout_dialog; SoutDialog *p_sout_dialog;
wxFileDialog *p_file_dialog;
DECLARE_EVENT_TABLE(); DECLARE_EVENT_TABLE();
}; };
...@@ -95,9 +94,15 @@ namespace wxvlc ...@@ -95,9 +94,15 @@ namespace wxvlc
private: private:
VLMWrapper *p_vlm; VLMWrapper *p_vlm;
intf_thread_t *p_intf; intf_thread_t *p_intf;
wxWindow *p_parent;
wxFileDialog *p_file_dialog;
wxTimer timer; wxTimer timer;
void OnTimer( wxTimerEvent &); void OnTimer( wxTimerEvent &);
void OnClose( wxCommandEvent& );
void OnLoad( wxCommandEvent& );
void OnSave( wxCommandEvent& );
/** Notebook */ /** Notebook */
wxNotebook *p_notebook; wxNotebook *p_notebook;
DECLARE_EVENT_TABLE(); DECLARE_EVENT_TABLE();
...@@ -136,10 +141,10 @@ namespace wxvlc ...@@ -136,10 +141,10 @@ namespace wxvlc
virtual ~VLMFrame(); virtual ~VLMFrame();
void Update(); void Update();
void OnClose( wxCloseEvent& );
private: private:
VLMPanel *vlm_panel; VLMPanel *vlm_panel;
DECLARE_EVENT_TABLE(); DECLARE_EVENT_TABLE();
void OnClose( wxCloseEvent& );
}; };
/** This class is the edit dialog for a stream /** This class is the edit dialog for a stream
......
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