From 408dc186ad83c214ffe611796f3d98170adea2d7 Mon Sep 17 00:00:00 2001
From: Robert Goldmann <deadlocker@gmx.de>
Date: Thu, 2 Dec 2021 22:16:57 +0100
Subject: [PATCH] #157 - Removed calls to old setCustomDesign method

---
 .../playpad/layout/desktop/DesktopColorPickerView.java   | 4 ++--
 .../de/tobias/playpad/project/ProjectJsonReader.java     | 1 -
 .../src/main/java/de/tobias/playpad/pad/PadSettings.java | 9 ---------
 .../de/tobias/playpad/pad/PadSettingsSerializer.java     | 3 ---
 .../pad/settings/design/DesignUpdateListener.java        | 2 --
 5 files changed, 2 insertions(+), 17 deletions(-)

diff --git a/PlayWall/src/main/java/de/tobias/playpad/layout/desktop/DesktopColorPickerView.java b/PlayWall/src/main/java/de/tobias/playpad/layout/desktop/DesktopColorPickerView.java
index b71c1305..0e3de949 100644
--- a/PlayWall/src/main/java/de/tobias/playpad/layout/desktop/DesktopColorPickerView.java
+++ b/PlayWall/src/main/java/de/tobias/playpad/layout/desktop/DesktopColorPickerView.java
@@ -66,11 +66,11 @@ public class DesktopColorPickerView implements Consumer<DisplayableColor>, Event
 				PadSettings padSettings = pad.getPadSettings();
 
 				if (event.getButton() == MouseButton.PRIMARY) {
-					padSettings.setCustomDesign(true);
 					ModernCartDesign design = padSettings.getDesign();
+					design.setEnableCustomBackgroundColor(true);
 					colorModeHandler.setColor(design, selectedColor);
 				} else if (event.getButton() == MouseButton.SECONDARY) {
-					padSettings.setCustomDesign(false);
+					padSettings.getDesign().setEnableCustomBackgroundColor(false);
 				}
 				PlayPadMain.getProgramInstance().getMainViewController().loadUserCss();
 			}
diff --git a/PlayWall/src/main/java/de/tobias/playpad/project/ProjectJsonReader.java b/PlayWall/src/main/java/de/tobias/playpad/project/ProjectJsonReader.java
index 89c39e3e..29030b5a 100644
--- a/PlayWall/src/main/java/de/tobias/playpad/project/ProjectJsonReader.java
+++ b/PlayWall/src/main/java/de/tobias/playpad/project/ProjectJsonReader.java
@@ -78,7 +78,6 @@ public class ProjectJsonReader {
 			ModernCartDesign design = readModernCartDesign(pad, object.getJSONObject("design"));
 			if (design != null) {
 				pad.getPadSettings().setDesign(design);
-				pad.getPadSettings().setCustomDesign(true); // TODO Sync
 			}
 		}
 
diff --git a/PlayWallCore/src/main/java/de/tobias/playpad/pad/PadSettings.java b/PlayWallCore/src/main/java/de/tobias/playpad/pad/PadSettings.java
index 3ca40f91..8e8e3faf 100644
--- a/PlayWallCore/src/main/java/de/tobias/playpad/pad/PadSettings.java
+++ b/PlayWallCore/src/main/java/de/tobias/playpad/pad/PadSettings.java
@@ -35,7 +35,6 @@ public class PadSettings {
 	private ObjectProperty<Duration> warningProperty = new SimpleObjectProperty<>();
 	private ObjectProperty<Duration> cueInProperty = new SimpleObjectProperty<>();
 
-	private BooleanProperty customDesignProperty = new SimpleBooleanProperty(false);
 	private ModernCartDesign design;
 
 	private Map<TriggerPoint, Trigger> triggers = new EnumMap<>(TriggerPoint.class);
@@ -187,14 +186,6 @@ public class PadSettings {
 		return cueInProperty.get();
 	}
 
-	public void setCustomDesign(boolean customLayout) {
-		this.customDesignProperty.set(customLayout);
-	}
-
-	public BooleanProperty customDesignProperty() {
-		return customDesignProperty;
-	}
-
 	public ModernCartDesign getDesign() {
 		if (design == null) {
 			ModernCartDesign newDesign = new ModernCartDesign.ModernCartDesignBuilder(pad).build();
diff --git a/PlayWallCore/src/main/java/de/tobias/playpad/pad/PadSettingsSerializer.java b/PlayWallCore/src/main/java/de/tobias/playpad/pad/PadSettingsSerializer.java
index 3af4771b..f0854591 100644
--- a/PlayWallCore/src/main/java/de/tobias/playpad/pad/PadSettingsSerializer.java
+++ b/PlayWallCore/src/main/java/de/tobias/playpad/pad/PadSettingsSerializer.java
@@ -72,9 +72,6 @@ public class PadSettingsSerializer {
 		// Layout
 		Element designElement = settingsElement.element(DESIGN_ELEMENT);
 		if (designElement != null) {
-			if (designElement.attributeValue(CUSTOM_DESIGN_ELEMENT) != null) {
-				padSettings.setCustomDesign(Boolean.parseBoolean(designElement.attributeValue(CUSTOM_DESIGN_ELEMENT)));
-			}
 			ModernCartDesignSerializer serializer = new ModernCartDesignSerializer();
 			ModernCartDesign design = serializer.load(designElement, pad);
 			padSettings.setDesign(design);
diff --git a/PlayWallCore/src/main/java/de/tobias/playpad/server/sync/listener/downstream/pad/settings/design/DesignUpdateListener.java b/PlayWallCore/src/main/java/de/tobias/playpad/server/sync/listener/downstream/pad/settings/design/DesignUpdateListener.java
index fd06d289..47914b9c 100644
--- a/PlayWallCore/src/main/java/de/tobias/playpad/server/sync/listener/downstream/pad/settings/design/DesignUpdateListener.java
+++ b/PlayWallCore/src/main/java/de/tobias/playpad/server/sync/listener/downstream/pad/settings/design/DesignUpdateListener.java
@@ -41,13 +41,11 @@ public class DesignUpdateListener implements ServerListener {
 						if (field.equals(PropertyDef.DESIGN_BACKGROUND_COLOR)) {
 							Platform.runLater(() -> {
 								design.setBackgroundColor(color);
-								pad.getPadSettings().setCustomDesign(true);
 								mainViewController.loadUserCss();
 							});
 						} else if (field.equals(PropertyDef.DESIGN_PLAY_COLOR)) {
 							Platform.runLater(() -> {
 								design.setPlayColor(color);
-								pad.getPadSettings().setCustomDesign(true);
 								mainViewController.loadUserCss();
 							});
 						}
-- 
GitLab