Changeset 164278c36c18a1b5bc26cbdd4df929f80627b320
- Timestamp:
- 26/01/04 00:04:06 (5 years ago)
- git-parent:
- Files:
-
- modules/gui/skins2/parser/xmlparser.cpp (modified) (7 diffs)
- modules/gui/skins2/src/skin_main.cpp (modified) (6 diffs)
- modules/gui/skins2/src/theme.cpp (modified) (5 diffs)
- modules/gui/skins2/src/theme.hpp (modified) (2 diffs)
- modules/gui/skins2/src/theme_loader.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
modules/gui/skins2/parser/xmlparser.cpp
r1628f2f r164278c 3 3 ***************************************************************************** 4 4 * Copyright (C) 2004 VideoLAN 5 * $Id: xmlparser.cpp,v 1. 3 2004/01/25 11:44:19asmax Exp $5 * $Id: xmlparser.cpp,v 1.4 2004/01/25 23:04:01 asmax Exp $ 6 6 * 7 7 * Authors: Cyril Deguet <asmax@via.ecp.fr> … … 32 32 msg_Err( getIntf(), "Failed to open %s for parsing", 33 33 rFileName.c_str() ); 34 return; 34 35 } 35 36 … … 56 57 if( !m_pReader ) 57 58 { 58 return -1;59 return false; 59 60 } 60 61 … … 70 71 // Error 71 72 case -1: 72 return -1;73 return false; 73 74 break; 74 75 … … 80 81 if( !eltName ) 81 82 { 82 return -1;83 return false; 83 84 } 84 85 // Read the attributes … … 90 91 if( !name || !value ) 91 92 { 92 return -1;93 return false; 93 94 } 94 95 attributes[(const char*)name] = (const char*)value; … … 104 105 if( !eltName ) 105 106 { 106 return -1;107 return false; 107 108 } 108 109 handleEndElement( (const char*)eltName ); modules/gui/skins2/src/skin_main.cpp
r82a6766 r164278c 3 3 ***************************************************************************** 4 4 * Copyright (C) 2003 VideoLAN 5 * $Id: skin_main.cpp,v 1. 4 2004/01/25 17:20:19 kuehneExp $5 * $Id: skin_main.cpp,v 1.5 2004/01/25 23:04:06 asmax Exp $ 6 6 * 7 7 * Authors: Cyril Deguet <asmax@via.ecp.fr> … … 24 24 25 25 #include <stdlib.h> 26 #include "generic_window.hpp"27 26 #include "dialogs.hpp" 28 27 #include "os_factory.hpp" 29 28 #include "os_loop.hpp" 30 #include "window_manager.hpp"31 29 #include "var_manager.hpp" 32 30 #include "vlcproc.hpp" 31 #include "theme_loader.hpp" 33 32 #include "theme.hpp" 34 #include "theme_loader.hpp"35 33 #include "../parser/interpreter.hpp" 36 34 #include "../commands/async_queue.hpp" 35 #include "../commands/cmd_quit.hpp" 37 36 38 37 … … 168 167 // Load a theme 169 168 ThemeLoader *pLoader = new ThemeLoader( p_intf ); 170 char *skin_last = config_GetPsz( p_intf, "skin_last 2" );169 char *skin_last = config_GetPsz( p_intf, "skin_last" ); 171 170 172 171 if( skin_last == NULL || !pLoader->load( skin_last ) ) … … 187 186 // Last chance: the user can select a new theme file (blocking call) 188 187 Dialogs *pDialogs = Dialogs::instance( p_intf ); 189 pDialogs->showChangeSkin(); 188 if( pDialogs ) 189 { 190 pDialogs->showChangeSkin(); 191 } 192 else 193 { 194 // No dialogs provider, just quit... 195 CmdQuit *pCmd = new CmdQuit( p_intf ); 196 AsyncQueue *pQueue = AsyncQueue::instance( p_intf ); 197 pQueue->push( CmdGenericPtr( pCmd ) ); 198 msg_Err( p_intf, "Cannot show the \"open skin\" dialog: exiting..."); 199 } 190 200 } 191 201 } … … 199 209 // Get the instance of OSLoop 200 210 OSLoop *loop = OSFactory::instance( p_intf )->getOSLoop(); 211 212 // Enter the main event loop 201 213 loop->run(); 202 214 … … 214 226 #define DEFAULT_SKIN N_("Last skin used") 215 227 #define DEFAULT_SKIN_LONG N_("Select the path to the last skin used.") 228 #define SKIN_CONFIG N_("Config of last used skin") 229 #define SKIN_CONFIG_LONG N_("Config of last used skin.") 216 230 217 231 vlc_module_begin(); 218 // XXX 219 add_string( "skin_last2", "", NULL, DEFAULT_SKIN, DEFAULT_SKIN_LONG, 232 add_string( "skin_last", "", NULL, DEFAULT_SKIN, DEFAULT_SKIN_LONG, 233 VLC_TRUE ); 234 add_string( "skin_config", "", NULL, SKIN_CONFIG, SKIN_CONFIG_LONG, 220 235 VLC_TRUE ); 221 236 set_description( _("Skinnable Interface") ); modules/gui/skins2/src/theme.cpp
rb7dc5e8 r164278c 3 3 ***************************************************************************** 4 4 * Copyright (C) 2003 VideoLAN 5 * $Id: theme.cpp,v 1. 1 2004/01/03 23:31:34asmax Exp $5 * $Id: theme.cpp,v 1.2 2004/01/25 23:04:06 asmax Exp $ 6 6 * 7 7 * Authors: Cyril Deguet <asmax@via.ecp.fr> … … 28 28 Theme::~Theme() 29 29 { 30 saveConfig(); 31 30 32 // Be sure things are destroyed in the right order (XXX check) 31 33 m_layouts.clear(); … … 36 38 m_commands.clear(); 37 39 m_vars.clear(); 40 } 41 42 43 void Theme::loadConfig() 44 { 45 msg_Dbg( getIntf(), "Loading theme configuration"); 46 47 // Get config from vlcrc file 48 char *save = config_GetPsz( getIntf(), "skin_config" ); 49 if( save == NULL ) 50 return; 51 52 // Initialization 53 map<string, GenericWindowPtr>::const_iterator it; 54 int i = 0; 55 int x, y, v, scan; 56 57 // Get config for each window 58 for( it = m_windows.begin(); it != m_windows.end(); it++ ) 59 { 60 GenericWindow *pWin = (*it).second.get(); 61 // Get config 62 scan = sscanf( &save[i * 13], "(%4d,%4d,%1d)", &x, &y, &v ); 63 64 // If config has the correct number of arguments 65 if( scan > 2 ) 66 { 67 pWin->move( x, y ); 68 if( v ) pWin->show(); 69 } 70 71 // Next window 72 i++; 73 } 74 } 75 76 77 void Theme::saveConfig() 78 { 79 msg_Dbg( getIntf(), "Saving theme configuration"); 80 81 // Initialize char where config is stored 82 char *save = new char[400]; 83 map<string, GenericWindowPtr>::const_iterator it; 84 int i = 0; 85 int x, y; 86 87 // Save config of every window 88 for( it = m_windows.begin(); it != m_windows.end(); it++ ) 89 { 90 GenericWindow *pWin = (*it).second.get(); 91 // Print config 92 x = pWin->getLeft(); 93 y = pWin->getTop(); 94 sprintf( &save[i * 13], "(%4d,%4d,%1d)", x, y, 95 pWin->getVisibleVar().get() ); 96 i++; 97 } 98 99 // Save config to file 100 config_PutPsz( getIntf(), "skin_config", save ); 101 config_SaveConfigFile( getIntf(), "skins" ); 102 103 // Free memory 104 delete[] save; 38 105 } 39 106 … … 48 115 } \ 49 116 return (*it).second.get(); 50 51 117 52 118 GenericBitmap *Theme::getBitmapById( const string &id ) … … 75 141 } 76 142 143 144 modules/gui/skins2/src/theme.hpp
rb7dc5e8 r164278c 3 3 ***************************************************************************** 4 4 * Copyright (C) 2003 VideoLAN 5 * $Id: theme.hpp,v 1. 1 2004/01/03 23:31:34asmax Exp $5 * $Id: theme.hpp,v 1.2 2004/01/25 23:04:06 asmax Exp $ 6 6 * 7 7 * Authors: Cyril Deguet <asmax@via.ecp.fr> … … 47 47 virtual ~Theme(); 48 48 49 void loadConfig(); 50 void saveConfig(); 51 49 52 GenericBitmap *getBitmapById( const string &id ); 50 53 GenericFont *getFontById( const string &id ); modules/gui/skins2/src/theme_loader.cpp
r1628f2f r164278c 3 3 ***************************************************************************** 4 4 * Copyright (C) 2003 VideoLAN 5 * $Id: theme_loader.cpp,v 1. 7 2004/01/25 11:44:19asmax Exp $5 * $Id: theme_loader.cpp,v 1.8 2004/01/25 23:04:06 asmax Exp $ 6 6 * 7 7 * Authors: Cyril Deguet <asmax@via.ecp.fr> … … 67 67 #endif 68 68 69 #if 0 69 Theme *pNewTheme = getIntf()->p_sys->p_theme; 70 if( !pNewTheme ) 71 { 72 return false; 73 } 74 70 75 // Check if the skin to load is in the config file, to load its config 71 76 char *skin_last = config_GetPsz( getIntf(), "skin_last" ); 72 77 if( skin_last != NULL && fileName == (string)skin_last ) 73 78 { 74 getIntf()->p_sys->p_theme->LoadConfig();75 }76 else77 {78 config_PutPsz( getIntf(), "skin_last", fileName.c_str() );79 config_SaveConfigFile( getIntf(), "skins" );80 }81 #endif82 Theme *pNewTheme = getIntf()->p_sys->p_theme;83 if( pNewTheme )84 {85 79 // Used to anchor the windows at the beginning 86 80 pNewTheme->getWindowManager().stopMove(); 81 // Restore the theme configuration 82 getIntf()->p_sys->p_theme->loadConfig(); 83 } 84 else 85 { 86 config_PutPsz( getIntf(), "skin_last", fileName.c_str() ); 87 87 // Show the windows 88 88 pNewTheme->getWindowManager().showAll();
