diff --git a/src/de/deadlocker8/budgetmaster/logic/Settings.java b/src/de/deadlocker8/budgetmaster/logic/Settings.java index eccef861d3f45a70046c46e716b2cfecd2572663..d903633dea5a5e07733ad852dbf4a703986b2fff 100644 --- a/src/de/deadlocker8/budgetmaster/logic/Settings.java +++ b/src/de/deadlocker8/budgetmaster/logic/Settings.java @@ -4,6 +4,7 @@ public class Settings { private String url; private String secret; + private boolean restActivated; public Settings() { @@ -29,4 +30,14 @@ public class Settings { this.secret = secret; } + + public boolean isRestActivated() + { + return restActivated; + } + + public void setRestActivated(boolean restActivated) + { + this.restActivated = restActivated; + } } \ No newline at end of file diff --git a/src/de/deadlocker8/budgetmaster/ui/SettingsController.java b/src/de/deadlocker8/budgetmaster/ui/SettingsController.java index c4dfcf25ac90cc4c9a3cea9d56f3e1beb738e2cb..fd684c6536f701f3f855db44e77026ee37f244cd 100644 --- a/src/de/deadlocker8/budgetmaster/ui/SettingsController.java +++ b/src/de/deadlocker8/budgetmaster/ui/SettingsController.java @@ -6,7 +6,9 @@ import javafx.fxml.FXML; import javafx.scene.control.Alert.AlertType; import javafx.scene.control.Button; import javafx.scene.control.Label; +import javafx.scene.control.RadioButton; import javafx.scene.control.TextField; +import javafx.scene.control.ToggleGroup; import javafx.scene.layout.AnchorPane; import tools.AlertGenerator; @@ -18,6 +20,8 @@ public class SettingsController @FXML private TextField textFieldSecret; @FXML private Label labelSecret; @FXML private Button buttonSave; + @FXML private RadioButton radioButtonRestActivated; + @FXML private RadioButton radioButtonRestDeactivated; private Controller controller; @@ -28,6 +32,14 @@ public class SettingsController { textFieldURL.setText(controller.getSettings().getUrl()); textFieldSecret.setText(controller.getSettings().getSecret()); + if(controller.getSettings().isRestActivated()) + { + radioButtonRestActivated.setSelected(true); + } + else + { + radioButtonRestDeactivated.setSelected(true); + } } anchorPaneMain.setStyle("-fx-background-color: #F4F4F4;"); @@ -35,6 +47,10 @@ public class SettingsController labelURL.setStyle("-fx-text-fill: " + controller.getBundle().getString("color.text")); buttonSave.setStyle("-fx-background-color: #2E79B9; -fx-text-fill: white; -fx-font-weight: bold; -fx-font-size: 16;"); textFieldURL.setPromptText("z.B. https://yourdomain.de"); + + ToggleGroup toggleGroup = new ToggleGroup(); + radioButtonRestActivated.setToggleGroup(toggleGroup); + radioButtonRestDeactivated.setToggleGroup(toggleGroup); } public void save() @@ -48,13 +64,15 @@ public class SettingsController if(controller.getSettings() != null) { controller.getSettings().setUrl(url); - controller.getSettings().setSecret(secret); + controller.getSettings().setSecret(secret); + controller.getSettings().setRestActivated(radioButtonRestActivated.isSelected()); } else { Settings settings = new Settings(); settings.setUrl(url); settings.setSecret(secret); + settings.setRestActivated(radioButtonRestActivated.isSelected()); controller.setSettings(settings); } Utils.saveSettings(controller.getSettings()); diff --git a/src/de/deadlocker8/budgetmaster/ui/SettingsTab.fxml b/src/de/deadlocker8/budgetmaster/ui/SettingsTab.fxml index baaca0685a533add8fa9041073df83ffddfa51d9..23a7c13a1b20f5cedc09e67d3b596903cb0d31c3 100644 --- a/src/de/deadlocker8/budgetmaster/ui/SettingsTab.fxml +++ b/src/de/deadlocker8/budgetmaster/ui/SettingsTab.fxml @@ -3,6 +3,7 @@ <?import javafx.geometry.Insets?> <?import javafx.scene.control.Button?> <?import javafx.scene.control.Label?> +<?import javafx.scene.control.RadioButton?> <?import javafx.scene.control.TextField?> <?import javafx.scene.layout.AnchorPane?> <?import javafx.scene.layout.HBox?> @@ -30,6 +31,11 @@ <Font name="System Bold" size="16.0" /> </font> </Label> + <Label fx:id="labelSecret1" prefHeight="25.0" text="Übertrag:"> + <font> + <Font name="System Bold" size="16.0" /> + </font> + </Label> </children> <HBox.margin> <Insets right="25.0" /> @@ -39,6 +45,23 @@ <children> <TextField fx:id="textFieldURL" /> <TextField fx:id="textFieldSecret" /> + <HBox alignment="CENTER" prefHeight="100.0" prefWidth="200.0"> + <children> + <RadioButton fx:id="radioButtonRestActivated" maxWidth="1.7976931348623157E308" mnemonicParsing="false" text="aktiviert"> + <font> + <Font size="14.0" /> + </font> + <HBox.margin> + <Insets right="30.0" /> + </HBox.margin> + </RadioButton> + <RadioButton fx:id="radioButtonRestDeactivated" maxWidth="1.7976931348623157E308" mnemonicParsing="false" text="deaktiviert" HBox.hgrow="ALWAYS"> + <font> + <Font size="14.0" /> + </font> + </RadioButton> + </children> + </HBox> </children> </VBox> </children>