menu: added Image Path list to Detail Info 66/11566/1
authorGiWoong Kim <giwoong.kim@samsung.com>
Wed, 30 Oct 2013 07:40:33 +0000 (16:40 +0900)
committerGiWoong Kim <giwoong.kim@samsung.com>
Wed, 30 Oct 2013 07:44:56 +0000 (16:44 +0900)
Change-Id: I48ae2a7c6b12a56858117f017ec77a8f09191f6b
Signed-off-by: GiWoong Kim <giwoong.kim@samsung.com>
tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkin.java
tizen/src/skin/client/src/org/tizen/emulator/skin/dialog/AboutDialog.java
tizen/src/skin/client/src/org/tizen/emulator/skin/dialog/DetailInfoDialog.java

index fef276bd6a961f43966c846aa43b752472e13b3d..a94d9110c387ac7852f22f82698ee864919a22f7 100755 (executable)
@@ -1282,9 +1282,8 @@ public class EmulatorSkin {
                                        logger.fine("Open detail info");
                                }
 
-                               String emulatorName = SkinUtil.makeEmulatorName(config);
-                               DetailInfoDialog detailInfoDialog = new DetailInfoDialog(shell,
-                                               emulatorName, communicator, config, skinInfo);
+                               DetailInfoDialog detailInfoDialog = new DetailInfoDialog(
+                                               shell, communicator, config, skinInfo);
                                detailInfoDialog.open();
                        }
                };
index 93255e3e510a6155571db562ed40e0053c7df1f9..a65f79d920a0069c74a284d6f1389e00632709f9 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * 
+ * About Dialog
  *
  * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
  *
@@ -303,6 +303,5 @@ public class AboutDialog extends SkinDialog {
        @Override
        protected void close() {
                logger.info("close the about dialog");
-               aboutImage.dispose();
        }
 }
index b50b37b542e9d90758aa4cfe9c9d36cb3fba69f5..e260f60ce530be0ee23772897e449aa64ee43a31 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * Display the emulator detail information
+ * Detailed Information Of VM
  *
  * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
  *
 package org.tizen.emulator.skin.dialog;
 
 import java.io.IOException;
+import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
+import java.util.List;
 import java.util.Map.Entry;
 import java.util.logging.Level;
 import java.util.logging.Logger;
