| 23 | using namespace std; |
| 24 | |
| 25 | AdapterSettingsDialog::AdapterSettingsDialog(QWidget* parent, DbgRef<DebuggerController> controller) : |
| 26 | QDialog(), m_controller(controller) |
| 27 | { |
| 28 | setWindowTitle("Debug Adapter Settings"); |
| 29 | setAttribute(Qt::WA_DeleteOnClose); |
| 30 | |
| 31 | setModal(true); |
| 32 | QVBoxLayout* layout = new QVBoxLayout; |
| 33 | layout->setSpacing(0); |
| 34 | |
| 35 | m_adapterEntry = new QComboBox(this); |
| 36 | for (const std::string& adapter : DebugAdapterType::GetAvailableAdapters(m_controller->GetData())) |
| 37 | { |
| 38 | m_adapterEntry->addItem(QString::fromStdString(adapter)); |
| 39 | } |
| 40 | if (m_controller->GetAdapterType() != "") |
| 41 | { |
| 42 | m_adapterEntry->setCurrentText(QString::fromStdString(m_controller->GetAdapterType())); |
| 43 | } |
| 44 | else |
| 45 | { |
| 46 | m_adapterEntry->setCurrentText("(No available debug adapter)"); |
| 47 | } |
| 48 | |
| 49 | connect(m_adapterEntry, &QComboBox::currentTextChanged, this, &AdapterSettingsDialog::selectAdapter); |
| 50 | |
| 51 | m_inputFile = new QLineEdit(this); |
| 52 | m_inputFile->setMinimumWidth(800); |
| 53 | m_pathEntry = new QLineEdit(this); |
| 54 | m_pathEntry->setMinimumWidth(800); |
| 55 | m_argumentsEntry = new QLineEdit(this); |
| 56 | m_workingDirectoryEntry = new QLineEdit(this); |
| 57 | m_terminalEmulator = new QCheckBox(this); |
| 58 | |
| 59 | auto* fileSelector = new QPushButton("...", this); |
| 60 | fileSelector->setMaximumWidth(30); |
| 61 | connect(fileSelector, &QPushButton::clicked, [&]() { |
| 62 | auto fileName = QFileDialog::getOpenFileName(this, "Select Input File", m_workingDirectoryEntry->text()); |
| 63 | if (!fileName.isEmpty()) |
| 64 | m_inputFile->setText(fileName); |
| 65 | }); |
| 66 | |
| 67 | auto* pathSelector = new QPushButton("...", this); |
| 68 | pathSelector->setMaximumWidth(30); |
| 69 | connect(pathSelector, &QPushButton::clicked, [&]() { |
| 70 | auto fileName = QFileDialog::getOpenFileName(this, "Select Executable Path", m_pathEntry->text()); |
| 71 | if (!fileName.isEmpty()) |
| 72 | m_pathEntry->setText(fileName); |
| 73 | }); |
| 74 | |
| 75 | auto* workingDirSelector = new QPushButton("...", this); |
| 76 | workingDirSelector->setMaximumWidth(30); |
| 77 | connect(workingDirSelector, &QPushButton::clicked, [&]() { |
| 78 | auto pathName = QFileDialog::getExistingDirectory(this, "Specify Working Directory", |
| 79 | m_workingDirectoryEntry->text(), QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks); |
| 80 | if (!pathName.isEmpty()) |
| 81 | m_workingDirectoryEntry->setText(pathName); |
| 82 | }); |
nothing calls this directly
no test coverage detected