| 39 | #endif |
| 40 | |
| 41 | EngineConfigurationDialog::EngineConfigurationDialog( |
| 42 | EngineConfigurationDialog::DialogMode mode, QWidget* parent) |
| 43 | : QDialog(parent), |
| 44 | m_hasError(false), |
| 45 | m_engineOptionModel(new EngineOptionModel(this)), |
| 46 | m_engine(nullptr), |
| 47 | ui(new Ui::EngineConfigurationDialog) |
| 48 | { |
| 49 | ui->setupUi(this); |
| 50 | |
| 51 | #if 0 |
| 52 | new ModelTest(m_engineOptionModel, this); |
| 53 | #endif |
| 54 | |
| 55 | if (mode == EngineConfigurationDialog::AddEngine) |
| 56 | setWindowTitle(tr("Add Engine")); |
| 57 | else |
| 58 | setWindowTitle(tr("Configure Engine")); |
| 59 | |
| 60 | ui->m_progressBar->setRange(0, 0); |
| 61 | ui->m_progressBar->hide(); |
| 62 | |
| 63 | ui->m_protocolCombo->addItems(EngineFactory::protocols()); |
| 64 | |
| 65 | ui->m_tscaleSpin->setStyleSheet("QDoubleSpinBox {color: black} \ |
| 66 | QDoubleSpinBox[value='1'] {color: #d0d0d0}"); |
| 67 | |
| 68 | ui->m_optionsView->setModel(m_engineOptionModel); |
| 69 | connect(m_engineOptionModel, SIGNAL(modelReset()), |
| 70 | this, SLOT(resizeColumns())); |
| 71 | |
| 72 | EngineOptionDelegate* delegate = new EngineOptionDelegate(this); |
| 73 | ui->m_optionsView->setItemDelegate(delegate); |
| 74 | connect(ui->m_workingDirEdit, SIGNAL(textChanged(QString)), |
| 75 | delegate, SLOT(setEngineDirectory(QString))); |
| 76 | |
| 77 | connect(ui->m_browseCmdBtn, SIGNAL(clicked(bool)), |
| 78 | this, SLOT(browseCommand())); |
| 79 | connect(ui->m_browseWorkingDirBtn, SIGNAL(clicked(bool)), |
| 80 | this, SLOT(browseWorkingDir())); |
| 81 | connect(ui->m_detectBtn, SIGNAL(clicked()), |
| 82 | this, SLOT(detectEngineOptions())); |
| 83 | connect(ui->m_restoreBtn, SIGNAL(clicked()), |
| 84 | this, SLOT(restoreDefaults())); |
| 85 | connect(ui->m_tabs, SIGNAL(currentChanged(int)), |
| 86 | this, SLOT(onTabChanged(int))); |
| 87 | connect(ui->m_nameEdit, SIGNAL(textChanged(QString)), |
| 88 | this, SLOT(onNameOrCommandChanged())); |
| 89 | connect(ui->m_commandEdit, SIGNAL(textChanged(QString)), |
| 90 | this, SLOT(onNameOrCommandChanged())); |
| 91 | connect(ui->m_buttonBox, SIGNAL(accepted()), |
| 92 | this, SLOT(onAccepted())); |
| 93 | connect(ui->m_protocolCombo, &QComboBox::currentTextChanged, |
| 94 | [=](const QString& text) |
| 95 | { |
| 96 | if (text == "xboard") |
| 97 | { |
| 98 | ui->m_whitePovCheck->setEnabled(true); |