- Moved to 'emulator-manager-resources' project.
Change-Id: Id8a1fa95a5a33db8c313107039603648aaa866bb
Signed-off-by: minkee.lee <minkee.lee@samsung.com>
<property name="jna.file" value="jna-4.1.0.jar" />
<property name="common.dir" value="common-project" />
- <property name="plugin.dir" value="plugin-project" />
- <property name="plugin.file" value="em-plugin.jar" />
-
- <!-- mobile plugin property -->
- <property name="mobile.dir" value="mobile-plugin" />
- <property name="mobile.platform.version" value="2.4" />
- <property name="mobile.platform.profile" value="mobile"/>
- <property name="mobile.item.factory" value="org.tizen.emulator.manager.mobile.ui.detail.ItemListFactory" />
- <property name="mobile.vmworker" value="org.tizen.emulator.manager.mobile.vms.VMWorker" />
- <property name="mobile.vmbutton.painter" value="org.tizen.emulator.manager.mobile.ui.widget.VMButtonPainter" />
-
- <!-- wearable plugin property -->
- <property name="wearable.dir" value="wearable-plugin" />
- <property name="wearable.platform.version" value="2.4" />
- <property name="wearable.platform.profile" value="wearable"/>
- <property name="wearable.item.factory" value="org.tizen.emulator.manager.wearable.ui.detail.ItemListFactory" />
- <property name="wearable.vmworker" value="org.tizen.emulator.manager.wearable.vms.VMWorker" />
- <property name="wearable.vmbutton.painter" value="org.tizen.emulator.manager.wearable.ui.widget.VMButtonPainter" />
+ <property name="build.dir" value="build" />
<path id="common-classpath">
<fileset dir="${common.dir}/lib" includes="${swt.file}" />
<fileset dir="${common.dir}/lib" includes="${jna.file}" />
</path>
- <path id="plugin-classpath">
- <fileset dir="${common.dir}/lib" includes="${swt.file}" />
- <fileset dir="${common.dir}" includes="${jar.file}" />
- </path>
-
<target name="clean">
<echo message="cleaning..." />
- <delete dir="build" />
+ <delete dir="${build.dir}" />
<delete file="${common.dir}/${jar.file}" />
- <delete file="${plugin.dir}/${mobile.dir}/${plugin.file}" />
- <delete file="${plugin.dir}/${wearable.idr}/${plugin.file}" />
</target>
<target name="make-properties">
<target name="create-common-jar">
<echo message="creating emulator-manager jar..." />
- <mkdir dir="build/res" />
- <copy todir="build/res">
+ <mkdir dir="${build.dir}/res" />
+ <copy todir="${build.dir}/res">
<fileset dir="${common.dir}/resource/res" />
</copy>
- <jar jarfile="${common.dir}/${jar.file}" basedir="build" duplicate="add">
+ <jar jarfile="${common.dir}/${jar.file}" basedir="${build.dir}" duplicate="add">
<fileset file="about.properties" />
<manifest>
<attribute name="Main-Class" value="${mainclass}" />
</jar>
</target>
- <target name="create-mobile-jar">
- <echo message="creating mobile plugin jar..." />
- <mkdir dir="build/res" />
- <copy todir="build/res">
- <fileset dir="${plugin.dir}/${mobile.dir}/res" />
- </copy>
- <jar jarfile="${plugin.dir}/${mobile.dir}/${plugin.file}" basedir="build" duplicate="add">
- <manifest>
- <attribute name="Platform-Version" value="${mobile.platform.version}"/>
- <attribute name="Platform-Profile" value="${mobile.platform.profile}"/>
- <attribute name="Item-Factory" value="${mobile.item.factory}"/>
- <attribute name="VM-Worker" value="${mobile.vmworker}" />
- <attribute name="VMButton-Painter" value="${mobile.vmbutton.painter}" />
- </manifest>
- </jar>
- </target>
-
- <target name="create-wearable-jar">
- <echo message="creating wearable plugin jar..." />
- <mkdir dir="build/res" />
- <copy todir="build/res">
- <fileset dir="${plugin.dir}/${wearable.dir}/res" />
- </copy>
- <jar jarfile="${plugin.dir}/${wearable.dir}/${plugin.file}" basedir="build" duplicate="add">
- <manifest>
- <attribute name="Platform-Version" value="${wearable.platform.version}"/>
- <attribute name="Platform-Profile" value="${wearable.platform.profile}"/>
- <attribute name="Item-Factory" value="${wearable.item.factory}"/>
- <attribute name="VM-Worker" value="${wearable.vmworker}" />
- <attribute name="VMButton-Painter" value="${wearable.vmbutton.painter}" />
- </manifest>
- </jar>
- </target>
-
<target name="prepare-compile">
<echo message="prepare for compile..." />
- <delete dir="build" />
- <mkdir dir="build" />
+ <delete dir="${build.dir}" />
+ <mkdir dir="${build.dir}" />
</target>
<target name="common-compile" depends="make-properties">
<echo message="compiling emulator manager jar" />
<antcall target="prepare-compile"/>
- <javac includeantruntime="false" encoding="UTF-8" fork="true" srcdir="${common.dir}/src:${common.dir}/jaxb_src" destdir="build" debug="on" memorymaximumsize="128m">
+ <javac includeantruntime="false" encoding="UTF-8" fork="true" srcdir="${common.dir}/src:${common.dir}/jaxb_src" destdir="${build.dir}" debug="on" memorymaximumsize="128m">
<classpath refid="common-classpath" />
</javac>
<antcall target="create-common-jar"/>
</target>
- <target name="mobile-compile">
- <echo message="compiling mobile profile plugin jar" />
- <antcall target="prepare-compile"/>
- <javac includeantruntime="false" encoding="UTF-8" fork="true" srcdir="${plugin.dir}/${mobile.dir}/src" destdir="build" debug="on" memorymaximumsize="128m">
- <classpath refid="plugin-classpath" />
- </javac>
- <antcall target="create-mobile-jar"/>
- </target>
-
- <target name="wearable-compile">
- <echo message="compiling wearable profile plugin jar" />
- <antcall target="prepare-compile"/>
- <javac includeantruntime="false" encoding="UTF-8" fork="true" srcdir="${plugin.dir}/${wearable.dir}/src" destdir="build" debug="on" memorymaximumsize="128m">
- <classpath refid="plugin-classpath" />
- </javac>
- <antcall target="create-wearable-jar"/>
- </target>
-
-
- <target name="compile" depends="prepare-compile, common-compile, mobile-compile, wearable-compile" />
- <target name="all" depends="compile">
- <delete dir="build" />
- </target>
- <target name="mobile" depends="common-compile, mobile-compile">
- <delete dir="build" />
- </target>
-
- <target name="wearable" depends="common-compile, wearable-compile">
- <delete dir="build" />
+ <target name="all" depends="prepare-compile, common-compile">
+ <delete dir="${build.dir}" />
</target>
<!-- for dibs system... -->
<fileset dir="${classpath.dibs}" includes="${jna.file}" />
</path>
- <path id="plugin-classpath-dibs">
- <fileset dir="${classpath.dibs}" includes="${swt.file}" />
- <fileset dir="${common.dir}" includes="emulator-manager.jar" />
- </path>
-
<target name="common-compile-dibs" depends="make-properties">
<echo message="compiling emulator manager jar" />
<antcall target="prepare-compile"/>
- <javac includeantruntime="false" encoding="UTF-8" fork="true" srcdir="${common.dir}/src:${common.dir}/jaxb_src" destdir="build" debug="on" memorymaximumsize="128m">
+ <javac includeantruntime="false" encoding="UTF-8" fork="true" srcdir="${common.dir}/src:${common.dir}/jaxb_src" destdir="${build.dir}" debug="on" memorymaximumsize="128m">
<classpath refid="common-classpath-dibs" />
</javac>
<antcall target="create-common-jar"/>
</target>
- <target name="mobile-compile-dibs">
- <echo message="compiling mobile profile plugin jar" />
- <antcall target="prepare-compile"/>
- <javac includeantruntime="false" encoding="UTF-8" fork="true" srcdir="${plugin.dir}/${mobile.dir}/src" destdir="build" debug="on" memorymaximumsize="128m">
- <classpath refid="plugin-classpath-dibs" />
- </javac>
- <antcall target="create-mobile-jar"/>
- </target>
-
-
- <target name="wearable-compile-dibs">
- <echo message="compiling wearable profile plugin jar" />
- <antcall target="prepare-compile"/>
- <javac includeantruntime="false" encoding="UTF-8" fork="true" srcdir="${plugin.dir}/${wearable.dir}/src" destdir="build" debug="on" memorymaximumsize="128m">
- <classpath refid="plugin-classpath-dibs" />
- </javac>
- <antcall target="create-wearable-jar"/>
- </target>
-
-
- <target name="compile-dibs" depends="common-compile-dibs, mobile-compile-dibs, wearable-compile-dibs" />
- <target name="make-jar-dibs" depends="compile-dibs">
- <delete dir="build" />
+ <target name="make-jar-dibs" depends="common-compile-dibs" >
+ <delete dir="${build.dir}" />
</target>
</project>
<classpathentry kind="src" path="jaxb_src"/>
<classpathentry kind="src" path="resource"/>
<classpathentry exported="true" kind="lib" path="lib/swt.jar" sourcepath="lib/src.zip"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.7.0_51"/>
- <classpathentry exported="true" kind="lib" path="lib/jsch-0.1.50.jar"/>
+ <classpathentry kind="lib" path="lib/jsch-0.1.50.jar"/>
<classpathentry kind="lib" path="lib/protobuf.jar"/>
<classpathentry kind="lib" path="lib/jna-4.1.0.jar"/>
<classpathentry kind="lib" path="lib/jna-platform-4.1.0.jar"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>
{
cd $SRCDIR
ant -buildfile build.xml -Dclasspath.dibs=${ROOTDIR}/tools/emulator/bin make-jar-dibs
- #ant -buildfile common-project/build.xml -Dclasspath.dibs=${ROOTDIR}/tools/emulator/bin make-jar-dibs
- #ant -buildfile plugin-project/mobile-plugin/build.xml -Dclasspath.dibs=${ROOTDIR}/tools/emulator/bin -Dem.dir=${SRCDIR}/common-project make-jar-dibs
- #ant -buildfile plugin-project/ivi-plugin/build.xml -Dclasspath.dibs=${ROOTDIR}/tools/emulator/bin -Dem.dir=${SRCDIR}/common-project make-jar-dibs
}
# install
cp $SRCDIR/common-project/supplement/emulator-manager.sh $BIN_DIR/bin/emulator-manager
cp $SRCDIR/common-project/supplement/em-cli.sh $BIN_DIR/bin/em-cli
cp $SRCDIR/common-project/resource/res/em.ico $BIN_DIR/icons
-
- RESOURCES_DIR=$SRCDIR/package/mobile-2.4-emulator-manager-resources.package.$TARGET_OS/data/platforms/mobile-2.4/emulator-resources
- mkdir -p $RESOURCES_DIR/template
- mkdir -p $RESOURCES_DIR/plugins
- cp $SRCDIR/template/x86-standard.xml $RESOURCES_DIR/template/x86-standard.xml
- cp $SRCDIR/template/x86-standard-template.xml $RESOURCES_DIR/template/x86-standard-template.xml
- mv $SRCDIR/plugin-project/mobile-plugin/em-plugin.jar $RESOURCES_DIR/plugins/em-plugin.jar
-
- W_RESOURCES_DIR=$SRCDIR/package/wearable-2.4-emulator-manager-resources.package.$TARGET_OS/data/platforms/wearable-2.4/emulator-resources
- mkdir -p $W_RESOURCES_DIR/template
- mkdir -p $W_RESOURCES_DIR/plugins
- cp $SRCDIR/template/w-x86-standard.xml $W_RESOURCES_DIR/template/x86-standard.xml
- cp $SRCDIR/template/w-x86-standard-template.xml $W_RESOURCES_DIR/template/x86-standard-template.xml
- mv $SRCDIR/plugin-project/wearable-plugin/em-plugin.jar $W_RESOURCES_DIR/plugins/em-plugin.jar
}
[ "$1" = "clean" ] && clean
fi
mv $SRCDIR/emulator-manager.app $BIN_DIR/bin
-
- RESOURCES_DIR=$SRCDIR/package/mobile-2.4-emulator-manager-resources.package.$TARGET_OS/data/platforms/mobile-2.4/emulator-resources
- mkdir -p $RESOURCES_DIR/template
- mkdir -p $RESOURCES_DIR/plugins
- cp $SRCDIR/template/x86-standard.xml $RESOURCES_DIR/template/x86-standard.xml
- cp $SRCDIR/template/x86-standard-template.xml $RESOURCES_DIR/template/x86-standard-template.xml
- mv $SRCDIR/plugin-project/mobile-plugin/em-plugin.jar $RESOURCES_DIR/plugins/em-plugin.jar
-
- W_RESOURCES_DIR=$SRCDIR/package/wearable-2.4-emulator-manager-resources.package.$TARGET_OS/data/platforms/wearable-2.4/emulator-resources
- mkdir -p $W_RESOURCES_DIR/template
- mkdir -p $W_RESOURCES_DIR/plugins
- cp $SRCDIR/template/w-x86-standard.xml $W_RESOURCES_DIR/template/x86-standard.xml
- cp $SRCDIR/template/w-x86-standard-template.xml $W_RESOURCES_DIR/template/x86-standard-template.xml
- mv $SRCDIR/plugin-project/wearable-plugin/em-plugin.jar $W_RESOURCES_DIR/plugins/em-plugin.jar
}
[ "$1" = "clean" ] && clean
cp $SRCDIR/emulator-manager.exe $BIN_DIR/bin/emulator-manager.exe
cp $SRCDIR/common-project/supplement/em-cli.bat $BIN_DIR/bin/em-cli.bat
cp $SRCDIR/common-project/resource/res/em.ico $BIN_DIR/icons
-
- RESOURCES_DIR=$SRCDIR/package/mobile-2.4-emulator-manager-resources.package.$TARGET_OS/data/platforms/mobile-2.4/emulator-resources
- W_RESOURCES_DIR=$SRCDIR/package/wearable-2.4-emulator-manager-resources.package.$TARGET_OS/data/platforms/wearable-2.4/emulator-resources
- mkdir -p $RESOURCES_DIR/template
- mkdir -p $RESOURCES_DIR/plugins
- mkdir -p $W_RESOURCES_DIR/template
- mkdir -p $W_RESOURCES_DIR/plugins
-
- cp $SRCDIR/template/x86-standard.xml $RESOURCES_DIR/template/x86-standard.xml
- cp $SRCDIR/template/x86-standard-template.xml $RESOURCES_DIR/template/x86-standard-template.xml
- mv $SRCDIR/plugin-project/mobile-plugin/em-plugin.jar $RESOURCES_DIR/plugins/em-plugin.jar
- cp $SRCDIR/template/w-x86-standard.xml $W_RESOURCES_DIR/template/x86-standard.xml
- cp $SRCDIR/template/w-x86-standard-template.xml $W_RESOURCES_DIR/template/x86-standard-template.xml
- mv $SRCDIR/plugin-project/wearable-plugin/em-plugin.jar $W_RESOURCES_DIR/plugins/em-plugin.jar
}
[ "$1" = "clean" ] && clean
Package: emulator-manager
OS: ubuntu-32
Build-host-os: ubuntu-32
-Build-dependency: emulator-lib [ ubuntu-32 ]
+Build-dependency: emulator-manager-lib
Description: Tizen Emulator Manager
Package: emulator-manager
OS: ubuntu-64
Build-host-os: ubuntu-64
-Build-dependency: emulator-lib [ ubuntu-64 ]
+Build-dependency: emulator-manager-lib
Description: Tizen Emulator Manager
Package: emulator-manager
OS: windows-32, windows-64
Build-host-os: windows-32
-Build-dependency: emulator-lib-dev [ windows-32 ], emulator-lib [ windows-32 ]
+Build-dependency: emulator-lib-dev [ windows-32 ], emulator-manager-lib [ windows-32 ]
Description: Tizen Emulator Manager
Package: emulator-manager
OS: macos-64
Build-host-os: macos-64
-Build-dependency: emulator-lib [ macos-64 ]
+Build-dependency: emulator-manager-lib
Description: Tizen Emulator Manager
-
-Package: mobile-2.4-emulator-manager-resources
-OS: ubuntu-32
-Build-host-os: ubuntu-32
-Description: Emulator Manager Platform Resources
-
-Package: mobile-2.4-emulator-manager-resources
-OS: ubuntu-64
-Build-host-os: ubuntu-64
-Description: Emulator Manager Platform Resources
-
-Package: mobile-2.4-emulator-manager-resources
-OS: windows-32, windows-64
-Build-host-os: windows-32
-Description: Emulator Manager Platform Resources
-
-Package: mobile-2.4-emulator-manager-resources
-OS: macos-64
-Build-host-os: macos-64
-Description: Emulator Manager Platform Resources
-
-Package: wearable-2.4-emulator-manager-resources
-OS: ubuntu-32
-Build-host-os: ubuntu-32
-Description: Emulator Manager Platform Resources
-
-Package: wearable-2.4-emulator-manager-resources
-OS: ubuntu-64
-Build-host-os: ubuntu-64
-Description: Emulator Manager Platform Resources
-
-Package: wearable-2.4-emulator-manager-resources
-OS: windows-32, windows-64
-Build-host-os: windows-32
-Description: Emulator Manager Platform Resources
-
-Package: wearable-2.4-emulator-manager-resources
-OS: macos-64
-Build-host-os: macos-64
-Description: Emulator Manager Platform Resources
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry combineaccessrules="false" kind="src" path="/EmulatorManager"/>
- <classpathentry kind="lib" path="/EmulatorManager/lib/swt.jar" sourcepath="/EmulatorManager/lib/src.zip"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>mobile-plugin</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
+++ /dev/null
-/*
- * Emulator Manager
- *
- * Copyright (C) 2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * JiHye Kim <jihye1128.kim@samsung.com>
- * SeokYeon Hwang <syeon.hwang@samsung.com>
- * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-package org.tizen.emulator.manager.mobile.ui.detail;
-
-import java.util.List;
-
-import org.tizen.emulator.manager.EmulatorManager;
-import org.tizen.emulator.manager.EmulatorManager.ManagerModeType;
-import org.tizen.emulator.manager.ui.detail.item.CommonItemListFactory;
-import org.tizen.emulator.manager.ui.detail.item.IViewItem;
-import org.tizen.emulator.manager.ui.detail.item.ItemType;
-import org.tizen.emulator.manager.ui.detail.item.LineLabelViewItem;
-import org.tizen.emulator.manager.ui.detail.item.template.CheckLabelViewItem;
-import org.tizen.emulator.manager.ui.detail.item.template.ComboViewItem;
-import org.tizen.emulator.manager.ui.detail.item.template.FileViewItem;
-import org.tizen.emulator.manager.ui.detail.item.template.LabelViewItem;
-import org.tizen.emulator.manager.ui.detail.item.template.OnOffViewItem;
-import org.tizen.emulator.manager.ui.detail.item.template.TextViewItem;
-import org.tizen.emulator.manager.vms.helper.CheckingRunningEmulator;
-import org.tizen.emulator.manager.vms.xml.template.DeviceList;
-import org.tizen.emulator.manager.vms.xml.template.Item;
-import org.tizen.emulator.manager.vms.xml.template.ItemList;
-
-public class ItemListFactory extends CommonItemListFactory {
-
- private static String ITEM_EXPERIMENTAL = "experimental";
-
- private static void makeItemListOld(List<? extends IViewItem> list) {
- List<IViewItem> itemList = (List<IViewItem>)list;
-
- itemList.add(new TNameTextItem());
- itemList.add(new TDisplayItem());
- itemList.add(new TRAMItem());
- itemList.add(new TTouchPointItem());
- if (EmulatorManager.getManagerMode() == ManagerModeType.INHOUSE_MODE) {
- itemList.add(new TSupportSuspendItem());
- }
-
- itemList.add(new TFileShareItem());
- itemList.add(new THWSupportItem());
-
- }
-
- @Override
- public void makeItemList(List<? extends IViewItem> itemList,
- ItemList template) {
- if (template == null) {
- makeItemListOld(itemList); // TODO old
- } else {
- makePropertyItemList(itemList, template.getPropertyList(), template.getProfile(), true);
- makeDeviceItemList(itemList, template.getDeviceList());
-
- }
- }
-
- // Override if need
- public void makeDeviceItemList(List<? extends IViewItem> list, DeviceList deviceList) {
-
- if (deviceList != null) {
- List<IViewItem> itemList = (List<IViewItem>)list;
- List<Item> deviceItemList = deviceList.getItem();
- LineLabelViewItem currentLineLabel = null; // Top categorizing item
- boolean isExperimentalItem = false;
-
- for (Item item : deviceItemList) {
- String type = item.getType();
- String name = item.getName();
-
- if (isExperimentalItem && EmulatorManager.getManagerMode() != ManagerModeType.INHOUSE_MODE) {
- continue;
- }
-
- if (name.equals(CheckingRunningEmulator.OPTION_VIEWER)) {
- if (EmulatorManager.isLinux()) {
- itemList.add(new LabelViewItem(item, currentLineLabel));
- }
- continue;
- }
-
- if (type.equals(ItemType.LINE_LABEL.getName())) { // Top categorizing item
- if (name.equals(ITEM_EXPERIMENTAL)) {
- isExperimentalItem = true;
- if (EmulatorManager.getManagerMode() == ManagerModeType.INHOUSE_MODE) {
- currentLineLabel = new LineLabelViewItem(item);
- itemList.add(currentLineLabel);
- }
- } else {
- currentLineLabel = new LineLabelViewItem(item);
- itemList.add(currentLineLabel);
- isExperimentalItem = false;
- }
-
- } else if (type.equals(ItemType.TOGGLE.getName())) {
- itemList.add(new OnOffViewItem(item, currentLineLabel));
-
- } else if (type.equals(ItemType.LABEL.getName())) {
- itemList.add(new LabelViewItem(item, currentLineLabel));
-
- } else if (type.equals(ItemType.COMBO.getName())) {
- itemList.add(new ComboViewItem(item, currentLineLabel));
-
- } else if (type.equals(ItemType.FILE.getName())) {
- itemList.add(new FileViewItem(item, currentLineLabel));
-
- } else if (type.equals(ItemType.CHECK_LABEL.getName())) {
- itemList.add(new CheckLabelViewItem(item, currentLineLabel));
-
- } else if (type.equals(ItemType.TEXT.getName())) {
- itemList.add(new TextViewItem(item, currentLineLabel));
- }
- }
- }
- }
-
-
- @Override
- public void makeCustomItemList(List<? extends IViewItem> itemList,
- List<ItemList> templateList) {
- if (templateList == null || templateList.size() == 0) {
- makeItemListOld(itemList); // TODO old
- } else {
-
- makeCustomDeviceItemList(itemList, templateList);
- }
- }
-}
+++ /dev/null
-/*
- * Emulator Manager
- *
- * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * JiHye Kim <jihye1128.kim@samsung.com>
- * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
- * SeokYeon Hwang <syeon.hwang@samsung.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-package org.tizen.emulator.manager.mobile.ui.detail;
-import java.util.ArrayList;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyAdapter;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.widgets.Spinner;
-import org.tizen.emulator.manager.EmulatorManager;
-import org.tizen.emulator.manager.EmulatorManager.ManagerModeType;
-import org.tizen.emulator.manager.logging.EMLogger;
-import org.tizen.emulator.manager.platform.Skin;
-import org.tizen.emulator.manager.platform.SkinList;
-import org.tizen.emulator.manager.resources.ColorResources;
-import org.tizen.emulator.manager.resources.FontResources;
-import org.tizen.emulator.manager.resources.ImageResources;
-import org.tizen.emulator.manager.resources.PatchImageResources;
-import org.tizen.emulator.manager.ui.detail.item.DetailViewItem;
-import org.tizen.emulator.manager.ui.detail.item.ItemChangeState;
-import org.tizen.emulator.manager.ui.widgets.ImageCombo;
-import org.tizen.emulator.manager.ui.widgets.ImageLabel;
-import org.tizen.emulator.manager.ui.widgets.WSTATE;
-import org.tizen.emulator.manager.vms.RESOLUTION;
-import org.tizen.emulator.manager.vms.SKIN_TYPE;
-import org.tizen.emulator.manager.vms.VMPropertyValue;
-
-public class TDisplayItem extends DetailViewItem {
- private RESOLUTION oldResolution;
- private RESOLUTION newResolution;
- private int oldDPI;
- private int newDPI;
- private Skin oldSkin;
- private Skin newSkin;
-
- private ArrayList<Skin> skinList;
-
- @Override
- public void init() {
- title = "Display";
- count = 3;
- }
-
- @Override
- public void setValue(VMPropertyValue value) {
- value.resolution = newResolution;
- value.dpi = newDPI;
- value.skin = newSkin;
- if (newSkin != null) {
- value.skinPath = newSkin.getPath();
- } else {
- value.skinPath = null;
- }
- }
-
- private ImageLabel reCategory;
- private ImageLabel dpiCategory;
- private ImageLabel skinCategory;
- private ImageLabel resolution;
- private ImageLabel dpi;
- private ImageLabel skin;
-
- private static int CATEGORY_WIDTH = 66;
- private static int INPUTBOX_WIDTH = 105;
- private static Image CATEGORY_IMAGE = null;
- private static Image INPUTBOX_ON_IMAGE = null;
- private static Image INPUTBOX_OFF_IMAGE = null;
-
- private void drawCategory() {
- if (CATEGORY_IMAGE == null) {
- CATEGORY_IMAGE = PatchImageResources.getCategoryBox(CATEGORY_WIDTH);
- }
-
- reCategory = new ImageLabel(compList.get(0), SWT.NONE);
- reCategory.setText("Resolution");
- reCategory.setEnableImage(CATEGORY_IMAGE);
- reCategory.setFont(FontResources.DETAIL_LABEL_FONT.getFont());
- reCategory.setEnableFontColor(ColorResources.DETAIL_CATEGORY_FONT_COLOR.getColor());
- FormData data = new FormData();
- data.left = new FormAttachment(0, INPUTBOX_OFFSET);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP + 1);
- data.width = reCategory.getSize().x;
- data.height = reCategory.getSize().y;
- reCategory.setLayoutData(data);
-
- dpiCategory = new ImageLabel(compList.get(1), SWT.NONE);
- dpiCategory.setText("Density");
- dpiCategory.setEnableImage(CATEGORY_IMAGE);
- dpiCategory.setFont(FontResources.DETAIL_LABEL_FONT.getFont());
- dpiCategory.setEnableFontColor(ColorResources.DETAIL_CATEGORY_FONT_COLOR.getColor());
- data = new FormData();
- data.left = new FormAttachment(0, INPUTBOX_OFFSET);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP + 1);
- data.width = dpiCategory.getSize().x;
- data.height = dpiCategory.getSize().y;
- dpiCategory.setLayoutData(data);
-
- skinCategory = new ImageLabel(compList.get(2), SWT.NONE);
- skinCategory.setText("Skin");
- skinCategory.setEnableImage(CATEGORY_IMAGE);
- skinCategory.setFont(FontResources.DETAIL_LABEL_FONT.getFont());
- skinCategory.setEnableFontColor(ColorResources.DETAIL_CATEGORY_FONT_COLOR.getColor());
-
- data = new FormData();
- data.left = new FormAttachment(0, INPUTBOX_OFFSET);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP + 1);
- data.width = skinCategory.getSize().x;
- data.height = skinCategory.getSize().y;
- skinCategory.setLayoutData(data);
- }
-
- @Override
- public void drawDetail() {
- drawCategory();
-
- if (INPUTBOX_OFF_IMAGE == null) {
- INPUTBOX_OFF_IMAGE = PatchImageResources.getInputBoxOff(INPUTBOX_WIDTH);
- }
-
- resolution = new ImageLabel(compList.get(0), SWT.NONE);
- resolution.setEnableImage(INPUTBOX_OFF_IMAGE);
-
- FormData data = new FormData();
- data.left = new FormAttachment(reCategory, 4);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP);
- data.width = resolution.getSize().x;
- data.height = resolution.getSize().y;
- resolution.setLayoutData(data);
-
- dpi = new ImageLabel(compList.get(1), SWT.NONE);
- dpi.setEnableImage(INPUTBOX_OFF_IMAGE);
-
- data = new FormData();
- data.left = new FormAttachment(dpiCategory, 4);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP);
- data.width = dpi.getSize().x;
- data.height = dpi.getSize().y;
- dpi.setLayoutData(data);
-
- skin = new ImageLabel(compList.get(2), SWT.NONE);
- skin.setEnableImage(INPUTBOX_OFF_IMAGE);
-
- data = new FormData();
- data.left = new FormAttachment(skinCategory, 4);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP);
- data.width = skin.getSize().x;
- data.height = skin.getSize().y;
- skin.setLayoutData(data);
- }
-
- private ImageCombo reCombo = null;
- private Spinner dpiSpinner = null;
- private ImageCombo skinCombo = null;
- @Override
- public void drawModify() {
- drawCategory();
-
- if (INPUTBOX_ON_IMAGE == null) {
- INPUTBOX_ON_IMAGE = PatchImageResources.getInputBoxON(INPUTBOX_WIDTH);
- }
-
- reCombo = new ImageCombo(compList.get(0), SWT.NONE);
- reCombo.setImage(WSTATE.NORMAL, INPUTBOX_ON_IMAGE);
- reCombo.setImage(WSTATE.PUSH, INPUTBOX_ON_IMAGE);
- reCombo.setImage(WSTATE.HOVER, INPUTBOX_ON_IMAGE);
-
- reCombo.setArrowButtonImage(ImageResources.ARROW_DROPDOWN.getImage());
- reCombo.setEnabled(true);
- reCombo.setItemHeight(INPUTBOX_ON_IMAGE.getImageData().height);
-
- FormData data = new FormData();
- data.left = new FormAttachment(reCategory, 4);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP);
- data.width = INPUTBOX_ON_IMAGE.getImageData().width;
- data.height = INPUTBOX_ON_IMAGE.getImageData().height;
- reCombo.setLayoutData(data);
-
- dpi = new ImageLabel(compList.get(1), SWT.NONE);
- dpi.setEnableImage(INPUTBOX_ON_IMAGE);
-
- data = new FormData();
- data.left = new FormAttachment(dpiCategory, 4);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP);
- data.width = dpi.getSize().x;
- data.height = dpi.getSize().y;
- dpi.setLayoutData(data);
-
- dpi.setLayout(new FormLayout());
-
- dpiSpinner = new Spinner(dpi, SWT.NONE);
- dpiSpinner.setValues(0, 0, 999, 0, 1, 1);
- dpiSpinner.setTextLimit(3);
-
- dpiSpinner.setBackground(ColorResources.DETAIL_INPUT_BOX_COLOR.getColor());
- dpiSpinner.setFont(FontResources.DETAIL_LABEL_FONT.getFont());
- dpiSpinner.setForeground(ColorResources.DETAIL_ENABLE_FONT_COLOR.getColor());
-
- data = new FormData();
- data.left = new FormAttachment(0, 5);
- data.top = new FormAttachment(0, 1);
- data.right = new FormAttachment(100, -2);
- data.bottom = new FormAttachment(100, -2);
- dpiSpinner.setLayoutData(data);
-
-
- skinCombo = new ImageCombo(compList.get(2), SWT.NONE);
- skinCombo.setImage(WSTATE.NORMAL, INPUTBOX_ON_IMAGE);
- skinCombo.setImage(WSTATE.PUSH, INPUTBOX_ON_IMAGE);
- skinCombo.setImage(WSTATE.HOVER, INPUTBOX_ON_IMAGE);
-
- skinCombo.setArrowButtonImage(ImageResources.ARROW_DROPDOWN.getImage());
- skinCombo.setEnabled(true);
- skinCombo.setItemHeight(INPUTBOX_ON_IMAGE.getImageData().height);
-
- data = new FormData();
- data.left = new FormAttachment(skinCategory, 4);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP);
- data.width = INPUTBOX_ON_IMAGE.getImageData().width;
- data.height = INPUTBOX_ON_IMAGE.getImageData().height;
- skinCombo.setLayoutData(data);
-
- addWidgetListener();
- }
-
- private void addWidgetListener() {
- reCombo.addSelectionListener(new SelectionListener() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- String re = reCombo.getText();
- reCombo.setToolTipText(reCombo.getText());
-
- RESOLUTION d = DisplayResolution.getInstance().findResolution(re);
- if (d != null) {
- EMLogger.getLogger().fine("Change Resolution -> " + d.getStrTypeValue());
- newResolution = d;
- changeResolution(d);
- }
-
- if (!isCreateMode()) {
- getListener().ChangeValue(getThis());
- }
- }
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- // TODO Auto-generated method stub
-
- }
- });
-
- dpiSpinner.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- newDPI = dpiSpinner.getSelection();
- if (!isCreateMode()) {
- getListener().ChangeValue(getThis());
- }
- }
- });
-
- dpiSpinner.addKeyListener(new KeyAdapter() {
- public void keyPressed(KeyEvent event) {
- switch (event.keyCode) {
- case SWT.CR:
- case SWT.KEYPAD_CR:
- ///TODO
- getListener().ChangeState(ItemChangeState.CREATE);
- break;
- case SWT.ESC:
- getListener().ChangeState(ItemChangeState.CANCEL);
- break;
- default:
- // TODO
- break;
- }
- }
- });
-
- skinCombo.addSelectionListener(new SelectionListener() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- String name = skinCombo.getText();
- skinCombo.setToolTipText(skinCombo.getText());
-
- newSkin = SkinList.getInstance().findSkinUseName(name, skinList);
- if (newSkin == null && name.equals(oldSkin.toString())) {
- newSkin = oldSkin;
- }
-
- if (!isCreateMode()) {
- getListener().ChangeValue(getThis());
- }
- }
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- // TODO Auto-generated method stub
-
- }
- });
- }
-
- @Override
- public void closeItem() {
- reCategory.dispose();
- dpiCategory.dispose();
- skinCategory.dispose();
- if (resolution != null) {
- resolution.dispose();
- }
- if (dpi != null) {
- dpi.dispose();
- }
- if (skin != null) {
- skin.dispose();
- }
-
- if (reCombo != null) {
- reCombo.dispose();
- }
-
- if (dpiSpinner != null) {
- dpiSpinner.dispose();
- }
-
- if (skinCombo != null) {
- skinCombo.dispose();
- }
- }
-
- @Override
- public boolean settingDetailItem(VMPropertyValue value) {
- resolution.setText(value.resolution.getStrTypeValue());
- resolution.setToolTipText(value.resolution.getStrTypeValue());
-
- dpi.setText(Integer.toString(value.dpi));
-
- skinList = value.baseImage.getPlatform().getSkins();
- if (value.skin != null) {
- skin.setText(value.skin.getName());
- skin.setToolTipText(value.skin.getName());
- } else {
- if (value.skinPath != null) {
- value.skin = SkinList.getInstance().findSkinUsePath(value.skinPath, skinList);
- }
- if (value.skin != null) {
- skin.setText(value.skin.getName());
- skin.setToolTipText(value.skin.getName());
- } else {
- skin.setText("");
- skin.setToolTipText("check skin directory: ." + (value.skinPath == null ? "" : value.skinPath));
- }
- }
- return false;
- }
-
- @Override
- public boolean settingModifyItem(VMPropertyValue value) {
- oldResolution = newResolution = value.resolution;
- newDPI = oldDPI = value.dpi;
- newSkin = oldSkin = value.skin;
- skinList = value.baseImage.getPlatform().getSkins();
-
- //RESOLUTION
- if (value.baseName == null || value.baseName != null && value.baseName.equals("x86")) {
- DisplayResolution.getInstance().initializeCustom(oldResolution);
- } else if (value.baseName != null && value.baseName.equals("x86-standard")) {
- DisplayResolution.getInstance().initialize(oldResolution);
- } else {
-// oldResolution = newResolution = RESOLUTION.WVGA;
- DisplayResolution.getInstance().initializeWVGA(oldResolution);
- }
- reCombo.removeAll();
-
- String r = null;
- int f = -1;
- for (int i = 0; i < DisplayResolution.getInstance().getList().length; i++) {
- r = DisplayResolution.getInstance().get(i);
- if (r.equals(oldResolution.toString())) {
- f = i;
- }
- reCombo.add(r);
- }
-
- if (f == -1) {
- reCombo.add(oldResolution.toString(), 0);
- f = 0;
- }
- reCombo.select(f);
- reCombo.setToolTipText(reCombo.getText());
-
- // DPI
- dpiSpinner.setSelection(value.dpi);
- if (!isCreateMode()) {
- dpiSpinner.setFocus();
- }
-
- // SKIN
-// if (value.baseName == null || value.baseName != null &&
-// ( value.baseName.equals("x86-standard") || value.baseName.equals("x86") )) {
-// settingSkinList(value.resolution);
-// } else {
-// settingSkinList(RESOLUTION.WVGA);
-// }
- settingSkinList(value.resolution);
-
- return true;
- }
-
- private void settingSkinList(RESOLUTION re) {
- skinCombo.removeAll();
-
- int find = -1;
- ArrayList<Skin> skins = null;
-
- if (!isCreateMode()
- && !DisplayResolution.getInstance().isMinResoluion(re)
- && EmulatorManager.getManagerMode() != ManagerModeType.INHOUSE_MODE) {
- if (oldSkin != null) {
- EMLogger.getLogger().fine("Add old skin: " + oldSkin.toString());
- skinCombo.add(oldSkin.toString());
- find = 0;
- }
- } else {
- skins = SkinList.getInstance().findSkinList(re, skinList);
-
- Skin s = null;
- for (int i = 0; i < skins.size(); i++) {
- s = skins.get(i);
- if (newSkin != null && newSkin.equals(s)) {
- find = i;
- }
- skinCombo.add(s.toString());
- }
-
- if (find == -1) {
- if (newSkin != null
- && newSkin.getType() == SKIN_TYPE.GENERAL) {
- skins.add(0, newSkin);
- skinCombo.add(newSkin.toString(), 0);
- }
- if (skins.size() > 0) {
- find = 0;
- }
- }
- }
-
- if (find >= 0) {
- skinCombo.select(find);
- skinCombo.setToolTipText(skinCombo.getText());
- newSkin = skins == null ? oldSkin : skins.get(find);
- } else {
- EMLogger.getLogger().warning("To initial Skin Combo has been failed.");
- }
- }
-
- private void changeResolution(RESOLUTION re) {
- // DPI
- if (!DisplayResolution.getInstance().isMinResoluion(re)
- && EmulatorManager.getManagerMode() != ManagerModeType.INHOUSE_MODE) {
- EMLogger.getLogger().fine("Emulator Manager does not support this resolution -> " + re.getStrTypeValue());
- dpiSpinner.setSelection(oldDPI);
- } else {
- dpiSpinner.setSelection(re.getDPI());
- }
-
- // SKIN
- settingSkinList(re);
- }
-
- private static boolean isShareMinMode = false;
-
- @Override
- protected void changeArrowState() {
- super.changeArrowState();
- isShareMinMode = isMinMode;
- }
-
- @Override
- public void settingStatus(boolean isRefresh) {
- if (isRefresh) {
- if (isMinMode) {
- arrowButton.setSelection(false);
- changeArrowState();
- }
- } else {
- if (isShareMinMode != isMinMode) {
- arrowButton.setSelection(isShareMinMode);
- changeArrowState();
- }
- }
- if (!isCreateMode() && dpiSpinner != null) {
- dpiSpinner.setFocus();
- }
- }
-
- @Override
- public boolean checkValue() {
- return true;
- }
-}
+++ /dev/null
-/*
- * Emulator Manager
- *
- * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * JiHye Kim <jihye1128.kim@samsung.com>
- * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
- * SeokYeon Hwang <syeon.hwang@samsung.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-package org.tizen.emulator.manager.mobile.ui.detail;
-
-import java.io.File;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.widgets.DirectoryDialog;
-import org.eclipse.swt.widgets.Label;
-import org.tizen.emulator.manager.EmulatorManager;
-import org.tizen.emulator.manager.EmulatorManager.ManagerModeType;
-import org.tizen.emulator.manager.logging.EMLogger;
-import org.tizen.emulator.manager.resources.ColorResources;
-import org.tizen.emulator.manager.resources.FontResources;
-import org.tizen.emulator.manager.resources.ImageResources;
-import org.tizen.emulator.manager.resources.PatchImageResources;
-import org.tizen.emulator.manager.resources.StringResources;
-import org.tizen.emulator.manager.ui.MainDialog;
-import org.tizen.emulator.manager.ui.detail.item.DetailViewItem;
-import org.tizen.emulator.manager.ui.widgets.ImageButton;
-import org.tizen.emulator.manager.ui.widgets.ImageLabel;
-import org.tizen.emulator.manager.vms.VMPropertyValue;
-
-public class TFileShareItem extends DetailViewItem {
- private boolean oldSupport;
- private boolean newSupport;
-
- private String newPath;
- private String oldPathName;
- private String newPathName;
- private DirectoryDialog sharedFD;
-
- @Override
- public void init() {
- title = "File Sharing";
- count = 2;
- }
-
- @Override
- public void setValue(VMPropertyValue value) {
- value.isFileShareSupport = newSupport;
-
- value.fileSharePath = newPath;
- value.fileSharePathName = newPathName;
- }
-
-
- private ImageLabel supportLabel;
- private ImageLabel dirCategory;
- private ImageLabel directoryLabel;
-
- private static int INPUTBOX_WIDTH = 175;
- private static int DIR_CATEGORY_WIDTH = 66;
- private static int DIR_INPUTBOX_OFF_WIDTH = 105;
- // for modify
- private static int DIR_INPUTBOX_ON_WIDTH = 133;
-
- @Override
- public void drawDetail() {
- supportLabel = new ImageLabel(compList.get(0), SWT.NONE);
- supportLabel.setEnableImage(PatchImageResources.getInputBoxOff(INPUTBOX_WIDTH));
-
- dirCategory = new ImageLabel(compList.get(1), SWT.NONE);
- dirCategory.setText("Directory");
- dirCategory.setEnableImage(PatchImageResources.getCategoryBox(DIR_CATEGORY_WIDTH));
- dirCategory.setEnableFontColor(ColorResources.DETAIL_CATEGORY_FONT_COLOR.getColor());
-
- directoryLabel = new ImageLabel(compList.get(1), SWT.NONE);
- directoryLabel.setEnableImage(PatchImageResources.getInputBoxOff(DIR_INPUTBOX_OFF_WIDTH));
-
- FormData data = new FormData();
- data.left = new FormAttachment(0, INPUTBOX_OFFSET);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP);
- data.width = supportLabel.getSize().x;
- data.height = supportLabel.getSize().y;
- supportLabel.setLayoutData(data);
-
- data = new FormData();
- data.left = new FormAttachment(0, INPUTBOX_OFFSET);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP + 1);
- data.width = dirCategory.getSize().x;
- data.height = dirCategory.getSize().y;
- dirCategory.setLayoutData(data);
-
- data = new FormData();
- data.left = new FormAttachment(dirCategory, 4);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP);
- data.width = directoryLabel.getSize().x;
- data.height = directoryLabel.getSize().y;
- directoryLabel.setLayoutData(data);
-
- comp.layout(true, true);
- }
-
- private Label stateLabel;
- private ImageButton selectSupport;
- private ImageButton selectDirButton;
-
- private static String toolTipforMac = "Please refer to file sharing section in SDK documentation.";
- @Override
- public void drawModify() {
-
- makeModifyWidget();
-
- FormData data = new FormData();
- data.left = new FormAttachment(0, INPUTBOX_OFFSET);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP);
- data.width = TOGGLE_BUTTON_WIDTH;
- data.height = TOGGLE_BUTTON_HEIGHT;
- selectSupport.setLayoutData(data);
-
- data = new FormData();
- data.left = new FormAttachment(selectSupport, 10);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP + 1);
- data.width = TOGGLE_BUTTON_WIDTH;
- stateLabel.setLayoutData(data);
-
- data = new FormData();
- data.left = new FormAttachment(0,INPUTBOX_OFFSET);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP);
- data.width = directoryLabel.getSize().x;
- data.height = directoryLabel.getSize().y;
- directoryLabel.setLayoutData(data);
-
- data = new FormData();
- data.left = new FormAttachment(directoryLabel, 5);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP);
- data.width = FILE_SELECT_BUTTON_WIDTH;
- data.height = FILE_SELECT_BUTTON_HEIGHT;
- selectDirButton.setLayoutData(data);
- }
-
- private void makeModifyWidget() {
- selectSupport = new ImageButton(compList.get(0), SWT.TOGGLE);
- selectSupport.setImages(ImageResources.TOGGLE_ON_NOMAL.getImage(),
- ImageResources.TOGGLE_ON_HOVER.getImage(),
- ImageResources.TOGGLE_ON_PUSH.getImage(),
- ImageResources.TOGGLE_OFF_NOMAL.getImage(),
- ImageResources.TOGGLE_OFF_HOVER.getImage(),
- ImageResources.TOGGLE_OFF_PUSH.getImage(),
- ImageResources.TOGGLE_OFF_PUSH.getImage()); //disable
-
- selectSupport.addSelectionListener(new SelectionListener() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- if (selectSupport.isSelection()) { // NOT SUPPORT
- newSupport = false;
- stateLabel.setText(StringResources.NOT_SUPPORTED);
- directoryLabel.setText("");
- selectDirButton.setEnabled(false);
- } else { // SUPPORT
- newSupport = true;
- stateLabel.setText(StringResources.SUPPORTED);
- directoryLabel.setText(newPathName);
- selectDirButton.setEnabled(true);
- }
- if (!isCreateMode()) {
- getListener().ChangeValue(getThis());
- }
- }
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- // TODO Auto-generated method stub
-
- }
-
- });
-
- stateLabel = new Label(compList.get(0), SWT.NONE);
- stateLabel.setFont(FontResources.DETAIL_LABEL_FONT.getFont());
- stateLabel.setForeground(ColorResources.DETAIL_ENABLE_FONT_COLOR.getColor());
- stateLabel.setBackground(ColorResources.DETAIL_MIDDLE_COLOR.getColor());
-
- directoryLabel = new ImageLabel(compList.get(1), SWT.NONE);
- directoryLabel.setEnableImage(PatchImageResources.getInputBoxON(DIR_INPUTBOX_ON_WIDTH));
- directoryLabel.setEnabled(false);
-
- selectDirButton = new ImageButton(compList.get(1), SWT.PUSH);
- selectDirButton.setImages(
- ImageResources.BUTTON_FILE_NOMAL.getImage(),
- ImageResources.BUTTON_FILE_HOVER.getImage(),
- ImageResources.BUTTON_FILE_PUSH.getImage(),
- ImageResources.BUTTON_FILE_DISABLE.getImage());
-
- selectDirButton.addSelectionListener(new SelectionListener() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- if (sharedFD == null) {
- sharedFD = new DirectoryDialog(
- MainDialog.getShell(), SWT.OPEN);
- sharedFD.setText("Select directory");
- }
-
- EMLogger.getLogger().fine("Open Directory Dialog");
- String path = sharedFD.open();
-
- if (path != null) {
- EMLogger.getLogger().fine("Select directory for FileShare: " + path);
- newPath = path;
- newPathName = path.substring(path
- .lastIndexOf(File.separator) + 1, path.length());
- directoryLabel.setText(newPathName);
- directoryLabel.setToolTipText(newPath);
-
- if (!isCreateMode()) {
- getListener().ChangeValue(getThis());
- }
- }
- }
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- // TODO Auto-generated method stub
-
- }
- });
- }
-
- @Override
- public boolean settingDetailItem(VMPropertyValue value) {
- supportLabel.setText(value.isFileShareSupport
- ? StringResources.SUPPORTED
- : StringResources.NOT_SUPPORTED);
-
- directoryLabel.setText(value.isFileShareSupport
- ? value.fileSharePathName
- : "");
- directoryLabel.setToolTipText(value.fileSharePath);
-
- return true;
- }
-
- @Override
- public boolean settingModifyItem(VMPropertyValue value) {
- newSupport = oldSupport = value.isFileShareSupport;
- newPath = value.fileSharePath;
- newPathName = oldPathName = value.fileSharePathName;
-
- if (oldSupport) {
- selectSupport.setSelection(false);
- stateLabel.setText(StringResources.SUPPORTED);
- directoryLabel.setText(oldPathName);
- directoryLabel.setToolTipText(newPath);
- selectDirButton.setEnabled(true);
- } else {
- selectSupport.setSelection(true);
- stateLabel.setText(StringResources.NOT_SUPPORTED);
- directoryLabel.setText(oldPathName);
- selectDirButton.setEnabled(false);
- }
-
- return true;
- }
-
- @Override
- public void closeItem() {
- if (supportLabel != null) {
- supportLabel.dispose();
- }
-
- if (dirCategory != null) {
- dirCategory.dispose();
- }
-
- if (directoryLabel != null) {
- directoryLabel.dispose();
- }
-
- if (stateLabel != null) {
- stateLabel.dispose();
- }
-
- if (selectSupport != null) {
- selectSupport.dispose();
- }
-
- if (selectDirButton != null) {
- selectDirButton.dispose();
- }
- }
-
- private static boolean isShareMinMode = false;
-
- @Override
- protected void changeArrowState() {
- super.changeArrowState();
- isShareMinMode = isMinMode;
- }
-
- @Override
- public void settingStatus(boolean isRefresh) {
- if (isRefresh) {
- if (isMinMode) {
- arrowButton.setSelection(false);
- changeArrowState();
- }
- } else {
- if (isShareMinMode != isMinMode) {
- arrowButton.setSelection(isShareMinMode);
- changeArrowState();
- }
- }
- }
-
- @Override
- public boolean checkValue() {
- return true;
- }
-
-}
+++ /dev/null
-/*
- * Emulator Manager
- *
- * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * JiHye Kim <jihye1128.kim@samsung.com>
- * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
- * SeokYeon Hwang <syeon.hwang@samsung.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-package org.tizen.emulator.manager.mobile.ui.detail;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.widgets.Label;
-import org.tizen.emulator.manager.resources.ColorResources;
-import org.tizen.emulator.manager.resources.FontResources;
-import org.tizen.emulator.manager.resources.ImageResources;
-import org.tizen.emulator.manager.resources.PatchImageResources;
-import org.tizen.emulator.manager.resources.StringResources;
-import org.tizen.emulator.manager.tool.CheckVirtualization;
-import org.tizen.emulator.manager.ui.detail.item.DetailViewItem;
-import org.tizen.emulator.manager.ui.widgets.ImageButton;
-import org.tizen.emulator.manager.ui.widgets.ImageLabel;
-import org.tizen.emulator.manager.vms.VMPropertyValue;
-
-public class THWSupportItem extends DetailViewItem {
- private boolean oldHWSupport;
- private boolean newHWSupport;
- private boolean oldGPUSupport;
- private boolean newGPUSupport;
-
- @Override
- public void init() {
- title = "HW Support";
- count = 2;
- }
-
- @Override
- public void setValue(VMPropertyValue value) {
- value.isHWVirtualization = newHWSupport;
- value.isGLAcceleration = newGPUSupport;
- }
-
- private ImageLabel virtualCategory;
- private ImageLabel GPUCategory;
-
- private ImageLabel virtualLabel;
- private ImageLabel GPULabel;
-
- private static int INPUTBOX_WIDTH = 105;
- private static int CATEGORY_WIDTH = 66;
-
- private static String GPUToolTipText = "If you enable the GPU option,"
- + StringResources.NEW_LINE
- + "the rendering performance of video player or camera may degrade.";
- private static String CPUDisableToolTipText = "Your system cannot support HW virtualization."
- + StringResources.NEW_LINE + "Try install KVM (linux) or HAX (windows or mac)";
- private static String GPUDisableToolTipText = "Your system cannot support HW OpenGL acceleration."
- + StringResources.NEW_LINE + "Try upgrade graphic card driver.";
- private void makeCategory() {
- virtualCategory = new ImageLabel(compList.get(0), SWT.NONE);
- virtualCategory.setEnableImage(PatchImageResources.getCategoryBox(CATEGORY_WIDTH));
- virtualCategory.setEnableFontColor(ColorResources.DETAIL_CATEGORY_FONT_COLOR.getColor());
- virtualCategory.setText("CPU VT");
-
- GPUCategory = new ImageLabel(compList.get(1), SWT.NONE);
- GPUCategory.setEnableImage(PatchImageResources.getCategoryBox(CATEGORY_WIDTH));
- GPUCategory.setEnableFontColor(ColorResources.DETAIL_CATEGORY_FONT_COLOR.getColor());
- GPUCategory.setText("GPU");
- GPUCategory.setToolTipText(GPUToolTipText);
-
- FormData data = new FormData();
- data.left = new FormAttachment(0, INPUTBOX_OFFSET);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP + 1);
- data.width = virtualCategory.getSize().x;
- data.height = virtualCategory.getSize().y;
- virtualCategory.setLayoutData(data);
-
- data = new FormData();
- data.left = new FormAttachment(0, INPUTBOX_OFFSET);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP + 1);
- data.width = GPUCategory.getSize().x;
- data.height = GPUCategory.getSize().y;
- GPUCategory.setLayoutData(data);
- }
-
- @Override
- public void drawDetail() {
- makeCategory();
-
- virtualLabel = new ImageLabel(compList.get(0), SWT.NONE);
- virtualLabel.setEnableImage(PatchImageResources.getInputBoxOff(INPUTBOX_WIDTH));
-
- GPULabel = new ImageLabel(compList.get(1), SWT.NONE);
- GPULabel.setEnableImage(PatchImageResources.getInputBoxOff(INPUTBOX_WIDTH));
- GPULabel.setToolTipText(GPUToolTipText);
-
- FormData data = new FormData();
- data.left = new FormAttachment(virtualCategory, 4);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP);
- data.width = virtualLabel.getSize().x;
- data.height = virtualLabel.getSize().y;
- virtualLabel.setLayoutData(data);
-
- data = new FormData();
- data.left = new FormAttachment(GPUCategory, 4);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP);
- data.width = GPULabel.getSize().x;
- data.height = GPULabel.getSize().y;
- GPULabel.setLayoutData(data);
- }
-
- private ImageButton virtualButton;
- private ImageButton GPUButton;
- private Label virtualState;
- private Label GPUState;
- @Override
- public void drawModify() {
- makeCategory();
- makeModifyWidget();
-
- FormData data = new FormData();
- data.left = new FormAttachment(virtualCategory, 4);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP);
- data.width = TOGGLE_BUTTON_WIDTH;
- data.height = TOGGLE_BUTTON_HEIGHT;
- virtualButton.setLayoutData(data);
-
- data = new FormData();
- data.left = new FormAttachment(virtualButton, 10);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP + 1);
- data.width = INPUTBOX_WIDTH - TOGGLE_BUTTON_WIDTH - INPUTBOX_RIGHT_GAP;
- virtualState.setLayoutData(data);
-
- data = new FormData();
- data.left = new FormAttachment(GPUCategory, 4);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP);
- data.width = TOGGLE_BUTTON_WIDTH;
- data.height = TOGGLE_BUTTON_HEIGHT;
- GPUButton.setLayoutData(data);
-
- data = new FormData();
- data.left = new FormAttachment(GPUButton, 10);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP + 1);
- data.width = INPUTBOX_WIDTH - TOGGLE_BUTTON_WIDTH - INPUTBOX_RIGHT_GAP;
- GPUState.setLayoutData(data);
- }
-
- private void makeModifyWidget() {
- virtualButton = new ImageButton(compList.get(0), SWT.TOGGLE);
- virtualButton.setImages(ImageResources.TOGGLE_ON_NOMAL.getImage(),
- ImageResources.TOGGLE_ON_HOVER.getImage(),
- ImageResources.TOGGLE_ON_PUSH.getImage(),
- ImageResources.TOGGLE_OFF_NOMAL.getImage(),
- ImageResources.TOGGLE_OFF_HOVER.getImage(),
- ImageResources.TOGGLE_OFF_PUSH.getImage(),
- ImageResources.TOGGLE_OFF_PUSH.getImage()); //disable
-
- virtualButton.addSelectionListener(new SelectionListener() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- if (virtualButton.isSelection()) { // NOT SUPPORT
- newHWSupport = false;
- virtualState.setText(StringResources.NOT_SUPPORTED);
- } else { // SUPPORT
- newHWSupport = true;
- virtualState.setText(StringResources.SUPPORTED);
- }
- if (!isCreateMode()) {
- getListener().ChangeValue(getThis());
- }
- }
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- // TODO Auto-generated method stub
-
- }
- });
-
- virtualState = new Label(compList.get(0), SWT.NONE);
- virtualState.setFont(FontResources.DETAIL_LABEL_FONT.getFont());
- virtualState.setForeground(ColorResources.DETAIL_ENABLE_FONT_COLOR.getColor());
- virtualState.setBackground(ColorResources.DETAIL_MIDDLE_COLOR.getColor());
-
- GPUButton = new ImageButton(compList.get(1), SWT.TOGGLE);
- GPUButton.setImages(ImageResources.TOGGLE_ON_NOMAL.getImage(),
- ImageResources.TOGGLE_ON_HOVER.getImage(),
- ImageResources.TOGGLE_ON_PUSH.getImage(),
- ImageResources.TOGGLE_OFF_NOMAL.getImage(),
- ImageResources.TOGGLE_OFF_HOVER.getImage(),
- ImageResources.TOGGLE_OFF_PUSH.getImage(),
- ImageResources.TOGGLE_OFF_PUSH.getImage()); //disable
-
- GPUButton.addSelectionListener(new SelectionListener() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- if (GPUButton.isSelection()) { // NOT SUPPORT
- newGPUSupport = false;
- GPUState.setText(StringResources.NOT_SUPPORTED);
- } else { // SUPPORT
- newGPUSupport = true;
- GPUState.setText(StringResources.SUPPORTED);
- }
-
- if (!isCreateMode()) {
- getListener().ChangeValue(getThis());
- }
- }
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- // TODO Auto-generated method stub
-
- }
- });
-
- GPUButton.setToolTipText(GPUToolTipText);
-
- GPUState = new Label(compList.get(1), SWT.NONE);
- GPUState.setFont(FontResources.DETAIL_LABEL_FONT.getFont());
- GPUState.setForeground(ColorResources.DETAIL_ENABLE_FONT_COLOR.getColor());
- GPUState.setBackground(ColorResources.DETAIL_MIDDLE_COLOR.getColor());
- }
-
- private boolean isArm = false;
-
- @Override
- public boolean settingDetailItem(VMPropertyValue value) {
- isArm = value.archType.equals("arm");
-
- if (!CheckVirtualization.getInstance().isSupportVirtualization()
- || isArm) {
- virtualLabel.setText(StringResources.DISABLED);
- virtualLabel.setToolTipText(CPUDisableToolTipText);
- } else {
- virtualLabel.setText(value.isHWVirtualization
- ? StringResources.SUPPORTED
- : StringResources.NOT_SUPPORTED);
- virtualLabel.setToolTipText("");
- }
-
- if (!CheckVirtualization.getInstance().isSupportGPU()
- || isArm) {
- GPULabel.setText(StringResources.DISABLED);
- GPULabel.setToolTipText(GPUDisableToolTipText);
- } else {
- GPULabel.setText(value.isGLAcceleration
- ? StringResources.SUPPORTED
- : StringResources.NOT_SUPPORTED);
- GPULabel.setToolTipText(GPUToolTipText);
- }
- return true;
- }
-
- @Override
- public boolean settingModifyItem(VMPropertyValue value) {
- isArm = value.archType.equals("arm");
- if (isCreateMode() && isArm) {
- newHWSupport = oldHWSupport = false;
- newGPUSupport = oldGPUSupport = false;
- } else {
- newHWSupport = oldHWSupport = value.isHWVirtualization;
- newGPUSupport = oldGPUSupport = value.isGLAcceleration;
- }
-
- if (!CheckVirtualization.getInstance().isSupportVirtualization()
- || isArm) {
- virtualButton.setEnabled(false);
- virtualState.setText(StringResources.DISABLED);
- virtualState.setToolTipText(CPUDisableToolTipText);
- } else {
- if (oldHWSupport) {
- virtualButton.setSelection(false);
- virtualState.setText(StringResources.SUPPORTED);
- } else {
- virtualButton.setSelection(true);
- virtualState.setText(StringResources.NOT_SUPPORTED);
- }
- virtualState.setToolTipText("");
- }
-
- if (!CheckVirtualization.getInstance().isSupportGPU() || isArm) {
- GPUButton.setEnabled(false);
- GPUState.setText(StringResources.DISABLED);
- GPUState.setToolTipText(GPUDisableToolTipText);
- } else {
- if (oldGPUSupport /*&& !isArm
- && CheckVirtualization.getInstance().isSupportGPU()*/) {
- GPUButton.setSelection(false);
- GPUState.setText(StringResources.SUPPORTED);
- } else {
- GPUButton.setSelection(true);
- GPUState.setText(StringResources.NOT_SUPPORTED);
- }
- GPUState.setToolTipText(GPUToolTipText);
- }
-
- return true;
- }
-
- @Override
- public void closeItem() {
- if (virtualCategory != null) {
- virtualCategory.dispose();
- }
-
- if (GPUCategory != null) {
- GPUCategory.dispose();
- }
-
- if (virtualLabel != null) {
- virtualLabel.dispose();
- }
-
- if (GPULabel != null) {
- GPULabel.dispose();
- }
-
- if (virtualButton != null) {
- virtualButton.dispose();
- }
-
- if (GPUButton != null) {
- GPUButton.dispose();
- }
-
- if (virtualState != null) {
- virtualState.dispose();
- }
-
- if (GPUState != null) {
- GPUState.dispose();
- }
- }
-
- private static boolean isShareMinMode = false;
- @Override
- protected void changeArrowState() {
- super.changeArrowState();
- isShareMinMode = isMinMode;
- }
-
- @Override
- public void settingStatus(boolean isRefresh) {
- if (isRefresh) {
- if (isMinMode) {
- arrowButton.setSelection(false);
- changeArrowState();
- }
- } else {
- if (isShareMinMode != isMinMode) {
- arrowButton.setSelection(isShareMinMode);
- changeArrowState();
- }
- }
- }
-
- @Override
- public boolean checkValue() {
- return true;
- }
-}
+++ /dev/null
-/*
- * Emulator Manager
- *
- * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Minkee Lee <minkee.lee@samsung.com>
- * MunKyu Im <munkyu.im@samsung.com>
- * SeokYeon Hwang <syeon.hwang@samsung.com>
- * JiHye Kim <jihye1128.kim@samsung.com>
- * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-
-
-package org.tizen.emulator.manager.mobile.ui.detail;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.widgets.Label;
-import org.tizen.emulator.manager.resources.ColorResources;
-import org.tizen.emulator.manager.resources.FontResources;
-import org.tizen.emulator.manager.resources.ImageResources;
-import org.tizen.emulator.manager.resources.PatchImageResources;
-import org.tizen.emulator.manager.resources.StringResources;
-import org.tizen.emulator.manager.ui.detail.item.DetailViewItem;
-import org.tizen.emulator.manager.ui.widgets.ImageButton;
-import org.tizen.emulator.manager.ui.widgets.ImageLabel;
-import org.tizen.emulator.manager.vms.VMPropertyValue;
-
-public class TNFCItem extends DetailViewItem {
-
- private boolean oldSupport;
- private boolean newSupport;
-
- public static String OPTION_NFC = "nfcDevice";
- public static String NFC_ON = "on";
- public static String NFC_OFF = "off";
-
- private ImageLabel supportLabel;
- private static int INPUTBOX_WIDTH = 175;
-
- @Override
- public void drawDetail() {
- supportLabel = new ImageLabel(compList.get(0), SWT.NONE);
- supportLabel.setEnableImage(PatchImageResources.getInputBoxOff(INPUTBOX_WIDTH));
-
- FormData data = new FormData();
- data.left = new FormAttachment(0, INPUTBOX_OFFSET);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP);
- data.width = supportLabel.getSize().x;
- data.height = supportLabel.getSize().y;
- supportLabel.setLayoutData(data);
-
- comp.layout(true, true);
- }
-
- @Override
- public boolean settingDetailItem(VMPropertyValue value) {
- if (value.baseName == null || value.baseName != null &&
- ( value.baseName.equals("x86-standard") || value.baseName.equals("x86") )) {
- supportLabel.setText(
- value.getExtendedOptionVal(OPTION_NFC).toLowerCase().equals(NFC_ON)
- ? StringResources.SUPPORTED
- : StringResources.NOT_SUPPORTED);
- } else {
- supportLabel.setText(StringResources.NOT_SUPPORTED);
- }
- return true;
- }
-
- @Override
- public void init() {
- title = "NFC Device";
- count = 1;
- }
-
- @Override
- public void settingStatus(boolean isRefresh) {
- // TODO Auto-generated method stub
- }
-
- @Override
- public void closeItem() {
- // TODO Auto-generated method stub
- }
-
- @Override
- public void setValue(VMPropertyValue value) {
- value.setExtendedOption(OPTION_NFC,
- newSupport ? NFC_ON : NFC_OFF );
- }
-
-
- private Label stateLabel;
- private ImageButton selectSupport;
-
- @Override
- public void drawModify() {
- makeModifyWidget();
-
- FormData data = new FormData();
- data.left = new FormAttachment(0, INPUTBOX_OFFSET);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP);
- data.width = TOGGLE_BUTTON_WIDTH;
- data.height = TOGGLE_BUTTON_HEIGHT;
- selectSupport.setLayoutData(data);
-
- data = new FormData();
- data.left = new FormAttachment(selectSupport, 10);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP + 1);
- data.width = TOGGLE_BUTTON_WIDTH;
- stateLabel.setLayoutData(data);
- }
-
- private void makeModifyWidget() {
- selectSupport = new ImageButton(compList.get(0), SWT.TOGGLE);
- selectSupport.setImages(ImageResources.TOGGLE_ON_NOMAL.getImage(),
- ImageResources.TOGGLE_ON_HOVER.getImage(),
- ImageResources.TOGGLE_ON_PUSH.getImage(),
- ImageResources.TOGGLE_OFF_NOMAL.getImage(),
- ImageResources.TOGGLE_OFF_HOVER.getImage(),
- ImageResources.TOGGLE_OFF_PUSH.getImage(),
- ImageResources.TOGGLE_OFF_PUSH.getImage()); //disable
-
- selectSupport.addSelectionListener(new SelectionListener() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- if (selectSupport.isSelection()) { // NOT SUPPORT
- newSupport = false;
- stateLabel.setText(StringResources.NOT_SUPPORTED);
- } else { // SUPPORT
- newSupport = true;
- stateLabel.setText(StringResources.SUPPORTED);
- }
- if (!isCreateMode()) {
- getListener().ChangeValue(getThis());
- }
- }
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- // TODO Auto-generated method stub
- }
- });
-
- stateLabel = new Label(compList.get(0), SWT.NONE);
- stateLabel.setFont(FontResources.DETAIL_LABEL_FONT.getFont());
- stateLabel.setForeground(ColorResources.DETAIL_ENABLE_FONT_COLOR.getColor());
- stateLabel.setBackground(ColorResources.DETAIL_MIDDLE_COLOR.getColor());
- }
-
- @Override
- public boolean settingModifyItem(VMPropertyValue value) {
- if (value.baseName == null || value.baseName != null &&
- ( value.baseName.equals("x86-standard") || value.baseName.equals("x86") )) {
- selectSupport.setEnabled(true);
- boolean nfcValue = value.getExtendedOptionVal(OPTION_NFC).toLowerCase().equals(NFC_ON)
- ? true : false;
- newSupport = oldSupport = nfcValue;
-
- if (oldSupport) {
- selectSupport.setSelection(false);
- stateLabel.setText(StringResources.SUPPORTED);
- } else {
- selectSupport.setSelection(true);
- stateLabel.setText(StringResources.NOT_SUPPORTED);
- }
- } else {
- newSupport = oldSupport = false;
- stateLabel.setText(StringResources.NOT_SUPPORTED);
- selectSupport.setEnabled(false);
- }
-
- return true;
- }
-
- @Override
- public boolean checkValue() {
- return true;
- }
-
-}
+++ /dev/null
-/*
- * Emulator Manager
- *
- * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * JiHye Kim <jihye1128.kim@samsung.com>
- * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
- * SeokYeon Hwang <syeon.hwang@samsung.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-package org.tizen.emulator.manager.mobile.ui.detail;
-
-import java.io.File;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyAdapter;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.PaintEvent;
-import org.eclipse.swt.events.PaintListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-import org.tizen.emulator.manager.EmulatorManager;
-import org.tizen.emulator.manager.EmulatorManager.ManagerModeType;
-import org.tizen.emulator.manager.resources.ColorResources;
-import org.tizen.emulator.manager.resources.FontResources;
-import org.tizen.emulator.manager.resources.ImageResources;
-import org.tizen.emulator.manager.resources.PatchImageResources;
-import org.tizen.emulator.manager.resources.StringResources;
-import org.tizen.emulator.manager.ui.MainDialog;
-import org.tizen.emulator.manager.ui.VMsMainView;
-import org.tizen.emulator.manager.ui.detail.item.DetailViewItem;
-import org.tizen.emulator.manager.ui.detail.item.ItemChangeState;
-import org.tizen.emulator.manager.ui.dialog.MessageDialog;
-import org.tizen.emulator.manager.ui.widgets.ImageButton;
-import org.tizen.emulator.manager.ui.widgets.ImageLabel;
-import org.tizen.emulator.manager.vms.EmulatorVMList;
-import org.tizen.emulator.manager.vms.VMProperty;
-import org.tizen.emulator.manager.vms.VMPropertyValue;
-import org.tizen.emulator.manager.vms.helper.HelperClass;
-
-public class TNameTextItem extends DetailViewItem {
- private boolean isStandard;
-
- // for vm name
- private String oldName = "";
- private String newName = "";
-
- // for base image
- private String subTitle;
- private Label subTitleLabel;
-
- private String newPath;
- private String newPathName;
- private FileDialog baseImageFD;
- private boolean isSelected;
-
- @Override
- public void setValue(VMPropertyValue value) {
- value.vmsName = newName;
-
- value.baseImagePath = newPath;
- value.baseImagePathName = newPathName;
- }
-
- @Override
- public void init() {
- title = "Name";
- subTitle = "Base Image";
- count = 2;
- }
-
- @Override
- protected void initTitle(boolean supportMinMode) {
- super.initTitle(false);
-
- subTitleLabel = new Label(compList.get(1), SWT.NONE);
-
- subTitleLabel.setFont(FontResources.DETAIL_TITLE_FONT.getFont());
- subTitleLabel.setForeground(ColorResources.DETAIL_TITILE_FONT_COLOR.getColor());
- FormData data = new FormData();
- data.left = new FormAttachment(0, TITLE_LEFT_GAP);
- data.top = new FormAttachment(0, TITLE_TOP_GAP);
- data.height = TITLE_HEIGHT;
- data.width = 100;
- subTitleLabel.setLayoutData(data);
- subTitleLabel.setBackground(ColorResources.DETAIL_MIDDLE_COLOR.getColor());
- subTitleLabel.addPaintListener(new PaintListener() {
- @Override
- public void paintControl(PaintEvent e) {
- drawTitle(e, subTitle);
- }
- });
- }
-
- private ImageLabel nameLabel;
- private ImageLabel baseImageLabel;
-
- private static int INPUTBOX_WIDTH = 175;
-// private static int INPUTBOX_WIDTH = 150;
- private static Image INPUTBOX_ON_IMAGE = null;
- private static Image INPUTBOX_OFF_IMAGE = null;
-
- // for modify (base image)
- private static int IMAGE_INPUTBOX_WIDTH = 133;
- private static Image IMAGE_INPUTBOX_IMAGE = null;
-
- @Override
- public void drawDetail() {
- if (INPUTBOX_OFF_IMAGE == null) {
- INPUTBOX_OFF_IMAGE = PatchImageResources.getInputBoxOff(INPUTBOX_WIDTH);
- }
-
- nameLabel = new ImageLabel(compList.get(0), SWT.NONE);
- nameLabel.setEnableImage(INPUTBOX_OFF_IMAGE);
- nameLabel.setDisableImage(INPUTBOX_OFF_IMAGE);
-
- FormData data = new FormData();
- data.left = new FormAttachment(0, INPUTBOX_OFFSET);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP);
- data.width = nameLabel.getSize().x;
- data.height = nameLabel.getSize().y;
- nameLabel.setLayoutData(data);
-
- baseImageLabel = new ImageLabel(compList.get(1), SWT.NONE);
- baseImageLabel.setEnableImage(INPUTBOX_OFF_IMAGE);
- baseImageLabel.setDisableImage(INPUTBOX_OFF_IMAGE);
-
- data = new FormData();
- data.left = new FormAttachment(0, INPUTBOX_OFFSET);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP);
- data.width = baseImageLabel.getSize().x;
- data.height = baseImageLabel.getSize().y;
- baseImageLabel.setLayoutData(data);
-
- comp.layout(true, true);
- }
-
- private Text nameText;
- private ImageButton selectImageButton;
- @Override
- public void drawModify() {
- if (INPUTBOX_ON_IMAGE == null) {
- INPUTBOX_ON_IMAGE = PatchImageResources.getInputBoxON(INPUTBOX_WIDTH);
- }
- if (IMAGE_INPUTBOX_IMAGE == null) {
- IMAGE_INPUTBOX_IMAGE = PatchImageResources.getInputBoxON(IMAGE_INPUTBOX_WIDTH);
- }
-
- makeModifyNameLabel();
-
- FormData data = new FormData();
- data.left = new FormAttachment(0, INPUTBOX_OFFSET);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP);
- data.width = nameLabel.getSize().x;
- data.height = nameLabel.getSize().y;
- nameLabel.setLayoutData(data);
-
- makeModifyBaseImage();
-
- data = new FormData();
- data.left = new FormAttachment(0, INPUTBOX_OFFSET);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP);
- data.width = baseImageLabel.getSize().x;
- data.height = baseImageLabel.getSize().y;
- baseImageLabel.setLayoutData(data);
-
- data = new FormData();
- data.left = new FormAttachment(baseImageLabel, 5);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP);
- data.width = FILE_SELECT_BUTTON_WIDTH;
- data.height = FILE_SELECT_BUTTON_HEIGHT;
- selectImageButton.setLayoutData(data);
- }
-
- private void makeModifyNameLabel() {
- nameLabel = new ImageLabel(compList.get(0), SWT.NONE);
- nameLabel.setEnableImage(INPUTBOX_ON_IMAGE);
- nameLabel.setDisableImage(INPUTBOX_OFF_IMAGE);
- nameLabel.setLayout(new FormLayout());
-
- nameText = new Text(nameLabel, SWT.NONE);
- nameText.setBackground(ColorResources.DETAIL_INPUT_BOX_COLOR.getColor());
- nameText.setFont(FontResources.DETAIL_LABEL_FONT.getFont());
- nameText.setForeground(ColorResources.DETAIL_ENABLE_FONT_COLOR.getColor());
- nameText.setTextLimit(VMProperty.MAX_NAME_LEN);
-
- FormData data = new FormData();
- data.left = new FormAttachment(0, 5);
- data.top = new FormAttachment(0, 2);
- data.right = new FormAttachment(100, -5);
- data.bottom = new FormAttachment(100, -2);
- nameText.setLayoutData(data);
-
- nameText.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- if (isCreateMode()) {
- newName = nameText.getText();
- checkVMName();
- }
- }
- });
-
- nameText.addKeyListener(new KeyAdapter() {
- public void keyPressed(KeyEvent event) {
- switch (event.keyCode) {
- case SWT.CR:
- case SWT.KEYPAD_CR:
- ///TODO
- getListener().ChangeState(ItemChangeState.CREATE);
- break;
- case SWT.ESC:
- getListener().ChangeState(ItemChangeState.CANCEL);
- break;
- default:
- // TODO
- break;
- }
- }
- });
- }
-
- private void checkVMName() {
- if (HelperClass.checkImageName(newName, true)) {
- if (isStandard) {
- getListener().ChangeValue(true);
- } else {
- if (isSelected) {
- getListener().ChangeValue(true);
- } else {
- getListener().ChangeValue(false);
- }
- }
- } else {
- getListener().ChangeValue(false);
- }
- }
-
- private void makeModifyBaseImage() {
- baseImageLabel = new ImageLabel(compList.get(1), SWT.NONE);
- baseImageLabel.setEnableImage(IMAGE_INPUTBOX_IMAGE);
- baseImageLabel.setDisableImage(IMAGE_INPUTBOX_IMAGE);
-
- selectImageButton = new ImageButton(compList.get(1), SWT.PUSH);
- selectImageButton.setImages(
- ImageResources.BUTTON_FILE_NOMAL.getImage(),
- ImageResources.BUTTON_FILE_HOVER.getImage(),
- ImageResources.BUTTON_FILE_PUSH.getImage(),
- ImageResources.BUTTON_FILE_DISABLE.getImage());
-
- selectImageButton.addSelectionListener(new SelectionListener() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- if (baseImageFD == null) {
- baseImageFD = new FileDialog(MainDialog.getShell(), SWT.OPEN);
- baseImageFD.setText(String.format("Select existing Base Image"));
- String[] filter = null;
- String[] filterName = null;
- if (EmulatorManager.getManagerMode() == ManagerModeType.INHOUSE_MODE) {
- filter = new String[]{"*.x86", "*.arm"};
- filterName = new String[]{"Disk Image Files(*.x86)", "Disk Image Files(*.arm)"};
- } else {
- filter = new String[]{"*.x86"};
- filterName = new String[]{"Disk Image Files(*.x86)"};
- }
- baseImageFD.setFilterExtensions(filter);
- baseImageFD.setFilterNames(filterName);
- }
-
- String path = baseImageFD.open();
- if (path != null) {
- if (!HelperClass.isPathAvaliable(path)) {
- new MessageDialog().openWarningDialog("This base image not ready yet."
- + StringResources.NEW_LINE
- + "Please select again in a few seconds.");
- return;
- }
- newPath = path;
- newPathName = path.substring(path.lastIndexOf(File.separator) + 1, path.length());
-
- // for arm emulator
- boolean isArm = newPathName.endsWith("arm");
- EmulatorVMList.getInstance().CustomArch = !isArm ? "x86" : "arm";
-
- baseImageLabel.setText(newPathName);
- baseImageLabel.redraw();
- isSelected = true;
- checkVMName();
-
- // TODO
- //arm image
- //false hw virtualization
- //false gl accelertaion
- }
- }
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- // TODO Auto-generated method stub
-
- }
- });
- }
-
- protected boolean checkImageName() {
- return true;
- }
-
- @Override
- public void closeItem() {
- subTitleLabel.dispose();
-
- nameLabel.dispose();
- baseImageLabel.dispose();
-
- if (nameText != null) {
- nameText.dispose();
- }
- if (selectImageButton != null) {
- selectImageButton.dispose();
- }
- }
-
- @Override
- public boolean settingDetailItem(VMPropertyValue value) {
- if (nameLabel != null) {
- nameLabel.setText(value.vmsName);
- }
-
- if (baseImageLabel != null) {
- baseImageLabel.setText(value.baseImagePathName);
- if (!value.isStandard) {
- baseImageLabel.setToolTipText(value.baseImagePath);
- }
- }
- return true;
- }
-
- @Override
- public boolean settingModifyItem(VMPropertyValue value) {
- newName = oldName = value.vmsName;
- isStandard = value.isStandard;
-
- newPath = value.baseImagePath;
- newPathName = value.baseImagePathName;
- isSelected = false;
-
- if (isCreateMode()) {
- nameText.setText(getDefaultVMName(value));
- nameText.selectAll();
- nameText.setEnabled(true);
-
- if (value.isStandard) {
- baseImageLabel.setText(value.baseImage == null
- ? value.baseImagePathName
- : value.baseImage.getPathName());
- baseImageLabel.setEnabled(false);
- selectImageButton.setEnabled(false);
- } else {
- baseImageLabel.setEnabled(true);
- if (checkBaseImageFile(value.baseImagePath)) {
- baseImageLabel.setText(value.baseImagePathName);
- baseImageLabel.setToolTipText(value.baseImagePath);
- isSelected = true;
- getListener().ChangeValue(true);
- } else {
- baseImageLabel.setText("");
- }
- selectImageButton.setEnabled(true);
- }
- } else {
- nameText.setText(oldName);
- nameText.setEnabled(false);
-
- baseImageLabel.setText(value.baseImagePathName);
- baseImageLabel.setEnabled(false);
- selectImageButton.setEnabled(false);
- }
-
- if (VMsMainView.getInstance().isSetFocus()) {
- setFocus();
- }
- return false;
- }
-
- public void setFocus() {
- nameLabel.setFocus();
- nameText.setFocus();
- }
-
- @Override
- public void settingStatus(boolean isRefresh) {
- if (isCreateMode() && VMsMainView.getInstance().isSetFocus()) {
- setFocus();
- }
- }
-
- // Generate VMName automatically.
- // ex) "m-0627-1"
- private String getDefaultVMName(VMPropertyValue value) {
- StringBuilder sb = new StringBuilder();
- sb.append(value.profile.substring(0,1).toLowerCase());
- if (!value.isStandard) {
- sb.append("c");
- }
- sb.append("-");
-
- SimpleDateFormat formatter = new SimpleDateFormat ("MMdd");
- Date currentTime = new Date( );
- String timeStr = formatter.format(currentTime);
- sb.append(timeStr);
- sb.append("-");
-
- int count=1;
- String prefix = sb.toString();
- StringBuilder vmName = null;
- do {
- vmName = new StringBuilder();
- vmName.append(prefix).append(Integer.toString(count++));
- } while (HelperClass.checkDupulicateName(vmName.toString()) != null) ;
-
- return vmName.toString();
- }
-
- private boolean checkBaseImageFile(String baseImagePath){
- if (baseImagePath == null || baseImagePath.isEmpty()) {
- return false;
- }
- // Check ".x86"
- String pathSplit[] = null;
- if (EmulatorManager.isWin()) {
- pathSplit = baseImagePath.split("\\\\");
- } else {
- pathSplit = baseImagePath.split(File.separator);
- }
- String fileSplit[] = pathSplit[pathSplit.length-1].split("\\.");
- String extension = fileSplit[fileSplit.length-1];
- if (!extension.equals("x86")) {
- return false;
- }
- // Check whether file is exist.
- File imageFile = new File(baseImagePath);
- if (!imageFile.exists()) {
- return false;
- }
-
- return true;
- }
-
- @Override
- public boolean checkValue() {
- return true;
- }
-}
-
+++ /dev/null
-/*
- * Emulator Manager
- *
- * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * JiHye Kim <jihye1128.kim@samsung.com>
- * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
- * SeokYeon Hwang <syeon.hwang@samsung.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-package org.tizen.emulator.manager.mobile.ui.detail;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.widgets.Label;
-import org.tizen.emulator.manager.resources.ColorResources;
-import org.tizen.emulator.manager.resources.FontResources;
-import org.tizen.emulator.manager.resources.ImageResources;
-import org.tizen.emulator.manager.resources.PatchImageResources;
-import org.tizen.emulator.manager.ui.detail.item.DetailViewItem;
-import org.tizen.emulator.manager.ui.widgets.ImageCombo;
-import org.tizen.emulator.manager.ui.widgets.ImageLabel;
-import org.tizen.emulator.manager.ui.widgets.WSTATE;
-import org.tizen.emulator.manager.vms.VMPropertyValue;
-
-public class TRAMItem extends DetailViewItem {
- private int oldSize;
- private int newSize;
-
- @Override
- public void init() {
- title = "RAM Size";
- count = 1;
- }
-
- @Override
- public void setValue(VMPropertyValue value) {
- value.ramSize = newSize;
- }
-
- private ImageLabel ramSize;
- private ImageCombo ramSizeCombo;
- private Label stateLabel;
-
- private static int INPUTBOX_WIDTH = 175;
- private static Image INPUTBOX_ON_IMAGE = null;
- @Override
- public void drawDetail() {
- ramSize = new ImageLabel(compList.get(0), SWT.NONE);
- ramSize.setEnableImage(PatchImageResources.getInputBoxOff(INPUTBOX_WIDTH));
-
- FormData data = new FormData();
- data.left = new FormAttachment(0, INPUTBOX_OFFSET);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP);
- data.width = ramSize.getSize().x;
- data.height = ramSize.getSize().y;
- ramSize.setLayoutData(data);
- }
-
- @Override
- public void drawModify() {
- if (INPUTBOX_ON_IMAGE == null) {
- INPUTBOX_ON_IMAGE = PatchImageResources.getInputBoxON(INPUTBOX_WIDTH - 40);
- }
-
- ramSizeCombo = new ImageCombo(compList.get(0), SWT.NONE);
- ramSizeCombo.setImage(WSTATE.NORMAL, INPUTBOX_ON_IMAGE);
- ramSizeCombo.setImage(WSTATE.PUSH, INPUTBOX_ON_IMAGE);
- ramSizeCombo.setImage(WSTATE.HOVER, INPUTBOX_ON_IMAGE);
-
- ramSizeCombo.setArrowButtonImage(ImageResources.ARROW_DROPDOWN.getImage());
- ramSizeCombo.setEnabled(true);
- ramSizeCombo.setItemHeight(INPUTBOX_ON_IMAGE.getImageData().height);
-
- //
-
- stateLabel = new Label(compList.get(0), SWT.NONE);
- stateLabel.setFont(FontResources.DETAIL_LABEL_FONT.getFont());
- stateLabel.setForeground(ColorResources.DETAIL_ENABLE_FONT_COLOR.getColor());
- stateLabel.setBackground(ColorResources.DETAIL_MIDDLE_COLOR.getColor());
- stateLabel.setText("MB");
-
- FormData data = new FormData();
- data.left = new FormAttachment(0, INPUTBOX_OFFSET);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP);
- data.width = INPUTBOX_ON_IMAGE.getImageData().width;
- data.height = INPUTBOX_ON_IMAGE.getImageData().height;
- ramSizeCombo.setLayoutData(data);
-
- data = new FormData();
- data.left = new FormAttachment(ramSizeCombo, 10);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP + 1);
- data.width = 30;
- stateLabel.setLayoutData(data);
-
- for (String s : RamSize.getInstance().getList()) {
- ramSizeCombo.add(s);
- }
-
- ramSizeCombo.addSelectionListener(new SelectionListener() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- String size = ramSizeCombo.getText();
- newSize = Integer.valueOf(size);
-
- if (!isCreateMode()) {
- getListener().ChangeValue(getThis());
- }
- }
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- // TODO Auto-generated method stub
-
- }
- });
- }
-
- @Override
- public boolean settingDetailItem(VMPropertyValue value) {
- ramSize.setText(value.ramSize + " MB");
- return false;
- }
-
- @Override
- public boolean settingModifyItem(VMPropertyValue value) {
- newSize = oldSize = value.ramSize;
- String s = Integer.toString(oldSize);
- ramSizeCombo.select(RamSize.getInstance().findIndex(s));
- return false;
- }
-
- @Override
- public void closeItem() {
- if (ramSize != null) {
- ramSize.dispose();
- }
-
- if (ramSizeCombo != null) {
- ramSizeCombo.dispose();
- }
- }
-
- @Override
- public void settingStatus(boolean isRefresh) {
- // TODO Auto-generated method stub
- }
-
- @Override
- public boolean checkValue() {
- return true;
- }
-}
+++ /dev/null
-package org.tizen.emulator.manager.mobile.ui.detail;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.widgets.Label;
-import org.tizen.emulator.manager.resources.ColorResources;
-import org.tizen.emulator.manager.resources.FontResources;
-import org.tizen.emulator.manager.resources.ImageResources;
-import org.tizen.emulator.manager.resources.PatchImageResources;
-import org.tizen.emulator.manager.resources.StringResources;
-import org.tizen.emulator.manager.ui.detail.item.DetailViewItem;
-import org.tizen.emulator.manager.ui.widgets.ImageButton;
-import org.tizen.emulator.manager.ui.widgets.ImageLabel;
-import org.tizen.emulator.manager.vms.VMPropertyValue;
-
-public class TSupportSuspendItem extends DetailViewItem {
- private boolean newSupport;
-
- private static int INPUTBOX_WIDTH = 175;
- private ImageLabel supportLabel;
- private ImageButton supportButton;
- private Label statusLabel;
- @Override
- public void init() {
- title = "Suspend";
- count = 1;
- }
-
- @Override
- public void drawDetail() {
- //titleLabel.setFont(FontResources.DETAIL_LABEL_FONT.getFont());
- supportLabel = new ImageLabel(compList.get(0), SWT.NONE);
- supportLabel.setEnableImage(PatchImageResources.getInputBoxOff(INPUTBOX_WIDTH));
-
- FormData data = new FormData();
- data.left = new FormAttachment(0, INPUTBOX_OFFSET);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP);
- data.width = supportLabel.getSize().x;
- data.height = supportLabel.getSize().y;
- supportLabel.setLayoutData(data);
- }
-
- @Override
- public void drawModify() {
- //titleLabel.setFont(FontResources.DETAIL_LABEL_FONT.getFont());
- supportButton = new ImageButton(compList.get(0), SWT.TOGGLE);
- supportButton.setImages(ImageResources.TOGGLE_ON_NOMAL.getImage(),
- ImageResources.TOGGLE_ON_HOVER.getImage(),
- ImageResources.TOGGLE_ON_PUSH.getImage(),
- ImageResources.TOGGLE_OFF_NOMAL.getImage(),
- ImageResources.TOGGLE_OFF_HOVER.getImage(),
- ImageResources.TOGGLE_OFF_PUSH.getImage(),
- ImageResources.TOGGLE_OFF_PUSH.getImage()); //disable
-
- statusLabel = new Label(compList.get(0), SWT.NONE);
- statusLabel.setFont(FontResources.DETAIL_LABEL_FONT.getFont());
- statusLabel.setForeground(ColorResources.DETAIL_ENABLE_FONT_COLOR.getColor());
- statusLabel.setBackground(ColorResources.DETAIL_MIDDLE_COLOR.getColor());
-
- FormData data = new FormData();
- data.left = new FormAttachment(0, INPUTBOX_OFFSET);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP);
- data.width = TOGGLE_BUTTON_WIDTH;
- data.height = TOGGLE_BUTTON_HEIGHT;
- supportButton.setLayoutData(data);
-
- data = new FormData();
- data.left = new FormAttachment(supportButton, 10);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP + 1);
- data.width = INPUTBOX_WIDTH - TOGGLE_BUTTON_WIDTH - INPUTBOX_RIGHT_GAP;
- statusLabel.setLayoutData(data);
-
- setButtonListener();
- }
-
- private void setButtonListener() {
- supportButton.addSelectionListener(new SelectionListener() {
-
- @Override
- public void widgetDefaultSelected(SelectionEvent arg0) {
- }
-
- @Override
- public void widgetSelected(SelectionEvent arg0) {
- if (supportButton.isSelection()) { // NOT SUPPORT
- newSupport = false;
- statusLabel.setText(StringResources.NOT_SUPPORTED);
- } else { // SUPPORT
- newSupport = true;
- statusLabel.setText(StringResources.SUPPORTED);
- }
- if (!isCreateMode()) {
- getListener().ChangeValue(getThis());
- }
- }
- });
- }
-
- @Override
- public boolean settingDetailItem(VMPropertyValue value) {
- if (!value.isSupportSuspend) {
- supportLabel.setText(StringResources.NOT_SUPPORTED);
- } else {
- supportLabel.setText(StringResources.SUPPORTED);
- }
- return true;
- }
-
- @Override
- public boolean settingModifyItem(VMPropertyValue value) {
- newSupport = value.isSupportSuspend;
-
- if (!value.isSupportSuspend) {
- supportButton.setSelection(true);
- statusLabel.setText(StringResources.NOT_SUPPORTED);
- } else {
- supportButton.setSelection(false);
- statusLabel.setText(StringResources.SUPPORTED);
- }
- return true;
- }
-
- @Override
- public void settingStatus(boolean isRefresh) {
- // TODO Auto-generated method stub
- }
-
- @Override
- public void closeItem() {
- if (supportLabel != null) {
- supportLabel.dispose();
- }
-
- if (supportButton != null) {
- supportButton.dispose();
- }
-
- if (statusLabel != null) {
- statusLabel.dispose();
- }
- }
-
- @Override
- public void setValue(VMPropertyValue value) {
- value.isSupportSuspend = newSupport;
- }
-
- @Override
- public boolean checkValue() {
- return true;
- }
-}
+++ /dev/null
-/*
- * Emulator Manager
- *
- * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * JiHye Kim <jihye1128.kim@samsung.com>
- * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
- * SeokYeon Hwang <syeon.hwang@samsung.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-package org.tizen.emulator.manager.mobile.ui.detail;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.tizen.emulator.manager.resources.PatchImageResources;
-import org.tizen.emulator.manager.ui.detail.item.DetailViewItem;
-import org.tizen.emulator.manager.ui.widgets.ImageLabel;
-import org.tizen.emulator.manager.vms.VMPropertyValue;
-
-public class TTouchPointItem extends DetailViewItem {
- private int touchPointValue;
- @Override
- public void init() {
- title = "Max Touch Point";
- count = 1;
- }
-
- @Override
- public void setValue(VMPropertyValue value) {
- value.maxTouchCount = touchPointValue;
- }
-
- private ImageLabel touchPoint;
- private static int INPUTBOX_WIDTH = 175;
- @Override
- public void drawDetail() {
- touchPoint = new ImageLabel(compList.get(0), SWT.NONE);
- touchPoint.setEnableImage(PatchImageResources.getInputBoxOff(INPUTBOX_WIDTH));
-
- FormData data = new FormData();
- data.left = new FormAttachment(0, INPUTBOX_OFFSET);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP);
- data.width = touchPoint.getSize().x;
- data.height = touchPoint.getSize().y;
- touchPoint.setLayoutData(data);
- touchPoint.redraw();
- }
-
- @Override
- public void drawModify() {
- touchPoint = new ImageLabel(compList.get(0), SWT.NONE);
- touchPoint.setDisableImage(PatchImageResources.getInputBoxON(INPUTBOX_WIDTH));
-
- FormData data = new FormData();
- data.left = new FormAttachment(0, INPUTBOX_OFFSET);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP);
- data.width = touchPoint.getSize().x;
- data.height = touchPoint.getSize().y;
- touchPoint.setLayoutData(data);
- touchPoint.setEnabled(false);
- }
-
- @Override
- public boolean settingDetailItem(VMPropertyValue value) {
- touchPointValue = value.maxTouchCount;
- touchPoint.setText(Integer.toString(touchPointValue));
- return false;
- }
-
- @Override
- public boolean settingModifyItem(VMPropertyValue value) {
- touchPointValue = value.maxTouchCount;
- touchPoint.setText(Integer.toString(touchPointValue));
- return false;
- }
-
- @Override
- public void closeItem() {
- touchPoint.dispose();
- }
-
- @Override
- public void settingStatus(boolean isRefresh) {
- // TODO Auto-generated method stub
- }
-
- @Override
- public boolean checkValue() {
- return true;
- }
-}
+++ /dev/null
-/*
- * Emulator Manager
- *
- * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * MunKyu Im <munkyu.im@samsung.com>
- * SeokYeon Hwang <syeon.hwang@samsung.com>
- * JiHye Kim <jihye1128.kim@samsung.com>
- * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-package org.tizen.emulator.manager.mobile.ui.detail;
-
-import java.util.ArrayList;
-
-import org.tizen.emulator.manager.EmulatorManager;
-import org.tizen.emulator.manager.EmulatorManager.ManagerModeType;
-import org.tizen.emulator.manager.resources.StringResources;
-import org.tizen.emulator.manager.vms.RAM_SIZE;
-import org.tizen.emulator.manager.vms.RESOLUTION;
-
-class StringArrayResource
-{
- private ArrayList<String> list;
- private int defaultIndex = 0;
-
- public StringArrayResource()
- {
- list = new ArrayList<String>();
- list.clear();
- }
-
- public void add(int index, String element)
- {
- list.add(index, element);
- }
-
- public String[] getList()
- {
- if (size() == 0) {
- return null;
- } else {
- return list.toArray(new String[size()]);
- }
- }
-
- public String get(int i) {
- return list.get(i);
- }
-
- public int size()
- {
- return list.size();
- }
-
- public int getDefaultIndex()
- {
- return defaultIndex;
- }
-
- public void setDefaultIndex(int index) {
- defaultIndex = index;
- }
-
- public void clear() {
- list.clear();
- }
-}
-
-class SupportType extends StringArrayResource
-{
- private static SupportType support = new SupportType();
- public static SupportType getInstance()
- {
- return support;
- }
-
- private SupportType()
- {
- add(0, StringResources.SUPPORTED);
- add(1, StringResources.NOT_SUPPORTED);
-
- setDefaultIndex(1);
- }
-
- public int findIndex(String type) {
- String[] strArray = getList();
- String s = null;
- for (int i = 0; i < strArray.length; i++) {
- s = strArray[i];
- if (s.equals(type)) {
- return i;
- }
- }
- return getDefaultIndex();
- }
-}
-
-class DisplayResolution extends StringArrayResource
-{
- private static RESOLUTION[] minResoultion = {RESOLUTION.WVGA, RESOLUTION.HD};
- private static RESOLUTION[] customResolution = {RESOLUTION.WVGA, RESOLUTION.HVGA, RESOLUTION.HD};
-
- private static DisplayResolution resolution = new DisplayResolution();
- public static DisplayResolution getInstance()
- {
- return resolution;
- }
-
- private DisplayResolution()
- {
- }
-
- public void initialize(RESOLUTION re) {
- clear();
-
- int i = 0;
- if (EmulatorManager.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());
- }
- }
-
- if (!(EmulatorManager.getManagerMode() == ManagerModeType.INHOUSE_MODE)) {
- for (String s : getList()) {
- if (s.equals(re.toString())) {
- return;
- }
- }
- add(0, re.toString());
- }
- }
-
- public void initializeWVGA(RESOLUTION re) {
- clear();
-
- int i = 0;
- if (EmulatorManager.getManagerMode() == ManagerModeType.INHOUSE_MODE) {
- for (RESOLUTION r : RESOLUTION.values()) {
- if (r == RESOLUTION.WVGA) {
- setDefaultIndex(i);
- }
- add(i++, r.toString());
- }
- } else {
- for (RESOLUTION r : minResoultion) {
- if (r == RESOLUTION.WVGA) {
- setDefaultIndex(i);
- }
- add(i++, r.toString());
- }
- }
-
- if (!(EmulatorManager.getManagerMode() == ManagerModeType.INHOUSE_MODE)) {
- for (String s : getList()) {
- if (s.equals(re.toString())) {
- return;
- }
- }
- add(0, re.toString());
- }
- }
-
- public void initializeCustom(RESOLUTION re) {
- clear();
-
- int i = 0;
- if (EmulatorManager.getManagerMode() == ManagerModeType.INHOUSE_MODE) {
- for (RESOLUTION r : RESOLUTION.values()) {
- if (r == RESOLUTION.HD) {
- setDefaultIndex(i);
- }
- add(i++, r.toString());
- }
- } else {
- for (RESOLUTION r : customResolution) {
- if (r == RESOLUTION.HD) {
- setDefaultIndex(i);
- }
- add(i++, r.toString());
- }
- }
-
- if (!(EmulatorManager.getManagerMode() == ManagerModeType.INHOUSE_MODE)) {
- for (String s : getList()) {
- if (s.equals(re.toString())) {
- return;
- }
- }
- add(0, re.toString());
- }
- }
-
- public RESOLUTION findResolution(String resolution) {
- for (RESOLUTION r : RESOLUTION.values()) {
- if (resolution.equals(r.toString())) {
- return r;
- }
- }
-
- return null;
- }
-
- public int findIndex(String r) {
- String[] strArray = getList();
- String s = null;
- for (int i = 0; i < strArray.length; i++) {
- s = strArray[i];
- if (s.equals(r)) {
- return i;
- }
- }
-
- return getDefaultIndex();
- }
-
- public boolean isMinResoluion(RESOLUTION resolution) {
- for (RESOLUTION r : minResoultion) {
- if (resolution.getStrValue().equals(r.getStrValue())) {
- return true;
- }
- }
-
- if (resolution.getStrValue().equals(RESOLUTION.HVGA.getStrValue())) {
- return true;
- }
- return false;
- }
-}
-
-class RamSize extends StringArrayResource
-{
- private static RamSize size = new RamSize();
- public static RamSize getInstance()
- {
- return size;
- }
-
- private RamSize()
- {
- int i = 0;
- for (RAM_SIZE r : RAM_SIZE.values()) {
- if (r == RAM_SIZE.RAM512) {
- setDefaultIndex(i);
- }
- add(i++, r.toString());
- }
- }
-
- public int findIndex(String size) {
- String[] strArray = getList();
- String s = null;
- for (int i = 0; i < strArray.length; i++) {
- s = strArray[i];
- if (s.contains(size)) {
- return i;
- }
- }
- return getDefaultIndex();
- }
-}
+++ /dev/null
-/*
- * Emulator Manager
- *
- * Copyright (C) 2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * JiHye Kim <jihye1128.kim@samsung.com>
- * SeokYeon Hwang <syeon.hwang@samsung.com>
- * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-package org.tizen.emulator.manager.mobile.ui.widget;
-
-import org.eclipse.swt.events.PaintEvent;
-import org.eclipse.swt.events.PaintListener;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Canvas;
-import org.tizen.emulator.manager.plugin.PluginImageResources;
-import org.tizen.emulator.manager.resources.FontResources;
-import org.tizen.emulator.manager.ui.widgets.VMButton;
-import org.tizen.emulator.manager.ui.widgets.WSTATE;
-import org.tizen.emulator.manager.vms.VMProperty;
-import org.tizen.emulator.manager.vms.VMPropertyValue;
-
-public class VMButtonPainter implements PaintListener {
-
- @Override
- public void paintControl(PaintEvent e) {
- VMButton button = (VMButton)e.widget;
- Image image = button.getImage(button.currentState());
- if (image == null) {
- return;
- }
-
- if (button.getProperty() != null) {
- if (button.getProperty().isRunning()) {
- button.getLaunchButton().setEnabled(false);
- } else {
- button.getLaunchButton().setEnabled(true);
- }
- }
-
- Rectangle rect = ((Canvas) e.widget).getClientArea();
- GC gc = e.gc;
-
- gc.setBackground(button.getBackgroundColor(button.currentState()));
- gc.fillRectangle(rect);
- gc.drawImage(image, rect.x + W_OFFSET, rect.y + H_OFFSET);
- if (button.isSelection()) {
- gc.drawImage(PluginImageResources.VM_IMAGE_SELECTED.getImage(button.getBaseImage().getPlatform().getPluginPlatformName()),
- rect.x, rect.y);
- }
- drawButtonText(gc, rect, button);
- }
-
- private int W_OFFSET = 2;
- private int H_OFFSET = 3;
- private int X_POINT = 40 + W_OFFSET;
- private int Y_POINT = 27 + H_OFFSET;
- private int Y_GAP = 23;
- private int RE_X_POINT = 16 + W_OFFSET;
-
- private void drawButtonText(GC gc, Rectangle rect, VMButton button) {
- VMProperty property = button.getProperty();
- if (property == null) {
- return;
- }
-
- // drawing Title
- gc.setForeground(button.getFontColor(button.currentState()));
- gc.setFont(FontResources.VM_BUTTON_TITLE_FONT.getFont());
-
- gc.setBackground(button.getBackgroundColor(button.currentState()));
- gc.drawString(button.getTitle(), button.getTitle_x(), 8, true);
-
- // reset font color
- gc.setForeground(button.getFontColor(WSTATE.NORMAL));
-
- VMPropertyValue value = property.getPropertyValue();
-
- gc.drawString(property.getArch().name(), X_POINT, Y_POINT, true);
- gc.drawString(Integer.toString(value.dpi), X_POINT, Y_POINT + Y_GAP, true);
- gc.drawString(Integer.toString(value.ramSize), X_POINT, Y_POINT + Y_GAP * 2, true);
- gc.drawString(value.resolution.getStrValue(), RE_X_POINT, Y_POINT + Y_GAP * 3, true);
- }
-
-}
+++ /dev/null
-/*
- * Emulator Manager
- *
- * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * MunKyu Im <munkyu.im@samsung.com>
- * SeokYeon Hwang <syeon.hwang@samsung.com>
- * JiHye Kim <jihye1128.kim@samsung.com>
- * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-package org.tizen.emulator.manager.mobile.vms;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.logging.Level;
-
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.tizen.emulator.manager.EmulatorManager;
-import org.tizen.emulator.manager.EmulatorManager.ManagerModeType;
-import org.tizen.emulator.manager.console.RemoteManager;
-import org.tizen.emulator.manager.logging.EMLogger;
-import org.tizen.emulator.manager.resources.FilePathResources;
-import org.tizen.emulator.manager.resources.StringResources;
-import org.tizen.emulator.manager.tool.CheckVirtualization;
-import org.tizen.emulator.manager.tool.PortHelper;
-import org.tizen.emulator.manager.tool.SettingInfoFile;
-import org.tizen.emulator.manager.ui.dialog.MessageDialog;
-import org.tizen.emulator.manager.vms.ILauncher;
-import org.tizen.emulator.manager.vms.VMProperty;
-import org.tizen.emulator.manager.vms.helper.CheckingRunningEmulator;
-import org.tizen.emulator.manager.vms.helper.MonitoringEmulator;
-import org.tizen.emulator.manager.vms.helper.VMLauncherException;
-import org.tizen.emulator.manager.vms.xml.CpuType;
-import org.tizen.emulator.manager.vms.xml.OptionType;
-import org.tizen.emulator.manager.vms.xml.TouchType;
-
-public class Launcher implements ILauncher {
- private boolean isConsole = false;
- private String binPath = null;
- private static Launcher launcher;
-
-
- // Option names in vm_config.xml
- // Add if need.
- public static final String OPT_DEVICE = "device";
- public static final String OPT_NFC = "nfc";
- public static final String OPT_BATTERY = "battery";
- public static final String OPT_CAMERA = "camera";
- public static final String OPT_HWKEY = "hwkey";
- public static final String OPT_SWAP = "swap";
- public static final String OPT_CODEC = "codec";
-
- public static final String OPT_JACK = "jack";
- public static final String OPT_EARJACK = "earjack";
- public static final String OPT_USB = "usb";
- public static final String OPT_CHARGER = "charger";
-
- public static final String OPT_SENSOR = "sensor";
- public static final String OPT_ACCEL = "accel";
- public static final String OPT_GYRO = "gyro";
- public static final String OPT_GEO = "geo";
- public static final String OPT_LIGHT = "light";
- public static final String OPT_PROXI = "proxi";
- public static final String OPT_HAPTIC = "haptic";
- public static final String OPT_PRESS = "press"; // pressure
- public static final String OPT_UV = "uv"; // ultra violet
- public static final String OPT_HRM = "hrm"; // heartbeat rate meter
-
- public static Launcher getInstance() {
- if (launcher == null) {
- launcher = new Launcher();
- }
- return launcher;
- }
-
- private Launcher() {
- isConsole = EmulatorManager.isConsoleMode();
- }
-
-
- @Override
- public List<String> getLaunchCommand(VMProperty property, String path) throws VMLauncherException {
- String binary;
- String hwVirtualization = "";
- int portNo;
-
- /* check available port number */
- portNo = new PortHelper().getPortNo();
- if(portNo == -1) {
- String error = "Can not execute emulator."
- + StringResources.NEW_LINE
- + "All available ports are in use.";
- throw new VMLauncherException(error);
- }
-
- if (property.getArch().toString().equals("x86")) {
- if (EmulatorManager.isWin()) {
- binary = "emulator-x86.exe";
- } else {
- binary = "emulator-x86";
- }
- } else {
- if (EmulatorManager.isWin()) {
- binary = "emulator-arm.exe";
- } else {
- binary = "emulator-arm";
- }
- }
-
- // check disk image
- File child = new File(property.getConfiguration().getBaseInformation().getDiskImage().getCurrentDiskImage().getValue());
- File base = new File(property.getConfiguration().getBaseInformation().getDiskImage().getBaseDiskImage().getValue());
- if (!child.exists()) {
- throw new VMLauncherException("Child disk image does not exist."
- + StringResources.NEW_LINE + child.getAbsolutePath()
- , true);
- }
- if (!base.exists()) {
- throw new VMLauncherException("Base disk image does not exist."
- + StringResources.NEW_LINE + base.getAbsolutePath()
- , true);
- }
-
- if (property.getConfiguration().getUsability().isHwVirtualization() && CheckVirtualization.getInstance().isSupportVirtualization()) {
- hwVirtualization = CheckVirtualization.getInstance().getVirtualizationEnableCommnad();
- } else {
- hwVirtualization = CheckVirtualization.getInstance().getVirtualizationDisableCommnad();
- }
-
- List<String> cmd = new ArrayList<String>();
- int width = property.getConfiguration().getDevice().getDisplay().getResolution().getWidth();
- int height = property.getConfiguration().getDevice().getDisplay().getResolution().getHeight();
- String skinPath = null;
- if (property.getConfiguration().getDevice().getDisplay().getSkinPath() != null) {
- skinPath = property.getConfiguration().getDevice().getDisplay().getSkinPath().getPath();
- if (skinPath != null && skinPath.isEmpty()) {
- skinPath = null;
- }
- }
- String fileshare = property.getConfiguration().getUsability().getFileSharing().getPath();
- String osVersion = System.getProperty("os.version");
- boolean isFileshare = true;
- if (fileshare == null) {
- isFileshare = false;
- }
-
- /* get MAC address of host set as guest MAC address */
- String macAddr = SettingInfoFile.getMACaddr();
-
- if(macAddr.isEmpty()) {
- macAddr = "52:54:00:12:34:56";
- EMLogger.getLogger().log(Level.INFO, String.format("MAC set as default = %s", macAddr));
- }
-
- if (path == null || path.isEmpty()) {
- cmd.add(FilePathResources.getBinPath() + File.separator + binary);
- } else {
- this.binPath = path;
- cmd.add(binPath + File.separator + binary);
- }
-
- cmd.add("--skin-args");
- cmd.add("width=" + width);
- cmd.add("height=" + height);
- if (skinPath != null) {
- cmd.add("skin.path=" + skinPath);
- }
-
- if (RemoteManager.getSpiceMode()) {
- cmd.add("hb.ignore=true");
- }
-
- cmd.add("--qemu-args");
-
- // x86 part of cmd
- if (property.getArch().toString().equals("x86")) {
- cmd.add("-drive");
- cmd.add("file=" + property.getConfiguration().getBaseInformation().getDiskImage().getCurrentDiskImage().getValue()+ ",if=virtio,index=1");
- cmd.add( "-boot");
- cmd.add("c");
- cmd.add("-append");
- String kernelOption = "console=ttyS0 video=LVDS-1:"
- + width
- + "x"
- + height
- + "-32@60"
- + " dpi=" + property.getConfiguration().getDevice().getDisplay().getDensity().getValue() * 10
- + " ip=10.0.2.16::10.0.2.2:255.255.255.0::eth0:none"
- + " vm_name=" + property.getConfiguration().getBaseInformation().getName();
- /* set virtio-9p string in case of using directory share [kernel option] */
- if(isFileshare) {
- kernelOption += " virtio-9p";
- }
-
- /*
- if(property.getPropertyValue().skin != null && property.getPropertyValue().skin.getButtonType() == SKIN_BUTTON_TYPE.THREE_BUTTON_TYPE) {
- kernelOption += " platform_feature=3btn";
- } else {
- kernelOption += " platform_feature=1btn";
- }
- */
-
- cmd.add(kernelOption);
-
- /* use fileshare [non-kernel option] */
- if(isFileshare) {
- cmd.add("-virtfs");
- cmd.add("local,path=" + property.getConfiguration().getUsability().getFileSharing().getPath() +",security_model=none,mount_tag=fileshare");
- }
-
- cmd.add("-serial");
- cmd.add("file:" + FilePathResources.getTizenVmsPath() + File.separator + property.getName() + File.separator + "logs" + File.separator + "emulator.klog");
- CpuType cpuOption = property.getConfiguration().getDevice().getCPU();
- if (cpuOption != null) {
- cmd.add("-smp");
- cmd.add(String.valueOf(cpuOption.getValue().getValue()));
- }
- cmd.add("-m");
- cmd.add(String.valueOf(property.getConfiguration().getDevice().getRAM().getSize().getValue()));
- cmd.add("-M");
- cmd.add("maru-x86-machine");
- cmd.add("-net");
- cmd.add("nic,model=virtio,macaddr=" + macAddr);
- cmd.add("-soundhw");
- cmd.add("all");
- cmd.add("-usb");
- cmd.add("-vga");
- cmd.add("none");
- cmd.add("-enable-vigs");
- cmd.add("-L");
- cmd.add(FilePathResources.getBiosPath());
- cmd.add("-kernel");
- cmd.add(FilePathResources.getKernelPath() + File.separator+ "bzImage." + property.getArch().toString());
- cmd.add("-net");
- cmd.add("user,dhcpstart=10.0.2.16");
- cmd.add("-rtc");
- cmd.add("base=utc");
- if (property.getConfiguration().getBaseInformation().getDiskImage().getSwapDiskImage() != null
- && checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_DEVICE, OPT_SWAP))) {
- cmd.add("-drive");
- cmd.add("file=" + property.getConfiguration().getBaseInformation().getDiskImage().getSwapDiskImage().getValue() + ",if=virtio,index=2");
- }
-
- /* append HW virtualization option if supports */
- if (hwVirtualization != null) {
- cmd.add(hwVirtualization);
- }
-
- // add hw gl acceleration
- if (property.getConfiguration().getUsability().isHwGLAcceleration()
- && CheckVirtualization.getInstance().isSupportGPU()) {
-// cmd.add(CheckVirtualization.getInstance().getGPU_enable_command());
- cmd.add("-vigs-backend");
- cmd.add("gl");
- cmd.add("-enable-yagl");
- cmd.add("-yagl-backend");
- cmd.add("vigs");
- } else {
- cmd.add("-vigs-backend");
- cmd.add("sw");
- }
-
- // for suspend
- if (EmulatorManager.getManagerMode() == ManagerModeType.INHOUSE_MODE
- && property.getConfiguration().getUsability().isSupoortSuspend()) {
- cmd.add("-enable-suspend");
- }
-
- // for bootup status
- cmd.add("-device");
- cmd.add("virtio-esm-pci");
-
- // for host keyboard
- cmd.add("-device");
- cmd.add("virtio-keyboard-pci");
-
- // for ecp
- cmd.add("-device");
- cmd.add("virtio-evdi-pci,profile=" + property.getPropertyValue().profile
- + "-" + property.getPropertyValue().version);
-
- // for brightness
- cmd.add("-device");
- cmd.add("maru-brightness");
-
- // for vmodem
- cmd.add("-device");
- cmd.add("virtio-vmodem-pci");
-
- // for hardware key
- if (checkOnOff(property.getPropertyValue().getAdvancedOptionValue(OPT_HWKEY))) {
- cmd.add("-device");
- cmd.add("virtio-hwkey-pci");
- }
-
- // for codec
- if (checkOnOff(property.getPropertyValue().getAdvancedOptionValue(OPT_CODEC))) {
- cmd.add("-device");
- cmd.add("codec-pci");
- }
-
- // for nfc
- if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_DEVICE, OPT_NFC))) {
- cmd.add("-device");
- cmd.add("virtio-nfc-pci");
- }
-
- // for battery
- cmd.add("-device");
- cmd.add("virtio-power-pci");
- /*if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_DEVICE, OPT_BATTERY))) {
- cmd.add("-device");
- cmd.add("virtio-power-pci");
- }*/
-
- // for camera
- if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_DEVICE, OPT_CAMERA))) {
- cmd.add("-device");
- cmd.add("maru-camera");
- }
-
- cmd.add("-device");
- TouchType touchType = property.getConfiguration().getDevice().getTouch();
- if (touchType != null) {
- cmd.add("virtio-touchscreen-pci,max_point=" + touchType.getMaxTouchPoint());
- } else {
- cmd.add("virtio-touchscreen-pci");
- }
-
- // for sensor (accel, geo, gyro, light, proxi, haptic, pressure, ultra violet, heart rate meter)
- OptionType sensor = property.getPropertyValue().getAdvancedOption(OPT_SENSOR);
- if (sensor != null) {
- cmd.add("-device");
-
- StringBuilder sb = new StringBuilder();
- if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_SENSOR, OPT_ACCEL))) {
- if(!sb.toString().isEmpty()) {
- sb.append("&");
- }
- sb.append("accel");
- }
- if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_SENSOR, OPT_GEO))) {
- if(!sb.toString().isEmpty()) {
- sb.append("&");
- }
- sb.append("geo");
- }
- if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_SENSOR, OPT_GYRO))) {
- if(!sb.toString().isEmpty()) {
- sb.append("&");
- }
- sb.append("gyro");
- }
- if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_SENSOR, OPT_LIGHT))) {
- if(!sb.toString().isEmpty()) {
- sb.append("&");
- }
- sb.append("light");
- }
- if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_SENSOR, OPT_PROXI))) {
- if(!sb.toString().isEmpty()) {
- sb.append("&");
- }
- sb.append("proxi");
- }
- if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_SENSOR, OPT_HAPTIC))) {
- if(!sb.toString().isEmpty()) {
- sb.append("&");
- }
- sb.append("haptic");
- }
- if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_SENSOR, OPT_PRESS))) {
- if(!sb.toString().isEmpty()) {
- sb.append("&");
- }
- sb.append("press");
- }
- if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_SENSOR, OPT_UV))) {
- if(!sb.toString().isEmpty()) {
- sb.append("&");
- }
- sb.append("uv");
- }
- if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_SENSOR, OPT_HRM))) {
- if(!sb.toString().isEmpty()) {
- sb.append("&");
- }
- sb.append("hrm");
- }
-
- if (sb.toString().isEmpty()) {
- cmd.add("virtio-sensor-pci");
- } else {
- sb.insert(0, "virtio-sensor-pci,sensors=");
- cmd.add(sb.toString());
- }
- }
-
- // for jacks (enabled charger, earjack and usb)
- cmd.add("-device");
- cmd.add("virtio-jack-pci,jacks=earjack&charger&usb");
- /* OptionType jacks = property.getPropertyValue().getAdvancedOption(OPT_JACK);
- if (jacks != null) {
- cmd.add("-device");
-
- StringBuilder sb = new StringBuilder();
- if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_JACK, OPT_EARJACK))) {
- if(!sb.toString().isEmpty()) {
- sb.append("&");
- }
- sb.append("earjack");
- }
- if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_JACK, OPT_CHARGER))) {
- if(!sb.toString().isEmpty()) {
- sb.append("&");
- }
- sb.append("charger");
- }
- if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_JACK, OPT_USB))) {
- if(!sb.toString().isEmpty()) {
- sb.append("&");
- }
- sb.append("usb");
- }
-
- if (sb.toString().isEmpty()) {
- cmd.add("virtio-jack-pci");
- } else {
- sb.insert(0, "virtio-jack-pci,jacks=");
- cmd.add(sb.toString());
- }
- } */
- }
-
- /* append user added options if exists */
- String advancedOptions = property.getConfiguration().getUsability().getAdvancedOptions();
- if (advancedOptions != null) {
- String[] arrOptions = advancedOptions.split(" ");
- for (String option : arrOptions) {
- cmd.add(option);
- }
- }
-
- /* spice options */
- if (RemoteManager.getSpiceMode()
- || CheckingRunningEmulator.isRemote(property)) {
- cmd.add("-spice");
- cmd.add("disable-ticketing");
- cmd.add("-device");
- cmd.add("virtio-serial-pci,id=virtio-serial0,max_ports=16,bus=pci.0");
- cmd.add("-chardev");
- cmd.add("spicevmc,id=vdagent,name=vdagent");
- cmd.add("-device");
- cmd.add("virtserialport,nr=1,bus=virtio-serial0.0,chardev=vdagent,name=com.redhat.spice.0");
- }
-
- EMLogger.getLogger().log(Level.INFO, "Starting Emulator Command : ");
- String temp = cmd.get(0) + " ";
- for (String s : cmd.subList(1, cmd.size())) {
- temp += ("\"" + s + "\" ");
- }
- EMLogger.getLogger().log(Level.INFO, temp);
- System.out.println("cmd : " + cmd);
- return cmd;
- }
-
- @Override
- public boolean launch(VMProperty property) throws VMLauncherException {
- return launch(property, false);
- }
-
- @Override
- public boolean launch(VMProperty property, boolean wait) throws VMLauncherException {
- List<String> cmd;
-
- cmd = getLaunchCommand(property, null);
-
- if (cmd == null) {
- return false;
- }
-
- CheckingRunningEmulator.addEmulator(property);
- MonitoringEmulator monitor = new MonitoringEmulator(property);
- Process process = launch(cmd);
- if (process != null) {
- monitor.setProcess(process);
- monitor.start();
- if (wait) {
- try {
- monitor.join();
- } catch (InterruptedException e) {
- EMLogger.getLogger().warning(e.getMessage());
- }
- if (monitor.isSuccess()) {
- return true;
- } else {
- return false;
- }
- }
- return true;
- } else {
- CheckingRunningEmulator.removeEmulator(property, false);
- monitor.interrupt();
- return false;
- }
- }
-
- @Override
- public Process launch(List<String> cmd) {
- ProcessBuilder pb = new ProcessBuilder(cmd);
- Map<String, String> env = pb.environment();
- if (EmulatorManager.isLinux()) {
- String value = env.get("LD_LIBRARY_PATH");
- env.put("LD_LIBRARY_PATH", ((value == null) ? "" : value + ":") + FilePathResources.getBinPath() + ":" + FilePathResources.getRemotePath() + File.separator + "lib:");
- EMLogger.getLogger().log(Level.INFO, "LD_LIBRARY_PATH=" + env.get("LD_LIBRARY_PATH"));
- }
- env.put("GL_VERSION", "2");
- EMLogger.getLogger().log(Level.INFO, "GL_VERSION: " + env.get("GL_VERSION"));
-
- if (this.binPath == null || this.binPath.isEmpty()) {
- pb.directory(new File(FilePathResources.getBinPath()));
- } else {
- pb.directory(new File(this.binPath));
- }
-
- Process process = null;
- try {
- process = pb.start();
- } catch (IOException e) {
- if (!isConsole) {
- MessageDialog msg = new MessageDialog(new Shell(Display.getCurrent()));
- msg.openWarningDialog("Failed to launch" + StringResources.NEW_LINE + e.getMessage());
- }
- EMLogger.getLogger().log(Level.WARNING, "Failed to launch." + StringResources.NEW_LINE + e.getMessage());
- }
-
- return process;
- }
-
-
- private boolean checkOnOff(String value) {
- if (value.toLowerCase().equals("on")) {
- return true;
- } else if (value.toLowerCase().equals("off")) {
- return false;
- } else if (value.isEmpty()){
- return true;
- } else {
- return false;
- }
- }
-
- @Override
- public void sendRemoteLog(String msg) {
- EMLogger.getLogger().info("Launcher log : " + msg);
- }
-}
+++ /dev/null
-/*
- * Emulator Manager
- *
- * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Minkee Lee <minkee.lee@samsung.com>
- * SeokYeon Hwang <syeon.hwang@samsung.com>
- * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-package org.tizen.emulator.manager.mobile.vms;
-
-import org.tizen.emulator.manager.vms.VMWorkerCommon;
-
-public class VMWorker extends VMWorkerCommon {
-
- @Override
- public void initLauncher() {
- setLauncher(Launcher.getInstance());
- }
-
-}
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
- <classpathentry combineaccessrules="false" kind="src" path="/EmulatorManager"/>
- <classpathentry kind="lib" path="/EmulatorManager/lib/swt.jar" sourcepath="/EmulatorManager/lib/src.zip"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>wearable-plugin</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
+++ /dev/null
-/*
- * Emulator Manager
- *
- * Copyright (C) 2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * JiHye Kim <jihye1128.kim@samsung.com>
- * SeokYeon Hwang <syeon.hwang@samsung.com>
- * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-package org.tizen.emulator.manager.wearable.ui.detail;
-
-import java.util.List;
-
-import org.tizen.emulator.manager.ui.detail.item.CommonItemListFactory;
-import org.tizen.emulator.manager.ui.detail.item.IViewItem;
-import org.tizen.emulator.manager.vms.xml.template.ItemList;
-
-public class ItemListFactory extends CommonItemListFactory {
-
- private static void makeItemListOld(List<? extends IViewItem> list) {
- List<IViewItem> itemList = (List<IViewItem>)list;
-
- itemList.add(new TNameTextItem());
- itemList.add(new TDisplayItem());
- itemList.add(new TRAMItem());
- itemList.add(new TTouchPointItem());
- itemList.add(new TFileShareItem());
- itemList.add(new THWSupportItem());
-
- }
-
-
- @Override
- public void makeItemList(List<? extends IViewItem> itemList,
- ItemList template) {
- if (template == null) {
- makeItemListOld(itemList); // TODO old
- } else {
- makePropertyItemList(itemList, template.getPropertyList(), template.getProfile(), true);
- makeDeviceItemList(itemList, template.getDeviceList());
-
- }
- }
-
-
- @Override
- public void makeCustomItemList(List<? extends IViewItem> itemList,
- List<ItemList> templateList) {
- if (templateList == null || templateList.size() == 0) {
- makeItemListOld(itemList); // TODO old
- } else {
-
- makeCustomDeviceItemList(itemList, templateList);
- }
- }
-}
+++ /dev/null
-/*
- * Emulator Manager
- *
- * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * JiHye Kim <jihye1128.kim@samsung.com>
- * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
- * SeokYeon Hwang <syeon.hwang@samsung.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-package org.tizen.emulator.manager.wearable.ui.detail;
-import java.util.ArrayList;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyAdapter;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.widgets.Spinner;
-import org.tizen.emulator.manager.EmulatorManager;
-import org.tizen.emulator.manager.EmulatorManager.ManagerModeType;
-import org.tizen.emulator.manager.logging.EMLogger;
-import org.tizen.emulator.manager.platform.Skin;
-import org.tizen.emulator.manager.platform.SkinList;
-import org.tizen.emulator.manager.resources.ColorResources;
-import org.tizen.emulator.manager.resources.FontResources;
-import org.tizen.emulator.manager.resources.ImageResources;
-import org.tizen.emulator.manager.resources.PatchImageResources;
-import org.tizen.emulator.manager.ui.detail.item.DetailViewItem;
-import org.tizen.emulator.manager.ui.detail.item.ItemChangeState;
-import org.tizen.emulator.manager.ui.widgets.ImageCombo;
-import org.tizen.emulator.manager.ui.widgets.ImageLabel;
-import org.tizen.emulator.manager.ui.widgets.WSTATE;
-import org.tizen.emulator.manager.vms.RESOLUTION;
-import org.tizen.emulator.manager.vms.SKIN_TYPE;
-import org.tizen.emulator.manager.vms.VMPropertyValue;
-
-public class TDisplayItem extends DetailViewItem {
- private RESOLUTION oldResolution;
- private RESOLUTION newResolution;
- private int oldDPI;
- private int newDPI;
- private Skin oldSkin;
- private Skin newSkin;
-
- private ArrayList<Skin> skinList;
-
- @Override
- public void init() {
- title = "Display";
- count = 3;
- }
-
- @Override
- public void setValue(VMPropertyValue value) {
- value.resolution = newResolution;
- value.dpi = newDPI;
- value.skin = newSkin;
- if (newSkin != null) {
- value.skinPath = newSkin.getPath();
- } else {
- value.skinPath = null;
- }
- }
-
- private ImageLabel reCategory;
- private ImageLabel dpiCategory;
- private ImageLabel skinCategory;
- private ImageLabel resolution;
- private ImageLabel dpi;
- private ImageLabel skin;
-
- private static int CATEGORY_WIDTH = 66;
- private static int INPUTBOX_WIDTH = 105;
- private static Image CATEGORY_IMAGE = null;
- private static Image INPUTBOX_ON_IMAGE = null;
- private static Image INPUTBOX_OFF_IMAGE = null;
-
- private void drawCategory() {
- if (CATEGORY_IMAGE == null) {
- CATEGORY_IMAGE = PatchImageResources.getCategoryBox(CATEGORY_WIDTH);
- }
-
- reCategory = new ImageLabel(compList.get(0), SWT.NONE);
- reCategory.setText("Resolution");
- reCategory.setEnableImage(CATEGORY_IMAGE);
- reCategory.setFont(FontResources.DETAIL_LABEL_FONT.getFont());
- reCategory.setEnableFontColor(ColorResources.DETAIL_CATEGORY_FONT_COLOR.getColor());
- FormData data = new FormData();
- data.left = new FormAttachment(0, INPUTBOX_OFFSET);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP + 1);
- data.width = reCategory.getSize().x;
- data.height = reCategory.getSize().y;
- reCategory.setLayoutData(data);
-
- dpiCategory = new ImageLabel(compList.get(1), SWT.NONE);
- dpiCategory.setText("Density");
- dpiCategory.setEnableImage(CATEGORY_IMAGE);
- dpiCategory.setFont(FontResources.DETAIL_LABEL_FONT.getFont());
- dpiCategory.setEnableFontColor(ColorResources.DETAIL_CATEGORY_FONT_COLOR.getColor());
- data = new FormData();
- data.left = new FormAttachment(0, INPUTBOX_OFFSET);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP + 1);
- data.width = dpiCategory.getSize().x;
- data.height = dpiCategory.getSize().y;
- dpiCategory.setLayoutData(data);
-
- skinCategory = new ImageLabel(compList.get(2), SWT.NONE);
- skinCategory.setText("Skin");
- skinCategory.setEnableImage(CATEGORY_IMAGE);
- skinCategory.setFont(FontResources.DETAIL_LABEL_FONT.getFont());
- skinCategory.setEnableFontColor(ColorResources.DETAIL_CATEGORY_FONT_COLOR.getColor());
-
- data = new FormData();
- data.left = new FormAttachment(0, INPUTBOX_OFFSET);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP + 1);
- data.width = skinCategory.getSize().x;
- data.height = skinCategory.getSize().y;
- skinCategory.setLayoutData(data);
- }
-
- @Override
- public void drawDetail() {
- drawCategory();
-
- if (INPUTBOX_OFF_IMAGE == null) {
- INPUTBOX_OFF_IMAGE = PatchImageResources.getInputBoxOff(INPUTBOX_WIDTH);
- }
-
- resolution = new ImageLabel(compList.get(0), SWT.NONE);
- resolution.setEnableImage(INPUTBOX_OFF_IMAGE);
-
- FormData data = new FormData();
- data.left = new FormAttachment(reCategory, 4);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP);
- data.width = resolution.getSize().x;
- data.height = resolution.getSize().y;
- resolution.setLayoutData(data);
-
- dpi = new ImageLabel(compList.get(1), SWT.NONE);
- dpi.setEnableImage(INPUTBOX_OFF_IMAGE);
-
- data = new FormData();
- data.left = new FormAttachment(dpiCategory, 4);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP);
- data.width = dpi.getSize().x;
- data.height = dpi.getSize().y;
- dpi.setLayoutData(data);
-
- skin = new ImageLabel(compList.get(2), SWT.NONE);
- skin.setEnableImage(INPUTBOX_OFF_IMAGE);
-
- data = new FormData();
- data.left = new FormAttachment(skinCategory, 4);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP);
- data.width = skin.getSize().x;
- data.height = skin.getSize().y;
- skin.setLayoutData(data);
- }
-
- private ImageCombo reCombo = null;
- private Spinner dpiSpinner = null;
- private ImageCombo skinCombo = null;
- @Override
- public void drawModify() {
- drawCategory();
-
- if (INPUTBOX_ON_IMAGE == null) {
- INPUTBOX_ON_IMAGE = PatchImageResources.getInputBoxON(INPUTBOX_WIDTH);
- }
-
- reCombo = new ImageCombo(compList.get(0), SWT.NONE);
- reCombo.setImage(WSTATE.NORMAL, INPUTBOX_ON_IMAGE);
- reCombo.setImage(WSTATE.PUSH, INPUTBOX_ON_IMAGE);
- reCombo.setImage(WSTATE.HOVER, INPUTBOX_ON_IMAGE);
-
- reCombo.setArrowButtonImage(ImageResources.ARROW_DROPDOWN.getImage());
- reCombo.setEnabled(true);
- reCombo.setItemHeight(INPUTBOX_ON_IMAGE.getImageData().height);
-
- FormData data = new FormData();
- data.left = new FormAttachment(reCategory, 4);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP);
- data.width = INPUTBOX_ON_IMAGE.getImageData().width;
- data.height = INPUTBOX_ON_IMAGE.getImageData().height;
- reCombo.setLayoutData(data);
-
- dpi = new ImageLabel(compList.get(1), SWT.NONE);
- dpi.setEnableImage(INPUTBOX_ON_IMAGE);
-
- data = new FormData();
- data.left = new FormAttachment(dpiCategory, 4);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP);
- data.width = dpi.getSize().x;
- data.height = dpi.getSize().y;
- dpi.setLayoutData(data);
-
- dpi.setLayout(new FormLayout());
-
- dpiSpinner = new Spinner(dpi, SWT.NONE);
- dpiSpinner.setValues(0, 0, 999, 0, 1, 1);
- dpiSpinner.setTextLimit(3);
-
- dpiSpinner.setBackground(ColorResources.DETAIL_INPUT_BOX_COLOR.getColor());
- dpiSpinner.setFont(FontResources.DETAIL_LABEL_FONT.getFont());
- dpiSpinner.setForeground(ColorResources.DETAIL_ENABLE_FONT_COLOR.getColor());
-
- data = new FormData();
- data.left = new FormAttachment(0, 5);
- data.top = new FormAttachment(0, 1);
- data.right = new FormAttachment(100, -2);
- data.bottom = new FormAttachment(100, -2);
- dpiSpinner.setLayoutData(data);
-
-
- skinCombo = new ImageCombo(compList.get(2), SWT.NONE);
- skinCombo.setImage(WSTATE.NORMAL, INPUTBOX_ON_IMAGE);
- skinCombo.setImage(WSTATE.PUSH, INPUTBOX_ON_IMAGE);
- skinCombo.setImage(WSTATE.HOVER, INPUTBOX_ON_IMAGE);
-
- skinCombo.setArrowButtonImage(ImageResources.ARROW_DROPDOWN.getImage());
- skinCombo.setEnabled(true);
- skinCombo.setItemHeight(INPUTBOX_ON_IMAGE.getImageData().height);
-
- data = new FormData();
- data.left = new FormAttachment(skinCategory, 4);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP);
- data.width = INPUTBOX_ON_IMAGE.getImageData().width;
- data.height = INPUTBOX_ON_IMAGE.getImageData().height;
- skinCombo.setLayoutData(data);
-
- addWidgetListener();
- }
-
- private void addWidgetListener() {
- reCombo.addSelectionListener(new SelectionListener() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- String re = reCombo.getText();
- reCombo.setToolTipText(reCombo.getText());
-
- RESOLUTION d = DisplayResolution.getInstance().findResolution(re);
- if (d != null) {
- EMLogger.getLogger().fine("Change Resolution -> " + d.getStrTypeValue());
- newResolution = d;
- changeResolution(d);
- }
-
- if (!isCreateMode()) {
- getListener().ChangeValue(getThis());
- }
- }
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- // TODO Auto-generated method stub
- }
- });
-
- dpiSpinner.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- newDPI = dpiSpinner.getSelection();
- if (!isCreateMode()) {
- getListener().ChangeValue(getThis());
- }
- }
- });
-
- dpiSpinner.addKeyListener(new KeyAdapter() {
- public void keyPressed(KeyEvent event) {
- switch (event.keyCode) {
- case SWT.CR:
- case SWT.KEYPAD_CR:
- ///TODO
- getListener().ChangeState(ItemChangeState.CREATE);
- break;
- case SWT.ESC:
- getListener().ChangeState(ItemChangeState.CANCEL);
- break;
- default:
- // TODO
- break;
- }
- }
- });
-
- skinCombo.addSelectionListener(new SelectionListener() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- String name = skinCombo.getText();
- skinCombo.setToolTipText(skinCombo.getText());
-
- newSkin = SkinList.getInstance().findSkinUseName(name, skinList);
- if (newSkin == null && name.equals(oldSkin.toString())) {
- newSkin = oldSkin;
- }
-
- if (!isCreateMode()) {
- getListener().ChangeValue(getThis());
- }
- }
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- // TODO Auto-generated method stub
- }
- });
- }
-
- @Override
- public void closeItem() {
- reCategory.dispose();
- dpiCategory.dispose();
- skinCategory.dispose();
- if (resolution != null) {
- resolution.dispose();
- }
- if (dpi != null) {
- dpi.dispose();
- }
- if (skin != null) {
- skin.dispose();
- }
-
- if (reCombo != null) {
- reCombo.dispose();
- }
-
- if (dpiSpinner != null) {
- dpiSpinner.dispose();
- }
-
- if (skinCombo != null) {
- skinCombo.dispose();
- }
- }
-
- @Override
- public boolean settingDetailItem(VMPropertyValue value) {
- resolution.setText(value.resolution.getStrTypeValue());
- resolution.setToolTipText(value.resolution.getStrTypeValue());
-
- dpi.setText(Integer.toString(value.dpi));
-
- skinList = value.baseImage.getPlatform().getSkins();
- if (value.skin != null) {
- skin.setText(value.skin.getName());
- skin.setToolTipText(value.skin.getName());
- } else {
- if (value.skinPath != null) {
- value.skin = SkinList.getInstance().findSkinUsePath(value.skinPath, skinList);
- }
- if (value.skin != null) {
- skin.setText(value.skin.getName());
- skin.setToolTipText(value.skin.getName());
- } else {
- skin.setText("");
- skin.setToolTipText("check skin directory: ." + (value.skinPath == null ? "" : value.skinPath));
- }
- }
- return false;
- }
-
- @Override
- public boolean settingModifyItem(VMPropertyValue value) {
- oldResolution = newResolution = value.resolution;
- newDPI = oldDPI = value.dpi;
- newSkin = oldSkin = value.skin;
- skinList = value.baseImage.getPlatform().getSkins();
-
- //RESOLUTION
- DisplayResolution.getInstance().initialize(oldResolution);
- reCombo.removeAll();
-
- String r = null;
- int f = -1;
- for (int i = 0; i < DisplayResolution.getInstance().getList().length; i++) {
- r = DisplayResolution.getInstance().get(i);
- if (r.equals(oldResolution.toString())) {
- f = i;
- }
- reCombo.add(r);
- }
-
- if (f == -1) {
- reCombo.add(oldResolution.toString(), 0);
- f = 0;
- }
- reCombo.select(f);
- reCombo.setToolTipText(reCombo.getText());
-
- // DPI
- dpiSpinner.setSelection(value.dpi);
- if (!isCreateMode()) {
- dpiSpinner.setFocus();
- }
-
- // SKIN
- settingSkinList(value.resolution);
-
- return true;
- }
-
- private void settingSkinList(RESOLUTION re) {
- skinCombo.removeAll();
-
- int find = -1;
- ArrayList<Skin> skins = null;
-
- if (!isCreateMode()
- && !DisplayResolution.getInstance().isMinResoluion(re)
- && EmulatorManager.getManagerMode() != ManagerModeType.INHOUSE_MODE) {
- if (oldSkin != null) {
- EMLogger.getLogger().fine("Add old skin: " + oldSkin.toString());
- skinCombo.add(oldSkin.toString());
- find = 0;
- }
- } else {
- skins = SkinList.getInstance().findSkinList(re, skinList);
-
- Skin s = null;
- for (int i = 0; i < skins.size(); i++) {
- s = skins.get(i);
- if (newSkin != null && newSkin.equals(s)) {
- find = i;
- }
- skinCombo.add(s.toString());
- }
-
- if (find == -1) {
- if (newSkin != null
- && newSkin.getType() == SKIN_TYPE.GENERAL) {
- skins.add(0, newSkin);
- skinCombo.add(newSkin.toString(), 0);
- }
- if (skins.size() > 0) {
- find = 0;
- }
- }
- }
-
- if (find >= 0) {
- skinCombo.select(find);
- skinCombo.setToolTipText(skinCombo.getText());
- newSkin = skins == null ? oldSkin : skins.get(find);
- } else {
- EMLogger.getLogger().warning("To initial Skin Combo has been failed.");
- }
- }
-
- private void changeResolution(RESOLUTION re) {
- // DPI
- if (!DisplayResolution.getInstance().isMinResoluion(re)
- && EmulatorManager.getManagerMode() != ManagerModeType.INHOUSE_MODE) {
- EMLogger.getLogger().fine("Emulator Manager does not support this resolution -> " + re.getStrTypeValue());
- dpiSpinner.setSelection(oldDPI);
- } else {
- dpiSpinner.setSelection(re.getDPI());
- }
-
- // SKIN
- settingSkinList(re);
- }
-
- private static boolean isShareMinMode = false;
-
- @Override
- protected void changeArrowState() {
- super.changeArrowState();
- isShareMinMode = isMinMode;
- }
-
- @Override
- public void settingStatus(boolean isRefresh) {
- if (isRefresh) {
- if (isMinMode) {
- arrowButton.setSelection(false);
- changeArrowState();
- }
- } else {
- if (isShareMinMode != isMinMode) {
- arrowButton.setSelection(isShareMinMode);
- changeArrowState();
- }
- }
- if (!isCreateMode() && dpiSpinner != null) {
- dpiSpinner.setFocus();
- }
- }
-
- @Override
- public boolean checkValue() {
- return true;
- }
-}
+++ /dev/null
-/*
- * Emulator Manager
- *
- * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * JiHye Kim <jihye1128.kim@samsung.com>
- * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
- * SeokYeon Hwang <syeon.hwang@samsung.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-package org.tizen.emulator.manager.wearable.ui.detail;
-
-import java.io.File;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.widgets.DirectoryDialog;
-import org.eclipse.swt.widgets.Label;
-import org.tizen.emulator.manager.EmulatorManager;
-import org.tizen.emulator.manager.logging.EMLogger;
-import org.tizen.emulator.manager.resources.ColorResources;
-import org.tizen.emulator.manager.resources.FontResources;
-import org.tizen.emulator.manager.resources.ImageResources;
-import org.tizen.emulator.manager.resources.PatchImageResources;
-import org.tizen.emulator.manager.resources.StringResources;
-import org.tizen.emulator.manager.ui.MainDialog;
-import org.tizen.emulator.manager.ui.detail.item.DetailViewItem;
-import org.tizen.emulator.manager.ui.widgets.ImageButton;
-import org.tizen.emulator.manager.ui.widgets.ImageLabel;
-import org.tizen.emulator.manager.vms.VMPropertyValue;
-
-public class TFileShareItem extends DetailViewItem {
- private boolean oldSupport;
- private boolean newSupport;
-
- private String newPath;
- private String oldPathName;
- private String newPathName;
- private DirectoryDialog sharedFD;
-
- @Override
- public void init() {
- title = "File Sharing";
- count = 2;
- }
-
- @Override
- public void setValue(VMPropertyValue value) {
- value.isFileShareSupport = newSupport;
-
- value.fileSharePath = newPath;
- value.fileSharePathName = newPathName;
- }
-
-
- private ImageLabel supportLabel;
- private ImageLabel dirCategory;
- private ImageLabel directoryLabel;
-
- private static int INPUTBOX_WIDTH = 175;
- private static int DIR_CATEGORY_WIDTH = 66;
- private static int DIR_INPUTBOX_OFF_WIDTH = 105;
- // for modify
- private static int DIR_INPUTBOX_ON_WIDTH = 133;
-
- @Override
- public void drawDetail() {
- supportLabel = new ImageLabel(compList.get(0), SWT.NONE);
- supportLabel.setEnableImage(PatchImageResources.getInputBoxOff(INPUTBOX_WIDTH));
-
- dirCategory = new ImageLabel(compList.get(1), SWT.NONE);
- dirCategory.setText("Directory");
- dirCategory.setEnableImage(PatchImageResources.getCategoryBox(DIR_CATEGORY_WIDTH));
- dirCategory.setEnableFontColor(ColorResources.DETAIL_CATEGORY_FONT_COLOR.getColor());
-
- directoryLabel = new ImageLabel(compList.get(1), SWT.NONE);
- directoryLabel.setEnableImage(PatchImageResources.getInputBoxOff(DIR_INPUTBOX_OFF_WIDTH));
-
- FormData data = new FormData();
- data.left = new FormAttachment(0, INPUTBOX_OFFSET);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP);
- data.width = supportLabel.getSize().x;
- data.height = supportLabel.getSize().y;
- supportLabel.setLayoutData(data);
-
- data = new FormData();
- data.left = new FormAttachment(0, INPUTBOX_OFFSET);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP + 1);
- data.width = dirCategory.getSize().x;
- data.height = dirCategory.getSize().y;
- dirCategory.setLayoutData(data);
-
- data = new FormData();
- data.left = new FormAttachment(dirCategory, 4);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP);
- data.width = directoryLabel.getSize().x;
- data.height = directoryLabel.getSize().y;
- directoryLabel.setLayoutData(data);
-
- comp.layout(true, true);
- }
-
- private Label stateLabel;
- private ImageButton selectSupport;
- private ImageButton selectDirButton;
-
- private static String toolTipforMac = "Please refer to file sharing section in SDK documentation.";
- @Override
- public void drawModify() {
-
- makeModifyWidget();
-
- FormData data = new FormData();
- data.left = new FormAttachment(0, INPUTBOX_OFFSET);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP);
- data.width = TOGGLE_BUTTON_WIDTH;
- data.height = TOGGLE_BUTTON_HEIGHT;
- selectSupport.setLayoutData(data);
-
- data = new FormData();
- data.left = new FormAttachment(selectSupport, 10);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP + 1);
- data.width = TOGGLE_BUTTON_WIDTH;
- stateLabel.setLayoutData(data);
-
- data = new FormData();
- data.left = new FormAttachment(0,INPUTBOX_OFFSET);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP);
- data.width = directoryLabel.getSize().x;
- data.height = directoryLabel.getSize().y;
- directoryLabel.setLayoutData(data);
-
- data = new FormData();
- data.left = new FormAttachment(directoryLabel, 5);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP);
- data.width = FILE_SELECT_BUTTON_WIDTH;
- data.height = FILE_SELECT_BUTTON_HEIGHT;
- selectDirButton.setLayoutData(data);
- }
-
- private void makeModifyWidget() {
- selectSupport = new ImageButton(compList.get(0), SWT.TOGGLE);
- selectSupport.setImages(ImageResources.TOGGLE_ON_NOMAL.getImage(),
- ImageResources.TOGGLE_ON_HOVER.getImage(),
- ImageResources.TOGGLE_ON_PUSH.getImage(),
- ImageResources.TOGGLE_OFF_NOMAL.getImage(),
- ImageResources.TOGGLE_OFF_HOVER.getImage(),
- ImageResources.TOGGLE_OFF_PUSH.getImage(),
- ImageResources.TOGGLE_OFF_PUSH.getImage()); //disable
-
- selectSupport.addSelectionListener(new SelectionListener() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- if (selectSupport.isSelection()) { // NOT SUPPORT
- newSupport = false;
- stateLabel.setText(StringResources.NOT_SUPPORTED);
- directoryLabel.setText("");
- selectDirButton.setEnabled(false);
- } else { // SUPPORT
- newSupport = true;
- stateLabel.setText(StringResources.SUPPORTED);
- directoryLabel.setText(newPathName);
- selectDirButton.setEnabled(true);
- }
- if (!isCreateMode()) {
- getListener().ChangeValue(getThis());
- }
- }
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- // TODO Auto-generated method stub
- }
- });
-
- stateLabel = new Label(compList.get(0), SWT.NONE);
- stateLabel.setFont(FontResources.DETAIL_LABEL_FONT.getFont());
- stateLabel.setForeground(ColorResources.DETAIL_ENABLE_FONT_COLOR.getColor());
- stateLabel.setBackground(ColorResources.DETAIL_MIDDLE_COLOR.getColor());
-
- directoryLabel = new ImageLabel(compList.get(1), SWT.NONE);
- directoryLabel.setEnableImage(PatchImageResources.getInputBoxON(DIR_INPUTBOX_ON_WIDTH));
- directoryLabel.setEnabled(false);
-
- selectDirButton = new ImageButton(compList.get(1), SWT.PUSH);
- selectDirButton.setImages(
- ImageResources.BUTTON_FILE_NOMAL.getImage(),
- ImageResources.BUTTON_FILE_HOVER.getImage(),
- ImageResources.BUTTON_FILE_PUSH.getImage(),
- ImageResources.BUTTON_FILE_DISABLE.getImage());
-
- selectDirButton.addSelectionListener(new SelectionListener() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- if (sharedFD == null) {
- sharedFD = new DirectoryDialog(
- MainDialog.getShell(), SWT.OPEN);
- sharedFD.setText("Select directory");
- }
-
- EMLogger.getLogger().fine("Open Directory Dialog");
- String path = sharedFD.open();
-
- if (path != null) {
- EMLogger.getLogger().fine("Select directory for FileShare: " + path);
- newPath = path;
- newPathName = path.substring(path
- .lastIndexOf(File.separator) + 1, path.length());
- directoryLabel.setText(newPathName);
- directoryLabel.setToolTipText(newPath);
-
- if (!isCreateMode()) {
- getListener().ChangeValue(getThis());
- }
- }
- }
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- // TODO Auto-generated method stub
- }
- });
- }
-
- @Override
- public boolean settingDetailItem(VMPropertyValue value) {
- supportLabel.setText(value.isFileShareSupport
- ? StringResources.SUPPORTED
- : StringResources.NOT_SUPPORTED);
-
- directoryLabel.setText(value.isFileShareSupport
- ? value.fileSharePathName
- : "");
- directoryLabel.setToolTipText(value.fileSharePath);
-
- return true;
- }
-
- @Override
- public boolean settingModifyItem(VMPropertyValue value) {
- newSupport = oldSupport = value.isFileShareSupport;
- newPath = value.fileSharePath;
- newPathName = oldPathName = value.fileSharePathName;
-
- if (oldSupport) {
- selectSupport.setSelection(false);
- stateLabel.setText(StringResources.SUPPORTED);
- directoryLabel.setText(oldPathName);
- directoryLabel.setToolTipText(newPath);
- selectDirButton.setEnabled(true);
- } else {
- selectSupport.setSelection(true);
- stateLabel.setText(StringResources.NOT_SUPPORTED);
- directoryLabel.setText(oldPathName);
- selectDirButton.setEnabled(false);
- }
- return true;
- }
-
- @Override
- public void closeItem() {
- if (supportLabel != null) {
- supportLabel.dispose();
- }
-
- if (dirCategory != null) {
- dirCategory.dispose();
- }
-
- if (directoryLabel != null) {
- directoryLabel.dispose();
- }
-
- if (stateLabel != null) {
- stateLabel.dispose();
- }
-
- if (selectSupport != null) {
- selectSupport.dispose();
- }
-
- if (selectDirButton != null) {
- selectDirButton.dispose();
- }
- }
-
- private static boolean isShareMinMode = false;
-
- @Override
- protected void changeArrowState() {
- super.changeArrowState();
- isShareMinMode = isMinMode;
- }
-
- @Override
- public void settingStatus(boolean isRefresh) {
- if (isRefresh) {
- if (isMinMode) {
- arrowButton.setSelection(false);
- changeArrowState();
- }
- } else {
- if (isShareMinMode != isMinMode) {
- arrowButton.setSelection(isShareMinMode);
- changeArrowState();
- }
- }
- }
-
- @Override
- public boolean checkValue() {
- return true;
- }
-
-}
+++ /dev/null
-/*
- * Emulator Manager
- *
- * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * JiHye Kim <jihye1128.kim@samsung.com>
- * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
- * SeokYeon Hwang <syeon.hwang@samsung.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-package org.tizen.emulator.manager.wearable.ui.detail;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.widgets.Label;
-import org.tizen.emulator.manager.resources.ColorResources;
-import org.tizen.emulator.manager.resources.FontResources;
-import org.tizen.emulator.manager.resources.ImageResources;
-import org.tizen.emulator.manager.resources.PatchImageResources;
-import org.tizen.emulator.manager.resources.StringResources;
-import org.tizen.emulator.manager.tool.CheckVirtualization;
-import org.tizen.emulator.manager.ui.detail.item.DetailViewItem;
-import org.tizen.emulator.manager.ui.widgets.ImageButton;
-import org.tizen.emulator.manager.ui.widgets.ImageLabel;
-import org.tizen.emulator.manager.vms.VMPropertyValue;
-
-public class THWSupportItem extends DetailViewItem {
- private boolean oldHWSupport;
- private boolean newHWSupport;
- private boolean oldGPUSupport;
- private boolean newGPUSupport;
-
- @Override
- public void init() {
- title = "HW Support";
- count = 2;
- }
-
- @Override
- public void setValue(VMPropertyValue value) {
- value.isHWVirtualization = newHWSupport;
- value.isGLAcceleration = newGPUSupport;
- }
-
- private ImageLabel virtualCategory;
- private ImageLabel GPUCategory;
-
- private ImageLabel virtualLabel;
- private ImageLabel GPULabel;
-
- private static int INPUTBOX_WIDTH = 105;
- private static int CATEGORY_WIDTH = 66;
-
- private static String GPUToolTipText = "If you enable the GPU option,"
- + StringResources.NEW_LINE
- + "the rendering performance of video player or camera may degrade.";
- private static String CPUDisableToolTipText = "Your system cannot support HW virtualization."
- + StringResources.NEW_LINE + "Try install KVM (linux) or HAX (windows or mac)";
- private static String GPUDisableToolTipText = "Your system cannot support HW OpenGL acceleration."
- + StringResources.NEW_LINE + "Try upgrade graphic card driver.";
- private void makeCategory() {
- virtualCategory = new ImageLabel(compList.get(0), SWT.NONE);
- virtualCategory.setEnableImage(PatchImageResources.getCategoryBox(CATEGORY_WIDTH));
- virtualCategory.setEnableFontColor(ColorResources.DETAIL_CATEGORY_FONT_COLOR.getColor());
- virtualCategory.setText("CPU VT");
-
- GPUCategory = new ImageLabel(compList.get(1), SWT.NONE);
- GPUCategory.setEnableImage(PatchImageResources.getCategoryBox(CATEGORY_WIDTH));
- GPUCategory.setEnableFontColor(ColorResources.DETAIL_CATEGORY_FONT_COLOR.getColor());
- GPUCategory.setText("GPU");
- GPUCategory.setToolTipText(GPUToolTipText);
-
- FormData data = new FormData();
- data.left = new FormAttachment(0, INPUTBOX_OFFSET);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP + 1);
- data.width = virtualCategory.getSize().x;
- data.height = virtualCategory.getSize().y;
- virtualCategory.setLayoutData(data);
-
- data = new FormData();
- data.left = new FormAttachment(0, INPUTBOX_OFFSET);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP + 1);
- data.width = GPUCategory.getSize().x;
- data.height = GPUCategory.getSize().y;
- GPUCategory.setLayoutData(data);
- }
-
- @Override
- public void drawDetail() {
- makeCategory();
-
- virtualLabel = new ImageLabel(compList.get(0), SWT.NONE);
- virtualLabel.setEnableImage(PatchImageResources.getInputBoxOff(INPUTBOX_WIDTH));
-
- GPULabel = new ImageLabel(compList.get(1), SWT.NONE);
- GPULabel.setEnableImage(PatchImageResources.getInputBoxOff(INPUTBOX_WIDTH));
- GPULabel.setToolTipText(GPUToolTipText);
-
- FormData data = new FormData();
- data.left = new FormAttachment(virtualCategory, 4);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP);
- data.width = virtualLabel.getSize().x;
- data.height = virtualLabel.getSize().y;
- virtualLabel.setLayoutData(data);
-
- data = new FormData();
- data.left = new FormAttachment(GPUCategory, 4);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP);
- data.width = GPULabel.getSize().x;
- data.height = GPULabel.getSize().y;
- GPULabel.setLayoutData(data);
- }
-
- private ImageButton virtualButton;
- private ImageButton GPUButton;
- private Label virtualState;
- private Label GPUState;
- @Override
- public void drawModify() {
- makeCategory();
- makeModifyWidget();
-
- FormData data = new FormData();
- data.left = new FormAttachment(virtualCategory, 4);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP);
- data.width = TOGGLE_BUTTON_WIDTH;
- data.height = TOGGLE_BUTTON_HEIGHT;
- virtualButton.setLayoutData(data);
-
- data = new FormData();
- data.left = new FormAttachment(virtualButton, 10);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP + 1);
- data.width = INPUTBOX_WIDTH - TOGGLE_BUTTON_WIDTH - INPUTBOX_RIGHT_GAP;
- virtualState.setLayoutData(data);
-
- data = new FormData();
- data.left = new FormAttachment(GPUCategory, 4);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP);
- data.width = TOGGLE_BUTTON_WIDTH;
- data.height = TOGGLE_BUTTON_HEIGHT;
- GPUButton.setLayoutData(data);
-
- data = new FormData();
- data.left = new FormAttachment(GPUButton, 10);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP + 1);
- data.width = INPUTBOX_WIDTH - TOGGLE_BUTTON_WIDTH - INPUTBOX_RIGHT_GAP;
- GPUState.setLayoutData(data);
- }
-
- private void makeModifyWidget() {
- virtualButton = new ImageButton(compList.get(0), SWT.TOGGLE);
- virtualButton.setImages(ImageResources.TOGGLE_ON_NOMAL.getImage(),
- ImageResources.TOGGLE_ON_HOVER.getImage(),
- ImageResources.TOGGLE_ON_PUSH.getImage(),
- ImageResources.TOGGLE_OFF_NOMAL.getImage(),
- ImageResources.TOGGLE_OFF_HOVER.getImage(),
- ImageResources.TOGGLE_OFF_PUSH.getImage(),
- ImageResources.TOGGLE_OFF_PUSH.getImage()); //disable
-
- virtualButton.addSelectionListener(new SelectionListener() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- if (virtualButton.isSelection()) { // NOT SUPPORT
- newHWSupport = false;
- virtualState.setText(StringResources.NOT_SUPPORTED);
- } else { // SUPPORT
- newHWSupport = true;
- virtualState.setText(StringResources.SUPPORTED);
- }
- if (!isCreateMode()) {
- getListener().ChangeValue(getThis());
- }
- }
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- // TODO Auto-generated method stub
- }
- });
-
- virtualState = new Label(compList.get(0), SWT.NONE);
- virtualState.setFont(FontResources.DETAIL_LABEL_FONT.getFont());
- virtualState.setForeground(ColorResources.DETAIL_ENABLE_FONT_COLOR.getColor());
- virtualState.setBackground(ColorResources.DETAIL_MIDDLE_COLOR.getColor());
-
- GPUButton = new ImageButton(compList.get(1), SWT.TOGGLE);
- GPUButton.setImages(ImageResources.TOGGLE_ON_NOMAL.getImage(),
- ImageResources.TOGGLE_ON_HOVER.getImage(),
- ImageResources.TOGGLE_ON_PUSH.getImage(),
- ImageResources.TOGGLE_OFF_NOMAL.getImage(),
- ImageResources.TOGGLE_OFF_HOVER.getImage(),
- ImageResources.TOGGLE_OFF_PUSH.getImage(),
- ImageResources.TOGGLE_OFF_PUSH.getImage()); //disable
-
- GPUButton.addSelectionListener(new SelectionListener() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- if (GPUButton.isSelection()) { // NOT SUPPORT
- newGPUSupport = false;
- GPUState.setText(StringResources.NOT_SUPPORTED);
- } else { // SUPPORT
- newGPUSupport = true;
- GPUState.setText(StringResources.SUPPORTED);
- }
-
- if (!isCreateMode()) {
- getListener().ChangeValue(getThis());
- }
- }
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- // TODO Auto-generated method stub
- }
- });
-
- GPUButton.setToolTipText(GPUToolTipText);
-
- GPUState = new Label(compList.get(1), SWT.NONE);
- GPUState.setFont(FontResources.DETAIL_LABEL_FONT.getFont());
- GPUState.setForeground(ColorResources.DETAIL_ENABLE_FONT_COLOR.getColor());
- GPUState.setBackground(ColorResources.DETAIL_MIDDLE_COLOR.getColor());
- }
-
- private boolean isArm = false;
-
- @Override
- public boolean settingDetailItem(VMPropertyValue value) {
- isArm = value.archType.equals("arm");
-
- if (!CheckVirtualization.getInstance().isSupportVirtualization()
- || isArm) {
- virtualLabel.setText(StringResources.DISABLED);
- virtualLabel.setToolTipText(CPUDisableToolTipText);
- } else {
- virtualLabel.setText(value.isHWVirtualization
- ? StringResources.SUPPORTED
- : StringResources.NOT_SUPPORTED);
- virtualLabel.setToolTipText("");
- }
-
- if (!CheckVirtualization.getInstance().isSupportGPU()
- || isArm) {
- GPULabel.setText(StringResources.DISABLED);
- GPULabel.setToolTipText(GPUDisableToolTipText);
- } else {
- GPULabel.setText(value.isGLAcceleration
- ? StringResources.SUPPORTED
- : StringResources.NOT_SUPPORTED);
- GPULabel.setToolTipText(GPUToolTipText);
- }
- return false;
- }
-
- @Override
- public boolean settingModifyItem(VMPropertyValue value) {
- isArm = value.archType.equals("arm");
- if (isCreateMode() && isArm) {
- newHWSupport = oldHWSupport = false;
- newGPUSupport = oldGPUSupport = false;
- } else {
- newHWSupport = oldHWSupport = value.isHWVirtualization;
- newGPUSupport = oldGPUSupport = value.isGLAcceleration;
- }
-
- if (!CheckVirtualization.getInstance().isSupportVirtualization()
- || isArm) {
- virtualButton.setEnabled(false);
- virtualState.setText(StringResources.DISABLED);
- virtualState.setToolTipText(CPUDisableToolTipText);
- } else {
- if (oldHWSupport) {
- virtualButton.setSelection(false);
- virtualState.setText(StringResources.SUPPORTED);
- } else {
- virtualButton.setSelection(true);
- virtualState.setText(StringResources.NOT_SUPPORTED);
- }
- virtualState.setToolTipText("");
- }
-
- if (!CheckVirtualization.getInstance().isSupportGPU() || isArm) {
- GPUButton.setEnabled(false);
- GPUState.setText(StringResources.DISABLED);
- GPUState.setToolTipText(GPUDisableToolTipText);
- } else {
- if (oldGPUSupport /*&& !isArm
- && CheckVirtualization.getInstance().isSupportGPU()*/) {
- GPUButton.setSelection(false);
- GPUState.setText(StringResources.SUPPORTED);
- } else {
- GPUButton.setSelection(true);
- GPUState.setText(StringResources.NOT_SUPPORTED);
- }
- GPUState.setToolTipText(GPUToolTipText);
- }
-
- return false;
- }
-
- @Override
- public void closeItem() {
- if (virtualCategory != null) {
- virtualCategory.dispose();
- }
-
- if (GPUCategory != null) {
- GPUCategory.dispose();
- }
-
- if (virtualLabel != null) {
- virtualLabel.dispose();
- }
-
- if (GPULabel != null) {
- GPULabel.dispose();
- }
-
- if (virtualButton != null) {
- virtualButton.dispose();
- }
-
- if (GPUButton != null) {
- GPUButton.dispose();
- }
-
- if (virtualState != null) {
- virtualState.dispose();
- }
-
- if (GPUState != null) {
- GPUState.dispose();
- }
- }
-
- private static boolean isShareMinMode = false;
- @Override
- protected void changeArrowState() {
- super.changeArrowState();
- isShareMinMode = isMinMode;
- }
-
- @Override
- public void settingStatus(boolean isRefresh) {
- if (isRefresh) {
- if (isMinMode) {
- arrowButton.setSelection(false);
- changeArrowState();
- }
- } else {
- if (isShareMinMode != isMinMode) {
- arrowButton.setSelection(isShareMinMode);
- changeArrowState();
- }
- }
- }
-
- @Override
- public boolean checkValue() {
- return true;
- }
-}
+++ /dev/null
-/*
- * Emulator Manager
- *
- * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * JiHye Kim <jihye1128.kim@samsung.com>
- * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
- * SeokYeon Hwang <syeon.hwang@samsung.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-package org.tizen.emulator.manager.wearable.ui.detail;
-
-import java.io.File;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyAdapter;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.PaintEvent;
-import org.eclipse.swt.events.PaintListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-import org.tizen.emulator.manager.EmulatorManager;
-import org.tizen.emulator.manager.EmulatorManager.ManagerModeType;
-import org.tizen.emulator.manager.resources.ColorResources;
-import org.tizen.emulator.manager.resources.FontResources;
-import org.tizen.emulator.manager.resources.ImageResources;
-import org.tizen.emulator.manager.resources.PatchImageResources;
-import org.tizen.emulator.manager.resources.StringResources;
-import org.tizen.emulator.manager.ui.MainDialog;
-import org.tizen.emulator.manager.ui.VMsMainView;
-import org.tizen.emulator.manager.ui.detail.item.DetailViewItem;
-import org.tizen.emulator.manager.ui.detail.item.ItemChangeState;
-import org.tizen.emulator.manager.ui.dialog.MessageDialog;
-import org.tizen.emulator.manager.ui.widgets.ImageButton;
-import org.tizen.emulator.manager.ui.widgets.ImageLabel;
-import org.tizen.emulator.manager.vms.EmulatorVMList;
-import org.tizen.emulator.manager.vms.VMProperty;
-import org.tizen.emulator.manager.vms.VMPropertyValue;
-import org.tizen.emulator.manager.vms.helper.HelperClass;
-
-public class TNameTextItem extends DetailViewItem {
- private boolean isStandard;
-
- // for vm name
- private String oldName = "";
- private String newName = "";
-
- // for base image
- private String subTitle;
- private Label subTitleLabel;
-
- private String newPath;
- private String newPathName;
- private FileDialog baseImageFD;
- private boolean isSelected;
-
- @Override
- public void setValue(VMPropertyValue value) {
- value.vmsName = newName;
-
- value.baseImagePath = newPath;
- value.baseImagePathName = newPathName;
- }
-
- @Override
- public void init() {
- title = "Name";
- subTitle = "Base Image";
- count = 2;
- }
-
- @Override
- protected void initTitle(boolean supportMinMode) {
- super.initTitle(false);
-
- subTitleLabel = new Label(compList.get(1), SWT.NONE);
-
- subTitleLabel.setFont(FontResources.DETAIL_TITLE_FONT.getFont());
- subTitleLabel.setForeground(ColorResources.DETAIL_TITILE_FONT_COLOR.getColor());
- FormData data = new FormData();
- data.left = new FormAttachment(0, TITLE_LEFT_GAP);
- data.top = new FormAttachment(0, TITLE_TOP_GAP);
- data.height = TITLE_HEIGHT;
- data.width = TITLE_WIDTH;
- subTitleLabel.setLayoutData(data);
- subTitleLabel.setBackground(ColorResources.DETAIL_MIDDLE_COLOR.getColor());
- subTitleLabel.addPaintListener(new PaintListener() {
- @Override
- public void paintControl(PaintEvent e) {
- drawTitle(e, subTitle);
- }
- });
- }
-
- private ImageLabel nameLabel;
- private ImageLabel baseImageLabel;
-
- private static int INPUTBOX_WIDTH = 175;
- private static Image INPUTBOX_ON_IMAGE = null;
- private static Image INPUTBOX_OFF_IMAGE = null;
-
- // for modify (base image)
- private static int IMAGE_INPUTBOX_WIDTH = 133;
- private static Image IMAGE_INPUTBOX_IMAGE = null;
-
- @Override
- public void drawDetail() {
- if (INPUTBOX_OFF_IMAGE == null) {
- INPUTBOX_OFF_IMAGE = PatchImageResources.getInputBoxOff(INPUTBOX_WIDTH);
- }
-
- nameLabel = new ImageLabel(compList.get(0), SWT.NONE);
- nameLabel.setEnableImage(INPUTBOX_OFF_IMAGE);
- nameLabel.setDisableImage(INPUTBOX_OFF_IMAGE);
-
- FormData data = new FormData();
- data.left = new FormAttachment(0, INPUTBOX_OFFSET);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP);
- data.width = nameLabel.getSize().x;
- data.height = nameLabel.getSize().y;
- nameLabel.setLayoutData(data);
-
- baseImageLabel = new ImageLabel(compList.get(1), SWT.NONE);
- baseImageLabel.setEnableImage(INPUTBOX_OFF_IMAGE);
- baseImageLabel.setDisableImage(INPUTBOX_OFF_IMAGE);
-
- data = new FormData();
- data.left = new FormAttachment(0, INPUTBOX_OFFSET);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP);
- data.width = baseImageLabel.getSize().x;
- data.height = baseImageLabel.getSize().y;
- baseImageLabel.setLayoutData(data);
-
- comp.layout(true, true);
- }
-
- private Text nameText;
- private ImageButton selectImageButton;
- @Override
- public void drawModify() {
- if (INPUTBOX_ON_IMAGE == null) {
- INPUTBOX_ON_IMAGE = PatchImageResources.getInputBoxON(INPUTBOX_WIDTH);
- }
- if (IMAGE_INPUTBOX_IMAGE == null) {
- IMAGE_INPUTBOX_IMAGE = PatchImageResources.getInputBoxON(IMAGE_INPUTBOX_WIDTH);
- }
-
- makeModifyNameLabel();
-
- FormData data = new FormData();
- data.left = new FormAttachment(0, INPUTBOX_OFFSET);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP);
- data.width = nameLabel.getSize().x;
- data.height = nameLabel.getSize().y;
- nameLabel.setLayoutData(data);
-
- makeModifyBaseImage();
-
- data = new FormData();
- data.left = new FormAttachment(0, INPUTBOX_OFFSET);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP);
- data.width = baseImageLabel.getSize().x;
- data.height = baseImageLabel.getSize().y;
- baseImageLabel.setLayoutData(data);
-
- data = new FormData();
- data.left = new FormAttachment(baseImageLabel, 5);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP);
- data.width = FILE_SELECT_BUTTON_WIDTH;
- data.height = FILE_SELECT_BUTTON_HEIGHT;
- selectImageButton.setLayoutData(data);
- }
-
- private void makeModifyNameLabel() {
- nameLabel = new ImageLabel(compList.get(0), SWT.NONE);
- nameLabel.setEnableImage(INPUTBOX_ON_IMAGE);
- nameLabel.setDisableImage(INPUTBOX_OFF_IMAGE);
- nameLabel.setLayout(new FormLayout());
-
- nameText = new Text(nameLabel, SWT.NONE);
- nameText.setBackground(ColorResources.DETAIL_INPUT_BOX_COLOR.getColor());
- nameText.setFont(FontResources.DETAIL_LABEL_FONT.getFont());
- nameText.setForeground(ColorResources.DETAIL_ENABLE_FONT_COLOR.getColor());
- nameText.setTextLimit(VMProperty.MAX_NAME_LEN);
-
- FormData data = new FormData();
- data.left = new FormAttachment(0, 5);
- data.top = new FormAttachment(0, 2);
- data.right = new FormAttachment(100, -5);
- data.bottom = new FormAttachment(100, -2);
- nameText.setLayoutData(data);
-
- nameText.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- if (isCreateMode()) {
- newName = nameText.getText();
- checkVMName();
- }
- }
- });
-
- nameText.addKeyListener(new KeyAdapter() {
- public void keyPressed(KeyEvent event) {
- switch (event.keyCode) {
- case SWT.CR:
- case SWT.KEYPAD_CR:
- ///TODO
- getListener().ChangeState(ItemChangeState.CREATE);
- break;
- case SWT.ESC:
- getListener().ChangeState(ItemChangeState.CANCEL);
- break;
- default:
- // TODO
- break;
- }
- }
- });
- }
-
- private void checkVMName() {
- if (HelperClass.checkImageName(newName, true)) {
- if (isStandard) {
- getListener().ChangeValue(true);
- } else {
- if (isSelected) {
- getListener().ChangeValue(true);
- } else {
- getListener().ChangeValue(false);
- }
- }
- } else {
- getListener().ChangeValue(false);
- }
- }
-
- private void makeModifyBaseImage() {
- baseImageLabel = new ImageLabel(compList.get(1), SWT.NONE);
- baseImageLabel.setEnableImage(IMAGE_INPUTBOX_IMAGE);
- baseImageLabel.setDisableImage(IMAGE_INPUTBOX_IMAGE);
-
- selectImageButton = new ImageButton(compList.get(1), SWT.PUSH);
- selectImageButton.setImages(
- ImageResources.BUTTON_FILE_NOMAL.getImage(),
- ImageResources.BUTTON_FILE_HOVER.getImage(),
- ImageResources.BUTTON_FILE_PUSH.getImage(),
- ImageResources.BUTTON_FILE_DISABLE.getImage());
-
- selectImageButton.addSelectionListener(new SelectionListener() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- if (baseImageFD == null) {
- baseImageFD = new FileDialog(MainDialog.getShell(), SWT.OPEN);
- baseImageFD.setText(String.format("Select existing Base Image"));
- String[] filter = null;
- String[] filterName = null;
- if (EmulatorManager.getManagerMode() == ManagerModeType.INHOUSE_MODE) {
- filter = new String[]{"*.x86", "*.arm"};
- filterName = new String[]{"Disk Image Files(*.x86)", "Disk Image Files(*.arm)"};
- } else {
- filter = new String[]{"*.x86"};
- filterName = new String[]{"Disk Image Files(*.x86)"};
- }
- baseImageFD.setFilterExtensions(filter);
- baseImageFD.setFilterNames(filterName);
- }
-
- String path = baseImageFD.open();
- if (path != null) {
- if (!HelperClass.isPathAvaliable(path)) {
- new MessageDialog().openWarningDialog("This base image not ready yet."
- + StringResources.NEW_LINE
- + "Please select again in a few seconds.");
- return;
- }
- newPath = path;
- newPathName = path.substring(path.lastIndexOf(File.separator) + 1, path.length());
-
- // for arm emulator
- boolean isArm = newPathName.endsWith("arm");
- EmulatorVMList.getInstance().CustomArch = !isArm ? "x86" : "arm";
-
- baseImageLabel.setText(newPathName);
- baseImageLabel.redraw();
- isSelected = true;
- checkVMName();
-
- // TODO
- //arm image
- //false hw virtualization
- //false gl accelertaion
- }
- }
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- // TODO Auto-generated method stub
- }
- });
- }
-
- protected boolean checkImageName() {
- return true;
- }
-
- @Override
- public void closeItem() {
- subTitleLabel.dispose();
-
- nameLabel.dispose();
- baseImageLabel.dispose();
-
- if (nameText != null) {
- nameText.dispose();
- }
- if (selectImageButton != null) {
- selectImageButton.dispose();
- }
- }
-
- @Override
- public boolean settingDetailItem(VMPropertyValue value) {
- if (nameLabel != null) {
- nameLabel.setText(value.vmsName);
- }
-
- if (baseImageLabel != null) {
- baseImageLabel.setText(value.baseImagePathName);
- if (!value.isStandard) {
- baseImageLabel.setToolTipText(value.baseImagePath);
- }
- }
- return true;
- }
-
- @Override
- public boolean settingModifyItem(VMPropertyValue value) {
- newName = oldName = value.vmsName;
- isStandard = value.isStandard;
-
- newPath = value.baseImagePath;
- newPathName = value.baseImagePathName;
- isSelected = false;
-
- if (isCreateMode()) {
- nameText.setText(getDefaultVMName(value));
- nameText.selectAll();
- nameText.setEnabled(true);
-
- if (value.isStandard) {
- baseImageLabel.setText(value.baseImage == null
- ? value.baseImagePathName
- : value.baseImage.getPathName());
- baseImageLabel.setEnabled(false);
- selectImageButton.setEnabled(false);
- } else {
- baseImageLabel.setEnabled(true);
- if (checkBaseImageFile(value.baseImagePath)) {
- baseImageLabel.setText(value.baseImagePathName);
- baseImageLabel.setToolTipText(value.baseImagePath);
- isSelected = true;
- getListener().ChangeValue(true);
- } else {
- baseImageLabel.setText("");
- }
- selectImageButton.setEnabled(true);
- }
- } else {
- nameText.setText(oldName);
- nameText.setEnabled(false);
-
- baseImageLabel.setText(value.baseImagePathName);
- baseImageLabel.setEnabled(false);
- selectImageButton.setEnabled(false);
- }
-
- if (VMsMainView.getInstance().isSetFocus()) {
- setFocus();
- }
- return false;
- }
-
- public void setFocus() {
- nameLabel.setFocus();
- nameText.setFocus();
- }
-
- @Override
- public void settingStatus(boolean isRefresh) {
- if (isCreateMode() && VMsMainView.getInstance().isSetFocus()) {
- setFocus();
- }
- }
-
- // Generate VMName automatically.
- // ex) "w-0627-1"
- private String getDefaultVMName(VMPropertyValue value) {
- StringBuilder sb = new StringBuilder();
- sb.append(value.profile.substring(0,1).toLowerCase());
- if (!value.isStandard) {
- sb.append("c");
- }
- sb.append("-");
-
- SimpleDateFormat formatter = new SimpleDateFormat ("MMdd");
- Date currentTime = new Date( );
- String timeStr = formatter.format(currentTime);
- sb.append(timeStr);
- sb.append("-");
-
- int count=1;
- String prefix = sb.toString();
- StringBuilder vmName = null;
- do {
- vmName = new StringBuilder();
- vmName.append(prefix).append(Integer.toString(count++));
- } while (HelperClass.checkDupulicateName(vmName.toString()) != null) ;
-
- return vmName.toString();
- }
-
- private boolean checkBaseImageFile(String baseImagePath){
- if (baseImagePath == null || baseImagePath.isEmpty()) {
- return false;
- }
- // Check ".x86"
- String pathSplit[] = null;
- if (EmulatorManager.isWin()) {
- pathSplit = baseImagePath.split("\\\\");
- } else {
- pathSplit = baseImagePath.split(File.separator);
- }
- String fileSplit[] = pathSplit[pathSplit.length-1].split("\\.");
- String extension = fileSplit[fileSplit.length-1];
- if (!extension.equals("x86")) {
- return false;
- }
- // Check whether file is exist.
- File imageFile = new File(baseImagePath);
- if (!imageFile.exists()) {
- return false;
- }
-
- return true;
- }
-
- @Override
- public boolean checkValue() {
- return true;
- }
-}
+++ /dev/null
-/*
- * Emulator Manager
- *
- * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * JiHye Kim <jihye1128.kim@samsung.com>
- * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
- * SeokYeon Hwang <syeon.hwang@samsung.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-package org.tizen.emulator.manager.wearable.ui.detail;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.widgets.Label;
-import org.tizen.emulator.manager.resources.ColorResources;
-import org.tizen.emulator.manager.resources.FontResources;
-import org.tizen.emulator.manager.resources.ImageResources;
-import org.tizen.emulator.manager.resources.PatchImageResources;
-import org.tizen.emulator.manager.ui.detail.item.DetailViewItem;
-import org.tizen.emulator.manager.ui.widgets.ImageCombo;
-import org.tizen.emulator.manager.ui.widgets.ImageLabel;
-import org.tizen.emulator.manager.ui.widgets.WSTATE;
-import org.tizen.emulator.manager.vms.VMPropertyValue;
-
-public class TRAMItem extends DetailViewItem {
- private int oldSize;
- private int newSize;
-
- @Override
- public void init() {
- title = "RAM Size";
- count = 1;
- }
-
- @Override
- public void setValue(VMPropertyValue value) {
- value.ramSize = newSize;
- }
-
- private ImageLabel ramSize;
- private ImageCombo ramSizeCombo;
- private Label stateLabel;
-
- private static int INPUTBOX_WIDTH = 175;
- private static Image INPUTBOX_ON_IMAGE = null;
- @Override
- public void drawDetail() {
- ramSize = new ImageLabel(compList.get(0), SWT.NONE);
- ramSize.setEnableImage(PatchImageResources.getInputBoxOff(INPUTBOX_WIDTH));
-
- FormData data = new FormData();
- data.left = new FormAttachment(0, INPUTBOX_OFFSET);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP);
- data.width = ramSize.getSize().x;
- data.height = ramSize.getSize().y;
- ramSize.setLayoutData(data);
- }
-
- @Override
- public void drawModify() {
- if (INPUTBOX_ON_IMAGE == null) {
- INPUTBOX_ON_IMAGE = PatchImageResources.getInputBoxON(INPUTBOX_WIDTH - 40);
- }
-
- ramSizeCombo = new ImageCombo(compList.get(0), SWT.NONE);
- ramSizeCombo.setImage(WSTATE.NORMAL, INPUTBOX_ON_IMAGE);
- ramSizeCombo.setImage(WSTATE.PUSH, INPUTBOX_ON_IMAGE);
- ramSizeCombo.setImage(WSTATE.HOVER, INPUTBOX_ON_IMAGE);
-
- ramSizeCombo.setArrowButtonImage(ImageResources.ARROW_DROPDOWN.getImage());
- ramSizeCombo.setEnabled(true);
- ramSizeCombo.setItemHeight(INPUTBOX_ON_IMAGE.getImageData().height);
-
- //
-
- stateLabel = new Label(compList.get(0), SWT.NONE);
- stateLabel.setFont(FontResources.DETAIL_LABEL_FONT.getFont());
- stateLabel.setForeground(ColorResources.DETAIL_ENABLE_FONT_COLOR.getColor());
- stateLabel.setBackground(ColorResources.DETAIL_MIDDLE_COLOR.getColor());
- stateLabel.setText("MB");
-
- FormData data = new FormData();
- data.left = new FormAttachment(0, INPUTBOX_OFFSET);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP);
- data.width = INPUTBOX_ON_IMAGE.getImageData().width;
- data.height = INPUTBOX_ON_IMAGE.getImageData().height;
- ramSizeCombo.setLayoutData(data);
-
- data = new FormData();
- data.left = new FormAttachment(ramSizeCombo, 10);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP + 1);
- data.width = 30;
- stateLabel.setLayoutData(data);
-
- for (String s : RamSize.getInstance().getList()) {
- ramSizeCombo.add(s);
- }
-
- ramSizeCombo.addSelectionListener(new SelectionListener() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- String size = ramSizeCombo.getText();
- newSize = Integer.valueOf(size);
-
- if (!isCreateMode()) {
- getListener().ChangeValue(getThis());
- }
- }
-
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- // TODO Auto-generated method stub
- }
- });
- }
-
- @Override
- public boolean settingDetailItem(VMPropertyValue value) {
- ramSize.setText(value.ramSize + " MB");
- return false;
- }
-
- @Override
- public boolean settingModifyItem(VMPropertyValue value) {
- newSize = oldSize = value.ramSize;
- String s = Integer.toString(oldSize);
- ramSizeCombo.select(RamSize.getInstance().findIndex(s));
- return false;
- }
-
- @Override
- public void closeItem() {
- if (ramSize != null) {
- ramSize.dispose();
- }
-
- if (ramSizeCombo != null) {
- ramSizeCombo.dispose();
- }
- }
-
- @Override
- public void settingStatus(boolean isRefresh) {
- // TODO Auto-generated method stub
- }
-
- @Override
- public boolean checkValue() {
- return true;
- }
-}
+++ /dev/null
-/*
- * Emulator Manager
- *
- * Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * JiHye Kim <jihye1128.kim@samsung.com>
- * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
- * SeokYeon Hwang <syeon.hwang@samsung.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-package org.tizen.emulator.manager.wearable.ui.detail;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.tizen.emulator.manager.resources.PatchImageResources;
-import org.tizen.emulator.manager.ui.detail.item.DetailViewItem;
-import org.tizen.emulator.manager.ui.widgets.ImageLabel;
-import org.tizen.emulator.manager.vms.VMPropertyValue;
-
-public class TTouchPointItem extends DetailViewItem {
- private int touchPointValue;
- @Override
- public void init() {
- title = "Max Touch Point";
- count = 1;
- }
-
- @Override
- public void setValue(VMPropertyValue value) {
- value.maxTouchCount = touchPointValue;
- }
-
- private ImageLabel touchPoint;
- private static int INPUTBOX_WIDTH = 175;
- @Override
- public void drawDetail() {
- touchPoint = new ImageLabel(compList.get(0), SWT.NONE);
- touchPoint.setEnableImage(PatchImageResources.getInputBoxOff(INPUTBOX_WIDTH));
-
- FormData data = new FormData();
- data.left = new FormAttachment(0, INPUTBOX_OFFSET);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP);
- data.width = touchPoint.getSize().x;
- data.height = touchPoint.getSize().y;
- touchPoint.setLayoutData(data);
- touchPoint.redraw();
- }
-
- @Override
- public void drawModify() {
- touchPoint = new ImageLabel(compList.get(0), SWT.NONE);
- touchPoint.setDisableImage(PatchImageResources.getInputBoxON(INPUTBOX_WIDTH));
-
- FormData data = new FormData();
- data.left = new FormAttachment(0, INPUTBOX_OFFSET);
- data.top = new FormAttachment(0, INPUTBOX_TOP_GAP);
- data.width = touchPoint.getSize().x;
- data.height = touchPoint.getSize().y;
- touchPoint.setLayoutData(data);
- touchPoint.setEnabled(false);
- }
-
- @Override
- public boolean settingDetailItem(VMPropertyValue value) {
- touchPointValue = value.maxTouchCount;
- touchPoint.setText(Integer.toString(touchPointValue));
- return false;
- }
-
- @Override
- public boolean settingModifyItem(VMPropertyValue value) {
- touchPointValue = value.maxTouchCount;
- touchPoint.setText(Integer.toString(touchPointValue));
- return false;
- }
-
- @Override
- public void closeItem() {
- touchPoint.dispose();
- }
-
- @Override
- public void settingStatus(boolean isRefresh) {
- // TODO Auto-generated method stub
- }
-
- @Override
- public boolean checkValue() {
- return true;
- }
-}
+++ /dev/null
-/*
- * Emulator Manager
- *
- * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * MunKyu Im <munkyu.im@samsung.com>
- * SeokYeon Hwang <syeon.hwang@samsung.com>
- * JiHye Kim <jihye1128.kim@samsung.com>
- * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-package org.tizen.emulator.manager.wearable.ui.detail;
-
-import java.util.ArrayList;
-
-import org.tizen.emulator.manager.EmulatorManager;
-import org.tizen.emulator.manager.EmulatorManager.ManagerModeType;
-import org.tizen.emulator.manager.resources.StringResources;
-import org.tizen.emulator.manager.vms.RAM_SIZE;
-import org.tizen.emulator.manager.vms.RESOLUTION;
-
-class StringArrayResource
-{
- private ArrayList<String> list;
- private int defaultIndex = 0;
-
- public StringArrayResource()
- {
- list = new ArrayList<String>();
- list.clear();
- }
-
- public void add(int index, String element)
- {
- list.add(index, element);
- }
-
- public String[] getList()
- {
- if (size() == 0) {
- return null;
- } else {
- return list.toArray(new String[size()]);
- }
- }
-
- public String get(int i) {
- return list.get(i);
- }
-
- public int size()
- {
- return list.size();
- }
-
- public int getDefaultIndex()
- {
- return defaultIndex;
- }
-
- public void setDefaultIndex(int index) {
- defaultIndex = index;
- }
-
- public void clear() {
- list.clear();
- }
-}
-
-class SupportType extends StringArrayResource
-{
- private static SupportType support = new SupportType();
- public static SupportType getInstance()
- {
- return support;
- }
-
- private SupportType()
- {
- add(0, StringResources.SUPPORTED);
- add(1, StringResources.NOT_SUPPORTED);
-
- setDefaultIndex(1);
- }
-
- public int findIndex(String type) {
- String[] strArray = getList();
- String s = null;
- for (int i = 0; i < strArray.length; i++) {
- s = strArray[i];
- if (s.equals(type)) {
- return i;
- }
- }
- return getDefaultIndex();
- }
-}
-
-class DisplayResolution extends StringArrayResource
-{
- private static RESOLUTION[] minResoultion = {RESOLUTION.MINI};
- private static RESOLUTION[] inhouseResoultion = {RESOLUTION.MINI, RESOLUTION.R_360_480};
-
- private static DisplayResolution resolution = new DisplayResolution();
- public static DisplayResolution getInstance()
- {
- return resolution;
- }
-
- private DisplayResolution()
- {
- }
-
- public void initialize(RESOLUTION re) {
- clear();
-
- int i = 0;
-
- if (EmulatorManager.getManagerMode() == ManagerModeType.INHOUSE_MODE) {
- for (RESOLUTION r : inhouseResoultion ) {
- if (r == RESOLUTION.MINI) {
- setDefaultIndex(i);
- }
- add(i++, r.toString());
- }
- }
- else {
- for (RESOLUTION r : minResoultion) {
- if (r == RESOLUTION.MINI) {
- setDefaultIndex(i);
- }
- add(i++, r.toString());
- }
- }
-
- if (!(EmulatorManager.getManagerMode() == ManagerModeType.INHOUSE_MODE)) {
- for (String s : getList()) {
- if (s.equals(re.toString())) {
- return;
- }
- }
- add(0, re.toString());
- }
- }
-
- public RESOLUTION findResolution(String resolution) {
- for (RESOLUTION r : inhouseResoultion) {
- if (resolution.equals(r.toString())) {
- return r;
- }
- }
-
- return null;
- }
-
- public int findIndex(String r) {
- String[] strArray = getList();
- String s = null;
- for (int i = 0; i < strArray.length; i++) {
- s = strArray[i];
- if (s.equals(r)) {
- return i;
- }
- }
-
- return getDefaultIndex();
- }
-
- public boolean isMinResoluion(RESOLUTION resolution) {
- for (RESOLUTION r : minResoultion) {
- if (resolution.getStrValue().equals(r.getStrValue())) {
- return true;
- }
- }
- return false;
- }
-}
-
-class RamSize extends StringArrayResource
-{
- private static RamSize size = new RamSize();
- public static RamSize getInstance()
- {
- return size;
- }
-
- private RamSize()
- {
- int i = 0;
- for (RAM_SIZE r : RAM_SIZE.values()) {
- if (r == RAM_SIZE.RAM512) {
- setDefaultIndex(i);
- add(i++, r.toString());
- }
- }
- }
-
- public int findIndex(String size) {
- String[] strArray = getList();
- String s = null;
- for (int i = 0; i < strArray.length; i++) {
- s = strArray[i];
- if (s.contains(size)) {
- return i;
- }
- }
- return getDefaultIndex();
- }
-}
+++ /dev/null
-/*
- * Emulator Manager
- *
- * Copyright (C) 2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * JiHye Kim <jihye1128.kim@samsung.com>
- * SeokYeon Hwang <syeon.hwang@samsung.com>
- * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-package org.tizen.emulator.manager.wearable.ui.widget;
-
-import org.eclipse.swt.events.PaintEvent;
-import org.eclipse.swt.events.PaintListener;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Canvas;
-import org.tizen.emulator.manager.plugin.PluginImageResources;
-import org.tizen.emulator.manager.resources.FontResources;
-import org.tizen.emulator.manager.ui.widgets.VMButton;
-import org.tizen.emulator.manager.ui.widgets.WSTATE;
-import org.tizen.emulator.manager.vms.VMProperty;
-import org.tizen.emulator.manager.vms.VMPropertyValue;
-
-public class VMButtonPainter implements PaintListener {
-
- @Override
- public void paintControl(PaintEvent e) {
- VMButton button = (VMButton)e.widget;
- Image image = button.getImage(button.currentState());
- if (image == null) {
- return;
- }
-
- if (button.getProperty() != null) {
- if (button.getProperty().isRunning()) {
- button.getLaunchButton().setEnabled(false);
- } else {
- button.getLaunchButton().setEnabled(true);
- }
- }
-
- Rectangle rect = ((Canvas) e.widget).getClientArea();
- GC gc = e.gc;
-
- gc.setBackground(button.getBackgroundColor(button.currentState()));
- gc.fillRectangle(rect);
- gc.drawImage(image, rect.x + W_OFFSET, rect.y + H_OFFSET);
- if (button.isSelection()) {
- gc.drawImage(PluginImageResources.VM_IMAGE_SELECTED.getImage(button.getBaseImage().getPlatform().getPluginPlatformName()),
- rect.x, rect.y);
- }
- drawButtonText(gc, rect, button);
- }
-
- private int W_OFFSET = 2;
- private int H_OFFSET = 3;
- private int X_POINT = 40 + W_OFFSET;
- private int Y_POINT = 27 + H_OFFSET;
- private int Y_GAP = 23;
- private int RE_X_POINT = 16 + W_OFFSET;
-
- private void drawButtonText(GC gc, Rectangle rect, VMButton button) {
- VMProperty property = button.getProperty();
- if (property == null) {
- return;
- }
-
- // / drawing Title
- gc.setForeground(button.getFontColor(button.currentState()));
- gc.setFont(FontResources.VM_BUTTON_TITLE_FONT.getFont());
-
- gc.setBackground(button.getBackgroundColor(button.currentState()));
- gc.drawString(button.getTitle(), button.getTitle_x(), 8, true);
-
- // reset font color
- gc.setForeground(button.getFontColor(WSTATE.NORMAL));
-
- VMPropertyValue value = property.getPropertyValue();
-
- gc.drawString(property.getArch().name(), X_POINT, Y_POINT, true);
- gc.drawString(Integer.toString(value.dpi), X_POINT, Y_POINT + Y_GAP, true);
- gc.drawString(Integer.toString(value.ramSize), X_POINT, Y_POINT + Y_GAP * 2, true);
- gc.drawString(value.resolution.getStrValue(), RE_X_POINT, Y_POINT + Y_GAP * 3, true);
- }
-
-}
+++ /dev/null
-/*
- * Emulator Manager
- *
- * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * MunKyu Im <munkyu.im@samsung.com>
- * SeokYeon Hwang <syeon.hwang@samsung.com>
- * JiHye Kim <jihye1128.kim@samsung.com>
- * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-package org.tizen.emulator.manager.wearable.vms;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.logging.Level;
-
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.tizen.emulator.manager.EmulatorManager;
-import org.tizen.emulator.manager.console.RemoteManager;
-import org.tizen.emulator.manager.logging.EMLogger;
-import org.tizen.emulator.manager.resources.FilePathResources;
-import org.tizen.emulator.manager.resources.StringResources;
-import org.tizen.emulator.manager.tool.CheckVirtualization;
-import org.tizen.emulator.manager.tool.PortHelper;
-import org.tizen.emulator.manager.tool.SettingInfoFile;
-import org.tizen.emulator.manager.ui.dialog.MessageDialog;
-import org.tizen.emulator.manager.vms.ILauncher;
-import org.tizen.emulator.manager.vms.VMProperty;
-import org.tizen.emulator.manager.vms.helper.CheckingRunningEmulator;
-import org.tizen.emulator.manager.vms.helper.MonitoringEmulator;
-import org.tizen.emulator.manager.vms.helper.VMLauncherException;
-import org.tizen.emulator.manager.vms.xml.CpuType;
-import org.tizen.emulator.manager.vms.xml.OptionType;
-import org.tizen.emulator.manager.vms.xml.TouchType;
-
-public class Launcher implements ILauncher {
- private boolean isConsole = false;
- private String binPath = null;
- private static Launcher launcher;
-
-
- // Option names in vm_config.xml
- // Add if need.
- public static final String OPT_DEVICE = "device";
- public static final String OPT_NFC = "nfc";
- public static final String OPT_BATTERY = "battery";
- public static final String OPT_CAMERA = "camera";
- public static final String OPT_HWKEY = "hwkey";
- public static final String OPT_SWAP = "swap";
- public static final String OPT_CODEC = "codec";
-
- public static final String OPT_JACK = "jack";
- public static final String OPT_USB = "usb";
- public static final String OPT_CHARGER = "charger";
-
- public static final String OPT_SENSOR = "sensor";
- public static final String OPT_ACCEL = "accel";
- public static final String OPT_GYRO = "gyro";
- public static final String OPT_GEO = "geo";
- public static final String OPT_LIGHT = "light";
- public static final String OPT_PROXI = "proxi";
- public static final String OPT_HAPTIC = "haptic";
- public static final String OPT_PRESS = "press"; // pressure
- public static final String OPT_UV = "uv"; // ultra violet
- public static final String OPT_HRM = "hrm"; // heartbeat rate meter
-
- public static Launcher getInstance() {
- if (launcher == null) {
- launcher = new Launcher();
- }
- return launcher;
- }
-
- public Launcher() {
- isConsole = EmulatorManager.isConsoleMode();
- }
-
- @Override
- public List<String> getLaunchCommand(VMProperty property, String path)
- throws VMLauncherException {
- String binary;
- String hwVirtualization = "";
- int portNo;
-
- /* check available port number */
- portNo = new PortHelper().getPortNo();
- if(portNo == -1) {
- String error = "Can not execute emulator."
- + StringResources.NEW_LINE
- + "All available ports are in use.";
- throw new VMLauncherException(error);
- }
-
- if (property.getArch().toString().equals("x86")) {
- if (EmulatorManager.isWin()) {
- binary = "emulator-x86.exe";
- } else {
- binary = "emulator-x86";
- }
- } else {
- if (EmulatorManager.isWin()) {
- binary = "emulator-arm.exe";
- } else {
- binary = "emulator-arm";
- }
- }
-
- // check disk image
- File child = new File(property.getConfiguration().getBaseInformation().getDiskImage().getCurrentDiskImage().getValue());
- File base = new File(property.getConfiguration().getBaseInformation().getDiskImage().getBaseDiskImage().getValue());
- if (!child.exists()) {
- throw new VMLauncherException("Child disk image does not exist."
- + StringResources.NEW_LINE + child.getAbsolutePath()
- , true);
- }
- if (!base.exists()) {
- throw new VMLauncherException("Base disk image does not exist."
- + StringResources.NEW_LINE + base.getAbsolutePath()
- , true);
- }
- if (property.getConfiguration().getUsability().isHwVirtualization() && CheckVirtualization.getInstance().isSupportVirtualization()) {
- hwVirtualization = CheckVirtualization.getInstance().getVirtualizationEnableCommnad();
- } else {
- hwVirtualization = CheckVirtualization.getInstance().getVirtualizationDisableCommnad();
- }
-
- List<String> cmd = new ArrayList<String>();
- int width = property.getConfiguration().getDevice().getDisplay().getResolution().getWidth();
- int height = property.getConfiguration().getDevice().getDisplay().getResolution().getHeight();
- String skinPath = null;
- if (property.getConfiguration().getDevice().getDisplay().getSkinPath() != null) {
- skinPath = property.getConfiguration().getDevice().getDisplay().getSkinPath().getPath();
- if (skinPath != null && skinPath.isEmpty()) {
- skinPath = null;
- }
- }
- String fileshare = property.getConfiguration().getUsability().getFileSharing().getPath();
- String osVersion = System.getProperty("os.version");
- boolean isFileshare = true;
- if (fileshare == null) {
- isFileshare = false;
- }
-
- /* get MAC address of host set as guest MAC address */
- String macAddr = SettingInfoFile.getMACaddr();
-
- if(macAddr.isEmpty()) {
- macAddr = "52:54:00:12:34:56";
- EMLogger.getLogger().log(Level.INFO, String.format("MAC set as default = %s", macAddr));
- }
-
- if (path == null || path.isEmpty()) {
- cmd.add(FilePathResources.getBinPath() + File.separator + binary);
- } else {
- this.binPath = path;
- cmd.add(binPath + File.separator + binary);
- }
-
- cmd.add("--skin-args");
- cmd.add("width=" + width);
- cmd.add("height=" + height);
- if (skinPath != null) {
- cmd.add("skin.path=" + skinPath);
- }
-
- if (RemoteManager.getSpiceMode()) {
- cmd.add("hb.ignore=true");
- }
-
- cmd.add("--qemu-args");
- // x86 part of cmd
- if (property.getArch().toString().equals("x86")) {
- cmd.add("-drive");
- cmd.add("file=" + property.getConfiguration().getBaseInformation().getDiskImage().getCurrentDiskImage().getValue()+ ",if=virtio,index=1");
- cmd.add( "-boot");
- cmd.add("c");
- cmd.add("-append");
- String kernelOption = "console=ttyS0 video=LVDS-1:"
- + width
- + "x"
- + height
- + "-32@60"
- + " dpi=" + property.getConfiguration().getDevice().getDisplay().getDensity().getValue() * 10
- + " ip=10.0.2.16::10.0.2.2:255.255.255.0::eth0:none"
- + " vm_name=" + property.getConfiguration().getBaseInformation().getName();
- /* set virtio-9p string in case of using directory share [kernel option] */
- if(isFileshare) {
- kernelOption += " virtio-9p";
- }
- /*
- if(property.getPropertyValue().skin != null && property.getPropertyValue().skin.getButtonType() == SKIN_BUTTON_TYPE.THREE_BUTTON_TYPE) {
- kernelOption += " platform_feature=3btn";
- } else {
- kernelOption += " platform_feature=1btn";
- }
- */
-
- cmd.add(kernelOption);
-
- /* use fileshare [non-kernel option] */
- if(isFileshare) {
- cmd.add("-virtfs");
- cmd.add("local,path=" + property.getConfiguration().getUsability().getFileSharing().getPath() +",security_model=none,mount_tag=fileshare");
- }
-
- cmd.add("-serial");
- cmd.add("file:" + FilePathResources.getTizenVmsPath() + File.separator + property.getName() + File.separator + "logs" + File.separator + "emulator.klog");
- CpuType cpuOption = property.getConfiguration().getDevice().getCPU();
- if (cpuOption != null) {
- cmd.add("-smp");
- cmd.add(String.valueOf(cpuOption.getValue().getValue()));
- }
- cmd.add("-m");
- cmd.add(String.valueOf(property.getConfiguration().getDevice().getRAM().getSize().getValue()));
- cmd.add("-M");
- cmd.add("maru-x86-machine");
- cmd.add("-net");
- cmd.add("nic,model=virtio,macaddr=" + macAddr);
- cmd.add("-soundhw");
- cmd.add("all");
- cmd.add("-usb");
- cmd.add("-vga");
- cmd.add("none");
- cmd.add("-enable-vigs");
- cmd.add("-L");
- cmd.add(FilePathResources.getBiosPath());
- cmd.add("-kernel");
- cmd.add(FilePathResources.getKernelPath() + File.separator+ "bzImage." + property.getArch().toString());
- cmd.add("-net");
- cmd.add("user,dhcpstart=10.0.2.16");
- cmd.add("-rtc");
- cmd.add("base=utc");
- if (property.getConfiguration().getBaseInformation().getDiskImage().getSwapDiskImage() != null) {
- cmd.add("-drive");
- cmd.add("file=" + property.getConfiguration().getBaseInformation().getDiskImage().getSwapDiskImage().getValue() + ",if=virtio,index=2");
- }
-
- /* append HW virtualization option if supports */
- if (hwVirtualization != null) {
- cmd.add(hwVirtualization);
- }
-
- // add hw gl acceleration
- if (property.getConfiguration().getUsability().isHwGLAcceleration()
- && CheckVirtualization.getInstance().isSupportGPU()) {
- //cmd.add(CheckVirtualization.getInstance().getGPU_enable_command());
- cmd.add("-vigs-backend");
- cmd.add("gl");
- cmd.add("-enable-yagl");
- cmd.add("-yagl-backend");
- cmd.add("vigs");
- } else {
- cmd.add("-vigs-backend");
- cmd.add("sw");
- }
-
- // for bootup status
- cmd.add("-device");
- cmd.add("virtio-esm-pci");
-
- // for brightness
- cmd.add("-device");
- cmd.add("maru-brightness");
-
- // for vmodem
- cmd.add("-device");
- cmd.add("virtio-vmodem-pci");
-
- // for hardware key
- if (checkOnOff(property.getPropertyValue().getAdvancedOptionValue(OPT_HWKEY))) {
- cmd.add("-device");
- cmd.add("virtio-hwkey-pci");
- }
-
- // for codec
- if (checkOnOff(property.getPropertyValue().getAdvancedOptionValue(OPT_CODEC))) {
- cmd.add("-device");
- cmd.add("codec-pci");
- }
-
- // for ecp
- cmd.add("-device");
- cmd.add("virtio-evdi-pci,profile=" + property.getPropertyValue().profile
- + "-" + property.getPropertyValue().version);
-
- // for camera
- if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_DEVICE, OPT_CAMERA))) {
- cmd.add("-device");
- cmd.add("maru-camera");
- }
-
- // for battery
- cmd.add("-device");
- cmd.add("virtio-power-pci");
-
- // for nfc
- if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_DEVICE, OPT_NFC))) {
- cmd.add("-device");
- cmd.add("virtio-nfc-pci");
- }
-
- // for sensor (accel, geo, gyro, light, proxi, haptic, pressure, ultra violet, heart rate meter)
- OptionType sensor = property.getPropertyValue().getAdvancedOption(OPT_SENSOR);
- if (sensor != null) {
- cmd.add("-device");
-
- StringBuilder sb = new StringBuilder();
- if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_SENSOR, OPT_ACCEL))) {
- if(!sb.toString().isEmpty()) {
- sb.append("&");
- }
- sb.append("accel");
- }
- if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_SENSOR, OPT_GEO))) {
- if(!sb.toString().isEmpty()) {
- sb.append("&");
- }
- sb.append("geo");
- }
- if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_SENSOR, OPT_GYRO))) {
- if(!sb.toString().isEmpty()) {
- sb.append("&");
- }
- sb.append("gyro");
- }
- if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_SENSOR, OPT_LIGHT))) {
- if(!sb.toString().isEmpty()) {
- sb.append("&");
- }
- sb.append("light");
- }
- if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_SENSOR, OPT_PROXI))) {
- if(!sb.toString().isEmpty()) {
- sb.append("&");
- }
- sb.append("proxi");
- }
- if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_SENSOR, OPT_HAPTIC))) {
- if(!sb.toString().isEmpty()) {
- sb.append("&");
- }
- sb.append("haptic");
- }
- if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_SENSOR, OPT_PRESS))) {
- if(!sb.toString().isEmpty()) {
- sb.append("&");
- }
- sb.append("press");
- }
- if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_SENSOR, OPT_UV))) {
- if(!sb.toString().isEmpty()) {
- sb.append("&");
- }
- sb.append("uv");
- }
- if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_SENSOR, OPT_HRM))) {
- if(!sb.toString().isEmpty()) {
- sb.append("&");
- }
- sb.append("hrm");
- }
-
- if (sb.toString().isEmpty()) {
- cmd.add("virtio-sensor-pci");
- } else {
- sb.insert(0, "virtio-sensor-pci,sensors=");
- cmd.add(sb.toString());
- }
- }
-
- // for jacks (enabled charger, and usb)
- cmd.add("-device");
- cmd.add("virtio-jack-pci,jacks=charger&usb");
- /* OptionType jacks = property.getPropertyValue().getAdvancedOption(OPT_JACK);
- if (jacks != null) {
- cmd.add("-device");
-
- StringBuilder sb = new StringBuilder();
- if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_JACK, OPT_CHARGER))) {
- if(!sb.toString().isEmpty()) {
- sb.append("&");
- }
- sb.append("charger");
- }
- if (checkOnOff(property.getPropertyValue().getAdvancedOptionSubValue(OPT_JACK, OPT_USB))) {
- if(!sb.toString().isEmpty()) {
- sb.append("&");
- }
- sb.append("usb");
- }
-
- if (sb.toString().isEmpty()) {
- cmd.add("virtio-jack-pci");
- } else {
- sb.insert(0, "virtio-jack-pci,jacks=");
- cmd.add(sb.toString());
- }
- } */
-
-
- cmd.add("-device");
- TouchType touchType = property.getConfiguration().getDevice().getTouch();
- if (touchType != null) {
- cmd.add("virtio-touchscreen-pci,max_point=" + touchType.getMaxTouchPoint());
- } else {
- cmd.add("virtio-touchscreen-pci");
- }
-
- } else { // ARM part of cmd
- cmd.add("-drive");
- cmd.add("file=" + property.getConfiguration().getBaseInformation().getDiskImage().getCurrentDiskImage().getValue()+ ",id=virtio-blk,if=none");
- cmd.add( "-device");
- cmd.add("virtio-blk,drive=virtio-blk,transport=virtio-mmio.0");
- cmd.add("-netdev");
- cmd.add("user,id=virtio-net");
- cmd.add("-device");
- cmd.add("virtio-net,netdev=virtio-net,transport=virtio-mmio.1");
- cmd.add("-append");
- cmd.add("yagl=1 console=ttySAC2,115200 video=s3cfb:"
- + width
- + "x"
- + height
- + "-24"
- + " dpi=" + property.getConfiguration().getDevice().getDisplay().getDensity().getValue() * 10
- + " rootwait root=/dev/vda rw rootfstype=ext4"
- + " ip=10.0.2.16::10.0.2.2:255.255.255.0::eth0:none"
- + " vm_name=" + property.getConfiguration().getBaseInformation().getName()
- + " virtio_mmio.device=4K@0x10AD0000:423 virtio_mmio.device=4K@0x10AC0000:422");
- cmd.add("-serial");
- cmd.add(EmulatorManager.isLinux() ? "/dev/null" : "none");
- cmd.add("-serial");
- cmd.add(EmulatorManager.isLinux() ? "/dev/null" : "none");
- cmd.add("-serial");
- cmd.add("file:" + FilePathResources.getTizenVmsPath() + File.separator + property.getName() + File.separator + "logs" + File.separator + "emulator.klog");
- cmd.add("-m");
- cmd.add(String.valueOf(property.getConfiguration().getDevice().getRAM().getSize().getValue()));
- cmd.add("-M");
- cmd.add("maru-arm-machine");
- cmd.add("-soundhw");
- cmd.add("all");
- cmd.add("-usb");
- cmd.add("-usbdevice");
- cmd.add("maru-touchscreen");
- cmd.add("-kernel");
- cmd.add(FilePathResources.getKernelPath() + File.separator+ "bzImage." + property.getArch().toString());
- }
-
- //}
-
- /* append user added options if exists */
- String advancedOptions = property.getConfiguration().getUsability().getAdvancedOptions();
- if (advancedOptions != null) {
- String[] arrOptions = advancedOptions.split(" ");
- for (String option : arrOptions) {
- cmd.add(option);
- }
- }
-
- /* spice options */
- if (RemoteManager.getSpiceMode()) {
- cmd.add("-spice");
- cmd.add("disable-ticketing");
- cmd.add("-device");
- cmd.add("virtio-serial-pci,id=virtio-serial0,max_ports=16,bus=pci.0");
- cmd.add("-chardev");
- cmd.add("spicevmc,id=vdagent,name=vdagent");
- cmd.add("-device");
- cmd.add("virtserialport,nr=1,bus=virtio-serial0.0,chardev=vdagent,name=com.redhat.spice.0");
- }
-
- EMLogger.getLogger().log(Level.INFO, "Starting Emulator Command : ");
- String temp = cmd.get(0) + " ";
- for (String s : cmd.subList(1, cmd.size())) {
- temp += ("\"" + s + "\" ");
- }
- EMLogger.getLogger().log(Level.INFO, temp);
- System.out.println("cmd : " + cmd);
- return cmd;
- }
-
- @Override
- public boolean launch(VMProperty property) throws VMLauncherException {
- return launch(property, false);
- }
-
- @Override
- public boolean launch(VMProperty property, boolean wait) throws VMLauncherException {
- List<String> cmd;
-
- cmd = getLaunchCommand(property, null);
-
- if (cmd == null) {
- return false;
- }
-
- CheckingRunningEmulator.addEmulator(property);
- MonitoringEmulator monitor = new MonitoringEmulator(property);
- Process process = launch(cmd);
- if (process != null) {
- monitor.setProcess(process);
- monitor.start();
- if (wait) {
- try {
- monitor.join();
- } catch (InterruptedException e) {
- EMLogger.getLogger().warning(e.getMessage());
- }
- if (monitor.isSuccess()) {
- return true;
- } else {
- return false;
- }
- }
- return true;
- } else {
- CheckingRunningEmulator.removeEmulator(property, false);
- monitor.interrupt();
- return false;
- }
- }
-
- @Override
- public Process launch(List<String> cmd) {
- ProcessBuilder pb = new ProcessBuilder(cmd);
- Map<String, String> env = pb.environment();
- if (EmulatorManager.isLinux()) {
- String value = env.get("LD_LIBRARY_PATH");
- env.put("LD_LIBRARY_PATH", ((value == null) ? "" : value + ":") + FilePathResources.getBinPath() + ":" + FilePathResources.getRemotePath() + File.separator + "lib:");
- EMLogger.getLogger().log(Level.INFO, "LD_LIBRARY_PATH=" + env.get("LD_LIBRARY_PATH"));
- }
- env.put("GL_VERSION", "2");
- EMLogger.getLogger().log(Level.INFO, "GL_VERSION: " + env.get("GL_VERSION"));
-
- if (this.binPath == null || this.binPath.isEmpty()) {
- pb.directory(new File(FilePathResources.getBinPath()));
- } else {
- pb.directory(new File(this.binPath));
- }
-
- Process process = null;
- try {
- process = pb.start();
- } catch (IOException e) {
- if (!isConsole) {
- MessageDialog msg = new MessageDialog(new Shell(Display.getCurrent()));
- msg.openWarningDialog("Failed to launch" + StringResources.NEW_LINE + e.getMessage());
- }
- EMLogger.getLogger().log(Level.WARNING, "Failed to launch." + StringResources.NEW_LINE + e.getMessage());
- }
-
- return process;
- }
-
- private boolean checkOnOff(String value) {
- if (value.toLowerCase().equals("on")) {
- return true;
- } else if (value.toLowerCase().equals("off")) {
- return false;
- } else if (value.isEmpty()){
- return true;
- } else {
- return false;
- }
- }
-
- @Override
- public void sendRemoteLog(String msg) {
- EMLogger.getLogger().info("Launcher log : " + msg);
- }
-}
+++ /dev/null
-/*
- * Emulator Manager
- *
- * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * Minkee Lee <minkee.lee@samsung.com>
- * SeokYeon Hwang <syeon.hwang@samsung.com>
- * YeongKyoon Lee <yeongkyoon.lee@samsung.com>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributors:
- * - S-Core Co., Ltd
- *
- */
-
-package org.tizen.emulator.manager.wearable.vms;
-
-import org.tizen.emulator.manager.vms.VMWorkerCommon;
-
-public class VMWorker extends VMWorkerCommon {
-
- @Override
- public void initLauncher() {
- setLauncher(Launcher.getInstance());
- }
-
-}
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-
-<!-- This file describes component of VM property UI in Emulator manager.
- (VM property UI descriptor)
- Each element in this file is matched with an item of vm property UI. -->
-
-<ItemList xmlns="http://www.tizen.org/em/template" profile="wearable" image="x86-standard">
-
- <propertyList>
- <item type="text" name="vmName" title="Name"/>
- <item type="file" name="baseImage" title="Base Image">
- <option name="dialogType">file</option>
- </item>
- <item type="label" name="display" title="Display">
- <item type="combo" name="resolution" title="Resolution">
- <!-- name, width, height, dpi -->
- <option name="320"> ,320,320,316 </option>
- <option name="480"> ,360,480,300 </option>
-<!-- <option name="hvga"> HVGA,320,480,160 </option> -->
-<!-- <option name="wvga"> WVGA,480,800,207 </option> -->
-<!-- <option name="wsvga"> WSVGA,600,1024,207 </option> -->
-<!-- <option name="qhd"> QHD,540,960,244 </option> -->
-<!-- <option name="hd"> HD,720,1280,316 </option> -->
-<!-- <option name="wxga"> WXGA,1280,800,300 </option> -->
-<!-- <option name="hd1080"> HD1080,1920,1080,314 </option> -->
-<!-- <option name="wqxga"> WQXGA,2560,1600,301 </option> -->
-<!-- <option name="fullhd"> FULLHD,1080,1920,314 </option> -->
- </item>
- <item type="spinner" name="dpi" title="Density"/>
- <item type="combo" name="skin" title="Skin"/>
- </item>
- <item type="combo" name="processors" title="Processors" />
- <item type="combo" name="ramSize" title="RAM Size">
- <option name="list">512,768,1024</option>
- </item>
-<!-- <item type="combo" name="maxTouch" title="Max Touch Point"/> -->
- <item type="label" name="fileShare" title="File Sharing">
- <item type="toggle" name="share" title="Sharing"/>
- <item type="file" name="directory" title="Directory">
- <option name="dialogType">directory</option>
- </item>
- </item>"
- <item type="label" name="hwSupport" title="HW Support">
- <item type="toggle" name="cpu" title="CPU VT"/>
- <item type="toggle" name="gpu" title="GPU"/>
- </item>
- </propertyList>
-
-<!-- Followings are drawn as check box in Emulator Manager vm property UI.-->
- <deviceList>
- <item type="lineLabel" name="advancedOption" title="Advanced Option"/>
- <item type="checkLabel" name="sensor" title="Sensor">
- <item type="checkbox" name="accel" title="Accelerometer"/>
- <item type="checkbox" name="gyro" title="Gyroscope"/>
- <item type="checkbox" name="geo" title="Geomagnetic"/>
- <item type="checkbox" name="proxi" title="Proximity"/>
- <item type="checkbox" name="light" title="Light"/>
- <item type="checkbox" name="haptic" title="Haptic"/>
- <item type="checkbox" name="press" title="Pressure"/>
- <item type="checkbox" name="uv" title="Ultraviolet"/>
- <item type="checkbox" name="hrm" title="Heartbeat Rate"/>
- </item>
- <item type="checkLabel" name="device" title="Device">
- <item type="checkbox" name="nfc" title="NFC"/>
- <item type="checkbox" name="camera" title="Camera"/>
-<!-- <item type="checkbox" name="battery" title="Battery"/> -->
-<!-- <item type="checkbox" name="swap" title="Swap Image"> -->
-<!-- <option name="defaultOnCreate">on</option> -->
-<!-- </item> -->
-<!-- <item type="checkbox" name="hwkey" title="HW Key"/> -->
- </item>
-<!-- <item type="checkLabel" name="jack" title="Jack"> -->
-<!-- <item type="checkbox" name="charger" title="Charger"/> -->
-<!-- <item type="checkbox" name="usb" title="USB"/> -->
-<!-- </item> -->
- </deviceList>
-
-</ItemList>
-
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<EmulatorConfiguration xmlns="http://www.tizen.org/em">
- <baseInformation>
- <diskImage profile="wearable"/>
- </baseInformation>
- <usability>
- <logging>
- <level>NONE</level>
- </logging>
- <fileSharing/>
- <hwVirtualization>true</hwVirtualization>
- <hwGLAcceleration>true</hwGLAcceleration>
- </usability>
- <device>
- <display>
- <resolution>
- <width>360</width>
- <height>480</height>
- </resolution>
- <density unit="dpi">300</density>
- </display>
- <RAM>
- <size unit="MiB">512</size>
- </RAM>
- <touch maxTouchPoint="2"/>
- </device>
- <advancedOption>
- <option name="device">
- <subOption name="camera" value="on"/>
- <subOption name="battery" value="on"/>
- </option>
- <option name="jack">
- <subOption name="charger" value="on"/>
- <subOption name="usb" value="on"/>
- </option>
- <option name="sensor">
- <subOption name="accel" value="on"/>
- <subOption name="gyro" value="on"/>
- <subOption name="geo" value="on"/>
- <subOption name="light" value="on"/>
- <subOption name="proxi" value="on"/>
- <subOption name="haptic" value="on"/>
- <subOption name="press" value="on"/>
- <subOption name="uv" value="on"/>
- <subOption name="hrm" value="on"/>
- </option>
- </advancedOption>
-</EmulatorConfiguration>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-
-<!-- This file describes component of VM property UI in Emulator manager.
- (VM property UI descriptor)
- Each element in this file is matched with an item of vm property UI. -->
-
-<ItemList xmlns="http://www.tizen.org/em/template" profile="mobile" image="x86-standard">
-
- <propertyList>
- <item type="text" name="vmName" title="Name"/>
- <item type="file" name="baseImage" title="Base Image">
- <option name="dialogType">file</option>
- </item>
- <item type="label" name="display" title="Display">
- <item type="combo" name="resolution" title="Resolution">
- <!-- name, width, height, dpi -->
- <option name="experimental"> ,320,320,316 </option>
- <option name="experimental"> HVGA,320,480,160 </option>
- <option name="wvga"> WVGA,480,800,233 </option>
-<!-- <option name="wsvga"> WSVGA,600,1024,207 </option> -->
- <option name="experimental"> WSVGA,600,1024,207 </option>
- <option name="qhd"> qHD,540,960,220 </option>
- <option name="hd"> HD,720,1280,306 </option>
- <option name="experimental"> WXGA,1280,800,300 </option>
- <option name="experimental"> WQXGA,2560,1600,301 </option>
- <option name="experimental"> FULLHD,1080,1920,314 </option>
- </item>
- <item type="spinner" name="dpi" title="Density"/>
- <item type="combo" name="skin" title="Skin"/>
- </item>
- <item type="combo" name="processors" title="Processors" />
- <item type="combo" name="ramSize" title="RAM Size">
- <option name="list">512,768,1024</option>
- </item>
-<!-- <item type="combo" name="maxTouch" title="Max Touch Point"/> -->
- <item type="label" name="fileShare" title="File Sharing">
- <item type="toggle" name="share" title="Sharing"/>
- <item type="file" name="directory" title="Directory">
- <option name="dialogType">directory</option>
- </item>
- </item>"
- <item type="label" name="hwSupport" title="HW Support">
- <item type="toggle" name="cpu" title="CPU VT"/>
- <item type="toggle" name="gpu" title="GPU"/>
- </item>
- </propertyList>
-
-<!-- Followings are drawn as check box in Emulator Manager vm property UI.-->
- <deviceList>
- <item type="lineLabel" name="advancedOption" title="Advanced Option"/>
- <item type="checkLabel" name="sensor" title="Sensor">
- <item type="checkbox" name="accel" title="Accelerometer"/>
- <item type="checkbox" name="gyro" title="Gyroscope"/>
- <item type="checkbox" name="geo" title="Geo-magnetic"/>
- <item type="checkbox" name="proxi" title="Proximity"/>
- <item type="checkbox" name="light" title="Light"/>
- <item type="checkbox" name="haptic" title="Haptic"/>
- <item type="checkbox" name="press" title="Pressure"/>
- <item type="checkbox" name="uv" title="Ultraviolet"/>
- <item type="checkbox" name="hrm" title="Heartbeat Rate"/>
- </item>
- <item type="checkLabel" name="device" title="Device">
- <item type="checkbox" name="nfc" title="NFC"/>
- <item type="checkbox" name="camera" title="Camera"/>
-<!-- <item type="checkbox" name="battery" title="Battery"/> -->
-<!-- <item type="checkbox" name="swap" title="Swap Image"> -->
-<!-- <option name="defaultOnCreate">on</option> -->
-<!-- </item> -->
-<!-- <item type="checkbox" name="hwkey" title="HW Key"/> -->
- </item>
-<!-- <item type="checkLabel" name="jack" title="Jack"> -->
-<!-- <item type="checkbox" name="earjack" title="Ear Jack"/> -->
-<!-- <item type="checkbox" name="charger" title="Charger"/> -->
-<!-- <item type="checkbox" name="usb" title="USB"/> -->
-<!-- </item> -->
- <item type="lineLabel" name="experimental" title="Experimental Options"/>
- <item type="label" name="viewer" title="Viewer">
- <item type="combo" name="type" title="Type">
- <option name="list">Native, Web</option>
- <option name="defaultOnCreate">Native</option>
- </item>
- </item>
- </deviceList>
-
-</ItemList>
-
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<EmulatorConfiguration xmlns="http://www.tizen.org/em">
- <baseInformation>
- <diskImage profile="mobile"/>
- </baseInformation>
- <usability>
- <logging>
- <level>NONE</level>
- </logging>
- <fileSharing/>
- <hwVirtualization>true</hwVirtualization>
- <hwGLAcceleration>true</hwGLAcceleration>
- </usability>
- <device>
- <display>
- <resolution>
- <width>480</width>
- <height>800</height>
- </resolution>
- <density unit="dpi">233</density>
- </display>
- <RAM>
- <size unit="MiB">512</size>
- </RAM>
- <touch maxTouchPoint="10"/>
- </device>
- <advancedOption>
- <option name="device">
-<!-- <subOption name="nfc" value="on"/> -->
- <subOption name="camera" value="on"/>
- <subOption name="battery" value="on"/>
-<!-- <subOption name="swap" value="on"/> -->
-<!-- <subOption name="hwkey" value="on"/> -->
- </option>
- <option name="jack">
- <subOption name="earjack" value="on"/>
- <subOption name="charger" value="on"/>
- <subOption name="usb" value="on"/>
- </option>
- <option name="sensor">
- <subOption name="accel" value="on"/>
- <subOption name="gyro" value="on"/>
- <subOption name="geo" value="on"/>
- <subOption name="light" value="on"/>
- <subOption name="proxi" value="on"/>
- <subOption name="haptic" value="on"/>
- <subOption name="press" value="on"/>
- <subOption name="uv" value="on"/>
- <subOption name="hrm" value="on"/>
- </option>
- </advancedOption>
-</EmulatorConfiguration>