import org.tizen.emulator.manager.platform.Skin;
import org.tizen.emulator.manager.resources.StringResources;
+import org.tizen.emulator.manager.ui.renewal.item.ItemName;
import org.tizen.emulator.manager.vms.RESOLUTION;
import org.tizen.emulator.manager.vms.SKIN_SHAPE;
return true;
}
+
+ public boolean isRearCameraSupport() {
+ SubDevice camera = findSubDevice(ItemName.CAMERA);
+ if (camera == null) {
+ return false;
+ }
+ SubDeviceItem rearCameraItem = findSubDeviceItem(camera, ItemName.CAMERA_REAR);
+ if (rearCameraItem == null) {
+ return false;
+ }
+
+ return rearCameraItem.isSupport();
+ }
}
}
if (f == null) {
f = new CommonItemListFactory();
- EMLogger.getLogger().warning("Fail to load ItemListFactory.");
+ EMLogger.getLogger().warning("Fail to load ItemListFactory. Image : " + imageName);
EMLogger.getLogger().info("Use CommonItemListFactory.");
}
defaultItemList = f.makeDefaultItemList(template);
ICON_TITLE_TREE_EXPANDED("icon_title_tree_expanded"),
ICON_TITLE_TREE_CLOSED("icon_title_tree_closed"),
ICON_TITILE_DESCRIPTION("icon_title_description"),
+ ICON_TITLE_CAMERA("icon_title_camera"),
+ ICON_TITLE_CONNECTIVITY("icon_title_connectivity"),
ICON_BLUE_BUTTON_OPEN("icon_blue_btn_open"),
ICON_BLUE_BUTTON_PLUS("icon_blue_btn_plus"),
ICON_BLUE_BUTTON_CLOSE("icon_blue_btn_close"),
import org.tizen.emulator.manager.EmulatorManager;
import org.tizen.emulator.manager.logging.EMLogger;
import org.tizen.emulator.manager.resources.StringResources;
-import org.tizen.emulator.manager.ui.detail.item.OptionType;
import org.tizen.emulator.manager.ui.renewal.item.ItemName;
-import org.tizen.emulator.manager.ui.renewal.item.ItemType;
import org.tizen.emulator.manager.ui.renewal.item.OptionName;
-import org.tizen.emulator.manager.ui.renewal.item.modify.common.CheckBoxItem;
import org.tizen.emulator.manager.ui.renewal.item.modify.common.CheckItemData;
import org.tizen.emulator.manager.ui.renewal.item.modify.common.ConnectivityItem;
import org.tizen.emulator.manager.ui.renewal.item.modify.common.DisplayItem;
return itemList;
}
+ public static int getNumColomnOption(VMItem item) {
+ int numColumn = 3; // default;
+ for (VMItemOption opt : item.getOptions()) {
+ if (opt.getName().equals(OptionName.NUM_COLUMN)) {
+ try {
+ numColumn = Integer.parseInt(opt.getValue());
+ } catch (NumberFormatException e) {
+ EMLogger.getLogger().warning(e.getMessage());
+ }
+ break;
+ }
+ }
+ return numColumn;
+ }
+
public static VMItemGroup getDefaultItemGroup(VMTemplate template) {
for (VMItemGroup group : template.getVmItemGroups()) {
}
// check item type
- if (type.equals(ItemType.CHECK_LABEL)) {
- dialogItem = new CheckBoxItem(name, title, getCheckBoxNumColumn(item),
- null, getCheckBoxDataList(item));
- }
- if (dialogItem != null) {
- itemList.add(dialogItem);
- }
+// if (type.equals(ItemType.CHECK_LABEL)) {
+// dialogItem = new CheckBoxItem(name, title, getCheckBoxNumColumn(item),
+// null, getCheckBoxDataList(item));
+// }
+// if (dialogItem != null) {
+// itemList.add(dialogItem);
+// }
}
}
public static boolean checkExperimentalItem(VMItem item) {
boolean isExperimentalItem = false;
for (VMItemOption opt : item.getOptions()) {
- if (opt.getName().equals(OptionType.EXPERIMENTAL.getName())) {
- if (opt.getValue().equals(OptionType.VALUE_TRUE)) {
+ if (opt.getName().equals(OptionName.EXPERIMENTAL)) {
+ if (opt.getValue().equals(OptionName.VALUE_TRUE)) {
isExperimentalItem = true;
}
}
public static boolean isSupportOS(VMItem item) {
boolean isSupportOS = true;
for (VMItemOption opt : item.getOptions()) {
- if (opt.getName().equals(OptionType.SUPPORT_OS.getName())) {
+ if (opt.getName().equals(OptionName.SUPPORT_OS)) {
List<String> osList = Arrays.asList(opt.getValue().trim().
split(StringResources.REG_EXP_SPLIT_COMMA));
- if (EmulatorManager.isWin() && !osList.contains(OptionType.WIN)) {
+ if (EmulatorManager.isWin() && !osList.contains(OptionName.WIN)) {
isSupportOS = false;
}
- if (EmulatorManager.isLinux() && !osList.contains(OptionType.LINUX)) {
+ if (EmulatorManager.isLinux() && !osList.contains(OptionName.LINUX)) {
isSupportOS = false;
}
- if (EmulatorManager.isMac() && !osList.contains(OptionType.MAC)) {
+ if (EmulatorManager.isMac() && !osList.contains(OptionName.MAC)) {
isSupportOS = false;
}
}
boolean isOKButtonEnable = true;
for (ModifyDialogItem dialogItem : itemList) {
+ if (!dialogItem.isUse()) {
+ continue;
+ }
if (!dialogItem.isValid()) {
isOKButtonEnable = false;
}
item.setInitialValue(propertyValue);
}
changeItemList(itemList, imageItems);
+ checkValid();
+
layoutScrolledComposite();
public class VMModifyDialog extends ModifyDialog {
private final static String TITLE = "VM Modify";
- public final static int WIDTH = 484;
-// private final static int WIDTH = 500;
+// public final static int WIDTH = 484;
+ public final static int WIDTH = 494;
// private final static int HEIGHT = 496;
private final static int HEIGHT = 497;
import org.tizen.emulator.manager.ui.renewal.item.modify.common.RamSizeItem;
import org.tizen.emulator.manager.ui.renewal.item.modify.common.SensorItem;
import org.tizen.emulator.manager.ui.renewal.item.modify.comp.TreeModifyItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.vm.CameraImageItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.vm.CameraItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.vm.CameraLegacyItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.vm.CameraTypeItem;
import org.tizen.emulator.manager.ui.renewal.item.modify.vm.CategoryItem;
import org.tizen.emulator.manager.ui.renewal.item.modify.vm.DeviceTemplateItem;
import org.tizen.emulator.manager.ui.renewal.item.modify.vm.FileSharingItem;
}
- public void addSubItems(List<VMItem> items, CategoryItem dialogItem) {
+ public void addSubItems(List<VMItem> items, CategoryItem categoryItem) {
for (VMItem item : items) {
if (!VMTemplateUtil.checkItemAvailable(item)) {
continue;
}
- addSubItem(item, dialogItem);
+ addSubItem(item, categoryItem);
}
}
- public void addSubItem(VMItem item, CategoryItem dialogItem) {
+ public void addSubItem(VMItem item, CategoryItem categoryItem) {
String name = item.getName();
String title = item.getTitle();
if (name.equals(ItemName.NET_PROXY)) {
- dialogItem.addSubItems(new NetProxyItem(VMTemplateUtil.getProxyItemMap(item.getOptions())));
+ categoryItem.addSubItems(new NetProxyItem(VMTemplateUtil.getProxyItemMap(item.getOptions())));
} else if (name.equals(ItemName.NET_CONNECT_TYPE)) {
- dialogItem.addSubItems(new NetConnectTypeItem(title,
+ categoryItem.addSubItems(new NetConnectTypeItem(title,
VMTemplateUtil.getOptionList(item.getOptions())));
} else if (name.equals(ItemName.NET_TAP_DEVICE)) {
if (EmulatorManager.isWin()) {
- dialogItem.addSubItems(new NetTapDeviceItemForWin(title));
+ categoryItem.addSubItems(new NetTapDeviceItemForWin(title));
} else {
- dialogItem.addSubItems(new NetTapDeviceItem(title));
+ categoryItem.addSubItems(new NetTapDeviceItem(title));
}
} else if (name.equals(ItemName.NET_IP_INFO)) {
- dialogItem.addSubItems(new NetIPInfoItem(title));
+ categoryItem.addSubItems(new NetIPInfoItem(title));
} else if (name.equals(ItemName.NET_DNS)) {
- dialogItem.addSubItems(new NetDnsItem(title));
+ categoryItem.addSubItems(new NetDnsItem(title));
} else if (name.equals(ItemName.NET_MAC)) {
- dialogItem.addSubItems(new NetMacItem(title));
+ categoryItem.addSubItems(new NetMacItem(title));
+
+ } else if (name.equals(ItemName.CAMERA_TYPE_FRONT)) {
+ categoryItem.addSubItems(new CameraTypeItem(name, title));
+
+ } else if (name.equals(ItemName.CAMERA_TYPE_REAR)) {
+ categoryItem.addSubItems(new CameraTypeItem(name, title));
+
+ } else if (name.equals(ItemName.CAMERA_IMAGE_FRONT)) {
+ categoryItem.addSubItems(new CameraImageItem(name, title));
+
+ } else if (name.equals(ItemName.CAMERA_IMAGE_REAR)) {
+ categoryItem.addSubItems(new CameraImageItem(name, title));
}
}
String name = item.getName();
String title = item.getTitle();
+ String type = item.getType();
if (name.equals(ItemName.NAME)) {
itemList.add(new HWSupportItem());
} else if (name.equals(ItemName.NETWORK)) {
- CategoryItem categoryItem = new NetworkItem();
- itemList.add(categoryItem);
- addSubItems(item.getSubItems(), categoryItem);
+ CategoryItem networkItem = new NetworkItem();
+ itemList.add(networkItem);
+ addSubItems(item.getSubItems(), networkItem);
+
+ } else if (name.equals(ItemName.CAMERA)) {
+ CategoryItem cameraItem = new CameraItem(null, title);
+ itemList.add(cameraItem);
+ addSubItems(item.getSubItems(), cameraItem);
+
+ } else if (name.equals(ItemName.CAMERA_LEGACY)) {
+ itemList.add(new CameraLegacyItem(name, title, VMTemplateUtil.getNumColomnOption(item),
+ treeRoot, VMTemplateUtil.getCheckBoxDataList(item)));
}
-
}
import org.tizen.emulator.manager.template.renewal.VMItem;
import org.tizen.emulator.manager.vms.option.BaseImageOption;
import org.tizen.emulator.manager.vms.option.CPUSupportOption;
+import org.tizen.emulator.manager.vms.option.CameraLegacyOption;
import org.tizen.emulator.manager.vms.option.CommonOption;
import org.tizen.emulator.manager.vms.option.ConnectivityOption;
import org.tizen.emulator.manager.vms.option.DisplayModeOption;
} else if (name.equals(ItemName.NET_PROXY)) {
optionList.add(Option.getInstance(NetProxyOption.class));
+ } else if (name.equals(ItemName.CAMERA_LEGACY)) {
+ optionList.add(Option.getInstance(CameraLegacyOption.class));
+
} else if (name.equals(ItemName.CAMERA)) {
// add sub options (rear camera, front camera)
if (item.getSubItems() != null) {
makeCommonOptionList(optionList, item.getSubItems());
}
- } else if (name.equals(ItemName.CAMERA_REAR)) {
+ } else if (name.equals(ItemName.CAMERA_TYPE_REAR)) {
optionList.add(Option.getInstance(RearCameraOption.class));
- } else if (name.equals(ItemName.CAMERA_FRONT)) {
+ } else if (name.equals(ItemName.CAMERA_TYPE_FRONT)) {
optionList.add(Option.getInstance(FrontCameraOption.class));
} else if (name.equals(ItemName.SENSOR)) {
public static final String CONNECTIVITY = "connectivity";
public static final String SENSOR = "sensor"; //$NON-NLS-1$
- public static final String DEVICE = "device"; //$NON-NLS-1$
+ public static final String DEVICES = "devices"; //$NON-NLS-1$
public static final String JACK = "jack"; //$NON-NLS-1$
+ public static final String CAMERA_LEGACY = "cameraLegacy";
+ public static final String CAMERA_REAR = "rear";
public static final String CAMERA = "camera"; //$NON-NLS-1$
- public static final String CAMERA_REAR = "rearType";
- public static final String CAMERA_FRONT = "frontType";
+ public static final String CAMERA_TYPE_REAR = "rearType";
+ public static final String CAMERA_TYPE_FRONT = "frontType";
+ public static final String CAMERA_IMAGE_REAR = "rearImage"; //$NON-NLS-1$
+ public static final String CAMERA_IMAGE_FRONT = "frontImage"; //$NON-NLS-1$
public static final String NET_CONFIG = "netConfig"; //$NON-NLS-1$
public static final String NET_PROXY = "proxy"; //$NON-NLS-1$
public static final String NUM_COLUMN = "numColumn";
public static final String EXPERIMENTAL = "experimental";
public static final String LIST = "list";
+ public static final String SUPPORT_OS = "supportOS";
+
+ public static final String VALUE_TRUE = "true";
+ public static final String VALUE_FALSE = "false";
+
+ public static final String VALUE_ON = "on"; //$NON-NLS-1$
+ public static final String VALUE_OFF = "off"; //$NON-NLS-1$
+
+ public static final String LINUX = "linux"; //$NON-NLS-1$
+ public static final String WIN = "win"; //$NON-NLS-1$
+ public static final String MAC = "mac"; //$NON-NLS-1$
}
}
- private void updateCheckBoxSubItems() {
+ protected void updateCheckBoxSubItems() {
for (CheckBoxSubItem subItem : subItemList) {
boolean isDataExist = false;
for (CheckItemData data : dataList) {
}
- private void layoutCheckBoxSubItems() {
+ protected void layoutCheckBoxSubItems() {
// layout subitems
int top = 0;
valueMap.put(subItem.getName(), subItem.isChecked());
}
value.setCheckBoxOptions(getName(), valueMap);
-
}
@Override
}
-
protected String getSelectedItem() {
return comboBox.getSelectedItem();
}
package org.tizen.emulator.manager.ui.renewal.item.modify.common;
+import java.util.ArrayList;
import java.util.List;
import org.eclipse.swt.widgets.Composite;
+import org.tizen.emulator.manager.renewal.resources.ImageResources;
import org.tizen.emulator.manager.ui.renewal.item.modify.comp.TreeModifyItem;
public class ConnectivityItem extends CheckBoxItem {
@Override
public void create(Composite parent) {
item.init(parent);
- item.setItemTitle(createIconTitle(item, null));
+ item.setItemTitle(createIconTitle(item, ImageResources.ICON_TITLE_CONNECTIVITY));
item.create();
createCheckBoxItems(item);
}
+ @Override
+ public ModifyDialogItem cloneItem() {
+ List<CheckItemData> dataList = new ArrayList<CheckItemData>();
+ dataList.addAll(this.dataList);
+ return new ConnectivityItem(null, dataList);
+ }
+
}
lastPath = path;
}
+
+ public int getContentRight(int boxWidth) {
+ return boxWidth + BUTTON_SPACE + BUTTON_WIDTH;
+ }
+
public static String getLastDirectoryPath() {
return lastPath;
}
makeBody(textBoxWidth);
}
- private void makeBody(int textBoxWidth) {
+ protected void makeBody(int textBoxWidth) {
item.setBodyLayoutForm();
}
public abstract void fileSelected();
+
+
+ public void setItemEnable(boolean enable) {
+ textBox.setEnabled(enable);
+ fileDialogButton.setShowImage(enable);
+ item.setTitleEnable(enable);
+ }
+
+
+
+ @Override
+ public void changeWidgetState(boolean isError) {
+ if (!getItemListComp().isDetailMode()) {
+ textBox.setError(isError);
+ }
+ }
}
public static final int ERROR_ICON_SPACING_INNER = 3;
// decide item's visibility in dialog
- private final boolean isUse = true;
+ private boolean isUse = true;
// This decide whether draw bottom line or not.
private boolean isDrawBottomLine = true;
}
}
+ public boolean isUse() {
+ return isUse;
+ }
+
+ public void setUse(boolean isUse) {
+ this.isUse = isUse;
+ }
+
public void redrawBottomLine() {
item.getBody().redraw();
item.getItemTitle().redrawBottomLine(isDrawBottomLine);
} else {
data.heightHint = 0;
}
+
+ setUse(isVisible);
}
public void setVisible() {
package org.tizen.emulator.manager.ui.renewal.item.modify.common;
+import java.util.ArrayList;
import java.util.List;
import org.eclipse.swt.widgets.Composite;
}
+ @Override
+ public ModifyDialogItem cloneItem() {
+ List<CheckItemData> dataList = new ArrayList<CheckItemData>();
+ dataList.addAll(this.dataList);
+ return new SensorItem(null, dataList);
+ }
+
+
}
import org.tizen.emulator.manager.ui.renewal.dialog.DIALOG_MODE;
import org.tizen.emulator.manager.ui.renewal.dialog.ItemListComp;
import org.tizen.emulator.manager.ui.renewal.dialog.ValidationListener;
+import org.tizen.emulator.manager.ui.renewal.item.ItemName;
import org.tizen.emulator.manager.ui.renewal.item.modify.common.ModifyDialogItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.vm.CameraItem;
import org.tizen.emulator.manager.ui.renewal.tableviewer.CreateVMTableViewer;
public void saveDataInto(Object value) {
itemListComp.saveDataInto(value);
}
+
+ // return if item is showing in advanced option.
+ public CameraItem getCameraItem() {
+ for (ModifyDialogItem item :itemListComp.getItemList()) {
+ if (item.getName().equals(ItemName.CAMERA)) {
+ if (item.isUse()) {
+ return (CameraItem)item;
+ }
+ break;
+ }
+ }
+ return null;
+ }
}
public class ItemTitle extends Canvas{
public static final int TITLE_SPACING = 8;
-// private final int TITLE_CANVAS_WIDTH = 144;
- public static final int TITLE_CANVAS_WIDTH = 130;
+ public static final int TITLE_CANVAS_WIDTH = 140;
+// public static final int TITLE_CANVAS_WIDTH = 130;
private final int LINE_INDENT = 5;
protected int ICON_WIDTH = 18;
import org.tizen.emulator.manager.platform.Platform;
import org.tizen.emulator.manager.platform.Skin;
import org.tizen.emulator.manager.platform.baseimage.CustomBaseImageValue;
+import org.tizen.emulator.manager.ui.renewal.item.ItemName;
import org.tizen.emulator.manager.vms.RESOLUTION;
import org.tizen.emulator.manager.vms.SKIN_SHAPE;
import org.tizen.emulator.manager.vms.VMOption;
return valueMap;
}
+ public Map<String, Boolean> getCameraCheckOptions() {
+ if (isVMValue()) {
+ return getCheckBoxOptions(ItemName.CAMERA_LEGACY);
+
+ } else {
+ return getCheckBoxOptions(ItemName.CAMERA);
+ }
+ }
+
public void setCPUVirtualization(boolean isOn) {
if (isVMValue()) {
public boolean getCheckBoxValue(String name, String subName) {
if (isVMValue()) {
return checkOn(getSubOptionValue(name, subName));
+
+ } else if (isTemplateValue()) {
+ for (SubDevice subDevice : templateValue.getAdditionalDevices()) {
+ if (subDevice.getName().equals(name)) {
+ for (SubDeviceItem subDeviceItem : subDevice.getItems()) {
+ if (subDeviceItem.getId().equals(subName)) {
+ return subDeviceItem.isSupport();
+ }
+ }
+ }
+ }
+ return false;
}
return true;
}
package org.tizen.emulator.manager.ui.renewal.item.modify.template;
+import java.util.ArrayList;
import java.util.List;
import org.eclipse.swt.widgets.Composite;
+import org.tizen.emulator.manager.renewal.resources.ImageResources;
import org.tizen.emulator.manager.ui.renewal.item.modify.common.CheckBoxItem;
import org.tizen.emulator.manager.ui.renewal.item.modify.common.CheckItemData;
+import org.tizen.emulator.manager.ui.renewal.item.modify.common.ModifyDialogItem;
public class CameraItem extends CheckBoxItem {
@Override
public void create(Composite parent) {
item.init(parent);
- item.setItemTitle(createIconTitle(item, null));
+ item.setItemTitle(createIconTitle(item, ImageResources.ICON_TITLE_CAMERA));
item.create();
createCheckBoxItems(item);
}
+ @Override
+ public ModifyDialogItem cloneItem() {
+ List<CheckItemData> dataList = new ArrayList<CheckItemData>();
+ dataList.addAll(this.dataList);
+ return new CameraItem(dataList);
+ }
+
}
--- /dev/null
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Minkee Lee <minkee.lee@samsung.com>
+ * JiHye Kim <jihye424.kim@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * Sangho Park <sangho.pk@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.ui.renewal.item.modify.vm;
+
+import java.io.File;
+
+import org.eclipse.swt.widgets.Composite;
+import org.tizen.emulator.manager.renewal.resources.ColorResources;
+import org.tizen.emulator.manager.resources.FilePathResources;
+import org.tizen.emulator.manager.ui.Messages;
+import org.tizen.emulator.manager.ui.renewal.item.ItemName;
+import org.tizen.emulator.manager.ui.renewal.item.modify.common.FileDialogItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.common.ModifyDialogItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.comp.PropertyValue;
+import org.tizen.emulator.manager.ui.renewal.item.modify.comp.SubItemTitle;
+import org.tizen.emulator.manager.ui.renewal.item.modify.comp.SubModifyItem;
+
+public class CameraImageItem extends FileDialogItem {
+
+ private String imagePath; // directory
+ private CameraItem cameraItem;
+
+ private static final String DEFAULT_FRONT_IMG = "default-image1.gif";
+ private static final String DEFAULT_REAR_IMG = "default-image2.gif";
+
+
+ public CameraImageItem(String name, String title) {
+ super(name, title);
+ }
+
+ @Override
+ public void create(Composite parent) {
+ item = new SubModifyItem(this);
+ item.setItemHeight(SubModifyItem.ITEM_HEIGHT);
+ item.init(parent);
+ item.setItemTitle(new SubItemTitle(item.getItemComp(), getTitle(),
+ ColorResources.WHITE));
+ item.create();
+
+ makeBody(SubModifyItem.BOX_WIDTH);
+
+ setTextBox(imagePath);
+ }
+
+
+ @Override
+ public void setParentItem(ModifyDialogItem parentItem) {
+ super.setParentItem(parentItem);
+ cameraItem = (CameraItem)parentItem;
+ }
+
+ private void updateUI() {
+ if (imagePath == null || imagePath.isEmpty()) {
+ setTextBox("(select sharing path...)");
+
+ } else {
+ setTextBox(imagePath);
+ }
+
+ }
+ @Override
+ public void setInitialValue(PropertyValue value) {
+ imagePath = value.getSubOptionValue(getParentItem().getName(), getName());
+ settingImagePath();
+// setTextBox(imagePath);
+
+ }
+
+ @Override
+ public void setValue(PropertyValue value) {
+ value.setSubOptionValue(getParentItem().getName(), getName(), imagePath);
+
+ }
+
+ @Override
+ public ModifyDialogItem cloneItem() {
+ return new CameraImageItem(getName(), getTitle());
+ }
+
+
+ @Override
+ public void fileSelected() {
+ imagePath = filePath;
+ getItemListComp().checkValid();
+ }
+
+
+ public void reset(String cameraType) {
+ if (CameraItem.TYPE_VIRTUAL.equals(cameraType)) {
+ activate();
+ } else {
+ deactivate();
+ }
+ }
+
+ private void settingImagePath() {
+ if (imagePath == null || imagePath.isEmpty()) {
+ imagePath = FilePathResources.getToolEmulatorImagesPath()
+ + File.separator
+ + (ItemName.CAMERA_IMAGE_FRONT.equals(getName()) ? DEFAULT_FRONT_IMG
+ : DEFAULT_REAR_IMG);
+ }
+ }
+
+ public void activate() {
+ setItemEnable(true);
+ settingImagePath();
+ setTextBox(imagePath);
+ }
+
+ public void deactivate() {
+ imagePath = ""; //$NON-NLS-1$
+ setTextBox(imagePath);
+ setItemEnable(false);
+ }
+
+ @Override
+ public boolean isValid() {
+ boolean isValid = true;
+ String msg = "";
+ CameraTypeItem cameraType = cameraItem.getCameraTypeItem(getName());
+ if (cameraType.isVirtualSelected()) {
+ if (imagePath == null || imagePath.isEmpty()) {
+ msg = Messages.getString("CameraImageSubViewItem.ImageFileError.0"); //$NON-NLS-1$
+
+ } else {
+ File f = new File(imagePath);
+ if (!f.exists()) {
+ msg = Messages.getString("CameraImageSubViewItem.ImageFileError.1"); //$NON-NLS-1$
+ }
+ }
+ }
+
+ if (!msg.isEmpty()) {
+ isValid = false;
+ }
+
+ changeItemState(!isValid, getContentRight(SubModifyItem.BOX_WIDTH), msg);
+
+ return isValid;
+ }
+
+}
--- /dev/null
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Minkee Lee <minkee.lee@samsung.com>
+ * JiHye Kim <jihye424.kim@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * Sangho Park <sangho.pk@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.ui.renewal.item.modify.vm;
+
+import java.util.Arrays;
+
+import org.eclipse.swt.widgets.Composite;
+import org.tizen.emulator.manager.renewal.resources.ImageResources;
+import org.tizen.emulator.manager.resources.FilePathResources;
+import org.tizen.emulator.manager.ui.renewal.item.ItemName;
+import org.tizen.emulator.manager.ui.renewal.item.modify.common.ModifyDialogItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.comp.ModifyItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.comp.PropertyValue;
+import org.tizen.emulator.manager.ui.renewal.item.modify.comp.SubTreeModifyItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.comp.TreeModifyItem;
+import org.tizen.emulator.manager.vms.helper.HelperClass;
+import org.tizen.emulator.manager.vms.helper.ProcessResult;
+
+public class CameraItem extends CategoryItem {
+
+ public static final String NAME = "camera";
+
+ public static final String TYPE_NONE = "(none)"; //$NON-NLS-1$
+ public static final String TYPE_WEBCAM = "Webcam"; //$NON-NLS-1$
+ public static final String TYPE_VIRTUAL = "Virtual"; //$NON-NLS-1$
+
+ public static Boolean webcamSupport = null;
+
+ public CameraItem(TreeModifyItem treeRoot, String title) {
+ super(NAME, title);
+ if (treeRoot == null) {
+ item = new ModifyItem(this);
+
+ } else {
+ item = new SubTreeModifyItem(this,treeRoot);
+ treeRoot.addSubItem((SubTreeModifyItem)item);
+ }
+ }
+
+
+ @Override
+ public void create(Composite parent) {
+ int itemHeight = 0;
+ if (subItems.size() == 0) {
+ itemHeight = ModifyItem.ITEM_HEIGHT;
+
+ } else {
+ for (ModifyDialogItem subItem : subItems) {
+ subItem.setDrawBottomLine(false);
+ }
+ itemHeight = getItemHeight();
+ }
+
+// item = new ModifyItem(this);
+ item.setItemHeight(itemHeight);
+ item.init(parent);
+
+ // TODO set camera icon
+ item.setItemTitle(createIconTitle(item, ImageResources.ICON_TITLE_CAMERA));
+ item.create();
+
+ makeBody();
+ }
+
+
+ private void makeBody() {
+ item.setBodyLayoutGrid(1, 0);
+ createSubItems();
+ }
+
+
+ private void createSubItems() {
+ for (ModifyDialogItem item : subItems) {
+ item.setParentItem(this);
+ item.setItemListComp(this.getItemListComp());
+ item.setInitialValue(this.getItemListComp().getPropertyValue());
+ item.create(this.item.getBody());
+ item.setVisible();
+ }
+
+ CameraTypeItem rearTypeItem = getRearTypeItem();
+ CameraTypeItem frontTypeItem = getFrontTypeItem();
+ String rearType = rearTypeItem == null ? TYPE_NONE : rearTypeItem.getCameraType();
+ String frontType = frontTypeItem == null ? TYPE_NONE : frontTypeItem.getCameraType();
+ if (rearTypeItem != null) {
+ rearTypeItem.reset(frontType);
+ getRearImageItem().reset(rearType);
+ }
+ if (frontTypeItem != null) {
+ frontTypeItem.reset(rearType);
+ getFrontImageItem().reset(frontType);
+ }
+ }
+
+
+ public void setRearCameraCheck(boolean isCheck) {
+ CameraTypeItem rearTypeItem = getRearTypeItem();
+ if (rearTypeItem == null) {
+ return;
+ }
+
+ String cameraType = isCheck ? "" : TYPE_NONE;
+ rearTypeItem.setCameraTypeAndSelect(cameraType);
+ }
+
+
+ @Override
+ public ModifyDialogItem cloneItem() {
+ CameraItem item = new CameraItem(null, getTitle());
+ for (ModifyDialogItem subItem : subItems) {
+ item.addSubItems(subItem.cloneItem());
+ }
+
+ return item;
+ }
+
+
+ private static boolean checkWebcam() {
+ ProcessResult res = HelperClass.runProcess(Arrays
+ .asList(FilePathResources.getCheckCamPath()));
+ int result = res.getExitValue();
+ if (result == 1) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ public static boolean isWebcamSupport() {
+ if (webcamSupport == null) {
+ webcamSupport = checkWebcam();
+ }
+ return webcamSupport;
+ }
+
+
+ private CameraTypeItem getRearTypeItem() {
+ return (CameraTypeItem)getSubItemByName(ItemName.CAMERA_TYPE_REAR);
+ }
+
+ private CameraTypeItem getFrontTypeItem() {
+ return (CameraTypeItem)getSubItemByName(ItemName.CAMERA_TYPE_FRONT);
+ }
+
+ private CameraImageItem getRearImageItem() {
+ return (CameraImageItem)getSubItemByName(ItemName.CAMERA_IMAGE_REAR);
+ }
+
+ private CameraImageItem getFrontImageItem() {
+ return (CameraImageItem)getSubItemByName(ItemName.CAMERA_IMAGE_FRONT);
+ }
+
+
+ public CameraImageItem getCameraImageItem(String typeItemName) {
+ if (typeItemName.equals(ItemName.CAMERA_TYPE_FRONT)) {
+ return getFrontImageItem();
+ } else {
+ return getRearImageItem();
+ }
+ }
+
+ public CameraTypeItem getCameraTypeItem(String imageItemName) {
+ if (imageItemName.equals(ItemName.CAMERA_IMAGE_FRONT)) {
+ return getFrontTypeItem();
+ } else {
+ return getRearTypeItem();
+ }
+ }
+
+ public CameraTypeItem getAnotherCameraTypeItem(String typeItemName) {
+ if (typeItemName.equals(ItemName.CAMERA_TYPE_FRONT)) {
+ return getRearTypeItem();
+ } else {
+ return getFrontTypeItem();
+ }
+ }
+
+ @Override
+ public boolean isValid() {
+ boolean isValid = true;
+ for (ModifyDialogItem item : subItems) {
+ if(!item.isValid()) {
+ isValid = false;
+ }
+ }
+ return isValid;
+ }
+
+ @Override
+ public void changeItemValue(PropertyValue value) {
+ boolean useRear = value.getCheckBoxValue(ItemName.CAMERA, ItemName.CAMERA_REAR);
+ setRearCameraCheck(useRear);
+ }
+}
--- /dev/null
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Minkee Lee <minkee.lee@samsung.com>
+ * JiHye Kim <jihye424.kim@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * Sangho Park <sangho.p@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.ui.renewal.item.modify.vm;
+
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.swt.widgets.Composite;
+import org.tizen.emulator.manager.renewal.resources.ImageResources;
+import org.tizen.emulator.manager.ui.renewal.item.modify.common.CheckBoxItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.common.CheckBoxSubItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.common.CheckItemData;
+import org.tizen.emulator.manager.ui.renewal.item.modify.comp.PropertyValue;
+import org.tizen.emulator.manager.ui.renewal.item.modify.comp.TreeModifyItem;
+
+public class CameraLegacyItem extends CheckBoxItem {
+
+ public CameraLegacyItem(String name, String title, int numColomn,
+ TreeModifyItem treeRoot, List<CheckItemData> dataList) {
+ super(name, title, numColomn, treeRoot, dataList);
+ }
+
+ @Override
+ public void create(Composite parent) {
+ item.init(parent);
+ item.setItemTitle(createIconTitle(item, ImageResources.ICON_TITLE_CAMERA));
+ item.create();
+
+ createCheckBoxItems(item);
+ }
+
+ @Override
+ public void changeItemValue(PropertyValue value) {
+ setInitialValue(value);
+ updateCheckBoxSubItems();
+ layoutCheckBoxSubItems();
+ }
+
+
+ @Override
+ public void setInitialValue(PropertyValue value) {
+ Map<String, Boolean> valueMap = value.getCameraCheckOptions();
+ this.valueMap = valueMap;
+ }
+
+
+ @Override
+ public void setValue(PropertyValue value) {
+ valueMap.clear();
+ for (CheckBoxSubItem subItem : getSubItemList()) {
+ valueMap.put(subItem.getName(), subItem.isChecked());
+ }
+ value.setCheckBoxOptions(getName(), valueMap);
+ }
+
+}
--- /dev/null
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Minkee Lee <minkee.lee@samsung.com>
+ * JiHye Kim <jihye424.kim@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * Sangho Park <sangho.pk@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.ui.renewal.item.modify.vm;
+
+import org.eclipse.swt.widgets.Composite;
+import org.tizen.emulator.manager.renewal.resources.ColorResources;
+import org.tizen.emulator.manager.ui.detail.item.property.CameraViewItem;
+import org.tizen.emulator.manager.ui.renewal.item.ItemName;
+import org.tizen.emulator.manager.ui.renewal.item.modify.common.ComboItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.common.ModifyDialogItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.comp.PropertyValue;
+import org.tizen.emulator.manager.ui.renewal.item.modify.comp.SubItemTitle;
+import org.tizen.emulator.manager.ui.renewal.item.modify.comp.SubModifyItem;
+import org.tizen.emulator.manager.ui.renewal.widgets.ComboBox;
+
+public class CameraTypeItem extends ComboItem {
+
+ String cameraType = "";
+
+ private CameraItem cameraItem;
+
+ public CameraTypeItem(String name, String title) {
+ super(name, title);
+ }
+
+ @Override
+ public void create(Composite parent) {
+ item = new SubModifyItem(this);
+ item.setItemHeight(SubModifyItem.ITEM_HEIGHT);
+ item.init(parent);
+ item.setItemTitle(new SubItemTitle(item.getItemComp(), getTitle(),
+ ColorResources.WHITE));
+ item.create();
+
+ makeBody();
+ }
+
+ protected void makeBody() {
+ // create combo
+ createCombo(item, SubModifyItem.BOX_WIDTH);
+
+ // init combo list
+ addItem(CameraItem.TYPE_WEBCAM);
+ addItem(CameraItem.TYPE_VIRTUAL);
+ addItem(CameraItem.TYPE_NONE);
+
+ // select combo
+ selectItem(false);
+ }
+
+ @Override
+ public void setParentItem(ModifyDialogItem parentItem) {
+ super.setParentItem(parentItem);
+ cameraItem = (CameraItem)parentItem;
+ }
+
+ private boolean addItem(String type) {
+ if (CameraItem.TYPE_WEBCAM.equals(type)
+ && !CameraViewItem.isWebcamSupport()) {
+ return false;
+ }
+ addComboItem(type);
+ return true;
+ }
+
+
+ private void selectItem(boolean notifySelect) {
+ if (comboBox == null || comboBox.isDisposed()) {
+ return;
+ }
+
+ // Set default if first create.
+ if (getItemListComp().isCreateMode()) {
+ if (!isInComboOptions(cameraType)) {
+ // Rear : webcam (if webcam available)
+ if (isRear() && CameraItem.isWebcamSupport()) {
+ cameraType = CameraItem.TYPE_WEBCAM;
+
+ // Front : virtual
+ } else {
+ cameraType = CameraItem.TYPE_VIRTUAL;
+ }
+ }
+ }
+
+
+ // select item
+ int index = -1;
+ for (int i=0 ; i < getComboItemList().size() ; i++) {
+ if (getComboItemList().get(i).equals(cameraType)) {
+ index = i;
+ break;
+ }
+ }
+
+ if (index == -1) {
+ index = 0;
+ cameraType = getComboItem(index);
+ }
+
+ selectComboItem(index, notifySelect);
+
+ if (notifySelect) {
+ comboSelected();
+ }
+ }
+
+ private void comboSelected() {
+ // reset image item
+ CameraImageItem imageItem = cameraItem.getCameraImageItem(getName());
+ if (imageItem != null) {
+ imageItem.reset(cameraType);
+ }
+
+ // reset another camera type item
+ CameraTypeItem anotherCameraItem = cameraItem.getAnotherCameraTypeItem(getName());
+ if (anotherCameraItem != null) {
+ anotherCameraItem.reset(cameraType);
+ }
+
+ getItemListComp().checkValid();
+ }
+
+
+ @Override
+ public void itemSelected(ComboBox comboBox) {
+ // This is called when combo item is selected
+ cameraType = comboBox.getSelectedItem();
+ comboSelected();
+ }
+
+
+ @Override
+ public void setInitialValue(PropertyValue value) {
+ cameraType = value.getSubOptionValue(ItemName.CAMERA, getName());
+ }
+
+ @Override
+ public void setValue(PropertyValue value) {
+ value.setSubOptionValue(ItemName.CAMERA, getName(), cameraType);
+
+ }
+
+ public String getCameraType() {
+ return cameraType;
+ }
+
+
+ public void setCameraTypeAndSelect(String cameraType) {
+ this.cameraType = cameraType;
+ selectItem(true);
+ }
+
+
+ @Override
+ public ModifyDialogItem cloneItem() {
+ return new CameraTypeItem(getName(), getTitle());
+ }
+
+ public void reset(String anotherCameraType) {
+ if (CameraItem.TYPE_WEBCAM.equals(anotherCameraType)) {
+ // remove webcam if exist.
+ int index = -1;
+ for (int i = 0; i < comboBox.getItemCount(); i++) {
+ if (comboBox.getItem(i).equals(CameraItem.TYPE_WEBCAM)) {
+ index = i;
+ }
+ }
+ if (index > -1) {
+ comboBox.remove(index);
+ selectItem(false); // false ?
+ }
+
+ } else {
+ // Add webcam if not exist.
+ if (CameraItem.isWebcamSupport()) {
+ boolean addWebcam = true;
+ for (int i = 0; i < comboBox.getItemCount(); i++) {
+ if (comboBox.getItem(i).equals(CameraItem.TYPE_WEBCAM)) {
+ addWebcam = false;
+ break;
+ }
+ }
+ if (addWebcam) {
+ comboBox.addItem(CameraItem.TYPE_WEBCAM, 0);
+ selectItem(false); // false ?
+ }
+ }
+ }
+ }
+
+
+ private boolean isInComboOptions(String value) {
+ for (String str : comboBox.getItemList()) {
+ if (str.equals(value)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private boolean isRear() {
+ return ItemName.CAMERA_TYPE_REAR.equals(getName());
+ }
+
+
+
+ public boolean isVirtualSelected() {
+ if (CameraViewItem.VALUE_VIRTUAL.equals(cameraType)) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+}
import java.util.List;
import org.tizen.emulator.manager.ui.renewal.item.modify.common.ModifyDialogItem;
+import org.tizen.emulator.manager.ui.renewal.item.modify.comp.PropertyValue;
public abstract class CategoryItem extends ModifyDialogItem {
return height;
}
+ @Override
+ public void setValue(PropertyValue value) {
+ for (ModifyDialogItem item : subItems) {
+ item.setValue(value);
+ }
+ }
+
+ @Override
+ public void setInitialValue(PropertyValue value) {
+ // override this if you want.
+ }
+
+ protected ModifyDialogItem getSubItemByName(String itemName) {
+ for (ModifyDialogItem subItem : subItems) {
+ if (subItem.getName().equals(itemName)) {
+ return subItem;
+ }
+ }
+ return null;
+ }
+
}
import org.tizen.emulator.manager.devices.DeviceTemplate;
import org.tizen.emulator.manager.platform.Profile;
import org.tizen.emulator.manager.platform.ProfileList;
+import org.tizen.emulator.manager.ui.renewal.item.ItemName;
import org.tizen.emulator.manager.ui.renewal.item.modify.common.ComboItem;
import org.tizen.emulator.manager.ui.renewal.item.modify.common.ModifyDialogItem;
import org.tizen.emulator.manager.ui.renewal.item.modify.comp.PropertyValue;
public void itemSelected(ComboBox comboBox) {
template = (DeviceTemplate)comboBox.getSelectedData();
+ PropertyValue propertyValue = new PropertyValue(template.getValue());
// - change item list value
for (SubTreeModifyItem subTree : treeModifyItem.getSubItemList()) {
ModifyDialogItem dialogItem = subTree.getDialogItem();
- dialogItem.changeItemValue(new PropertyValue(template.getValue()));
+ dialogItem.changeItemValue(propertyValue);
}
+
+ // change new camera item value
+ changeCameraItemValue(propertyValue);
+ }
+
+
+ private void changeCameraItemValue(PropertyValue value) {
+ CameraItem cameraItem = (CameraItem)getItemListComp().getItem(ItemName.CAMERA);
+ if (cameraItem == null) {
+ return;
+ }
+
+ cameraItem.changeItemValue(value);
}
@Override
return new FileSharingItem();
}
+
@Override
public void fileSelected() {
sharingPath = filePath;
setFilePath(sharingPath);
updateUI();
}
+
+
}
} else if (str.equals(TYPE_BRIDGE)) {
addComboItem(TYPE_BRIDGE);
}
-
}
// select combo
@Override
public void create(Composite parent) {
- subItems.get(subItems.size()-1).setDrawBottomLine(false);
+ int itemHeight = 0;
+ if (subItems.size() == 0) {
+ itemHeight = ModifyItem.ITEM_HEIGHT;
+
+ } else {
+ subItems.get(subItems.size()-1).setDrawBottomLine(false);
+ itemHeight = getItemHeight();
+ }
item = new ModifyItem(this);
// item.setItemHeight(ModifyItem.ITEM_HEIGHT * subItems.size());
- item.setItemHeight(getItemHeight());
+ item.setItemHeight(itemHeight);
item.init(parent);
item.setItemTitle(createIconTitle(item, ImageResources.ICON_TITLE_NETWORK));
item.create();
}
- @Override
- public void setValue(PropertyValue value) {
- for (ModifyDialogItem item : subItems) {
- item.setValue(value);
- }
- }
-
@Override
public boolean isValid() {
item.resetItem();
}
-
- private ModifyDialogItem getSubItemByName(String itemName) {
- for (ModifyDialogItem subItem : subItems) {
- if (subItem.getName().equals(itemName)) {
- return subItem;
- }
- }
- return null;
- }
-
public void setSubnet(String subnet) {
NetIPInfoItem item = (NetIPInfoItem)getSubItemByName(ItemName.NET_IP_INFO);
item.setSubnet(subnet);
import org.tizen.emulator.manager.resources.StringResources;
import org.tizen.emulator.manager.ui.Messages;
import org.tizen.emulator.manager.ui.renewal.MainDialog;
+import org.tizen.emulator.manager.ui.renewal.item.ItemName;
+import org.tizen.emulator.manager.ui.renewal.item.OptionName;
import org.tizen.emulator.manager.ui.renewal.item.modify.comp.AdvancedPropertyViewer;
import org.tizen.emulator.manager.ui.renewal.item.modify.comp.PropertyValue;
+import org.tizen.emulator.manager.ui.renewal.item.modify.vm.CameraItem;
import org.tizen.emulator.manager.ui.renewal.widgets.GrayButton;
import org.tizen.emulator.manager.ui.renewal.widgets.ImageButton;
import org.tizen.emulator.manager.ui.renewal.widgets.NinePatchResourceInfo;
}
this.baseImage = baseImage;
- if (needRedrawingTable) {
- System.out.println("need redrawing");
- table.showTable();
- }
// change advanced item-list
settingVMPropertyValue();
PropertyValue value = new PropertyValue(newValue.clone());
advancedViewer.changeItemList(baseImage, value);
+ if (needRedrawingTable) {
+ System.out.println("need redrawing");
+ table.showTable();
+ }
+
+
checkValid();
}
return template;
}
+
public void setTemplate(DeviceTemplate template) {
this.template = template;
+
+ // check camera
+ resetCameraOption();
+
+ // TODO check skin list
+
checkValid();
}
+
+ private void resetCameraOption() {
+ if (newValue == null) {
+ settingVMPropertyValue();
+ }
+
+ boolean isRearCameraSupport = template.getValue().isRearCameraSupport();
+
+ CameraItem advancedCameraItem = advancedViewer.getCameraItem();
+ if (advancedCameraItem == null) {
+ // setting legacy camera option
+ newValue.setAdvancedOptionSub(ItemName.CAMERA_LEGACY, ItemName.CAMERA_REAR,
+ isRearCameraSupport ? OptionName.VALUE_ON : OptionName.VALUE_OFF);
+
+ } else {
+ // change camera value in advanced option
+ advancedCameraItem.setRearCameraCheck(isRearCameraSupport);
+ }
+ }
+
+
public VMPropertyValue getNewValue() {
return newValue;
}
}
}
+ public int getItemCount() {
+ return items.size();
+ }
+
+ public String getItem(int index) {
+ return items.get(index);
+ }
+
+ public void remove(int index) {
+ items.remove(index);
+ datas.remove(index);
+ }
+
+
public Shell getParentShell() {
return parentShell;
}
VMOption option = getVMAdvancedOption(name);
if (option == null) {
option = new VMOption(name);
- option.setValue(value);
+ option.setValue(null);
advancedVMOptionList.add(option);
}
--- /dev/null
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Minkee Lee <minkee.lee@samsung.com>
+ * JiHye Kim <jihye424.kim@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * Sangho Park <sangho.p@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.vms.option;
+
+import org.tizen.emulator.manager.ui.renewal.item.ItemName;
+import org.tizen.emulator.manager.vms.VMProperty;
+import org.tizen.emulator.manager.vms.helper.VMWorkerException;
+
+public class CameraLegacyOption extends Option {
+
+ @Override
+ public void getLaunchArgument(LaunchConfig config, VMProperty property)
+ throws VMWorkerException {
+
+ if (checkOn(property.getPropertyValue().getAdvancedOptionSubValue(
+ ItemName.CAMERA_LEGACY, ItemName.CAMERA_REAR))) {
+ config.addQemuOption("-device", "maru-camera");
+ }
+ }
+
+}
<item name="hrm" title="Heartbeat Rate" type="checkbox"/>
<option name="numColumn">2</option>
</item>
+<!-- <item name="cameraLegacy" title="Camera" type="checkLabel"> -->
+<!-- <option name="numColumn">2</option> -->
+<!-- <item name="rear" title="Rear" type="checkBox"/> -->
+<!-- </item> -->
<item name="connectivity" title="Connectivity" type="checkLabel">
<item name="nfc" title="NFC" type="checkbox" />
<option name="numColumn">2</option>
</item>
- <item name="camera" title="Camera" type="label" >
-<!-- <item type="combo" name="frontType" title="Front"/> -->
-<!-- <item type="file" name="frontImage" title="(image)"/> -->
- <item type="combo" name="rearType" title="Rear"/>
- <item type="file" name="rearImage" title="(image)"/>
- </item>
</item>
</itemGroup>
-<!-- <item type="label" name="camera" title="Camera"> -->
-<!-- <item type="combo" name="frontType" title="Front"/> -->
-<!-- <item type="file" name="frontImage" title="(image)"/> -->
-<!-- <item type="combo" name="rearType" title="Rear"/> -->
-<!-- <item type="file" name="rearImage" title="(image)"/> -->
-
<itemGroup name="advanced">
<item name="suspendSupport" title="Suspend" type="toggle" >
<item name="fileShare" title="File Sharing" type="file">
<option name="dialogType">directory</option>
</item>
+ <item name="camera" title="Camera" type="label" >
+<!-- <item type="combo" name="frontType" title="Front"/> -->
+<!-- <item type="file" name="frontImage" title="(image)"/> -->
+ <item type="combo" name="rearType" title="Rear"/>
+ <item type="file" name="rearImage" title="(image)"/>
+ </item>
<item name="network" title="Network" type="label">
<item name="proxy" title="Proxy" type="combo" >
<option name="none">No proxy</option>