lay down basic imgui wrappers/helpers

This commit is contained in:
SimoZ64
2025-04-28 21:22:27 +02:00
parent 3f14a99ea0
commit f57e15f4de
8 changed files with 178 additions and 74 deletions

View File

@@ -2,30 +2,22 @@
#include <JSONUtils.hpp>
#include <log.hpp>
CPUSettings::CPUSettings(nlohmann::json &settings) : QWidget(nullptr), settings(settings) {
cpuTypes->addItems({
"Interpreter" //, "Dynamic Recompiler"
});
CPUSettings::CPUSettings(nlohmann::json &settings) : settings(settings) {
if (JSONGetField<std::string>(settings, "cpu", "type") == "jit") {
cpuTypes->setCurrentIndex(1);
cpuTypes.setCurrentIndex(1);
} else {
cpuTypes->setCurrentIndex(0);
cpuTypes.setCurrentIndex(0);
}
}
connect(cpuTypes.get(), &QComboBox::currentIndexChanged, this, [&]() {
if (cpuTypes->currentIndex() == 0) {
bool CPUSettings::render() {
if(cpuTypes.render()) {
if(cpuTypes.getCurrentIndex() == 0) {
JSONSetField(settings, "cpu", "type", "interpreter");
//} else if (cpuTypes->currentIndex() == 1) {
// JSONSetField(settings, "cpu", "type", "jit");
} else {
Util::panic("Impossible CPU type!");
Util::panic("JIT is unfinished and currently not supported!");
}
emit modified();
});
mainLayout->addWidget(label.get());
mainLayout->addWidget(cpuTypes.get());
mainLayout->addStretch();
setLayout(mainLayout.get());
modified = true;
}
}