UI: massive refactoring about UI/Display components
authorSeokYeon Hwang <syeon.hwang@samsung.com>
Mon, 10 Aug 2015 03:58:35 +0000 (12:58 +0900)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Mon, 10 Aug 2015 12:40:37 +0000 (21:40 +0900)
Detached QT UI from skin/display completely.
Did not built skin/display when JAVA UI is disabled.
Fixed some of badly header inclusion chains.

Change-Id: I260876aadbed75154055ec19d5f384c884854ef5
Signed-off-by: SeokYeon Hwang <syeon.hwang@samsung.com>
54 files changed:
include/ui/console.h
tizen/src/Makefile.objs
tizen/src/display/Makefile.objs
tizen/src/display/maru_display.c
tizen/src/display/maru_sdl.c
tizen/src/display/propertykeyword.h [deleted file]
tizen/src/display/qt5.c [deleted file]
tizen/src/display/qt5.h [deleted file]
tizen/src/display/qt5_supplement.cpp [deleted file]
tizen/src/display/qt5_supplement.h [deleted file]
tizen/src/display/xmllayoutkeyword.h [deleted file]
tizen/src/display/xmllayoutparser.cpp [deleted file]
tizen/src/display/xmllayoutparser.h [deleted file]
tizen/src/ecs/ecs_msg_device.c
tizen/src/ecs/ecs_msg_injector.c
tizen/src/emul_state.c
tizen/src/emulator.c
tizen/src/emulator_legacy.c
tizen/src/eventcast/encode_fb.c
tizen/src/hw/pci/maru_brightness.c
tizen/src/hw/virtio/Makefile.objs
tizen/src/hw/virtio/maru_virtio_esm.c
tizen/src/skin/maruskin_operation.c
tizen/src/skin/maruskin_operation.h
tizen/src/ui/Makefile.objs
tizen/src/ui/controller/hwkeybutton.cpp
tizen/src/ui/displaybase.cpp
tizen/src/ui/displaybase.h
tizen/src/ui/input/keyboardhelper.cpp
tizen/src/ui/input/keyboardshortcut.cpp
tizen/src/ui/input/multitouchtracker.cpp
tizen/src/ui/mainwindow.cpp
tizen/src/ui/menu/contextmenu.cpp
tizen/src/ui/menu/contextmenu.h
tizen/src/ui/propertykeyword.h [new file with mode: 0644]
tizen/src/ui/qt5.c [new file with mode: 0644]
tizen/src/ui/qt5.h [new file with mode: 0644]
tizen/src/ui/qt5_supplement.cpp [new file with mode: 0644]
tizen/src/ui/qt5_supplement.h [new file with mode: 0644]
tizen/src/ui/rotaryview.cpp
tizen/src/ui/skinbezelitem.cpp
tizen/src/ui/skinkeyitem.cpp
tizen/src/ui/skinkeyitem.h
tizen/src/ui/xmllayoutkeyword.h [new file with mode: 0644]
tizen/src/ui/xmllayoutparser.cpp [new file with mode: 0644]
tizen/src/ui/xmllayoutparser.h [new file with mode: 0644]
tizen/src/util/Makefile.objs
tizen/src/util/error_handler.c
tizen/src/util/error_handler.h
tizen/src/util/sdb.c
tizen/src/util/sdb.h
tizen/src/util/ui_operations.c [new file with mode: 0644]
tizen/src/util/ui_operations.h [new file with mode: 0644]
vl.c

index 28986208d657db1d86d2d5ae56517acc9f4ee9ee..a3ce4f9dcb78b30340c8ed47ee518ce53ab9b3b0 100644 (file)
@@ -11,7 +11,7 @@
 #include "qapi-types.h"
 #include "qapi/error.h"
 
-#if defined(CONFIG_MARU) && defined(CONFIG_SDL)
+#if defined(CONFIG_MARU) && defined(CONFIG_SDL) && defined(CONFIG_JAVA_UI)
 #define SDL_THREAD
 #endif
 
index 1ff95c8b9eaaea5555d705426b0bf763ad9dc80f..404f1ac1e7f67da87c942e66efa46802bac523c8 100644 (file)
@@ -11,9 +11,6 @@ obj-y += util/
 # ui
 obj-y += ui/
 
-# maru display
-obj-y += display/
-
 # protobuf
 obj-y += distrib/protobuf/protobuf-c.o
 
@@ -23,8 +20,11 @@ obj-y += ecs/
 # tethering
 obj-y += eventcast/
 
+# maru display
+obj-$(CONFIG_JAVA_UI) += display/
+
 # maru skin
-obj-y += skin/
+obj-$(CONFIG_JAVA_UI) += skin/
 
 # maru hardware
 obj-y += hw/
index 4fc94161d991fdc1bcfa1f73be3b614748239f10..92fdb9990b4d943ef4912f4c11236a0e83d4ec78 100644 (file)
@@ -1,13 +1,6 @@
 obj-y += maru_display.o maru_display_processing.o
-
-ifdef CONFIG_JAVA_UI
 obj-$(CONFIG_USE_SHM) += maru_shm.o
 obj-$(CONFIG_SDL) += maru_sdl.o maru_sdl_processing.o maru_finger.o
-endif
-
-obj-$(CONFIG_QT) += qt5.o
-obj-$(CONFIG_QT) += qt5_supplement.o
-obj-$(CONFIG_QT) += xmllayoutparser.o
 
 $(obj)/maru_display.o $(obj)/maru_sdl.o $(obj)/maru_sdl_processing.o $(obj)/maru_finger.o: QEMU_CFLAGS += $(SDL_CFLAGS)
 
index 9f97fa665e945f9b7b251e8bc3acde123668d2ca..ca631448e8a27885c73ecac67f2ad085072bc6a9 100644 (file)
@@ -60,10 +60,6 @@ static void maru_display_notify_exit(Notifier *notifier, void *data)
 
 static Notifier maru_display_exit = { .notify = maru_display_notify_exit };
 
