| 71 | } |
| 72 | |
| 73 | void FileTransferController::onSaveSimulationDialog() |
| 74 | { |
| 75 | GenericFileDialog::get().showSaveFileDialog( |
| 76 | "Save simulation", "Simulation file (*.sim){.sim},.*", _referencePath, [&](std::filesystem::path const& path) { |
| 77 | auto firstFilename = ifd::FileDialog::Instance().GetResult(); |
| 78 | auto firstFilenameCopy = firstFilename; |
| 79 | _referencePath = firstFilenameCopy.remove_filename().string(); |
| 80 | printOverlayMessage("Saving ..."); |
| 81 | _saveSimulationProcessor->executeTask( |
| 82 | [&, firstFilename = firstFilename](auto const& senderId) { |
| 83 | auto senderInfo = SenderInfo{.senderId = senderId, .wishResultData = false, .wishErrorInfo = true}; |
| 84 | auto readData = SaveSimulationRequestData{firstFilename.string(), Viewport::get().getZoomFactor(), Viewport::get().getCenterInWorldPos()}; |
| 85 | return _persisterFacade->scheduleSaveSimulation(senderInfo, readData); |
| 86 | }, |
| 87 | [](auto const&) { }, |
| 88 | [](auto const& criticalErrors) { GenericMessageDialog::get().information("Error", criticalErrors); }); |
| 89 | }); |
| 90 | } |
| 91 | |
| 92 | void FileTransferController::init(PersisterFacade persisterFacade, SimulationFacade simulationFacade) |
| 93 | { |
no test coverage detected