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.geometry.Pos;
import javafx.geometry.Pos;
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.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.util.Objects;
import java.util.Objects;
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.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 versionText = new Label(serverInfo.getVersion().getText() + " - "+ serverInfo.getPlatform().getUIName() + " - "+ serverInfo.getReleaseStatus().getUIName());
versionText.getStyleClass().add("about_version_label");
versionText.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(versionText, 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);
getChildren().addAll(appIconImageView, tabPane, donateButton, hBox);
getChildren().addAll(appIconImageView, tabPane, donateButton, hBox);
}
}
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;
}
}
}
}
package com.stream_pi.server.window.settings;
package com.stream_pi.server.window.settings;
import com.stream_pi.server.connection.ServerListener;
import com.stream_pi.server.connection.ServerListener;
import com.stream_pi.server.window.ExceptionAndAlertHandler;
import com.stream_pi.server.window.ExceptionAndAlertHandler;
import com.stream_pi.server.window.settings.About.About;
import com.stream_pi.server.window.settings.About.About;
import javafx.application.HostServices;
import javafx.application.HostServices;
import javafx.event.Event;
import javafx.geometry.Insets;
import javafx.geometry.Insets;
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.input.SwipeEvent;
import javafx.scene.layout.Priority;
import javafx.scene.layout.Priority;
import javafx.scene.layout.VBox;
import javafx.scene.layout.VBox;
public class SettingsBase extends VBox
public class SettingsBase extends VBox
{
{
private TabPane tabPane;
private TabPane tabPane;
private GeneralSettings generalSettings;
private GeneralSettings generalSettings;
private PluginsSettings pluginsSettings;
private PluginsSettings pluginsSettings;
private ThemesSettings themesSettings;
private ThemesSettings themesSettings;
private ClientsSettings clientsSettings;
private ClientsSettings clientsSettings;
private Button closeButton;
private Button closeButton;
private HostServices hostServices;
private HostServices hostServices;
private ExceptionAndAlertHandler exceptionAndAlertHandler;
private ExceptionAndAlertHandler exceptionAndAlertHandler;
public SettingsBase(HostServices hostServices, ExceptionAndAlertHandler exceptionAndAlertHandler,
public SettingsBase(HostServices hostServices, ExceptionAndAlertHandler exceptionAndAlertHandler,
ServerListener serverListener)
ServerListener serverListener)
{
{
this.exceptionAndAlertHandler = exceptionAndAlertHandler;
this.exceptionAndAlertHandler = exceptionAndAlertHandler;
this.hostServices = hostServices;
this.hostServices = hostServices;
tabPane = new TabPane();
tabPane = new TabPane();
tabPane.addEventFilter(SwipeEvent.ANY, Event::consume);
tabPane.setTabClosingPolicy(TabPane.TabClosingPolicy.UNAVAILABLE);
tabPane.setTabClosingPolicy(TabPane.TabClosingPolicy.UNAVAILABLE);
VBox.setVgrow(tabPane, Priority.ALWAYS);
VBox.setVgrow(tabPane, Priority.ALWAYS);
Tab generalSettingsTab = new Tab("General");
Tab generalSettingsTab = new Tab("General");
generalSettings = new GeneralSettings(exceptionAndAlertHandler, serverListener, hostServices);
generalSettings = new GeneralSettings(exceptionAndAlertHandler, serverListener, hostServices);
generalSettingsTab.setContent(generalSettings);
generalSettingsTab.setContent(generalSettings);
Tab pluginsSettingsTab = new Tab("Plugins");
Tab pluginsSettingsTab = new Tab("Plugins");
pluginsSettings = new PluginsSettings(exceptionAndAlertHandler, hostServices);
pluginsSettings = new PluginsSettings(exceptionAndAlertHandler, hostServices);
pluginsSettingsTab.setContent(pluginsSettings);
pluginsSettingsTab.setContent(pluginsSettings);
Tab themesSettingsTab = new Tab("Themes");
Tab themesSettingsTab = new Tab("Themes");
themesSettings = new ThemesSettings(hostServices);
themesSettings = new ThemesSettings(hostServices);
themesSettingsTab.setContent(themesSettings);
themesSettingsTab.setContent(themesSettings);
Tab clientsSettingsTab = new Tab("Clients");
Tab clientsSettingsTab = new Tab("Clients");
clientsSettings = new ClientsSettings(exceptionAndAlertHandler, serverListener);
clientsSettings = new ClientsSettings(exceptionAndAlertHandler, serverListener);
clientsSettingsTab.setContent(clientsSettings);
clientsSettingsTab.setContent(clientsSettings);
Tab aboutTab = new Tab("About");
Tab aboutTab = new Tab("About");
aboutTab.setContent(new About(hostServices));
aboutTab.setContent(new About(hostServices));
tabPane.getTabs().addAll(generalSettingsTab, pluginsSettingsTab, themesSettingsTab, clientsSettingsTab, aboutTab);
tabPane.getTabs().addAll(generalSettingsTab, pluginsSettingsTab, themesSettingsTab, clientsSettingsTab, aboutTab);
setAlignment(Pos.TOP_RIGHT);
setAlignment(Pos.TOP_RIGHT);
closeButton = new Button("Close");
closeButton = new Button("Close");
VBox.setMargin(closeButton, new Insets(10.0));
VBox.setMargin(closeButton, new Insets(10.0));
getChildren().addAll(tabPane, closeButton);
getChildren().addAll(tabPane, closeButton);
setCache(true);
setCache(true);
setCacheHint(CacheHint.SPEED);
setCacheHint(CacheHint.SPEED);
}
}
public void setDefaultTabToGeneral()
public void setDefaultTabToGeneral()
{
{
tabPane.getSelectionModel().selectFirst();
tabPane.getSelectionModel().selectFirst();
}
}
public Button getCloseButton()
public Button getCloseButton()
{
{
return closeButton;
return closeButton;
}
}
public GeneralSettings getGeneralSettings()
public GeneralSettings getGeneralSettings()
{
{
return generalSettings;
return generalSettings;
}
}
public PluginsSettings getPluginsSettings()
public PluginsSettings getPluginsSettings()
{
{
return pluginsSettings;
return pluginsSettings;
}
}
public ThemesSettings getThemesSettings()
public ThemesSettings getThemesSettings()
{
{
return themesSettings;
return themesSettings;
}
}
public ClientsSettings getClientsSettings()
public ClientsSettings getClientsSettings()
{
{
return clientsSettings;
return clientsSettings;
}
}
}
}