mirror of
https://github.com/libretro/RetroArch
synced 2025-02-16 12:39:59 +00:00
Settings are now being passed correctly to the QT side
This commit is contained in:
parent
f3389bbd42
commit
b32a3e55f4
ui/drivers
@ -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<QQuickWindow *>(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;
|
||||
}
|
||||
|
@ -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 <QtWidgets/qwidget.h>
|
||||
#include <QtWidgets/qapplication.h>
|
||||
#include <QtQml/qqmlapplicationengine.h>
|
||||
#include <QtQuick/qquickwindow.h>
|
||||
#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;
|
||||
|
||||
};
|
||||
|
||||
|
@ -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
|
||||
|
@ -13,6 +13,11 @@
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#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
|
||||
}
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user