-// FIXME
-#ifdef SDL_THREAD
-QemuMutex sdl_mutex;
-#endif
 void maru_display_init(DisplayState *ds, DisplayType display_type,
                        int full_screen)
 {
index a3c30874b657372a2a53e9b77d59d375e42279ad..1caae288d53f2cde028e13ccf0f6a8e97e67ee77 100644 (file)
@@ -78,7 +78,7 @@ static unsigned int blank_cnt;
 #define BLANK_GUIDE_IMAGE_NAME "display_off_guide.png"
 
 #ifdef SDL_THREAD
-extern QemuMutex sdl_mutex;
+QemuMutex sdl_mutex;
 QemuCond sdl_cond;
 static int sdl_thread_initialized;
 
diff --git a/tizen/src/display/propertykeyword.h b/tizen/src/display/propertykeyword.h
deleted file mode 100644 (file)
index 8763e40..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Qt UI
- *
- * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * GiWoong Kim <giwoong.kim@samsung.com>
- * Sangho Park <sangho1206.park@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
- *
- */
-
-#ifndef PROPERTYKEYWORD_H
-#define PROPERTYKEYWORD_H
-
-#define SKIN_PROPERTY_NAME "skin.name"
-#define SKIN_PROPERTY_WINDOW_X "window.x"
-#define SKIN_PROPERTY_WINDOW_Y "window.y"
-#define SKIN_PROPERTY_WINDOW_SCALE "window.scale"
-#define SKIN_PROPERTY_WINDOW_TOPMOST "window.ontop"
-#define SKIN_PROPERTY_CONTROLLER_INDEX "controller.index"
-#define SKIN_PROPERTY_CONTROLLER_DOCK "controller.dock"
-
-#endif // PROPERTYKEYWORD_H
diff --git a/tizen/src/display/qt5.c b/tizen/src/display/qt5.c
deleted file mode 100644 (file)
index 7e8a714..0000000
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
- * Qt UI
- *
- * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * SeokYeon Hwang <syeon.hwang@samsung.com>
- * Sangho Park <sangho1206.park@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
- *
- */
-
-#include "ui/console.h"
-
-#include "qt5.h"
-#include "emul_state.h"
-#include "qt5_supplement.h"
-#include "hw/pci/maru_brightness.h"
-#ifdef CONFIG_DARWIN
-#include "ns_event.h"
-#endif
-
-
-#include "util/new_debug_ch.h"
-
-DECLARE_DEBUG_CHANNEL(qt5_console);
-
-static int qt5_num_outputs;
-
-// only for informing HW specification
-static int pixel_density_dpi;
-
-static struct qt5_state {
-    DisplayChangeListener dcl;
-    DisplaySurface *surface;
-
-    int idx;
-} *qt5_console;
-
-void qt5_graphic_hw_invalidate(void)
-{
-    graphic_hw_invalidate(NULL);
-}
-
-void qt5_graphic_hw_update(void)
-{
-    graphic_hw_update(NULL);
-}
-
-int qt5_graphic_hw_display(void)
-{
-    console_ch_t displayed = 0;
-    graphic_hw_text_update(NULL, &displayed);
-    return displayed;
-}
-
-static void qt5_update(DisplayChangeListener *dcl,
-                       int x, int y, int w, int h)
-{
-    struct qt5_state *con = container_of(dcl, struct qt5_state, dcl);
-
-    assert(con->surface);
-
-    composite_brightness_image(con->surface->image);
-
-    qt5_update_internal(surface_data(con->surface),
-                        surface_width(con->surface),
-                        surface_height(con->surface));
-}
-
-static void qt5_switch(DisplayChangeListener *dcl,
-                       DisplaySurface *new_surface)
-{
-    struct qt5_state *con = container_of(dcl, struct qt5_state, dcl);
-
-    if (con->surface &&
-            (surface_width(con->surface) != surface_width(new_surface) ||
-             surface_height(con->surface) != surface_height(new_surface))) {
-        // TODO: we should adjust display size.
-        // We should warn to user since we can not adjust display size now.
-        LOG_WARNING("display size is changed.\n");
-    }
-
-    con->surface = new_surface;
-
-}
-
-static void qt5_refresh(DisplayChangeListener *dcl)
-{
-    graphic_hw_update(dcl->con);
-    qt5_refresh_internal();
-}
-
-static void qt5_mouse_warp(DisplayChangeListener *dcl,
-                           int x, int y, int on)
-{
-}
-
-static void qt5_mouse_define(DisplayChangeListener *dcl,
-                             QEMUCursor *c)
-{
-}
-
-static const DisplayChangeListenerOps dcl_ops = {
-    .dpy_name          = "qt5",
-    .dpy_gfx_update    = qt5_update,
-    .dpy_gfx_switch    = qt5_switch,
-    .dpy_refresh       = qt5_refresh,
-    .dpy_mouse_set     = qt5_mouse_warp,
-    .dpy_cursor_define = qt5_mouse_define,
-};
-
-void maru_early_qt5_display_init(bool isOnscreen)
-{
-#ifdef CONFIG_DARWIN
-    ns_run_in_event_loop_with_bool(&qt5_early_prepare, isOnscreen);
-
-    /* set emulator icon */
-#define ICON_RESOURCE_PATH "../icons/"
-#define ICON_FILE_NAME "emulator_icon.ico"
-    const int path_len = strlen(get_bin_path()) +
-        strlen(ICON_RESOURCE_PATH) + strlen(ICON_FILE_NAME) + 1;
-
-    char *icon_path = g_malloc0(sizeof(char) * path_len);
-    snprintf(icon_path, path_len, "%s%s%s",
-        get_bin_path(), ICON_RESOURCE_PATH, ICON_FILE_NAME);
-    fprintf(stdout, "application icon path : %s\n", icon_path);
-
-    set_application_icon(icon_path);
-    g_free(icon_path);
-#else
-    qt5_early_prepare(isOnscreen);
-#endif
-    if (isOnscreen) {
-        LOG_INFO("Display Type: QT5 Onscreen\n");
-    } else {
-        LOG_INFO("Display Type: QT5 Offscreen\n");
-    }
-}
-
-static void maru_qt5_display_fini(void)
-{
-    if (qt5_console) {
-        g_free(qt5_console);
-        qt5_console = NULL;
-    }
-    qt5_destroy();
-}
-
-void set_display_pixel_density(int dpi)
-{
-    pixel_density_dpi = dpi;
-}
-
-void maru_qt5_display_init(DisplayState *ds, int full_screen)
-{
-    int i;
-
-    /* prepare gui */
-#ifdef CONFIG_DARWIN
-    ns_run_in_event_loop(&qt5_prepare);
-#else
-    qt5_prepare();
-#endif
-
-    for (i = 0;; i++) {
-        QemuConsole *con = qemu_console_lookup_by_index(i);
-        if (!con || !qemu_console_is_graphic(con)) {
-            break;
-        }
-    }
-    qt5_num_outputs = i;
-    qt5_console = g_new0(struct qt5_state, qt5_num_outputs);
-    for (i = 0; i < qt5_num_outputs; i++) {
-        QemuConsole *con = qemu_console_lookup_by_index(i);
-        qt5_console[i].dcl.ops = &dcl_ops;
-        qt5_console[i].dcl.con = con;
-        register_displaychangelistener(&qt5_console[i].dcl);
-        qt5_console[i].idx = i;
-    }
-
-    if (full_screen) {
-        /* TODO */
-    }
-    atexit(maru_qt5_display_fini);
-
-    /* TODO
-    mouse_mode_notifier.notify = qt2_mouse_mode_change;
-    qemu_add_mouse_mode_change_notifier(&mouse_mode_notifier);
-    */
-
-    /* TODO: cursor control */
-}
diff --git a/tizen/src/display/qt5.h b/tizen/src/display/qt5.h
deleted file mode 100644 (file)
index b1aac1c..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * QT5 display driver
- *
- * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * GiWoong Kim <giwoong.kim@samsung.com>
- * SeokYeon Hwang <syeon.hwang@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
- *
- */
-
-#ifndef __QT5_H__
-#define __QT5_H__
-
-#include <stdbool.h>
-
-#include "sysemu/sysemu.h"
-
-void maru_early_qt5_display_init(bool isOnscreen);
-void maru_qt5_display_init(DisplayState *ds, int full_screen);
-
-void set_display_pixel_density(int dpi);
-
-#endif // __QT5_H__
diff --git a/tizen/src/display/qt5_supplement.cpp b/tizen/src/display/qt5_supplement.cpp
deleted file mode 100644 (file)
index 3cd2450..0000000
+++ /dev/null
@@ -1,533 +0,0 @@
-/*
- * Qt UI
- *
- * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * GiWoong Kim <giwoong.kim@samsung.com>
- * SeokYeon Hwang <syeon.hwang@samsung.com>
- * Sangho Park <sangho1206.park@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
- *
- */
-
-#include <QApplication>
-
-#include "qt5_supplement.h"
-#include "propertykeyword.h"
-#include "mainwindow.h"
-#include "layout/hardwarekey.h"
-#include "xmllayoutparser.h"
-#include "uiutil.h"
-#include "resource/ui_strings.h"
-#include "displaybase.h"
-
-extern "C" {
-#include "emul_state.h"
-int qemu_get_thread_id(void);
-bool is_display_off(void);
-}
-
-//using namespace std;
-void qMessageOutput(QtMsgType, const QMessageLogContext &, const QString &);
-void loadMainFormFromXML(QFile *, UIInformation *);
-void loadConFormFromXML(QFile *, UIInformation *);
-
-bool qt5IsOnscreen;
-QApplication *qt5App = NULL;
-
-static int argc = 0;
-static char *argv[0];
-
-#define MAX_BLANK_FRAME_CNT 10
-static unsigned int blank_cnt;
-
-static void *captureRequestListener;
-static void (*captureRequestHandler)(void *);
-
-static MainWindow *mainwindow;
-static UIInformation *uiInfo;
-
-#define GUI_PROPERTIES_FILE_NAME "gui.property"
-#define SKIN_INFO_FILE_NAME "info.ini"
-#define FORM_FILE_NAME "layout.xml"
-#define CON_FORM_SUBPATH "controller"
-
-class ConFile {
-public:
-    QFile *formFile;
-    int priority;
-};
-
-#ifdef CONFIG_WIN32
-class EventFilter : public QAbstractNativeEventFilter
-{
-public:
-    virtual bool nativeEventFilter(const QByteArray &eventType, void *message, long *res) Q_DECL_OVERRIDE;
-};
-
-EventFilter *eventFilter = NULL;
-
-bool EventFilter::nativeEventFilter(const QByteArray &eventType, void *message, long *res)
-{
-    if (eventType == "windows_generic_MSG") {
-        MSG *msg = static_cast<MSG *>(message);
-        if (msg->message == WM_ERASEBKGND) {
-            qt5_graphic_hw_invalidate();
-        }
-    }
-
-    return false;
-}
-#endif
-
-void qt5_gui_init(void)
-{
-    QCoreApplication::setApplicationName("Tizen Emulator");
-
-    qDebug() << "* Qt version :" << QT_VERSION_STR;
-    qDebug() << "* working path :" << QDir::currentPath();
-    qDebug() << "* binary path :" << QCoreApplication::applicationDirPath();
-
-    uiInfo = new UIInformation();
-
-    /* parameter parsing */
-    // TODO:
-
-    uiInfo->vmName = QString(get_vm_name()).trimmed();
-    qDebug() << "VM name :" <<  uiInfo->vmName;
-
-    uiInfo->resolution.setWidth(get_display_resolution_width());
-    uiInfo->resolution.setHeight(get_display_resolution_height());
-    uiInfo->basePort = get_emul_vm_base_port();
-
-    uiInfo->vmDataPath = QDir(get_vm_data_path()).canonicalPath();
-    if (uiInfo->vmDataPath.endsWith(QDir::separator()) == false) {
-        uiInfo->vmDataPath += QDir::separator();
-    }
-    qDebug() << "VM path :" <<  uiInfo->vmDataPath;
-
-    uiInfo->skinPath = QDir(get_emul_skin_path()).canonicalPath();
-    if (uiInfo->skinPath.endsWith(QDir::separator()) == false) {
-        uiInfo->skinPath += QDir::separator();
-    }
-    qDebug() << "skin path :" <<  uiInfo->skinPath;
-
-    /* read skin information */
-    QSettings skinInfo(uiInfo->skinPath + SKIN_INFO_FILE_NAME,
-        QSettings::IniFormat);
-    QString skinName = skinInfo.value(SKIN_PROPERTY_NAME).toString();
-    if (skinName.isEmpty() == true) {
-        skinName = "Undefined";
-    }
-    uiInfo->skinName = skinName;
-
-    /* open most recently used data information file */
-    QFile::remove(uiInfo->vmDataPath + GUI_PROPERTIES_FILE_NAME + ".lock");
-    const QSettings mruInfo(
-        uiInfo->vmDataPath + GUI_PROPERTIES_FILE_NAME, QSettings::IniFormat);
-
-    /* XML layout */
-    QFile mainXMLFile(uiInfo->skinPath + FORM_FILE_NAME);
-    /* load main form */
-    loadMainFormFromXML(&mainXMLFile, uiInfo);
-
-    QDir skinDir(uiInfo->skinPath + CON_FORM_SUBPATH);
-    /* load controller forms */
-    QFileInfoList entries = skinDir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot);
-
-    if (entries.isEmpty() == false) {
-        /* sort by priority */
-        QList<ConFile *> conFileList;
-
-        for (int i = 0; i < entries.size(); i++) {
-            ConFile *conFile = new ConFile();
-
-            QString conPath = entries.at(i).filePath() + QDir::separator();
-            conFile->formFile = new QFile(conPath + FORM_FILE_NAME);
-            QSettings conInfo(conPath + SKIN_INFO_FILE_NAME, QSettings::IniFormat);
-            conFile->priority = conInfo.value("priority").toInt();
-
-            int j = 0;
-            for ( ; j < conFileList.size(); j++) {
-                if (conFileList.at(j)->priority > conFile->priority) {
-                    break;
-                }
-            }
-            conFileList.insert(j, conFile);
-        }
-
-        /* loading */
-        for (int i = 0; i < conFileList.size(); i++) {
-            loadConFormFromXML(conFileList.at(i)->formFile, uiInfo);
-            delete conFileList.at(i)->formFile;
-            delete conFileList.at(i);
-        }
-    }
-
-    /* default scale */
-    int scale = mruInfo.value(SKIN_PROPERTY_WINDOW_SCALE).toInt();
-    qDebug("previous scale value is %d", scale);
-
-    if (scale <= 0) {
-        scale = 100;
-
-        MenuItem *item = NULL;
-        for (int i = 0; i < uiInfo->menuList.count(); i++) {
-            item = uiInfo->menuList.at(i);
-            if (item->getType() == MenuItemType::scaleItem) {
-                ScaleMenuItem *scaleItem = (ScaleMenuItem *)item;
-                if (scaleItem->getDefaultScaleFactor() > 0) {
-                    scale = scaleItem->getDefaultScaleFactor();
-                }
-            }
-        }
-    }
-    uiInfo->uiState.mainFormScale = scale;
-    qDebug("default scale value is %d", uiInfo->uiState.mainFormScale);
-
-    /* GUI */
-    qDebug("start!");
-
-    mainwindow = new MainWindow(uiInfo);
-    mainwindow->setCaptureRequestHandler(captureRequestListener, captureRequestHandler);
-
-    /* position */
-    QRect hostBounds = UIUtil::getHostScreenBounds();
-    qDebug() << "host geometry :" << hostBounds;
-
-    int defaultValueX = hostBounds.x() - 1;
-    int defaultValueY = hostBounds.y() - 1;
-    int xx = mruInfo.value(SKIN_PROPERTY_WINDOW_X, defaultValueX).toInt();
-    int yy = mruInfo.value(SKIN_PROPERTY_WINDOW_Y, defaultValueY).toInt();
-
-    if (xx == defaultValueX || yy == defaultValueY) {
-        xx = yy = 80 + (uiInfo->basePort % 100); /* default position */
-    } else {
-        qDebug("previous position value : (%d, %d)", xx, yy);
-
-        xx = qMax(xx, hostBounds.x());
-        xx = qMin(xx, hostBounds.x() + hostBounds.width() - 100);
-        yy = qMax(yy, hostBounds.y());
-        yy = qMin(yy, hostBounds.y() + hostBounds.height() - 100);
-    }
-
-    mainwindow->move(xx, yy);
-    qDebug("current position value : (%d, %d)", xx, yy);
-
-    bool onTop = mruInfo.value(SKIN_PROPERTY_WINDOW_TOPMOST).toBool();
-    if (onTop == true) {
-        mainwindow->setTopMost(true);
-    }
-
-    /* controller */
-    const int defaultDockPos = Qt::AlignRight | Qt::AlignCenter;
-    mainwindow->getUIState()->conState.recentlyDockPos = defaultDockPos;
-
-    int conIndex = mruInfo.value(SKIN_PROPERTY_CONTROLLER_INDEX).toInt();
-    if (conIndex >= 0 && conIndex < uiInfo->conFormList.count()) {
-        int conDockPos = mruInfo.value(SKIN_PROPERTY_CONTROLLER_DOCK).toInt();
-        if (conDockPos <= 0) {
-            conDockPos = defaultDockPos;
-        }
-
-        mainwindow->openController(conIndex, conDockPos);
-    }
-
-    mainwindow->show();
-
-#ifdef CONFIG_WIN32
-    /* W/A: Sometimes, QGrahpicsItem's update() does not work with QGLWidget
-     * on Windows Aero theme. We need to indirectly repaint the items
-     * through these lines. */
-    const QSize viewSize = uiInfo->getUiSize();
-    mainwindow->getSkinView()->resize(viewSize / 2);
-    mainwindow->getSkinView()->resize(viewSize);
-#endif
-
-    mainwindow->startDisplaySwapper();
-}
-
-void qt5_destroy()
-{
-    qDebug("qt5 destroy");
-
-    /* write most recently used data information */
-    QString path(uiInfo->vmDataPath + GUI_PROPERTIES_FILE_NAME);
-    qDebug() <<  "save MRU data:" << path;
-
-    QSettings mruInfo(path, QSettings::IniFormat);
-    mruInfo.setValue(SKIN_PROPERTY_WINDOW_X, mainwindow->pos().x());
-    mruInfo.setValue(SKIN_PROPERTY_WINDOW_Y, mainwindow->pos().y());
-    mruInfo.setValue(SKIN_PROPERTY_WINDOW_SCALE, uiInfo->uiState.mainFormScale);
-    mruInfo.setValue(SKIN_PROPERTY_WINDOW_TOPMOST, uiInfo->uiState.isOnTop());
-    mruInfo.setValue(SKIN_PROPERTY_CONTROLLER_INDEX, uiInfo->uiState.conState.conFormIndex);
-
-    DockingController *con = uiInfo->uiState.conState.dockingCon;
-    if (con != NULL) {
-        mruInfo.setValue(SKIN_PROPERTY_CONTROLLER_DOCK, con->getDockPos());
-    } else {
-        mruInfo.setValue(SKIN_PROPERTY_CONTROLLER_DOCK, 0);
-    }
-
-    mruInfo.sync();
-
-    /* clean up */
-#ifdef CONFIG_WIN32
-    delete eventFilter;
-#endif
-    qt5App->flush();
-
-    mainwindow->closeController();
-    mainwindow->terminateDisplaySwapper();
-
-    qt5App->processEvents(QEventLoop::ExcludeUserInputEvents);
-    qt5App->quit();
-
-    //TODO: fix me
-    //delete mainwindow;
-
-    if (uiInfo) {
-        delete uiInfo;
-        uiInfo = NULL;
-    }
-}
-
-void qt5_early_prepare(bool isOnscreen)
-{
-    qt5IsOnscreen = isOnscreen;
-
-    Q_INIT_RESOURCE(resource);
-
-#ifdef CONFIG_LINUX
-    /* QGLWidget threading: Note that under X11 it is necessary to set the
-     * Qt::AA_X11InitThreads application attribute to make the X11 library
-     * and GLX calls thread safe, otherwise the above scenarios will fail. */
-
-    /* Calls XInitThreads() as part of the QApplication construction in order
-     * to make Xlib calls thread-safe. This attribute must be set before
-     * QApplication is constructed. */
-    QCoreApplication::setAttribute(Qt::AA_X11InitThreads);
-#endif
-
-    qt5App = new QApplication(argc, argv);
-
-    /* add the path in the application's main() function, right after the
-     * QApplication object is created */
-    qt5App->addLibraryPath(QDir::currentPath()); //TODO: consider a symbolic link
-
-    qInstallMessageHandler(qMessageOutput);
-
-    qDebug() << "* Qt plugin library path:" << QCoreApplication::libraryPaths();
-
-#ifdef CONFIG_WIN32
-    eventFilter = new EventFilter();
-    qt5App->installNativeEventFilter(eventFilter);
-#endif
-}
-
-void qt5_prepare(void)
-{
-    qt5_gui_init();
-}
-
-void qt5_update_internal(void *data, int width, int height)
-{
-    QImage image((uchar *)data, width, height, QImage::Format_RGB32);
-
-    mainwindow->getScreenWidget()->setPixmap(
-        QPixmap::fromImage(image.transformed(
-            mainwindow->getDisplayMatrix(), Qt::SmoothTransformation)));
-}
-
-void qt5_switch_internal(void)
-{
-    /* do nothing */
-}
-
-void qt5_refresh_internal(void)
-{
-    qt5App->processEvents();
-
-    DisplayBase *db = mainwindow->getDisplay();
-    if (db) {
-        if (db->getIsGimgReady()) {
-            if (is_display_off()) {
-                if (db->getGimgState() == false) {
-                    if (blank_cnt > MAX_BLANK_FRAME_CNT) {
-                        db->startGuideImg();
-                        blank_cnt = 0;
-                    } else {
-                        blank_cnt++;
-                    }
-                }
-            } else {
-                if (db->getGimgState() == true) {
-                    db->stopGuideImg();
-                }
-
-                blank_cnt = 0;
-            }
-        }
-    } else {
-        qDebug() << "Display is not ready.";
-    }
-}
-
-void qt5_register_capture_request_listener(void *listener, void (*handler)(void *))
-{
-    if (mainwindow) {
-        mainwindow->setCaptureRequestHandler(listener, handler);
-    }
-
-    captureRequestListener = listener;
-    captureRequestHandler = handler;
-}
-
-void qt5_unregister_capture_request_listener(void *listener)
-{
-    if (mainwindow) {
-        mainwindow->unsetCaptureRequestHandler(listener);
-    }
-
-    captureRequestListener = NULL;
-    captureRequestHandler = NULL;
-}
-
-void qt5_process_captured(bool captured, void *pixels, int width, int height)
-{
-    if (mainwindow) {
-        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;
-    char *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().data();
-
-    switch (type) {
-    case QtDebugMsg:
-        fprintf(stdout, "%s|%5d|I|%10.10s|%4u|%s\n", dateMsg.constData(),
-                qemu_get_thread_id(), fname, 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, 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, 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, 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();
-    }
-}
-
-void loadMainFormFromXML(QFile *file, UIInformation *uiInfo/* out */)
-{
-    if (file->exists() == false) {
-        qFatal("%s %s", qPrintable(file->fileName()), MSG_NOT_FOUND);
-        return;
-    }
-
-    if (!file->open(QIODevice::ReadOnly | QIODevice::Text)) {
-        qFatal("%s %s %s", MSG_NOT_OPEN_1, qPrintable(file->fileName()), MSG_NOT_OPEN_2);
-        return;
-    }
-
-    qDebug("main form is loaded from %s", qPrintable(file->fileName()));
-
-    /* read xml */
-    QFileInfo fileInfo(*file);
-    QXmlStreamReader xml(file);
-
-    /* parse xml */
-    XmlLayoutParser parser(fileInfo.absolutePath(), uiInfo);
-    QString version = parser.parseEmulatorUI(xml);
-    qDebug() << "layout version :" << version;
-
-    const bool hasError = xml.hasError();
-    xml.clear();
-    file->close();
-
-    if (hasError == true) {
-        qFatal(MSG_INVALID_XML_FORMAT);
-        return;
-    }
-}
-
-void loadConFormFromXML(QFile *file, UIInformation *uiInfo/* out */)
-{
-    if (file->exists() == false) {
-        qWarning("%s is not found", qPrintable(file->fileName()));
-        return;
-    }
-
-    if (!file->open(QIODevice::ReadOnly | QIODevice::Text)) {
-        qFatal("%s %s %s", MSG_NOT_OPEN_1, qPrintable(file->fileName()), MSG_NOT_OPEN_2);
-        return;
-    }
-
-    qDebug("controller form is loaded from %s", qPrintable(file->fileName()));
-
-    /* read xml */
-    QFileInfo fileInfo(*file);
-    QXmlStreamReader xml(file);
-
-    /* parse xml */
-    XmlLayoutParser parser(fileInfo.absolutePath(), uiInfo);
-    QString version = parser.parseControllerUI(xml);
-    qDebug() << "layout version :" << version;
-
-    const bool hasError = xml.hasError();
-    xml.clear();
-    file->close();
-
-    if (hasError == true) {
-        qFatal(MSG_INVALID_XML_FORMAT);
-        return;
-    }
-}
diff --git a/tizen/src/display/qt5_supplement.h b/tizen/src/display/qt5_supplement.h
deleted file mode 100644 (file)
index 89cbf7f..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Qt UI
- *
- * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * GiWoong Kim <giwoong.kim@samsung.com>
- * SeokYeon Hwang <syeon.hwang@samsung.com>
- * Sangho Park <sangho1206.park@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
- *
- */
-
-#ifndef __QT5_INTERNAL_H__
-#define __QT5_INTERNAL_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-void qt5_graphic_hw_invalidate(void);
-void qt5_graphic_hw_update(void);
-int qt5_graphic_hw_display(void);
-void qt5_early_prepare(bool isOnscreen);
-void qt5_prepare(void);
-void qt5_destroy(void);
-
-void qt5_update_internal(void *data, int width, int height);
-void qt5_switch_internal(void);
-void qt5_refresh_internal(void);
-#ifdef __cplusplus
-}
-#endif
-
-#endif // __QT5_INTERNAL_H__
diff --git a/tizen/src/display/xmllayoutkeyword.h b/tizen/src/display/xmllayoutkeyword.h
deleted file mode 100644 (file)
index dd84f76..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Qt UI
- *
- * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * GiWoong Kim <giwoong.kim@samsung.com>
- * Sangho Park <sangho1206.park@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
- *
- */
-
-#ifndef XMLLAYOUTKEYWORD_H
-#define XMLLAYOUTKEYWORD_H
-
-#define NAME_ATTR_KEYWORD "name"
-#define PROP_ATTR_KEYWORD "property"
-#define DEFAULT_ATTR_KEYWORD "default"
-#define COLOR_RED_ATTR_KEYWORD "R"
-#define COLOR_GREEN_ATTR_KEYWORD "G"
-#define COLOR_BLUE_ATTR_KEYWORD "B"
-#define REGION_LEFT_ATTR_KEYWORD "left"
-#define REGION_TOP_ATTR_KEYWORD "top"
-#define REGION_WIDTH_ATTR_KEYWORD "width"
-#define REGION_HEIGHT_ATTR_KEYWORD "height"
-#define KEYCODE_LONGPRESS_ATTR_KEYWORD "longPress"
-
-#define EMULATOR_UI_KEYWORD "EmulatorUI"
-#define CONTROLLER_UI_KEYWORD "ControllerUI"
-#define LAYOUTVER_KEYWORD "layoutVersion"
-#define COLOR_KEYWORD "color"
-#define REGION_KEYWORD "region"
-#define ANGLE_KEYWORD "angle"
-#define DISPLAY_KEYWORD "display"
-#define NORMAL_IMG_KEYWORD "normalImage"
-#define PRESSED_IMG_KEYWORD "pressedImage"
-#define MASK_IMG_KEYWORD "maskImage"
-#define ROTARY_IMG_KEYWORD "rotaryImage"
-#define KEYLIST_KEYWORD "keyList"
-#define KEY_KEYWORD "key"
-#define KEYCODE_KEYWORD "keycode"
-#define TOOLTIP_KEYWORD "tooltip"
-#define SHORTCUT_KEYWORD "shortcut"
-#define HOVER_KEYWORD "hover"
-#define FACTORLIST_KEYWORD "factorList"
-#define FACTOR_KEYWORD "factor"
-#define FORM_KEYWORD "form"
-#define FORMLIST_KEYWORD "formList"
-#define SHORTCUT_KEYWORD "shortcut"
-#define MENULIST_KEYWORD "menuList"
-
-#define SEPARATOR_MENU_KEYWORD "separator"
-#define ADVANCED_MENU_KEYWORD "advancedItem"
-#define INFO_MENU_KEYWORD "infoItem"
-#define ONTOP_MENU_KEYWORD "onTopItem"
-#define SWITCH_MENU_KEYWORD "switchItem"
-#define SCALE_MENU_KEYWORD "scaleItem"
-#define CONTROLLER_MENU_KEYWORD "controllerItem"
-#define HOSTKBD_MENU_KEYWORD "hostKeyboardItem"
-#define SHELL_MENU_KEYWORD "shellItem"
-#define ECP_MENU_KEYWORD "controlPanelItem"
-#define SCREENSHOT_MENU_KEYWORD "screenShotItem"
-#define ABOUT_MENU_KEYWORD "aboutItem"
-#define FORCECLOSE_MENU_KEYWORD "forceCloseItem"
-#define CLOSE_MENU_KEYWORD "closeItem"
-
-#endif // XMLLAYOUTKEYWORD_H
diff --git a/tizen/src/display/xmllayoutparser.cpp b/tizen/src/display/xmllayoutparser.cpp
deleted file mode 100644 (file)
index 82ed1df..0000000
+++ /dev/null
@@ -1,688 +0,0 @@
-/*
- * Qt UI
- *
- * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * GiWoong Kim <giwoong.kim@samsung.com>
- * Sangho Park <sangho1206.park@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
- *
- */
-
-#include "xmllayoutparser.h"
-#include "xmllayoutkeyword.h"
-#include "skinpainter.h"
-#include "layout/keycodetype.h"
-#include "controller/generalpurposecon.h"
-
-/* Qt Qlayout has a minimum size */
-#define QT_LAYOUT_MINIMUM (73)
-
-XmlLayoutParser::XmlLayoutParser(QString path, UIInformation *uiInfo)
-{
-    this->xmlPath = path;
-    this->uiInfo = uiInfo;
-}
-
-QColor XmlLayoutParser::parseColor(QXmlStreamReader &xml)
-{
-    int red = 0, green = 0, blue = 0;
-
-    if (xml.name() == COLOR_KEYWORD &&
-        xml.tokenType() == QXmlStreamReader::StartElement) {
-        QXmlStreamAttributes attributes = xml.attributes();
-
-        if (attributes.hasAttribute(COLOR_RED_ATTR_KEYWORD)) {
-            red = attributes.value(COLOR_RED_ATTR_KEYWORD).toString().toInt();
-            qDebug() << red;
-        }
-        if (attributes.hasAttribute(COLOR_GREEN_ATTR_KEYWORD)) {
-            green = attributes.value(COLOR_GREEN_ATTR_KEYWORD).toString().toInt();
-            qDebug() << green;
-        }
-        if (attributes.hasAttribute(COLOR_BLUE_ATTR_KEYWORD)) {
-            blue = attributes.value(COLOR_BLUE_ATTR_KEYWORD).toString().toUInt();
-            qDebug() << blue;
-        }
-    }
-
-    return QColor(red, green, blue, 255);
-}
-
-HoverType *XmlLayoutParser::parseHover(QXmlStreamReader &xml)
-{
-    QColor color;
-
-    QXmlStreamReader::TokenType token = xml.readNext();
-
-    while (xml.atEnd() == false && (xml.name() == HOVER_KEYWORD &&
-        token == QXmlStreamReader::EndElement) == false) /* ~ </hover> */
-    {
-        if (token == QXmlStreamReader::StartElement) {
-            if (xml.name() == COLOR_KEYWORD) {
-                /* color */
-                color = parseColor(xml);
-                qDebug() << "hover color :" << color;
-            }
-        }
-
-        token = xml.readNext();
-    }
-
-    return new HoverType(color);
-}
-
-QRect XmlLayoutParser::parseRegion(QXmlStreamReader &xml)
-{
-    int left = 0, top = 0;
-    unsigned int width = 0, height = 0;
-
-    if (xml.name() == REGION_KEYWORD &&
-        xml.tokenType() == QXmlStreamReader::StartElement) {
-        QXmlStreamAttributes attributes = xml.attributes();
-
-        if (attributes.hasAttribute(REGION_LEFT_ATTR_KEYWORD)) {
-            left = attributes.value(REGION_LEFT_ATTR_KEYWORD).toString().toInt();
-        }
-        if (attributes.hasAttribute(REGION_TOP_ATTR_KEYWORD)) {
-            top = attributes.value(REGION_TOP_ATTR_KEYWORD).toString().toInt();
-        }
-        if (attributes.hasAttribute(REGION_WIDTH_ATTR_KEYWORD)) {
-            width = attributes.value(REGION_WIDTH_ATTR_KEYWORD).toString().toUInt();
-        }
-        if (attributes.hasAttribute(REGION_HEIGHT_ATTR_KEYWORD)) {
-            height = attributes.value(REGION_HEIGHT_ATTR_KEYWORD).toString().toUInt();
-        }
-    }
-
-    return QRect(left, top, width, height);
-}
-
-DisplayType *XmlLayoutParser::parseDisplay(QXmlStreamReader &xml)
-{
-    QRect displayRect;
-    int angle = 0;
-    QPixmap maskImage;
-
-    qDebug() << "**" << DISPLAY_KEYWORD << "{";
-
-    QXmlStreamReader::TokenType token = xml.readNext();
-
-    while (xml.atEnd() == false && (xml.name() == DISPLAY_KEYWORD &&
-        token == QXmlStreamReader::EndElement) == false) /* ~ </display> */
-    {
-        if (token == QXmlStreamReader::StartElement) {
-            if (xml.name() == REGION_KEYWORD) {
-                /* region */
-                displayRect = parseRegion(xml);
-                qDebug("- rect : (%d,%d %dx%d)",
-                    displayRect.x(), displayRect.y(),
-                    displayRect.width(), displayRect.height());
-            } else if (xml.name() == ANGLE_KEYWORD) {
-                /* angle */
-                angle = xml.readElementText().toInt();
-            } else if (xml.name() == MASK_IMG_KEYWORD) {
-                /* display mask */
-                QString maskImageFileName = xml.readElementText();
-                qDebug() << "-" << MASK_IMG_KEYWORD << ":" << maskImageFileName;
-
-                if (maskImage.load(
-                    xmlPath + QDir::separator() + maskImageFileName) == false) {
-                    qWarning() << "failed to load mask image";
-                }
-            }
-        }
-
-        token = xml.readNext();
-    }
-
-    qDebug("** }");
-
-    return new DisplayType(displayRect, angle, maskImage);
-}
-
-KeycodeType *XmlLayoutParser::parseKeycode(QXmlStreamReader &xml)
-{
-    int longPress = -1, shortPress = 0;
-
-    /* attribute */
-    longPress = xml.attributes().value(KEYCODE_LONGPRESS_ATTR_KEYWORD).toString().toInt();
-
-    shortPress = xml.readElementText().toInt();
-
-    return new KeycodeType(shortPress, longPress);
-}
-
-HardwareKey *XmlLayoutParser::parseKey(QXmlStreamReader &xml)
-{
-    QRect keyRegion;
-    KeycodeType *keycodeType = NULL;
-    QString keyTooptip;
-    QString keySequence;
-
-    /* attribute */
-    QString keyName = xml.attributes().value(NAME_ATTR_KEYWORD).toString();
-
-    QXmlStreamReader::TokenType token = xml.readNext();
-
-    while (xml.atEnd() == false && (xml.name() == KEY_KEYWORD &&
-        token == QXmlStreamReader::EndElement) == false) /* ~ </key> */
-    {
-        if (token == QXmlStreamReader::StartElement) {
-            if (xml.name() == REGION_KEYWORD) {
-                /* region */
-                keyRegion = parseRegion(xml);
-            } else if (xml.name() == KEYCODE_KEYWORD) {
-                /* keycode */
-                keycodeType = parseKeycode(xml);
-            } else if (xml.name() == TOOLTIP_KEYWORD) {
-                /* tooltip */
-                keyTooptip = xml.readElementText();
-            } else if (xml.name() == SHORTCUT_KEYWORD) {
-                /* shortcut */
-                keySequence = xml.readElementText();
-            }
-        }
-
-        token = xml.readNext();
-    }
-
-    return new HardwareKey(keyName, keycodeType, keyRegion, keyTooptip, keySequence);
-}
-
-int XmlLayoutParser::parseKeyList(
-    QXmlStreamReader &xml, QList<HardwareKey *> &list)
-{
-    HardwareKey *hwKey = NULL;
-    QXmlStreamReader::TokenType token = xml.readNext();
-
-    while (xml.atEnd() == false && (xml.name() == KEYLIST_KEYWORD &&
-        token == QXmlStreamReader::EndElement) == false) /* ~ </keyList> */
-    {
-        if (token == QXmlStreamReader::StartElement) {
-            if (xml.name() == KEY_KEYWORD) {
-                hwKey = parseKey(xml);
-                if (hwKey != NULL) {
-                    list.append(hwKey);
-                }
-            }
-        }
-
-        token = xml.readNext();
-    }
-
-    return list.count();
-}
-
-MainForm *XmlLayoutParser::parseMainForm(QXmlStreamReader &xml)
-{
-    /* attribute */
-    QString formName = xml.attributes().value(NAME_ATTR_KEYWORD).toString();
-    MainForm *form = new MainForm(formName);
-
-    qDebug() << '*' << form->getName() << '{';
-
-    QXmlStreamReader::TokenType token = xml.readNext();
-
-    while (xml.atEnd() == false && (xml.name() == FORM_KEYWORD &&
-        token == QXmlStreamReader::EndElement) == false) /* ~ </form> */
-    {
-        if (token == QXmlStreamReader::StartElement) {
-            if (xml.name() == DISPLAY_KEYWORD) {
-                /* display */
-                form->displayType = parseDisplay(xml);
-            } else if (xml.name() == NORMAL_IMG_KEYWORD) {
-                /* normal image */
-                QString normalImageFileName = xml.readElementText();
-                qDebug() << "-" << NORMAL_IMG_KEYWORD << ":" << normalImageFileName;
-
-                if (form->skinImg[MainForm::normal].load(
-                    xmlPath + QDir::separator() + normalImageFileName) == false) {
-                    qWarning() << "failed to load normal image";
-                }
-            } else if (xml.name() == PRESSED_IMG_KEYWORD) {
-                /* key pressed image */
-                QString pressedImageFileName = xml.readElementText();
-                qDebug() << "-" << PRESSED_IMG_KEYWORD << ":" << pressedImageFileName;
-
-                if (form->skinImg[MainForm::pressed].load(
-                    xmlPath + QDir::separator() + pressedImageFileName) == false) {
-                    qWarning() << "failed to load pressed image";
-                }
-            }  else if (xml.name() == ROTARY_IMG_KEYWORD) {
-                /* rotary image */
-                QString rotaryImageFileName = xml.readElementText();
-                qDebug() << "-" << ROTARY_IMG_KEYWORD << ":" << rotaryImageFileName;
-
-                form->setRotaryImage(new QPixmap(
-                    xmlPath + QDir::separator() + rotaryImageFileName));
-                if (form->getRotaryImage()->isNull() == true) {
-                    qWarning() << "failed to load rotary image";
-                }
-            } else if (xml.name() == KEYLIST_KEYWORD) {
-                /* HW keys */
-                int cnt = parseKeyList(xml, form->keyList);
-                qDebug() << "-" << KEYLIST_KEYWORD << ":" << cnt;
-            } else {
-                qWarning() << "undefined element :" << xml.name();
-            }
-        }
-
-        token = xml.readNext();
-    }
-
-    qDebug("}");
-
-    return form;
-}
-
-int XmlLayoutParser::parseMainFormList(
-    QXmlStreamReader &xml, QList<MainForm *> &list)
-{
-    MainForm *form = NULL;
-    QXmlStreamReader::TokenType token = xml.readNext();
-
-    while (xml.atEnd() == false && (xml.name() == FORMLIST_KEYWORD &&
-        token == QXmlStreamReader::EndElement) == false) /* ~ </formList> */
-    {
-        if (token == QXmlStreamReader::StartElement) {
-            if (xml.name() == FORM_KEYWORD) {
-                form = parseMainForm(xml);
-                if (form != NULL) {
-                    /* image validation */
-                    if (form->skinImg[MainForm::normal].size() == QSize(0, 0)) {
-                        qDebug("- general purpose skin form");
-
-                        SkinPainter painter("main-skin",
-                            uiInfo->resolution, form->displayType->getAngle(),
-                            QPoint(30, 16), uiInfo->getVMColor());
-                        form->setGeneralPurpose(true);
-
-                        form->skinImg[MainForm::normal] = painter.getSkinImage();
-                        form->displayType->setRect(painter.getCenterRect());
-                    }
-
-                    list.append(form);
-                }
-            }
-        }
-
-        token = xml.readNext();
-    }
-
-    return list.count();
-}
-
-/* menu */
-int XmlLayoutParser::parseFactorList(
-    QXmlStreamReader &xml, QMap<int, QString> &map, int *defaultFactor)
-{
-    QString defaultValue = xml.attributes().value(DEFAULT_ATTR_KEYWORD).toString();
-    *defaultFactor = defaultValue.toInt();
-
-    QXmlStreamReader::TokenType token = xml.readNext();
-
-    while (xml.atEnd() == false && (xml.name() == "factorList" &&
-        token == QXmlStreamReader::EndElement) == false) /* ~ </factorList> */
-    {
-        if (token == QXmlStreamReader::StartElement) {
-            if (xml.name() == FACTOR_KEYWORD) {
-                QString value = xml.attributes().value(NAME_ATTR_KEYWORD).toString();
-                map.insert(xml.readElementText().toInt(), value);
-            }
-        }
-
-        token = xml.readNext();
-    }
-
-    return map.count();
-}
-
-int XmlLayoutParser::parseShortcut(
-    QXmlStreamReader &xml, QMap<QString, QString> &map)
-{
-    QString key = xml.attributes().value(PROP_ATTR_KEYWORD).toString();
-    map.insert(key, xml.readElementText());
-
-    return map.count();
-}
-
-AdvancedMenuItem *XmlLayoutParser::parseAdvancedMenuItem(QXmlStreamReader &xml)
-{
-    /* attribute */
-    QString menuName = xml.attributes().value(NAME_ATTR_KEYWORD).toString();
-    AdvancedMenuItem *item = new AdvancedMenuItem(menuName);
-
-    QXmlStreamReader::TokenType token = xml.readNext();
-
-    while (xml.atEnd() == false && (xml.name() == "advancedItem" &&
-        token == QXmlStreamReader::EndElement) == false) /* ~ </advancedItem> */
-    {
-        if (token == QXmlStreamReader::StartElement) {
-            if (xml.name() == SHORTCUT_KEYWORD) {
-                parseShortcut(xml, item->getShortcutMap());
-            } else if (xml.name() == MENULIST_KEYWORD) {
-                int cnt = parseMenuList(xml, item->getMenuList());
-                qDebug("- advanced menuList : %d", cnt);
-            }
-        }
-
-        token = xml.readNext();
-    }
-
-    return item;
-}
-
-ScaleMenuItem *XmlLayoutParser::parseScaleMenuItem(QXmlStreamReader &xml)
-{
-    /* attribute */
-    QString menuName = xml.attributes().value(NAME_ATTR_KEYWORD).toString();
-    ScaleMenuItem *item = new ScaleMenuItem(menuName);
-
-    QXmlStreamReader::TokenType token = xml.readNext();
-
-    while (xml.atEnd() == false && (xml.name() == "scaleItem" &&
-        token == QXmlStreamReader::EndElement) == false) /* ~ </scaleItem> */
-    {
-        if (token == QXmlStreamReader::StartElement) {
-            if (xml.name() == SHORTCUT_KEYWORD) {
-                parseShortcut(xml, item->getShortcutMap());
-            } else if (xml.name() == FACTORLIST_KEYWORD) {
-                int defaultFactor = 0;
-                int cnt = parseFactorList(xml, item->getFactorMap(), &defaultFactor);
-                qDebug("- scale factorList : %d", cnt);
-
-                item->setDefaultScaleFactor(defaultFactor);
-            }
-        }
-
-        token = xml.readNext();
-    }
-
-    return item;
-}
-
-MenuItem *XmlLayoutParser::parseGeneralMenuItem(
-    QXmlStreamReader &xml, int menuType)
-{
-    QString itemKeyword = xml.name().toString();
-
-    /* attribute */
-    QString menuName = xml.attributes().value(NAME_ATTR_KEYWORD).toString();
-    MenuItem *item = new MenuItem(menuType, menuName);
-
-    QString shortcut;
-    QXmlStreamReader::TokenType token = xml.readNext();
-
-    while (xml.atEnd() == false && (xml.name().compare(itemKeyword) == 0 &&
-        token == QXmlStreamReader::EndElement) == false) /* ~ </xxItem> */
-    {
-        if (token == QXmlStreamReader::StartElement) {
-            if (xml.name() == SHORTCUT_KEYWORD) {
-                parseShortcut(xml, item->getShortcutMap());
-            }
-        }
-
-        token = xml.readNext();
-    }
-
-    return item;
-}
-
-int XmlLayoutParser::parseMenuList(
-    QXmlStreamReader &xml, QList<MenuItem *> &list)
-{
-    MenuItem *item = NULL;
-    QXmlStreamReader::TokenType token = xml.readNext();
-
-    while (xml.atEnd() == false && (xml.name() == MENULIST_KEYWORD &&
-        token == QXmlStreamReader::EndElement) == false) /* ~ </menuList> */
-    {
-        if (token == QXmlStreamReader::StartElement) {
-            if (xml.name() == SEPARATOR_MENU_KEYWORD) {
-                item = new MenuItem(MenuItemType::separator, NULL);
-                if (item != NULL) {
-                    list.append(item);
-                }
-            } else if (xml.name() == ADVANCED_MENU_KEYWORD) {
-                item = (MenuItem *)parseAdvancedMenuItem(xml);
-                if (item != NULL) {
-                    list.append(item);
-                }
-            } else if (xml.name() == INFO_MENU_KEYWORD) {
-                item = parseGeneralMenuItem(xml, MenuItemType::infoItem);
-                if (item != NULL) {
-                    list.append(item);
-                }
-            } else if (xml.name() == ONTOP_MENU_KEYWORD) {
-                item = parseGeneralMenuItem(xml, MenuItemType::onTopItem);
-                if (item != NULL) {
-                    list.append(item);
-                }
-            } else if (xml.name() == SWITCH_MENU_KEYWORD) {
-                item = parseGeneralMenuItem(xml, MenuItemType::switchItem);
-                if (item != NULL) {
-                    list.append(item);
-                }
-            } else if (xml.name() == SCALE_MENU_KEYWORD) {
-                item = (MenuItem *)parseScaleMenuItem(xml);
-                if (item != NULL) {
-                    list.append(item);
-                }
-            } else if (xml.name() == CONTROLLER_MENU_KEYWORD) {
-                item = parseGeneralMenuItem(xml, MenuItemType::controllerItem);
-                if (item != NULL) {
-                    list.append(item);
-                }
-            } else if (xml.name() == HOSTKBD_MENU_KEYWORD) {
-                item = parseGeneralMenuItem(xml, MenuItemType::hostKeyboardItem);
-                if (item != NULL) {
-                    list.append(item);
-                }
-            } else if (xml.name() == SHELL_MENU_KEYWORD) {
-                item = parseGeneralMenuItem(xml, MenuItemType::shellItem);
-                if (item != NULL) {
-                    list.append(item);
-                }
-            } else if (xml.name() == ECP_MENU_KEYWORD) {
-                item = parseGeneralMenuItem(xml, MenuItemType::controlPanelItem);
-                if (item != NULL) {
-                    list.append(item);
-                }
-            } else if (xml.name() == SCREENSHOT_MENU_KEYWORD) {
-                item = parseGeneralMenuItem(xml, MenuItemType::screenShotItem);
-                if (item != NULL) {
-                    list.append(item);
-                }
-            } else if (xml.name() == ABOUT_MENU_KEYWORD) {
-                item = parseGeneralMenuItem(xml, MenuItemType::aboutItem);
-                if (item != NULL) {
-                    list.append(item);
-                }
-            } else if (xml.name() == FORCECLOSE_MENU_KEYWORD) {
-                item = parseGeneralMenuItem(xml, MenuItemType::forceCloseItem);
-                if (item != NULL) {
-                    list.append(item);
-                }
-            } else if (xml.name() == CLOSE_MENU_KEYWORD) {
-                item = parseGeneralMenuItem(xml, MenuItemType::closeItem);
-                if (item != NULL) {
-                    list.append(item);
-                }
-            }
-        }
-
-        token = xml.readNext();
-    }
-
-    return list.count();
-}
-
-QString XmlLayoutParser::parseEmulatorUI(QXmlStreamReader &xml)
-{
-    QString layoutVersion = "undefined";
-
-    QXmlStreamReader::TokenType token;
-
-    while (xml.atEnd() == false && xml.hasError() == false) {
-        token = xml.readNext();
-        /* If token is just StartDocument, go to next.*/
-        if (token == QXmlStreamReader::StartDocument) {
-            continue;
-        }
-
-        if (token == QXmlStreamReader::StartElement) {
-            if (xml.name() == EMULATOR_UI_KEYWORD) {
-                continue;
-            }
-
-            if (xml.name() == LAYOUTVER_KEYWORD) {
-                layoutVersion = xml.readElementText();
-                continue;
-            } else if (xml.name() == FORMLIST_KEYWORD) {
-                int cnt = parseMainFormList(xml, uiInfo->mainFormList);
-                qDebug() << FORMLIST_KEYWORD << ":" << cnt;
-            } else if (xml.name() == MENULIST_KEYWORD) {
-                int cnt = parseMenuList(xml, uiInfo->menuList);
-                qDebug() << MENULIST_KEYWORD << ":" << cnt;
-            }
-        }
-    }
-
-    return layoutVersion;
-}
-
-/* controller */
-ControllerForm *XmlLayoutParser::parseControllerForm(QXmlStreamReader &xml)
-{
-    /* attribute */
-    QString formName = xml.attributes().value(NAME_ATTR_KEYWORD).toString();
-    ControllerForm *form = new ControllerForm(
-        formName.isEmpty() ? xmlPath.section(QDir::separator(), -1) : formName);
-
-    qDebug() << '*' << form->getName() << "{";
-
-    QXmlStreamReader::TokenType token = xml.readNext();
-
-    while (xml.atEnd() == false && (xml.name() == FORM_KEYWORD &&
-        token == QXmlStreamReader::EndElement) == false) /* ~ </form> */
-    {
-        if (token == QXmlStreamReader::StartElement) {
-            if (xml.name() == NORMAL_IMG_KEYWORD) {
-                /* normal image */
-                QString normalImageFileName = xml.readElementText();
-                qDebug() << "-" << NORMAL_IMG_KEYWORD << ":" <<  normalImageFileName;
-
-                if (form->conImg[ControllerForm::normal].load(
-                    xmlPath + QDir::separator() + normalImageFileName) == false) {
-                    qWarning() << "failed to load normal image";
-                }
-            } else if (xml.name() == PRESSED_IMG_KEYWORD) {
-                /* key pressed image */
-                QString pressedImageFileName = xml.readElementText();
-                qDebug() << "-" << PRESSED_IMG_KEYWORD << ":" << pressedImageFileName;
-
-                if (form->conImg[ControllerForm::pressed].load(
-                    xmlPath + QDir::separator() + pressedImageFileName) == false) {
-                    qWarning() << "failed to load pressed image";
-                }
-            } else if (xml.name() == KEYLIST_KEYWORD) {
-                /* HW keys */
-                int cnt = parseKeyList(xml, form->keyList);
-                qDebug() << "-" << KEYLIST_KEYWORD << ":" << cnt;
-            } else if (xml.name() == HOVER_KEYWORD) {
-                /* hover */
-                form->setHoverType(parseHover(xml));
-            } else {
-                qWarning() << "undefined element :" << xml.name();
-            }
-        }
-
-        token = xml.readNext();
-    }
-
-    qDebug("}");
-
-    return form;
-}
-
-QString XmlLayoutParser::parseControllerUI(QXmlStreamReader &xml)
-{
-    QString layoutVersion = "undefined";
-
-    ControllerForm *form = NULL;
-    QXmlStreamReader::TokenType token;
-
-    while (xml.atEnd() == false && xml.hasError() == false) {
-        token = xml.readNext();
-        /* If token is just StartDocument, go to next.*/
-        if (token == QXmlStreamReader::StartDocument) {
-            continue;
-        }
-
-        if (token == QXmlStreamReader::StartElement) {
-            if (xml.name() == CONTROLLER_UI_KEYWORD) {
-                continue;
-            }
-
-            if (xml.name() == LAYOUTVER_KEYWORD) {
-                layoutVersion = xml.readElementText();
-                continue;
-            } else if (xml.name() == FORM_KEYWORD) {
-                form = parseControllerForm(xml);
-                if (form != NULL) {
-                    /* image validation */
-                    if (form->conImg[ControllerForm::normal].size() == QSize(0, 0)) {
-                        qDebug("- general purpose con form");
-
-                        int keyCount = form->keyList.count();
-
-                        int width = GPC_KEYBUTTON_WIDTH;
-                        int height = GPC_HEAD_SPACING;
-                        if (keyCount < GPC_KEYBUTTON_DEFAULT_CNT) {
-                            height += (GPC_KEYBUTTON_HEIGHT * keyCount) +
-                                (GPC_KEYBUTTON_VSPACING * (keyCount - 1)) +
-                                GPC_TAIL_SPACING;
-                        } else {
-                            width += (GPC_SCROLLBAR_WIDTH + GPC_SCROLLBAR_HSPACING);
-                            height += (GPC_KEYBUTTON_HEIGHT * GPC_KEYBUTTON_DEFAULT_CNT) +
-                                (GPC_KEYBUTTON_VSPACING * (GPC_KEYBUTTON_DEFAULT_CNT - 1)) +
-                                GPC_TAIL_SPACING;
-                        }
-
-                        SkinPainter painter("controller-skin",
-                            QSize(width, qMax(height, QT_LAYOUT_MINIMUM - 20)),
-                            0, QPoint(14, GPC_HEAD_SPACING - 1),
-                            uiInfo->getVMColor());
-                        form->setGeneralPurpose(true);
-
-                        form->conImg[ControllerForm::normal] = painter.getSkinImage();
-                        form->centerRect = painter.getCenterRect();
-                    }
-
-                    uiInfo->conFormList.append(form);
-                }
-            }
-        }
-    }
-
-    return layoutVersion;
-}
diff --git a/tizen/src/display/xmllayoutparser.h b/tizen/src/display/xmllayoutparser.h
deleted file mode 100644 (file)
index 6e01a02..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Qt UI
- *
- * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact:
- * GiWoong Kim <giwoong.kim@samsung.com>
- * Sangho Park <sangho1206.park@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
- *
- */
-
-#ifndef XMLLAYOUTPARSER_H
-#define XMLLAYOUTPARSER_H
-
-#include <QXmlStreamReader>
-
-#include "uiinformation.h"
-#include "layout/keycodetype.h"
-#include "layout/mainform.h"
-#include "layout/controllerform.h"
-#include "menu/menuitem.h"
-#include "menu/advancedmenuitem.h"
-#include "menu/scalemenuitem.h"
-
-
-class XmlLayoutParser
-{
-public:
-    XmlLayoutParser(QString path, UIInformation *uiInfo /* out */);
-
-    QString parseEmulatorUI(QXmlStreamReader &xml);
-    QString parseControllerUI(QXmlStreamReader &xml);
-
-private:
-    QColor parseColor(QXmlStreamReader &xml);
-    HoverType *parseHover(QXmlStreamReader &xml);
-    QRect parseRegion(QXmlStreamReader &xml);
-    DisplayType *parseDisplay(QXmlStreamReader &xml);
-    KeycodeType *parseKeycode(QXmlStreamReader &xml);
-    HardwareKey *parseKey(QXmlStreamReader &xml);
-    int parseKeyList(QXmlStreamReader &xml, QList<HardwareKey *> &list);
-    MainForm *parseMainForm(QXmlStreamReader &xml);
-    int parseMainFormList(QXmlStreamReader &xml, QList<MainForm *> &list);
-
-    int parseFactorList(QXmlStreamReader &xml, QMap<int, QString> &map, int *defaultFactor);
-    int parseShortcut(QXmlStreamReader &xml, QMap<QString, QString> &map);
-    AdvancedMenuItem *parseAdvancedMenuItem(QXmlStreamReader &xml);
-    ScaleMenuItem *parseScaleMenuItem(QXmlStreamReader &xml);
-    MenuItem *parseGeneralMenuItem(QXmlStreamReader &xml, int menuType);
-    int parseMenuList(QXmlStreamReader &xml, QList<MenuItem *> &list);
-
-    ControllerForm *parseControllerForm(QXmlStreamReader &xml);
-
-    QString xmlPath;
-    UIInformation *uiInfo;
-};
-
-#endif // XMLLAYOUTPARSER_H
index 57b921bd10b8ac73e866c2802c5284f342bb5636..87dab3f7983a101f4b4263ac598fdcccc4ddf3d5 100644 (file)
@@ -37,9 +37,8 @@
 #include "monitor/qdev.h"
 #include "hw/virtio/maru_virtio_sensor.h"
 #include "hw/virtio/maru_virtio_nfc.h"
-#include "skin/maruskin_operation.h"
-#include "skin/maruskin_server.h"
 
+#include "util/ui_operations.h"
 #include "util/device_hotplug.h"
 #include "util/hds.h"
 #include "emul_state.h"
index dca573046b73a509cfa2d276788bbd5edaded718..6892443fd1e517dc0d46fb0ea4f11644431b1af8 100644 (file)
@@ -44,7 +44,7 @@
 #include "ecs.h"
 #include "debug_ch.h"
 #include "util/osutil.h"
-#include "skin/maruskin_client.h"
+#include "util/exported_strings.h"
 
 MULTI_DEBUG_CHANNEL(qemu, ecs);
 
@@ -519,7 +519,7 @@ static void show_error_popup(char* data)
     strcat(fail_msg, addon);
     strcat(fail_msg, FAILED_TO_INSTALL_EXTRAPACKAGE_2);
 
-    start_simple_client(fail_msg);
+    error_report("%s", fail_msg);
 }
 
 static void* push_pkgs_thread(void* args)
