ochess/src/engine_tab/EngineTab.cpp

22 lines
843 B
C++
Raw Normal View History

2022-02-26 17:05:47 +01:00
#include "EngineTab.hpp"
EngineTab::EngineTab(wxWindow *parent, std::string engine_path_or_name)
: EngineTabBF(parent), TabInfos(TabInfos::ENGINE) {
SetLabel("New Engine");
engine = new uciadapter::UCI(engine_path_or_name);
engine_location->SetValue(engine_path_or_name);
std::vector<uciadapter::Option> opts = engine->GetOptions();
for (uciadapter::Option &opt : opts) {
if (opt.type == "check") {
engine_parameters->Append(new wxBoolProperty(
opt.name, wxPG_LABEL, opt.default_value == "true"));
} else if (opt.type == "spin") {
engine_parameters->Append(new wxIntProperty(
opt.name, wxPG_LABEL, std::stoi(opt.default_value)));
} else if (opt.type == "string") {
engine_parameters->Append(
new wxStringProperty(opt.name, wxPG_LABEL, opt.default_value));
}
}
}