diff options
author | SeokYeon Hwang <syeon.hwang@samsung.com> | 2016-07-18 14:51:31 +0900 |
---|---|---|
committer | SeokYeon Hwang <syeon.hwang@samsung.com> | 2016-07-18 23:45:45 +0900 |
commit | a04654db5c1e4bc4fb085940b6ff2dfe4cfafbe6 (patch) | |
tree | 8b74c50047ebdddaa5070de4bfac6a6f7f8c5889 | |
parent | d137077b0e87c0abc500bb5b32620a1a4cedc70c (diff) | |
download | qemu-a04654db5c1e4bc4fb085940b6ff2dfe4cfafbe6.tar.gz qemu-a04654db5c1e4bc4fb085940b6ff2dfe4cfafbe6.tar.bz2 qemu-a04654db5c1e4bc4fb085940b6ff2dfe4cfafbe6.zip |
ecp: new ECP move to tools path
Change-Id: I50a60f1fd4382094a4aa72d79068383c8b09df76
Signed-off-by: SeokYeon Hwang <syeon.hwang@samsung.com>
-rw-r--r-- | tizen/src/emul_state.c | 5 | ||||
-rw-r--r-- | tizen/src/emul_state.h | 1 | ||||
-rw-r--r-- | tizen/src/ui/menu/contextmenu.cpp | 121 | ||||
-rw-r--r-- | tizen/src/ui/menu/contextmenu.h | 1 | ||||
-rw-r--r-- | tizen/src/ui/resource/ui_strings.h | 3 |
5 files changed, 85 insertions, 46 deletions
diff --git a/tizen/src/emul_state.c b/tizen/src/emul_state.c index baef305f86..8a2ddf4192 100644 --- a/tizen/src/emul_state.c +++ b/tizen/src/emul_state.c @@ -393,6 +393,11 @@ const char *get_profile_name(void) return get_variable("profile"); } +const char *get_platform_version(void) +{ + return get_variable("platform_version"); +} + // host directory sharing path const char* get_host_directory_sharing_path(void) { diff --git a/tizen/src/emul_state.h b/tizen/src/emul_state.h index 62ccd78e61..b360e88332 100644 --- a/tizen/src/emul_state.h +++ b/tizen/src/emul_state.h @@ -131,6 +131,7 @@ const char *get_kernel_file(void); const char *get_http_proxy_addr(void); const char *get_vm_name(void); const char *get_profile_name(void); +const char *get_platform_version(void); const char *get_vm_data_path(void); const char *get_sdcard_image_path(void); const char* get_host_directory_sharing_path(void); diff --git a/tizen/src/ui/menu/contextmenu.cpp b/tizen/src/ui/menu/contextmenu.cpp index 8673aff4c5..2811019fd1 100644 --- a/tizen/src/ui/menu/contextmenu.cpp +++ b/tizen/src/ui/menu/contextmenu.cpp @@ -934,28 +934,77 @@ void ContextMenu::slotShell() sdbHelper->openShell(vmName); } -void ContextMenu::slotControlPanel() +void ContextMenu::launchControlPanel(QString& command, + QStringList& arguments) { - qDebug("Control Panel"); + QString httpProxyAddr; + QString httpProxyPort; + const char *http_proxy_addr = get_http_proxy_addr(); + if (http_proxy_addr) { + char **proxy = g_strsplit(http_proxy_addr, ":", 2); + if (proxy[0] && proxy[1]) { + httpProxyAddr = "-Dhttp.proxyHost=" + QString(proxy[0]); + httpProxyPort = "-Dhttp.proxyPort=" + QString(proxy[1]); + } + g_strfreev(proxy); + } + + if (httpProxyAddr != NULL && httpProxyPort != NULL) { + arguments << httpProxyAddr << httpProxyPort; + } - 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 + jar); + QString loggingCommand = QString("staring ecp: \"" + command + "\""); + for (int i = 0; i < arguments.size(); ++i) { + loggingCommand += " \"" + arguments.at(i) + "\""; + } + qInfo() << qPrintable(loggingCommand); + + QString workingDir = QFileInfo(command).canonicalPath(); + try { + QProcess::startDetached(command, arguments, workingDir); + } catch (QString &error) { + showMsgBox(QMessageBox::Warning, MSG_INVALID_ECP_OPEN + error); return; } +} + +void ContextMenu::slotControlPanel() +{ + qDebug("Control Panel"); - QString command = QDir(QCoreApplication::applicationDirPath() + - QDir::separator() + SDK_EMULATOR_BIN_PATH + - SDK_ECP_FILE).absolutePath(); + QString command; QStringList arguments; - if (QFileInfo(command).exists()) { + + // check for new ECP + QString newCommand = QDir(QCoreApplication::applicationDirPath() + + QDir::separator() + SDK_EMULATOR_TOOLS_BIN_PATH + + SDK_ECP_FILE).absolutePath(); + if (QFileInfo(newCommand).exists()) { + command = newCommand; + + QString vmNameOpt = "vm_name=" + parent->getUiInfo()->getVmName(); + QString platformVersionOpt = "platform_version=" + + QString::fromLocal8Bit(get_platform_version()); + QString profileOpt = "profile=" + + QString::fromLocal8Bit(get_profile_name()); + QString basePortOpt = + "base_port=" + QString::number(parent->getUiInfo()->getBasePort()); + + arguments << vmNameOpt << platformVersionOpt << profileOpt + << basePortOpt; + // we have standalone command for ECP // we respect standalone command, so nothing to do - } else { + launchControlPanel(command, arguments); + + return; + } + + // check for old ECP + QString oldJar = QDir(QCoreApplication::applicationDirPath() + + QDir::separator() + SDK_EMULATOR_BIN_PATH + + SDK_ECP_FILE_JAR).absolutePath(); + if (QFileInfo(oldJar).exists()) { // we do not have standalone command for ECP // we may have SWT based ECP @@ -978,43 +1027,25 @@ void ContextMenu::slotControlPanel() /* SWT Display must be created on main thread due to Cocoa restrictions */ arguments << "-XstartOnFirstThread"; #endif - arguments << "-jar" << jar; - } + arguments << "-jar" << oldJar; - QString basePortOpt = - "base.port=" + QString::number(parent->getUiInfo()->getBasePort()); - QString vmNameOpt = "vmname=" + parent->getUiInfo()->getVmName(); - QString vmProfileOpt = "profile=" + QString::fromLocal8Bit(get_profile_name()); + QString vmNameOpt = "vmname=" + parent->getUiInfo()->getVmName(); + QString profileOpt = "profile=" + + QString::fromLocal8Bit(get_profile_name()); + QString basePortOpt = "base.port=" + + QString::number(parent->getUiInfo()->getBasePort()); - QString httpProxyAddr; - QString httpProxyPort; - const char *http_proxy_addr = get_http_proxy_addr(); - if (http_proxy_addr) { - char **proxy = g_strsplit(http_proxy_addr, ":", 2); - if (proxy[0] && proxy[1]) { - httpProxyAddr = "-Dhttp.proxyHost=" + QString(proxy[0]); - httpProxyPort = "-Dhttp.proxyPort=" + QString(proxy[1]); - } - g_strfreev(proxy); - } - - if (httpProxyAddr != NULL && httpProxyPort != NULL) { - arguments << httpProxyAddr << httpProxyPort; - } + arguments << vmNameOpt << profileOpt << basePortOpt; - 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); + launchControlPanel(command, arguments); - try { - QProcess::startDetached(command, arguments); - } catch (QString &error) { - showMsgBox(QMessageBox::Warning, MSG_INVALID_ECP_OPEN + error); return; } + + // we can not launch ControlPanel + showMsgBox(QMessageBox::Warning, MSG_ECP_NOT_EXIST); + + return; } void ContextMenu::slotRequestScreenshot() diff --git a/tizen/src/ui/menu/contextmenu.h b/tizen/src/ui/menu/contextmenu.h index 7dad213ff9..88370a483d 100644 --- a/tizen/src/ui/menu/contextmenu.h +++ b/tizen/src/ui/menu/contextmenu.h @@ -123,6 +123,7 @@ protected: bool eventFilter(QObject *obj, QEvent *event); private: + void launchControlPanel(QString &, QStringList &); QAction *addGeneralAction(QMenu *menu, const QIcon &icon, const QString &text, QShortcut *shortcut, const char *slot); void attachShortcut(QAction *action, QShortcut *shortcut, const char *slot); diff --git a/tizen/src/ui/resource/ui_strings.h b/tizen/src/ui/resource/ui_strings.h index eb95f4a11b..97f49429b7 100644 --- a/tizen/src/ui/resource/ui_strings.h +++ b/tizen/src/ui/resource/ui_strings.h @@ -40,6 +40,7 @@ /* SDK path */ #define SDK_ROOT_PATH "../../../../../" +#define SDK_EMULATOR_TOOLS_BIN_PATH SDK_ROOT_PATH"/tools/emulator/bin/" #define SDK_EMULATOR_BIN_PATH "../../../common/emulator/bin/" #define SDK_EMULATOR_IMAGES_PATH "../images/" #define SDK_EMULATOR_ICONS_PATH "../icons/" @@ -151,7 +152,7 @@ /* messages */ #define MSG_SDB_NOT_READY "SDB is not ready.\nPlease wait until the emulator is completely boot up." #define MSG_SDB_NOT_EXIST "SDB file does not exist in the following path.\n" -#define MSG_ECP_NOT_EXIST "Control Panel file does not exist in the following path.\n" +#define MSG_ECP_NOT_EXIST "Control Panel binary file does not exist.\n" #define MSG_INVALID_JAVA_PATH "Failed to get java path." #define MSG_INVALID_ECP_OPEN "Failed to open Control Panel : " #define MSG_SYSTEM_RESET_POPUP "If you force the emulator to reboot, it may cause problems.\n"\ |