From 7aa365592626e7532ddfa06f8aa3527d2a369640 Mon Sep 17 00:00:00 2001 From: Christian Heinemann Date: Tue, 15 Oct 2024 08:17:44 +0200 Subject: [PATCH] + crash during download fixed + providing data in uploading --- source/Gui/NetworkTransferController.cpp | 4 ++-- source/Gui/UploadSimulationDialog.cpp | 10 +++++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/source/Gui/NetworkTransferController.cpp b/source/Gui/NetworkTransferController.cpp index 51376e2d0..5001f7d13 100644 --- a/source/Gui/NetworkTransferController.cpp +++ b/source/Gui/NetworkTransferController.cpp @@ -44,7 +44,7 @@ void NetworkTransferController::onDownload(DownloadNetworkResourceRequestData co auto const& deserializedSimulation = std::get(data.resourceData); try { _simController->newSimulation( - requestData.resourceName, + data.resourceName, deserializedSimulation.auxiliaryData.timestep, deserializedSimulation.auxiliaryData.generalSettings, deserializedSimulation.auxiliaryData.simulationParameters); @@ -60,7 +60,7 @@ void NetworkTransferController::onDownload(DownloadNetworkResourceRequestData co showMessage("Error", *errorMessage); _simController->closeSimulation(); _simController->newSimulation( - requestData.resourceName, + data.resourceName, deserializedSimulation.auxiliaryData.timestep, deserializedSimulation.auxiliaryData.generalSettings, deserializedSimulation.auxiliaryData.simulationParameters); diff --git a/source/Gui/UploadSimulationDialog.cpp b/source/Gui/UploadSimulationDialog.cpp index 1cd4fdba5..1370e3c87 100644 --- a/source/Gui/UploadSimulationDialog.cpp +++ b/source/Gui/UploadSimulationDialog.cpp @@ -144,11 +144,19 @@ void _UploadSimulationDialog::onUpload() { printOverlayMessage("Uploading ..."); + auto data = [&]() -> std::variant { + if (_resourceType == NetworkResourceType_Simulation) { + return UploadNetworkResourceRequestData::SimulationData{.zoom = Viewport::getZoomFactor(), .center = Viewport::getCenterInWorldPos()}; + } else { + return UploadNetworkResourceRequestData::GenomeData{.description = _genomeEditorWindow->getCurrentGenome()}; + } + }(); auto workspaceType = _share ? WorkspaceType_Public : WorkspaceType_Private; NetworkTransferController::get().onUpload(UploadNetworkResourceRequestData{ .folderName = _folder, .resourceWithoutFolderName = _resourceName, .resourceDescription = _resourceDescription, .workspaceType = workspaceType, - .downloadCache = _browserWindow->getSimulationCache()}); + .downloadCache = _browserWindow->getSimulationCache(), + .data = data}); }