client

Clone or download

Modified Files

--- 'a/src/main/java/com/stream_pi/client/Main.java'
+++ b/src/main/java/com/stream_pi/client/Main.java
@@ -16,6 +16,7 @@ public class Main extends Application {
Controller d = new Controller();
Scene s = new Scene(d);
stage.setScene(s);
+ d.setHostServices(getHostServices());
d.init();
}
--- 'a/src/main/java/com/stream_pi/client/connection/Client.java'
+++ b/src/main/java/com/stream_pi/client/connection/Client.java
@@ -356,7 +356,7 @@ public class Client extends Thread{
{
String clientVersion = clientInfo.getVersion().getText();
String releaseStatus = clientInfo.getReleaseStatus().toString();
- String clientCommsStandard = clientInfo.getCommsStandardVersion().getText();
+ String clientCommStandard = clientInfo.getCommStandardVersion().getText();
String clientMinThemeStandard = clientInfo.getMinThemeSupportVersion().getText();
String clientNickname = Config.getInstance().getClientNickName();
String screenWidth = Config.getInstance().getStartupWindowWidth()+"";
@@ -369,7 +369,7 @@ public class Client extends Thread{
toBeSent.setStringArrValue(
clientVersion,
releaseStatus,
- clientCommsStandard,
+ clientCommStandard,
clientMinThemeStandard,
clientNickname,
screenWidth,
@@ -613,8 +613,15 @@ public class Client extends Thread{
if(old != null)
{
- if(action.isHasIcon())
+ if(isHasIcon)
action.setIcon(clientListener.getClientProfiles().getProfileFromID(profileID).getActionFromID(action.getID()).getIconAsByteArray());
+ else
+ {
+ if(old.isHasIcon())
+ {
+ new File(Config.getInstance().getIconsPath()+"/"+actionID).delete();
+ }
+ }
}
clientListener.getClientProfiles().getProfileFromID(profileID).addAction(action);
--- 'a/src/main/java/com/stream_pi/client/info/ClientInfo.java'
+++ b/src/main/java/com/stream_pi/client/info/ClientInfo.java
@@ -21,71 +21,54 @@ import java.util.function.Function;
public class ClientInfo {
private Version version;
private final ReleaseStatus releaseStatus;
- private Platform platformType = null;
+ private Platform platformType;
private String prePath;
private Version minThemeSupportVersion;
private Version minPluginSupportVersion;
- private Version commsStandardVersion;
+ private Version commStandardVersion;
private String runnerFileName;
private static ClientInfo instance = null;
- private ClientInfo(){
-
- try {
- version = new Version("1.0.0");
- minThemeSupportVersion = new Version("1.0.0");
- minPluginSupportVersion = new Version("1.0.0");
- commsStandardVersion = new Version("1.0.0");
- } catch (MinorException e) {
- e.printStackTrace();
- }
+ private ClientInfo()
+ {
+ version = new Version(1,0,0);
+ minThemeSupportVersion = new Version(1,0,0);
+ minPluginSupportVersion = new Version(1,0,0);
+ commStandardVersion = new Version(1,0,0);
releaseStatus = ReleaseStatus.EA;
- if(platformType == null)
- {
- String osName = System.getProperty("os.name").toLowerCase();
+ String osName = System.getProperty("os.name").toLowerCase();
- if(osName.contains("windows"))
- {
- prePath = "data/";
- platformType = Platform.WINDOWS;
- }
- else if (osName.contains("linux"))
- {
- if(osName.contains("raspberrypi"))
- {
- prePath = "data/";
- platformType = Platform.LINUX_RPI;
- }
- else
- {
- prePath = "data/";
- platformType = Platform.LINUX;
- }
- }
- else if(osName.contains("android")) // SPECIFY -Dsvm.targetName=android WHILE BUILDING ANDROID NATIVE IMAGE
- {
- prePath = "/sdcard/Android/data/com.stream_pi.client/";
- platformType = Platform.ANDROID;
- }
- else if (osName.contains("mac"))
- {
- prePath = "data/";
- platformType = Platform.MAC;
- }
- else
- {
- prePath = "data/";
- platformType = Platform.UNKNOWN;
- }
+ if(osName.contains("windows"))
+ {
+ prePath = "data/";
+ platformType = Platform.WINDOWS;
+ }
+ else if (osName.contains("linux"))
+ {
+ prePath = "data/";
+ platformType = Platform.LINUX;
+ }
+ else if(osName.contains("android")) // SPECIFY -Dsvm.targetName=android WHILE BUILDING ANDROID NATIVE IMAGE
+ {
+ prePath = "/sdcard/Android/data/com.stream_pi.client/";
+ platformType = Platform.ANDROID;
+ }
+ else if (osName.contains("mac"))
+ {
+ prePath = "data/";
+ platformType = Platform.MAC;
+ }
+ else
+ {
+ prePath = "data/";
+ platformType = Platform.UNKNOWN;
}
-
-
}
public void setRunnerFileName(String runnerFileName)
@@ -157,8 +140,8 @@ public class ClientInfo {
return minPluginSupportVersion;
}
- public Version getCommsStandardVersion()
+ public Version getCommStandardVersion()
{
- return commsStandardVersion;
+ return commStandardVersion;
}
}
--- 'a/src/main/java/com/stream_pi/client/profile/ClientProfile.java'
+++ b/src/main/java/com/stream_pi/client/profile/ClientProfile.java
@@ -589,9 +589,7 @@ public class ClientProfile implements Cl
if(XMLConfigHelper.getBooleanProperty(iconElement, "has"))
{
- File file = new File(ClientInfo.getInstance().getPrePath()+iconsPath+"/"+ID);
-
- System.out.println(file.delete());
+ new File(iconsPath+"/"+ID).delete();
}
actions.remove(ID);
}
--- 'a/src/main/java/com/stream_pi/client/window/Base.java'
+++ b/src/main/java/com/stream_pi/client/window/Base.java
@@ -23,6 +23,7 @@ import com.stream_pi.util.loggerhelper.S
import com.stream_pi.util.loggerhelper.StreamPiLogFileHandler;
import com.stream_pi.util.platform.Platform;
+import javafx.application.HostServices;
import javafx.geometry.Insets;
import javafx.scene.CacheHint;
import javafx.scene.Cursor;
@@ -122,20 +123,28 @@ public abstract class Base extends Stack
logFallbackHandler.close();
}
+ private HostServices hostServices;
+
+ public void setHostServices(HostServices hostServices)
+ {
+ this.hostServices = hostServices;
+ }
+
+ public HostServices getHostServices()
+ {
+ return hostServices;
+ }
+
public void initBase() throws SevereException
{
stage = (Stage) getScene().getWindow();
clientInfo = ClientInfo.getInstance();
dashboardBase = new DashboardBase(this, this);
- dashboardBase.setCache(true);
- dashboardBase.setCacheHint(CacheHint.SPEED);
dashboardBase.prefWidthProperty().bind(widthProperty());
dashboardBase.prefHeightProperty().bind(heightProperty());
- settingsBase = new SettingsBase(this, this);
- settingsBase.setCache(true);
- settingsBase.setCacheHint(CacheHint.SPEED);
+ settingsBase = new SettingsBase(this, this, getHostServices());
alertStackPane = new StackPane();
alertStackPane.setPadding(new Insets(10));
--- 'a/src/main/java/com/stream_pi/client/window/dashboard/DashboardBase.java'
+++ b/src/main/java/com/stream_pi/client/window/dashboard/DashboardBase.java
@@ -42,9 +42,6 @@ public class DashboardBase extends VBox
getChildren().addAll(actionGridPane,hBox);
getStyleClass().add("dashboard");
-
- setCache(true);
- setCacheHint(CacheHint.SPEED);
}
public void renderProfile(ClientProfile clientProfile) throws SevereException
--- 'a/src/main/java/com/stream_pi/client/window/dashboard/actiongridpane/ActionGridPane.java'
+++ b/src/main/java/com/stream_pi/client/window/dashboard/actiongridpane/ActionGridPane.java
@@ -13,6 +13,7 @@ import com.stream_pi.util.exception.Seve
import javafx.concurrent.Task;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
+import javafx.scene.CacheHint;
import javafx.scene.Node;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.Priority;
@@ -45,6 +46,9 @@ public class ActionGridPane extends Grid
setAlignment(Pos.CENTER);
VBox.setVgrow(this, Priority.ALWAYS);
+
+ setCache(true);
+ setCacheHint(CacheHint.SPEED);
}
private String currentParent;
@@ -205,8 +209,6 @@ public class ActionGridPane extends Grid
logger.info("bbbbbb " +col+","+row);
}
}
-
- logger.info(isFreshRender+"22222222222222222xxxxxxxxxx");
}
}
--- 'a/src/main/java/com/stream_pi/client/window/settings/SettingsBase.java'
+++ b/src/main/java/com/stream_pi/client/window/settings/SettingsBase.java
@@ -10,19 +10,22 @@ import com.stream_pi.client.window.Excep
import com.stream_pi.theme_api.Theme;
import com.stream_pi.util.alert.StreamPiAlert;
import com.stream_pi.util.alert.StreamPiAlertType;
+import com.stream_pi.util.checkforupdates.CheckForUpdates;
import com.stream_pi.util.combobox.StreamPiComboBox;
import com.stream_pi.util.combobox.StreamPiComboBoxFactory;
import com.stream_pi.util.combobox.StreamPiComboBoxListener;
import com.stream_pi.util.exception.MinorException;
import com.stream_pi.util.exception.SevereException;
+import com.stream_pi.util.platform.PlatformType;
import com.stream_pi.util.uihelper.HBoxInputBox;
import com.stream_pi.util.uihelper.SpaceFiller;
-import com.stream_pi.util.startatboot.SoftwareType;
import com.stream_pi.util.startatboot.StartAtBoot;
+import javafx.application.HostServices;
import javafx.application.Platform;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
+import javafx.scene.CacheHint;
import javafx.scene.control.*;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority;
@@ -57,9 +60,15 @@ public class SettingsBase extends VBox {
private TextField iconsPathTextField;
private TextField profilesPathTextField;
- public SettingsBase(ExceptionAndAlertHandler exceptionAndAlertHandler, ClientListener clientListener) {
+ private final Button checkForUpdatesButton;
+ private HostServices hostServices;
+ public SettingsBase(ExceptionAndAlertHandler exceptionAndAlertHandler,
+ ClientListener clientListener, HostServices hostServices)
+ {
getStyleClass().add("settings_base");
+
+ this.hostServices = hostServices;
this.clientListener = clientListener;
this.exceptionAndAlertHandler = exceptionAndAlertHandler;
@@ -154,6 +163,8 @@ public class SettingsBase extends VBox {
screenWidthInputBox.setVisible(false);
}
+ checkForUpdatesButton = new Button("Check for updates");
+ checkForUpdatesButton.setOnAction(event->checkForUpdates());
VBox vBox = new VBox(
new HBoxInputBox("Device Name", nickNameTextField, prefWidth),
@@ -173,13 +184,27 @@ public class SettingsBase extends VBox {
screenWidthInputBox,
themesPathInputBox,
iconsPathInputBox,
- profilesPathInputBox,
+ profilesPathInputBox
+ );
+
+ if(ClientInfo.getInstance().getPlatformType() == com.stream_pi.util.platform.Platform.LINUX &&
+ ClientInfo.getInstance().isShowShutDownButton())
+ {
+
+ shutdownButton = new Button("Shutdown");
+ shutdownButton.setOnAction(event -> onShutdownButtonClicked());
+ vBox.getChildren().add(shutdownButton);
+ }
+
+ vBox.getChildren().addAll(
+ checkForUpdatesButton,
startOnBootToggleButton,
showCursorToggleButton,
fullScreenToggleButton,
licenseLabel,
versionLabel
);
+
vBox.getStyleClass().add("settings_base_vbox");
vBox.setSpacing(5.0);
@@ -208,8 +233,6 @@ public class SettingsBase extends VBox {
connectDisconnectButton = new Button("Connect");
connectDisconnectButton.setOnAction(event -> onConnectDisconnectButtonClicked());
- shutdownButton = new Button("Shutdown");
- shutdownButton.setOnAction(event -> onShutdownButtonClicked());
Button exitButton = new Button("Exit");
exitButton.setOnAction(event -> onExitButtonClicked());
@@ -217,12 +240,6 @@ public class SettingsBase extends VBox {
HBox buttonBar = new HBox(connectDisconnectButton, saveButton, exitButton, closeButton);
buttonBar.getStyleClass().add("settings_button_bar");
- if(ClientInfo.getInstance().getPlatformType() == com.stream_pi.util.platform.Platform.LINUX &&
- ClientInfo.getInstance().isShowShutDownButton())
- {
- buttonBar.getChildren().add(shutdownButton);
- }
-
buttonBar.setPadding(new Insets(0,5,5,0));
buttonBar.setSpacing(5.0);
@@ -235,6 +252,15 @@ public class SettingsBase extends VBox {
scrollPane,
buttonBar
);
+
+ setCache(true);
+ setCacheHint(CacheHint.SPEED);
+ }
+
+ private void checkForUpdates()
+ {
+ new CheckForUpdates(checkForUpdatesButton, hostServices,
+ PlatformType.CLIENT, ClientInfo.getInstance().getVersion());
}
public void onExitButtonClicked()
@@ -448,7 +474,7 @@ public class SettingsBase extends VBox {
}
else
{
- StartAtBoot startAtBoot = new StartAtBoot(SoftwareType.CLIENT, ClientInfo.getInstance().getPlatformType());
+ StartAtBoot startAtBoot = new StartAtBoot(PlatformType.CLIENT, ClientInfo.getInstance().getPlatformType());
if(startOnBoot)
{
startAtBoot.create(new File(ClientInfo.getInstance().getRunnerFileName()),