index c064186692ea969365f38a8e5867f3fdcdc20b30..310dea6061dc2cf21a370e15175ff01fe59cdbb0 100644 (file)
@@ -52,11 +52,14 @@ extern bool hax_allowed;
 #include "qmp-commands.h"
 
 #include "emulator_options.h"
-#include "skin/maruskin_server.h"
 #include "hw/virtio/maru_virtio_touchscreen.h"
 #include "hw/virtio/maru_virtio_evdi.h"
 #include "util/new_debug_ch.h"
 
+#ifdef CONFIG_JAVA_UI
+#include "skin/maruskin_server.h"
+#endif
+
 DECLARE_DEBUG_CHANNEL(emul_state);
 
 static EmulatorConfigInfo _emul_info = {0,};
index f6cc9724dd7f427bf87951ce6d2144c23261f754..4205e0cc554b7e441b0e08bfa3eda5ea242ddbb2 100644 (file)
 #include "util/error_handler.h"
 #include "util/osutil.h"
 #include "util/sdb.h"
-#include "skin/maruskin_server.h"
 #include "util/new_debug_ch.h"
 #include "ecs/ecs.h"
 #include "util/device_hotplug.h"
 #include "util/exported_strings.h"
 
+#ifdef CONFIG_JAVA_UI
+#include "skin/maruskin_server.h"
+#include "skin/maruskin_client.h"
+#endif
+
 #ifdef CONFIG_SDL
 #include <SDL.h>
 #endif
