Skip to content

Commit

Permalink
ReopenProject implemented
Browse files Browse the repository at this point in the history
  • Loading branch information
crsib committed Feb 15, 2024
1 parent d77b712 commit 8f2bb1a
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion modules/mod-cloud-audiocom/CloudProjectUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "CloudSyncService.h"
#include "CodeConversions.h"
#include "Project.h"
#include "ProjectFileIO.h"
#include "ProjectFileManager.h"
#include "ProjectManager.h"
#include "ProjectWindow.h"
Expand All @@ -24,8 +25,8 @@

#include "ui/dialogs/LinkFailedDialog.h"
#include "ui/dialogs/ProjectVersionConflictDialog.h"
#include "ui/dialogs/UploadCanceledDialog.h"
#include "ui/dialogs/UpdateCloudPreviewDialog.h"
#include "ui/dialogs/UploadCanceledDialog.h"

#include "sync/LocalProjectSnapshot.h"
#include "sync/MixdownUploader.h"
Expand Down Expand Up @@ -295,7 +296,23 @@ bool ResaveLocally(AudacityProject& project)
// TODO: Delete the old file immediately?
return ProjectFileManager::Get(project).SaveAs();
}

void ReopenProject(AudacityProject& project)
{
auto& projectCloudExtension = ProjectCloudExtension::Get(project);

if (!projectCloudExtension.IsCloudProject())
return;

BasicUI::CallAfter(
[&project,
projectId = std::string(projectCloudExtension.GetCloudProjectId())]
{
auto newProject = ProjectManager::New();
ProjectWindow::Get(project).Close(true);
OpenProjectFromCloud(
newProject, projectId, {},
CloudSyncService::SyncMode::ForceOverwrite);
});
}
} // namespace cloud::audiocom::sync

0 comments on commit 8f2bb1a

Please sign in to comment.