| 6421 | } |
| 6422 | |
| 6423 | void BufferViewer::exportData(const BufferExport ¶ms) |
| 6424 | { |
| 6425 | if(!m_Ctx.IsCaptureLoaded()) |
| 6426 | return; |
| 6427 | |
| 6428 | if(!m_Ctx.CurAction()) |
| 6429 | return; |
| 6430 | |
| 6431 | if(!m_CurView && !m_CurFixed) |
| 6432 | return; |
| 6433 | |
| 6434 | QString filter; |
| 6435 | QString title; |
| 6436 | if(params.format == BufferExport::CSV) |
| 6437 | { |
| 6438 | filter = tr("CSV Files (*.csv)"); |
| 6439 | title = tr("Export buffer to CSV"); |
| 6440 | } |
| 6441 | else if(params.format == BufferExport::RawBytes) |
| 6442 | { |
| 6443 | filter = tr("Binary Files (*.bin)"); |
| 6444 | title = tr("Export buffer to bytes"); |
| 6445 | } |
| 6446 | |
| 6447 | QString filename = |
| 6448 | RDDialog::getSaveFileName(this, title, QString(), tr("%1;;All files (*)").arg(filter)); |
| 6449 | |
| 6450 | if(filename.isEmpty()) |
| 6451 | return; |
| 6452 | |
| 6453 | QFile *f = new QFile(filename); |
| 6454 | |
| 6455 | QIODevice::OpenMode flags = QIODevice::WriteOnly | QFile::Truncate; |
| 6456 | |
| 6457 | if(params.format == BufferExport::CSV) |
| 6458 | flags |= QIODevice::Text; |
| 6459 | |
| 6460 | if(!f->open(flags)) |
| 6461 | { |
| 6462 | delete f; |
| 6463 | RDDialog::critical(this, tr("Error exporting file"), |
| 6464 | tr("Couldn't open file '%1' for writing").arg(filename)); |
| 6465 | return; |
| 6466 | } |
| 6467 | |
| 6468 | if(m_MeshView) |
| 6469 | { |
| 6470 | ANALYTIC_SET(Export.MeshOutput, true); |
| 6471 | } |
| 6472 | else |
| 6473 | { |
| 6474 | ANALYTIC_SET(Export.RawBuffer, true); |
| 6475 | } |
| 6476 | |
| 6477 | if(m_CurView) |
| 6478 | { |
| 6479 | BufferItemModel *model = (BufferItemModel *)m_CurView->model(); |
| 6480 |
nothing calls this directly
no test coverage detected