mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-09 23:00:20 +02:00
Global rootfs doesn't support a named rootfs (only local supports that). So when it is a global rootfs option just give the full path to the config path. Just needs some special handling to ensure the full path is retained for global paths. A reimplementation of #4067 that doesn't hardcode paths and routes the global data path through FEXCore.
74 lines
1.4 KiB
C++
74 lines
1.4 KiB
C++
// SPDX-License-Identifier: MIT
|
|
#include <QStandardItemModel>
|
|
#include <QQmlApplicationEngine>
|
|
|
|
#include <latch>
|
|
#include <thread>
|
|
|
|
class QQuickWindow;
|
|
|
|
class ConfigModel : public QStandardItemModel {
|
|
Q_OBJECT
|
|
QML_ELEMENT
|
|
QML_SINGLETON
|
|
|
|
public:
|
|
ConfigModel();
|
|
|
|
void Reload();
|
|
|
|
public slots:
|
|
bool has(const QString&, bool unused) const;
|
|
void erase(const QString&);
|
|
|
|
bool getBool(const QString&, bool unused) const;
|
|
QString getString(const QString&, bool unused) const;
|
|
QStringList getStringList(const QString&, bool unused) const;
|
|
int getInt(const QString&, bool unused) const;
|
|
|
|
void setBool(const QString&, bool);
|
|
void setString(const QString&, const QString&);
|
|
void setStringList(const QString&, const QStringList&);
|
|
void setInt(const QString&, int value);
|
|
};
|
|
|
|
class RootFSModel : public QStandardItemModel {
|
|
Q_OBJECT
|
|
QML_ELEMENT
|
|
QML_SINGLETON
|
|
|
|
std::thread Thread;
|
|
std::latch ExitRequest {1};
|
|
|
|
int INotifyFD;
|
|
|
|
void INotifyThreadFunc();
|
|
|
|
public:
|
|
RootFSModel();
|
|
~RootFSModel();
|
|
|
|
public slots:
|
|
void Reload();
|
|
|
|
bool hasItem(const QString&) const;
|
|
|
|
QUrl getBaseUrl() const;
|
|
};
|
|
|
|
class ConfigRuntime : public QObject {
|
|
Q_OBJECT
|
|
|
|
QQmlApplicationEngine Engine;
|
|
QQuickWindow* Window = nullptr;
|
|
RootFSModel RootFSList;
|
|
ConfigModel ConfigModelInst;
|
|
|
|
public:
|
|
ConfigRuntime(const QString& ConfigFilename);
|
|
|
|
public slots:
|
|
void onSave(const QUrl&);
|
|
void onLoad(const QUrl&);
|
|
};
|