diff --git a/application/src/main/java/nl/jixxed/eliteodysseymaterials/templates/settings/sections/General.java b/application/src/main/java/nl/jixxed/eliteodysseymaterials/templates/settings/sections/General.java index 3f85f711..d8363abc 100644 --- a/application/src/main/java/nl/jixxed/eliteodysseymaterials/templates/settings/sections/General.java +++ b/application/src/main/java/nl/jixxed/eliteodysseymaterials/templates/settings/sections/General.java @@ -1,6 +1,7 @@ package nl.jixxed.eliteodysseymaterials.templates.settings.sections; import javafx.application.Application; +import javafx.application.HostServices; import javafx.application.Platform; import javafx.scene.Node; import javafx.scene.control.Button; @@ -25,11 +26,13 @@ import nl.jixxed.eliteodysseymaterials.service.LocaleService; import nl.jixxed.eliteodysseymaterials.service.PreferencesService; import nl.jixxed.eliteodysseymaterials.service.RegistryService; +import nl.jixxed.eliteodysseymaterials.service.SupportService; import nl.jixxed.eliteodysseymaterials.service.event.*; import nl.jixxed.eliteodysseymaterials.templates.Template; import nl.jixxed.eliteodysseymaterials.templates.destroyables.DestroyableLabel; import java.io.File; +import java.nio.file.Path; import java.util.ArrayList; import java.util.List; import java.util.concurrent.Executors; @@ -93,9 +96,10 @@ public void initComponents() { final HBox blueprintExpandedSetting = createBlueprintExpandedSetting(); final HBox importFromClipboardSetting = createImportFromClipboardSetting(); final HBox importSlefFromClipboardSetting = createImportSlefFromClipboardSetting(); + final HBox supportPackageSetting = createSupportPackageSetting(); final HBox wipSetting = createWIPSetting(); this.getStyleClass().addAll("settingsblock", SETTINGS_SPACING_10_CLASS); - this.getChildren().addAll(generalLabel, langSetting, fontSetting, customJournalFolderSetting, pollSetting, urlSchemeLinkingSetting, exportInventory, blueprintExpandedSetting, importFromClipboardSetting,importSlefFromClipboardSetting); + this.getChildren().addAll(generalLabel, langSetting, fontSetting, customJournalFolderSetting, pollSetting, urlSchemeLinkingSetting, exportInventory, blueprintExpandedSetting, importFromClipboardSetting,importSlefFromClipboardSetting,supportPackageSetting); } @Override @@ -341,4 +345,18 @@ private HBox createImportSlefFromClipboardSetting() { .withNodes(importSlefClipboardLabel, importSlefClipboard, importSlefClipboardExplainLabel) .buildHBox(); } + private HBox createSupportPackageSetting() { + final DestroyableLabel supportPackageLabel = LabelBuilder.builder().withStyleClass(SETTINGS_LABEL_CLASS).withText(LocaleService.getStringBinding("settings.button.support.package")).build(); + final DestroyableLabel supportPackageExplainLabel = LabelBuilder.builder().withStyleClass(SETTINGS_LABEL_CLASS).withText(LocaleService.getStringBinding("settings.button.support.package.explain")).build(); + final Button supportPackage = ButtonBuilder.builder().withText(LocaleService.getStringBinding("settings.button.support.package.create")).withOnAction(event -> { + final String supportPackageFile = SupportService.createSupportPackage(); + HostServices host = application.getHostServices(); + host.showDocument(Path.of(supportPackageFile).toFile().getAbsoluteFile().getParent()); + + }).build(); + return BoxBuilder.builder() + .withStyleClasses(SETTINGS_JOURNAL_LINE_STYLE_CLASS, SETTINGS_SPACING_10_CLASS) + .withNodes(supportPackageLabel, supportPackage, supportPackageExplainLabel) + .buildHBox(); + } } diff --git a/application/src/main/resources/locale/tab.settings.csv b/application/src/main/resources/locale/tab.settings.csv index dd480306..9404916c 100644 --- a/application/src/main/resources/locale/tab.settings.csv +++ b/application/src/main/resources/locale/tab.settings.csv @@ -92,3 +92,6 @@ settings.button.import.clipboard.slef.explain,Import SLEF from the clipboard.,Im settings.button.import.clipboard.import.slef,Import SLEF,Import SLEF,Import SLEF,Importar SLEF,Importer SLEF,Importar SLEF,Импортировать SLEF tab.settings.notification.test,Test,Test,Test,Prueba,Test,Test,Тест tab.settings.notification.screen,Screen,Screen,Screen,Pantalla,Écran,Tela,Экран +settings.button.support.package,Support package,,,,,, +settings.button.support.package.create,Create,,,,,, +settings.button.support.package.explain,Creates a support package for the developer to assist in reproducing issues,,,,,, \ No newline at end of file