Custom resolution: Added custom resolution in CLI.
authorminkee.lee <minkee.lee@samsung.com>
Mon, 23 Mar 2015 05:19:00 +0000 (14:19 +0900)
committerminkee.lee <minkee.lee@samsung.com>
Mon, 23 Mar 2015 05:34:56 +0000 (14:34 +0900)
- You can see guide in help content.
  (./em-cli -h create, ./em-cli -h modify)

Change-Id: I4f9668f9cc20b9b813b05fee57bc7da5fb9a6864
Signed-off-by: minkee.lee <minkee.lee@samsung.com>
common-project/src/org/tizen/emulator/manager/console/ActionList.java
common-project/src/org/tizen/emulator/manager/console/ConsoleCreateVM.java

index f0a65d8..81b2bdd 100644 (file)
@@ -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));
index de6e571..5e3ab4d 100644 (file)
@@ -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.");
        }