[Title] merge supporting 3 keys from release-pre1.0, change default scaling to 1/2x
authorSon Hyunjun <hj79.son@samsung.com>
Mon, 26 Mar 2012 17:03:12 +0000 (02:03 +0900)
committerSon Hyunjun <hj79.son@samsung.com>
Mon, 26 Mar 2012 17:03:12 +0000 (02:03 +0900)
[Type] Feature
[Module]
[Priority] Minor
[CQ#]
[Redmine#]
[Problem]
[Cause]
[Solution]

Change-Id: I3dc69745dcb4e9b2800b9691830cbc919bc2099d

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
tizen/src/skin/client/src/org/tizen/emulator/skin/util/SkinUtil.java

index 9087bcedca83fd5ae2189877c10ef18df3df8aee..d558dd962bb218c35bbd6046242e9ccd5c987dac 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;
@@ -147,7 +148,7 @@ public class EmulatorSkinMain {
                        
                }
 
-               SkinLogLevel skinLogLevel = SkinLogLevel.TRACE;
+               SkinLogLevel skinLogLevel = SkinLogLevel.DEBUG;
                
                if( !StringUtil.isEmpty( logLevel ) ) {
                        
@@ -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;
@@ -256,4 +257,4 @@ public class EmulatorSkinMain {
 
        }
 
-}
\ No newline at end of file
+}
index d8104982803c08bdca8f8c6e252db09417ab75c8..96aa9a47a72592c094d10a4005a30dfc157736ca 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 04209e12879e57eb1f4f0f6bb829001985ed64a9..b87e2e4d2586bcada95b2ed488a81824ae454c18 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,29 @@ 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 = ".." + File.separator + SKIN_FOLDER + File.separator +
+                               IMAGE_FOLDER_PREFIX + lcdWidth + "x" + lcdHeight;
+
+               if (argSkinPath == null) {
+                       return skinPath;
+               }
+
+               File f = new File(argSkinPath);
+               if (f.isDirectory() == false) {
+                       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();
index 847f3941c05830ccb5e217821e60b6fdc8e87754..406f28eef9b449181d2373bf63dabb5f3e8f18bf 100644 (file)
@@ -60,6 +60,7 @@ import org.tizen.emulator.skin.image.ImageRegistry.ImageType;
  */
 public class SkinUtil {
 
+       public static final int DEFAULT_SCALE = 50; // 1/2x
        public static final int SCALE_CONVERTER = 100;
        public static final String EMULATOR_PREFIX = "emulator";
 
@@ -289,27 +290,16 @@ public class SkinUtil {
 
        public static int getValidScale( EmulatorConfig config ) {
 
-               int lcdHeight = Integer.parseInt( config.getArg( ArgsConstants.RESOLUTION_HEIGHT ) );
-               int defaultScale = SkinUtil.getDefaultScale( lcdHeight );
-
-               int storedScale = config.getPropertyInt( PropertiesConstants.WINDOW_SCALE, defaultScale );
+               int storedScale = config.getPropertyInt( PropertiesConstants.WINDOW_SCALE, DEFAULT_SCALE );
                
                if ( !SkinUtil.isValidScale( storedScale ) ) {
-                       return defaultScale;
+                       return DEFAULT_SCALE;
                }else {
                        return storedScale;
                }
                
        }
 
-       public static int getDefaultScale( int lcdHeight ) {
-               int defaultScale = 100;
-               if ( 800 < lcdHeight ) {
-                       defaultScale = 50;
-               }
-               return defaultScale;
-       }
-
        public static boolean isValidScale( int scale ) {
                if ( 100 == scale || 75 == scale || 50 == scale || 25 == scale ) {
                        return true;