mirror of
https://github.com/libretro/RetroArch
synced 2025-04-02 07:20:34 +00:00
Try to pass settings to the QT ui driver
This commit is contained in:
parent
9480bfbd9e
commit
7a7f778341
ui/drivers
@ -2,17 +2,46 @@
|
|||||||
#include "../wrapper/wrapper.h"
|
#include "../wrapper/wrapper.h"
|
||||||
#include "../wimp/wimp.h"
|
#include "../wimp/wimp.h"
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <pthread.h>
|
||||||
|
|
||||||
|
struct Wimp* t;
|
||||||
|
|
||||||
|
|
||||||
|
int i=0;
|
||||||
|
|
||||||
|
void *initGui(void *arg)
|
||||||
{
|
{
|
||||||
struct Wimp* wimp;
|
char **arguments = (char**)arg;
|
||||||
char* args[] = {""};
|
t = ctrWimp(i,arguments);
|
||||||
|
CreateMainWindow(t); //-->uncomment this to open the QT gui
|
||||||
qDebug() << "C++ Style Debug Message";
|
return 0;
|
||||||
|
}
|
||||||
wimp = ctrWimp(0, argv);
|
|
||||||
if(wimp)
|
int main(int argc, char *argv[])
|
||||||
CreateMainWindow(wimp);
|
{
|
||||||
|
i = argc;
|
||||||
return 1;
|
|
||||||
|
pthread_t gui;
|
||||||
|
int rc;
|
||||||
|
rc=pthread_create(&gui, NULL, initGui, (void *)argv);
|
||||||
|
if(rc!=0)
|
||||||
|
{
|
||||||
|
printf("failed");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int j=0;j<100;j++)
|
||||||
|
{
|
||||||
|
Sleep(1000);
|
||||||
|
printf("test = %d\n",i);
|
||||||
|
i++;
|
||||||
|
if(j < 2)
|
||||||
|
t->SetTitle("test");
|
||||||
|
}
|
||||||
|
|
||||||
|
pthread_join(gui,NULL);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,11 +20,7 @@
|
|||||||
#include <QListView>
|
#include <QListView>
|
||||||
#include <QQuickWindow>
|
#include <QQuickWindow>
|
||||||
|
|
||||||
#include "configuration.h"
|
|
||||||
|
|
||||||
QObject *topLevel;
|
QObject *topLevel;
|
||||||
QQuickWindow *window;
|
|
||||||
static settings_t *g_config;
|
|
||||||
|
|
||||||
int Wimp::CreateMainWindow()
|
int Wimp::CreateMainWindow()
|
||||||
{
|
{
|
||||||
@ -33,18 +29,19 @@ int Wimp::CreateMainWindow()
|
|||||||
topLevel = engine.rootObjects().value(0);
|
topLevel = engine.rootObjects().value(0);
|
||||||
window = qobject_cast<QQuickWindow *>(topLevel);
|
window = qobject_cast<QQuickWindow *>(topLevel);
|
||||||
|
|
||||||
SetTitle("RetroArch");
|
|
||||||
|
|
||||||
return this->exec();
|
return this->exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Wimp::SetTitle(char* title)
|
void Wimp::SetTitle(char* title)
|
||||||
{
|
{
|
||||||
window->setTitle(title);
|
window->setTitle(title);
|
||||||
}
|
}
|
||||||
|
|
||||||
settings_t *config_get_ptr(void)
|
void Wimp::ConfigGetPtr(settings_t *settings)
|
||||||
{
|
{
|
||||||
return g_config;
|
this->settings = settings;
|
||||||
|
/* Test, print the video driver name to check if we got the settings data succesfully */
|
||||||
|
printf("Video Driver: %s\n",settings->video.driver);
|
||||||
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
|
@ -20,14 +20,20 @@
|
|||||||
#include <QtWidgets/qwidget.h>
|
#include <QtWidgets/qwidget.h>
|
||||||
#include <QtWidgets/qapplication.h>
|
#include <QtWidgets/qapplication.h>
|
||||||
#include <QtQml/qqmlapplicationengine.h>
|
#include <QtQml/qqmlapplicationengine.h>
|
||||||
|
#include <QtQuick/qquickwindow.h>
|
||||||
|
#include "configuration.h"
|
||||||
|
|
||||||
class WIMPSHARED_EXPORT Wimp : public QGuiApplication
|
class WIMPSHARED_EXPORT Wimp : public QGuiApplication
|
||||||
{
|
{
|
||||||
|
QQuickWindow *window;
|
||||||
|
settings_t *settings;
|
||||||
|
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
Wimp(int argc, char *argv[]): QGuiApplication(argc, argv) {}
|
Wimp(int argc, char *argv[]): QGuiApplication(argc, argv) {}
|
||||||
int CreateMainWindow();
|
int CreateMainWindow();
|
||||||
void SetTitle(char* title);
|
void SetTitle(char* title);
|
||||||
|
void ConfigGetPtr(settings_t* settings);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -39,6 +39,11 @@ void SetTitle(Wimp*p, char* title)
|
|||||||
return p->SetTitle(title);
|
return p->SetTitle(title);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ConfigGetPtr(Wimp*p, settings_t *settings)
|
||||||
|
{
|
||||||
|
return p->ConfigGetPtr(settings);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
* If not, see <http://www.gnu.org/licenses/>.
|
* If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "configuration.h"
|
||||||
|
|
||||||
#ifndef WRAPPER_H
|
#ifndef WRAPPER_H
|
||||||
#define WRAPPER_H
|
#define WRAPPER_H
|
||||||
@ -27,6 +28,7 @@ Wimp* ctrWimp(int argc, char *argv[]);
|
|||||||
|
|
||||||
int CreateMainWindow(Wimp* p);
|
int CreateMainWindow(Wimp* p);
|
||||||
void SetTitle(Wimp* p, char* title);
|
void SetTitle(Wimp* p, char* title);
|
||||||
|
void ConfigGetPtr(Wimp*p, settings_t *settings);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -20,3 +20,6 @@ else:unix: LIBS += -L$$PWD/../wimp/build/ -lwimp.dll
|
|||||||
|
|
||||||
INCLUDEPATH += $$PWD/../wimp/build/release
|
INCLUDEPATH += $$PWD/../wimp/build/release
|
||||||
DEPENDPATH += $$PWD/../wimp/build/release
|
DEPENDPATH += $$PWD/../wimp/build/release
|
||||||
|
|
||||||
|
INCLUDEPATH += $$PWD/../../../../
|
||||||
|
INCLUDEPATH += $$PWD/../../../../libretro-common/include/
|
||||||
|
@ -39,12 +39,12 @@ typedef struct ui_companion_qt
|
|||||||
static void qt_thread(void *data)
|
static void qt_thread(void *data)
|
||||||
{
|
{
|
||||||
ui_companion_qt_t *handle = (ui_companion_qt_t*)data;
|
ui_companion_qt_t *handle = (ui_companion_qt_t*)data;
|
||||||
|
|
||||||
wimp = ctrWimp(0, NULL);
|
wimp = ctrWimp(0, NULL);
|
||||||
|
ConfigGetPtr(wimp,config_get_ptr());
|
||||||
if(wimp)
|
if(wimp)
|
||||||
CreateMainWindow(wimp);
|
CreateMainWindow(wimp);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ui_companion_qt_deinit(void *data)
|
static void ui_companion_qt_deinit(void *data)
|
||||||
@ -63,7 +63,6 @@ static void ui_companion_qt_deinit(void *data)
|
|||||||
static void *ui_companion_qt_init(void)
|
static void *ui_companion_qt_init(void)
|
||||||
{
|
{
|
||||||
ui_companion_qt_t *handle = (ui_companion_qt_t*)calloc(1, sizeof(*handle));
|
ui_companion_qt_t *handle = (ui_companion_qt_t*)calloc(1, sizeof(*handle));
|
||||||
|
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|
||||||
|
|
||||||
@ -72,7 +71,7 @@ static void *ui_companion_qt_init(void)
|
|||||||
|
|
||||||
handle->lock = slock_new();
|
handle->lock = slock_new();
|
||||||
handle->thread = sthread_create(qt_thread, handle);
|
handle->thread = sthread_create(qt_thread, handle);
|
||||||
|
|
||||||
if (!handle->thread)
|
if (!handle->thread)
|
||||||
{
|
{
|
||||||
slock_free(handle->lock);
|
slock_free(handle->lock);
|
||||||
@ -87,8 +86,8 @@ static int ui_companion_qt_iterate(void *data, unsigned action)
|
|||||||
{
|
{
|
||||||
(void)data;
|
(void)data;
|
||||||
(void)action;
|
(void)action;
|
||||||
printf("Test");
|
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user