From bef139b6fa5bb4be2a9907da3b90b4a27d54f81f Mon Sep 17 00:00:00 2001 From: jihye kim Date: Wed, 31 Oct 2012 11:57:23 +0900 Subject: [PATCH] [Title] emulator-manager : add select skin menu to the CLI [Desc.] add select skin menu to the CLI [Issue] N/A --- package/changelog | 6 ++++ package/pkginfo.manifest | 2 +- src/org/tizen/emulator/manager/console/Action.java | 1 + .../tizen/emulator/manager/console/ActionList.java | 21 +++++++++++ .../emulator/manager/console/ConsoleCreateVM.java | 41 ++++++++++++++++++++++ src/org/tizen/emulator/manager/image/Skins.java | 15 ++++++-- .../emulator/manager/ui/detail/TableWidget.java | 23 ++++++++++-- src/org/tizen/emulator/manager/vms/Creator.java | 6 +++- src/org/tizen/emulator/manager/vms/Modifier.java | 8 +++-- .../emulator/manager/vms/VMPropertyValue.java | 19 +++++++--- 10 files changed, 128 insertions(+), 14 deletions(-) diff --git a/package/changelog b/package/changelog index 4155071..d341f23 100644 --- a/package/changelog +++ b/package/changelog @@ -1,3 +1,9 @@ +*1.3.49 +- add 'select skin path' menu. +- modify console mode. +- add 'Skin' class +== 김지혜 2012-10-31 + *1.3.48 - change multi touch's max point 3->6 - update version diff --git a/package/pkginfo.manifest b/package/pkginfo.manifest index 066240f..1462b84 100644 --- a/package/pkginfo.manifest +++ b/package/pkginfo.manifest @@ -1,5 +1,5 @@ Source: emulator-manager -Version: 1.3.48 +Version: 1.3.49 Maintainer: Yeong-Kyoon Lee Package: emulator-manager diff --git a/src/org/tizen/emulator/manager/console/Action.java b/src/org/tizen/emulator/manager/console/Action.java index 58c09f1..43ec543 100644 --- a/src/org/tizen/emulator/manager/console/Action.java +++ b/src/org/tizen/emulator/manager/console/Action.java @@ -253,6 +253,7 @@ class Actions { public final static String OP_RESOLUTION = "resolution"; public final static String OP_DPI = "dpi"; + public final static String OP_SKIN = "skin"; public final static String OP_KEYTYPE = "key-type"; public final static String OP_RAM = "ram-size"; public final static String OP_FILESHARE = "file-sharing"; diff --git a/src/org/tizen/emulator/manager/console/ActionList.java b/src/org/tizen/emulator/manager/console/ActionList.java index 873eb97..c496815 100644 --- a/src/org/tizen/emulator/manager/console/ActionList.java +++ b/src/org/tizen/emulator/manager/console/ActionList.java @@ -345,6 +345,17 @@ class Create extends Action { , RESOLUTION.HD.getType(), false, true)); commandList.add(new Command("d", Actions.OP_DPI, "DPI. (100 ~ 480)", Integer.toString(property.dpi), false, true)); + + /** TODO : resolution and skin..***********************************************/ + String skinType = ""; + int i = 1; + skinType += Integer.toString(i++) + "(phone_shape_skin) | "; + skinType += Integer.toString(i++) + "(general_purpose_skin)"; + + commandList.add(new Command("k", Actions.OP_SKIN, + "Select skin style (" + skinType + ")", "1", false, true)); + /*****************************************************************************/ + /* commandList.add(new Command("k", Actions.OP_KEYTYPE, "Skin'front button type. (1 | 3)", Integer.toString(property.keyType), false, true)); @@ -403,6 +414,16 @@ class Modify extends Action { commandList.add(new Command("d", Actions.OP_DPI, "DPI. (100 ~ 480)", Integer.toString(property.dpi), false, true)); + /** TODO : resolution and skin..***********************************************/ + String skinType = ""; + int i = 1; + skinType += Integer.toString(i++) + "(phone_shape_skin) | "; + skinType += Integer.toString(i++) + "(general_purpose_skin)"; + + commandList.add(new Command("k", Actions.OP_SKIN, + "Select skin style (" + skinType + ")", "1", false, true)); + /*****************************************************************************/ + /* commandList.add(new Command("k", Actions.OP_KEYTYPE, "Skin'front button type. (1 | 3)", Integer.toString(property.keyType), false, true)); diff --git a/src/org/tizen/emulator/manager/console/ConsoleCreateVM.java b/src/org/tizen/emulator/manager/console/ConsoleCreateVM.java index a6c859c..aa2b100 100644 --- a/src/org/tizen/emulator/manager/console/ConsoleCreateVM.java +++ b/src/org/tizen/emulator/manager/console/ConsoleCreateVM.java @@ -38,6 +38,7 @@ import org.tizen.emulator.manager.image.BaseImage; import org.tizen.emulator.manager.image.Platform; import org.tizen.emulator.manager.tool.CheckVirtualization; import org.tizen.emulator.manager.tool.SelectSkin; +import org.tizen.emulator.manager.tool.StringResource; import org.tizen.emulator.manager.ui.detail.VMPropertyView; import org.tizen.emulator.manager.vms.Creator; import org.tizen.emulator.manager.vms.EmulatorVMs; @@ -176,6 +177,7 @@ public class ConsoleCreateVM { return true; } + private Command skinCommand = null; public void setOptions(Command c, VMPropertyValue prop) throws ConsoleException { boolean check = false; // Options @@ -183,6 +185,15 @@ public class ConsoleCreateVM { RESOLUTION r = checkResolution(c.getCurrentValue()); prop.resolution = r; prop.dpi = r.getDPI(); + if (skinCommand != null) { + selectSkin(skinCommand, prop); + skinCommand = null; + } else { + if (prop.skin != null && + !prop.skin.getResolution().equals(StringResource.SKIN_GENERAL)) { + selectSkin(null, prop); + } + } } else if (c.getLongName() == Actions.OP_DPI) { check = false; @@ -196,6 +207,10 @@ public class ConsoleCreateVM { throw new ConsoleException("DPI value (" + c.getCurrentValue() + ") is not avaliable."); } } + else if (c.getLongName() == Actions.OP_SKIN) { + skinCommand = c; + selectSkin(c, prop); + } /* else if (c.getLongName() == Actions.OP_KEYTYPE) { check = false; @@ -242,6 +257,32 @@ public class ConsoleCreateVM { } } + private void selectSkin(Command c, VMPropertyValue prop) throws ConsoleException { + // phone shape skin + if (c == null || c.getCurrentValue().equals("1")) { + prop.skin = prop.skinList.findSkin(prop.resolution.getValue()); + if (prop.skin == null) { + System.out.println("There is not match skin to resolution(" + prop.resolution + ")"); + prop.skin = prop.skinList.findGeneralSkin(); + if (prop.skin == null) { + System.out.println("There is not general skin. Skin path may be null."); + } + } + if (prop.skin != null) { + prop.skinPath = prop.skin.getPath(); + } + } else if (c.getCurrentValue().equals("2")) { + prop.skin = prop.skinList.findGeneralSkin(); + if (prop.skin == null) { + System.out.println("There is not general skin. Skin path may be null."); + } else { + prop.skinPath = prop.skin.getPath(); + } + } else { + throw new ConsoleException("Skin value (" + c.getCurrentValue() + ") is not avaliable."); + } + } + private boolean checkGLAcceleration(String currentValue) throws ConsoleException{ String value = currentValue.toLowerCase(); if (value.equals("true")) { diff --git a/src/org/tizen/emulator/manager/image/Skins.java b/src/org/tizen/emulator/manager/image/Skins.java index 040be06..5131c34 100644 --- a/src/org/tizen/emulator/manager/image/Skins.java +++ b/src/org/tizen/emulator/manager/image/Skins.java @@ -36,8 +36,8 @@ import org.tizen.emulator.manager.logging.EMLogger; import org.tizen.emulator.manager.tool.StringResource; public class Skins { - private ArrayList skins; - private String path; + private ArrayList skins = null; + private String path = null; public Skins(File dir) throws Exception { if (dir.exists()) { @@ -77,6 +77,17 @@ public class Skins { return null; } + public Skin findGeneralSkin() { + if (skins != null) { + for (Skin skin : skins) { + if (skin.getResolution().equals(StringResource.SKIN_GENERAL)) { + return skin; + } + } + } + return null; + } + public Skin findSkinUsePath(String path) { if (skins != null) { for (Skin skin : skins) { diff --git a/src/org/tizen/emulator/manager/ui/detail/TableWidget.java b/src/org/tizen/emulator/manager/ui/detail/TableWidget.java index 6427a64..58b70b4 100644 --- a/src/org/tizen/emulator/manager/ui/detail/TableWidget.java +++ b/src/org/tizen/emulator/manager/ui/detail/TableWidget.java @@ -492,18 +492,30 @@ class SkinCombo extends TableWidget { } public String getValue(VMPropertyValue value) { - return value.skin.getName(); + if (value.skin != null) { + return value.skin.getName(); + } else { + return ""; + } } public void setValue(VMPropertyValue value) { value.skin = newSkin; + if (newSkin != null) { + value.skinPath = newSkin.getPath(); + } } public boolean settingWidget(Table table, VMPropertyValue value) { oldSkin = newSkin = value.skin; skins = value.getSkin(); - ArrayList skinList = skins.findSkinList(value.resolution.getValue()); + ArrayList skinList = null; + if (skins != null) { + skinList = skins.findSkinList(value.resolution.getValue()); + } else { + skinList = new ArrayList(); + } helper = new VMCreateHelper(); skinCombo = helper.makeCombo(table); @@ -539,7 +551,12 @@ class SkinCombo extends TableWidget { public void selectResolution(String resolution) { skinCombo.removeAll(); - ArrayList skinList = skins.findSkinList(resolution); + ArrayList skinList = null; + if (skins != null) { + skinList = skins.findSkinList(resolution); + } else { + skinList = new ArrayList(); + } helper.addComboItem(skinCombo, skinList.toArray(), 0); newSkin = skinList.get(0); } diff --git a/src/org/tizen/emulator/manager/vms/Creator.java b/src/org/tizen/emulator/manager/vms/Creator.java index 2553671..9d2f0ff 100644 --- a/src/org/tizen/emulator/manager/vms/Creator.java +++ b/src/org/tizen/emulator/manager/vms/Creator.java @@ -275,7 +275,11 @@ public class Creator { ec.getDevice().getDisplay().getDensity().setValue(newVM.dpi); ec.getDevice().getDisplay().setSkinPath(factory.createDisplayTypeSkinPath()); - ec.getDevice().getDisplay().getSkinPath().setPath(newVM.skin.getPath()); + if (newVM.skin != null) { + ec.getDevice().getDisplay().getSkinPath().setPath(newVM.skin.getPath()); + } else if (newVM.skinPath != null) { + ec.getDevice().getDisplay().getSkinPath().setPath(newVM.skinPath); + } ec.getDevice().setRAM(factory.createRamType()); ec.getDevice().getRAM().setSize(factory.createRamTypeSize()); diff --git a/src/org/tizen/emulator/manager/vms/Modifier.java b/src/org/tizen/emulator/manager/vms/Modifier.java index a2a24a9..0e9daa3 100644 --- a/src/org/tizen/emulator/manager/vms/Modifier.java +++ b/src/org/tizen/emulator/manager/vms/Modifier.java @@ -56,10 +56,12 @@ public class Modifier { } */ if (newVM.skin != null) { - //newVM.skinPath = newVM.getSkin().findSkin(newVM.resolution.getValue()).getPath(); - property.getConfiguration().getDevice().getDisplay().getSkinPath().setPath(newVM.skin.getPath()); + newVM.skinPath = newVM.skin.getPath(); + property.getConfiguration().getDevice().getDisplay().getSkinPath().setPath(newVM.skinPath); + } else if (newVM.skinPath != null) { + property.getConfiguration().getDevice().getDisplay().getSkinPath().setPath(newVM.skinPath); } else { - //newVM.skinPath = null; + newVM.skinPath = null; } } /* else { diff --git a/src/org/tizen/emulator/manager/vms/VMPropertyValue.java b/src/org/tizen/emulator/manager/vms/VMPropertyValue.java index 9e3589a..d9ea31e 100644 --- a/src/org/tizen/emulator/manager/vms/VMPropertyValue.java +++ b/src/org/tizen/emulator/manager/vms/VMPropertyValue.java @@ -58,7 +58,7 @@ public class VMPropertyValue implements Cloneable { public int dpi; public int keyType; public Skin skin; - //public String skinPath; + public String skinPath; public int ramSize; @@ -94,6 +94,9 @@ public class VMPropertyValue implements Cloneable { if (skin == null && skinList != null) { skin = skinList.findSkin(resolution.getValue()); } + if (skin != null) { + skinPath = skin.getPath(); + } } } @@ -134,7 +137,7 @@ public class VMPropertyValue implements Cloneable { dest.resolution = this.resolution; dest.dpi = this.dpi; dest.skin = this.skin; - //dest.skinPath = this.skinPath; + dest.skinPath = this.skinPath; dest.keyType = this.keyType; dest.ramSize = this.ramSize; @@ -231,10 +234,14 @@ public class VMPropertyValue implements Cloneable { keyType = 1; if (SelectSkin.getInstance().getDefaultSkin() != null) { if (property.getConfiguration().getDevice().getDisplay().getSkinPath() != null) { + skinPath = property.getConfiguration().getDevice().getDisplay().getSkinPath().getPath(); skin = SelectSkin.getInstance().getDefaultSkin().findSkinUsePath - (property.getConfiguration().getDevice().getDisplay().getSkinPath().getPath()); + (skinPath); } else { - skin = SelectSkin.getInstance().getDefaultSkin().findSkin(resolution.getValue());; + skin = SelectSkin.getInstance().getDefaultSkin().findSkin(resolution.getValue()); + if (skin != null) { + skinPath = skin.getPath(); + } } } else { skin = null; @@ -275,6 +282,10 @@ public class VMPropertyValue implements Cloneable { if (SelectSkin.getInstance().getDefaultSkin() != null) { skin = SelectSkin.getInstance().getDefaultSkin().findSkin(resolution.getValue()); } + if (skin!= null) { + skinPath = skin.getPath(); + } + keyType = 1; // -- 2.7.4