From: giwoong.kim Date: Thu, 25 Oct 2012 03:09:26 +0000 (+0900) Subject: skin: set default skin path in general skin mode X-Git-Tag: Tizen_Studio_1.3_Release_p2.3.1~1409^2~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a5a729a24406b1498b517116a06239023ff18ef6;p=sdk%2Femulator%2Fqemu.git skin: set default skin path in general skin mode I added general skin dbi file. And modified skin mode name. (default -> standard) Signed-off-by: GiWoong Kim --- diff --git a/tizen/src/skin/client/skins/emul-general/default.dbi b/tizen/src/skin/client/skins/emul-general/default.dbi new file mode 100644 index 0000000000..f034072d86 --- /dev/null +++ b/tizen/src/skin/client/skins/emul-general/default.dbi @@ -0,0 +1,181 @@ + + + + + + + + + + default_0.png + default_0_p.png + + + + + + 101 + HOME + + Home + + + + + 103 + POWER + + Power + + + + + 115 + VOLUME UP + + Volume-up + + + + + 114 + VOLUME DOWN + + Volume-down + + + + + + + + + default_L90.png + default_L90_p.png + + + + + + 101 + HOME + + Home + + + + + 103 + POWER + + Power + + + + + 115 + VOLUME UP + + Volume-up + + + + + 114 + + + Volume-down + + + + + + + + + default_180.png + default_180_p.png + + + + + + 101 + HOME + + Home + + + + + 103 + POWER + + Power + + + + + 115 + VOLUME UP + + Volume-up + + + + + 114 + VOLUME DOWN + + Volume-down + + + + + + + + + default_R90.png + default_R90_p.png + + + + + + 101 + HOME + + Home + + + + + 103 + POWER + + Power + + + + + 115 + VOLUME UP + + Volume-up + + + + + 114 + VOLUME DOWN + + Volume-down + + + + + + + + diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkin.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkin.java index b3fc36e3f5..b183fe43d4 100644 --- a/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkin.java +++ b/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkin.java @@ -2079,7 +2079,7 @@ public class EmulatorSkin { final Menu menu = new Menu(shell, SWT.DROP_DOWN); /* Control Panel menu */ - /*final MenuItem panelItem = new MenuItem(menu, SWT.PUSH); + final MenuItem panelItem = new MenuItem(menu, SWT.PUSH); panelItem.setText("&Control Panel"); //panelItem.setImage(imageRegistry.getIcon(IconName.XXX)); panelItem.addSelectionListener(new SelectionAdapter() { @@ -2102,7 +2102,7 @@ public class EmulatorSkin { controlPanel = null; } } - } );*/ + } ); /* Screen shot menu */ final MenuItem screenshotItem = new MenuItem(menu, SWT.PUSH); diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkinMain.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkinMain.java index b4c3a7b562..3b40175e42 100644 --- a/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkinMain.java +++ b/tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkinMain.java @@ -123,24 +123,31 @@ public class EmulatorSkinMain { /* set emulator window config property */ String configPropFilePath = vmPath + File.separator + CONFIG_PROPERTIES_FILE_NAME; - Properties configProperties = loadProperties( configPropFilePath, false ); + Properties configProperties = loadProperties(configPropFilePath, false); - // able to use log file after loading properties - initLog( argsMap, configProperties ); + /* able to use log file after loading properties */ + initLog(argsMap, configProperties); - EmulatorConfig.validateArgs( argsMap ); - EmulatorConfig.validateSkinProperties( skinProperties ); - EmulatorConfig.validateSkinConfigProperties( configProperties ); + /* validation check */ + EmulatorConfig.validateArgs(argsMap); + EmulatorConfig.validateSkinProperties(skinProperties); + EmulatorConfig.validateSkinConfigProperties(configProperties); + /* emulator resolution */ int resolutionW = Integer.parseInt( argsMap.get(ArgsConstants.RESOLUTION_WIDTH)); int resolutionH = Integer.parseInt( argsMap.get(ArgsConstants.RESOLUTION_HEIGHT)); + /* get skin path from startup argument */ String argSkinPath = (String) argsMap.get(ArgsConstants.SKIN_PATH); + /* determine skin mode */ + SkinMode skinMode = SkinMode.getValue(argsMap.get(ArgsConstants.SKIN_MODE)); + logger.info("skin mode is " + skinMode); + /* load dbi file */ - EmulatorUI dbiContents = loadDbi(argSkinPath, resolutionW, resolutionH); + EmulatorUI dbiContents = loadDbi(argSkinPath, skinMode, resolutionW, resolutionH); if ( null == dbiContents ) { logger.severe( "Fail to load dbi file." ); @@ -162,14 +169,11 @@ public class EmulatorSkinMain { /* load image resource */ ImageRegistry.getInstance().initialize(config); + /* load Always on Top value */ String onTopVal = config.getSkinProperty( SkinPropertiesConstants.WINDOW_ONTOP, Boolean.FALSE.toString()); boolean isOnTop = Boolean.parseBoolean(onTopVal); - /* determine skin mode */ - SkinMode skinMode = SkinMode.getValue(argsMap.get(ArgsConstants.SKIN_MODE)); - logger.info("skin mode is " + skinMode); - /* create skin */ EmulatorSkin skin; if (SwtUtil.isMacPlatform()) { @@ -341,10 +345,12 @@ public class EmulatorSkinMain { } - private static EmulatorUI loadDbi(String argSkinPath, int resolutionW, int resolutionH) { + private static EmulatorUI loadDbi(String argSkinPath, SkinMode skinMode, + int resolutionW, int resolutionH) { String skinPath = - ImageRegistry.getSkinPath(argSkinPath, resolutionW, resolutionH) + + ImageRegistry.getSkinPath(argSkinPath, skinMode, resolutionW, resolutionH) + File.separator + DBI_FILE_NAME; + logger.info("load dbi file from " + skinPath); FileInputStream fis = null; EmulatorUI emulatorUI = null; diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/image/ImageRegistry.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/image/ImageRegistry.java index 75d058aa1a..d7b437d622 100644 --- a/tizen/src/skin/client/src/org/tizen/emulator/skin/image/ImageRegistry.java +++ b/tizen/src/skin/client/src/org/tizen/emulator/skin/image/ImageRegistry.java @@ -48,6 +48,7 @@ import org.tizen.emulator.skin.dbi.ImageListType; import org.tizen.emulator.skin.dbi.RotationType; import org.tizen.emulator.skin.dbi.RotationsType; import org.tizen.emulator.skin.log.SkinLogger; +import org.tizen.emulator.skin.mode.SkinMode; import org.tizen.emulator.skin.util.IOUtil; import org.tizen.emulator.skin.util.SkinRotation; @@ -135,12 +136,12 @@ public class ImageRegistry { this.display = Display.getDefault(); - int lcdWidth = config.getArgInt( ArgsConstants.RESOLUTION_WIDTH ); - int lcdHeight = config.getArgInt( ArgsConstants.RESOLUTION_HEIGHT ); - this.argSkinPath = config.getArg( ArgsConstants.SKIN_PATH ); + int resolutionW = config.getArgInt(ArgsConstants.RESOLUTION_WIDTH); + int resolutionH = config.getArgInt(ArgsConstants.RESOLUTION_HEIGHT); + this.argSkinPath = config.getArg(ArgsConstants.SKIN_PATH); - this.resolutionWidth = lcdWidth; - this.resolutionHeight = lcdHeight; + this.resolutionWidth = resolutionW; + this.resolutionHeight = resolutionH; this.dbiContents = config.getDbiContents(); this.skinImageMap = new HashMap(); this.iconMap = new HashMap(); @@ -149,17 +150,23 @@ public class ImageRegistry { } - 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; + public static String getSkinPath(String argSkinPath, SkinMode skinMode, + int resolutionX, int resolutionY) { + /* When emulator has a invalid skin path, + emulator uses default skin path instead of it */ + String defaultSkinPath = + ".." + File.separator + SKIN_FOLDER + File.separator + + ((skinMode == SkinMode.GENERAL) ? + "emul-general" : + IMAGE_FOLDER_PREFIX + resolutionX + "x" + resolutionY); + + if (argSkinPath == null) { + return defaultSkinPath; } - File f = new File( argSkinPath ); - if ( f.isDirectory() == false ) { - return skinPath; + File f = new File(argSkinPath); + if (f.isDirectory() == false) { + return defaultSkinPath; } return argSkinPath; @@ -199,7 +206,8 @@ public class ImageRegistry { return null; } - String skinPath = getSkinPath( argSkinPath, resolutionWidth, resolutionHeight ); + String skinPath = getSkinPath(argSkinPath, null, resolutionWidth, resolutionHeight); + logger.info("get image data of skin from " + skinPath); RotationType targetRotation = SkinRotation.getRotation( id ); diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/mode/SkinMode.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/mode/SkinMode.java index 7e3a376e3c..a9dc104ef4 100644 --- a/tizen/src/skin/client/src/org/tizen/emulator/skin/mode/SkinMode.java +++ b/tizen/src/skin/client/src/org/tizen/emulator/skin/mode/SkinMode.java @@ -34,7 +34,7 @@ package org.tizen.emulator.skin.mode; public enum SkinMode { GENERAL("general"), FULLSCREEN("fullscreen"), /* not used yet */ - DEFAULT("default"), + STANDARD("standard"), CUSTOM("custom"); /* not used yet */ private String value; @@ -55,7 +55,7 @@ public enum SkinMode { } } - return SkinMode.DEFAULT; + return SkinMode.STANDARD; } } diff --git a/tizen/src/skin/client/src/org/tizen/emulator/skin/util/SkinUtil.java b/tizen/src/skin/client/src/org/tizen/emulator/skin/util/SkinUtil.java index 6fad927b74..91d0624c0b 100644 --- a/tizen/src/skin/client/src/org/tizen/emulator/skin/util/SkinUtil.java +++ b/tizen/src/skin/client/src/org/tizen/emulator/skin/util/SkinUtil.java @@ -117,13 +117,22 @@ public class SkinUtil { float convertedScale = convertScale(scale); if (mode == SkinMode.GENERAL) { - lcdCanvas.setBounds(0, 0, - (int)(resolutionW * convertedScale), - (int)(resolutionH * convertedScale)); + /* resoultion, that is lcd size in general skin mode */ + if (RotationInfo.LANDSCAPE == RotationInfo.getValue(rotationId) || + RotationInfo.REVERSE_LANDSCAPE == RotationInfo.getValue(rotationId)) { + lcdCanvas.setBounds(0, 0, + (int)(resolutionH * convertedScale), + (int)(resolutionW * convertedScale)); + } else { + lcdCanvas.setBounds(0, 0, + (int)(resolutionW * convertedScale), + (int)(resolutionH * convertedScale)); + } + return; } - LcdType lcd = rotation.getLcd(); + LcdType lcd = rotation.getLcd(); /* from dbi */ RegionType region = lcd.getRegion(); Integer left = region.getLeft();