[Title] emulator-manager : change default resolution (WVGA, HD)
authorjihye kim <jihye1128.kim@samsung.com>
Mon, 3 Dec 2012 07:01:23 +0000 (16:01 +0900)
committerjihye kim <jihye1128.kim@samsung.com>
Mon, 3 Dec 2012 07:01:23 +0000 (16:01 +0900)
[Desc.] change default resolution (WVGA, HD) and set x86 image id 0, arm image start 1.
[Issue] N/A

package/changelog
package/pkginfo.manifest
src/org/tizen/emulator/manager/EmulatorManager.java
src/org/tizen/emulator/manager/image/BaseImage.java
src/org/tizen/emulator/manager/image/Platform.java
src/org/tizen/emulator/manager/ui/detail/TableWidget.java
src/org/tizen/emulator/manager/ui/detail/VMResource.java

index e1e22eb..e21ecf3 100644 (file)
@@ -1,3 +1,8 @@
+* 1.3.64
+- change set of resolution (WVGA, HD)
+- set x86 image id 0 (arm image start 1)
+== jihye kim <jihye1128.kim@samsung.com> 2012-12-03
+
 * 1.3.63
 - change emulator-manager.app for mac
 == jihye kim <jihye1128.kim@samsung.com> 2012-11-29
index f2c3a2a..0ec6fc9 100644 (file)
@@ -1,5 +1,5 @@
 Source: emulator-manager
-Version: 1.3.63
+Version: 1.3.64
 Maintainer: Yeong-Kyoon Lee<yeongkyoon.lee@samsung.com>
 
 Package: emulator-manager
index 9d5a54b..aafebbc 100755 (executable)
@@ -63,7 +63,7 @@ public class EmulatorManager {
        private static CommandLineParser processor = null;
        private static boolean isConsoleMode = true;
        // for multi touch
-       private static boolean isInhoseMode  = true;
+       private static boolean isInhoseMode  = false;
 
        private static RandomAccessFile randomAccessFile;
        private static boolean isMac = false;
index 18b1b35..475831a 100644 (file)
@@ -40,7 +40,7 @@ import org.tizen.emulator.manager.tool.StringResource;
 
 public class BaseImage {
        private Platform platform;
-       private String id;
+       private String id = "x";
        private String platformName;
        private String type;
        private String name;
@@ -53,23 +53,13 @@ public class BaseImage {
        private String path;
        private String information;
 
-       public BaseImage(Platform platform, File path, int id) throws IOException {
+       public BaseImage(Platform platform, File path) throws IOException {
                this.platform = platform;
-               loadProperty(id, path);
+               loadProperty(path);
                settingImagePath(path);
-               information = getName() + "\n" +
-                               "       ID              : " + getID() + "\n" +
-                               "       Platform        : " + getPlatformName() + "\n" +
-                               "       Type            : " + getType() + "\n" +
-                               "       Version         : " + getVersion() + "\n" +
-                               "       Release Version : " + getRelease() + "\n" +
-                               "       Target CPU      : " + getCpu().toUpperCase() + "\n" +
-                               "       Product Domain  : " + getDomain() + "\n" +
-                               "       Base Disk Image Path : " + getPath() + "\n";
        }
 
-       private void loadProperty(int id, File path) throws IOException {
-               this.id = Integer.toString(id);
+       private void loadProperty(File path) throws IOException {
                File f = new File(path + File.separator + StringResource.IMAGE_INFO_FILENAME);
                FileInputStream inputStream = null;
                try {
@@ -114,6 +104,22 @@ public class BaseImage {
                        throw new IOException("Failed getting image file path.");
                }
        }
+
+       void setID(int id) {
+               this.id = Integer.toString(id);
+               //
+               information = getName() + "\n" +
+                               "       ID              : " + getID() + "\n" +
+                               "       Platform        : " + getPlatformName() + "\n" +
+                               "       Type            : " + getType() + "\n" +
+                               "       Version         : " + getVersion() + "\n" +
+                               "       Release Version : " + getRelease() + "\n" +
+                               "       Target CPU      : " + getCpu().toUpperCase() + "\n" +
+                               "       Product Domain  : " + getDomain() + "\n" +
+                               "       Base Disk Image Path : " + getPath() + "\n";
+               //
+       }
+
        public String getID() {
                return id;
        }
index ae5e83a..01dfc94 100644 (file)
@@ -159,12 +159,11 @@ public class Platform {
                        for (File f : defaultImages.listFiles()) {
                                if (f.isDirectory()) {
                                        try {
-                                               image = new BaseImage(this, f, ++id);
+                                               image = new BaseImage(this, f);
                                                for (BaseImage i : imageList) {
                                                        if (i.getName().equals(image.getName())){
                                                                // TODO: duplicate name
                                                                EMLogger.getLogger().warning("The same name of the base disk image already exist.(name : " + image.getName() + " )");
-                                                               --id;
                                                                throw new IOException();
                                                        }
                                                }
@@ -181,12 +180,11 @@ public class Platform {
                        for (File f : addonsImages.listFiles()) {
                                if (f.isDirectory()) {
                                        try {
-                                               image = new BaseImage(this, f, ++id);
+                                               image = new BaseImage(this, f);
                                                for (BaseImage i : imageList) {
                                                        if (i.getName().equals(image.getName())){
                                                                // TODO: duplicate name
                                                                EMLogger.getLogger().warning("The same name of the base disk image already exist.(name : " + image.getName() + " )");
-                                                               --id;
                                                                throw new IOException();
                                                        }
                                                }
@@ -197,6 +195,19 @@ public class Platform {
                                }
                        }
                }
+
+               // set image id
+               for (BaseImage i : imageList) {
+                       if (i.getCpu().equals("x86")) {
+                               i.setID(id++);
+                               break;
+                       }
+               }
+               for (BaseImage i : imageList) {
+                       if (!i.getID().equals("0")) {
+                               i.setID(id++);
+                       }
+               }
        }
 
 
index bae26ce..df28dc6 100644 (file)
@@ -392,8 +392,11 @@ class ResolutionCombo extends TableWidget {
 
                VMCreateHelper helper = new VMCreateHelper();
                resolutionCombo = helper.makeCombo(table);
-               helper.addComboItem(resolutionCombo, DisplayResoultion.getInstance().getList(),
-                                                       DisplayResoultion.getInstance().findIndex(oldResolution.toString()));
+               DisplayResolution.getInstance().initialize(oldResolution);
+
+               helper.addComboItem(resolutionCombo, DisplayResolution.getInstance().getList(),
+                               DisplayResolution.getInstance().findIndex(oldResolution.toString()));
+
                resolutionCombo.setToolTipText(resolutionCombo.getItem(resolutionCombo.getSelectionIndex()));
                return true;
        }
@@ -404,15 +407,14 @@ class ResolutionCombo extends TableWidget {
                        public void widgetSelected(SelectionEvent e) {
                                String re = resolutionCombo.getItem(resolutionCombo.getSelectionIndex());
                                resolutionCombo.setToolTipText(re);
-                               for (RESOLUTION d : RESOLUTION.values()) {
-                                       if (re.equals(d.toString())) {
-                                               newResolution = d;
-                                               Spinner dpi = (Spinner)(TableWidgetList.getInstance()
-                                                               .findVMWidget("dpi", isCreateMode()).getWidget());
-                                               dpi.setSelection(d.getDPI());
-                                               SkinCombo skin = (SkinCombo)TableWidgetList.getInstance().findVMWidget("skin", isCreateMode());
-                                               skin.selectResolution(d.getValue());
-                                       }
+                               RESOLUTION d = DisplayResolution.getInstance().findResolution(re);
+                               if (d != null) {
+                                       newResolution = d;
+                                       Spinner dpi = (Spinner)(TableWidgetList.getInstance()
+                                                       .findVMWidget("dpi", isCreateMode()).getWidget());
+                                       dpi.setSelection(d.getDPI());
+                                       SkinCombo skin = (SkinCombo)TableWidgetList.getInstance().findVMWidget("skin", isCreateMode());
+                                       skin.selectResolution(d.getValue());
                                }
 
                                if (!isCreateMode()) {
index 5cb5f09..f31e23f 100644 (file)
@@ -32,6 +32,8 @@ package org.tizen.emulator.manager.ui.detail;
 
 import java.util.ArrayList;
 
+import org.tizen.emulator.manager.EmulatorManager;
+import org.tizen.emulator.manager.EmulatorManager.ManagerModeType;
 import org.tizen.emulator.manager.tool.StringResource;
 import org.tizen.emulator.manager.vms.RAM_SIZE;
 import org.tizen.emulator.manager.vms.RESOLUTION;
@@ -108,25 +110,64 @@ class SupportType extends StringArrayResource
        }
 }
 
-class DisplayResoultion extends StringArrayResource
+class DisplayResolution extends StringArrayResource
 {
-       private static DisplayResoultion resolution = new DisplayResoultion();
-       public static DisplayResoultion getInstance()
+       private static RESOLUTION[] minResoultion = {RESOLUTION.WVGA, RESOLUTION.HD};
+
+       private static DisplayResolution resolution = new DisplayResolution();
+       public static DisplayResolution getInstance()
        {
                return resolution;
        }
 
-       private DisplayResoultion()
+       private DisplayResolution()
        {
                int i = 0;
-               for (RESOLUTION r : RESOLUTION.values()) {
-                       if (r == RESOLUTION.HD) {
-                               setDefaultIndex(i);
+               if (EmulatorManager.getInstance().getManagerMode() == ManagerModeType.INHOUSE_MODE) {
+                       for (RESOLUTION r : RESOLUTION.values()) {
+                               if (r == RESOLUTION.HD) {
+                                       setDefaultIndex(i);
+                               }
+                               add(i++, r.toString());
+                       }
+               } else {
+                       for (RESOLUTION r : minResoultion) {
+                               if (r == RESOLUTION.HD) {
+                                       setDefaultIndex(i);
+                               }
+                               add(i++, r.toString());
+                       }
+               }
+       }
+
+       public void initialize(RESOLUTION re) {
+               if (!(EmulatorManager.getInstance().getManagerMode() == ManagerModeType.INHOUSE_MODE)) {
+                       for (String s : getList()) {
+                               if (s.equals(re.toString())) {
+                                       return;
+                               }
                        }
-                       add(i++, r.toString());
+                       add(0, re.toString());
                }
        }
 
+       public RESOLUTION findResolution(String resolution) {
+               if (EmulatorManager.getInstance().getManagerMode() == ManagerModeType.INHOUSE_MODE) {
+                       for (RESOLUTION r : RESOLUTION.values()) {
+                               if (resolution.equals(r.toString())) {
+                                       return r;
+                               }
+                       }
+               } else {
+                       for (RESOLUTION r : minResoultion) {
+                               if (resolution.equals(r.toString())) {
+                                       return r;
+                               }
+                       }
+               }
+               return null;
+       }
+
        public int findIndex(String r) {
                String[] strArray = getList();
                String s = null;
@@ -136,6 +177,7 @@ class DisplayResoultion extends StringArrayResource
                                return i;
                        }
                }
+
                return getDefaultIndex();
        }
 }