lay down basic imgui wrappers/helpers
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user