From 254440194f0815a905a10775ab712c7c094a3efe Mon Sep 17 00:00:00 2001
From: tobias <tobias.ullerich@icloud.com>
Date: Tue, 16 Aug 2016 10:00:53 +0200
Subject: [PATCH] Move Live Settings and Cache to GlobalSettings

Removed Bug from Update Tests
---
 .../{profile => global}/generalTab.fxml       |   0
 .../playpad/audio/ClipAudioHandler.java       |   6 +-
 .../playpad/audio/TinyAudioHandler.java       |  13 ++-
 .../DesktopMenuToolbarViewController.java     |   4 +-
 .../desktop/DesktopPadViewController.java     |   8 +-
 .../main/BasicMenuToolbarViewController.java  |   6 +-
 .../main/MainViewControllerV2.java            |   3 +-
 .../global/GlobalSettingsViewController.java  |   2 +
 .../profile/GeneralTabViewController.java     |  56 ++++-----
 .../ProfileSettingsViewController.java        |   1 -
 .../viewcontroller/pad/PadDragListener.java   |  13 ++-
 .../playpad/settings/GlobalSettings.java      | 107 ++++++++++++++++++
 .../playpad/settings/ProfileSettings.java     | 102 +----------------
 .../playpad/update/UpdateRegistery.java       |   2 +-
 14 files changed, 176 insertions(+), 147 deletions(-)
 rename PlayWall/assets/de/tobias/playpad/assets/view/option/{profile => global}/generalTab.fxml (100%)

diff --git a/PlayWall/assets/de/tobias/playpad/assets/view/option/profile/generalTab.fxml b/PlayWall/assets/de/tobias/playpad/assets/view/option/global/generalTab.fxml
similarity index 100%
rename from PlayWall/assets/de/tobias/playpad/assets/view/option/profile/generalTab.fxml
rename to PlayWall/assets/de/tobias/playpad/assets/view/option/global/generalTab.fxml
diff --git a/PlayWall/src/de/tobias/playpad/audio/ClipAudioHandler.java b/PlayWall/src/de/tobias/playpad/audio/ClipAudioHandler.java
index 2da8971e..235b0455 100644
--- a/PlayWall/src/de/tobias/playpad/audio/ClipAudioHandler.java
+++ b/PlayWall/src/de/tobias/playpad/audio/ClipAudioHandler.java
@@ -18,11 +18,12 @@ import javax.sound.sampled.DataLine.Info;
 import javax.sound.sampled.FloatControl;
 import javax.sound.sampled.Mixer;
 
+import de.tobias.playpad.PlayPadPlugin;
 import de.tobias.playpad.pad.Pad;
 import de.tobias.playpad.pad.PadStatus;
 import de.tobias.playpad.pad.conntent.PadContent;
 import de.tobias.playpad.pad.content.AudioContent;
-import de.tobias.playpad.settings.Profile;
+import de.tobias.playpad.settings.GlobalSettings;
 import de.tobias.utils.util.FileUtils;
 import javafx.application.Platform;
 import javafx.beans.property.ObjectProperty;
@@ -210,7 +211,8 @@ public class ClipAudioHandler extends AudioHandler {
 
 			// Convert wenn mp3
 			if (FileUtils.getFileExtention(url.getFile()).toLowerCase().endsWith(MP3)) {
-				Path wavPath = Profile.currentProfile().getProfileSettings().getCachePath().resolve(path.getFileName().toString() + ".wav");
+				GlobalSettings globalSettings = PlayPadPlugin.getImplementation().getGlobalSettings();
+				Path wavPath = globalSettings.getCachePath().resolve(path.getFileName().toString() + ".wav");
 				url = convertMp3ToWav(path, wavPath, getContent().getPad());
 			}
 
diff --git a/PlayWall/src/de/tobias/playpad/audio/TinyAudioHandler.java b/PlayWall/src/de/tobias/playpad/audio/TinyAudioHandler.java
index 8c412a0e..c25c2f83 100644
--- a/PlayWall/src/de/tobias/playpad/audio/TinyAudioHandler.java
+++ b/PlayWall/src/de/tobias/playpad/audio/TinyAudioHandler.java
@@ -18,10 +18,12 @@ import javax.sound.sampled.LineUnavailableException;
 import javax.sound.sampled.Mixer.Info;
 import javax.sound.sampled.UnsupportedAudioFileException;
 
+import de.tobias.playpad.PlayPadPlugin;
 import de.tobias.playpad.pad.Pad;
 import de.tobias.playpad.pad.PadStatus;
 import de.tobias.playpad.pad.conntent.PadContent;
 import de.tobias.playpad.pad.content.AudioContent;
+import de.tobias.playpad.settings.GlobalSettings;
 import de.tobias.playpad.settings.Profile;
 import de.tobias.utils.util.FileUtils;
 import javafx.application.Platform;
@@ -40,10 +42,10 @@ public class TinyAudioHandler extends AudioHandler {
 
 	public static final String SOUND_CARD = "SoundCard";
 
-	public static final String TYPE = "TinyAudio"; 
+	public static final String TYPE = "TinyAudio";
 	public static final String NAME = "Java Audiostream";
 	private static final String MP3 = "mp3";
-	
+
 	private static final int SLEEP_TIME_POSITION = 50;
 
 	private static ExecutorService executorService;
@@ -96,7 +98,9 @@ public class TinyAudioHandler extends AudioHandler {
 					}
 
 					Thread.sleep(SLEEP_TIME_POSITION);
-				} catch (InterruptedException e) {} catch (ConcurrentModificationException e) {} catch (Exception e) {
+				} catch (InterruptedException e) {
+				} catch (ConcurrentModificationException e) {
+				} catch (Exception e) {
 					e.printStackTrace();
 				}
 			}