@@ -62,7 +64,15 @@ import org.tizen.emulator.skin.util.SwtUtil;
  *
  */
 public class DetailInfoDialog extends SkinDialog {
+       public final static String TABLE_COLUMN_NAME_0 = "Feature";
+       public final static String TABLE_COLUMN_NAME_1 = "Value";
+
        public final static String DATA_DELIMITER = "#";
+       public final static String QEMU_PARAMETER_KVM = "-enable-kvm";
+       public final static String QEMU_PARAMETER_HAX = "-enable-hax";
+       public final static String QEMU_PARAMETER_GL = "-enable-gl";
+       public final static String QEMU_PARAMETER_RAM = "-m";
+       public final static String QEMU_PARAMETER_DRIVE = "-drive";
 
        public final static String KEY_VM_NAME = "VM Name";
        public final static String KEY_SKIN_NAME = "Skin Name";
@@ -95,9 +105,9 @@ public class DetailInfoDialog extends SkinDialog {
        /**
         *  Constructor
         */
-       public DetailInfoDialog(Shell parent, String emulatorName,
-                       SocketCommunicator communicator, EmulatorConfig config, SkinInformation skinInfo) {
-               super(parent, "Detail Info" + " - " + emulatorName,
+       public DetailInfoDialog(Shell parent, SocketCommunicator communicator,
+                       EmulatorConfig config, SkinInformation skinInfo) {
+               super(parent, "Detail Info" + " - " + SkinUtil.makeEmulatorName(config),
                                SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL | SWT.RESIZE | SWT.MAX);
 
                this.communicator = communicator;
@@ -123,10 +133,10 @@ public class DetailInfoDialog extends SkinDialog {
                TableColumn[] column = new TableColumn[2];
 
                column[0] = new TableColumn(table, SWT.LEFT);
-               column[0].setText("Feature");
+               column[0].setText(TABLE_COLUMN_NAME_0);
 
                column[1] = new TableColumn(table, SWT.LEFT);
-               column[1].setText("Value");
+               column[1].setText(TABLE_COLUMN_NAME_1);
 
                int index = 0;
 
@@ -159,28 +169,29 @@ public class DetailInfoDialog extends SkinDialog {
                                        return;
                                }
 
-                               TableItem tableItem = ((TableItem)table.getSelection()[0]);
+                               TableItem tableItem = table.getItem(table.getSelectionIndex());
                                String openPath = VALUE_NONE;
 
-                               if (tableItem.getText().compareTo(KEY_LOG_PATH) == 0) {
-                                       openPath = refinedData.get(KEY_LOG_PATH);
-                               } else if (tableItem.getText().compareTo(KEY_IMAGE_PATH) == 0) {
-                                       openPath = refinedData.get(KEY_IMAGE_PATH);
-                               } else if (tableItem.getText().compareTo(KEY_FILESHARED_PATH) == 0) {
-                                       openPath = refinedData.get(KEY_FILESHARED_PATH);
+                               if (tableItem.getText(0).compareTo(KEY_FILESHARED_PATH) == 0
+                                               || tableItem.getText(0).compareTo(KEY_LOG_PATH) == 0
+                                               || tableItem.getText(0).startsWith(KEY_IMAGE_PATH) == true) {
+                                       openPath = tableItem.getText(1);
+                               } else {
+                                       return;
+                               }
+
+                               if (openPath == null || openPath.compareTo(VALUE_NONE) == 0 ||
+                                               openPath.compareTo("") == 0) {
+                                       return;
                                }
 
                                try {
+                                       logger.info("open " + openPath);
                                        openPath = StringUtil.getCanonicalPath(openPath);
                                } catch (IOException e) {
                                        logger.warning("Invalid path");
                                }
 
-                               if (openPath.compareTo(VALUE_NONE) == 0 ||
-                                               openPath.compareTo("") == 0) {
-                                       return;
-                               }
-
                                Program.launch(openPath);
 
                                /*ProcessBuilder procBrowser = new ProcessBuilder();
@@ -209,11 +220,13 @@ public class DetailInfoDialog extends SkinDialog {
 
        @Override
        protected void setShellSize() {
-               if (SwtUtil.isLinuxPlatform()) {
-                       shell.setSize((int) (402 * 1.618/* golden ratio */), 402);
+               /* if (SwtUtil.isLinuxPlatform()) {
+                       shell.setSize((int) (402 * 1.618), 402);
                } else {
                        shell.setSize((int) (372 * 1.618), 372);
-               }
+               } */
+
+               shell.pack();
        }
 
        private String queryData() {
@@ -240,7 +253,7 @@ public class DetailInfoDialog extends SkinDialog {
                String cpu = "";
                String ramSize = "";
                String dpi = "";
-               String imagePath = "";
+               List<String> imagePathList = new ArrayList<String>();
                String sharedPath = "";
                boolean isCpuVirtual = false;
                boolean isGpuVirtual = false;
@@ -249,18 +262,19 @@ public class DetailInfoDialog extends SkinDialog {
                String logPath = "";
                boolean isHaxError = false;
 
-               if (SwtUtil.isLinuxPlatform()) {
-                       cpuVirtualCompare = "-enable-kvm";
-               } else if (SwtUtil.isWindowsPlatform()) {
-                       cpuVirtualCompare = "-enable-hax";
+               if (SwtUtil.isLinuxPlatform() == true) {
+                       cpuVirtualCompare = QEMU_PARAMETER_KVM;
+               } else {
+                       cpuVirtualCompare = QEMU_PARAMETER_HAX;
                }
-               gpuVirtualCompare = "-enable-gl";
+               gpuVirtualCompare = QEMU_PARAMETER_GL;
 
                String[] split = infoData.split(DATA_DELIMITER);
 
                for (int i = 0; i < split.length; i++) {
-                       if (0 == i) {
+                       if (0 == i) { /* emulator binary name */
                                String exec = split[i].trim().toLowerCase();
+
                                if (SwtUtil.isWindowsPlatform()) {
                                        if (4 <= exec.length()) {
                                                /* remove '.exe' in Windows */
@@ -274,15 +288,15 @@ public class DetailInfoDialog extends SkinDialog {
                                } else if (exec.endsWith("arm")) {
                                        cpu = "ARM";
                                }
-                       } else {
+                       } else { /* qemu arguments */
                                if (i + 1 <= split.length) {
                                        String arg = split[i].trim();
 
-                                       if ("-m".equals(arg))
+                                       if (QEMU_PARAMETER_RAM.equals(arg))
                                        {
                                                ramSize = split[i + 1].trim();
                                        }
-                                       else if ("-drive".equals(arg))
+                                       else if (QEMU_PARAMETER_DRIVE.equals(arg))
                                        {
                                                /* arg : file=/path/emulimg.x86,... */
                                                arg = split[i + 1].trim();
@@ -292,7 +306,7 @@ public class DetailInfoDialog extends SkinDialog {
                                                        String[] sp2 = sp[0].split("=");
                                                        String drivePath = sp2[sp2.length - 1];
 
-                                                       imagePath = drivePath;
+                                                       imagePathList.add(drivePath);
                                                }
                                        }
                                        else if ("-virtfs".equals(arg))
@@ -306,7 +320,7 @@ public class DetailInfoDialog extends SkinDialog {
                                                        sharedPath = sp[1].substring(spIndex + 1, sp[1].length());
                                                }
                                        }
-                                       else if ("-append".equals(arg))
+                                       else if ("-append".equals(arg)) /* kernel parameters */
                                        {
                                                arg = split[i + 1].trim();
                                                String[] splitSub = arg.split(" ");
@@ -409,10 +423,15 @@ public class DetailInfoDialog extends SkinDialog {
                }
 
                /* platform image path */
-               if (StringUtil.isEmpty(imagePath)) {
-                       result.put(KEY_IMAGE_PATH, "Not identified");
+               int nPath = imagePathList.size();
+               if (nPath == 0) {
+                       result.put(KEY_IMAGE_PATH, VALUE_NONE);
+               } else if (nPath == 1) {
+                       result.put(KEY_IMAGE_PATH, imagePathList.get(0));
                } else {
-                       result.put(KEY_IMAGE_PATH, imagePath);
+                       for (int i = 0; i < nPath; i ++) {
+                               result.put(KEY_IMAGE_PATH + " " + (i + 1), imagePathList.get(i));
+                       }
                }
 
                /* emulator log path */