diff --git a/Makefile.common b/Makefile.common index b03cc09226ad..990602475efa 100644 --- a/Makefile.common +++ b/Makefile.common @@ -181,6 +181,16 @@ OBJ += frontend/frontend.o \ OBJ += gfx/image/image.o +# Qt + +ifeq ($(HAVE_QT), 1) +OBJ += ui/drivers/ui_qt.o +# TODO/FIXME - figure out which libraries we need to link against +LIBS += -lQt5Quick -lQt5Widgets -lQt5Gui -lQt5Qml -lQt5Network -lQt5Core -lglu32 -lopengl32 +# Make this Win32-specific +# -lgdi32 -luser32 -L./qt -lwrapper +endif + # LibretroDB ifeq ($(HAVE_LIBRETRODB), 1) diff --git a/griffin/griffin_cpp.cpp b/griffin/griffin_cpp.cpp new file mode 100644 index 000000000000..c7be168f3525 --- /dev/null +++ b/griffin/griffin_cpp.cpp @@ -0,0 +1,18 @@ +/* RetroArch - A frontend for libretro. +* Copyright (C) 2011-2015 - Daniel De Matteis +* +* RetroArch 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 Found- +* ation, either version 3 of the License, or (at your option) any later version. +* +* RetroArch 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 RetroArch. +* If not, see . +*/ + +#ifdef HAVE_QT +#include "../ui/drivers/ui_qt.cpp" +#endif diff --git a/griffin/griffin_objc.m b/griffin/griffin_objc.m index 5e44d12e12ed..b0fe28c0ffb0 100644 --- a/griffin/griffin_objc.m +++ b/griffin/griffin_objc.m @@ -1,3 +1,18 @@ +/* RetroArch - A frontend for libretro. +* Copyright (C) 2011-2015 - Daniel De Matteis +* +* RetroArch 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 Found- +* ation, either version 3 of the License, or (at your option) any later version. +* +* RetroArch 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 RetroArch. +* If not, see . +*/ + #ifdef IOS #include #else diff --git a/ui/drivers/ui_qt.cpp b/ui/drivers/ui_qt.cpp new file mode 100644 index 000000000000..5f0b496dc2de --- /dev/null +++ b/ui/drivers/ui_qt.cpp @@ -0,0 +1,115 @@ +/* RetroArch - A frontend for libretro. + * Copyright (C) 2011-2015 - Daniel De Matteis + * + * RetroArch 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 Found- + * ation, either version 3 of the License, or (at your option) any later version. + * + * RetroArch 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 RetroArch. + * If not, see . + */ + +#include +#include +#include +#include +#include + +#include +#include +#include "../ui_companion_driver.h" + +#include +#include +#include +#include +#include +#include +#include + +typedef struct ui_companion_qt +{ + volatile bool quit; + slock_t *lock; + sthread_t *thread; +} ui_companion_qt_t; + +class QtApp : public QGuiApplication +{ + Q_OBJECT + public: + QtApp(int argc, char *argv[]): QGuiApplication(argc, argv) {} + + int CreateMainWindow() + { + QQmlApplicationEngine engine; + engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); + return this->exec(); + } +}; + +static void qt_thread(void *data) +{ + ui_companion_qt_t *handle = (ui_companion_qt_t*)data; + + /* call CreateMainWindow here */ +} + +static void ui_companion_qt_deinit(void *data) +{ + ui_companion_qt_t *handle = (ui_companion_qt_t*)data; + + if (!handle) + return; + + slock_free(handle->lock); + sthread_join(handle->thread); + + free(handle); +} + +static void *ui_companion_qt_init(void) +{ + ui_companion_qt_t *handle = (ui_companion_qt_t*)calloc(1, sizeof(*handle)); + + if (!handle) + return NULL; + + handle->lock = slock_new(); + handle->thread = sthread_create(qt_thread, handle); + + if (!handle->thread) + { + slock_free(handle->lock); + free(handle); + return NULL; + } + + return handle; +} + +static int ui_companion_qt_iterate(void *data, unsigned action) +{ + (void)data; + (void)action; + + return 0; +} + +static void ui_companion_qt_notify_content_loaded(void *data) +{ + (void)data; +} + +const ui_companion_driver_t ui_companion_qt = { + ui_companion_qt_init, + ui_companion_qt_deinit, + ui_companion_qt_iterate, + NULL, + ui_companion_qt_notify_content_loaded, + "qt", +}; diff --git a/ui/ui_companion_driver.c b/ui/ui_companion_driver.c index f33760d3bf7f..4e5d141a80eb 100644 --- a/ui/ui_companion_driver.c +++ b/ui/ui_companion_driver.c @@ -24,6 +24,9 @@ static const ui_companion_driver_t *ui_companion_drivers[] = { #ifdef IOS &ui_companion_cocoatouch, +#endif +#ifdef HAVE_QT + &ui_companion_qt, #endif &ui_companion_null, NULL diff --git a/ui/ui_companion_driver.h b/ui/ui_companion_driver.h index 21212004a658..57cf619e3cbe 100644 --- a/ui/ui_companion_driver.h +++ b/ui/ui_companion_driver.h @@ -41,6 +41,7 @@ typedef struct ui_companion_driver extern const ui_companion_driver_t ui_companion_null; extern const ui_companion_driver_t ui_companion_cocoatouch; +extern const ui_companion_driver_t ui_companion_qt; /** * ui_companion_find_driver: