| 550 | } |
| 551 | |
| 552 | void UEFITool::saveImageFile() |
| 553 | { |
| 554 | QString path = QFileDialog::getSaveFileName(this, tr("Save BIOS image file"), currentDir, "BIOS image files (*.rom *.bin *.cap *.bio *.fd *.wph *.dec);;All files (*)"); |
| 555 | |
| 556 | if (path.isEmpty()) |
| 557 | return; |
| 558 | |
| 559 | QByteArray reconstructed; |
| 560 | UINT8 result = ffsEngine->reconstructImageFile(reconstructed); |
| 561 | showMessages(); |
| 562 | if (result) { |
| 563 | QMessageBox::critical(this, tr("Image reconstruction failed"), errorMessage(result), QMessageBox::Ok); |
| 564 | return; |
| 565 | } |
| 566 | |
| 567 | QFile outputFile; |
| 568 | outputFile.setFileName(path); |
| 569 | |
| 570 | if (!outputFile.open(QFile::WriteOnly)) { |
| 571 | QMessageBox::critical(this, tr("Image reconstruction failed"), tr("Can't open output file for rewriting"), QMessageBox::Ok); |
| 572 | return; |
| 573 | } |
| 574 | |
| 575 | outputFile.resize(0); |
| 576 | outputFile.write(reconstructed); |
| 577 | outputFile.close(); |
| 578 | if (QMessageBox::information(this, tr("Image reconstruction successful"), tr("Open reconstructed file?"), QMessageBox::Yes, QMessageBox::No) |
| 579 | == QMessageBox::Yes) |
| 580 | openImageFile(path); |
| 581 | } |
| 582 | |
| 583 | void UEFITool::openImageFile() |
| 584 | { |
nothing calls this directly
no test coverage detected