From cfb7b4b802412957f4fd45adb8965ec5b9a03de4 Mon Sep 17 00:00:00 2001 From: "minkee.lee" Date: Mon, 23 Mar 2015 14:19:00 +0900 Subject: [PATCH] Custom resolution: Added custom resolution in CLI. - You can see guide in help content. (./em-cli -h create, ./em-cli -h modify) Change-Id: I4f9668f9cc20b9b813b05fee57bc7da5fb9a6864 Signed-off-by: minkee.lee --- .../org/tizen/emulator/manager/console/ActionList.java | 8 ++++++-- .../tizen/emulator/manager/console/ConsoleCreateVM.java | 16 ++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/common-project/src/org/tizen/emulator/manager/console/ActionList.java b/common-project/src/org/tizen/emulator/manager/console/ActionList.java index f0a65d8..81b2bdd 100644 --- a/common-project/src/org/tizen/emulator/manager/console/ActionList.java +++ b/common-project/src/org/tizen/emulator/manager/console/ActionList.java @@ -409,7 +409,9 @@ class Create extends Action { } resolution = resolution.substring(0, resolution.length() - 3); commandList.add(new Command("r", Actions.OP_RESOLUTION, - "Resolution of vm. (" + resolution + ")" + "Resolution of vm. (" + resolution + ")" + StringResources.NEW_LINE + + "\t\t(Custom resolution is supported as experimental feature." + + " Range is from 320 to 1920)." , RESOLUTION.HD.getType(), false, true)); commandList.add(new Command("d", Actions.OP_DPI, "DPI. (100 ~ 480)", Integer.toString(RESOLUTION.HD.getDPI()), false, true)); @@ -566,7 +568,9 @@ class Modify extends Action { } resolution = resolution.substring(0, resolution.length() - 3); commandList.add(new Command("r", Actions.OP_RESOLUTION, - "Resolution of vm. (" + resolution + ")" + "Resolution of vm. (" + resolution + ")" + StringResources.NEW_LINE + + "\t\t(Custom resolution is supported as experimental feature." + + " Range is from 320 to 1920)." , RESOLUTION.HD.getType(), false, true)); commandList.add(new Command("d", Actions.OP_DPI, "DPI. (100 ~ 480)", Integer.toString(RESOLUTION.HD.getDPI()), false, true)); diff --git a/common-project/src/org/tizen/emulator/manager/console/ConsoleCreateVM.java b/common-project/src/org/tizen/emulator/manager/console/ConsoleCreateVM.java index de6e571..5e3ab4d 100644 --- a/common-project/src/org/tizen/emulator/manager/console/ConsoleCreateVM.java +++ b/common-project/src/org/tizen/emulator/manager/console/ConsoleCreateVM.java @@ -33,6 +33,7 @@ import java.io.File; import java.io.IOException; import java.util.ArrayList; +import org.tizen.emulator.manager.logging.EMLogger; import org.tizen.emulator.manager.platform.BaseImage; import org.tizen.emulator.manager.platform.CustomPlatform; import org.tizen.emulator.manager.platform.Platform; @@ -510,6 +511,21 @@ public class ConsoleCreateVM { return r; } } + // Check custom resolution. + String[] arr = value.toLowerCase().split("x"); + if (arr != null && arr.length == 2) { + try { + int width = Integer.parseInt(arr[0]); + int height = Integer.parseInt(arr[1]); + int dpi = 316; // TODO + if ( (width >= 320 && width <= 1920) + && (height >= 320 && height <= 1920)) { + return new RESOLUTION(width, height, "", dpi); + } + } catch (NumberFormatException e) { + EMLogger.getLogger().warning(e.getMessage()); + } + } throw new ConsoleException("This " + Actions.OP_RESOLUTION + " (" + value + ") is not avaliable."); } -- 2.7.4