Skip to content

Commit

Permalink
(Qt) Start making clean Qt skeleton implementation - radius needs to …
Browse files Browse the repository at this point in the history
…do the rest
  • Loading branch information
inactive123 committed Apr 12, 2015
1 parent a9d24e9 commit c2d8d7e
Show file tree
Hide file tree
Showing 6 changed files with 162 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
18 changes: 18 additions & 0 deletions griffin/griffin_cpp.cpp
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
*/

#ifdef HAVE_QT
#include "../ui/drivers/ui_qt.cpp"
#endif
15 changes: 15 additions & 0 deletions griffin/griffin_objc.m
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
*/

#ifdef IOS
#include <Availability.h>
#else
Expand Down
115 changes: 115 additions & 0 deletions ui/drivers/ui_qt.cpp
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
*/

#include <stdint.h>
#include <boolean.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>

#include <file/file_path.h>
#include <rthreads/rthreads.h>
#include "../ui_companion_driver.h"

#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QListView>
#include <QtWidgets/qwidget.h>
#include <QtWidgets/qapplication.h>
#include <QtQml/qqmlapplicationengine.h>
#include <QtCore/qglobal.h>

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",
};
3 changes: 3 additions & 0 deletions ui/ui_companion_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions ui/ui_companion_driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit c2d8d7e

Please sign in to comment.