* vlcproc.cpp: VlcProc class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
- * $Id: vlcproc.cpp,v 1.4 2003/04/11 22:08:06 videolan Exp $
+ * $Id: vlcproc.cpp,v 1.36 2003/06/20 19:50:29 ipkiss Exp $
*
* Authors: Olivier Teulière <ipkiss@via.ecp.fr>
* Emmanuel Puig <karibu@via.ecp.fr>
* USA.
*****************************************************************************/
-
//--- VLC -------------------------------------------------------------------
#include <vlc/vlc.h>
#include <vlc/intf.h>
#include <vlc/aout.h>
#include <vlc/vout.h>
-
//--- SKIN ------------------------------------------------------------------
-#include "os_api.h"
-#include "dialog.h"
-#include "os_dialog.h"
+#include "../os_api.h"
#include "event.h"
#include "banks.h"
#include "theme.h"
-#include "os_theme.h"
+#include "../os_theme.h"
#include "themeloader.h"
#include "window.h"
#include "vlcproc.h"
#include "skin_common.h"
-
-
+#include "dialogs.h"
//---------------------------------------------------------------------------
// VlcProc
p_intf = _p_intf;
}
//---------------------------------------------------------------------------
+VlcProc::~VlcProc()
+{
+}
+//---------------------------------------------------------------------------
bool VlcProc::EventProc( Event *evt )
{
switch( evt->GetMessage() )
return true;
case VLC_HIDE:
- for( list<Window *>::const_iterator win =
+ for( list<SkinWindow *>::const_iterator win =
p_intf->p_sys->p_theme->WindowList.begin();
win != p_intf->p_sys->p_theme->WindowList.end(); win++ )
{
return true;
case VLC_SHOW:
- for( list<Window *>::const_iterator win =
+ for( list<SkinWindow *>::const_iterator win =
p_intf->p_sys->p_theme->WindowList.begin();
win != p_intf->p_sys->p_theme->WindowList.end(); win++ )
{
return true;
case VLC_OPEN:
- OpenFile( true );
+ p_intf->p_sys->p_dialogs->ShowOpen( true );
+ InterfaceRefresh();
return true;
case VLC_LOAD_SKIN:
return true;
case VLC_PLAYLIST_ADD_FILE:
- OpenFile( false );
+ p_intf->p_sys->p_dialogs->ShowOpen( false );
+ InterfaceRefresh();
return true;
case VLC_LOG_SHOW:
- p_intf->p_sys->p_theme->ShowLog( evt->GetParam2() );
+ p_intf->p_sys->p_dialogs->ShowMessages();
return true;
case VLC_LOG_CLEAR:
- p_intf->p_sys->p_theme->ClearLog();
+ return true;
+
+ case VLC_PREFS_SHOW:
+ p_intf->p_sys->p_dialogs->ShowPrefs();
+ return true;
+
+ case VLC_INFO_SHOW:
+ p_intf->p_sys->p_dialogs->ShowFileInfo();
return true;
case VLC_INTF_REFRESH:
if( p_intf->p_sys->b_all_win_closed )
return true;
- list<Window *>::const_iterator win;
+ list<SkinWindow *>::const_iterator win;
// If a window has been closed, test if all are closed !
for( win = p_intf->p_sys->p_theme->WindowList.begin();
Theme *Thema = Sys->p_theme;
playlist_t *PlayList = Sys->p_playlist;
-
// Refresh
- if( PlayList != NULL && Sys->p_input != NULL &&
- Sys->p_input->stream.b_seekable )
+ if( PlayList != NULL )
{
// Refresh stream control controls ! :)
switch( PlayList->i_status )
else
EnabledEvent( "next", true );
-
- // Update file name text
+ // Update file name
if( PlayList->i_index != Sys->i_index )
{
+ string long_name = PlayList->pp_items[PlayList->i_index]->psz_name;
+ int pos = long_name.rfind( DIRECTORY_SEPARATOR, long_name.size() );
+
+ // Complete file name
Thema->EvtBank->Get( "file_name" )->PostTextMessage(
PlayList->pp_items[PlayList->i_index]->psz_name );
+ // File name without path
+ Thema->EvtBank->Get( "title" )->PostTextMessage(
+ PlayList->pp_items[PlayList->i_index]->psz_name + pos + 1 );
}
// Update playlists
//---------------------------------------------------------------------------
-
//---------------------------------------------------------------------------
// Common VLC procedures
//---------------------------------------------------------------------------
{
if( p_intf->p_sys->p_new_theme_file == NULL )
{
- // Initialize file structure
- OpenFileDialog *OpenFile;
- OpenFile = (OpenFileDialog *)new OSOpenFileDialog( p_intf,
- _("Change skin - Open new file"), false );
- OpenFile->AddFilter( _("Skin files"), "*.vlt" );
- OpenFile->AddFilter( _("Skin files"), "*.xml" );
- OpenFile->AddFilter( _("All files"), "*.*" );
-
- // Open dialog box
- if( OpenFile->Open() )
- {
- p_intf->p_sys->p_new_theme_file =
- new char[OpenFile->FileList.front().length()];
-
- strcpy( p_intf->p_sys->p_new_theme_file,
- OpenFile->FileList.front().c_str() );
-
- // Tell vlc to change skin after hiding interface
- OSAPI_PostMessage( NULL, VLC_HIDE, VLC_LOAD_SKIN, 0 );
- }
-
- // Free memory
- delete OpenFile;
+ p_intf->p_sys->p_dialogs->ShowOpenSkin();
}
else
{
}
}
//---------------------------------------------------------------------------
-void VlcProc::OpenFile( bool play )
-{
- // Initialize file structure
- OpenFileDialog *OpenFile;
- if( play )
- {
- OpenFile = (OpenFileDialog *)new OSOpenFileDialog( p_intf,
- _("Open file"), false );
- }
- else
- {
- OpenFile = (OpenFileDialog *)new OSOpenFileDialog( p_intf,
- _("Add file"), true );
- }
- OpenFile->AddFilter( _("All files"), "*.*" );
-
- // Check if palylist is available
- playlist_t *p_playlist = p_intf->p_sys->p_playlist;
- if( p_playlist == NULL )
- return;
-
- // Open dialog box and launch file
- if( OpenFile->Open() )
- {
- list<string>::const_iterator file;
- for( file = OpenFile->FileList.begin();
- file != OpenFile->FileList.end(); file++ )
- {
- playlist_Add( p_playlist, (*file).c_str(), PLAYLIST_APPEND,
- PLAYLIST_END );
- }
-
- // Refreshing
- if( play )
- {
- // Play
- p_intf->p_sys->p_theme->EvtBank->Get( "play" )->SendEvent();
- }
- // Refresh interface !
- p_intf->p_sys->p_theme->EvtBank->Get( "playlist_refresh" )
- ->PostSynchroMessage();
- InterfaceRefresh();
- }
-
- // Free memory
- delete OpenFile;
-}
-//---------------------------------------------------------------------------
void VlcProc::DropFile( unsigned int param )
{
// Get pointer to file
{
if( p_intf->p_sys->p_playlist == NULL )
return;
+
if( !p_intf->p_sys->p_playlist->i_size )
+ {
+ p_intf->p_sys->p_dialogs->ShowOpen( true );
+ InterfaceRefresh();
return;
+ }
playlist_Play( p_intf->p_sys->p_playlist );
}
aout_VolumeGet( p_intf, &volume );
- PostMessage( NULL, CTRL_SET_SLIDER,
- (unsigned int)
- p_intf->p_sys->p_theme->EvtBank->Get( "volume_refresh" ),
- (int)( volume * SLIDER_RANGE / AOUT_VOLUME_MAX ) );
}
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
void VlcProc::AddNetworkUDP( int port )
{
- config_PutInt( p_intf, "network-channel", FALSE );
-
// Build source name
char *s_port = new char[5];
sprintf( s_port, "%i", port );
InterfaceRefresh();
}
//---------------------------------------------------------------------------
-
-