Skip to content

Commit

Permalink
Refactored config, implemented Full MVP to General Settings, refactor…
Browse files Browse the repository at this point in the history
…ed general settings records
  • Loading branch information
rnayabed committed Jul 1, 2022
1 parent 510872d commit b0ee7eb
Show file tree
Hide file tree
Showing 26 changed files with 174 additions and 217 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
handler for config.xml
*/

package com.stream_pi.server.io;
package com.stream_pi.server.config;

import java.awt.*;
import java.io.File;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.stream_pi.server.config.record;

public record ActionGridSettings(double actionGridActionSize, boolean actionGridUseSameActionSizeAsProfile, double actionGridActionGap, boolean actionGridUseSameActionGapAsProfile, double actionGridActionDisplayTextFontSize, boolean actionGridUseSameActionDisplayTextFontSizeAsProfile)
{
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package com.stream_pi.server.config.record;

public record ConnectionSettings(String serverName, int port, String IP) {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.stream_pi.server.config.record;

// TODO: This should be moved to Config and not only just GeneralSettings
/*public record GeneralSettings(String serverName, int port, double actionGridActionDisplayTextFontSize,
String pluginsPath, String themesPath,
double actionGridActionSize,
boolean actionGridUseSameActionSizeAsProfile, boolean actionGridUseSameActionGapAsProfile,
boolean actionGridUseSameActionDisplayTextFontSizeAsProfile,
double actionGridActionGap,
boolean minimiseToSystemTrayOnClose, boolean showAlertsPopup, boolean startOnBoot,
boolean soundOnActionClickedStatus, String soundOnActionClickedFilePath,
String IP, Locale currentLanguageLocale)
{
}*/

public record GeneralSettings(ConnectionSettings connection, ActionGridSettings actionGrid, LocationsSettings locations, SoundOnActionClickedSettings soundOnActionClicked, OthersSettings others)
{

}

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package com.stream_pi.server.config.record;

public record LocationsSettings(String pluginsPath, String themesPath) {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.stream_pi.server.config.record;

import java.util.Locale;

public record OthersSettings(Locale currentLanguageLocale, boolean minimiseToSystemTrayOnClose, boolean startOnBoot, boolean showAlertsPopup) {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package com.stream_pi.server.config.record;

public record SoundOnActionClickedSettings(String soundOnActionClickedFilePath, boolean soundOnActionClickedStatus) {
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@
import com.stream_pi.action_api.actionproperty.gaugeproperties.GaugeProperties;
import com.stream_pi.action_api.actionproperty.property.Property;
import com.stream_pi.action_api.actionproperty.property.StringProperty;
import com.stream_pi.action_api.actionproperty.property.Type;
import com.stream_pi.action_api.externalplugin.ExternalPlugin;
import com.stream_pi.action_api.externalplugin.GaugeAction;
import com.stream_pi.action_api.externalplugin.ToggleAction;
import com.stream_pi.action_api.externalplugin.inputevent.StreamPiInputEvent;
import com.stream_pi.action_api.otheractions.CombineAction;
import com.stream_pi.action_api.otheractions.FolderAction;
Expand All @@ -36,9 +34,8 @@
import com.stream_pi.server.controller.ServerListener;
import com.stream_pi.server.i18n.I18N;
import com.stream_pi.server.info.ServerInfo;
import com.stream_pi.server.io.Config;
import com.stream_pi.server.config.Config;
import com.stream_pi.server.window.ExceptionAndAlertHandler;
import com.stream_pi.server.window.dashboard.actiongridpane.ActionBox;
import com.stream_pi.util.alert.StreamPiAlert;
import com.stream_pi.util.alert.StreamPiAlertType;
import com.stream_pi.util.comms.DisconnectReason;
Expand All @@ -49,21 +46,13 @@
import com.stream_pi.util.platform.Platform;
import com.stream_pi.util.platform.ReleaseStatus;
import com.stream_pi.util.version.Version;
import eu.hansolo.medusa.Gauge;
import javafx.concurrent.Task;
import javafx.event.EventType;
import javafx.geometry.Orientation;
import javafx.scene.control.Toggle;
import javafx.scene.input.MouseEvent;
import javafx.scene.input.TouchEvent;

import java.io.*;
import java.net.Socket;
import java.net.SocketAddress;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.logging.Level;
import java.util.logging.Logger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import com.stream_pi.server.i18n.I18N;
import com.stream_pi.server.info.ServerInfo;
import com.stream_pi.server.info.StartupFlags;
import com.stream_pi.server.io.Config;
import com.stream_pi.server.config.Config;
import com.stream_pi.server.window.Base;
import com.stream_pi.server.window.GlobalExceptionAndAlertHandler;
import com.stream_pi.server.window.dashboard.actiongridpane.ActionBox;
Expand Down
9 changes: 1 addition & 8 deletions src/main/java/com/stream_pi/server/window/Base.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
import com.stream_pi.action_api.ActionAPI;
import com.stream_pi.server.controller.ServerListener;
import com.stream_pi.server.i18n.I18N;
import com.stream_pi.server.info.StartupFlags;
import com.stream_pi.server.io.Config;
import com.stream_pi.server.config.Config;
import com.stream_pi.server.info.ServerInfo;
import com.stream_pi.server.Main;
import com.stream_pi.server.window.dashboard.DashboardBase;
Expand All @@ -28,25 +27,19 @@
import com.stream_pi.theme_api.Themes;
import com.stream_pi.util.Util;
import com.stream_pi.util.alert.StreamPiAlert;
import com.stream_pi.util.alert.StreamPiAlertButton;
import com.stream_pi.util.alert.StreamPiAlertListener;
import com.stream_pi.util.alert.StreamPiAlertType;
import com.stream_pi.util.exception.MinorException;
import com.stream_pi.util.exception.SevereException;
import com.stream_pi.util.iohelper.IOHelper;
import com.stream_pi.util.loggerhelper.StreamPiLogFallbackHandler;
import com.stream_pi.util.loggerhelper.StreamPiLogFileHandler;

import com.stream_pi.util.platform.Platform;
import com.stream_pi.util.rootchecker.RootChecker;
import javafx.application.HostServices;
import javafx.scene.CacheHint;
import javafx.scene.image.Image;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;

import java.io.File;
import java.io.IOException;
import java.util.Locale;
import java.util.Objects;
import java.util.logging.Logger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.stream_pi.server.controller.ServerListener;
import com.stream_pi.server.i18n.I18N;
import com.stream_pi.server.io.Config;
import com.stream_pi.server.config.Config;
import com.stream_pi.util.alert.StreamPiAlert;
import com.stream_pi.util.alert.StreamPiAlertButton;
import com.stream_pi.util.alert.StreamPiAlertListener;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import com.stream_pi.server.client.ClientProfile;
import com.stream_pi.server.connection.ClientConnection;
import com.stream_pi.server.i18n.I18N;
import com.stream_pi.server.io.Config;
import com.stream_pi.server.config.Config;
import com.stream_pi.server.window.ExceptionAndAlertHandler;
import com.stream_pi.server.window.dashboard.actiondetailspane.ActionDetailsPaneListener;
import com.stream_pi.util.exception.MinorException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import com.stream_pi.server.controller.ServerListener;
import com.stream_pi.server.i18n.I18N;
import com.stream_pi.server.info.ServerInfo;
import com.stream_pi.server.io.Config;
import com.stream_pi.server.config.Config;
import com.stream_pi.server.window.ExceptionAndAlertHandler;
import com.stream_pi.server.combobox.IPChooserComboBox;
import com.stream_pi.util.alert.StreamPiAlert;
Expand All @@ -29,7 +29,6 @@
import com.stream_pi.util.uihelper.HBoxWithSpaceBetween;
import javafx.application.Platform;
import javafx.concurrent.Task;
import javafx.geometry.Pos;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,9 @@
import com.stream_pi.server.combobox.LanguageChooserComboBox;
import com.stream_pi.server.controller.ServerListener;
import com.stream_pi.server.i18n.I18N;
import com.stream_pi.server.io.Config;
import com.stream_pi.server.config.Config;
import com.stream_pi.server.window.ExceptionAndAlertHandler;
import com.stream_pi.util.exception.SevereException;
import com.stream_pi.util.uihelper.HBoxWithSpaceBetween;
import javafx.collections.FXCollections;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.control.Label;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,17 @@

import com.stream_pi.server.controller.Controller;
import com.stream_pi.server.i18n.I18N;
import com.stream_pi.server.io.Config;
import com.stream_pi.server.config.Config;
import com.stream_pi.theme_api.Theme;
import com.stream_pi.theme_api.Themes;
import com.stream_pi.util.exception.SevereException;
import com.stream_pi.util.uihelper.SpaceFiller;
import javafx.application.HostServices;
import javafx.application.Platform;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.event.EventHandler;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.control.*;
import javafx.scene.input.MouseEvent;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority;
import javafx.scene.layout.Region;
import javafx.scene.layout.VBox;
import org.controlsfx.control.ToggleSwitch;
import org.kordamp.ikonli.javafx.FontIcon;
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit b0ee7eb

Please sign in to comment.