Main Page | Modules | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

cmd_change_skin.cpp

00001 /*****************************************************************************
00002  * cmd_change_skin.cpp
00003  *****************************************************************************
00004  * Copyright (C) 2003 the VideoLAN team
00005  * $Id: cmd_change_skin.cpp 11664 2005-07-09 06:17:09Z courmisch $
00006  *
00007  * Authors: Cyril Deguet     <[email protected]>
00008  *          Olivier Teulière <[email protected]>
00009  *
00010  * This program is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2 of the License, or
00013  * (at your option) any later version.
00014  *
00015  * This program is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018  * GNU General Public License for more details.
00019  *
00020  * You should have received a copy of the GNU General Public License
00021  * along with this program; if not, write to the Free Software
00022  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
00023  *****************************************************************************/
00024 
00025 #include "cmd_change_skin.hpp"
00026 #include "cmd_quit.hpp"
00027 #include "../src/os_factory.hpp"
00028 #include "../src/os_loop.hpp"
00029 #include "../src/theme.hpp"
00030 #include "../src/theme_loader.hpp"
00031 #include "../src/window_manager.hpp"
00032 
00033 
00034 void CmdChangeSkin::execute()
00035 {
00036     // Save the old theme to restore it in case of problem
00037     Theme *pOldTheme = getIntf()->p_sys->p_theme;
00038 
00039     if( pOldTheme )
00040     {
00041         pOldTheme->getWindowManager().hideAll();
00042     }
00043 
00044     ThemeLoader loader( getIntf() );
00045     if( loader.load( m_file ) )
00046     {
00047         // Everything went well
00048         msg_Dbg( getIntf(), "New theme successfully loaded (%s)",
00049                  m_file.c_str() );
00050         if( pOldTheme )
00051         {
00052             delete pOldTheme;
00053         }
00054     }
00055     else if( pOldTheme )
00056     {
00057         msg_Err( getIntf(), "A problem occurred when loading the new theme,"
00058                   " restoring the previous one" );
00059         getIntf()->p_sys->p_theme = pOldTheme;
00060         pOldTheme->getWindowManager().showAll();
00061     }
00062     else
00063     {
00064         msg_Err( getIntf(), "Cannot load the theme, aborting" );
00065         // Quit
00066         CmdQuit cmd( getIntf() );
00067         cmd.execute();
00068     }
00069 }
00070 

Generated on Tue Dec 20 10:14:41 2005 for vlc-0.8.4a by  doxygen 1.4.2