Try to pass settings to the QT ui driver

This commit is contained in:
radius 2015-08-31 21:00:46 -05:00
parent 9480bfbd9e
commit 7a7f778341
9 changed files with 170 additions and 29 deletions

View File

@ -2,17 +2,46 @@
#include "../wrapper/wrapper.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* args[] = {""};
qDebug() << "C++ Style Debug Message";
wimp = ctrWimp(0, argv);
if(wimp)
CreateMainWindow(wimp);
return 1;
char **arguments = (char**)arg;
t = ctrWimp(i,arguments);
CreateMainWindow(t); //-->uncomment this to open the QT gui
return 0;
}
int main(int argc, char *argv[])
{
i = argc;
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;
}

View File

@ -20,11 +20,7 @@
#include <QListView>
#include <QQuickWindow>
#include "configuration.h"
QObject *topLevel;
QQuickWindow *window;
static settings_t *g_config;
int Wimp::CreateMainWindow()
{
@ -33,18 +29,19 @@ int Wimp::CreateMainWindow()
topLevel = engine.rootObjects().value(0);
window = qobject_cast<QQuickWindow *>(topLevel);
SetTitle("RetroArch");
return this->exec();
}
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);
}

View File

@ -20,14 +20,20 @@
#include <QtWidgets/qwidget.h>
#include <QtWidgets/qapplication.h>
#include <QtQml/qqmlapplicationengine.h>
#include <QtQuick/qquickwindow.h>
#include "configuration.h"
class WIMPSHARED_EXPORT Wimp : public QGuiApplication
{
QQuickWindow *window;
settings_t *settings;
Q_OBJECT
public:
Wimp(int argc, char *argv[]): QGuiApplication(argc, argv) {}
int CreateMainWindow();
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

View File

@ -39,6 +39,11 @@ void SetTitle(Wimp*p, char* title)
return p->SetTitle(title);
}
void ConfigGetPtr(Wimp*p, settings_t *settings)
{
return p->ConfigGetPtr(settings);
}
#ifdef __cplusplus
}
#endif

View File

@ -13,6 +13,7 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#include "configuration.h"
#ifndef WRAPPER_H
#define WRAPPER_H
@ -27,6 +28,7 @@ Wimp* ctrWimp(int argc, char *argv[]);
int CreateMainWindow(Wimp* p);
void SetTitle(Wimp* p, char* title);
void ConfigGetPtr(Wimp*p, settings_t *settings);
#ifdef __cplusplus
}

View File

@ -20,3 +20,6 @@ else:unix: LIBS += -L$$PWD/../wimp/build/ -lwimp.dll
INCLUDEPATH += $$PWD/../wimp/build/release
DEPENDPATH += $$PWD/../wimp/build/release
INCLUDEPATH += $$PWD/../../../../
INCLUDEPATH += $$PWD/../../../../libretro-common/include/

View File

@ -39,12 +39,12 @@ typedef struct ui_companion_qt
static void qt_thread(void *data)
{
ui_companion_qt_t *handle = (ui_companion_qt_t*)data;
wimp = ctrWimp(0, NULL);
ConfigGetPtr(wimp,config_get_ptr());
if(wimp)
CreateMainWindow(wimp);
return;
return;
}
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)
{
ui_companion_qt_t *handle = (ui_companion_qt_t*)calloc(1, sizeof(*handle));
fflush(stdout);
@ -72,7 +71,7 @@ static void *ui_companion_qt_init(void)
handle->lock = slock_new();
handle->thread = sthread_create(qt_thread, handle);
if (!handle->thread)
{
slock_free(handle->lock);
@ -87,8 +86,8 @@ static int ui_companion_qt_iterate(void *data, unsigned action)
{
(void)data;
(void)action;
printf("Test");
fflush(stdout);
return 0;
}