| 347 | } |
| 348 | |
| 349 | void LiveCapture::saveCapture_triggered() |
| 350 | { |
| 351 | if(ui->captures->selectedItems().size() == 1) |
| 352 | { |
| 353 | saveCapture(GetCapture(ui->captures->selectedItems()[0]), QString()); |
| 354 | } |
| 355 | else |
| 356 | { |
| 357 | QString path = m_Main->GetSavePath(tr("Save All Captures As")); |
| 358 | |
| 359 | if(!path.isEmpty()) |
| 360 | { |
| 361 | if(path.endsWith(lit(".rdc"))) |
| 362 | path.chop(4); |
| 363 | |
| 364 | // don't save duplicates if we have multiple captures from the same frame (possible if the |
| 365 | // application is not presenting at all and using the API to capture) |
| 366 | QMap<uint32_t, uint32_t> existingFiles; |
| 367 | |
| 368 | for(QListWidgetItem *item : ui->captures->selectedItems()) |
| 369 | { |
| 370 | Capture *cap = GetCapture(item); |
| 371 | |
| 372 | QString filename = QFormatStr("%1-frame%2").arg(path).arg(cap->frameNumber); |
| 373 | if(cap->frameNumber == ~0U) |
| 374 | filename = QFormatStr("%1-capture").arg(path); |
| 375 | |
| 376 | if(existingFiles.contains(cap->frameNumber)) |
| 377 | { |
| 378 | filename += QFormatStr("_%1").arg(existingFiles[cap->frameNumber]); |
| 379 | existingFiles[cap->frameNumber]++; |
| 380 | } |
| 381 | else |
| 382 | { |
| 383 | // start on 2 next time |
| 384 | existingFiles[cap->frameNumber] = 2; |
| 385 | } |
| 386 | |
| 387 | saveCapture(cap, QFormatStr("%1.rdc").arg(filename)); |
| 388 | } |
| 389 | } |
| 390 | } |
| 391 | } |
| 392 | |
| 393 | void LiveCapture::deleteCapture_triggered() |
| 394 | { |
nothing calls this directly
no test coverage detected