| 1169 | } |
| 1170 | |
| 1171 | void CaptureDialog::TriggerCapture() |
| 1172 | { |
| 1173 | if(IsInjectMode()) |
| 1174 | { |
| 1175 | QModelIndexList sel = ui->processList->selectionModel()->selectedRows(); |
| 1176 | if(sel.size() == 1) |
| 1177 | { |
| 1178 | QModelIndex item = sel[0]; |
| 1179 | |
| 1180 | QSortFilterProxyModel *model = (QSortFilterProxyModel *)ui->processList->model(); |
| 1181 | |
| 1182 | item = model->mapToSource(item); |
| 1183 | |
| 1184 | QString name = m_ProcessModel->data(m_ProcessModel->index(item.row(), 0)).toString(); |
| 1185 | uint32_t PID = m_ProcessModel->data(m_ProcessModel->index(item.row(), 1)).toUInt(); |
| 1186 | |
| 1187 | m_InjectCallback( |
| 1188 | PID, Settings().environment, name, Settings().options, [this](LiveCapture *live) { |
| 1189 | if(ui->queueFrameCap->isChecked()) |
| 1190 | live->QueueCapture((int)ui->queuedFrame->value(), (int)ui->numFrames->value()); |
| 1191 | }); |
| 1192 | } |
| 1193 | else |
| 1194 | { |
| 1195 | RDDialog::critical(this, tr("No process selected"), |
| 1196 | tr("No process is selected to inject from the list above.")); |
| 1197 | } |
| 1198 | } |
| 1199 | else |
| 1200 | { |
| 1201 | QString exe = ui->exePath->text().trimmed(); |
| 1202 | |
| 1203 | if(exe.isEmpty()) |
| 1204 | { |
| 1205 | RDDialog::critical(this, tr("No executable selected"), |
| 1206 | tr("No program selected to launch, click browse next to 'Executable Path' " |
| 1207 | "above to select the program to launch.")); |
| 1208 | return; |
| 1209 | } |
| 1210 | |
| 1211 | // for non-remote captures, check the executable locally |
| 1212 | if(!m_Ctx.Replay().CurrentRemote().IsValid()) |
| 1213 | { |
| 1214 | if(!QFileInfo::exists(exe) && QStandardPaths::findExecutable(exe).isEmpty()) |
| 1215 | { |
| 1216 | RDDialog::critical( |
| 1217 | this, tr("Invalid executable"), |
| 1218 | tr("Invalid executable: %1\nCan't locate this path or a matching executable in PATH") |
| 1219 | .arg(exe)); |
| 1220 | return; |
| 1221 | } |
| 1222 | } |
| 1223 | |
| 1224 | QString workingDir = ui->workDirPath->text(); |
| 1225 | |
| 1226 | // for non-remote captures, check the directory locally |
| 1227 | if(!m_Ctx.Replay().CurrentRemote().IsValid()) |
| 1228 | { |
no test coverage detected