Skip to content

Commit

Permalink
add support package generation on Settings tab
Browse files Browse the repository at this point in the history
  • Loading branch information
jixxed committed Aug 20, 2024
1 parent 819ca5d commit 3132296
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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();
}
}
3 changes: 3 additions & 0 deletions application/src/main/resources/locale/tab.settings.csv
Original file line number Diff line number Diff line change
Expand Up @@ -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,,,,,,

0 comments on commit 3132296

Please sign in to comment.