server
Clone or download
Modified Files
package com.stream_pi.server.window.settings.About;
package com.stream_pi.server.window.settings.About;
import com.stream_pi.action_api.ActionAPI;
import com.stream_pi.action_api.ActionAPI;
import com.stream_pi.server.info.ServerInfo;
import com.stream_pi.server.info.ServerInfo;
import com.stream_pi.server.Main;
import com.stream_pi.server.Main;
import javafx.application.HostServices;
import javafx.application.HostServices;
import javafx.event.Event;
import javafx.event.Event;
import javafx.geometry.Pos;
import javafx.geometry.Pos;
import javafx.scene.CacheHint;
import javafx.scene.CacheHint;
import javafx.scene.control.*;
import javafx.scene.control.*;
import javafx.scene.image.Image;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.image.ImageView;
import javafx.scene.input.SwipeEvent;
import javafx.scene.input.SwipeEvent;
import javafx.scene.layout.HBox;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority;
import javafx.scene.layout.Priority;
import javafx.scene.layout.VBox;
import javafx.scene.layout.VBox;
import java.io.File;
import java.io.File;
import java.io.InputStream;
import java.io.InputStream;
import java.net.URL;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.Paths;
import java.util.Objects;
import java.util.Objects;
import java.util.Scanner;
import java.util.Scanner;
import java.util.logging.Logger;
import java.util.logging.Logger;
public class About extends VBox
public class About extends VBox
{
{
private HostServices hostServices;
private HostServices hostServices;
public About(HostServices hostServices)
public About(HostServices hostServices)
{
{
getStyleClass().add("about");
getStyleClass().add("about");
this.hostServices = hostServices;
this.hostServices = hostServices;
setAlignment(Pos.TOP_CENTER);
setAlignment(Pos.TOP_CENTER);
Image appIcon = new Image(Objects.requireNonNull(Main.class.getResourceAsStream("app_icon.png")));
Image appIcon = new Image(Objects.requireNonNull(Main.class.getResourceAsStream("app_icon.png")));
ImageView appIconImageView = new ImageView(appIcon);
ImageView appIconImageView = new ImageView(appIcon);
appIconImageView.setFitHeight(196);
appIconImageView.setFitHeight(196);
appIconImageView.setFitWidth(182);
appIconImageView.setFitWidth(182);
TabPane tabPane = new TabPane();
TabPane tabPane = new TabPane();
tabPane.addEventFilter(SwipeEvent.ANY, Event::consume);
tabPane.addEventFilter(SwipeEvent.ANY, Event::consume);
tabPane.getStyleClass().add("settings_about_tab_internal");
tabPane.getStyleClass().add("settings_about_tab_internal");
tabPane.setTabClosingPolicy(TabPane.TabClosingPolicy.UNAVAILABLE);
tabPane.setTabClosingPolicy(TabPane.TabClosingPolicy.UNAVAILABLE);
tabPane.setMaxWidth(600);
tabPane.setMaxWidth(600);
VBox.setVgrow(tabPane, Priority.ALWAYS);
VBox.setVgrow(tabPane, Priority.ALWAYS);
Tab licenseTab = new Tab("License");
Tab licenseTab = new Tab("License");
licenseTab.setContent(new LicenseTab());
licenseTab.setContent(new LicenseTab());
Tab contributorsTab = new Tab("Contributors");
Tab contributorsTab = new Tab("Contributors");
contributorsTab.setContent(new ContributorsTab());
contributorsTab.setContent(new ContributorsTab());
Tab contactTab = new Tab("Contact");
Tab contactTab = new Tab("Contact");
contactTab.setContent(new ContactTab(hostServices));
contactTab.setContent(new ContactTab(hostServices));
tabPane.getTabs().addAll(licenseTab, contributorsTab, contactTab);
tabPane.getTabs().addAll(licenseTab, contributorsTab, contactTab);
Hyperlink donateButton = new Hyperlink("DONATE");
Hyperlink donateButton = new Hyperlink("DONATE");
donateButton.setOnAction(event -> openWebpage("https://www.patreon.com/streampi"));
donateButton.setOnAction(event -> openWebpage("https://www.patreon.com/streampi"));
donateButton.getStyleClass().add("about_donate_hyperlink");
donateButton.getStyleClass().add("about_donate_hyperlink");
ServerInfo serverInfo = ServerInfo.getInstance();
ServerInfo serverInfo = ServerInfo.getInstance();
Label versionText = new Label(serverInfo.getVersion().getText() + " - "+ serverInfo.getPlatform().getUIName() + " - "+ serverInfo.getReleaseStatus().getUIName());
Label versionLabel = new Label(serverInfo.getVersion().getText() + " - "+ serverInfo.getPlatform().getUIName() + " - "+ serverInfo.getReleaseStatus().getUIName());
versionText.getStyleClass().add("about_version_label");
versionLabel.getStyleClass().add("about_version_label");
Label commStandardLabel = new Label("Comm Standard "+serverInfo.getCommStandardVersion().getText());
Label commStandardLabel = new Label("Comm Standard "+serverInfo.getCommStandardVersion().getText());
commStandardLabel.getStyleClass().add("about_comm_standard_label");
commStandardLabel.getStyleClass().add("about_comm_standard_label");
Label minThemeAPILabel = new Label("Min ThemeAPI "+serverInfo.getMinThemeSupportVersion().getText());
Label minThemeAPILabel = new Label("Min ThemeAPI "+serverInfo.getMinThemeSupportVersion().getText());
minThemeAPILabel.getStyleClass().add("about_min_theme_api_label");
minThemeAPILabel.getStyleClass().add("about_min_theme_api_label");
Label minActionAPILabel = new Label("Min ActionAPI "+serverInfo.getMinPluginSupportVersion().getText());
Label minActionAPILabel = new Label("Min ActionAPI "+serverInfo.getMinPluginSupportVersion().getText());
minActionAPILabel.getStyleClass().add("about_min_action_api_label");
minActionAPILabel.getStyleClass().add("about_min_action_api_label");
Label currentActionAPILabel = new Label("ActionAPI "+ ActionAPI.API_VERSION.getText());
Label currentActionAPILabel = new Label("ActionAPI "+ ActionAPI.API_VERSION.getText());
currentActionAPILabel.getStyleClass().add("about_current_action_api_label");
currentActionAPILabel.getStyleClass().add("about_current_action_api_label");
HBox hBox = new HBox(versionText, getSep(),
HBox hBox = new HBox(versionLabel, getSep(),
commStandardLabel, getSep(),
commStandardLabel, getSep(),
minThemeAPILabel, getSep(),
minThemeAPILabel, getSep(),
minActionAPILabel, getSep(),
minActionAPILabel, getSep(),
currentActionAPILabel);
currentActionAPILabel);
hBox.setAlignment(Pos.CENTER);
hBox.setAlignment(Pos.CENTER);
hBox.setSpacing(10);
hBox.setSpacing(10);
Label javaVersionLabel = new Label("Java "+System.getProperty("java.version"));
javaVersionLabel.getStyleClass().add("about_java_version");
Label javafxVersionLabel = new Label("JavaFX "+System.getProperty("javafx.version"));
javafxVersionLabel.getStyleClass().add("about_javafx_version");
Label buildDateLabel = new Label();
Label buildDateLabel = new Label();
buildDateLabel.getStyleClass().add("build-date-label");
buildDateLabel.getStyleClass().add("about_build_date_label");
HBox hBox2 = new HBox(javaVersionLabel, getSep(),
javafxVersionLabel, getSep(),
buildDateLabel);
hBox2.setAlignment(Pos.CENTER);
hBox2.setSpacing(10);
getChildren().addAll(appIconImageView, tabPane, donateButton, hBox, buildDateLabel);
getChildren().addAll(appIconImageView, tabPane, donateButton, hBox, hBox2);
try
try
{
{
buildDateLabel.setText("Build date/time: " + new String(Objects.requireNonNull(Main.class.getResourceAsStream("build-date")).readAllBytes()));
buildDateLabel.setText("Build date/time: " + new String(Objects.requireNonNull(Main.class.getResourceAsStream("build-date")).readAllBytes()));
}
}
catch (Exception e)
catch (Exception e)
{
{
e.printStackTrace();
e.printStackTrace();
}
}
}
}
public void openWebpage(String url)
public void openWebpage(String url)
{
{
hostServices.showDocument(url);
hostServices.showDocument(url);
}
}
private Label getSep()
private Label getSep()
{
{
Label label = new Label("|");
Label label = new Label("|");
label.getStyleClass().add("separator_ui_label");
label.getStyleClass().add("separator_ui_label");
return label;
return label;
}
}
}
}