/*****************************************************************************
* skin_main.cpp
*****************************************************************************
- * Copyright (C) 2003 VideoLAN
+ * Copyright (C) 2003 the VideoLAN team
* $Id$
*
* Authors: Cyril Deguet <asmax@via.ecp.fr>
- * Olivier Teulière <ipkiss@via.ecp.fr>
+ * Olivier Teulière <ipkiss@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include <stdlib.h>
#include "vlcproc.hpp"
#include "theme_loader.hpp"
#include "theme.hpp"
+#include "theme_repository.hpp"
#include "../parser/interpreter.hpp"
#include "../commands/async_queue.hpp"
#include "../commands/cmd_quit.hpp"
+#include "../commands/cmd_dialogs.hpp"
//---------------------------------------------------------------------------
p_intf->pf_run = Run;
// Suscribe to messages bank
- p_intf->p_sys->p_sub = msg_Subscribe( p_intf );
+ p_intf->p_sys->p_sub = msg_Subscribe( p_intf, MSG_QUEUE_NORMAL );
p_intf->p_sys->p_input = NULL;
p_intf->p_sys->p_playlist = (playlist_t *)vlc_object_find( p_intf,
if( p_intf->p_sys->p_playlist == NULL )
{
msg_Err( p_intf, "No playlist object found" );
+ msg_Unsubscribe( p_intf, p_intf->p_sys->p_sub );
return VLC_EGENERIC;
}
p_intf->p_sys->p_osLoop = NULL;
p_intf->p_sys->p_varManager = NULL;
p_intf->p_sys->p_vlcProc = NULL;
+ p_intf->p_sys->p_repository = NULL;
// No theme yet
p_intf->p_sys->p_theme = NULL;
// Initialize singletons
if( OSFactory::instance( p_intf ) == NULL )
{
- msg_Err( p_intf, "Cannot initialize OSFactory" );
+ msg_Err( p_intf, "cannot initialize OSFactory" );
+ vlc_object_release( p_intf->p_sys->p_playlist );
+ msg_Unsubscribe( p_intf, p_intf->p_sys->p_sub );
return VLC_EGENERIC;
}
if( AsyncQueue::instance( p_intf ) == NULL )
{
- msg_Err( p_intf, "Cannot initialize AsyncQueue" );
+ msg_Err( p_intf, "cannot initialize AsyncQueue" );
+ vlc_object_release( p_intf->p_sys->p_playlist );
+ msg_Unsubscribe( p_intf, p_intf->p_sys->p_sub );
return VLC_EGENERIC;
}
if( Interpreter::instance( p_intf ) == NULL )
{
- msg_Err( p_intf, "Cannot instanciate Interpreter" );
+ msg_Err( p_intf, "cannot instanciate Interpreter" );
+ vlc_object_release( p_intf->p_sys->p_playlist );
+ msg_Unsubscribe( p_intf, p_intf->p_sys->p_sub );
return VLC_EGENERIC;
}
if( VarManager::instance( p_intf ) == NULL )
{
- msg_Err( p_intf, "Cannot instanciate VarManager" );
+ msg_Err( p_intf, "cannot instanciate VarManager" );
+ vlc_object_release( p_intf->p_sys->p_playlist );
+ msg_Unsubscribe( p_intf, p_intf->p_sys->p_sub );
return VLC_EGENERIC;
}
if( VlcProc::instance( p_intf ) == NULL )
{
- msg_Err( p_intf, "Cannot initialize VLCProc" );
+ msg_Err( p_intf, "cannot initialize VLCProc" );
+ vlc_object_release( p_intf->p_sys->p_playlist );
+ msg_Unsubscribe( p_intf, p_intf->p_sys->p_sub );
return VLC_EGENERIC;
}
Dialogs::instance( p_intf );
+ ThemeRepository::instance( p_intf );
// We support play on start
p_intf->b_play = VLC_TRUE;
// Destroy "singleton" objects
OSFactory::instance( p_intf )->destroyOSLoop();
+ ThemeRepository::destroy( p_intf );
Dialogs::destroy( p_intf );
Interpreter::destroy( p_intf );
AsyncQueue::destroy( p_intf );
vlc_object_release( p_intf->p_sys->p_playlist );
}
- // Unsubscribe from messages bank
+ // Unsubscribe from messages bank
msg_Unsubscribe( p_intf, p_intf->p_sys->p_sub );
// Destroy structure
list<string>::const_iterator it;
for( it = resPath.begin(); it != resPath.end(); it++ )
{
- string path = (*it) + sep + "default" + sep + "theme.xml";
+ string path = (*it) + sep + "default.vlt";
if( pLoader->load( path ) )
{
// Theme loaded successfully
if( it == resPath.end() )
{
// Last chance: the user can select a new theme file
- Dialogs *pDialogs = Dialogs::instance( p_intf );
- if( pDialogs )
+ if( Dialogs::instance( p_intf ) )
{
- pDialogs->showChangeSkin();
+ CmdDlgChangeSkin *pCmd = new CmdDlgChangeSkin( p_intf );
+ AsyncQueue *pQueue = AsyncQueue::instance( p_intf );
+ pQueue->push( CmdGenericPtr( pCmd ) );
}
else
{
AsyncQueue *pQueue = AsyncQueue::instance( p_intf );
pQueue->push( CmdGenericPtr( pCmd ) );
msg_Err( p_intf,
- "Cannot show the \"open skin\" dialog: exiting...");
+ "cannot show the \"open skin\" dialog: exiting...");
}
}
}
FIND_ANYWHERE );
if( p_playlist )
{
- playlist_Play( p_playlist );
+ playlist_LockControl( p_playlist, PLAYLIST_AUTOPLAY );
vlc_object_release( p_playlist );
}
}
p_demux->pf_demux = Demux;
p_demux->pf_control = DemuxControl;
- // Test that we have a valid .tar.gz file, based on the extension
+ // Test that we have a valid .vlt or .wsz file, based on the extension
// TODO: an actual check of the contents would be better...
- if( ( ext = strchr( p_demux->psz_path, '.' ) ) == NULL )
+ if( ( ext = strchr( p_demux->psz_path, '.' ) ) == NULL ||
+ ( strcasecmp( ext, ".vlt" ) && strcasecmp( ext, ".wsz" ) ) )
{
- msg_Warn( p_this, "skins2 module discarded (path=%s)",
- p_demux->psz_path );
- return VLC_EGENERIC;
- }
-
- // Skip '.'
- ext++;
-
- if( strcasecmp( ext, "tar.gz" ) && strcasecmp( ext, "vlt" ) )
- {
- msg_Warn( p_this, "skins2 module discarded (unknown extension '%s')",
- ext );
return VLC_EGENERIC;
}
if( p_intf != NULL )
{
// Do nothing is skins2 is not the main interface
- if( ! strcmp( p_intf->p_module->psz_shortname, "skins2" ) )
+ if( var_Type( p_intf, "skin-to-load" ) == VLC_VAR_STRING )
{
playlist_t *p_playlist =
(playlist_t *) vlc_object_find( p_this, VLC_OBJECT_PLAYLIST,
}
vlc_value_t val;
- val.psz_string = strdup( p_demux->psz_path );
+ val.psz_string = p_demux->psz_path;
var_Set( p_intf, "skin-to-load", val );
}
else
msg_Warn( p_this,
"skin could not be loaded (not using skins2 intf)" );
}
+
vlc_object_release( p_intf );
}
//---------------------------------------------------------------------------
// Module descriptor
//---------------------------------------------------------------------------
-#define SKINS2_LAST N_("Last skin used")
-#define SKINS2_LAST_LONG N_("Select the path to the last skin used.")
+#define SKINS2_LAST N_("Skin to use")
+#define SKINS2_LAST_LONG N_("Path to the skin to use.")
#define SKINS2_CONFIG N_("Config of last used skin")
-#define SKINS2_CONFIG_LONG N_("Config of last used skin.")
+#define SKINS2_CONFIG_LONG N_("Windows configuration of the last used. " \
+ "This option is updated automatically by the skins module." )
+
#define SKINS2_TRANSPARENCY N_("Enable transparency effects")
#define SKINS2_TRANSPARENCY_LONG N_("You can disable all transparency effects"\
" if you want. This is mainly useful when moving windows does not behave" \
" correctly.")
vlc_module_begin();
+ set_category( CAT_INTERFACE );
+ set_subcategory( SUBCAT_INTERFACE_MAIN );
add_string( "skins2-last", "", NULL, SKINS2_LAST, SKINS2_LAST_LONG,
VLC_TRUE );
+ change_autosave();
add_string( "skins2-config", "", NULL, SKINS2_CONFIG, SKINS2_CONFIG_LONG,
VLC_TRUE );
+ change_autosave();
#ifdef WIN32
add_bool( "skins2-transparency", VLC_FALSE, NULL, SKINS2_TRANSPARENCY,
SKINS2_TRANSPARENCY_LONG, VLC_FALSE );
#endif
+ set_shortname( _("Skins"));
set_description( _("Skinnable Interface") );
set_capability( "interface", 30 );
set_callbacks( Open, Close );
+ add_shortcut( "skins" );
set_program( "svlc" );
add_submodule();