skin: load sdk version from file
authorgiwoong.kim <giwoong.kim@samsung.com>
Thu, 21 Feb 2013 08:18:47 +0000 (17:18 +0900)
committergiwoong.kim <giwoong.kim@samsung.com>
Thu, 21 Feb 2013 08:18:47 +0000 (17:18 +0900)
load information of sdk version from
version file

Signed-off-by: GiWoong Kim <giwoong.kim@samsung.com>
tizen/src/VERSION
tizen/src/emulator.c
tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkin.java
tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkinMain.java
tizen/src/skin/client/src/org/tizen/emulator/skin/config/EmulatorConfig.java
tizen/src/skin/client/src/org/tizen/emulator/skin/dialog/AboutDialog.java
tizen/src/skin/client/src/org/tizen/emulator/skin/util/SkinUtil.java

index b3fef1de2a4645a7acb9ac921ebbbacea360682d..47f7d32da5687c02229f4efbeece75842702b0aa 100644 (file)
@@ -1 +1 @@
-2.1.0 RC9
+Maru
index 85bc177337fbecddcdd2b78a62513c814d0b287b..9651feae7d6b8ce727bf8513edd35ac50812c271 100644 (file)
@@ -292,7 +292,7 @@ static void print_system_info(void)
     struct tm *tm_time;
     struct timeval tval;
 
-    INFO("* SDK Version : %s\n", build_version);
+    INFO("* Board name : %s\n", build_version);
     INFO("* Package %s\n", pkginfo_version);
     INFO("* Package %s\n", pkginfo_maintainer);
     INFO("* Git Head : %s\n", pkginfo_githead);
index 720fc2d84cb1a2d12c4f8d7860d2162dff9bdfc8..d1b57d993cf2bc94176461a7e181e7a37d76bd3f 100644 (file)
@@ -1577,7 +1577,7 @@ public class EmulatorSkin {
                                        isOpen = true;
 
                                        logger.info("Open the about dialog");
-                                       AboutDialog dialog = new AboutDialog(shell);
+                                       AboutDialog dialog = new AboutDialog(shell, config);
                                        dialog.open();
                                        isOpen = false;
                                }
index facefd51c9d593852c851dcaca725bf92a748fb9..13f7e96bdf7a614ab2c33bbb97e5e8da56f4b0b8 100644 (file)
 
 package org.tizen.emulator.skin;
 
+import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileInputStream;
+import java.io.FileReader;
 import java.io.IOException;
 import java.net.Socket;
 import java.util.HashMap;
@@ -57,6 +59,7 @@ import org.tizen.emulator.skin.log.SkinLogger;
 import org.tizen.emulator.skin.log.SkinLogger.SkinLogLevel;
 import org.tizen.emulator.skin.util.IOUtil;
 import org.tizen.emulator.skin.util.JaxbUtil;
+import org.tizen.emulator.skin.util.SkinUtil;
 import org.tizen.emulator.skin.util.StringUtil;
 import org.tizen.emulator.skin.util.SwtUtil;
 
@@ -184,10 +187,10 @@ public class EmulatorSkinMain {
 
                        /* set emulator window skin property */
                        String skinPropFilePath = vmPath + File.separator + SKIN_PROPERTIES_FILE_NAME;
-                       Properties skinProperties = loadProperties( skinPropFilePath, true );
-                       if ( null == skinProperties ) {
-                               logger.severe( "Fail to load skin properties file." );
-                               System.exit( -1 );
+                       Properties skinProperties = loadProperties(skinPropFilePath, true);
+                       if (null == skinProperties) {
+                               logger.severe("Fail to load skin properties file.");
+                               System.exit(-1);
                        }
 
                        /* set emulator window config property */
@@ -219,9 +222,28 @@ public class EmulatorSkinMain {
                                System.exit(-1);
                        }
 
+                       /* collect configurations */
                        EmulatorConfig config = new EmulatorConfig(argsMap,
                                        dbiContents, skinProperties, skinPropFilePath, configProperties);
 
+                       /* load SDK version */
+                       String strVersion = "Undefined";
+                       String versionFilePath = SkinUtil.getSdkVersionFilePath();
+
+                       File file = new File(versionFilePath);
+                       if (file.exists() && file.isFile()) {
+                               BufferedReader reader = new BufferedReader(
+                                               new FileReader(versionFilePath));
+
+                               strVersion = reader.readLine();
+
+                               reader.close();
+                       }
+
+                       logger.info("SDK version : " + strVersion);
+                       config.setSkinProperty(
+                                       EmulatorConfig.SkinInfoConstants.SDK_VERSION_NAME, strVersion);
+
                        /* load image resource */
                        ImageRegistry.getInstance().initialize(config);
 
index 489e4add9c47c322b49aa55b2ec0191f2e380677..6dce373125c434dca99c1c5003fef4116c78afaa 100644 (file)
@@ -78,6 +78,7 @@ public class EmulatorConfig {
        }
 
        public interface SkinInfoConstants {
+               public static final String SDK_VERSION_NAME = "sdk.version-name";
                public static final String SKIN_NAME = "skin.name";
                public static final String RESOLUTION_WIDTH = "resolution.width";
                public static final String RESOLUTION_HEIGHT = "resolution.height";
index 0077773942e71316acbf57b6aef6bb82bfcbb617..c95ba2496a781ac3bdc39899f648991a5431905d 100644 (file)
@@ -52,6 +52,7 @@ import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Link;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.swt.widgets.Text;
+import org.tizen.emulator.skin.config.EmulatorConfig;
 import org.tizen.emulator.skin.log.SkinLogger;
 import org.tizen.emulator.skin.util.IOUtil;
 import org.tizen.emulator.skin.util.StringUtil;
@@ -67,12 +68,17 @@ public class AboutDialog extends SkinDialog {
 
        public static final String URL_TIZEN_ORG = "https://developer.tizen.org";
 
+       private Logger logger =
+                       SkinLogger.getSkinLogger(AboutDialog.class).getLogger();
+
        private Image aboutImage;
+       private EmulatorConfig config;
 
-       private Logger logger = SkinLogger.getSkinLogger(AboutDialog.class).getLogger();
 
-       public AboutDialog(Shell parent) {
+       public AboutDialog(Shell parent, EmulatorConfig config) {
                super(parent, "About Tizen Emulator", SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
+
+               this.config = config;
        }
 
        private GridLayout getNopaddedGridLayout(int numColumns, boolean makeColumnEqualWidth) {
@@ -160,10 +166,13 @@ public class AboutDialog extends SkinDialog {
 
                /* SDK version */
                Text versionText = new Text(compositeRight, SWT.NONE);
-               String version = getValue(properties, PROP_KEY_VERSION);
+               /*String version = getValue(properties, PROP_KEY_VERSION);
                if (version.isEmpty()) {
                        version = "Not identified";
-               }
+               }*/
+               String version = config.getSkinProperty(
+                               EmulatorConfig.SkinInfoConstants.SDK_VERSION_NAME);
+
                versionText.setText("Version : " + version);
                versionText.setEditable(false);
                versionText.setBackground(white);
index 7d973230695fc8b787faac4a7617b3016d214f53..b4d0a510240814934b0c035ccebb5e6f77bb5559 100644 (file)
@@ -124,6 +124,10 @@ public class SkinUtil {
                return sdbPath;
        }
 
+       public static String getSdkVersionFilePath() {
+               return ".." + File.separator + "etc" + File.separator + "version";
+       }
+
        public static List<KeyMapType> getHWKeyMapList(short rotationId) {
                RotationType rotation = SkinRotation.getRotation(rotationId);
                if (rotation == null) {