diff --git a/PlayWall/assets/de/tobias/playpad/assets/dialog/newProjectDialog.fxml b/PlayWall/assets/de/tobias/playpad/assets/dialog/newProjectDialog.fxml index f209b7e315ec0401af8b174d867a6bc170ea6843..080d8bb1bbe7618fb94f2f51a60c3b0a27e24616 100644 --- a/PlayWall/assets/de/tobias/playpad/assets/dialog/newProjectDialog.fxml +++ b/PlayWall/assets/de/tobias/playpad/assets/dialog/newProjectDialog.fxml @@ -13,6 +13,24 @@ <TextField fx:id="nameTextField" prefWidth="200.0" HBox.hgrow="ALWAYS" /> </children> </HBox> + <Separator prefWidth="200.0" /> + <HBox alignment="CENTER_LEFT" spacing="14.0"> + <children> + <Label alignment="CENTER_RIGHT" minWidth="100.0" prefWidth="100.0" text="%newProject.label.media" /> + <VBox spacing="14.0"> + <children> + <CheckBox fx:id="mediaPathCheckbox" mnemonicParsing="false" text="%newProject.checkbox.mediafolder" /> + <HBox alignment="CENTER_LEFT" spacing="14.0"> + <children> + <Button fx:id="mediaButtonChoose" minWidth="-Infinity" mnemonicParsing="false" onAction="#mediaButtonHandler" text="%newProject.button.media" /> + <Label fx:id="mediaPathLabel" textOverrun="CENTER_ELLIPSIS" HBox.hgrow="ALWAYS" /> + </children> + </HBox> + </children> + </VBox> + </children> + </HBox> + <Separator prefWidth="200.0" /> <HBox alignment="CENTER_LEFT" spacing="14.0"> <children> <Label alignment="CENTER_RIGHT" minWidth="100.0" prefWidth="100.0" text="%newProject.label.profile" HBox.hgrow="NEVER" /> diff --git a/PlayWall/assets/de/tobias/playpad/assets/lang/_de.properties b/PlayWall/assets/de/tobias/playpad/assets/lang/_de.properties index 9d1ef416099bc0f14fe5a98243cfd5bf81b02e33..4d8d70ce1861ba03463b4e7c68789e987cc74829 100644 --- a/PlayWall/assets/de/tobias/playpad/assets/lang/_de.properties +++ b/PlayWall/assets/de/tobias/playpad/assets/lang/_de.properties @@ -74,7 +74,8 @@ UI.Dialog.DragAndDrop.Button=OK UI.Dialog.NewProfile.Content=Geben Sie einen Namen f�r das neue Profil ein: # UI - Dialog - NewProject -UI.Dialog.NewProject.Content=Geben Sie einen Namen f�r das neue Projekt ein. +UI.Dialog.NewProject.Content=Geben Sie einen Namen f�r das neue Projekt ein: +UI.Dialog.NewProject.MediaPath=Sie m�ssen erst einen Ordner f�r die Mediendateien festlegen, bevor das Projekt erstellt werden kann. # UI - Dialog - Import UI.Dialog.Import.ReplaceProfile.Content=Es gibt bereits eine Profil mit dem Namen {}. Bitte geben Sie einen anderen Namen ein. diff --git a/PlayWall/assets/de/tobias/playpad/assets/lang/ui_de.properties b/PlayWall/assets/de/tobias/playpad/assets/lang/ui_de.properties index 811b3f9509d356ea77f17842abeee00da40740d5..347214a9facf30eb4cc963477a3785bf0c721af5 100644 --- a/PlayWall/assets/de/tobias/playpad/assets/lang/ui_de.properties +++ b/PlayWall/assets/de/tobias/playpad/assets/lang/ui_de.properties @@ -178,6 +178,10 @@ plugin.button.finish=Fertig settings.audio.type=Ausgabe Type w�hlen: newProject.label.name=Name: +newProject.label.media=Media Ordner: +newProject.checkbox.mediafolder=Media Ordner nutzen (Benutze Dateien werden dort hin kopiert) +newProject.button.media=Media Ordner w�hlen + newProject.label.profile=Profil: newProject.button.newProfile=Neues Profil... newProject.button.finish=Projekt erstellen diff --git a/PlayWall/src/de/tobias/playpad/Strings.java b/PlayWall/src/de/tobias/playpad/Strings.java index 7234c38e9af7f4ac4488865c2033ee586f12a52b..22a764fa04aa0e6f524a5140827f8f00acaab6b3 100644 --- a/PlayWall/src/de/tobias/playpad/Strings.java +++ b/PlayWall/src/de/tobias/playpad/Strings.java @@ -71,7 +71,8 @@ public class Strings { public static final String UI_Dialog_NewProfile_Content = "UI.Dialog.NewProfile.Content"; // UI - Dialog - NewProject - public static final String UI_Dialog_NewProject_Content = "UI.Dialog.NewProject.Content"; + public static final String UI_Dialog_NewProject_Content = "UI.Dialog.NewProject.Content"; // Duplicate Project + public static final String UI_Dialog_NewProject_Media = "UI.Dialog.NewProject.MediaPath"; // Create Project // UI - Dialog - Import public static final String UI_Dialog_Import_ReplaceProfile_Content = "UI.Dialog.Import.ReplaceProfile.Content"; @@ -169,9 +170,9 @@ public class Strings { public static final String Info_Mapper_PressKey = "Info.Mapper.PressKey"; // UI - Settings - Aler - + public static final String UI_Settings_Alert_NewKeyShortcut_Text = "UI.Settings.Alert.NewKeyShortcut.Text"; - + // UI - Window - PadSettings public static final String UI_Window_PadSettings_General_Title = "UI.Window.PadSettings.General.Title"; public static final String UI_Window_PadSettings_Player_Title = "UI.Window.PadSettings.Player.Title"; diff --git a/PlayWall/src/de/tobias/playpad/viewcontroller/dialog/NewProjectDialog.java b/PlayWall/src/de/tobias/playpad/viewcontroller/dialog/NewProjectDialog.java index 3a887b229e59c956c3f867761ca6f30de3e581af..21efdc3e312bba02de8e6f20e4eb3d2caaaf50ce 100644 --- a/PlayWall/src/de/tobias/playpad/viewcontroller/dialog/NewProjectDialog.java +++ b/PlayWall/src/de/tobias/playpad/viewcontroller/dialog/NewProjectDialog.java @@ -1,6 +1,8 @@ package de.tobias.playpad.viewcontroller.dialog; +import java.io.File; import java.io.IOException; +import java.nio.file.Path; import java.util.UUID; import org.dom4j.DocumentException; @@ -17,8 +19,11 @@ import de.tobias.utils.util.Localization; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.scene.control.Button; +import javafx.scene.control.CheckBox; import javafx.scene.control.ComboBox; +import javafx.scene.control.Label; import javafx.scene.control.TextField; +import javafx.stage.DirectoryChooser; import javafx.stage.Modality; import javafx.stage.Stage; import javafx.stage.Window; @@ -35,10 +40,16 @@ public class NewProjectDialog extends ViewController { @FXML private ComboBox<ProfileReference> profileComboBox; @FXML private Button newProfileButton; + // Media Path + @FXML private CheckBox mediaPathCheckbox; + @FXML private Button mediaButtonChoose; + @FXML private Label mediaPathLabel; + @FXML private Button finishButton; @FXML private Button cancelButton; private Project project; + private Path newMediaPath; // Ausgewählter Ordner (temp) public NewProjectDialog(Window owner) { super("newProjectDialog", "de/tobias/playpad/assets/dialog/", null, PlayPadMain.getUiResourceBundle()); @@ -66,6 +77,15 @@ public class NewProjectDialog extends ViewController { }); finishButton.setDisable(true); + mediaPathCheckbox.selectedProperty().addListener((a, b, c) -> + { + mediaButtonChoose.setDisable(!c); + if (!c) { + mediaPathLabel.setText(""); + newMediaPath = null; + } + }); + addCloseKeyShortcut(() -> getStage().close()); } @@ -75,10 +95,10 @@ public class NewProjectDialog extends ViewController { stage.setTitle(Localization.getString(Strings.UI_Dialog_NewProject_Title)); stage.setWidth(560); - stage.setHeight(250); + stage.setHeight(380); stage.setMinWidth(560); - stage.setMinHeight(250); + stage.setMinHeight(380); stage.setMaxWidth(560); @@ -87,17 +107,34 @@ public class NewProjectDialog extends ViewController { } } + @FXML + private void mediaButtonHandler(ActionEvent event) { + if (mediaPathCheckbox.isSelected()) { + DirectoryChooser chooser = new DirectoryChooser(); + File file = chooser.showDialog(getStage()); + if (file != null) { + newMediaPath = file.toPath(); + mediaPathLabel.setText(newMediaPath.toString()); + } + } + } + @FXML private void finishButtonHandler(ActionEvent evenet) { + if (mediaPathCheckbox.isSelected() && newMediaPath == null) { + showInfoMessage(Localization.getString(Strings.UI_Dialog_NewProject_Content)); + return; + } + try { Profile profile = Profile.load(profileComboBox.getSelectionModel().getSelectedItem()); - String name = nameTextField.getText(); UUID uuid = UUID.randomUUID(); ProjectReference projectReference = new ProjectReference(uuid, name, profile.getRef()); - project = new Project(projectReference); + project.getSettings().setUseMediaPath(mediaPathCheckbox.isSelected()); + project.getSettings().setMediaPath(newMediaPath); project.save(); ProjectReference.addProject(projectReference);