added a dialog to sow all licenses
* added a dialog to sow all licenses of all programms and libraries used int cemu_UI
This commit is contained in:
@ -24,11 +24,13 @@ package com.cemu_UI.application;
|
||||
import java.awt.Desktop;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.math.BigInteger;
|
||||
import java.net.HttpURLConnection;
|
||||
@ -41,6 +43,7 @@ import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.swing.ProgressMonitor;
|
||||
import javax.swing.ProgressMonitorInputStream;
|
||||
@ -48,6 +51,7 @@ import javax.swing.ProgressMonitorInputStream;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import com.cemu_UI.controller.SmmdbAPIController;
|
||||
import com.cemu_UI.controller.UpdateController;
|
||||
import com.cemu_UI.controller.dbController;
|
||||
@ -57,6 +61,7 @@ import com.cemu_UI.datatypes.UIROMDataType;
|
||||
import com.cemu_UI.uiElements.JFXEditGameDialog;
|
||||
import com.cemu_UI.uiElements.JFXInfoDialog;
|
||||
import com.cemu_UI.uiElements.JFXOkayCancelDialog;
|
||||
import com.cemu_UI.uiElements.JFXTestAreaInfoDialog;
|
||||
import com.jfoenix.controls.JFXButton;
|
||||
import com.jfoenix.controls.JFXColorPicker;
|
||||
import com.jfoenix.controls.JFXHamburger;
|
||||
@ -681,7 +686,27 @@ public class MainWindowController {
|
||||
EventHandler<ActionEvent> cancelAction = new EventHandler<ActionEvent>() {
|
||||
@Override
|
||||
public void handle(ActionEvent event) {
|
||||
// show licenses
|
||||
String headingText = "cemu_UI";
|
||||
String bodyText = "";
|
||||
|
||||
try {
|
||||
BufferedReader licenseBR = new BufferedReader(
|
||||
new InputStreamReader(getClass().getResourceAsStream("/licenses/licenses_show.txt")));
|
||||
String currentLine;
|
||||
|
||||
|
||||
while ((currentLine = licenseBR.readLine()) != null) {
|
||||
bodyText = bodyText + currentLine + "\n";
|
||||
}
|
||||
|
||||
licenseBR.close();
|
||||
} catch (IOException e) {
|
||||
LOGGER.error("Cloud not read the license file!", e);
|
||||
}
|
||||
|
||||
JFXTestAreaInfoDialog licenseDialog = new JFXTestAreaInfoDialog(headingText, bodyText,
|
||||
dialogBtnStyle, 510, 450, main.pane);
|
||||
licenseDialog.show();
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -0,0 +1,87 @@
|
||||
/**
|
||||
* cemu_UI
|
||||
*
|
||||
* Copyright 2017 <@Seil0>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
package com.cemu_UI.uiElements;
|
||||
|
||||
import com.jfoenix.controls.JFXButton;
|
||||
import com.jfoenix.controls.JFXDialog;
|
||||
import com.jfoenix.controls.JFXDialogLayout;
|
||||
import com.jfoenix.controls.JFXTextArea;
|
||||
|
||||
import javafx.event.ActionEvent;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.layout.Pane;
|
||||
import javafx.scene.layout.StackPane;
|
||||
import javafx.scene.text.Text;
|
||||
|
||||
public class JFXTestAreaInfoDialog {
|
||||
|
||||
private String headingText;
|
||||
private String bodyText;
|
||||
private String dialogBtnStyle;
|
||||
private int dialogWidth;
|
||||
private int dialogHeight;
|
||||
private Pane pane;
|
||||
|
||||
/**
|
||||
* Creates a new JFoenix Dialog to show some information
|
||||
* @param headingText Heading Text, just the heading
|
||||
* @param bodyText body Text, all other text belongs here
|
||||
* @param dialogBtnStyle Style of the okay button
|
||||
* @param dialogWidth dialog width
|
||||
* @param dialogHeight dialog height
|
||||
* @param pane pane to which the dialog belongs
|
||||
*/
|
||||
public JFXTestAreaInfoDialog(String headingText, String bodyText, String dialogBtnStyle, int dialogWidth, int dialogHeight, Pane pane) {
|
||||
this.headingText = headingText;
|
||||
this.bodyText = bodyText;
|
||||
this.dialogBtnStyle = dialogBtnStyle;
|
||||
this.dialogWidth = dialogWidth;
|
||||
this.dialogHeight = dialogHeight;
|
||||
this.pane = pane;
|
||||
}
|
||||
|
||||
public void show() {
|
||||
JFXDialogLayout content = new JFXDialogLayout();
|
||||
content.setHeading(new Text(headingText));
|
||||
content.setBody(new JFXTextArea(bodyText));
|
||||
content.setPrefSize(dialogWidth, dialogHeight);
|
||||
StackPane stackPane = new StackPane();
|
||||
stackPane.autosize();
|
||||
JFXDialog dialog = new JFXDialog(stackPane, content, JFXDialog.DialogTransition.LEFT, true);
|
||||
JFXButton button = new JFXButton("Okay");
|
||||
button.setOnAction(new EventHandler<ActionEvent>() {
|
||||
@Override
|
||||
public void handle(ActionEvent event) {
|
||||
dialog.close();
|
||||
}
|
||||
});
|
||||
button.setButtonType(com.jfoenix.controls.JFXButton.ButtonType.RAISED);
|
||||
button.setPrefHeight(32);
|
||||
button.setStyle(dialogBtnStyle);
|
||||
content.setActions(button);
|
||||
pane.getChildren().add(stackPane);
|
||||
AnchorPane.setTopAnchor(stackPane, (pane.getHeight() - content.getPrefHeight()) / 2);
|
||||
AnchorPane.setLeftAnchor(stackPane, (pane.getWidth() - content.getPrefWidth()) / 2);
|
||||
dialog.show();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user