[Title] parse skin.path argument
authorgiwoong.kim <giwoong.kim@samsung.com>
Mon, 26 Mar 2012 13:26:02 +0000 (22:26 +0900)
committergiwoong.kim <giwoong.kim@samsung.com>
Mon, 26 Mar 2012 13:26:02 +0000 (22:26 +0900)
[Type]
[Module] Emulator
[Priority]
[Jira#]
[Redmine#]
[Problem]
[Cause]
[Solution]
[TestCase]

tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkinMain.java
tizen/src/skin/client/src/org/tizen/emulator/skin/config/EmulatorConfig.java
tizen/src/skin/client/src/org/tizen/emulator/skin/image/ImageRegistry.java

index c8a2492..d78358a 100644 (file)
@@ -75,7 +75,8 @@ public class EmulatorSkinMain {
 
                        int lcdWidth = Integer.parseInt( argsMap.get( ArgsConstants.RESOLUTION_WIDTH ) );
                        int lcdHeight = Integer.parseInt( argsMap.get( ArgsConstants.RESOLUTION_HEIGHT ) );
-                       EmulatorUI dbiContents = loadDbi( lcdWidth, lcdHeight );
+                       String argSkinPath = (String) argsMap.get( ArgsConstants.SKIN_PATH );
+                       EmulatorUI dbiContents = loadDbi( argSkinPath, lcdWidth, lcdHeight );
                        if ( null == dbiContents ) {
                                logger.severe( "Fail to load dbi file." );
                                return;
@@ -196,9 +197,9 @@ public class EmulatorSkinMain {
 
        }
 
-       private static EmulatorUI loadDbi( int lcdWidth, int lcdHeight ) {
+       private static EmulatorUI loadDbi( String argSkinPath, int lcdWidth, int lcdHeight ) {
 
-               String skinPath = ImageRegistry.getSkinPath( lcdWidth, lcdHeight ) + File.separator + DBI_FILE_NAME;
+               String skinPath = ImageRegistry.getSkinPath( argSkinPath, lcdWidth, lcdHeight ) + File.separator + DBI_FILE_NAME;
 
                FileInputStream fis = null;
                EmulatorUI emulatorUI = null;
index d810498..96aa9a4 100644 (file)
@@ -60,8 +60,9 @@ public class EmulatorConfig {
                public static final String VM_PATH = "vm.path";
                public static final String LOG_LEVEL = "log.level";
                public static final String NET_BASE_PORT = "net.baseport";
+               public static final String SKIN_PATH = "skin.path";
        }
-       
+
        public interface PropertiesConstants {
                public static final String WINDOW_X = "window.x";
                public static final String WINDOW_Y = "window.y";
index 04209e1..07a71fa 100644 (file)
@@ -111,6 +111,7 @@ public class ImageRegistry {
                
                int lcdWidth = Integer.parseInt( config.getArg( ArgsConstants.RESOLUTION_WIDTH ) );
                int lcdHeight = Integer.parseInt( config.getArg( ArgsConstants.RESOLUTION_HEIGHT ) );
+               String skinPath = (String) config.getArg( ArgsConstants.SKIN_PATH );
 
                this.resolutionWidth = lcdWidth;
                this.resolutionHeight = lcdHeight;
@@ -118,18 +119,25 @@ public class ImageRegistry {
                this.skinImageMap = new HashMap<String, Image>();
                this.iconMap = new HashMap<String, Image>();
                
-               init();
+               init(skinPath);
                
        }
        
-       public static String getSkinPath( int lcdWidth, int lcdHeight ) {
-               String skinPath = ".." + File.separator + SKIN_FOLDER + File.separator + IMAGE_FOLDER_PREFIX + lcdWidth + "x" + lcdHeight;
-               return skinPath;
+       public static String getSkinPath( String argSkinPath, int lcdWidth, int lcdHeight ) {
+               String skinPath = null;
+
+               File f = new File(argSkinPath);
+               if (argSkinPath == null || f.isDirectory() == false) {
+                       skinPath = ".." + File.separator + SKIN_FOLDER + File.separator + IMAGE_FOLDER_PREFIX + lcdWidth + "x" + lcdHeight;
+                       return skinPath;
+               }
+
+               return argSkinPath;
        }
 
-       private void init() {
+       private void init(String argSkinPath) {
 
-               String skinPath = getSkinPath( resolutionWidth, resolutionHeight );
+               String skinPath = getSkinPath( argSkinPath, resolutionWidth, resolutionHeight );
                
                RotationsType rotations = dbiContents.getRotations();
                List<RotationType> rotationList = rotations.getRotation();