ecp: prepare to launch new ecp
authorSeokYeon Hwang <syeon.hwang@samsung.com>
Mon, 11 Jul 2016 06:15:34 +0000 (15:15 +0900)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Mon, 11 Jul 2016 07:06:24 +0000 (16:06 +0900)
Change-Id: Iea134b63272f0c25cd37666acafd2b42ea6de6ae
Signed-off-by: SeokYeon Hwang <syeon.hwang@samsung.com>
tizen/src/ui/menu/contextmenu.cpp
tizen/src/ui/resource/ui_strings.h

index ce68121..8673aff 100644 (file)
@@ -938,44 +938,54 @@ void ContextMenu::slotControlPanel()
 {
     qDebug("Control Panel");
 
-    QString ecpPath = QDir(QCoreApplication::applicationDirPath() +
-        QDir::separator() + SDK_EMULATOR_BIN_PATH + SDK_ECP_FILE).absolutePath();
-
-    QFileInfo ecpFileInfo(ecpPath);
-    if (!ecpFileInfo.exists()) {
+    QString jar = QDir(QCoreApplication::applicationDirPath() +
+        QDir::separator() + SDK_EMULATOR_BIN_PATH +
+        SDK_ECP_FILE_JAR).absolutePath();
+    if (!QFileInfo(jar).exists()) {
+        // check ecp jar
         showMsgBox(QMessageBox::Warning,
-            MSG_ECP_NOT_EXIST + ecpFileInfo.absoluteFilePath());
+            MSG_ECP_NOT_EXIST + jar);
         return;
     }
 
-    QString basePortOpt =
-        "base.port=" + QString::number(parent->getUiInfo()->getBasePort());
-    QString vmNameOpt = "vmname=" + parent->getUiInfo()->getVmName();
-    QString vmProfileOpt = "profile=" + QString::fromLocal8Bit(get_profile_name());
-
-    QString command;
+    QString command = QDir(QCoreApplication::applicationDirPath() +
+        QDir::separator() + SDK_EMULATOR_BIN_PATH +
+        SDK_ECP_FILE).absolutePath();
     QStringList arguments;
+    if (QFileInfo(command).exists()) {
+        // we have standalone command for ECP
+        // we respect standalone command, so nothing to do
+    } else {
+        // we do not have standalone command for ECP
+        // we may have SWT based ECP
 
-    /* find java path */
-    const char *path;
-
-    get_java_path(&path);
+        // find java path
+        const char *path;
+        get_java_path(&path);
 
-    if (path) {
-        command = QString::fromLocal8Bit(path);
-    } else {
-        // can not enter here...
-        showMsgBox(QMessageBox::Warning, MSG_INVALID_JAVA_PATH);
-        return;
-    }
+        if (path) {
+            command = QString::fromLocal8Bit(path);
+        } else {
+            // can not enter here...
+            showMsgBox(QMessageBox::Warning, MSG_INVALID_JAVA_PATH);
+            return;
+        }
 
 #if defined(__x86_64__) || defined(_WIN64)
-    arguments << "-d64";
+        arguments << "-d64";
 #endif
 #ifdef CONFIG_DARWIN
-    /* SWT Display must be created on main thread due to Cocoa restrictions */
-    arguments << "-XstartOnFirstThread";
+        /* SWT Display must be created on main thread due to Cocoa restrictions */
+        arguments << "-XstartOnFirstThread";
 #endif
+        arguments << "-jar" << jar;
+    }
+
+    QString basePortOpt =
+        "base.port=" + QString::number(parent->getUiInfo()->getBasePort());
+    QString vmNameOpt = "vmname=" + parent->getUiInfo()->getVmName();
+    QString vmProfileOpt = "profile=" + QString::fromLocal8Bit(get_profile_name());
+
     QString httpProxyAddr;
     QString httpProxyPort;
     const char *http_proxy_addr = get_http_proxy_addr();
@@ -992,8 +1002,12 @@ void ContextMenu::slotControlPanel()
         arguments << httpProxyAddr << httpProxyPort;
     }
 
-    arguments << "-jar" << ecpPath << vmNameOpt << basePortOpt << vmProfileOpt;
-    qDebug() << command << arguments;
+    arguments << vmNameOpt << basePortOpt << vmProfileOpt;
+    QString loggingCommand = QString("staring ecp: \"" + command + "\"");
+    for (int i = 0; i < arguments.size(); ++i) {
+        loggingCommand += " \"" + arguments.at(i) + "\"";
+    }
+    qInfo() << qPrintable(loggingCommand);
 
     try {
         QProcess::startDetached(command, arguments);
index 55eb671..eb95f4a 100644 (file)
@@ -44,7 +44,8 @@
 #define SDK_EMULATOR_IMAGES_PATH "../images/"
 #define SDK_EMULATOR_ICONS_PATH "../icons/"
 
-#define SDK_ECP_FILE "emulator-control-panel.jar"
+#define SDK_ECP_FILE "emulator-control-panel"
+#define SDK_ECP_FILE_JAR "emulator-control-panel.jar"
 
 /* resource file name */
 #define SDK_ABOUT_IMAGE_FILE "tizen_sdk.png"