add required shit for loading per-window config (I think)
This commit is contained in:
parent
d50f01b774
commit
f9449999ec
|
@ -539,11 +539,17 @@ Array Table::GetArray(const std::string& path)
|
|||
return Array(arr);
|
||||
}
|
||||
|
||||
Table Table::GetTable(const std::string& path)
|
||||
Table Table::GetTable(const std::string& path, const std::string& defpath)
|
||||
{
|
||||
toml::value& tbl = ResolvePath(path);
|
||||
if (!tbl.is_table())
|
||||
tbl = toml::table();
|
||||
{
|
||||
toml::value defval = toml::table();
|
||||
if (!defpath.empty())
|
||||
defval = ResolvePath(defpath);
|
||||
|
||||
tbl = defval;
|
||||
}
|
||||
|
||||
return Table(tbl, PathPrefix + path);
|
||||
}
|
||||
|
|
|
@ -116,7 +116,7 @@ public:
|
|||
Table& operator=(const Table& b);
|
||||
|
||||
Array GetArray(const std::string& path);
|
||||
Table GetTable(const std::string& path);
|
||||
Table GetTable(const std::string& path, const std::string& defpath = "");
|
||||
|
||||
int GetInt(const std::string& path);
|
||||
int64_t GetInt64(const std::string& path);
|
||||
|
|
|
@ -120,7 +120,7 @@ void EmuInstance::createWindow()
|
|||
if (id == -1)
|
||||
return;
|
||||
|
||||
MainWindow* win = new MainWindow(this, topWindow);
|
||||
MainWindow* win = new MainWindow(id, this, topWindow);
|
||||
if (!topWindow) topWindow = win;
|
||||
if (!mainWindow) mainWindow = win;
|
||||
windowList[id] = win;
|
||||
|
|
|
@ -197,11 +197,13 @@ static void signalHandler(int)
|
|||
|
||||
int test = 0;
|
||||
|
||||
MainWindow::MainWindow(EmuInstance* inst, QWidget* parent) :
|
||||
MainWindow::MainWindow(int id, EmuInstance* inst, QWidget* parent) :
|
||||
QMainWindow(parent),
|
||||
windowID(id),
|
||||
emuInstance(inst),
|
||||
globalCfg(inst->globalCfg),
|
||||
localCfg(inst->localCfg)
|
||||
localCfg(inst->localCfg),
|
||||
windowCfg(localCfg.GetTable("Window"+std::to_string(id), "Window0"))
|
||||
{
|
||||
test_num = test++;
|
||||
#ifndef _WIN32
|
||||
|
|
|
@ -102,7 +102,7 @@ class MainWindow : public QMainWindow
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit MainWindow(EmuInstance* inst, QWidget* parent = nullptr);
|
||||
explicit MainWindow(int id, EmuInstance* inst, QWidget* parent = nullptr);
|
||||
~MainWindow();
|
||||
|
||||
EmuInstance* getEmuInstance() { return emuInstance; }
|
||||
|
@ -241,11 +241,14 @@ private:
|
|||
|
||||
int test_num;
|
||||
|
||||
int windowID;
|
||||
|
||||
EmuInstance* emuInstance;
|
||||
EmuThread* emuThread;
|
||||
|
||||
Config::Table& globalCfg;
|
||||
Config::Table& localCfg;
|
||||
Config::Table windowCfg;
|
||||
|
||||
public:
|
||||
ScreenPanel* panel;
|
||||
|
|
Loading…
Reference in New Issue