fix: When exporting games the export dialog is shown before old directories are deleted.

Deleting from a USB stick can take a long time, the dialog was not shown before the delete was finished.
This commit is contained in:
lantzelot-swe 2022-01-02 18:11:35 +01:00
parent c42033719d
commit 1debbe348f
3 changed files with 16 additions and 12 deletions

View File

@ -954,8 +954,8 @@ public class MenuManager
if (!viewList.isEmpty())
{
exportManager.setGameViewsToExport(viewList);
exportManager.setTargetDirectory(exportSelectionDialog.getTargetDirectory(),
exportSelectionDialog.deleteBeforeExport());
exportManager.setDeleteBeforeExport(exportSelectionDialog.deleteBeforeExport());
exportManager.setTargetDirectory(exportSelectionDialog.getTargetDirectory());
ImportExportProgressDialog dialog = new ImportExportProgressDialog(this.mainWindow, "Export games", false);
ExportWorker worker = new ExportWorker(exportManager, dialog);
worker.execute();
@ -968,8 +968,8 @@ public class MenuManager
if (!gamesList.isEmpty())
{
exportManager.setGamesToExport(gamesList);
exportManager.setTargetDirectory(exportSelectionDialog.getTargetDirectory(),
exportSelectionDialog.deleteBeforeExport());
exportManager.setDeleteBeforeExport(exportSelectionDialog.deleteBeforeExport());
exportManager.setTargetDirectory(exportSelectionDialog.getTargetDirectory());
ImportExportProgressDialog dialog = new ImportExportProgressDialog(this.mainWindow, "Export games", false);
ExportWorker worker = new ExportWorker(exportManager, dialog);
worker.execute();
@ -992,8 +992,8 @@ public class MenuManager
if (!viewList.isEmpty())
{
exportManager.setGameViewsToExport(viewList);
exportManager.setTargetDirectory(exportSelectionDialog.getTargetDirectory(),
exportSelectionDialog.deleteBeforeExport());
exportManager.setDeleteBeforeExport(exportSelectionDialog.deleteBeforeExport());
exportManager.setTargetDirectory(exportSelectionDialog.getTargetDirectory());
ImportExportProgressDialog dialog = new ImportExportProgressDialog(this.mainWindow, "Export games", false);
ExportFileLoaderWorker worker = new ExportFileLoaderWorker(exportManager, dialog);
worker.execute();
@ -1006,8 +1006,8 @@ public class MenuManager
if (!gamesList.isEmpty())
{
exportManager.setGamesToExport(gamesList);
exportManager.setTargetDirectory(exportSelectionDialog.getTargetDirectory(),
exportSelectionDialog.deleteBeforeExport());
exportManager.setDeleteBeforeExport(exportSelectionDialog.deleteBeforeExport());
exportManager.setTargetDirectory(exportSelectionDialog.getTargetDirectory());
ImportExportProgressDialog dialog = new ImportExportProgressDialog(this.mainWindow, "Export games", false);
ExportFileLoaderWorker worker = new ExportFileLoaderWorker(exportManager, dialog);
worker.execute();

View File

@ -24,8 +24,10 @@ public class ExportFileLoaderWorker extends SwingWorker<Void, String>
{
if (exportManager.isDeleteBeforeExport())
{
publish("Deleting existing games before exporting.\n");
publish("Deleting existing games before exporting...\n");
exportManager.deleteBeforeExport();
}
exportManager.createDirectoriesBeforeExport();
publish("Exporting from db...");
StringBuilder infoBuilder = new StringBuilder();
exportManager.readFromDb(infoBuilder);
@ -34,7 +36,7 @@ public class ExportFileLoaderWorker extends SwingWorker<Void, String>
infoBuilder = new StringBuilder();
exportManager.createGameInfoFiles(infoBuilder, true);
publish(infoBuilder.toString());
publish("Copy game files...");
publish("Copying game files...");
infoBuilder = new StringBuilder();
exportManager.copyGamesForFileLoader(infoBuilder);
publish(infoBuilder.toString());

View File

@ -24,8 +24,10 @@ public class ExportWorker extends SwingWorker<Void, String>
{
if (exportManager.isDeleteBeforeExport())
{
publish("Deleting existing games before exporting.\n");
publish("Deleting existing games before exporting...\n");
exportManager.deleteBeforeExport();
}
exportManager.createDirectoriesBeforeExport();
publish("Exporting from db...");
StringBuilder infoBuilder = new StringBuilder();
exportManager.readFromDb(infoBuilder);
@ -34,7 +36,7 @@ public class ExportWorker extends SwingWorker<Void, String>
infoBuilder = new StringBuilder();
exportManager.createGameInfoFiles(infoBuilder, false);
publish(infoBuilder.toString());
publish("Copy screenshots, covers and game files...");
publish("Copying screenshots, covers and game files...");
infoBuilder = new StringBuilder();
exportManager.copyFilesForCarousel(infoBuilder);
publish(infoBuilder.toString());