Commit 122163a2 authored by Anil Daoud's avatar Anil Daoud

* display useful information in the tooltip

parent 66bf046e
...@@ -101,27 +101,6 @@ BEGIN_EVENT_TABLE(wxVolCtrl, wxWindow) ...@@ -101,27 +101,6 @@ BEGIN_EVENT_TABLE(wxVolCtrl, wxWindow)
EVT_MOTION(wxVolCtrl::OnChange) EVT_MOTION(wxVolCtrl::OnChange)
END_EVENT_TABLE() END_EVENT_TABLE()
/* Systray integration */
#ifdef wxHAS_TASK_BAR_ICON
class Systray: public wxTaskBarIcon
{
public:
Systray( Interface* p_main_interface );
virtual ~Systray() {};
wxMenu* CreatePopupMenu();
private:
void OnLeftClick( wxTaskBarIconEvent& event );
void OnPlayStream ( wxCommandEvent& event );
void OnStopStream ( wxCommandEvent& event );
void OnPrevStream ( wxCommandEvent& event );
void OnNextStream ( wxCommandEvent& event );
void OnExit( wxCommandEvent& event );
Interface* p_main_interface;
DECLARE_EVENT_TABLE()
};
#endif
/***************************************************************************** /*****************************************************************************
* Event Table. * Event Table.
*****************************************************************************/ *****************************************************************************/
...@@ -228,20 +207,6 @@ BEGIN_EVENT_TABLE(Interface, wxFrame) ...@@ -228,20 +207,6 @@ BEGIN_EVENT_TABLE(Interface, wxFrame)
END_EVENT_TABLE() END_EVENT_TABLE()
#ifdef wxHAS_TASK_BAR_ICON
BEGIN_EVENT_TABLE(Systray, wxTaskBarIcon)
/* Mouse events */
EVT_TASKBAR_LEFT_DOWN(Systray::OnLeftClick)
/* Menu events */
EVT_MENU(Iconize_Event, Systray::OnLeftClick)
EVT_MENU(Exit_Event, Systray::OnExit)
EVT_MENU(PlayStream_Event, Systray::OnPlayStream)
EVT_MENU(NextStream_Event, Systray::OnNextStream)
EVT_MENU(PrevStream_Event, Systray::OnPrevStream)
EVT_MENU(StopStream_Event, Systray::OnStopStream)
END_EVENT_TABLE()
#endif
/***************************************************************************** /*****************************************************************************
* Constructor. * Constructor.
*****************************************************************************/ *****************************************************************************/
...@@ -1305,10 +1270,27 @@ void wxVolCtrl::UpdateVolume() ...@@ -1305,10 +1270,27 @@ void wxVolCtrl::UpdateVolume()
} }
/***************************************************************************** /*****************************************************************************
* Definition of Systray class. * Systray class.
*****************************************************************************/ *****************************************************************************/
#ifdef wxHAS_TASK_BAR_ICON #ifdef wxHAS_TASK_BAR_ICON
BEGIN_EVENT_TABLE(Systray, wxTaskBarIcon)
/* Mouse events */
#ifdef WIN32
EVT_TASKBAR_LEFT_DCLICK(Systray::OnLeftClick)
#else
EVT_TASKBAR_LEFT_DOWN(Systray::OnLeftClick)
#endif
/* Menu events */
EVT_MENU(Iconize_Event, Systray::OnLeftClick)
EVT_MENU(Exit_Event, Systray::OnExit)
EVT_MENU(PlayStream_Event, Systray::OnPlayStream)
EVT_MENU(NextStream_Event, Systray::OnNextStream)
EVT_MENU(PrevStream_Event, Systray::OnPrevStream)
EVT_MENU(StopStream_Event, Systray::OnStopStream)
END_EVENT_TABLE()
Systray::Systray( Interface *_p_main_interface ) Systray::Systray( Interface *_p_main_interface )
{ {
p_main_interface = _p_main_interface; p_main_interface = _p_main_interface;
...@@ -1318,6 +1300,7 @@ Systray::Systray( Interface *_p_main_interface ) ...@@ -1318,6 +1300,7 @@ Systray::Systray( Interface *_p_main_interface )
void Systray::OnLeftClick( wxTaskBarIconEvent& event ) void Systray::OnLeftClick( wxTaskBarIconEvent& event )
{ {
p_main_interface->Show( ! p_main_interface->IsShown() ); p_main_interface->Show( ! p_main_interface->IsShown() );
if ( p_main_interface->IsShown() ) p_main_interface->Raise();
} }
void Systray::OnExit( wxCommandEvent& event ) void Systray::OnExit( wxCommandEvent& event )
...@@ -1359,5 +1342,10 @@ wxMenu* Systray::CreatePopupMenu() ...@@ -1359,5 +1342,10 @@ wxMenu* Systray::CreatePopupMenu()
systray_menu->Append( Iconize_Event, wxU(_("Show/Hide interface")) ); systray_menu->Append( Iconize_Event, wxU(_("Show/Hide interface")) );
return systray_menu; return systray_menu;
} }
void Systray::UpdateTooltip( const wxChar* tooltip )
{
SetIcon( wxIcon( vlc16x16_xpm ), tooltip );
}
#endif #endif
...@@ -137,6 +137,12 @@ void Timer::Notify() ...@@ -137,6 +137,12 @@ void Timer::Notify()
wxU(p_intf->p_sys->p_input->input.p_item->psz_name), 2 ); wxU(p_intf->p_sys->p_input->input.p_item->psz_name), 2 );
p_main_interface->TogglePlayButton( PLAYING_S ); p_main_interface->TogglePlayButton( PLAYING_S );
#ifdef wxHAS_TASK_BAR_ICON
if( p_main_interface->p_systray )
{
p_main_interface->p_systray->UpdateTooltip( wxU(p_intf->p_sys->p_input->input.p_item->psz_name) + wxString(wxT(" - ")) + wxU(_("Playing")));
}
#endif
i_old_playing_status = PLAYING_S; i_old_playing_status = PLAYING_S;
} }
} }
...@@ -161,6 +167,12 @@ void Timer::Notify() ...@@ -161,6 +167,12 @@ void Timer::Notify()
p_main_interface->statusbar->SetStatusText( wxT(""), 0 ); p_main_interface->statusbar->SetStatusText( wxT(""), 0 );
p_main_interface->statusbar->SetStatusText( wxT(""), 2 ); p_main_interface->statusbar->SetStatusText( wxT(""), 2 );
#ifdef wxHAS_TASK_BAR_ICON
if( p_main_interface->p_systray )
{
p_main_interface->p_systray->UpdateTooltip( wxString(wxT("VLC media player - ")) + wxU(_("Stopped")) );
}
#endif
vlc_object_release( p_intf->p_sys->p_input ); vlc_object_release( p_intf->p_sys->p_input );
p_intf->p_sys->p_input = NULL; p_intf->p_sys->p_input = NULL;
} }
...@@ -347,6 +359,19 @@ void Timer::Notify() ...@@ -347,6 +359,19 @@ void Timer::Notify()
{ {
p_main_interface->TogglePlayButton( PLAYING_S ); p_main_interface->TogglePlayButton( PLAYING_S );
} }
#ifdef wxHAS_TASK_BAR_ICON
if( p_main_interface->p_systray )
{
if( val.i_int == PAUSE_S )
{
p_main_interface->p_systray->UpdateTooltip( wxU(p_intf->p_sys->p_input->input.p_item->psz_name) + wxString(wxT(" - ")) + wxU(_("Paused")));
}
else
{
p_main_interface->p_systray->UpdateTooltip( wxU(p_intf->p_sys->p_input->input.p_item->psz_name) + wxString(wxT(" - ")) + wxU(_("Playing")));
}
}
#endif
i_old_playing_status = val.i_int; i_old_playing_status = val.i_int;
} }
......
...@@ -93,9 +93,6 @@ class DialogsProvider; ...@@ -93,9 +93,6 @@ class DialogsProvider;
class PrefsTreeCtrl; class PrefsTreeCtrl;
class AutoBuiltPanel; class AutoBuiltPanel;
class VideoWindow; class VideoWindow;
#ifdef wxHAS_TASK_BAR_ICON
class Systray;
#endif
/***************************************************************************** /*****************************************************************************
* intf_sys_t: description and status of wxwindows interface * intf_sys_t: description and status of wxwindows interface
...@@ -287,6 +284,28 @@ private: ...@@ -287,6 +284,28 @@ private:
}; };
#endif #endif
/* Systray integration */
#ifdef wxHAS_TASK_BAR_ICON
class Systray: public wxTaskBarIcon
{
public:
Systray( Interface* p_main_interface );
virtual ~Systray() {};
wxMenu* CreatePopupMenu();
void UpdateTooltip( const wxChar* tooltip );
private:
void OnLeftClick( wxTaskBarIconEvent& event );
void OnPlayStream ( wxCommandEvent& event );
void OnStopStream ( wxCommandEvent& event );
void OnPrevStream ( wxCommandEvent& event );
void OnNextStream ( wxCommandEvent& event );
void OnExit( wxCommandEvent& event );
Interface* p_main_interface;
DECLARE_EVENT_TABLE()
};
#endif
/* Main Interface */ /* Main Interface */
class Interface: public wxFrame class Interface: public wxFrame
{ {
......
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