It has limited capability for now.
Change-Id: I4f8c4e95ecbe0723594868fac985d4f1875fa957
Signed-off-by: SeokYeon Hwang <syeon.hwang@samsung.com>
fsdev/virtfs-proxy-helper
.cproject
.project
-tizen/src/util/check-hax
-tizen/src/util/check-cam
-
+check-hax
+check-cam
+moc_*.cpp
DT_NOGRAPHIC,
#ifdef CONFIG_MARU
DT_MARU,
+ DT_QT,
#endif
DT_NONE,
} DisplayType;
#ifndef CONSOLE_H
#define CONSOLE_H
+#ifndef __cplusplus
#include "ui/qemu-pixman.h"
+#endif
#include "qom/object.h"
#include "qapi/qmp/qdict.h"
#include "qemu/notify.h"
void early_gtk_display_init(void);
void gtk_display_init(DisplayState *ds, bool full_screen, bool grab_on_hover);
+/* qt5.c */
+void qt5_display_init(DisplayState *ds, int full_screen);
+
#endif
common-obj-$(CONFIG_VNC) += $(vnc-obj-y)
common-obj-$(CONFIG_GTK) += gtk.o x_keymap.o
+# by caramis
+common-obj-$(CONFIG_QT) += qt5.o
+common-obj-$(CONFIG_QT) += qt5_supplement.o moc_qt5_supplement.o
+
$(obj)/sdl.o $(obj)/sdl_zoom.o $(obj)/sdl2.o: QEMU_CFLAGS += $(SDL_CFLAGS)
$(obj)/gtk.o: QEMU_CFLAGS += $(GTK_CFLAGS) $(VTE_CFLAGS)
+
+$(obj)/qt5_supplement.o: QEMU_CFLAGS += $(QT_CFLAGS)
+$(obj)/moc_qt5_supplement.o: $(obj)/moc_qt5_supplement.cpp
+$(obj)/moc_qt5_supplement.cpp: $(obj)/qt5_supplement.h
+ moc $< -o $@
+$(obj)/moc_qt5_supplement.o: QEMU_CFLAGS += $(QT_CFLAGS)
--- /dev/null
+/*
+ * Qt UI
+ *
+ * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * 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/console.h"
+#include "qt5_supplement.h"
+
+//static Notifier mouse_mode_notifier;
+static int qt5_num_outputs;
+
+static struct qt5_state {
+ DisplayChangeListener dcl;
+ DisplaySurface *surface;
+
+ int idx;
+} *qt5_console;
+
+static void qt5_update(DisplayChangeListener *dcl,
+ int x, int y, int w, int h)
+{
+ DisplaySurface *surf = qemu_console_surface(dcl->con);
+
+ if (!surf) {
+ return;
+ }
+
+ qt5_update_internal(surface_data(surf), surface_width(surf), surface_height(surf));
+}
+
+static void qt5_switch(DisplayChangeListener *dcl,
+ DisplaySurface *new_surface)
+{
+// fprintf(stdout, "##### qt5_switch\n");
+}
+
+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 qt5_display_init(DisplayState *ds, int full_screen)
+{
+ int i;
+
+ // prepare gui
+ qt5_prepare();
+
+ 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;
+ }
+
+ // TODO: show icon
+
+ if (full_screen) {
+ // TODO
+ }
+
+ /* TODO
+ mouse_mode_notifier.notify = qt2_mouse_mode_change;
+ qemu_add_mouse_mode_change_notifier(&mouse_mode_notifier);
+ */
+
+ // TODO: cursor control
+}
--- /dev/null
+/*
+ * Qt UI
+ *
+ * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * 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 <QApplication>
+#include "qt5_supplement.h"
+
+//using namespace std;
+
+static QApplication *app;
+
+QT5Console::QT5Console()
+{
+ label = new QLabel();
+ label->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
+ label->setAlignment(Qt::AlignCenter);
+ label->setFixedSize(720 / 2, 1280 / 2);
+
+ layout = new QVBoxLayout();
+ layout->addWidget(label);
+ layout->setContentsMargins( 0, 0, 0, 0);
+ setLayout(layout);
+
+ setWindowTitle(tr("Emulator with Qt5"));
+}
+
+QLabel *QT5Console::getLabel()
+{
+ return label;
+}
+
+static int argc = 0;
+static char *argv[0];
+static QT5Console *console;
+
+void qt5_prepare(void)
+{
+ app = new QApplication(argc, argv);
+ console = new QT5Console();
+ console->show();
+}
+
+int qt5_get_win_id(void)
+{
+ return console->winId();
+}
+
+void qt5_update_internal(void *data, int width, int height)
+{
+ QPixmap pixmap = QPixmap();
+ QLabel *label = console->getLabel();
+
+ QImage image = QImage((uchar *)data, width, height, QImage::Format_ARGB32);
+ pixmap.convertFromImage(image);
+
+ label->setPixmap(pixmap.scaled(label->size(), Qt::KeepAspectRatio,
+ Qt::SmoothTransformation));
+}
+
+void qt5_switch_internal(void)
+{
+}
+
+void qt5_refresh_internal(void)
+{
+ app->processEvents();
+}
+
+void qt5_mouse_warp(void)
+{
+}
+
+void sdl_mouse_define(void)
+{
+}
--- /dev/null
+/*
+ * Qt UI
+ *
+ * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * 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_INTERNAL_H__
+#define __QT5_INTERNAL_H__
+
+#ifdef __cplusplus
+#include <QtWidgets>
+
+class QT5Console : public QWidget
+{
+ Q_OBJECT
+
+public:
+ QT5Console();
+ QLabel *getLabel();
+
+protected:
+
+private:
+ QLabel *label;
+ QLayout *layout;
+};
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+void qt5_prepare(void);
+int qt5_get_win_id(void);
+
+void qt5_update_internal(void *data, int width, int height);
+void qt5_switch_internal(void);
+void qt5_refresh_internal(void);
+void qt5_mouse_warp_internal(void);
+void sdl_mouse_define_internal(void);
+#ifdef __cplusplus
+}
+#endif
+
+#endif // __QT5_INTERNAL_H__
fprintf(stderr, "GTK support is disabled\n");
exit(1);
#endif
+ } else if (strstart(p, "qt", &opts)) {
+ display = DT_QT;
} else if (strstart(p, "none", &opts)) {
display = DT_NONE;
} else {
}
#ifdef CONFIG_MARU
-int use_qemu_display = 0; //0:use tizen qemu sdl, 1:use original qemu sdl
-
// W/A for preserve larger continuous heap for RAM.
extern void *preallocated_ram_ptr;
extern int preallocated_ram_size;
if (display_type == DT_DEFAULT && !display_remote) {
#if defined(CONFIG_MARU)
+#if defined(CONFIG_SDL)
display_type = DT_MARU;
+#elif defined(CONFIG_QT)
+ display_type = DT_QT;
+#endif
#elif defined(CONFIG_GTK)
display_type = DT_GTK;
#elif defined(CONFIG_SDL) || defined(CONFIG_COCOA)
start_skin();
break;
#endif
+#if defined(CONFIG_QT)
+ case DT_QT:
+ qt5_display_init(ds, full_screen);
+ break;
+#endif
#endif
#if defined(CONFIG_SDL)
case DT_SDL: