summaryrefslogtreecommitdiff
path: root/tizen/src/ui
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
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')
-rw-r--r--tizen/src/ui/mainwindow.cpp2
-rw-r--r--tizen/src/ui/menu/contextmenu.cpp137
-rw-r--r--tizen/src/ui/menu/contextmenu.h1
-rw-r--r--tizen/src/ui/qt5_supplement.cpp254
-rw-r--r--tizen/src/ui/resource/ui_strings.h6
5 files changed, 229 insertions, 171 deletions
diff --git a/tizen/src/ui/mainwindow.cpp b/tizen/src/ui/mainwindow.cpp
index dd8a5d02ef..8667059807 100644
--- a/tizen/src/ui/mainwindow.cpp
+++ b/tizen/src/ui/mainwindow.cpp
@@ -381,7 +381,7 @@ void MainWindow::resize(const QSize &size)
/* override */
void MainWindow::showEvent(QShowEvent *event)
{
- qDebug("show main window");
+ qInfo() << "show main window";
resize(uiInfo->getUiSize());
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);
diff --git a/tizen/src/ui/qt5_supplement.cpp b/tizen/src/ui/qt5_supplement.cpp
index 4df02d7634..639b9dac74 100644
--- a/tizen/src/ui/qt5_supplement.cpp
+++ b/tizen/src/ui/qt5_supplement.cpp
@@ -39,6 +39,10 @@
#include "resource/ui_strings.h"
#include "displaybase.h"
+#include "util/new_debug_ch.h"
+// XXX: all modules in ui/* are controlled by channel name "qt5_ui"
+DECLARE_DEBUG_CHANNEL(qt5_ui);
+
extern "C" {
#include "emul_state.h"
#include "emulator_options.h"
@@ -48,10 +52,6 @@ bool is_display_off(void);
}
//using namespace std;
-void qMessageOutput(QtMsgType, const QMessageLogContext &, const QString &);
-void loadMainFormFromXML(QString, UiInformation *);
-void loadConFormFromXML(QFile *, UiInformation *);
-
bool qt5IsOnscreen;
QApplication *qt5App = NULL;
@@ -95,6 +95,127 @@ bool EventFilter::nativeEventFilter(const QByteArray &eventType, void *message,
}
#endif
+static void loadMainFormFromXML(QString xmlPath, UiInformation *uiInfo/* out */)
+{
+ QFile file(xmlPath);
+
+ if (file.exists() == false ||
+ file.open(QIODevice::ReadOnly | QIODevice::Text) == false) {
+ qFatal("Failed to load the emulator skin. %s%s", MSG_CHECK_PATH,
+ qPrintable(xmlPath));
+ return;
+ }
+
+ qDebug("main form is loaded from %s", qPrintable(file.fileName()));
+
+ /* read xml */
+ QXmlStreamReader xml(&file);
+
+ /* parse xml */
+ QFileInfo fileInfo(xmlPath);
+ XmlLayoutParser parser(fileInfo.absolutePath(), uiInfo);
+ QString version = parser.parseEmulatorUI(xml);
+ qDebug() << "* main layout version:" << version;
+
+ const bool hasError = xml.hasError();
+ xml.clear();
+ file.close();
+
+ if (hasError == true) {
+ qFatal("%s %s%s", MSG_INVALID_XML_FORMAT, MSG_CHECK_PATH,
+ qPrintable(xmlPath));
+ return;
+ }
+}
+
+static void loadConFormFromXML(QFile *file, UiInformation *uiInfo/* out */)
+{
+ if (file->exists() == false ||
+ file->open(QIODevice::ReadOnly | QIODevice::Text) == false) {
+ qWarning() << "Failed to load the controller skin:" <<
+ file->fileName();
+ return;
+ }
+
+ qDebug("controller form is loaded from %s", qPrintable(file->fileName()));
+
+ /* read xml */
+ QXmlStreamReader xml(file);
+
+ /* parse xml */
+ QFileInfo fileInfo(*file);
+ XmlLayoutParser parser(fileInfo.absolutePath(), uiInfo);
+ QString version = parser.parseControllerUI(xml);
+ qDebug() << "* con layout version:" << version;
+
+ const bool hasError = xml.hasError();
+ xml.clear();
+ file->close();
+
+ if (hasError == true) {
+ qFatal("%s %s%s", MSG_INVALID_XML_FORMAT, MSG_CHECK_PATH,
+ qPrintable(fileInfo.absoluteFilePath()));
+ return;
+ }
+}
+
+static void qMessageOutput(QtMsgType type, const QMessageLogContext &context,
+ const QString &msg)
+{
+ char typeChar = '\0';
+
+ switch (type) {
+ case QtDebugMsg:
+ if (!IS_TRACE_ON) {
+ // if TRACE if off, we have nothing to do.
+ return;
+ }
+ typeChar = 'T';
+ break;
+ case QtInfoMsg:
+ typeChar = 'I';
+ break;
+ case QtWarningMsg:
+ typeChar = 'W';
+ break;
+ case QtCriticalMsg:
+ case QtFatalMsg:
+ typeChar = 'S';
+ default:
+ qFatal("invalid message type");
+ break;
+ }
+
+ QString timestamp = QDateTime::currentDateTime().toString("hh:mm:ss.zzz");
+ QString path = QFileInfo(context.file).completeBaseName();
+ path.truncate(10);
+
+ // XXX: it is hard to use DEBUGCH for c++ modules, so we are printing
+ // logs now.
+ QTextStream out(stdout);
+ out.setFieldAlignment(QTextStream::AlignRight);
+ out << qSetFieldWidth(12) << timestamp;
+ out << qSetFieldWidth(1) << "|";
+ out << qSetFieldWidth(5) << qemu_get_thread_id();
+ out << qSetFieldWidth(1) << "|";
+ out << qSetFieldWidth(1) << typeChar;
+ out << qSetFieldWidth(1) << "|";
+ out << qSetFieldWidth(10) << path;
+ out << qSetFieldWidth(1) << "|";
+ out << qSetFieldWidth(4) << context.line;
+ out << qSetFieldWidth(1) << "|";
+ out << qSetFieldWidth(0) << msg;
+ out << qSetFieldWidth(0) << endl;
+
+ if (type == QtCriticalMsg || type == QtFatalMsg) {
+ QMessageBox::critical(0, EMULATOR_TITLE,
+ QString(MSG_INTERNAL_ERR) + msg +
+ MSG_EMULATOR_EXIT);
+
+ abort();
+ }
+}
+
const char *qt5_get_version(void)
{
return qVersion();
@@ -104,10 +225,10 @@ static void qt5_gui_init(void)
{
QCoreApplication::setApplicationName(EMULATOR_TITLE);
- qDebug() << "* Qt version (compile time):" << QT_VERSION_STR;
- qDebug() << "* Qt version (runtime):" << qVersion();
- qDebug() << "* working path:" << QDir::currentPath();
- qDebug() << "* binary path:" << QCoreApplication::applicationDirPath();
+ qInfo() << "* Qt version (compile time):" << QT_VERSION_STR;
+ qInfo() << "* Qt version (runtime):" << qVersion();
+ qInfo() << "* working path:" << QDir::currentPath();
+ qInfo() << "* binary path:" << QCoreApplication::applicationDirPath();
uiInfo = new UiInformation();
@@ -428,120 +549,3 @@ void qt5_process_captured(bool captured, void *pixels, int width, int height)
mainwindow->processCaptured(captured, pixels, width, height);
}
}
-
-void qMessageOutput(QtMsgType type, const QMessageLogContext &context, const QString &msg)
-{
- QByteArray localMsg = msg.toLocal8Bit();
- QByteArray dateMsg = QDateTime::currentDateTime().toString("hh:mm:ss.zzz").toLocal8Bit();
-
- QString path = context.file;
- QByteArray fname = NULL;
- int posFname = path.lastIndexOf('/') + 1;
- int posDot = path.lastIndexOf('.');
-
- if (( posFname != 0 ) && ( posDot != -1)) {
- int fnameLen = path.length() - posFname;
- path = path.right(fnameLen);
- fnameLen = posDot - posFname;
- path.truncate(fnameLen);
- }
- fname = path.toLocal8Bit();
-
- switch (type) {
- case QtDebugMsg:
- fprintf(stdout, "%s|%5d|I|%10.10s|%4u|%s\n", dateMsg.constData(),
- qemu_get_thread_id(), fname.trimmed().constData(), context.line,
- localMsg.trimmed().constData());
- break;
- case QtWarningMsg:
- fprintf(stdout, "%s|%5d|W|%10.10s|%4u|%s\n", dateMsg.constData(),
- qemu_get_thread_id(), fname.trimmed().constData(), context.line,
- localMsg.trimmed().constData());
- break;
- case QtCriticalMsg:
- fprintf(stderr, "%s|%5d|S|%10.10s|%4u|%s\n", dateMsg.constData(),
- qemu_get_thread_id(), fname.trimmed().constData(), context.line,
- localMsg.trimmed().constData());
- break;
- case QtFatalMsg:
- fprintf(stderr, "%s|%5d|S|%10.10s|%4u|%s\n", dateMsg.constData(),
- qemu_get_thread_id(), fname.trimmed().constData(), context.line,
- localMsg.trimmed().constData());
- {
- QString err;
- QMessageBox::critical(0, EMULATOR_TITLE,
- QString(MSG_INTERNAL_ERR) +
- err.sprintf("%s", (localMsg.trimmed()).constData()) +
- MSG_EMULATOR_EXIT);
- }
-
- abort();
- default:
- qFatal("invalid message type");
- break;
- }
-}
-
-void loadMainFormFromXML(QString xmlPath, UiInformation *uiInfo/* out */)
-{
- QFile file(xmlPath);
-
- if (file.exists() == false ||
- file.open(QIODevice::ReadOnly | QIODevice::Text) == false) {
- qFatal("Failed to load the emulator skin. %s%s", MSG_CHECK_PATH,
- qPrintable(xmlPath));
- return;
- }
-
- qDebug("main form is loaded from %s", qPrintable(file.fileName()));
-
- /* read xml */
- QXmlStreamReader xml(&file);
-
- /* parse xml */
- QFileInfo fileInfo(xmlPath);
- XmlLayoutParser parser(fileInfo.absolutePath(), uiInfo);
- QString version = parser.parseEmulatorUI(xml);
- qDebug() << "* main layout version:" << version;
-
- const bool hasError = xml.hasError();
- xml.clear();
- file.close();
-
- if (hasError == true) {
- qFatal("%s %s%s", MSG_INVALID_XML_FORMAT, MSG_CHECK_PATH,
- qPrintable(xmlPath));
- return;
- }
-}
-
-void loadConFormFromXML(QFile *file, UiInformation *uiInfo/* out */)
-{
- if (file->exists() == false ||
- file->open(QIODevice::ReadOnly | QIODevice::Text) == false) {
- qWarning() << "Failed to load the controller skin:" <<
- file->fileName();
- return;
- }
-
- qDebug("controller form is loaded from %s", qPrintable(file->fileName()));
-
- /* read xml */
- QXmlStreamReader xml(file);
-
- /* parse xml */
- QFileInfo fileInfo(*file);
- XmlLayoutParser parser(fileInfo.absolutePath(), uiInfo);
- QString version = parser.parseControllerUI(xml);
- qDebug() << "* con layout version:" << version;
-
- const bool hasError = xml.hasError();
- xml.clear();
- file->close();
-
- if (hasError == true) {
- qFatal("%s %s%s", MSG_INVALID_XML_FORMAT, MSG_CHECK_PATH,
- qPrintable(fileInfo.absoluteFilePath()));
- return;
- }
-}
diff --git a/tizen/src/ui/resource/ui_strings.h b/tizen/src/ui/resource/ui_strings.h
index 55eb671212..97f49429b7 100644
--- a/tizen/src/ui/resource/ui_strings.h
+++ b/tizen/src/ui/resource/ui_strings.h
@@ -40,11 +40,13 @@
/* 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/"
-#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"
@@ -150,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"\