@@ -228,7 +232,8 @@ public class TinyAudioHandler extends AudioHandler {
 
 				// Convert wenn mp3
 				if (FileUtils.getFileExtention(url.getFile()).toLowerCase().endsWith(MP3)) {
-					Path wavPath = Profile.currentProfile().getProfileSettings().getCachePath().resolve(path.getFileName().toString() + ".wav");
+					GlobalSettings globalSettings = PlayPadPlugin.getImplementation().getGlobalSettings();
+					Path wavPath = globalSettings.getCachePath().resolve(path.getFileName().toString() + ".wav");
 					url = convertMp3ToWav(path, wavPath, getContent().getPad());
 				}
 
diff --git a/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopMenuToolbarViewController.java b/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopMenuToolbarViewController.java
index 837bd019..745090a6 100644
--- a/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopMenuToolbarViewController.java
+++ b/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopMenuToolbarViewController.java
@@ -431,7 +431,7 @@ public class DesktopMenuToolbarViewController extends BasicMenuToolbarViewContro
 	@FXML
 	void dndModeHandler(ActionEvent event) {
 		if (dndModeMenuItem.isSelected()) {
-			ProfileSettings settings = Profile.currentProfile().getProfileSettings();
+			GlobalSettings settings = PlayPadPlugin.getImplementation().getGlobalSettings();
 			Project currentProject = PlayPadMain.getProgramInstance().getCurrentProject();
 
 			if (settings.isLiveMode() && settings.isLiveModeDrag() && currentProject.getPlayedPlayers() > 0) {
@@ -501,7 +501,7 @@ public class DesktopMenuToolbarViewController extends BasicMenuToolbarViewContro
 		Midi midi = Midi.getInstance();
 		Project currentProject = PlayPadMain.getProgramInstance().getCurrentProject();
 
-		ProfileSettings settings = Profile.currentProfile().getProfileSettings();
+		GlobalSettings settings = PlayPadPlugin.getImplementation().getGlobalSettings();
 
 		if (settings.isLiveMode() && settings.isLiveModeSettings() && currentProject.getPlayedPlayers() > 0) {
 			mainViewController.showLiveInfo();
diff --git a/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopPadViewController.java b/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopPadViewController.java
index 0ae505cf..e58c3935 100644
--- a/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopPadViewController.java
+++ b/PlayWall/src/de/tobias/playpad/layout/desktop/DesktopPadViewController.java
@@ -22,6 +22,7 @@ import de.tobias.playpad.pad.listener.PadStatusListener;
 import de.tobias.playpad.pad.view.IPadViewV2;
 import de.tobias.playpad.pad.viewcontroller.IPadViewControllerV2;
 import de.tobias.playpad.registry.NoSuchComponentException;
+import de.tobias.playpad.settings.GlobalSettings;
 import de.tobias.playpad.settings.Profile;
 import de.tobias.playpad.settings.ProfileSettings;
 import de.tobias.playpad.view.FileDragOptionView;
@@ -67,7 +68,8 @@ public class DesktopPadViewController implements IPadViewControllerV2, EventHand
 		padDurationListener = new PadDurationListener(this);
 		padPositionListener = new PadPositionListener(this);
 
-		// Listener muss nur einmal hier hinzugefügt werden, weil bei einem neuen Profile, werden neue PadViewController erzeugt
+		// Listener muss nur einmal hier hinzugefügt werden, weil bei einem neuen Profile, werden neue PadViewController
+		// erzeugt
 		ProfileSettings profileSettings = Profile.currentProfile().getProfileSettings();
 		profileSettings.lockedProperty().addListener(padLockedListener);
 	}
@@ -187,7 +189,7 @@ public class DesktopPadViewController implements IPadViewControllerV2, EventHand
 	}
 
 	private void onNew(ActionEvent event) throws NoSuchComponentException {
-		ProfileSettings settings = Profile.currentProfile().getProfileSettings();
+		GlobalSettings settings = PlayPadPlugin.getImplementation().getGlobalSettings();
 		if (pad.getProject() != null) {
 			if (settings.isLiveMode() && settings.isLiveModeFile() && pad.getProject().getPlayedPlayers() > 0) {
 				PlayPadPlugin.getImplementation().getMainViewController().showLiveInfo();
@@ -252,7 +254,7 @@ public class DesktopPadViewController implements IPadViewControllerV2, EventHand
 	}
 
 	private void onSettings() {
-		ProfileSettings settings = Profile.currentProfile().getProfileSettings();
+		GlobalSettings settings = PlayPadPlugin.getImplementation().getGlobalSettings();
 		IMainViewController mvc = PlayPadPlugin.getImplementation().getMainViewController();
 
 		if (mvc != null) {
diff --git a/PlayWall/src/de/tobias/playpad/viewcontroller/main/BasicMenuToolbarViewController.java b/PlayWall/src/de/tobias/playpad/viewcontroller/main/BasicMenuToolbarViewController.java
index 04fbb3fd..ffc8d214 100644
--- a/PlayWall/src/de/tobias/playpad/viewcontroller/main/BasicMenuToolbarViewController.java
+++ b/PlayWall/src/de/tobias/playpad/viewcontroller/main/BasicMenuToolbarViewController.java
@@ -3,8 +3,9 @@ package de.tobias.playpad.viewcontroller.main;
 import java.util.ResourceBundle;
 
 import de.tobias.playpad.PlayPadMain;
+import de.tobias.playpad.PlayPadPlugin;
 import de.tobias.playpad.project.Project;
-import de.tobias.playpad.settings.Profile;
+import de.tobias.playpad.settings.GlobalSettings;
 import de.tobias.playpad.settings.keys.Key;
 import de.tobias.utils.ui.icon.FontAwesomeType;
 import de.tobias.utils.ui.icon.FontIcon;
@@ -57,7 +58,8 @@ public abstract class BasicMenuToolbarViewController extends MenuToolbarViewCont
 	// Utils
 	protected void doAction(Runnable run) {
 		Project project = PlayPadMain.getProgramInstance().getCurrentProject();
-		if (project.getPlayedPlayers() > 0 && Profile.currentProfile().getProfileSettings().isLiveMode()) {
+		GlobalSettings globalSettings = PlayPadPlugin.getImplementation().getGlobalSettings();
+		if (project.getPlayedPlayers() > 0 && globalSettings.isLiveMode()) {
 			mainViewController.showLiveInfo();
 		} else {
 			run.run();
diff --git a/PlayWall/src/de/tobias/playpad/viewcontroller/main/MainViewControllerV2.java b/PlayWall/src/de/tobias/playpad/viewcontroller/main/MainViewControllerV2.java
index 0025fa6d..455ffe04 100644
--- a/PlayWall/src/de/tobias/playpad/viewcontroller/main/MainViewControllerV2.java
+++ b/PlayWall/src/de/tobias/playpad/viewcontroller/main/MainViewControllerV2.java
@@ -276,10 +276,11 @@ public class MainViewControllerV2 extends ViewController implements IMainViewCon
 
 		if (Profile.currentProfile() != null) {
 			ProfileSettings profilSettings = Profile.currentProfile().getProfileSettings();
+			GlobalSettings globalSettings = PlayPadPlugin.getImplementation().getGlobalSettings();
 
 			// Frag den Nutzer ob das Programm wirdklich geschlossen werden sol
 			// wenn ein Pad noch im Status Play ist
-			if (openProject.getPlayedPlayers() > 0 && profilSettings.isLiveMode()) {
+			if (openProject.getPlayedPlayers() > 0 && globalSettings.isLiveMode()) {
 				Alert alert = new Alert(AlertType.CONFIRMATION);
 				alert.setContentText(Localization.getString(Strings.UI_Window_Main_CloseRequest));
 
diff --git a/PlayWall/src/de/tobias/playpad/viewcontroller/option/global/GlobalSettingsViewController.java b/PlayWall/src/de/tobias/playpad/viewcontroller/option/global/GlobalSettingsViewController.java
index 6534d297..71744916 100644
--- a/PlayWall/src/de/tobias/playpad/viewcontroller/option/global/GlobalSettingsViewController.java
+++ b/PlayWall/src/de/tobias/playpad/viewcontroller/option/global/GlobalSettingsViewController.java
@@ -10,6 +10,7 @@ import de.tobias.playpad.settings.GlobalSettings;
 import de.tobias.playpad.settings.Profile;
 import de.tobias.playpad.viewcontroller.option.GlobalSettingsTabViewController;
 import de.tobias.playpad.viewcontroller.option.IGlobalSettingsViewController;
+import de.tobias.playpad.viewcontroller.option.profile.GeneralTabViewController;
 import de.tobias.utils.ui.ViewController;
 import de.tobias.utils.util.Localization;
 import javafx.event.ActionEvent;
@@ -37,6 +38,7 @@ public class GlobalSettingsViewController extends ViewController implements IGlo
 
 		getStage().initOwner(owner);
 
+		addTab(new GeneralTabViewController(this));
 		addTab(new KeysTabViewController());
 		addTab(new UpdateTabViewController());
 
diff --git a/PlayWall/src/de/tobias/playpad/viewcontroller/option/profile/GeneralTabViewController.java b/PlayWall/src/de/tobias/playpad/viewcontroller/option/profile/GeneralTabViewController.java
index ee877030..406d947c 100644
--- a/PlayWall/src/de/tobias/playpad/viewcontroller/option/profile/GeneralTabViewController.java
+++ b/PlayWall/src/de/tobias/playpad/viewcontroller/option/profile/GeneralTabViewController.java
@@ -2,15 +2,16 @@ package de.tobias.playpad.viewcontroller.option.profile;
 
 import java.io.File;
 import java.io.IOException;
+import java.nio.file.DirectoryStream;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
 
 import de.tobias.playpad.PlayPadMain;
+import de.tobias.playpad.PlayPadPlugin;
 import de.tobias.playpad.Strings;
-import de.tobias.playpad.settings.Profile;
-import de.tobias.playpad.settings.ProfileSettings;
-import de.tobias.playpad.viewcontroller.option.ProfileSettingsTabViewController;
+import de.tobias.playpad.settings.GlobalSettings;
+import de.tobias.playpad.viewcontroller.option.GlobalSettingsTabViewController;
 import de.tobias.utils.application.ApplicationUtils;
 import de.tobias.utils.application.container.PathType;
 import de.tobias.utils.ui.Alertable;
@@ -25,7 +26,7 @@ import javafx.scene.control.TextField;
 import javafx.scene.control.ToggleGroup;
 import javafx.stage.DirectoryChooser;
 
-public class GeneralTabViewController extends ProfileSettingsTabViewController {
+public class GeneralTabViewController extends GlobalSettingsTabViewController {
 
 	@FXML private CheckBox liveModeCheckBox;
 
@@ -50,7 +51,7 @@ public class GeneralTabViewController extends ProfileSettingsTabViewController {
 	private Alertable alertable;
 
 	public GeneralTabViewController(Alertable alertable) {
-		super("generalTab", "de/tobias/playpad/assets/view/option/profile/", PlayPadMain.getUiResourceBundle());
+		super("generalTab", "de/tobias/playpad/assets/view/option/global/", PlayPadMain.getUiResourceBundle());
 		this.alertable = alertable;
 
 		calcCacheSize();
@@ -90,7 +91,8 @@ public class GeneralTabViewController extends ProfileSettingsTabViewController {
 		File folder = chooser.showDialog(getStage());
 		if (folder != null) {
 			Path folderPath = folder.toPath();
-			Profile.currentProfile().getProfileSettings().setCachePath(folderPath);
+			GlobalSettings globalSettings = PlayPadPlugin.getImplementation().getGlobalSettings();
+			globalSettings.setCachePath(folderPath);
 			cacheTextField.setText(folderPath.toString());
 		}
 	}
@@ -126,13 +128,16 @@ public class GeneralTabViewController extends ProfileSettingsTabViewController {
 	private void calcCacheSize() {
 		try {
 			double size = 0;
-			Path path = Profile.currentProfile().getProfileSettings().getCachePath();
+			GlobalSettings globalSettings = PlayPadPlugin.getImplementation().getGlobalSettings();
+			Path path = globalSettings.getCachePath();
 			if (Files.notExists(path))
 				Files.createDirectories(path);
 
-			for (Path item : Files.newDirectoryStream(Profile.currentProfile().getProfileSettings().getCachePath())) {
+			DirectoryStream<Path> directoryStream = Files.newDirectoryStream(globalSettings.getCachePath());
+			for (Path item : directoryStream) {
 				size += Files.size(item);
 			}
+			directoryStream.close();
 			cacheSizeLabel.setText(Localization.getString(Strings.UI_Window_Settings_Gen_CacheSize, NumberUtils.numberToString(size)));
 		} catch (IOException e) {
 			e.printStackTrace();
@@ -141,46 +146,43 @@ public class GeneralTabViewController extends ProfileSettingsTabViewController {
 	}
 
 	@Override
-	public void loadSettings(Profile profile) {
-		ProfileSettings profileSettings = profile.getProfileSettings();
+	public void loadSettings(GlobalSettings settings) {
 
-		liveModeCheckBox.setSelected(profileSettings.isLiveMode());
-		cacheTextField.setText(profileSettings.getCachePath().toString());
+		liveModeCheckBox.setSelected(settings.isLiveMode());
+		cacheTextField.setText(settings.getCachePath().toString());
 
-		if (profileSettings.isLiveModePage() == true)
+		if (settings.isLiveModePage() == true)
 			pageEnable.setSelected(true);
 		else
 			pageDisable.setSelected(true);
 
-		if (profileSettings.isLiveModeDrag() == true)
+		if (settings.isLiveModeDrag() == true)
 			dragEnable.setSelected(true);
 		else
 			dragDisable.setSelected(true);
 
-		if (profileSettings.isLiveModeFile() == true)
+		if (settings.isLiveModeFile() == true)
 			fileEnable.setSelected(true);
 		else
 			fileDisable.setSelected(true);
 
-		if (profileSettings.isLiveModeSettings() == true)
+		if (settings.isLiveModeSettings() == true)
 			settingsEnable.setSelected(true);
 		else
 			settingsDisable.setSelected(true);
 
-		disableLiveSettings(profileSettings.isLiveMode());
+		disableLiveSettings(settings.isLiveMode());
 	}
 
 	@Override
-	public void saveSettings(Profile profile) {
-		ProfileSettings profileSettings = profile.getProfileSettings();
-
-		profileSettings.setLiveMode(liveModeCheckBox.isSelected());
-		profileSettings.setCachePath(Paths.get(cacheTextField.getText()));
-
-		profileSettings.setLiveModePage(pageEnable.isSelected());
-		profileSettings.setLiveModeDrag(dragEnable.isSelected());
-		profileSettings.setLiveModeFile(fileEnable.isSelected());
-		profileSettings.setLiveModeSettings(settingsEnable.isSelected());
+	public void saveSettings(GlobalSettings settings) {
+		settings.setLiveMode(liveModeCheckBox.isSelected());
+		settings.setCachePath(Paths.get(cacheTextField.getText()));
+
+		settings.setLiveModePage(pageEnable.isSelected());
+		settings.setLiveModeDrag(dragEnable.isSelected());
+		settings.setLiveModeFile(fileEnable.isSelected());
+		settings.setLiveModeSettings(settingsEnable.isSelected());
 	}
 
 	@Override
diff --git a/PlayWall/src/de/tobias/playpad/viewcontroller/option/profile/ProfileSettingsViewController.java b/PlayWall/src/de/tobias/playpad/viewcontroller/option/profile/ProfileSettingsViewController.java
index e24d1316..9b74262c 100644
--- a/PlayWall/src/de/tobias/playpad/viewcontroller/option/profile/ProfileSettingsViewController.java
+++ b/PlayWall/src/de/tobias/playpad/viewcontroller/option/profile/ProfileSettingsViewController.java
@@ -44,7 +44,6 @@ public class ProfileSettingsViewController extends ViewController implements IPr
 
 		boolean activePlayer = project.hasPlayedPlayers();
 
-		addTab(new GeneralTabViewController(this));
 		addTab(new MappingTabViewController());
 		addTab(new MidiTabViewController());
 		addTab(new DesignTabViewController());
diff --git a/PlayWall/src/de/tobias/playpad/viewcontroller/pad/PadDragListener.java b/PlayWall/src/de/tobias/playpad/viewcontroller/pad/PadDragListener.java
index 2c86eb3a..9a43a47f 100644
--- a/PlayWall/src/de/tobias/playpad/viewcontroller/pad/PadDragListener.java
+++ b/PlayWall/src/de/tobias/playpad/viewcontroller/pad/PadDragListener.java
@@ -13,8 +13,8 @@ import de.tobias.playpad.pad.drag.PadDragMode;
 import de.tobias.playpad.pad.view.IPadViewV2;
 import de.tobias.playpad.project.Project;
 import de.tobias.playpad.registry.NoSuchComponentException;
+import de.tobias.playpad.settings.GlobalSettings;
 import de.tobias.playpad.settings.Profile;
-import de.tobias.playpad.settings.ProfileSettings;
 import de.tobias.playpad.view.FileDragOptionView;
 import de.tobias.playpad.view.PadDragOptionView;
 import de.tobias.utils.util.FileUtils;
@@ -58,9 +58,11 @@ public class PadDragListener {
 
 		if (event.getGestureSource() != this && event.getDragboard().hasFiles()) {
 			if (event.getDragboard().getFiles().get(0).isFile()) {
-				ProfileSettings settings = Profile.currentProfile().getProfileSettings();
+
+				GlobalSettings globalSettings = PlayPadPlugin.getImplementation().getGlobalSettings();
+
 				if (sourcePad.getProject() != null) {
-					if (settings.isLiveMode() && settings.isLiveModeFile() && sourcePad.getProject().getPlayedPlayers() > 0) {
+					if (globalSettings.isLiveMode() && globalSettings.isLiveModeFile() && sourcePad.getProject().getPlayedPlayers() > 0) {
 						PlayPadPlugin.getImplementation().getMainViewController().showLiveInfo();
 						return;
 					}
@@ -165,9 +167,10 @@ public class PadDragListener {
 
 	private void dragDetacted(MouseEvent event) {
 		if (dndMode) {
-			ProfileSettings settings = Profile.currentProfile().getProfileSettings();
+			GlobalSettings globalSettings = PlayPadPlugin.getImplementation().getGlobalSettings();
+
 			if (sourcePad.getProject() != null) {
-				if (settings.isLiveMode() && settings.isLiveModeDrag() && sourcePad.getProject().getPlayedPlayers() > 0) {
+				if (globalSettings.isLiveMode() && globalSettings.isLiveModeDrag() && sourcePad.getProject().getPlayedPlayers() > 0) {
 					PlayPadPlugin.getImplementation().getMainViewController().showLiveInfo();
 					return;
 				}
diff --git a/PlayWallCore/src/de/tobias/playpad/settings/GlobalSettings.java b/PlayWallCore/src/de/tobias/playpad/settings/GlobalSettings.java
index d15029dc..8ac7b1e2 100644
--- a/PlayWallCore/src/de/tobias/playpad/settings/GlobalSettings.java
+++ b/PlayWallCore/src/de/tobias/playpad/settings/GlobalSettings.java
@@ -4,6 +4,7 @@ import java.io.IOException;
 import java.io.UnsupportedEncodingException;
 import java.nio.file.Files;
 import java.nio.file.Path;
+import java.nio.file.Paths;
 
 import org.dom4j.Document;
 import org.dom4j.DocumentException;
@@ -16,6 +17,9 @@ import org.dom4j.io.XMLWriter;
 import de.tobias.playpad.PlayPad;
 import de.tobias.playpad.settings.keys.KeyCollection;
 import de.tobias.playpad.update.UpdateChannel;
+import de.tobias.utils.application.ApplicationUtils;
+import de.tobias.utils.application.container.PathType;
+import de.tobias.utils.settings.Storable;
 
 /**
  * Globale Einstellungen für das Programm. Eine Instanz von diesen Einstellungen wird in {@link PlayPad} verwaltet.
@@ -31,12 +35,27 @@ public class GlobalSettings {
 
 	private Path savePath;
 
+	// Key Binding
 	private KeyCollection keyCollection = new KeyCollection();
 
+	// Update
 	private boolean autoUpdate = true;
 	private boolean ignoreUpdate = false;
 	private UpdateChannel updateChannel = UpdateChannel.STABLE;
 
+	// Live Mode
+	@Storable private boolean liveMode = true;
+	@Storable private boolean liveModePage = true;
+	@Storable private boolean liveModeDrag = true;
+	@Storable private boolean liveModeFile = true;
+	@Storable private boolean liveModeSettings = true;
+
+	// Paths
+	@Storable private Path cachePath = ApplicationUtils.getApplication().getPath(PathType.CACHE);
+
+	public GlobalSettings() {
+	}
+
 	// Getter
 	public boolean isAutoUpdate() {
 		return autoUpdate;
@@ -54,6 +73,30 @@ public class GlobalSettings {
 		return keyCollection;
 	}
 
+	public boolean isLiveMode() {
+		return liveMode;
+	}
+
+	public boolean isLiveModeDrag() {
+		return liveModeDrag;
+	}
+
+	public boolean isLiveModeFile() {
+		return liveModeFile;
+	}
+
+	public boolean isLiveModePage() {
+		return liveModePage;
+	}
+
+	public boolean isLiveModeSettings() {
+		return liveModeSettings;
+	}
+
+	public Path getCachePath() {
+		return cachePath;
+	}
+
 	// Setter
 	public void setAutoUpdate(boolean autoUpdate) {
 		this.autoUpdate = autoUpdate;
@@ -67,10 +110,42 @@ public class GlobalSettings {
 		this.ignoreUpdate = ignoreUpdate;
 	}
 
+	public void setLiveMode(boolean liveMode) {
+		this.liveMode = liveMode;
+	}
+
+	public void setLiveModeDrag(boolean liveModeDrag) {
+		this.liveModeDrag = liveModeDrag;
+	}
+
+	public void setLiveModeFile(boolean liveModeFile) {
+		this.liveModeFile = liveModeFile;
+	}
+
+	public void setLiveModePage(boolean liveModePage) {
+		this.liveModePage = liveModePage;
+	}
+
+	public void setLiveModeSettings(boolean liveModeSettings) {
+		this.liveModeSettings = liveModeSettings;
+	}
+
+	public void setCachePath(Path cachePath) {
+		this.cachePath = cachePath;
+	}
+
+	// Save & Load Data
+
 	private static final String KEYS_ELEMENT = "Keys";
 	private static final String AUTO_UPDATE_ELEMENT = "AutoUpdate";
 	private static final String IGNORE_UPDATE_ELEMENT = "IgnoreUpdate";
 	private static final String UPDATE_CHANNEL_ELEMENT = "UpdateChannel";
+	private static final String LIVE_MODE_ELEMENT = "LiveMode";
+	private static final String LIVE_MODE_PAGE_ATTR = "page";
+	private static final String LIVE_MODE_DRAG_ATTR = "drag";
+	private static final String LIVE_MODE_FILE_ATTR = "file";
+	private static final String LIVE_MODE_SETTINGS_ATTR = "settings";
+	private static final String CACHE_PATH_ELEMENT = "Cache-Path";
 
 	/**
 	 * Lädt eine neue Instanz der Globalen Einstellungen.
@@ -104,6 +179,27 @@ public class GlobalSettings {
 			if (root.element(UPDATE_CHANNEL_ELEMENT) != null) {
 				settings.setUpdateChannel(UpdateChannel.valueOf(root.element(UPDATE_CHANNEL_ELEMENT).getStringValue()));
 			}
+
+			Element liveElement = root.element(LIVE_MODE_ELEMENT);
+			if (liveElement != null) {
+				settings.setLiveMode(Boolean.valueOf(liveElement.getStringValue()));
+				if (liveElement.attributeValue(LIVE_MODE_PAGE_ATTR) != null) {
+					settings.setLiveModePage(Boolean.valueOf(liveElement.attributeValue(LIVE_MODE_PAGE_ATTR)));
+				}
+				if (liveElement.attributeValue(LIVE_MODE_DRAG_ATTR) != null) {
+					settings.setLiveModeDrag(Boolean.valueOf(liveElement.attributeValue(LIVE_MODE_DRAG_ATTR)));
+				}
+				if (liveElement.attributeValue(LIVE_MODE_FILE_ATTR) != null) {
+					settings.setLiveModeFile(Boolean.valueOf(liveElement.attributeValue(LIVE_MODE_FILE_ATTR)));
+				}
+				if (liveElement.attributeValue(LIVE_MODE_SETTINGS_ATTR) != null) {
+					settings.setLiveModeSettings(Boolean.valueOf(liveElement.attributeValue(LIVE_MODE_SETTINGS_ATTR)));
+				}
+			}
+
+			if (root.element(CACHE_PATH_ELEMENT) != null) {
+				settings.setCachePath(Paths.get(root.element(CACHE_PATH_ELEMENT).getStringValue()));
+			}
 		}
 		return settings;
 	}
@@ -129,6 +225,17 @@ public class GlobalSettings {
 		root.addElement(IGNORE_UPDATE_ELEMENT).addText(String.valueOf(ignoreUpdate));
 		root.addElement(UPDATE_CHANNEL_ELEMENT).addText(updateChannel.name());
 
+		// Live Mode
+		Element liveElement = root.addElement(LIVE_MODE_ELEMENT);
+		liveElement.addText(String.valueOf(liveMode));
+		liveElement.addAttribute(LIVE_MODE_PAGE_ATTR, String.valueOf(liveModePage));
+		liveElement.addAttribute(LIVE_MODE_DRAG_ATTR, String.valueOf(liveModeDrag));
+		liveElement.addAttribute(LIVE_MODE_FILE_ATTR, String.valueOf(liveModeFile));
+		liveElement.addAttribute(LIVE_MODE_SETTINGS_ATTR, String.valueOf(liveModeSettings));
+
+		// Paths
+		root.addElement(CACHE_PATH_ELEMENT).addText(cachePath.toString());
+
 		XMLWriter writer = new XMLWriter(Files.newOutputStream(savePath), OutputFormat.createPrettyPrint());
 		writer.write(document);
 		writer.close();
diff --git a/PlayWallCore/src/de/tobias/playpad/settings/ProfileSettings.java b/PlayWallCore/src/de/tobias/playpad/settings/ProfileSettings.java
index 017e3777..0c3e79c7 100644
--- a/PlayWallCore/src/de/tobias/playpad/settings/ProfileSettings.java
+++ b/PlayWallCore/src/de/tobias/playpad/settings/ProfileSettings.java
@@ -4,7 +4,6 @@ import java.io.IOException;
 import java.io.UnsupportedEncodingException;
 import java.nio.file.Files;
 import java.nio.file.Path;
-import java.nio.file.Paths;
 import java.util.HashMap;
 
 import org.dom4j.Document;
@@ -17,8 +16,6 @@ import org.dom4j.io.XMLWriter;
 
 import de.tobias.playpad.PlayPadPlugin;
 import de.tobias.playpad.pad.TimeMode;
-import de.tobias.utils.application.ApplicationUtils;
-import de.tobias.utils.application.container.PathType;
 import de.tobias.utils.settings.SettingsSerializable;
 import de.tobias.utils.settings.Storable;
 import de.tobias.utils.settings.UserDefaults;
@@ -36,26 +33,21 @@ public class ProfileSettings implements SettingsSerializable {
 
 	// MIDI
 	@Storable private String midiDevice;
+	@Storable private boolean midiActive = false;
 
 	// Audio Output
-	// TODO Rewrite
 	@Storable private String audioClass = PlayPadPlugin.getRegistryCollection().getAudioHandlers().getDefaultID();
 	@Storable private HashMap<String, Object> audioUserInfo = new HashMap<>();
 
 	// Layout
-	@Storable private String layoutType = PlayPadPlugin.getRegistryCollection().getDesigns().getDefaultID(); // Rather DesignType
+	@Storable private String layoutType = PlayPadPlugin.getRegistryCollection().getDesigns().getDefaultID(); // Rather
+																												// DesignType
 	@Storable private String mainLayoutType = PlayPadPlugin.getRegistryCollection().getMainLayouts().getDefaultID();
 
 	// Cart Settings
 	@Storable private boolean multiplePlayer = true;
 	@Storable private Warning warningFeedback = new Warning(Duration.seconds(5));
 
-	@Storable private boolean midiActive = false;
-	@Storable private boolean liveMode = true;
-	@Storable private boolean liveModePage = true;
-	@Storable private boolean liveModeDrag = true;
-	@Storable private boolean liveModeFile = true;
-	@Storable private boolean liveModeSettings = true;
 	@Storable private DoubleProperty volumeProperty = new SimpleDoubleProperty(1.0);
 
 	@Storable private boolean windowAlwaysOnTop = false;
@@ -63,9 +55,6 @@ public class ProfileSettings implements SettingsSerializable {
 	@Storable private Fade fade = new Fade();
 	@Storable private TimeMode player_timeDisplayMode = TimeMode.REST;
 
-	// Folder
-	@Storable private Path cachePath = ApplicationUtils.getApplication().getPath(PathType.CACHE);
-
 	public boolean isLocked() {
 		return lockedProperty.get();
 	}
@@ -83,10 +72,6 @@ public class ProfileSettings implements SettingsSerializable {
 		return midiDevice;
 	}
 
-	public Path getCachePath() {
-		return cachePath;
-	}
-
 	public String getLayoutType() {
 		return layoutType;
 	}
@@ -103,26 +88,6 @@ public class ProfileSettings implements SettingsSerializable {
 		return midiActive;
 	}
 
-	public boolean isLiveMode() {
-		return liveMode;
-	}
-
-	public boolean isLiveModeDrag() {
-		return liveModeDrag;
-	}
-
-	public boolean isLiveModeFile() {
-		return liveModeFile;
-	}
-
-	public boolean isLiveModePage() {
-		return liveModePage;
-	}
-
-	public boolean isLiveModeSettings() {
-		return liveModeSettings;
-	}
-
 	public double getVolume() {
 		return volumeProperty.get();
 	}
@@ -156,10 +121,6 @@ public class ProfileSettings implements SettingsSerializable {
 		this.midiDevice = midiDevice;
 	}
 
-	public void setCachePath(Path cachePath) {
-		this.cachePath = cachePath;
-	}
-
 	public void setLayoutType(String layoutType) {
 		this.layoutType = layoutType;
 	}
@@ -176,26 +137,6 @@ public class ProfileSettings implements SettingsSerializable {
 		this.midiActive = midiActive;
 	}
 
-	public void setLiveMode(boolean liveMode) {
-		this.liveMode = liveMode;
-	}
-
-	public void setLiveModeDrag(boolean liveModeDrag) {
-		this.liveModeDrag = liveModeDrag;
-	}
-
-	public void setLiveModeFile(boolean liveModeFile) {
-		this.liveModeFile = liveModeFile;
-	}
-
-	public void setLiveModePage(boolean liveModePage) {
-		this.liveModePage = liveModePage;
-	}
-
-	public void setLiveModeSettings(boolean liveModeSettings) {
-		this.liveModeSettings = liveModeSettings;
-	}
-
 	public void setVolume(double volume) {
 		this.volumeProperty.set(volume);
 	}
@@ -227,18 +168,12 @@ public class ProfileSettings implements SettingsSerializable {
 
 	private static final String LOCKED_ELEMENT = "Locked";
 	private static final String ITEM_ELEMENT = "Item";
-	private static final String CACHE_PATH_ELEMENT = "Cache-Path";
 	private static final String VOLUME_ELEMENT = "Volume";
 	private static final String KEY_ATTRIBUTE = "key";
 	private static final String AUDIO_USER_INFO_ELEMENT = "AudioUserInfo";
 	private static final String AUDIO_CLASS_ELEMENT = "AudioClass";
 	private static final String WINDOW_ALWAYS_ON_TOP_ELEMENT = "WindowAlwaysOnTop";
 	private static final String MULTIPLE_PLAYER_ELEMENT = "MultiplePlayer";
-	private static final String LIVE_MODE_ELEMENT = "LiveMode";
-	private static final String LIVE_MODE_PAGE_ATTR = "page";
-	private static final String LIVE_MODE_DRAG_ATTR = "drag";
-	private static final String LIVE_MODE_FILE_ATTR = "file";
-	private static final String LIVE_MODE_SETTINGS_ATTR = "settings";
 	private static final String TIME_DISPLAY_ELEMENT = "TimeDisplay";
 	private static final String FADE_ELEMENT = "Fade";
 	private static final String WARNING_ELEMENT = "Warning";
@@ -295,23 +230,6 @@ public class ProfileSettings implements SettingsSerializable {
 				}
 			}
 
-			Element liveElement = root.element(LIVE_MODE_ELEMENT);
-			if (liveElement != null) {
-				profileSettings.setLiveMode(Boolean.valueOf(liveElement.getStringValue()));
-				if (liveElement.attributeValue(LIVE_MODE_PAGE_ATTR) != null) {
-					profileSettings.setLiveModePage(Boolean.valueOf(liveElement.attributeValue(LIVE_MODE_PAGE_ATTR)));
-				}
-				if (liveElement.attributeValue(LIVE_MODE_DRAG_ATTR) != null) {
-					profileSettings.setLiveModeDrag(Boolean.valueOf(liveElement.attributeValue(LIVE_MODE_DRAG_ATTR)));
-				}
-				if (liveElement.attributeValue(LIVE_MODE_FILE_ATTR) != null) {
-					profileSettings.setLiveModeFile(Boolean.valueOf(liveElement.attributeValue(LIVE_MODE_FILE_ATTR)));
-				}
-				if (liveElement.attributeValue(LIVE_MODE_SETTINGS_ATTR) != null) {
-					profileSettings.setLiveModeSettings(Boolean.valueOf(liveElement.attributeValue(LIVE_MODE_SETTINGS_ATTR)));
-				}
-			}
-
 			if (root.element(WINDOW_ALWAYS_ON_TOP_ELEMENT) != null)
 				profileSettings.setWindowAlwaysOnTop(Boolean.valueOf(root.element(WINDOW_ALWAYS_ON_TOP_ELEMENT).getStringValue()));
 			if (root.element(AUDIO_CLASS_ELEMENT) != null)
@@ -330,10 +248,6 @@ public class ProfileSettings implements SettingsSerializable {
 			}
 			if (root.element(VOLUME_ELEMENT) != null)
 				profileSettings.setVolume(Double.valueOf(root.element(VOLUME_ELEMENT).getStringValue()));
-
-			if (root.element(CACHE_PATH_ELEMENT) != null) {
-				profileSettings.setCachePath(Paths.get(root.element(CACHE_PATH_ELEMENT).getStringValue()));
-			}
 		}
 		return profileSettings;
 	}
@@ -358,13 +272,6 @@ public class ProfileSettings implements SettingsSerializable {
 
 		root.addElement(MULTIPLE_PLAYER_ELEMENT).addText(String.valueOf(multiplePlayer));
 
-		Element liveElement = root.addElement(LIVE_MODE_ELEMENT);
-		liveElement.addText(String.valueOf(liveMode));
-		liveElement.addAttribute(LIVE_MODE_PAGE_ATTR, String.valueOf(liveModePage));
-		liveElement.addAttribute(LIVE_MODE_DRAG_ATTR, String.valueOf(liveModeDrag));
-		liveElement.addAttribute(LIVE_MODE_FILE_ATTR, String.valueOf(liveModeFile));
-		liveElement.addAttribute(LIVE_MODE_SETTINGS_ATTR, String.valueOf(liveModeSettings));
-
 		root.addElement(WINDOW_ALWAYS_ON_TOP_ELEMENT).addText(String.valueOf(windowAlwaysOnTop));
 
 		// Audio
@@ -376,9 +283,6 @@ public class ProfileSettings implements SettingsSerializable {
 		}
 		root.addElement(VOLUME_ELEMENT).addText(String.valueOf(volumeProperty.get()));
 
-		// Paths
-		root.addElement(CACHE_PATH_ELEMENT).addText(cachePath.toString());
-
 		XMLWriter writer = new XMLWriter(Files.newOutputStream(path), OutputFormat.createPrettyPrint());
 		writer.write(document);
 		writer.close();
diff --git a/PlayWallCore/src/de/tobias/playpad/update/UpdateRegistery.java b/PlayWallCore/src/de/tobias/playpad/update/UpdateRegistery.java
index 86efe8b0..9b2274c4 100644
--- a/PlayWallCore/src/de/tobias/playpad/update/UpdateRegistery.java
+++ b/PlayWallCore/src/de/tobias/playpad/update/UpdateRegistery.java
@@ -22,7 +22,7 @@ public class UpdateRegistery {
 	}
 
 	public static List<Updatable> getAvailableUpdates() {
-		return updatables;
+		return availableUpdates;
 	}
 
 	public static List<Updatable> lookupUpdates(UpdateChannel channel) {
-- 
GitLab