Commit 237f16e4 authored by yoann's avatar yoann

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

parent 9dcfbd36
......@@ -30,10 +30,16 @@ enum
{
Notebook_Event,
Timer_Event,
Close_Event,
Load_Event,
Save_Event,
};
BEGIN_EVENT_TABLE( VLMPanel, wxPanel)
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()
......@@ -42,6 +48,7 @@ VLMPanel::VLMPanel( intf_thread_t *_p_intf, wxWindow *_p_parent ) :
timer( this, Timer_Event )
{
p_intf = _p_intf;
p_parent = _p_parent;
p_vlm = new VLMWrapper( p_intf );
p_vlm->AttachVLM();
......@@ -62,6 +69,13 @@ VLMPanel::VLMPanel( intf_thread_t *_p_intf, wxWindow *_p_parent ) :
panel_sizer->Add( p_notebook, 1 , wxEXPAND | wxALL, 5 );
#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();
SetSizerAndFit( panel_sizer );
......@@ -186,6 +200,38 @@ void VLMPanel::Update()
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
*************************/
......@@ -444,7 +490,6 @@ void VLMAddStreamPanel::OnChooseOutput( wxCommandEvent &event )
****************************************************************************/
enum
{
Close_Event,
};
BEGIN_EVENT_TABLE( VLMFrame, wxFrame )
......
......@@ -74,7 +74,6 @@ namespace wxvlc
OpenDialog *p_open_dialog;
SoutDialog *p_sout_dialog;
wxFileDialog *p_file_dialog;
DECLARE_EVENT_TABLE();
};
......@@ -95,9 +94,15 @@ namespace wxvlc
private:
VLMWrapper *p_vlm;
intf_thread_t *p_intf;
wxWindow *p_parent;
wxFileDialog *p_file_dialog;
wxTimer timer;
void OnTimer( wxTimerEvent &);
void OnClose( wxCommandEvent& );
void OnLoad( wxCommandEvent& );
void OnSave( wxCommandEvent& );
/** Notebook */
wxNotebook *p_notebook;
DECLARE_EVENT_TABLE();
......@@ -136,10 +141,10 @@ namespace wxvlc
virtual ~VLMFrame();
void Update();
void OnClose( wxCloseEvent& );
private:
VLMPanel *vlm_panel;
DECLARE_EVENT_TABLE();
void OnClose( wxCloseEvent& );
};
/** 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