summaryrefslogtreecommitdiff
path: root/tizen/src/ui/menu
diff options
context:
space:
mode:
authorSeokYeon Hwang <syeon.hwang@samsung.com>2016-07-26 13:20:54 +0900
committerSeokYeon Hwang <syeon.hwang@samsung.com>2016-07-26 13:20:54 +0900
commitba4cc3d77207c1bf25a585c4255b2db7f15cd069 (patch)
tree16daa0ec5763c30ef201cacf3f4ec9c60f66883e /tizen/src/ui/menu
parentb28120343e545e9d5a50f3b05952f3faefbaa6ef (diff)
parent1d947784dbcc184ecf4742ae0c188f231434d824 (diff)
downloadqemu-ba4cc3d77207c1bf25a585c4255b2db7f15cd069.tar.gz
qemu-ba4cc3d77207c1bf25a585c4255b2db7f15cd069.tar.bz2
qemu-ba4cc3d77207c1bf25a585c4255b2db7f15cd069.zip
Merge branch 'develop' into develop_qemu_2.6
Change-Id: Iedd4489f6321fa251bd7cbe917e258cd1f60f21d Signed-off-by: SeokYeon Hwang <syeon.hwang@samsung.com>
Diffstat (limited to 'tizen/src/ui/menu')
-rw-r--r--tizen/src/ui/menu/contextmenu.cpp137
-rw-r--r--tizen/src/ui/menu/contextmenu.h1
2 files changed, 95 insertions, 43 deletions
diff --git a/tizen/src/ui/menu/contextmenu.cpp b/tizen/src/ui/menu/contextmenu.cpp
index 0fbfdb558e..9ad0f0e663 100644
--- a/tizen/src/ui/menu/contextmenu.cpp
+++ b/tizen/src/ui/menu/contextmenu.cpp
@@ -938,73 +938,124 @@ 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);
+ }
- QString ecpPath = QDir(QCoreApplication::applicationDirPath() +
- QDir::separator() + SDK_EMULATOR_BIN_PATH + SDK_ECP_FILE).absolutePath();
+ if (httpProxyAddr != NULL && httpProxyPort != NULL) {
+ arguments << httpProxyAddr << httpProxyPort;
+ }
+
+ QString loggingCommand = QString("staring ecp: \"" + command + "\"");
+ for (int i = 0; i < arguments.size(); ++i) {
+ loggingCommand += " \"" + arguments.at(i) + "\"";
+ }
+ qInfo() << qPrintable(loggingCommand);
- QFileInfo ecpFileInfo(ecpPath);
- if (!ecpFileInfo.exists()) {
- showMsgBox(QMessageBox::Warning,
- MSG_ECP_NOT_EXIST + ecpFileInfo.absoluteFilePath());
+ QString workingDir = QFileInfo(command).canonicalPath();
+ try {
+ QProcess::startDetached(command, arguments, workingDir);
+ } catch (QString &error) {
+ showMsgBox(QMessageBox::Warning, MSG_INVALID_ECP_OPEN + error);
return;
}
+}
- QString basePortOpt =
- "base.port=" + QString::number(parent->getUiInfo()->getBasePort());
- QString vmNameOpt = "vmname=" + parent->getUiInfo()->getVmName();
- QString vmProfileOpt = "profile=" + QString::fromLocal8Bit(get_profile_name());
+void ContextMenu::slotControlPanel()
+{
+ qDebug("Control Panel");
QString command;
QStringList arguments;
- /* find java path */
- const char *path;
+ // check for new ECP
+#ifndef CONFIG_WIN32
+ QString newCommand = QDir(QCoreApplication::applicationDirPath() +
+ QDir::separator() + SDK_EMULATOR_TOOLS_BIN_PATH +
+ SDK_ECP_FILE).absolutePath();
+#else
+ QString newCommand = QDir(QCoreApplication::applicationDirPath() +
+ QDir::separator() + SDK_EMULATOR_TOOLS_BIN_PATH +
+ SDK_ECP_FILE + ".exe").absolutePath();
+#endif
+ if (QFileInfo(newCommand).exists()) {
+ command = newCommand;
- get_java_path(&path);
+ 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
+ launchControlPanel(command, arguments);
- if (path) {
- command = QString::fromLocal8Bit(path);
- } else {
- // can not enter here...
- showMsgBox(QMessageBox::Warning, MSG_INVALID_JAVA_PATH);
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
+
+ // 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 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
- 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);
- }
+ arguments << "-jar" << oldJar;
- if (httpProxyAddr != NULL && httpProxyPort != NULL) {
- arguments << httpProxyAddr << httpProxyPort;
- }
+ QString vmNameOpt = "vmname=" + parent->getUiInfo()->getVmName();
+ QString profileOpt = "profile=" +
+ QString::fromLocal8Bit(get_profile_name());
+ QString basePortOpt = "base.port=" +
+ QString::number(parent->getUiInfo()->getBasePort());
- arguments << "-jar" << ecpPath << vmNameOpt << basePortOpt << vmProfileOpt;
- qDebug() << command << arguments;
+ arguments << vmNameOpt << profileOpt << basePortOpt;
+
+ 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);