index 42e220a74cb1f057b7760bd261b81223a302c650..3c64841b357b75d4623d42e48cf331f0940e83b5 100644 (file)
@@ -45,7 +45,6 @@
 #include "display/maru_display.h"
 #include "util/osutil.h"
 #include "util/sdb.h"
-#include "skin/maruskin_server.h"
 #include "debug_ch.h"
 #include "ecs/ecs.h"
 
index 10d607c1d0d7b434e63dcad2cf0a452c3f2f9340..78c48527c92b13e778b78bd50f851fa11a289523 100644 (file)
@@ -32,7 +32,6 @@
 
 #include "emulator_common.h"
 #include "emul_state.h"
-#include "skin/maruskin_operation.h"
 #include "encode_fb.h"
 
 #if defined(CONFIG_LINUX) && defined(ENCODE_DEBUG)
index c0004d163a2a46bb1f173f1df6b7b3fb6e931bad..7be99fc717e7acc1abd44975fd29420fd266fa7c 100644 (file)
 #include "hw/pci/pci.h"
 #include "hw/maru_device_ids.h"
 #include "maru_brightness.h"
-#include "skin/maruskin_server.h"
 #include "debug_ch.h"
 
 MULTI_DEBUG_CHANNEL(tizen, brightness);
 
+#ifdef CONFIG_JAVA_UI
+#include "skin/maruskin_server.h"
+#endif
+
 #define QEMU_DEV_NAME           "maru-brightness"
 
 #define BRIGHTNESS_MEM_SIZE    (4 * 1024)    /* 4KB */
@@ -74,7 +77,9 @@ uint8_t brightness_tbl[] = {155, /* level 0 : for dimming */
 /* level 81 ~ 90 */          29,  27,  26,  24,  23,  21,  20,  18,  17,  15,
 /* level 91 ~ 99 */          14,  12,  11,   9,   8,   6,   5,   3,   2,   0};
 
-QEMUBH *display_bh;
+#ifdef CONFIG_JAVA_UI
+QEMUBH *display_bh = NULL;
+#endif
 
 /* Image processing functions using the pixman library */
 void composite_brightness_image(pixman_image_t *dst_image)
@@ -178,8 +183,10 @@ static void brightness_reg_write(void *opaque,
             maru_pixman_image_set_alpha(brightness_tbl[brightness_level]);
         }
 
+#ifdef CONFIG_JAVA_UI
         /* notify to skin process */
         qemu_bh_schedule(display_bh);
+#endif
 
         return;
     default:
@@ -196,9 +203,11 @@ static const MemoryRegionOps brightness_mmio_ops = {
 
 static void brightness_exitfn(PCIDevice *dev)
 {
+#ifdef CONFIG_JAVA_UI
     if (display_bh) {
         qemu_bh_delete(display_bh);
     }
+#endif
     if (brightness_image) {
         pixman_image_unref(brightness_image);
         brightness_image = NULL;
@@ -207,10 +216,12 @@ static void brightness_exitfn(PCIDevice *dev)
     INFO("finalize maru-brightness device\n");
 }
 
+#ifdef CONFIG_JAVA_UI
 static void maru_display_bh(void *opaque)
 {
     notify_display_power(!display_off);
 }
+#endif
 
 static int brightness_initfn(PCIDevice *dev)
 {
@@ -225,7 +236,9 @@ static int brightness_initfn(PCIDevice *dev)
                             "maru-brightness-mmio", BRIGHTNESS_REG_SIZE);
     pci_register_bar(&s->dev, 1, PCI_BASE_ADDRESS_SPACE_MEMORY, &s->mmio_addr);
 
+#ifdef CONFIG_JAVA_UI
     display_bh = qemu_bh_new(maru_display_bh, s);
+#endif
     brightness_level = BRIGHTNESS_MAX;
     level_color.alpha = 0x0000;
     level_color.red = 0x0000;
index adf0677b3334495cd022e42ca87d48eb4d0c6225..af51e99a49963b56f16324921ed9b2aea97f729e 100644 (file)
@@ -1,6 +1,5 @@
 obj-y += maru_virtio_pci.o
 obj-y += maru_virtio_touchscreen.o
-obj-y += maru_virtio_esm.o
 obj-y += maru_virtio_evdi.o
 obj-y += maru_virtio_hwkey.o
 obj-y += maru_virtio_jack.o
@@ -11,3 +10,4 @@ obj-y += maru_virtio_sensor.o
 obj-y += maru_virtio_vmodem.o
 obj-y += maru_virtio_rotary.o
 obj-y += maru_virtio_tablet.o
+obj-y += maru_virtio_esm.o
index 03b863dd971c2ddbfbf66101e9a1cc53b6d18e9a..80f566660dd96d5eec5eca9a9690e2ebbf37287f 100644 (file)
 
 #include "hw/maru_device_ids.h"
 #include "maru_virtio_esm.h"
-#include "skin/maruskin_server.h"
 #include "emul_state.h"
 #include "debug_ch.h"
 
 MULTI_DEBUG_CHANNEL(qemu, esm);
 
+#ifdef CONFIG_JAVA_UI
+#include "skin/maruskin_server.h"
+#endif
 
 #define SYSTEM_MODE_LAYER 1
 #define USER_MODE_LAYER 0
@@ -84,13 +86,17 @@ static void virtio_esm_handle(VirtIODevice *vdev, VirtQueue *vq)
                     boot_complete |= (1 << SYSTEM_MODE_LAYER);
                 }
 
+#ifdef CONFIG_JAVA_UI
                 notify_booting_progress(SYSTEM_MODE_LAYER, progress.percentage);
+#endif
             } else {
                 if (progress.percentage >= 100) {
                     boot_complete |= (1 << USER_MODE_LAYER);
                 }
 
+#ifdef CONFIG_JAVA_UI
                 notify_booting_progress(USER_MODE_LAYER, progress.percentage);
+#endif
             }
 
             /* booting complete check */
index f212b7f2ab7eee06b8f7284cab9efe24a6cd2eb7..398c4bebe8c743e2fa4b6720df782bce34f8bc3b 100644 (file)
 
 MULTI_DEBUG_CHANNEL(qemu, skin_op);
 
-
-#define RESUME_KEY_SEND_INTERVAL 500 /* milli-seconds */
 #define CLOSE_POWER_KEY_INTERVAL 1200 /* milli-seconds */
 #define DATA_DELIMITER "#" /* in detail info data */
 
-/* touch values */
-static int guest_x, guest_y;
-static int pressing_x = -1, pressing_y = -1;
-static int pressing_origin_x = -1, pressing_origin_y = -1;
-
 extern pthread_mutex_t mutex_screenshot;
 extern pthread_cond_t cond_screenshot;
 
@@ -95,116 +88,6 @@ void do_grabbing_enable(bool on)
     maru_display_set_invalidate(on);
 }
 
-void do_mouse_event(int button_type, int event_type,
-    int origin_x, int origin_y, int x, int y, int z)
-{
-    if (display_off) {
-        if (button_type == 0) {
-            INFO("auto mouse release\n");
-            // TODO:
-            virtio_touchscreen_event(0, 0, 0, 0);
-
-            return;
-        } else {
-            TRACE("reject mouse touch in display off : "
-                    "button=%d, type=%d, x=%d, y=%d, z=%d\n",
-                    button_type, event_type, x, y, z);
-            return;
-        }
-    }
-
-    TRACE("mouse event : button=%d, type=%d, "
-        "host=(%d, %d), x=%d, y=%d, z=%d\n",
-        button_type, event_type, origin_x, origin_y, x, y, z);
-
-#if defined(CONFIG_JAVA_UI) && !defined(CONFIG_USE_SHM)
-    /* draw multi-touch points */
-    if (get_multi_touch_enable() != 0) {
-        if (event_type == MOUSE_DOWN || event_type == MOUSE_DRAG) {
-            update_finger_point(z, origin_x, origin_y, x, y);
-        } else if (event_type == MOUSE_UP) {
-            remove_finger_point(z);
-        }
-
-        maru_display_update();
-    }
-#endif
-
-    /* single touch */
-    switch(event_type) {
-        case MOUSE_DOWN:
-        case MOUSE_DRAG:
-            pressing_x = guest_x = x;
-            pressing_y = guest_y = y;
-            pressing_origin_x = origin_x;
-            pressing_origin_y = origin_y;
-
-            virtio_touchscreen_event(x, y, z, 1);
-
-            break;
-        case MOUSE_UP:
-            guest_x = x;
-            guest_y = y;
-            pressing_x = pressing_y = -1;
-            pressing_origin_x = pressing_origin_y = -1;
-
-            virtio_touchscreen_event(x, y, z, 0);
-
-            break;
-        case MOUSE_WHEELUP:
-        case MOUSE_WHEELDOWN:
-            if (is_emul_input_touch_enable() == true) {
-                x -= guest_x;
-                y -= guest_y;
-                guest_x += x;
-                guest_y += y;
-            } else {
-                guest_x = x;
-                guest_y = y;
-            }
-
-            virtio_touchscreen_event(x, y, -z, event_type);
-
-            break;
-        case MOUSE_MOVE:
-            guest_x = x;
-            guest_y = y;
-
-            if (x != 0) {
-                qemu_input_queue_rel(NULL, INPUT_AXIS_X, x);
-            }
-            if (y != 0) {
-                qemu_input_queue_rel(NULL, INPUT_AXIS_Y, y);
-            }
-            qemu_input_event_sync();
-
-            break;
-        case PS2_DOWN:
-            qemu_input_queue_btn(NULL, INPUT_BUTTON_LEFT, 1);
-            qemu_input_event_sync();
-
-            break;
-        case PS2_UP:
-            qemu_input_queue_btn(NULL, INPUT_BUTTON_LEFT, 0);
-            qemu_input_event_sync();
-
-            break;
-        default:
-            ERR("undefined mouse event type passed : %d\n", event_type);
-            break;
-    }
-}
-
-void do_qt_keyboard_key_event(int event_type, int keycode) {
-    if (KEY_PRESSED == event_type) {
-        TRACE("key pressed: %d\n", keycode);
-        virtio_keyboard_event(keycode);
-    } else if (KEY_RELEASED == event_type) {
-        TRACE("key released: %d\n", keycode);
-        virtio_keyboard_event(keycode | 0x80);
-    }
-}
-
 #if defined(CONFIG_JAVA_UI) && !defined(CONFIG_USE_SHM)
 static void multitouch_toggle_key_checking(int event_type,
     int keycode, int state_mask, int key_location)
@@ -299,30 +182,6 @@ void do_keyboard_key_event(int event_type,
     }
 }
 
-void do_hw_key_event(int event_type, int keycode)
-{
-    TRACE("HW Key : event_type=%d, keycode=%d\n", event_type, keycode);
-
-    // TODO: remove workaround
-    if (runstate_check(RUN_STATE_SUSPENDED)) {
-        if (KEY_PRESSED == event_type) {
-            /* home key or power key is used for resume */
-            if ((HARD_KEY_HOME == keycode) || (HARD_KEY_POWER == keycode)) {
-                INFO("user requests system resume\n");
-                resume();
-
-#ifdef CONFIG_WIN32
-                Sleep(RESUME_KEY_SEND_INTERVAL);
-#else
-                usleep(RESUME_KEY_SEND_INTERVAL * 1000);
-#endif
-            }
-        }
-    }
-
-    maru_hwkey_event(event_type, keycode);
-}
-
 void do_scale_event(double scale_factor)
 {
     INFO("do_scale_event scale_factor : %lf\n", scale_factor);
@@ -580,21 +439,6 @@ void do_open_shell(void)
     /* do nothing */
 }
 
-void do_host_kbd_enable(bool on)
-{
-    INFO("host kbd enable : %d\n", on);
-
-#if defined(TARGET_ARM)
-    mloop_evcmd_usbkbd(on);
-#elif defined(TARGET_I386)
-    if (on) {
-        do_hotplug(ATTACH_HOST_KEYBOARD, NULL, 0);
-    } else {
-        do_hotplug(DETACH_HOST_KEYBOARD, NULL, 0);
-    }
-#endif
-}
-
 void do_interpolation_enable(bool on)
 {
     INFO("interpolation enable : %d\n", on);
@@ -635,8 +479,13 @@ void request_close(void)
     maru_display_update();
 }
 
-void do_rotary_event(int32_t delta, int32_t type)
+void do_host_kbd_enable(bool on)
 {
-    TRACE("rotaty event: delta(%d), type(%d)\n", delta, type);
-    maru_rotary_event(delta, type);
+    LOG_INFO("host kbd enable : %d\n", on);
+
+    if (on) {
+        do_hotplug(ATTACH_HOST_KEYBOARD, NULL, 0);
+    } else {
+        do_hotplug(DETACH_HOST_KEYBOARD, NULL, 0);
+    }
 }
index db4cf57a006cd34d5f45528fa83bd34bfb7e0f44..2126e8370e22da27e073a325f7e85f1fe8b760d6 100644 (file)
 
 #include "stdint.h"
 
-extern int ret_hax_init;
+// HACK: for common operations
+#include "util/ui_operations.h"
 
