From b32a3e55f4f79abc7be1aec76af787f135a35733 Mon Sep 17 00:00:00 2001 From: radius Date: Tue, 1 Sep 2015 17:37:23 -0500 Subject: [PATCH] Settings are now being passed correctly to the QT side --- ui/drivers/qt/wimp/wimp.cpp | 19 ++++--------------- ui/drivers/qt/wimp/wimp.h | 25 +++++++++++++++++++++---- ui/drivers/qt/wrapper/wrapper.cpp | 8 ++++---- ui/drivers/qt/wrapper/wrapper.h | 10 ++++++++-- ui/drivers/ui_qt.c | 12 ++++-------- 5 files changed, 41 insertions(+), 33 deletions(-) diff --git a/ui/drivers/qt/wimp/wimp.cpp b/ui/drivers/qt/wimp/wimp.cpp index cfab987dce..0508385049 100644 --- a/ui/drivers/qt/wimp/wimp.cpp +++ b/ui/drivers/qt/wimp/wimp.cpp @@ -22,29 +22,18 @@ QObject *topLevel; -static settings_t *settings; - -int Wimp::CreateMainWindow(char* windowTitle) +int Wimp::CreateMainWindow() { QQmlApplicationEngine engine; engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); topLevel = engine.rootObjects().value(0); window = qobject_cast(topLevel); - SetTitle(windowTitle); return this->exec(); + } - -void Wimp::SetTitle(char* title) +void Wimp::GetSettings(settings_t *s) { - window->setTitle(title); -} - -void Wimp::ConfigGetPtr(settings_t *g_config) -{ - settings = g_config; - /* test print the value of max users to compare with the value in RA */ - printf("Max Users: %d\n",g_config->input.max_users); - fflush(stdout); + settings = s; } diff --git a/ui/drivers/qt/wimp/wimp.h b/ui/drivers/qt/wimp/wimp.h index 4de50e63de..4b6748e31f 100644 --- a/ui/drivers/qt/wimp/wimp.h +++ b/ui/drivers/qt/wimp/wimp.h @@ -16,12 +16,22 @@ #ifndef WIMP_H #define WIMP_H +/* this is the only define missing from config.h remove these once + * we can build everything with a single makefile + */ + +#ifndef HAVE_MENU +#define HAVE_MENU +#endif + +#include "config.h" +#include "configuration.h" + #include "wimp_global.h" #include #include #include #include -#include "configuration.h" class WIMPSHARED_EXPORT Wimp : public QGuiApplication { @@ -30,9 +40,16 @@ class WIMPSHARED_EXPORT Wimp : public QGuiApplication Q_OBJECT public: Wimp(int argc, char *argv[]): QGuiApplication(argc, argv) {} - int CreateMainWindow(char* windowTitle); - void SetTitle(char* title); - void ConfigGetPtr(settings_t *g_config); + + /* create the main QT window */ + int CreateMainWindow(); + + /* get a pointer to RetroArch settings */ + void GetSettings(settings_t *s); + + private: + /* pointer to RetroArch settings */ + settings_t *settings; }; diff --git a/ui/drivers/qt/wrapper/wrapper.cpp b/ui/drivers/qt/wrapper/wrapper.cpp index 3e1877a626..c3573e40a5 100644 --- a/ui/drivers/qt/wrapper/wrapper.cpp +++ b/ui/drivers/qt/wrapper/wrapper.cpp @@ -29,14 +29,14 @@ Wimp* ctrWimp(int argc, char *argv[]){ return new Wimp(argc,argv); } -int CreateMainWindow(Wimp* p, char* windowTitle) +int CreateMainWindow(Wimp* p) { - return p->CreateMainWindow(windowTitle); + return p->CreateMainWindow(); } -void ConfigGetPtr(Wimp*p, settings_t *g_config) +void GetSettings(Wimp* p, settings_t *s) { - return p->ConfigGetPtr(g_config); + return p->GetSettings(s); } #ifdef __cplusplus diff --git a/ui/drivers/qt/wrapper/wrapper.h b/ui/drivers/qt/wrapper/wrapper.h index 98b392063c..5329613c7d 100644 --- a/ui/drivers/qt/wrapper/wrapper.h +++ b/ui/drivers/qt/wrapper/wrapper.h @@ -13,6 +13,11 @@ * If not, see . */ +#ifndef HAVE_MENU +#define HAVE_MENU +#endif + +#include "config.h" #include "configuration.h" #ifndef WRAPPER_H @@ -23,11 +28,12 @@ extern "C" { #endif typedef struct Wimp Wimp; +typedef settings_t (*config_get_ptr_cb); Wimp* ctrWimp(int argc, char *argv[]); -int CreateMainWindow(Wimp* p, char* windowTitle); -void ConfigGetPtr(Wimp*p, settings_t *g_config); +int CreateMainWindow(Wimp* p); +void GetSettings(Wimp* p, settings_t *s); #ifdef __cplusplus } diff --git a/ui/drivers/ui_qt.c b/ui/drivers/ui_qt.c index e8ca4008a7..2068afdb8d 100644 --- a/ui/drivers/ui_qt.c +++ b/ui/drivers/ui_qt.c @@ -29,7 +29,7 @@ struct Wimp* wimp; char* args[] = {""}; - +settings_t *settings; typedef struct ui_companion_qt { @@ -41,16 +41,12 @@ typedef struct ui_companion_qt static void qt_thread(void *data) { - settings_t *settings = config_get_ptr(); - /* test print the value of max users to compare with the value in QT */ - RARCH_LOG("Max Users: %d\n", settings->input.max_users); - ui_companion_qt_t *handle = (ui_companion_qt_t*)data; wimp = ctrWimp(0, NULL); if(wimp) { - ConfigGetPtr(wimp, settings); - CreateMainWindow(wimp, "RetroArch QT"); + GetSettings(wimp, settings); + CreateMainWindow(wimp); } return; @@ -74,7 +70,7 @@ static void *ui_companion_qt_init(void) ui_companion_qt_t *handle = (ui_companion_qt_t*)calloc(1, sizeof(*handle)); if (!handle) return NULL; - + settings = config_get_ptr(); handle->lock = slock_new(); handle->thread = sthread_create(qt_thread, handle); if (!handle->thread)