-#define TIMEOUT_FOR_SHUTDOWN 10 /* seconds */
+extern int ret_hax_init;
 
 typedef struct Framebuffer {
     unsigned char* data;
@@ -56,12 +57,8 @@ void start_display(uint64_t handle_id,
     double scale_factor, short rotation_type, bool blank_guide);
 
 void do_grabbing_enable(bool on);
-void do_mouse_event(int button_type, int event_type,
-    int origin_x, int origin_y, int x, int y, int z);
-void do_qt_keyboard_key_event(int event_type, int keycode);
 void do_keyboard_key_event(int event_type,
     int keycode, int state_mask, int key_location);
-void do_hw_key_event(int event_type, int keycode);
 void do_scale_event(double scale_factor);
 void do_rotation_event(int rotation_type);
 
@@ -72,12 +69,10 @@ void free_detail_info(DetailInfo *detail_info);
 void free_screenshot(Framebuffer *);
 
 void do_open_shell(void);
-void do_host_kbd_enable(bool on);
 void do_interpolation_enable(bool on);
 void do_ram_dump(void);
 void do_guestmemory_dump(void);
+void do_host_kbd_enable(bool on);
 
 void request_close(void);
-
-void do_rotary_event(int32_t delta, int32_t type);
 #endif /* MARUSKIN_OPERATION_H_ */
index ef66fac600db4765590f83378e0fbbf28af38d10..1c8a6dc40bbb7eb42182545ab778fbc989233cfb 100644 (file)
@@ -1,6 +1,10 @@
 TIZEN_UI = $(SRC_PATH)/tizen/src/ui
 QEMU_CFLAGS += $(QT_CFLAGS) -I$(TIZEN_UI)
 
+obj-$(CONFIG_QT) += qt5.o
+obj-$(CONFIG_QT) += qt5_supplement.o
+obj-$(CONFIG_QT) += xmllayoutparser.o
+
 $(obj)/qrc_resource.o: $(obj)/qrc_resource.cpp
 $(obj)/qrc_resource.cpp: $(TIZEN_UI)/resource/resource.qrc
        rcc -name resource $< -o $@
index 66a5a986c18f4013d584bc91687a4771608f3e1d..c3ca9bc97ecb3af6b04ff1d57f26cc874b56a90a 100644 (file)
@@ -32,8 +32,8 @@
 #include "hwkeybutton.h"
 
 extern "C" {
-#include "skin/maruskin_operation.h"
 #include "emul_state.h"
+#include "util/ui_operations.h"
 }
 
 HWKeyButton::HWKeyButton(QWidget *parent, HardwareKey *hwKey, QSize size) :
index 2345bb80151bbd350220ee0d6e91db8540d8e1a2..54689629521c96914cf0ef5ed234f93ec5b6cb38 100644 (file)
@@ -33,6 +33,9 @@
 #include "mainwindow.h"
 
 extern "C" {
+#include "util/ui_operations.h"
+
+void qt5_graphic_hw_invalidate(void);
 void req_set_sensor_accel_angle(int angle);
 void maru_tablet_event(int event_type, int x, int y, int btn, int btn_status);
 }
index 127c8923f19b2f3b2f8236023ccba1c4f9e554da..01de41184126fdd1f24bdaa6cc2764a29a1526bf 100644 (file)
 #include "layout/displaytype.h"
 #include "input/touchscreenhelper.h"
 
-extern "C" {
-void qt5_graphic_hw_invalidate(void);
-}
-
 enum {
     TOUCH_PRESS = 1,
     TOUCH_RELEASE = 2,
index c25a1af7cc82943810b4635d986bd0399b5ffdc4..643a73f528425622c8d9a1de9abc87551a9924d4 100644 (file)
@@ -34,7 +34,7 @@
 
 extern "C" {
 #include "emul_state.h"
-#include "skin/maruskin_operation.h"
+#include "util/ui_operations.h"
 
 void virtio_keyboard_event(int keycode);
 }
index 1cc8da6f5fc022e159e4c8e6a3e5922332909d94..e23a3fa1ea5f7512af3bd8a45838f848a37a3d1b 100644 (file)
 #include "resource/ui_strings.h"
 #include "mainwindow.h"
 
+extern "C" {
+#include "util/ui_operations.h"
+}
+
 KeyboardShortcut::KeyboardShortcut(QWidget *parent) : QWidget(parent)
 {
     this->parent = (MainWindow *)parent;
index 9d8774ed229d646898ad185df3f4a7dfdeb14973..c3c698d392739a69ec54c2a63fda7b21439bcd98 100644 (file)
@@ -32,6 +32,7 @@
 #include <QImage>
 #include <QDebug>
 
+#include "qt5_supplement.h"
 #include "multitouchtracker.h"
 #include "displaybase.h"
 
index e7372835149381b68614c1bd47ca61f7f8bc31cb..3cd69c9172049116c65af4f94a1d6cf616041814 100644 (file)
@@ -37,7 +37,9 @@
 #include "resource/ui_strings.h"
 
 extern "C" {
-extern void qt5_graphic_hw_update(void);
+#include "util/ui_operations.h"
+
+void qt5_graphic_hw_update(void);
 // FIXME: To avoid very complex header inclusion chains
 void qemu_system_graceful_shutdown_request(unsigned int sec);
 }
index ffd591efd4813ee23cf57514fd6e85710caecd1b..c617a8430e66667b950d76b79774075fa758e63a 100644 (file)
@@ -40,6 +40,9 @@
 extern "C" {
 // FIXME: To avoid very complex header inclusion chains
 void qemu_system_graceful_shutdown_request(unsigned int sec);
+
+#include "util/device_hotplug.h"
+#include "util/ui_operations.h"
 }
 
 ContextMenu::ContextMenu(QWidget *parent) : QMenu(parent)
@@ -577,7 +580,7 @@ void ContextMenu::slotShell()
 {
     qDebug("SDB shell");
 
-    if (is_sdbd_initialized == 0) {
+    if (!is_sdb_daemon_initialized()) {
         showMsgBox(QMessageBox::Warning, MSG_SDB_NOT_READY);
         return;
     }
@@ -699,7 +702,11 @@ void ContextMenu::slotHostKeyboard(bool on)
 {
     qDebug("host keyboard : %s", on? "on" : "off");
 
-    do_host_kbd_enable(on);
+    if (on) {
+        do_hotplug(ATTACH_HOST_KEYBOARD, NULL, 0);
+    } else {
+        do_hotplug(DETACH_HOST_KEYBOARD, NULL, 0);
+    }
 }
 
 void ContextMenu::slotAbout()
index 991b4e6c0a4f72677b07beeb40d3792a5538c04e..57fa534b2ff5999a9d6fecff56f24d6ee45e16b1 100644 (file)
@@ -44,9 +44,8 @@
 class MainWindow;
 
 extern "C" {
-#include "skin/maruskin_operation.h"
-#include "skin/maruskin_server.h"
 #include "emul_state.h"
+#include "util/sdb.h"
 }
 
 #define CLOSE_POWER_KEY_INTERVAL 1200 /* milli-seconds */
diff --git a/tizen/src/ui/propertykeyword.h b/tizen/src/ui/propertykeyword.h
new file mode 100644 (file)
index 0000000..8763e40
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * Qt UI
+ *
+ * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * GiWoong Kim <giwoong.kim@samsung.com>
+ * Sangho Park <sangho1206.park@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
+ *
+ */
+
+#ifndef PROPERTYKEYWORD_H
+#define PROPERTYKEYWORD_H
+
+#define SKIN_PROPERTY_NAME "skin.name"
+#define SKIN_PROPERTY_WINDOW_X "window.x"
+#define SKIN_PROPERTY_WINDOW_Y "window.y"
+#define SKIN_PROPERTY_WINDOW_SCALE "window.scale"
+#define SKIN_PROPERTY_WINDOW_TOPMOST "window.ontop"
+#define SKIN_PROPERTY_CONTROLLER_INDEX "controller.index"
+#define SKIN_PROPERTY_CONTROLLER_DOCK "controller.dock"
+
+#endif // PROPERTYKEYWORD_H
diff --git a/tizen/src/ui/qt5.c b/tizen/src/ui/qt5.c
new file mode 100644 (file)
index 0000000..7e8a714
--- /dev/null
@@ -0,0 +1,210 @@
+/*
+ * Qt UI
+ *
+ * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * Sangho Park <sangho1206.park@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
+ *
+ */
+
+#include "ui/console.h"
+
+#include "qt5.h"
+#include "emul_state.h"
+#include "qt5_supplement.h"
+#include "hw/pci/maru_brightness.h"
+#ifdef CONFIG_DARWIN
+#include "ns_event.h"
+#endif
+
+
+#include "util/new_debug_ch.h"
+
+DECLARE_DEBUG_CHANNEL(qt5_console);
+
+static int qt5_num_outputs;
+
+// only for informing HW specification
+static int pixel_density_dpi;
+
+static struct qt5_state {
+    DisplayChangeListener dcl;
+    DisplaySurface *surface;
+
+    int idx;
+} *qt5_console;
+
+void qt5_graphic_hw_invalidate(void)
+{
+    graphic_hw_invalidate(NULL);
+}
+
+void qt5_graphic_hw_update(void)
+{
+    graphic_hw_update(NULL);
+}
+
+int qt5_graphic_hw_display(void)
+{
+    console_ch_t displayed = 0;
+    graphic_hw_text_update(NULL, &displayed);
+    return displayed;
+}
+
+static void qt5_update(DisplayChangeListener *dcl,
+                       int x, int y, int w, int h)
+{
+    struct qt5_state *con = container_of(dcl, struct qt5_state, dcl);
+
+    assert(con->surface);
+
+    composite_brightness_image(con->surface->image);
+
+    qt5_update_internal(surface_data(con->surface),
+                        surface_width(con->surface),
+                        surface_height(con->surface));
+}
+
+static void qt5_switch(DisplayChangeListener *dcl,
+                       DisplaySurface *new_surface)
+{
+    struct qt5_state *con = container_of(dcl, struct qt5_state, dcl);
+
+    if (con->surface &&
+            (surface_width(con->surface) != surface_width(new_surface) ||
+             surface_height(con->surface) != surface_height(new_surface))) {
+        // TODO: we should adjust display size.
+        // We should warn to user since we can not adjust display size now.
+        LOG_WARNING("display size is changed.\n");
+    }
+
+    con->surface = new_surface;
+
+}
+
+static void qt5_refresh(DisplayChangeListener *dcl)
+{
+    graphic_hw_update(dcl->con);
+    qt5_refresh_internal();
+}
+
+static void qt5_mouse_warp(DisplayChangeListener *dcl,
+                           int x, int y, int on)
+{
+}
+
+static void qt5_mouse_define(DisplayChangeListener *dcl,
+                             QEMUCursor *c)
+{
+}
+
+static const DisplayChangeListenerOps dcl_ops = {
+    .dpy_name          = "qt5",
+    .dpy_gfx_update    = qt5_update,
+    .dpy_gfx_switch    = qt5_switch,
+    .dpy_refresh       = qt5_refresh,
+    .dpy_mouse_set     = qt5_mouse_warp,
+    .dpy_cursor_define = qt5_mouse_define,
+};
+
+void maru_early_qt5_display_init(bool isOnscreen)
+{
+#ifdef CONFIG_DARWIN
+    ns_run_in_event_loop_with_bool(&qt5_early_prepare, isOnscreen);
+
+    /* set emulator icon */
+#define ICON_RESOURCE_PATH "../icons/"
+#define ICON_FILE_NAME "emulator_icon.ico"
+    const int path_len = strlen(get_bin_path()) +
+        strlen(ICON_RESOURCE_PATH) + strlen(ICON_FILE_NAME) + 1;
+
+    char *icon_path = g_malloc0(sizeof(char) * path_len);
+    snprintf(icon_path, path_len, "%s%s%s",
+        get_bin_path(), ICON_RESOURCE_PATH, ICON_FILE_NAME);
+    fprintf(stdout, "application icon path : %s\n", icon_path);
+
+    set_application_icon(icon_path);
+    g_free(icon_path);
+#else
+    qt5_early_prepare(isOnscreen);
+#endif
+    if (isOnscreen) {
+        LOG_INFO("Display Type: QT5 Onscreen\n");
+    } else {
+        LOG_INFO("Display Type: QT5 Offscreen\n");
+    }
+}
+
+static void maru_qt5_display_fini(void)
+{
+    if (qt5_console) {
+        g_free(qt5_console);
+        qt5_console = NULL;
+    }
+    qt5_destroy();
+}
+
+void set_display_pixel_density(int dpi)
+{
+    pixel_density_dpi = dpi;
+}
+
+void maru_qt5_display_init(DisplayState *ds, int full_screen)
+{
+    int i;
+
+    /* prepare gui */
+#ifdef CONFIG_DARWIN
+    ns_run_in_event_loop(&qt5_prepare);
+#else
+    qt5_prepare();
+#endif
+
+    for (i = 0;; i++) {
+        QemuConsole *con = qemu_console_lookup_by_index(i);
+        if (!con || !qemu_console_is_graphic(con)) {
+            break;
+        }
+    }
+    qt5_num_outputs = i;
+    qt5_console = g_new0(struct qt5_state, qt5_num_outputs);
+    for (i = 0; i < qt5_num_outputs; i++) {
+        QemuConsole *con = qemu_console_lookup_by_index(i);
+        qt5_console[i].dcl.ops = &dcl_ops;
+        qt5_console[i].dcl.con = con;
+        register_displaychangelistener(&qt5_console[i].dcl);
+        qt5_console[i].idx = i;
+    }
+
+    if (full_screen) {
+        /* TODO */
+    }
+    atexit(maru_qt5_display_fini);
+
+    /* TODO
+    mouse_mode_notifier.notify = qt2_mouse_mode_change;
+    qemu_add_mouse_mode_change_notifier(&mouse_mode_notifier);
+    */
+
+    /* TODO: cursor control */
+}
diff --git a/tizen/src/ui/qt5.h b/tizen/src/ui/qt5.h
new file mode 100644 (file)
index 0000000..b1aac1c
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * QT5 display driver
+ *
+ * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * GiWoong Kim <giwoong.kim@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@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
+ *
+ */
+
+#ifndef __QT5_H__
+#define __QT5_H__
+
+#include <stdbool.h>
+
+#include "sysemu/sysemu.h"
+
+void maru_early_qt5_display_init(bool isOnscreen);
+void maru_qt5_display_init(DisplayState *ds, int full_screen);
+
+void set_display_pixel_density(int dpi);
+
+#endif // __QT5_H__
diff --git a/tizen/src/ui/qt5_supplement.cpp b/tizen/src/ui/qt5_supplement.cpp
new file mode 100644 (file)
index 0000000..3cd2450
--- /dev/null
@@ -0,0 +1,533 @@
+/*
+ * Qt UI
+ *
+ * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * GiWoong Kim <giwoong.kim@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * Sangho Park <sangho1206.park@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
+ *
+ */
+
+#include <QApplication>
+
+#include "qt5_supplement.h"
+#include "propertykeyword.h"
+#include "mainwindow.h"
+#include "layout/hardwarekey.h"
+#include "xmllayoutparser.h"
+#include "uiutil.h"
+#include "resource/ui_strings.h"
+#include "displaybase.h"
+
+extern "C" {
+#include "emul_state.h"
+int qemu_get_thread_id(void);
+bool is_display_off(void);
+}
+
+//using namespace std;
+void qMessageOutput(QtMsgType, const QMessageLogContext &, const QString &);
+void loadMainFormFromXML(QFile *, UIInformation *);
+void loadConFormFromXML(QFile *, UIInformation *);
+
+bool qt5IsOnscreen;
+QApplication *qt5App = NULL;
+
+static int argc = 0;
+static char *argv[0];
+
+#define MAX_BLANK_FRAME_CNT 10
+static unsigned int blank_cnt;
+
+static void *captureRequestListener;
+static void (*captureRequestHandler)(void *);
+
+static MainWindow *mainwindow;
+static UIInformation *uiInfo;
+
+#define GUI_PROPERTIES_FILE_NAME "gui.property"
+#define SKIN_INFO_FILE_NAME "info.ini"
+#define FORM_FILE_NAME "layout.xml"
+#define CON_FORM_SUBPATH "controller"
+
+class ConFile {
+public:
+    QFile *formFile;
+    int priority;
+};
+
+#ifdef CONFIG_WIN32
+class EventFilter : public QAbstractNativeEventFilter
+{
+public:
+    virtual bool nativeEventFilter(const QByteArray &eventType, void *message, long *res) Q_DECL_OVERRIDE;
+};
+
+EventFilter *eventFilter = NULL;
+
+bool EventFilter::nativeEventFilter(const QByteArray &eventType, void *message, long *res)
+{
+    if (eventType == "windows_generic_MSG") {
+        MSG *msg = static_cast<MSG *>(message);
+        if (msg->message == WM_ERASEBKGND) {
+            qt5_graphic_hw_invalidate();
+        }
+    }
+
+    return false;
+}
+#endif
+
+void qt5_gui_init(void)
+{
+    QCoreApplication::setApplicationName("Tizen Emulator");
+
+    qDebug() << "* Qt version :" << QT_VERSION_STR;
+    qDebug() << "* working path :" << QDir::currentPath();
+    qDebug() << "* binary path :" << QCoreApplication::applicationDirPath();
+
+    uiInfo = new UIInformation();
+
+    /* parameter parsing */
+    // TODO:
+
+    uiInfo->vmName = QString(get_vm_name()).trimmed();
+    qDebug() << "VM name :" <<  uiInfo->vmName;
+
+    uiInfo->resolution.setWidth(get_display_resolution_width());
+    uiInfo->resolution.setHeight(get_display_resolution_height());
+    uiInfo->basePort = get_emul_vm_base_port();
+
+    uiInfo->vmDataPath = QDir(get_vm_data_path()).canonicalPath();
+    if (uiInfo->vmDataPath.endsWith(QDir::separator()) == false) {
+        uiInfo->vmDataPath += QDir::separator();
+    }
+    qDebug() << "VM path :" <<  uiInfo->vmDataPath;
+
+    uiInfo->skinPath = QDir(get_emul_skin_path()).canonicalPath();
+    if (uiInfo->skinPath.endsWith(QDir::separator()) == false) {
+        uiInfo->skinPath += QDir::separator();
+    }
+    qDebug() << "skin path :" <<  uiInfo->skinPath;
+
+    /* read skin information */
+    QSettings skinInfo(uiInfo->skinPath + SKIN_INFO_FILE_NAME,
+        QSettings::IniFormat);
+    QString skinName = skinInfo.value(SKIN_PROPERTY_NAME).toString();
+    if (skinName.isEmpty() == true) {
+        skinName = "Undefined";
+    }
+    uiInfo->skinName = skinName;
+
+    /* open most recently used data information file */
+    QFile::remove(uiInfo->vmDataPath + GUI_PROPERTIES_FILE_NAME + ".lock");
+    const QSettings mruInfo(
+        uiInfo->vmDataPath + GUI_PROPERTIES_FILE_NAME, QSettings::IniFormat);
+
+    /* XML layout */
+    QFile mainXMLFile(uiInfo->skinPath + FORM_FILE_NAME);
+    /* load main form */
+    loadMainFormFromXML(&mainXMLFile, uiInfo);
+
+    QDir skinDir(uiInfo->skinPath + CON_FORM_SUBPATH);
+    /* load controller forms */
+    QFileInfoList entries = skinDir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot);
+
+    if (entries.isEmpty() == false) {
+        /* sort by priority */
+        QList<ConFile *> conFileList;
+
+        for (int i = 0; i < entries.size(); i++) {
+            ConFile *conFile = new ConFile();
+
+            QString conPath = entries.at(i).filePath() + QDir::separator();
+            conFile->formFile = new QFile(conPath + FORM_FILE_NAME);
+            QSettings conInfo(conPath + SKIN_INFO_FILE_NAME, QSettings::IniFormat);
+            conFile->priority = conInfo.value("priority").toInt();
+
+            int j = 0;
+            for ( ; j < conFileList.size(); j++) {
+                if (conFileList.at(j)->priority > conFile->priority) {
+                    break;
+                }
+            }
+            conFileList.insert(j, conFile);
+        }
+
+        /* loading */
+        for (int i = 0; i < conFileList.size(); i++) {
+            loadConFormFromXML(conFileList.at(i)->formFile, uiInfo);
+            delete conFileList.at(i)->formFile;
+            delete conFileList.at(i);
+        }
+    }
+
+    /* default scale */
+    int scale = mruInfo.value(SKIN_PROPERTY_WINDOW_SCALE).toInt();
+    qDebug("previous scale value is %d", scale);
+
+    if (scale <= 0) {
+        scale = 100;
+
+        MenuItem *item = NULL;
+        for (int i = 0; i < uiInfo->menuList.count(); i++) {
+            item = uiInfo->menuList.at(i);
+            if (item->getType() == MenuItemType::scaleItem) {
+                ScaleMenuItem *scaleItem = (ScaleMenuItem *)item;
+                if (scaleItem->getDefaultScaleFactor() > 0) {
+                    scale = scaleItem->getDefaultScaleFactor();
+                }
+            }
+        }
+    }
+    uiInfo->uiState.mainFormScale = scale;
+    qDebug("default scale value is %d", uiInfo->uiState.mainFormScale);
+
+    /* GUI */
+    qDebug("start!");
+
+    mainwindow = new MainWindow(uiInfo);
+    mainwindow->setCaptureRequestHandler(captureRequestListener, captureRequestHandler);
+
+    /* position */
+    QRect hostBounds = UIUtil::getHostScreenBounds();
+    qDebug() << "host geometry :" << hostBounds;
+
+    int defaultValueX = hostBounds.x() - 1;
+    int defaultValueY = hostBounds.y() - 1;
+    int xx = mruInfo.value(SKIN_PROPERTY_WINDOW_X, defaultValueX).toInt();
+    int yy = mruInfo.value(SKIN_PROPERTY_WINDOW_Y, defaultValueY).toInt();
+
+    if (xx == defaultValueX || yy == defaultValueY) {
+        xx = yy = 80 + (uiInfo->basePort % 100); /* default position */
+    } else {
+        qDebug("previous position value : (%d, %d)", xx, yy);
+
+        xx = qMax(xx, hostBounds.x());
+        xx = qMin(xx, hostBounds.x() + hostBounds.width() - 100);
+        yy = qMax(yy, hostBounds.y());
+        yy = qMin(yy, hostBounds.y() + hostBounds.height() - 100);
+    }
+
+    mainwindow->move(xx, yy);
+    qDebug("current position value : (%d, %d)", xx, yy);
+
+    bool onTop = mruInfo.value(SKIN_PROPERTY_WINDOW_TOPMOST).toBool();
+    if (onTop == true) {
+        mainwindow->setTopMost(true);
+    }
+
+    /* controller */
+    const int defaultDockPos = Qt::AlignRight | Qt::AlignCenter;
+    mainwindow->getUIState()->conState.recentlyDockPos = defaultDockPos;
+
+    int conIndex = mruInfo.value(SKIN_PROPERTY_CONTROLLER_INDEX).toInt();
+    if (conIndex >= 0 && conIndex < uiInfo->conFormList.count()) {
+        int conDockPos = mruInfo.value(SKIN_PROPERTY_CONTROLLER_DOCK).toInt();
+        if (conDockPos <= 0) {
+            conDockPos = defaultDockPos;
+        }
+
+        mainwindow->openController(conIndex, conDockPos);
+    }
+
+    mainwindow->show();
+
+#ifdef CONFIG_WIN32
+    /* W/A: Sometimes, QGrahpicsItem's update() does not work with QGLWidget
+     * on Windows Aero theme. We need to indirectly repaint the items
+     * through these lines. */
+    const QSize viewSize = uiInfo->getUiSize();
+    mainwindow->getSkinView()->resize(viewSize / 2);
+    mainwindow->getSkinView()->resize(viewSize);
+#endif
+
+    mainwindow->startDisplaySwapper();
+}
+
+void qt5_destroy()
+{
+    qDebug("qt5 destroy");
+
+    /* write most recently used data information */
+    QString path(uiInfo->vmDataPath + GUI_PROPERTIES_FILE_NAME);
+    qDebug() <<  "save MRU data:" << path;
+
+    QSettings mruInfo(path, QSettings::IniFormat);
+    mruInfo.setValue(SKIN_PROPERTY_WINDOW_X, mainwindow->pos().x());
+    mruInfo.setValue(SKIN_PROPERTY_WINDOW_Y, mainwindow->pos().y());
+    mruInfo.setValue(SKIN_PROPERTY_WINDOW_SCALE, uiInfo->uiState.mainFormScale);
+    mruInfo.setValue(SKIN_PROPERTY_WINDOW_TOPMOST, uiInfo->uiState.isOnTop());
+    mruInfo.setValue(SKIN_PROPERTY_CONTROLLER_INDEX, uiInfo->uiState.conState.conFormIndex);
+
+    DockingController *con = uiInfo->uiState.conState.dockingCon;
+    if (con != NULL) {
+        mruInfo.setValue(SKIN_PROPERTY_CONTROLLER_DOCK, con->getDockPos());
+    } else {
+        mruInfo.setValue(SKIN_PROPERTY_CONTROLLER_DOCK, 0);
+    }
+
+    mruInfo.sync();
+
+    /* clean up */
+#ifdef CONFIG_WIN32
+    delete eventFilter;
+#endif
+    qt5App->flush();
+
+    mainwindow->closeController();
+    mainwindow->terminateDisplaySwapper();
+
+    qt5App->processEvents(QEventLoop::ExcludeUserInputEvents);
+    qt5App->quit();
+
+    //TODO: fix me
+    //delete mainwindow;
+
+    if (uiInfo) {
+        delete uiInfo;
+        uiInfo = NULL;
+    }
+}
+
+void qt5_early_prepare(bool isOnscreen)
+{
+    qt5IsOnscreen = isOnscreen;
+
+    Q_INIT_RESOURCE(resource);
+
+#ifdef CONFIG_LINUX
+    /* QGLWidget threading: Note that under X11 it is necessary to set the
+     * Qt::AA_X11InitThreads application attribute to make the X11 library
+     * and GLX calls thread safe, otherwise the above scenarios will fail. */
+
+    /* Calls XInitThreads() as part of the QApplication construction in order
+     * to make Xlib calls thread-safe. This attribute must be set before
+     * QApplication is constructed. */
+    QCoreApplication::setAttribute(Qt::AA_X11InitThreads);
+#endif
+
+    qt5App = new QApplication(argc, argv);
+
+    /* add the path in the application's main() function, right after the
+     * QApplication object is created */
+    qt5App->addLibraryPath(QDir::currentPath()); //TODO: consider a symbolic link
+
+    qInstallMessageHandler(qMessageOutput);
+
+    qDebug() << "* Qt plugin library path:" << QCoreApplication::libraryPaths();
+
+#ifdef CONFIG_WIN32
+    eventFilter = new EventFilter();
+    qt5App->installNativeEventFilter(eventFilter);
+#endif
+}
+
+void qt5_prepare(void)
+{
+    qt5_gui_init();
+}
+
+void qt5_update_internal(void *data, int width, int height)
+{
+    QImage image((uchar *)data, width, height, QImage::Format_RGB32);
+
+    mainwindow->getScreenWidget()->setPixmap(
+        QPixmap::fromImage(image.transformed(
+            mainwindow->getDisplayMatrix(), Qt::SmoothTransformation)));
+}
+
+void qt5_switch_internal(void)
+{
+    /* do nothing */
+}
+
+void qt5_refresh_internal(void)
+{
+    qt5App->processEvents();
+
+    DisplayBase *db = mainwindow->getDisplay();
+    if (db) {
+        if (db->getIsGimgReady()) {
+            if (is_display_off()) {
+                if (db->getGimgState() == false) {
+                    if (blank_cnt > MAX_BLANK_FRAME_CNT) {
+                        db->startGuideImg();
+                        blank_cnt = 0;
+                    } else {
+                        blank_cnt++;
+                    }
+                }
+            } else {
+                if (db->getGimgState() == true) {
+                    db->stopGuideImg();
+                }
+
+                blank_cnt = 0;
+            }
+        }
+    } else {
+        qDebug() << "Display is not ready.";
+    }
+}
+
+void qt5_register_capture_request_listener(void *listener, void (*handler)(void *))
+{
+    if (mainwindow) {
+        mainwindow->setCaptureRequestHandler(listener, handler);
+    }
+
+    captureRequestListener = listener;
+    captureRequestHandler = handler;
+}
+
+void qt5_unregister_capture_request_listener(void *listener)
+{
+    if (mainwindow) {
+        mainwindow->unsetCaptureRequestHandler(listener);
+    }
+
+    captureRequestListener = NULL;
+    captureRequestHandler = NULL;
+}
+
+void qt5_process_captured(bool captured, void *pixels, int width, int height)
+{
+    if (mainwindow) {
+        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;
+    char *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().data();
+
+    switch (type) {
+    case QtDebugMsg:
+        fprintf(stdout, "%s|%5d|I|%10.10s|%4u|%s\n", dateMsg.constData(),
+                qemu_get_thread_id(), fname, 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, 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, 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, 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();
+    }
+}
+
+void loadMainFormFromXML(QFile *file, UIInformation *uiInfo/* out */)
+{
+    if (file->exists() == false) {
+        qFatal("%s %s", qPrintable(file->fileName()), MSG_NOT_FOUND);
+        return;
+    }
+
+    if (!file->open(QIODevice::ReadOnly | QIODevice::Text)) {
+        qFatal("%s %s %s", MSG_NOT_OPEN_1, qPrintable(file->fileName()), MSG_NOT_OPEN_2);
+        return;
+    }
+
+    qDebug("main form is loaded from %s", qPrintable(file->fileName()));
+
+    /* read xml */
+    QFileInfo fileInfo(*file);
+    QXmlStreamReader xml(file);
+
+    /* parse xml */
+    XmlLayoutParser parser(fileInfo.absolutePath(), uiInfo);
+    QString version = parser.parseEmulatorUI(xml);
+    qDebug() << "layout version :" << version;
+
+    const bool hasError = xml.hasError();
+    xml.clear();
+    file->close();
+
+    if (hasError == true) {
+        qFatal(MSG_INVALID_XML_FORMAT);
+        return;
+    }
+}
+
+void loadConFormFromXML(QFile *file, UIInformation *uiInfo/* out */)
+{
+    if (file->exists() == false) {
+        qWarning("%s is not found", qPrintable(file->fileName()));
+        return;
+    }
+
+    if (!file->open(QIODevice::ReadOnly | QIODevice::Text)) {
+        qFatal("%s %s %s", MSG_NOT_OPEN_1, qPrintable(file->fileName()), MSG_NOT_OPEN_2);
+        return;
+    }
+
+    qDebug("controller form is loaded from %s", qPrintable(file->fileName()));
+
+    /* read xml */
+    QFileInfo fileInfo(*file);
+    QXmlStreamReader xml(file);
+
+    /* parse xml */
+    XmlLayoutParser parser(fileInfo.absolutePath(), uiInfo);
+    QString version = parser.parseControllerUI(xml);
+    qDebug() << "layout version :" << version;
+
+    const bool hasError = xml.hasError();
+    xml.clear();
+    file->close();
+
+    if (hasError == true) {
+        qFatal(MSG_INVALID_XML_FORMAT);
+        return;
+    }
+}
diff --git a/tizen/src/ui/qt5_supplement.h b/tizen/src/ui/qt5_supplement.h
new file mode 100644 (file)
index 0000000..89cbf7f
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Qt UI
+ *
+ * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * GiWoong Kim <giwoong.kim@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * Sangho Park <sangho1206.park@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
+ *
+ */
+
+#ifndef __QT5_INTERNAL_H__
+#define __QT5_INTERNAL_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+void qt5_graphic_hw_invalidate(void);
+void qt5_graphic_hw_update(void);
+int qt5_graphic_hw_display(void);
+void qt5_early_prepare(bool isOnscreen);
+void qt5_prepare(void);
+void qt5_destroy(void);
+
+void qt5_update_internal(void *data, int width, int height);
+void qt5_switch_internal(void);
+void qt5_refresh_internal(void);
+#ifdef __cplusplus
+}
+#endif
+
+#endif // __QT5_INTERNAL_H__
index 4265b8836e6b7a24c3b1621a835c78f0516393be..4525b3ae2c43f8eaa7ee7217f9496df740d0cef9 100644 (file)
 #include "rotaryview.h"
 #include "mainwindow.h"
 
+extern "C" {
+#include "util/ui_operations.h"
+}
+
 #define ROTARY_DRAWING_INTERVAL 100
 
 RotaryView::RotaryView(QWidget *parent) :
index 7fa9c632284be2ee4a9de94ef6c2d921f666204a..8eef8fc7c10389e03c22464dfdd994e1e9a5211b 100644 (file)
 
 #include "skinbezelitem.h"
 
+extern "C" {
+#include "util/ui_operations.h"
+#include "emul_state.h"
+}
+
 SkinBezelItem::SkinBezelItem(QImage bezelImg, QGraphicsItem *parent) :
     QGraphicsPixmapItem(QPixmap::fromImage(bezelImg), parent)
 {
index ddaf15cea1a85b6f23b191c4ec9674d0c335d6e6..3e7c6f8651b07d766802cfb740fa43e54b23816f 100644 (file)
 
 #include "skinkeyitem.h"
 
+extern "C" {
+#include "emul_state.h"
+#include "util/ui_operations.h"
+}
+
 SkinKeyItem::SkinKeyItem(SkinBezelItem *parent,
     HardwareKey *hwKey, QImage pressedImg, HoverType *hover) :
     QGraphicsRectItem(hwKey->getRegion(), (QGraphicsItem *)parent)
index 85e1e0b71e3f87c325219b26352a670e3722567b..c5fec9500274c3ce6f3ff67714b2247c2ad6821e 100644 (file)
 #include "layout/hardwarekey.h"
 #include "layout/hovertype.h"
 
-extern "C" {
-#include "skin/maruskin_operation.h"
-#include "emul_state.h"
-}
-
 class SkinKeyItem : public QObject, public QGraphicsRectItem
 {
     Q_OBJECT
diff --git a/tizen/src/ui/xmllayoutkeyword.h b/tizen/src/ui/xmllayoutkeyword.h
new file mode 100644 (file)
index 0000000..dd84f76
--- /dev/null
@@ -0,0 +1,84 @@
+/*
+ * Qt UI
+ *
+ * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * GiWoong Kim <giwoong.kim@samsung.com>
+ * Sangho Park <sangho1206.park@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
+ *
+ */
+
+#ifndef XMLLAYOUTKEYWORD_H
+#define XMLLAYOUTKEYWORD_H
+
+#define NAME_ATTR_KEYWORD "name"
+#define PROP_ATTR_KEYWORD "property"
+#define DEFAULT_ATTR_KEYWORD "default"
+#define COLOR_RED_ATTR_KEYWORD "R"
+#define COLOR_GREEN_ATTR_KEYWORD "G"
+#define COLOR_BLUE_ATTR_KEYWORD "B"
+#define REGION_LEFT_ATTR_KEYWORD "left"
+#define REGION_TOP_ATTR_KEYWORD "top"
+#define REGION_WIDTH_ATTR_KEYWORD "width"
+#define REGION_HEIGHT_ATTR_KEYWORD "height"
+#define KEYCODE_LONGPRESS_ATTR_KEYWORD "longPress"
+
+#define EMULATOR_UI_KEYWORD "EmulatorUI"
+#define CONTROLLER_UI_KEYWORD "ControllerUI"
+#define LAYOUTVER_KEYWORD "layoutVersion"
+#define COLOR_KEYWORD "color"
+#define REGION_KEYWORD "region"
+#define ANGLE_KEYWORD "angle"
+#define DISPLAY_KEYWORD "display"
+#define NORMAL_IMG_KEYWORD "normalImage"
+#define PRESSED_IMG_KEYWORD "pressedImage"
+#define MASK_IMG_KEYWORD "maskImage"
+#define ROTARY_IMG_KEYWORD "rotaryImage"
+#define KEYLIST_KEYWORD "keyList"
+#define KEY_KEYWORD "key"
+#define KEYCODE_KEYWORD "keycode"
+#define TOOLTIP_KEYWORD "tooltip"
+#define SHORTCUT_KEYWORD "shortcut"
+#define HOVER_KEYWORD "hover"
+#define FACTORLIST_KEYWORD "factorList"
+#define FACTOR_KEYWORD "factor"
+#define FORM_KEYWORD "form"
+#define FORMLIST_KEYWORD "formList"
+#define SHORTCUT_KEYWORD "shortcut"
+#define MENULIST_KEYWORD "menuList"
+
+#define SEPARATOR_MENU_KEYWORD "separator"
+#define ADVANCED_MENU_KEYWORD "advancedItem"
+#define INFO_MENU_KEYWORD "infoItem"
+#define ONTOP_MENU_KEYWORD "onTopItem"
+#define SWITCH_MENU_KEYWORD "switchItem"
+#define SCALE_MENU_KEYWORD "scaleItem"
+#define CONTROLLER_MENU_KEYWORD "controllerItem"
+#define HOSTKBD_MENU_KEYWORD "hostKeyboardItem"
+#define SHELL_MENU_KEYWORD "shellItem"
+#define ECP_MENU_KEYWORD "controlPanelItem"
+#define SCREENSHOT_MENU_KEYWORD "screenShotItem"
+#define ABOUT_MENU_KEYWORD "aboutItem"
+#define FORCECLOSE_MENU_KEYWORD "forceCloseItem"
+#define CLOSE_MENU_KEYWORD "closeItem"
+
+#endif // XMLLAYOUTKEYWORD_H
diff --git a/tizen/src/ui/xmllayoutparser.cpp b/tizen/src/ui/xmllayoutparser.cpp
new file mode 100644 (file)
index 0000000..82ed1df
--- /dev/null
@@ -0,0 +1,688 @@
+/*
+ * Qt UI
+ *
+ * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * GiWoong Kim <giwoong.kim@samsung.com>
+ * Sangho Park <sangho1206.park@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
+ *
+ */
+
+#include "xmllayoutparser.h"
+#include "xmllayoutkeyword.h"
+#include "skinpainter.h"
+#include "layout/keycodetype.h"
+#include "controller/generalpurposecon.h"
+
+/* Qt Qlayout has a minimum size */
+#define QT_LAYOUT_MINIMUM (73)
+
+XmlLayoutParser::XmlLayoutParser(QString path, UIInformation *uiInfo)
+{
+    this->xmlPath = path;
+    this->uiInfo = uiInfo;
+}
+
+QColor XmlLayoutParser::parseColor(QXmlStreamReader &xml)
+{
+    int red = 0, green = 0, blue = 0;
+
+    if (xml.name() == COLOR_KEYWORD &&
+        xml.tokenType() == QXmlStreamReader::StartElement) {
+        QXmlStreamAttributes attributes = xml.attributes();
+
+        if (attributes.hasAttribute(COLOR_RED_ATTR_KEYWORD)) {
+            red = attributes.value(COLOR_RED_ATTR_KEYWORD).toString().toInt();
+            qDebug() << red;
+        }
+        if (attributes.hasAttribute(COLOR_GREEN_ATTR_KEYWORD)) {
+            green = attributes.value(COLOR_GREEN_ATTR_KEYWORD).toString().toInt();
+            qDebug() << green;
+        }
+        if (attributes.hasAttribute(COLOR_BLUE_ATTR_KEYWORD)) {
+            blue = attributes.value(COLOR_BLUE_ATTR_KEYWORD).toString().toUInt();
+            qDebug() << blue;
+        }
+    }
+
+    return QColor(red, green, blue, 255);
+}
+
+HoverType *XmlLayoutParser::parseHover(QXmlStreamReader &xml)
+{
+    QColor color;
+
+    QXmlStreamReader::TokenType token = xml.readNext();
+
+    while (xml.atEnd() == false && (xml.name() == HOVER_KEYWORD &&
+        token == QXmlStreamReader::EndElement) == false) /* ~ </hover> */
+    {
+        if (token == QXmlStreamReader::StartElement) {
+            if (xml.name() == COLOR_KEYWORD) {
+                /* color */
+                color = parseColor(xml);
+                qDebug() << "hover color :" << color;
+            }
+        }
+
+        token = xml.readNext();
+    }
+
+    return new HoverType(color);
+}
+
+QRect XmlLayoutParser::parseRegion(QXmlStreamReader &xml)
+{
+    int left = 0, top = 0;
+    unsigned int width = 0, height = 0;
+
+    if (xml.name() == REGION_KEYWORD &&
+        xml.tokenType() == QXmlStreamReader::StartElement) {
+        QXmlStreamAttributes attributes = xml.attributes();
+
+        if (attributes.hasAttribute(REGION_LEFT_ATTR_KEYWORD)) {
+            left = attributes.value(REGION_LEFT_ATTR_KEYWORD).toString().toInt();
+        }
+        if (attributes.hasAttribute(REGION_TOP_ATTR_KEYWORD)) {
+            top = attributes.value(REGION_TOP_ATTR_KEYWORD).toString().toInt();
+        }
+        if (attributes.hasAttribute(REGION_WIDTH_ATTR_KEYWORD)) {
+            width = attributes.value(REGION_WIDTH_ATTR_KEYWORD).toString().toUInt();
+        }
+        if (attributes.hasAttribute(REGION_HEIGHT_ATTR_KEYWORD)) {
+            height = attributes.value(REGION_HEIGHT_ATTR_KEYWORD).toString().toUInt();
+        }
+    }
+
+    return QRect(left, top, width, height);
+}
+
+DisplayType *XmlLayoutParser::parseDisplay(QXmlStreamReader &xml)
+{
+    QRect displayRect;
+    int angle = 0;
+    QPixmap maskImage;
+
+    qDebug() << "**" << DISPLAY_KEYWORD << "{";
+
+    QXmlStreamReader::TokenType token = xml.readNext();
+
+    while (xml.atEnd() == false && (xml.name() == DISPLAY_KEYWORD &&
+        token == QXmlStreamReader::EndElement) == false) /* ~ </display> */
+    {
+        if (token == QXmlStreamReader::StartElement) {
+            if (xml.name() == REGION_KEYWORD) {
+                /* region */
+                displayRect = parseRegion(xml);
+                qDebug("- rect : (%d,%d %dx%d)",
+                    displayRect.x(), displayRect.y(),
+                    displayRect.width(), displayRect.height());
+            } else if (xml.name() == ANGLE_KEYWORD) {
+                /* angle */
+                angle = xml.readElementText().toInt();
+            } else if (xml.name() == MASK_IMG_KEYWORD) {
+                /* display mask */
+                QString maskImageFileName = xml.readElementText();
+                qDebug() << "-" << MASK_IMG_KEYWORD << ":" << maskImageFileName;
+
+                if (maskImage.load(
+                    xmlPath + QDir::separator() + maskImageFileName) == false) {
+                    qWarning() << "failed to load mask image";
+                }
+            }
+        }
+
+        token = xml.readNext();
+    }
+
+    qDebug("** }");
+
+    return new DisplayType(displayRect, angle, maskImage);
+}
+
+KeycodeType *XmlLayoutParser::parseKeycode(QXmlStreamReader &xml)
+{
+    int longPress = -1, shortPress = 0;
+
+    /* attribute */
+    longPress = xml.attributes().value(KEYCODE_LONGPRESS_ATTR_KEYWORD).toString().toInt();
+
+    shortPress = xml.readElementText().toInt();
+
+    return new KeycodeType(shortPress, longPress);
+}
+
+HardwareKey *XmlLayoutParser::parseKey(QXmlStreamReader &xml)
+{
+    QRect keyRegion;
+    KeycodeType *keycodeType = NULL;
+    QString keyTooptip;
+    QString keySequence;
+
+    /* attribute */
+    QString keyName = xml.attributes().value(NAME_ATTR_KEYWORD).toString();
+
+    QXmlStreamReader::TokenType token = xml.readNext();
+
+    while (xml.atEnd() == false && (xml.name() == KEY_KEYWORD &&
+        token == QXmlStreamReader::EndElement) == false) /* ~ </key> */
+    {
+        if (token == QXmlStreamReader::StartElement) {
+            if (xml.name() == REGION_KEYWORD) {
+                /* region */
+                keyRegion = parseRegion(xml);
+            } else if (xml.name() == KEYCODE_KEYWORD) {
+                /* keycode */
+                keycodeType = parseKeycode(xml);
+            } else if (xml.name() == TOOLTIP_KEYWORD) {
+                /* tooltip */
+                keyTooptip = xml.readElementText();
+            } else if (xml.name() == SHORTCUT_KEYWORD) {
+                /* shortcut */
+                keySequence = xml.readElementText();
+            }
+        }
+
+        token = xml.readNext();
+    }
+
+    return new HardwareKey(keyName, keycodeType, keyRegion, keyTooptip, keySequence);
+}
+
+int XmlLayoutParser::parseKeyList(
+    QXmlStreamReader &xml, QList<HardwareKey *> &list)
+{
+    HardwareKey *hwKey = NULL;
+    QXmlStreamReader::TokenType token = xml.readNext();
+
+    while (xml.atEnd() == false && (xml.name() == KEYLIST_KEYWORD &&
+        token == QXmlStreamReader::EndElement) == false) /* ~ </keyList> */
+    {
+        if (token == QXmlStreamReader::StartElement) {
+            if (xml.name() == KEY_KEYWORD) {
+                hwKey = parseKey(xml);
+                if (hwKey != NULL) {
+                    list.append(hwKey);
+                }
+            }
+        }
+
+        token = xml.readNext();
+    }
+
+    return list.count();
+}
+
+MainForm *XmlLayoutParser::parseMainForm(QXmlStreamReader &xml)
+{
+    /* attribute */
+    QString formName = xml.attributes().value(NAME_ATTR_KEYWORD).toString();
+    MainForm *form = new MainForm(formName);
+
+    qDebug() << '*' << form->getName() << '{';
+
+    QXmlStreamReader::TokenType token = xml.readNext();
+
+    while (xml.atEnd() == false && (xml.name() == FORM_KEYWORD &&
+        token == QXmlStreamReader::EndElement) == false) /* ~ </form> */
+    {
+        if (token == QXmlStreamReader::StartElement) {
+            if (xml.name() == DISPLAY_KEYWORD) {
+                /* display */
+                form->displayType = parseDisplay(xml);
+            } else if (xml.name() == NORMAL_IMG_KEYWORD) {
+                /* normal image */
+                QString normalImageFileName = xml.readElementText();
+                qDebug() << "-" << NORMAL_IMG_KEYWORD << ":" << normalImageFileName;
+
+                if (form->skinImg[MainForm::normal].load(
+                    xmlPath + QDir::separator() + normalImageFileName) == false) {
+                    qWarning() << "failed to load normal image";
+                }
+            } else if (xml.name() == PRESSED_IMG_KEYWORD) {
+                /* key pressed image */
+                QString pressedImageFileName = xml.readElementText();
+                qDebug() << "-" << PRESSED_IMG_KEYWORD << ":" << pressedImageFileName;
+
+                if (form->skinImg[MainForm::pressed].load(
+                    xmlPath + QDir::separator() + pressedImageFileName) == false) {
+                    qWarning() << "failed to load pressed image";
+                }
+            }  else if (xml.name() == ROTARY_IMG_KEYWORD) {
+                /* rotary image */
+                QString rotaryImageFileName = xml.readElementText();
+                qDebug() << "-" << ROTARY_IMG_KEYWORD << ":" << rotaryImageFileName;
+
+                form->setRotaryImage(new QPixmap(
+                    xmlPath + QDir::separator() + rotaryImageFileName));
+                if (form->getRotaryImage()->isNull() == true) {
+                    qWarning() << "failed to load rotary image";
+                }
+            } else if (xml.name() == KEYLIST_KEYWORD) {
+                /* HW keys */
+                int cnt = parseKeyList(xml, form->keyList);
+                qDebug() << "-" << KEYLIST_KEYWORD << ":" << cnt;
+            } else {
+                qWarning() << "undefined element :" << xml.name();
+            }
+        }
+
+        token = xml.readNext();
+    }
+
+    qDebug("}");
+
+    return form;
+}
+
+int XmlLayoutParser::parseMainFormList(
+    QXmlStreamReader &xml, QList<MainForm *> &list)
+{
+    MainForm *form = NULL;
+    QXmlStreamReader::TokenType token = xml.readNext();
+
+    while (xml.atEnd() == false && (xml.name() == FORMLIST_KEYWORD &&
+        token == QXmlStreamReader::EndElement) == false) /* ~ </formList> */
+    {
+        if (token == QXmlStreamReader::StartElement) {
+            if (xml.name() == FORM_KEYWORD) {
+                form = parseMainForm(xml);
+                if (form != NULL) {
+                    /* image validation */
+                    if (form->skinImg[MainForm::normal].size() == QSize(0, 0)) {
+                        qDebug("- general purpose skin form");
+
+                        SkinPainter painter("main-skin",
+                            uiInfo->resolution, form->displayType->getAngle(),
+                            QPoint(30, 16), uiInfo->getVMColor());
+                        form->setGeneralPurpose(true);
+
+                        form->skinImg[MainForm::normal] = painter.getSkinImage();
+                        form->displayType->setRect(painter.getCenterRect());
+                    }
+
+                    list.append(form);
+                }
+            }
+        }
+
+        token = xml.readNext();
+    }
+
+    return list.count();
+}
+
+/* menu */
+int XmlLayoutParser::parseFactorList(
+    QXmlStreamReader &xml, QMap<int, QString> &map, int *defaultFactor)
+{
+    QString defaultValue = xml.attributes().value(DEFAULT_ATTR_KEYWORD).toString();
+    *defaultFactor = defaultValue.toInt();
+
+    QXmlStreamReader::TokenType token = xml.readNext();
+
+    while (xml.atEnd() == false && (xml.name() == "factorList" &&
+        token == QXmlStreamReader::EndElement) == false) /* ~ </factorList> */
+    {
+        if (token == QXmlStreamReader::StartElement) {
+            if (xml.name() == FACTOR_KEYWORD) {
+                QString value = xml.attributes().value(NAME_ATTR_KEYWORD).toString();
+                map.insert(xml.readElementText().toInt(), value);
+            }
+        }
+
+        token = xml.readNext();
+    }
+
+    return map.count();
+}
+
+int XmlLayoutParser::parseShortcut(
+    QXmlStreamReader &xml, QMap<QString, QString> &map)
+{
+    QString key = xml.attributes().value(PROP_ATTR_KEYWORD).toString();
+    map.insert(key, xml.readElementText());
+
+    return map.count();
+}
+
+AdvancedMenuItem *XmlLayoutParser::parseAdvancedMenuItem(QXmlStreamReader &xml)
+{
+    /* attribute */
+    QString menuName = xml.attributes().value(NAME_ATTR_KEYWORD).toString();
+    AdvancedMenuItem *item = new AdvancedMenuItem(menuName);
+
+    QXmlStreamReader::TokenType token = xml.readNext();
+
+    while (xml.atEnd() == false && (xml.name() == "advancedItem" &&
+        token == QXmlStreamReader::EndElement) == false) /* ~ </advancedItem> */
+    {
+        if (token == QXmlStreamReader::StartElement) {
+            if (xml.name() == SHORTCUT_KEYWORD) {
+                parseShortcut(xml, item->getShortcutMap());
+            } else if (xml.name() == MENULIST_KEYWORD) {
+                int cnt = parseMenuList(xml, item->getMenuList());
+                qDebug("- advanced menuList : %d", cnt);
+            }
+        }
+
+        token = xml.readNext();
+    }
+
+    return item;
+}
+
+ScaleMenuItem *XmlLayoutParser::parseScaleMenuItem(QXmlStreamReader &xml)
+{
+    /* attribute */
+    QString menuName = xml.attributes().value(NAME_ATTR_KEYWORD).toString();
+    ScaleMenuItem *item = new ScaleMenuItem(menuName);
+
+    QXmlStreamReader::TokenType token = xml.readNext();
+
+    while (xml.atEnd() == false && (xml.name() == "scaleItem" &&
+        token == QXmlStreamReader::EndElement) == false) /* ~ </scaleItem> */
+    {
+        if (token == QXmlStreamReader::StartElement) {
+            if (xml.name() == SHORTCUT_KEYWORD) {
+                parseShortcut(xml, item->getShortcutMap());
+            } else if (xml.name() == FACTORLIST_KEYWORD) {
+                int defaultFactor = 0;
+                int cnt = parseFactorList(xml, item->getFactorMap(), &defaultFactor);
+                qDebug("- scale factorList : %d", cnt);
+
+                item->setDefaultScaleFactor(defaultFactor);
+            }
+        }
+
+        token = xml.readNext();
+    }
+
+    return item;
+}
+
+MenuItem *XmlLayoutParser::parseGeneralMenuItem(
+    QXmlStreamReader &xml, int menuType)
+{
+    QString itemKeyword = xml.name().toString();
+
+    /* attribute */
+    QString menuName = xml.attributes().value(NAME_ATTR_KEYWORD).toString();
+    MenuItem *item = new MenuItem(menuType, menuName);
+
+    QString shortcut;
+    QXmlStreamReader::TokenType token = xml.readNext();
+
+    while (xml.atEnd() == false && (xml.name().compare(itemKeyword) == 0 &&
+        token == QXmlStreamReader::EndElement) == false) /* ~ </xxItem> */
+    {
+        if (token == QXmlStreamReader::StartElement) {
+            if (xml.name() == SHORTCUT_KEYWORD) {
+                parseShortcut(xml, item->getShortcutMap());
+            }
+        }
+
+        token = xml.readNext();
+    }
+
+    return item;
+}
+
+int XmlLayoutParser::parseMenuList(
+    QXmlStreamReader &xml, QList<MenuItem *> &list)
+{
+    MenuItem *item = NULL;
+    QXmlStreamReader::TokenType token = xml.readNext();
+
+    while (xml.atEnd() == false && (xml.name() == MENULIST_KEYWORD &&
+        token == QXmlStreamReader::EndElement) == false) /* ~ </menuList> */
+    {
+        if (token == QXmlStreamReader::StartElement) {
+            if (xml.name() == SEPARATOR_MENU_KEYWORD) {
+                item = new MenuItem(MenuItemType::separator, NULL);
+                if (item != NULL) {
+                    list.append(item);
+                }
+            } else if (xml.name() == ADVANCED_MENU_KEYWORD) {
+                item = (MenuItem *)parseAdvancedMenuItem(xml);
+                if (item != NULL) {
+                    list.append(item);
+                }
+            } else if (xml.name() == INFO_MENU_KEYWORD) {
+                item = parseGeneralMenuItem(xml, MenuItemType::infoItem);
+                if (item != NULL) {
+                    list.append(item);
+                }
+            } else if (xml.name() == ONTOP_MENU_KEYWORD) {
+                item = parseGeneralMenuItem(xml, MenuItemType::onTopItem);
+                if (item != NULL) {
+                    list.append(item);
+                }
+            } else if (xml.name() == SWITCH_MENU_KEYWORD) {
+                item = parseGeneralMenuItem(xml, MenuItemType::switchItem);
+                if (item != NULL) {
+                    list.append(item);
+                }
+            } else if (xml.name() == SCALE_MENU_KEYWORD) {
+                item = (MenuItem *)parseScaleMenuItem(xml);
+                if (item != NULL) {
+                    list.append(item);
+                }
+            } else if (xml.name() == CONTROLLER_MENU_KEYWORD) {
+                item = parseGeneralMenuItem(xml, MenuItemType::controllerItem);
+                if (item != NULL) {
+                    list.append(item);
+                }
+            } else if (xml.name() == HOSTKBD_MENU_KEYWORD) {
+                item = parseGeneralMenuItem(xml, MenuItemType::hostKeyboardItem);
+                if (item != NULL) {
+                    list.append(item);
+                }
+            } else if (xml.name() == SHELL_MENU_KEYWORD) {
+                item = parseGeneralMenuItem(xml, MenuItemType::shellItem);
+                if (item != NULL) {
+                    list.append(item);
+                }
+            } else if (xml.name() == ECP_MENU_KEYWORD) {
+                item = parseGeneralMenuItem(xml, MenuItemType::controlPanelItem);
+                if (item != NULL) {
+                    list.append(item);
+                }
+            } else if (xml.name() == SCREENSHOT_MENU_KEYWORD) {
+                item = parseGeneralMenuItem(xml, MenuItemType::screenShotItem);
+                if (item != NULL) {
+                    list.append(item);
+                }
+            } else if (xml.name() == ABOUT_MENU_KEYWORD) {
+                item = parseGeneralMenuItem(xml, MenuItemType::aboutItem);
+                if (item != NULL) {
+                    list.append(item);
+                }
+            } else if (xml.name() == FORCECLOSE_MENU_KEYWORD) {
+                item = parseGeneralMenuItem(xml, MenuItemType::forceCloseItem);
+                if (item != NULL) {
+                    list.append(item);
+                }
+            } else if (xml.name() == CLOSE_MENU_KEYWORD) {
+                item = parseGeneralMenuItem(xml, MenuItemType::closeItem);
+                if (item != NULL) {
+                    list.append(item);
+                }
+            }
+        }
+
+        token = xml.readNext();
+    }
+
+    return list.count();
+}
+
+QString XmlLayoutParser::parseEmulatorUI(QXmlStreamReader &xml)
+{
+    QString layoutVersion = "undefined";
+
+    QXmlStreamReader::TokenType token;
+
+    while (xml.atEnd() == false && xml.hasError() == false) {
+        token = xml.readNext();
+        /* If token is just StartDocument, go to next.*/
+        if (token == QXmlStreamReader::StartDocument) {
+            continue;
+        }
+
+        if (token == QXmlStreamReader::StartElement) {
+            if (xml.name() == EMULATOR_UI_KEYWORD) {
+                continue;
+            }
+
+            if (xml.name() == LAYOUTVER_KEYWORD) {
+                layoutVersion = xml.readElementText();
+                continue;
+            } else if (xml.name() == FORMLIST_KEYWORD) {
+                int cnt = parseMainFormList(xml, uiInfo->mainFormList);
+                qDebug() << FORMLIST_KEYWORD << ":" << cnt;
+            } else if (xml.name() == MENULIST_KEYWORD) {
+                int cnt = parseMenuList(xml, uiInfo->menuList);
+                qDebug() << MENULIST_KEYWORD << ":" << cnt;
+            }
+        }
+    }
+
+    return layoutVersion;
+}
+
+/* controller */
+ControllerForm *XmlLayoutParser::parseControllerForm(QXmlStreamReader &xml)
+{
+    /* attribute */
+    QString formName = xml.attributes().value(NAME_ATTR_KEYWORD).toString();
+    ControllerForm *form = new ControllerForm(
+        formName.isEmpty() ? xmlPath.section(QDir::separator(), -1) : formName);
+
+    qDebug() << '*' << form->getName() << "{";
+
+    QXmlStreamReader::TokenType token = xml.readNext();
+
+    while (xml.atEnd() == false && (xml.name() == FORM_KEYWORD &&
+        token == QXmlStreamReader::EndElement) == false) /* ~ </form> */
+    {
+        if (token == QXmlStreamReader::StartElement) {
+            if (xml.name() == NORMAL_IMG_KEYWORD) {
+                /* normal image */
+                QString normalImageFileName = xml.readElementText();
+                qDebug() << "-" << NORMAL_IMG_KEYWORD << ":" <<  normalImageFileName;
+
+                if (form->conImg[ControllerForm::normal].load(
+                    xmlPath + QDir::separator() + normalImageFileName) == false) {
+                    qWarning() << "failed to load normal image";
+                }
+            } else if (xml.name() == PRESSED_IMG_KEYWORD) {
+                /* key pressed image */
+                QString pressedImageFileName = xml.readElementText();
+                qDebug() << "-" << PRESSED_IMG_KEYWORD << ":" << pressedImageFileName;
+
+                if (form->conImg[ControllerForm::pressed].load(
+                    xmlPath + QDir::separator() + pressedImageFileName) == false) {
+                    qWarning() << "failed to load pressed image";
+                }
+            } else if (xml.name() == KEYLIST_KEYWORD) {
+                /* HW keys */
+                int cnt = parseKeyList(xml, form->keyList);
+                qDebug() << "-" << KEYLIST_KEYWORD << ":" << cnt;
+            } else if (xml.name() == HOVER_KEYWORD) {
+                /* hover */
+                form->setHoverType(parseHover(xml));
+            } else {
+                qWarning() << "undefined element :" << xml.name();
+            }
+        }
+
+        token = xml.readNext();
+    }
+
+    qDebug("}");
+
+    return form;
+}
+
+QString XmlLayoutParser::parseControllerUI(QXmlStreamReader &xml)
+{
+    QString layoutVersion = "undefined";
+
+    ControllerForm *form = NULL;
+    QXmlStreamReader::TokenType token;
+
+    while (xml.atEnd() == false && xml.hasError() == false) {
+        token = xml.readNext();
+        /* If token is just StartDocument, go to next.*/
+        if (token == QXmlStreamReader::StartDocument) {
+            continue;
+        }
+
+        if (token == QXmlStreamReader::StartElement) {
+            if (xml.name() == CONTROLLER_UI_KEYWORD) {
+                continue;
+            }
+
+            if (xml.name() == LAYOUTVER_KEYWORD) {
+                layoutVersion = xml.readElementText();
+                continue;
+            } else if (xml.name() == FORM_KEYWORD) {
+                form = parseControllerForm(xml);
+                if (form != NULL) {
+                    /* image validation */
+                    if (form->conImg[ControllerForm::normal].size() == QSize(0, 0)) {
+                        qDebug("- general purpose con form");
+
+                        int keyCount = form->keyList.count();
+
+                        int width = GPC_KEYBUTTON_WIDTH;
+                        int height = GPC_HEAD_SPACING;
+                        if (keyCount < GPC_KEYBUTTON_DEFAULT_CNT) {
+                            height += (GPC_KEYBUTTON_HEIGHT * keyCount) +
+                                (GPC_KEYBUTTON_VSPACING * (keyCount - 1)) +
+                                GPC_TAIL_SPACING;
+                        } else {
+                            width += (GPC_SCROLLBAR_WIDTH + GPC_SCROLLBAR_HSPACING);
+                            height += (GPC_KEYBUTTON_HEIGHT * GPC_KEYBUTTON_DEFAULT_CNT) +
+                                (GPC_KEYBUTTON_VSPACING * (GPC_KEYBUTTON_DEFAULT_CNT - 1)) +
+                                GPC_TAIL_SPACING;
+                        }
+
+                        SkinPainter painter("controller-skin",
+                            QSize(width, qMax(height, QT_LAYOUT_MINIMUM - 20)),
+                            0, QPoint(14, GPC_HEAD_SPACING - 1),
+                            uiInfo->getVMColor());
+                        form->setGeneralPurpose(true);
+
+                        form->conImg[ControllerForm::normal] = painter.getSkinImage();
+                        form->centerRect = painter.getCenterRect();
+                    }
+
+                    uiInfo->conFormList.append(form);
+                }
+            }
+        }
+    }
+
+    return layoutVersion;
+}
diff --git a/tizen/src/ui/xmllayoutparser.h b/tizen/src/ui/xmllayoutparser.h
new file mode 100644 (file)
index 0000000..6e01a02
--- /dev/null
@@ -0,0 +1,76 @@
+/*
+ * Qt UI
+ *
+ * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * GiWoong Kim <giwoong.kim@samsung.com>
+ * Sangho Park <sangho1206.park@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
+ *
+ */
+
+#ifndef XMLLAYOUTPARSER_H
+#define XMLLAYOUTPARSER_H
+
+#include <QXmlStreamReader>
+
+#include "uiinformation.h"
+#include "layout/keycodetype.h"
+#include "layout/mainform.h"
+#include "layout/controllerform.h"
+#include "menu/menuitem.h"
+#include "menu/advancedmenuitem.h"
+#include "menu/scalemenuitem.h"
+
+
+class XmlLayoutParser
+{
+public:
+    XmlLayoutParser(QString path, UIInformation *uiInfo /* out */);
+
+    QString parseEmulatorUI(QXmlStreamReader &xml);
+    QString parseControllerUI(QXmlStreamReader &xml);
+
+private:
+    QColor parseColor(QXmlStreamReader &xml);
+    HoverType *parseHover(QXmlStreamReader &xml);
+    QRect parseRegion(QXmlStreamReader &xml);
+    DisplayType *parseDisplay(QXmlStreamReader &xml);
+    KeycodeType *parseKeycode(QXmlStreamReader &xml);
+    HardwareKey *parseKey(QXmlStreamReader &xml);
+    int parseKeyList(QXmlStreamReader &xml, QList<HardwareKey *> &list);
+    MainForm *parseMainForm(QXmlStreamReader &xml);
+    int parseMainFormList(QXmlStreamReader &xml, QList<MainForm *> &list);
+
+    int parseFactorList(QXmlStreamReader &xml, QMap<int, QString> &map, int *defaultFactor);
+    int parseShortcut(QXmlStreamReader &xml, QMap<QString, QString> &map);
+    AdvancedMenuItem *parseAdvancedMenuItem(QXmlStreamReader &xml);
+    ScaleMenuItem *parseScaleMenuItem(QXmlStreamReader &xml);
+    MenuItem *parseGeneralMenuItem(QXmlStreamReader &xml, int menuType);
+    int parseMenuList(QXmlStreamReader &xml, QList<MenuItem *> &list);
+
+    ControllerForm *parseControllerForm(QXmlStreamReader &xml);
+
+    QString xmlPath;
+    UIInformation *uiInfo;
+};
+
+#endif // XMLLAYOUTPARSER_H
index 43009e8e659c35a391b03d6ac501711b2240b5f2..ac77989bd3c12188e3cdd33ade228bfa977cd268 100644 (file)
@@ -6,6 +6,9 @@ ifdef CONFIG_DARWIN
 QEMU_CFLAGS += -I$(SRC_PATH)/hw/vigs/vigs_inc
 endif
 
+# ui operations
+obj-y += ui_operations.o
+
 # osutil
 LIBS += $(CURL_LIBS)
 obj-y += osutil.o
index 87f36f7c2b37f768c86010af43c4b5d137682f13..654230726f46aae01d16e6d547d039323c7471a6 100644 (file)
 
 MULTI_DEBUG_CHANNEL(qemu, backtrace);
 
-// deprecated
-/* This table must match the enum definition */
-static char _maru_string_table[][JAVA_MAX_COMMAND_LENGTH] = {
-    /* 0 */ "",
-    /* 1 */ FAILED_TO_ALLOCATE_MEMORY,
-    /* 2 */ FAILED_TO_LOAD_KERNEL CHECK_FILE_VALID,
-    /* 3 */ FAILED_TO_LOAD_BIOS CHECK_FILE_VALID,
-    /* 4 */ FAILED_TO_INITIALIZE_SKIN,
-    /* 5 */ EMULATOR_HAS_STOPPED,
-    /* add here.. */
-    ""
-};
-
-static int maru_exit_status = MARU_EXIT_NORMAL;
-static char *maru_exit_msg;
-
-#ifdef CONFIG_WIN32
-static LPTOP_LEVEL_EXCEPTION_FILTER prevExceptionFilter;
+#ifdef CONFIG_JAVA_UI
+#include "skin/maruskin_client.h"
 #endif
 
-#ifdef CONFIG_LINUX
+#if defined(CONFIG_WIN32)
+static LPTOP_LEVEL_EXCEPTION_FILTER prevExceptionFilter;
+#elif defined(CONFIG_LINUX)
 static pthread_spinlock_t siglock;
-void maru_sighandler(int sig);
 #endif
 
-// deprecated
-char *get_canonical_path(char const *const path)
-{
-    if ((int)g_path_is_absolute(path)) {
-        return (char *)g_strdup(path);
-    }
-
-    char *canonical_path;
-
-#ifndef _WIN32
-    char *current_dir = g_get_current_dir();
-    canonical_path = g_strdup_printf("%s/%s", current_dir, path);
-    g_free(current_dir);
-#else
-    canonical_path = g_malloc(MAX_PATH);
-    GetFullPathName(path, MAX_PATH, canonical_path, NULL);
-#endif
-
-    return canonical_path;
-}
-
-// deprecated
-// Use error_report() instead
-void register_exit_message(int status, char const *format, ...)
-{
-    va_list args;
-
-    if (status >= MARU_EXIT_NORMAL) {
-        fprintf(stderr, "Invalid error message index = %d\n",
-            status);
-        return;
-    }
-    if (maru_exit_status != MARU_EXIT_NORMAL) {
-        fprintf(stderr, "The error message is already registered = %d\n",
-            maru_exit_status);
-        return;
-    }
-
-    maru_exit_status = status;
-
-    if (maru_exit_status == MARU_EXIT_HB_TIME_EXPIRED) {
-        fprintf(stderr, "Skin client could not connect to Skin server."
-                " The time of internal heartbeat has expired.\n");
-    }
-
-    if (!format) {
-        format = "";
-    }
-
-    va_start(args, format);
-    char *additional = g_strdup_vprintf(format, args);
-    va_end(args);
-    maru_exit_msg = g_strdup_printf("%s%s", _maru_string_table[maru_exit_status],
-                        additional);
-    g_free(additional);
-
-    if (strlen(maru_exit_msg) >= JAVA_MAX_COMMAND_LENGTH) {
-        maru_exit_msg[JAVA_MAX_COMMAND_LENGTH - 1] = '\0';
-    }
-
-    fprintf(stdout, "The error message is registered = %d : %s\n",
-        maru_exit_status, maru_exit_msg);
-}
-
 /* Print 'backtrace' */
 #ifdef _WIN32
 struct frame_layout {
@@ -254,13 +175,6 @@ static void dump_backtrace(void *ptr, int depth)
 
 static void handle_error_at_exit(void)
 {
-
-    // deprecated
-    if (maru_exit_status != MARU_EXIT_NORMAL || maru_exit_msg) {
-        start_simple_client(maru_exit_msg);
-    }
-    g_free(maru_exit_msg);
-
     // dump backtrace log no matter what
     INFO("Stack backtrace for tracing...\n");
     INFO("This is not an error.\n");
@@ -305,7 +219,7 @@ static WINAPI LONG maru_unhandled_exception_filter(LPEXCEPTION_POINTERS pExcepti
 #endif
 
 #ifdef CONFIG_LINUX
-void maru_sighandler(int sig)
+static void maru_sighandler(int sig)
 {
     ERR("Got signal %d\n", sig);
     // print system information again
@@ -365,7 +279,18 @@ static void report(const char *fmt, va_list ap)
     // We are wating for '\n'
     if (message[message_len - 1] == '\n') {
         fprintf(stderr, "%s", message);
-        start_simple_client(message);
+#ifdef CONFIG_QT
+        if (display_type == DT_MARU_QT_ONSCREEN ||
+            display_type == DT_MARU_QT_OFFSCREEN) {
+            // TODO: new pop-up dialog is needed
+        }
+#endif
+#ifdef CONFIG_JAVA_UI
+        if (display_type == DT_MARU_SDL ||
+            display_type == DT_MARU_SHM) {
+            start_simple_client(message);
+        }
+#endif
         message[0] = '\0';
         message_len = 0;
     }
index 7081672d1a97996bfdce123a2484fc7860f78a32..f45b05f320ccfae867e86e578f0b71c337c45021 100644 (file)
 #ifndef __ERROR_HANDLER_H__
 #define __ERROR_HANDLER_H__
 
-#include "tizen/src/skin/maruskin_client.h"
-
-// deprecated
-/* TODO: define macro for fair of definition */
-/* This enum must match the table definition */
-enum {
-    /* 0 */ MARU_EXIT_UNKNOWN = 0,
-    /* 1 */ MARU_EXIT_MEMORY_EXCEPTION,
-    /* 2 */ MARU_EXIT_KERNEL_FILE_EXCEPTION,
-    /* 3 */ MARU_EXIT_BIOS_FILE_EXCEPTION,
-    /* 4 */ MARU_EXIT_SKIN_SERVER_FAILED,
-    /* 5 */ MARU_EXIT_HB_TIME_EXPIRED,
-    /* add here.. */
-    MARU_EXIT_NORMAL
-};
-
 void init_error_handler(void);
-// deprecated
-void register_exit_message(int status, char const *format, ...);
-// deprecated
-char *get_canonical_path(char const *const path);
 
 #endif /* __ERROR_HANDLER_H__ */
index f9f5f7066bc652b44f5cf0c6a157e81868a2d516..017587cee3eeb32da94b7c5f041df254c0957091 100644 (file)
 
 #include "emulator.h"
 #include "emulator_common.h"
-#include "debug_ch.h"
 #include "emul_state.h"
 
 #include "hw/virtio/maru_virtio_hwkey.h"
-#include "skin/maruskin_server.h"
 #include "hw/maru_pm.h"
 #include "ecs/ecs.h"
+#include "debug_ch.h"
 
 MULTI_DEBUG_CHANNEL(qemu, sdb);
 
+#ifdef CONFIG_JAVA_UI
+#include "skin/maruskin_server.h"
+#endif
+
+static bool sdb_daemon_is_initialized = false;
+
 #ifdef _WIN32
 #include "qemu/main-loop.h"
 
@@ -449,7 +454,10 @@ static void command_handler(char* readbuf, struct sockaddr_in* client_addr)
     TRACE("----------------------------------------\n");
     TRACE("command:%s\n", command);
     if (strcmp(command, "2\n" ) == 0) {
+#ifdef CONFIG_JAVA_UI
         notify_sdb_daemon_start();
+#endif
+        sdb_daemon_is_initialized = true;
     } else if (strcmp(command, "5\n") == 0) {
         register_sdb_server(readbuf, client_addr);
         set_sdb_connection(true);
@@ -624,3 +632,7 @@ static void start_sdb_noti_server(int server_port)
     emulator_add_exit_notifier(&sdb_noti_server_exit);
 }
 
+bool is_sdb_daemon_initialized(void)
+{
+    return sdb_daemon_is_initialized;
+}
index cadb6ee657a80209738ebaab4a175a0a8039ddda..97ae0912f3f3b52228035bceea74862434c016f0 100644 (file)
@@ -58,6 +58,7 @@ int inet_strtoip(const char*  str, uint32_t  *ip);
 int socket_send(int fd, const void*  buf, int  buflen);
 void socket_close(int fd);
 int check_port_bind_listen(uint32_t port);
+bool is_sdb_daemon_initialized(void);
 
 #define STATE_RUNNING 0
 #define STATE_SUSPEND 1
diff --git a/tizen/src/util/ui_operations.c b/tizen/src/util/ui_operations.c
new file mode 100644 (file)
index 0000000..c255481
--- /dev/null
@@ -0,0 +1,199 @@
+/*
+ * UI operations
+ *
+ * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * GiWoong Kim <giwoong.kim@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@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
+ *
+ */
+
+#include "ui_operations.h"
+
+#include "sysemu/sysemu.h"
+#include "ui/input.h"
+
+#include "emul_state.h"
+#include "hw/maru_pm.h"
+#include "util/new_debug_ch.h"
+#include "hw/virtio/maru_virtio_hwkey.h"
+#include "hw/virtio/maru_virtio_touchscreen.h"
+#include "hw/virtio/maru_virtio_rotary.h"
+#include "hw/virtio/maru_virtio_keyboard.h"
+#include "hw/pci/maru_brightness.h"
+#include "util/device_hotplug.h"
+
+#if defined(CONFIG_JAVA_UI) && !defined(CONFIG_USE_SHM)
+#include "display/maru_finger.h"
+#include "display/maru_display.h"
+#endif
+
+DECLARE_DEBUG_CHANNEL(op_stub);
+
+#define RESUME_KEY_SEND_INTERVAL 500 /* milli-seconds */
+
+void do_hw_key_event(int event_type, int keycode)
+{
+    LOG_TRACE("HW Key : event_type=%d, keycode=%d\n", event_type, keycode);
+
+    // FIXME: remove workaround
+    if (runstate_check(RUN_STATE_SUSPENDED)) {
+        if (KEY_PRESSED == event_type) {
+            /* home key or power key is used for resume */
+            if ((HARD_KEY_HOME == keycode) || (HARD_KEY_POWER == keycode)) {
+                LOG_INFO("user requests system resume\n");
+                resume();
+
+#ifdef CONFIG_WIN32
+                Sleep(RESUME_KEY_SEND_INTERVAL);
+#else
+                usleep(RESUME_KEY_SEND_INTERVAL * 1000);
+#endif
+            }
+        }
+    }
+
+    maru_hwkey_event(event_type, keycode);
+}
+
+void do_mouse_event(int button_type, int event_type,
+    int origin_x, int origin_y, int x, int y, int z)
+{
+    static int guest_x, guest_y;
+//    static int pressing_x = -1, pressing_y = -1;
+//    static int pressing_origin_x = -1, pressing_origin_y = -1;
+
+    if (is_display_off()) {
+        if (button_type == 0) {
+            LOG_INFO("auto mouse release\n");
+            // TODO:
+            virtio_touchscreen_event(0, 0, 0, 0);
+
+            return;
+        } else {
+            LOG_TRACE("reject mouse touch in display off : "
+                    "button=%d, type=%d, x=%d, y=%d, z=%d\n",
+                    button_type, event_type, x, y, z);
+            return;
+        }
+    }
+
+    LOG_TRACE("mouse event : button=%d, type=%d, "
+        "host=(%d, %d), x=%d, y=%d, z=%d\n",
+        button_type, event_type, origin_x, origin_y, x, y, z);
+
+#if defined(CONFIG_JAVA_UI) && !defined(CONFIG_USE_SHM)
+    /* draw multi-touch points */
+    if (get_multi_touch_enable() != 0) {
+        if (event_type == MOUSE_DOWN || event_type == MOUSE_DRAG) {
+            update_finger_point(z, origin_x, origin_y, x, y);
+        } else if (event_type == MOUSE_UP) {
+            remove_finger_point(z);
+        }
+
+        maru_display_update();
+    }
+#endif
+
+    /* single touch */
+    switch(event_type) {
+        case MOUSE_DOWN:
+        case MOUSE_DRAG:
+//          pressing_x = x;
+//          pressing_y = y;
+            guest_x = x;
+            guest_y = y;
+//            pressing_origin_x = origin_x;
+//            pressing_origin_y = origin_y;
+
+            virtio_touchscreen_event(x, y, z, 1);
+
+            break;
+        case MOUSE_UP:
+            guest_x = x;
+            guest_y = y;
+//          pressing_x = pressing_y = -1;
+//          pressing_origin_x = pressing_origin_y = -1;
+
+            virtio_touchscreen_event(x, y, z, 0);
+
+            break;
+        case MOUSE_WHEELUP:
+        case MOUSE_WHEELDOWN:
+            if (is_emul_input_touch_enable() == true) {
+                x -= guest_x;
+                y -= guest_y;
+                guest_x += x;
+                guest_y += y;
+            } else {
+                guest_x = x;
+                guest_y = y;
+            }
+
+            virtio_touchscreen_event(x, y, -z, event_type);
+
+            break;
+        case MOUSE_MOVE:
+            guest_x = x;
+            guest_y = y;
+
+            if (x != 0) {
+                qemu_input_queue_rel(NULL, INPUT_AXIS_X, x);
+            }
+            if (y != 0) {
+                qemu_input_queue_rel(NULL, INPUT_AXIS_Y, y);
+            }
+            qemu_input_event_sync();
+
+            break;
+        case PS2_DOWN:
+            qemu_input_queue_btn(NULL, INPUT_BUTTON_LEFT, 1);
+            qemu_input_event_sync();
+
+            break;
+        case PS2_UP:
+            qemu_input_queue_btn(NULL, INPUT_BUTTON_LEFT, 0);
+            qemu_input_event_sync();
+
+            break;
+        default:
+            LOG_SEVERE("undefined mouse event type passed : %d\n", event_type);
+            break;
+    }
+}
+
+void do_rotary_event(int32_t delta, int32_t type)
+{
+    LOG_TRACE("rotaty event: delta(%d), type(%d)\n", delta, type);
+    maru_rotary_event(delta, type);
+}
+
+void do_qt_keyboard_key_event(int event_type, int keycode)
+{
+    if (KEY_PRESSED == event_type) {
+        LOG_TRACE("key pressed: %d\n", keycode);
+        virtio_keyboard_event(keycode);
+    } else if (KEY_RELEASED == event_type) {
+        LOG_TRACE("key released: %d\n", keycode);
+        virtio_keyboard_event(keycode | 0x80);
+    }
+}
diff --git a/tizen/src/util/ui_operations.h b/tizen/src/util/ui_operations.h
new file mode 100644 (file)
index 0000000..910f1fb
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ * UI operations
+ *
+ * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * GiWoong Kim <giwoong.kim@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@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
+ *
+ */
+
+
+#ifndef __UI_OPERATIONS_H__
+#define __UI_OPERATIONS_H__
+
+#include "tizen/src/emulator_common.h"
+
+#define TIMEOUT_FOR_SHUTDOWN 10 /* seconds */
+
+void do_hw_key_event(int event_type, int keycode);
+void do_mouse_event(int button_type, int event_type,
+    int origin_x, int origin_y, int x, int y, int z);
+void do_rotary_event(int32_t delta, int32_t type);
+void do_qt_keyboard_key_event(int event_type, int keycode);
+
+#endif // __UI_OPERATIONS_H___
diff --git a/vl.c b/vl.c
index 8036327aa243a1a0e553a123a2a0114657649aed..a1d9dcdf1794c35ba66e53c99201bcd8be8aa28a 100644 (file)
--- a/vl.c
+++ b/vl.c
@@ -133,8 +133,8 @@ int qemu_main(int argc, char **argv, char **envp);
 #ifdef CONFIG_MARU
 #include "tizen/src/emulator.h"
 #include "tizen/src/emul_state.h"
-#include "tizen/src/display/qt5.h"
-#include "tizen/src/skin/maruskin_operation.h"
+#include "tizen/src/ui/qt5.h"
+#include "tizen/src/util/ui_operations.h"
 #include "tizen/src/ecs/ecs.h"
 # ifdef CONFIG_JAVA_UI
 #include "tizen/src/display/maru_display.h"