15 Commits
047 ... 055

Author SHA1 Message Date
6a2c5d050f update 0.2.1 (055) 2017-11-14 23:44:49 +01:00
b8f4f89ec6 renamed SmmdbAPIQuery to SMMDBAPIController 2017-11-14 12:02:39 +01:00
dafd0b84df maven buildsystem
* maven is now used to build cemu_UI
* cleaned up a lot of code for better overview
2017-11-13 16:44:39 +01:00
06429eaf87 added jfxokaycanceldialog class
* added jfxokaycanceldialog class
* code clean up
2017-11-11 22:27:19 +01:00
9e3b553851 added jfxinfodialog class
* added jfxinfodialog class
* code clean up
2017-11-10 17:11:19 +01:00
61e02f6ac1 added support for updating to different branches
* added support for updating to different branches
* smmdb api fixed bad response from http url, using https now
* code clean-up
2017-11-10 15:58:20 +01:00
40c6084412 Update LICENSE 2017-11-06 21:33:05 +01:00
6cc9790c5a added update support
* added a manuall update function
* added a auto update function
2017-11-06 10:42:31 +01:00
3bcbf902d5 added adialog to explain missing values if adding a game manually 2017-11-06 10:00:10 +01:00
3f85fdf07b fiyed typos 2017-11-04 17:04:21 +01:00
40dd2c48d3 Merge remote-tracking branch 'origin/master' 2017-10-31 14:11:40 +01:00
1a4027e687 added edit dialog
* added a dialog for editing existing games
* a few UI clean ups
* you need to have valid values in every text field if you're adding a new game manually
2017-10-31 14:11:17 +01:00
b76126add1 Create CONTRIBUTING.md 2017-10-30 18:55:00 +01:00
9c4934966c UI clean up
* added a dialog if cloud sync init fails
*  fixed sideMenuSlideOut() is call even if its already outside
* code clean up
2017-10-30 18:28:58 +01:00
74440e3d7e add new Game is now one dialog
* add new game will now show only one dialog
* code clean up
2017-10-30 17:52:45 +01:00
126 changed files with 1149 additions and 513 deletions

View File

@ -1,29 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry kind="src" path="src"/> <classpathentry kind="src" output="target/classes" path="src/main/java">
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/> <attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.fx.ide.jdt.core.JAVAFX_CONTAINER"/> <classpathentry kind="con" path="org.eclipse.fx.ide.jdt.core.JAVAFX_CONTAINER"/>
<classpathentry kind="lib" path="src/libraries/minimal-json-0.9.4.jar"/> <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<classpathentry kind="lib" path="src/libraries/commons-vfs2-2.1.1744488.2.jar"/> <attributes>
<classpathentry kind="lib" path="src/libraries/flow-8.0.1.jar"/> <attribute name="maven.pomderived" value="true"/>
<classpathentry kind="lib" path="src/libraries/zip4j-1.3.2.jar"/> </attributes>
<classpathentry kind="lib" path="src/libraries/log4j-api-2.8.2.jar"/> </classpathentry>
<classpathentry kind="lib" path="src/libraries/log4j-core-2.8.2.jar"/> <classpathentry kind="output" path="target/classes"/>
<classpathentry kind="lib" path="src/libraries/sqlite-jdbc-3.20.0.jar"/>
<classpathentry kind="lib" path="src/libraries/jfoenix-1.9.1.jar"/>
<classpathentry kind="lib" path="src/libraries/commons-codec-1.11.jar"/>
<classpathentry kind="lib" path="src/libraries/commons-io-2.6.jar"/>
<classpathentry kind="lib" path="src/libraries/google_api_libraries/google-api-client-1.23.0.jar"/>
<classpathentry kind="lib" path="src/libraries/google_api_libraries/google-api-services-drive-v3-rev87-1.23.0.jar"/>
<classpathentry kind="lib" path="src/libraries/google_api_libraries/google-http-client-1.23.0.jar"/>
<classpathentry kind="lib" path="src/libraries/google_api_libraries/google-http-client-jackson2-1.23.0.jar"/>
<classpathentry kind="lib" path="src/libraries/google_api_libraries/google-oauth-client-1.23.0.jar"/>
<classpathentry kind="lib" path="src/libraries/google_api_libraries/google-oauth-client-java6-1.23.0.jar"/>
<classpathentry kind="lib" path="src/libraries/google_api_libraries/google-oauth-client-jetty-1.23.0.jar"/>
<classpathentry kind="lib" path="src/libraries/google_api_libraries/jackson-core-2.9.2.jar"/>
<classpathentry kind="lib" path="src/libraries/google_api_libraries/javax.servlet-api-4.0.0.jar"/>
<classpathentry kind="lib" path="src/libraries/google_api_libraries/jetty-6.1.26.jar"/>
<classpathentry kind="lib" path="src/libraries/google_api_libraries/jetty-util-6.1.26.jar"/>
<classpathentry kind="lib" path="src/libraries/commons-logging-1.1.1.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath> </classpath>

3
.gitignore vendored
View File

@ -48,4 +48,5 @@ Temporary Items
config.xml config.xml
client_secret.json client_secret.json
.directory .directory
target/
cemu_UI.jar

View File

@ -15,8 +15,14 @@
<arguments> <arguments>
</arguments> </arguments>
</buildCommand> </buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec> </buildSpec>
<natures> <natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.xtext.ui.shared.xtextNature</nature> <nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature> <nature>org.eclipse.jdt.core.javanature</nature>
</natures> </natures>

View File

@ -0,0 +1,5 @@
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/main/resources=UTF-8
encoding//src/test/java=UTF-8
encoding/<project>=UTF-8

View File

@ -9,4 +9,5 @@ org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.8 org.eclipse.jdt.core.compiler.source=1.8

View File

@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

27
CONTRIBUTING.md Normal file
View File

@ -0,0 +1,27 @@
# Contributing to cemu_UI
The following is a set of guidelines for contributing to cemu_UI.
## Java Sytleguide
If your willing to contribute to cemu_UI please us the following example as guide and rules to design your code.
* Use names for methods and variables that clarify their purpose. (This will help a lot to understand the code)
* Use as many spaces as necessary to make the code clear, but as little as possible.
* Sort all variables according to their type.
* For all (debugging) console outputs, use the log4j based logger. (syso/syse is okay for testing)
```java
// Use this as a sample Class:
public ClassName () {
void MethodName () {
double gameID; // Title-ID used on the Wii U
if (gameID == null) {
// Do something
}
// more code ...
}
}
```

17
LICENSE
View File

@ -1,13 +1,4 @@
"THE CHOCOLATE-WARE LICENSE" (Revision 1): GNU GENERAL PUBLIC LICENSE
<@Seil0> wrote this file. As long as you retain
this notice this software is licensed under the
GNU GENERAL PUBLIC LICENSE Version 3 ,with the following additions:
* If we meet some day, and you think this stuff is worth it,
you can buy me a chocolate in return. - @Seil0
(license based in Beer-ware, see https://fedoraproject.org/wiki/Licensing/Beerware )
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007 Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
@ -640,8 +631,8 @@ to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found. the "copyright" line and a pointer to where the full notice is found.
{one line to give the program's name and a brief idea of what it does.} <one line to give the program's name and a brief idea of what it does.>
Copyright (C) {year} {name of author} Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@ -661,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode: notice like this when it starts in an interactive mode:
{project} Copyright (C) {year} {fullname} <program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details. under certain conditions; type `show c' for details.

3
bin/.gitignore vendored
View File

@ -1,3 +0,0 @@
/application/
/cloudControllerInstances/
/datatypes/

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="ASCII"?>
<anttasks:AntTask xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:anttasks="http://org.eclipse.fx.ide.jdt/1.0" buildDirectory="${project}/build">
<deploy>
<application name="cemu_UI"/>
<info/>
</deploy>
<signjar/>
</anttasks:AntTask>

222
pom.xml Normal file
View File

@ -0,0 +1,222 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com</groupId>
<artifactId>cemu_UI</artifactId>
<version>0.2.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>cemu_UI</name>
<url>http://www.kellerkinder.xyz</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.jfoenix</groupId>
<artifactId>jfoenix</artifactId>
<version>1.9.0</version>
</dependency>
<dependency>
<groupId>com.eclipsesource.minimal-json</groupId>
<artifactId>minimal-json</artifactId>
<version>0.9.4</version>
</dependency>
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.20.0</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.9.0</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.9.0</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.5</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-vfs2 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-vfs2</artifactId>
<version>2.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-codec/commons-codec -->
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.11</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.datafx/flow -->
<dependency>
<groupId>io.datafx</groupId>
<artifactId>flow</artifactId>
<version>8.0.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/net.lingala.zip4j/zip4j -->
<dependency>
<groupId>net.lingala.zip4j</groupId>
<artifactId>zip4j</artifactId>
<version>1.3.2</version>
</dependency>
<!-- Google Drive-API libraries-->
<!-- https://mvnrepository.com/artifact/commons-logging/commons-logging -->
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.api-client/google-api-client -->
<dependency>
<groupId>com.google.api-client</groupId>
<artifactId>google-api-client</artifactId>
<version>1.23.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.apis/google-api-services-drive -->
<dependency>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-drive</artifactId>
<version>v3-rev87-1.23.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.http-client/google-http-client -->
<dependency>
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client</artifactId>
<version>1.23.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.http-client/google-http-client-jackson2 -->
<dependency>
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client-jackson2</artifactId>
<version>1.23.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.oauth-client/google-oauth-client -->
<dependency>
<groupId>com.google.oauth-client</groupId>
<artifactId>google-oauth-client</artifactId>
<version>1.23.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.oauth-client/google-oauth-client-java6 -->
<dependency>
<groupId>com.google.oauth-client</groupId>
<artifactId>google-oauth-client-java6</artifactId>
<version>1.23.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.oauth-client/google-oauth-client-jetty -->
<dependency>
<groupId>com.google.oauth-client</groupId>
<artifactId>google-oauth-client-jetty</artifactId>
<version>1.23.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.9.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.0-b01</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.mortbay.jetty/jetty -->
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty</artifactId>
<version>6.1.26</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.mortbay.jetty/jetty-util -->
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jetty-util</artifactId>
<version>6.1.26</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>libraries/</classpathPrefix>
<mainClass>com.cemu_UI.application.Main</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/libraries</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -1,124 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import com.jfoenix.controls.JFXButton?>
<?import com.jfoenix.controls.JFXColorPicker?>
<?import com.jfoenix.controls.JFXHamburger?>
<?import com.jfoenix.controls.JFXTextField?>
<?import com.jfoenix.controls.JFXToggleButton?>
<?import com.jfoenix.controls.JFXTreeTableView?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.text.Font?>
<?import javafx.scene.text.TextFlow?>
<AnchorPane fx:id="mainAnchorPane" prefHeight="600.0" prefWidth="904.0" xmlns="http://javafx.com/javafx/8.0.141" xmlns:fx="http://javafx.com/fxml/1" fx:controller="application.MainWindowController">
<children>
<ScrollPane fx:id="mainScrollPane" fitToWidth="true" layoutY="38.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="38.0">
<content>
<AnchorPane fx:id="gamesAnchorPane">
<padding>
<Insets bottom="17.0" />
</padding></AnchorPane>
</content>
</ScrollPane>
<HBox fx:id="topHBox" prefHeight="38.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children>
<JFXHamburger fx:id="menuHam" prefHeight="38.0" prefWidth="38.0" stylesheets="@MainWindows.css" />
</children>
</HBox>
<VBox fx:id="sideMenuVBox" layoutY="32.0" prefHeight="568.0" prefWidth="175.0" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="38.0">
<children>
<JFXButton fx:id="aboutBtn" alignment="TOP_LEFT" maxHeight="38.0" maxWidth="190.0" onAction="#aboutBtnAction" prefHeight="38.0" prefWidth="190.0" text="About" textAlignment="LEFT">
<font>
<Font name="System Bold" size="14.0" />
</font>
</JFXButton>
<JFXButton fx:id="settingsBtn" alignment="TOP_LEFT" maxHeight="38.0" maxWidth="213.0" onAction="#settingsBtnAction" prefHeight="38.0" prefWidth="213.0" text="Settings" textAlignment="LEFT">
<font>
<Font name="System Bold" size="14.0" />
</font>
</JFXButton>
<JFXButton fx:id="addBtn" alignment="TOP_LEFT" maxHeight="38.0" maxWidth="193.0" onAction="#addBtnAction" prefHeight="38.0" prefWidth="193.0" text="Add new Game" textAlignment="LEFT">
<font>
<Font name="System Bold" size="14.0" />
</font>
</JFXButton>
<JFXButton fx:id="reloadRomsBtn" alignment="TOP_LEFT" maxHeight="38.0" maxWidth="199.0" onAction="#reloadRomsBtnAction" prefHeight="38.0" prefWidth="199.0" text="reload roms" textAlignment="LEFT">
<font>
<Font name="System Bold" size="14.0" />
</font>
</JFXButton>
<JFXButton fx:id="smmdbBtn" alignment="TOP_LEFT" onAction="#smmdbBtnAction" prefHeight="38.0" prefWidth="216.0" text="smmdb">
<font>
<Font name="System Bold" size="14.0" />
</font>
</JFXButton>
</children>
</VBox>
<ScrollPane fx:id="settingsScrollPane" style="-fx-background: white;" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="175.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="38.0">
<content>
<!-- space between settings sections 35px, between sections elements (label + element) 20px, between label and element 3px(or more) -->
<AnchorPane fx:id="settingsAnchorPane" prefHeight="562.0" prefWidth="511.0" style="-fx-background-color: white;">
<children>
<Label fx:id="cemuDirectoryLbl" layoutX="10.0" layoutY="39.0" text="Cemu Directory" AnchorPane.leftAnchor="10.0" AnchorPane.topAnchor="39.0" />
<JFXTextField fx:id="cemuTextField" layoutX="10.0" layoutY="59.0" maxWidth="305.0" minWidth="305.0" onAction="#cemuTextFieldAction" prefHeight="32.0" prefWidth="305.0" promptText="cemu directory" AnchorPane.leftAnchor="10.0" AnchorPane.topAnchor="59.0" />
<JFXTextField fx:id="romTextField" layoutX="10.0" layoutY="131.0" maxWidth="305.0" minWidth="305.0" onAction="#romTextFieldAction" prefHeight="32.0" prefWidth="305.0" promptText="rom directory" AnchorPane.leftAnchor="10.0" AnchorPane.topAnchor="131.0" />
<JFXButton fx:id="romTFBtn" layoutX="329.0" layoutY="131.0" onAction="#romTFBtnAction" prefHeight="32.0" text="choose directory" AnchorPane.leftAnchor="329.0" AnchorPane.topAnchor="131.0" />
<JFXButton fx:id="cemuTFBtn" layoutX="329.0" layoutY="59.0" onAction="#cemuTFBtnAction" prefHeight="32.0" text="choose directory" AnchorPane.leftAnchor="329.0" AnchorPane.topAnchor="59.0" />
<JFXColorPicker fx:id="colorPicker" layoutX="12.0" layoutY="207.0" onAction="#colorPickerAction" AnchorPane.leftAnchor="12.0" AnchorPane.topAnchor="207.0" />
<JFXToggleButton fx:id="fullscreenToggleBtn" layoutX="16.0" layoutY="488.0" onAction="#fullscreenToggleBtnAction" text="start game in fullscreen" AnchorPane.bottomAnchor="14.0" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="488.0" />
<Label fx:id="romDirectoryLbl" layoutX="10.0" layoutY="111.0" text="Rom Directory" AnchorPane.leftAnchor="10.0" AnchorPane.topAnchor="111.0" />
<Label fx:id="mainColorLbl" layoutX="10.0" layoutY="183.0" text="main Color" AnchorPane.leftAnchor="10.0" AnchorPane.topAnchor="183.0" />
<Label fx:id="cemuSettingsLbl" layoutX="16.0" layoutY="450.0" text="Cemu Settings" AnchorPane.leftAnchor="16.0" AnchorPane.topAnchor="465.0">
<font>
<Font name="System Bold" size="14.0" />
</font>
</Label>
<Label fx:id="cemu_UISettingsLbl" layoutX="22.0" layoutY="14.0" text="cemu_UI Settings" AnchorPane.leftAnchor="18.0" AnchorPane.topAnchor="14.0">
<font>
<Font name="System Bold" size="14.0" />
</font>
</Label>
<JFXToggleButton fx:id="cloudSyncToggleBtn" layoutX="10.0" layoutY="247.0" onAction="#cloudSyncToggleBtnAction" text="cloud savegames (Google Drive)" AnchorPane.leftAnchor="10.0" AnchorPane.topAnchor="247.0" />
<Label fx:id="updateLbl" layoutX="10.0" layoutY="315.0" text="Updates" AnchorPane.leftAnchor="10.0" AnchorPane.topAnchor="315.0" />
<JFXButton fx:id="updateBtn" layoutX="14.0" layoutY="335.0" onAction="#updateBtnAction" prefHeight="32.0" prefWidth="111.0" text="check now!" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="335.0" />
<JFXToggleButton fx:id="autoUpdateToggleBtn" layoutX="10.0" layoutY="372.0" onAction="#autoUpdateToggleBtnAction" text="check for updates on startup" AnchorPane.leftAnchor="10.0" AnchorPane.topAnchor="372.0" />
</children>
</AnchorPane>
</content>
</ScrollPane>
<AnchorPane fx:id="smmdbAnchorPane" style="-fx-background-color: white;" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="175.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="38.0">
<children>
<JFXTreeTableView fx:id="courseTreeTable" layoutX="14.0" layoutY="14.0" prefHeight="537.0" prefWidth="405.0" AnchorPane.bottomAnchor="14.0" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="14.0" />
<ImageView fx:id="smmdbImageView" fitHeight="150.0" fitWidth="267.0" layoutX="436.0" layoutY="14.0" pickOnBounds="true" preserveRatio="true" AnchorPane.leftAnchor="436.0" AnchorPane.rightAnchor="14.0" AnchorPane.topAnchor="14.0" />
<ScrollPane fx:id="smmdbScrollPane" layoutX="436.0" layoutY="181.0" prefHeight="290.0" prefWidth="267.0" AnchorPane.bottomAnchor="91.0" AnchorPane.leftAnchor="436.0" AnchorPane.rightAnchor="14.0" AnchorPane.topAnchor="181.0">
<content>
<TextFlow fx:id="smmdbTextFlow" maxWidth="265.0" prefWidth="265.0" />
</content>
</ScrollPane>
<JFXButton fx:id="smmdbDownloadBtn" buttonType="RAISED" layoutX="436.0" layoutY="479.0" onAction="#smmdbDownloadBtnAction" prefHeight="38.0" prefWidth="267.0" text="download" AnchorPane.bottomAnchor="45.0" AnchorPane.leftAnchor="436.0" AnchorPane.rightAnchor="14.0" AnchorPane.topAnchor="479.0">
<font>
<Font name="System Bold" size="14.0" />
</font>
</JFXButton>
<Label fx:id="helpLabel" layoutX="436.0" layoutY="538.0" prefHeight="17.0" prefWidth="267.0" text="please help me improving this! click me!">
<font>
<Font size="14.0" />
</font>
</Label>
</children></AnchorPane>
<JFXButton fx:id="playBtn" buttonType="RAISED" layoutX="396.0" maxHeight="28.0" minWidth="100.0" onAction="#playBtnAction" ripplerFill="#00aacc" text="play" textAlignment="CENTER" visible="false" AnchorPane.bottomAnchor="12.0">
<font>
<Font name="System Bold" size="14.0" />
</font>
</JFXButton>
<JFXButton fx:id="totalPlaytimeBtn" buttonType="RAISED" layoutX="275.5" maxHeight="32.0" minWidth="100.0" onAction="#totalPlaytimeBtnAction" prefHeight="32.0" style="-fx-background-color: #ffffff; -fx-button-type: RAISED; -fx-text-fill: BLACK;" text="0 h 0 min" visible="false" AnchorPane.bottomAnchor="10.0">
</JFXButton>
<JFXButton fx:id="lastTimePlayedBtn" buttonType="RAISED" layoutX="516.5" maxHeight="32.0" minWidth="100.0" onAction="#lastTimePlayedBtnAction" prefHeight="32.0" style="-fx-background-color: #ffffff; -fx-button-type: RAISED; -fx-text-fill: BLACK;" text="Last played, never" visible="false" AnchorPane.bottomAnchor="10.0" />
</children>
</AnchorPane>

View File

@ -1,86 +0,0 @@
/*
* HAMBURGER CSS
*/
.jfx-hamburgerW StackPane {
-fx-background-color: white;
-fx-background-radius: 5px;
}
.jfx-hamburgerB StackPane {
-fx-background-color: black;
-fx-background-radius: 5px;
}
/*
* TREE TABLE CSS
*/
.tree-table-view {
-fx-tree-table-color: rgba(0, 168, 204, 0.2);
-fx-tree-table-rippler-color: rgba(0, 168, 204, 0.4);
}
.tree-table-view:focused .tree-table-row-cell:selected {
-fx-background-color: -fx-tree-table-color;
-fx-table-cell-border-color: -fx-tree-table-color;
-fx-text-fill: BLACK;
}
.tree-table-view:focused .tree-table-row-cell:selected .tree-table-cell {
-fx-text-fill: BLACK;
}
.tree-table-view .jfx-rippler {
-jfx-rippler-fill: -fx-tree-table-rippler-color;
}
.tree-table-view .column-header,
.tree-table-view .column-header-background,
.tree-table-view .column-header-background .filler {
-fx-background-color: TRANSPARENT;
}
.tree-table-view .column-header {
-fx-border-width: 0 1 0 1;
-fx-border-color: #F3F3F3;
}
.tree-table-view .column-header .label {
-fx-text-fill: #949494;
-fx-padding: 16 0 16 0;
}
.tree-table-view .column-header .arrow, .tree-table-view .column-header .sort-order-dot {
-fx-background-color: #949494;
}
.tree-table-view .column-header:last-visible {
-fx-border-width: 0 2 0 1;
}
.tree-table-view .column-header-background {
-fx-border-width: 0 0.0 1 0;
-fx-border-color: #F3F3F3;
}
.tree-table-view .tree-table-cell {
-fx-border-width: 0 0 0 0;
-fx-padding: 16 0 16 0;
}
.tree-table-view .column-overlay {
-fx-background-color: -fx-tree-table-color;
}
.tree-table-view .column-resize-line, .tree-table-view .column-drag-header {
-fx-background-color: -fx-tree-table-rippler-color;
}
.tree-table-view:focused {
-fx-background-color: -fx-tree-table-color, -fx-box-border, -fx-control-inner-background;
-fx-background-insets: -1.4, 0, 1;
-fx-background-radius: 1.4, 0, 0;
/*....*/
-fx-padding: 1; /* 0.083333em; */
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,20 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="INFO">
<Appenders>
<Console name="console" target="SYSTEM_OUT">
<PatternLayout pattern="[%-5level] %d{yyyy-MM-dd HH:mm:ss} [%t] %c{1} - %msg%n" />
</Console>
<File name="file" fileName="${sys:logFilename}" immediateFlush="true">
<PatternLayout pattern="[%-5level] %d{yyyy-MM-dd HH:mm:ss} [%t] %c{1} - %msg%n" />
</File>
</Appenders>
<Loggers>
<Root level="debug" additivity="false">
<AppenderRef ref="console" />
<AppenderRef ref="file"/>
</Root>
</Loggers>
</Configuration>

View File

@ -19,7 +19,7 @@
* MA 02110-1301, USA. * MA 02110-1301, USA.
*/ */
package application; package com.cemu_UI.application;
import java.io.File; import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
@ -33,6 +33,9 @@ import java.util.TimerTask;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import com.cemu_UI.controller.CloudController;
import javafx.application.Application; import javafx.application.Application;
import javafx.beans.value.ChangeListener; import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue; import javafx.beans.value.ObservableValue;
@ -66,16 +69,22 @@ public class Main extends Application {
@Override @Override
public void start(Stage primaryStage) { public void start(Stage primaryStage) {
this.primaryStage = primaryStage; try {
cloudController = new CloudController(this); this.primaryStage = primaryStage;
mainWindow(); cloudController = new CloudController(mainWindowController);
initActions(); mainWindow();
initActions();
} catch (Exception e) {
LOGGER.error("ooooops",e);
}
} }
private void mainWindow(){ private void mainWindow(){
try { try {
FXMLLoader loader = new FXMLLoader(Main.class.getResource("MainWindow.fxml")); FXMLLoader loader = new FXMLLoader();
pane = loader.load(); loader.setLocation(ClassLoader.getSystemResource("fxml/MainWindow.fxml"));
pane = (AnchorPane) loader.load();
// primaryStage.setResizable(false); // primaryStage.setResizable(false);
primaryStage.setTitle("cemu_UI"); primaryStage.setTitle("cemu_UI");
// primaryStage.getIcons().add(new Image(Main.class.getResourceAsStream("/resources/Homeflix_Icon_64x64.png"))); //adds application icon // primaryStage.getIcons().add(new Image(Main.class.getResourceAsStream("/resources/Homeflix_Icon_64x64.png"))); //adds application icon
@ -100,7 +109,7 @@ public class Main extends Application {
//startup checks //startup checks
//check if client_secret.jason is present //check if client_secret.jason is present
if (Main.class.getResourceAsStream("/resources/client_secret.json") == null) { if (Main.class.getResourceAsStream("/client_secret.json") == null) {
LOGGER.error("client_secret is missing!!!!!"); LOGGER.error("client_secret is missing!!!!!");
Alert alert = new Alert(AlertType.ERROR); Alert alert = new Alert(AlertType.ERROR);
@ -122,6 +131,7 @@ public class Main extends Application {
LOGGER.info("firststart, setting default values"); LOGGER.info("firststart, setting default values");
firstStart(); firstStart();
mainWindowController.setColor("00a8cc"); mainWindowController.setColor("00a8cc");
mainWindowController.setAutoUpdate(false);
mainWindowController.setxPosHelper(0); mainWindowController.setxPosHelper(0);
mainWindowController.saveSettings(); mainWindowController.saveSettings();
Runtime.getRuntime().exec("java -jar cemu_UI.jar"); //start again (preventing Bugs) Runtime.getRuntime().exec("java -jar cemu_UI.jar"); //start again (preventing Bugs)
@ -148,6 +158,7 @@ public class Main extends Application {
//loading settings and initialize UI, dbController.main() loads all databases //loading settings and initialize UI, dbController.main() loads all databases
mainWindowController.loadSettings(); mainWindowController.loadSettings();
mainWindowController.checkAutoUpdate();
mainWindowController.initActions(); mainWindowController.initActions();
mainWindowController.initUI(); mainWindowController.initUI();
mainWindowController.dbController.main(); mainWindowController.dbController.main();
@ -158,7 +169,7 @@ public class Main extends Application {
mainWindowController.addUIData(); mainWindowController.addUIData();
scene = new Scene(pane); //create new scene, append pane to scene scene = new Scene(pane); //create new scene, append pane to scene
scene.getStylesheets().add(Main.class.getResource("MainWindows.css").toExternalForm()); scene.getStylesheets().add(Main.class.getResource("/css/MainWindows.css").toExternalForm());
primaryStage.setScene(scene); //append scene to stage primaryStage.setScene(scene); //append scene to stage
primaryStage.show(); //show stage primaryStage.show(); //show stage
} catch (IOException e) { } catch (IOException e) {

View File

@ -19,7 +19,7 @@
* MA 02110-1301, USA. * MA 02110-1301, USA.
*/ */
package application; package com.cemu_UI.application;
import java.awt.Desktop; import java.awt.Desktop;
import java.awt.Graphics2D; import java.awt.Graphics2D;
@ -51,6 +51,14 @@ import org.apache.commons.io.FileUtils;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import com.cemu_UI.controller.SmmdbAPIController;
import com.cemu_UI.controller.UpdateController;
import com.cemu_UI.controller.dbController;
import com.cemu_UI.datatypes.CourseTableDataType;
import com.cemu_UI.datatypes.SmmdbApiDataType;
import com.cemu_UI.datatypes.UIROMDataType;
import com.cemu_UI.uiElements.JFXInfoDialog;
import com.cemu_UI.uiElements.JFXOkayCancelDialog;
import com.jfoenix.controls.JFXButton; import com.jfoenix.controls.JFXButton;
import com.jfoenix.controls.JFXColorPicker; import com.jfoenix.controls.JFXColorPicker;
import com.jfoenix.controls.JFXDialog; import com.jfoenix.controls.JFXDialog;
@ -62,9 +70,6 @@ import com.jfoenix.controls.JFXTreeTableColumn;
import com.jfoenix.controls.JFXTreeTableView; import com.jfoenix.controls.JFXTreeTableView;
import com.jfoenix.transitions.hamburger.HamburgerBackArrowBasicTransition; import com.jfoenix.transitions.hamburger.HamburgerBackArrowBasicTransition;
import datatypes.CourseTableDataType;
import datatypes.SmmdbApiDataType;
import datatypes.UIROMDataType;
import javafx.animation.FadeTransition; import javafx.animation.FadeTransition;
import javafx.animation.ParallelTransition; import javafx.animation.ParallelTransition;
import javafx.animation.TranslateTransition; import javafx.animation.TranslateTransition;
@ -78,18 +83,23 @@ import javafx.fxml.FXML;
import javafx.geometry.Insets; import javafx.geometry.Insets;
import javafx.scene.control.Alert; import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType; import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.Button;
import javafx.scene.control.ButtonBar.ButtonData;
import javafx.scene.control.ButtonType; import javafx.scene.control.ButtonType;
import javafx.scene.control.ChoiceBox;
import javafx.scene.control.ContextMenu; import javafx.scene.control.ContextMenu;
import javafx.scene.control.Dialog;
import javafx.scene.control.Label; import javafx.scene.control.Label;
import javafx.scene.control.MenuItem; import javafx.scene.control.MenuItem;
import javafx.scene.control.ScrollPane; import javafx.scene.control.ScrollPane;
import javafx.scene.control.TextInputDialog; import javafx.scene.control.TextField;
import javafx.scene.control.TreeItem; import javafx.scene.control.TreeItem;
import javafx.scene.image.Image; import javafx.scene.image.Image;
import javafx.scene.image.ImageView; import javafx.scene.image.ImageView;
import javafx.scene.input.MouseButton; import javafx.scene.input.MouseButton;
import javafx.scene.input.MouseEvent; import javafx.scene.input.MouseEvent;
import javafx.scene.layout.AnchorPane; import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.HBox; import javafx.scene.layout.HBox;
import javafx.scene.layout.StackPane; import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox; import javafx.scene.layout.VBox;
@ -166,6 +176,9 @@ public class MainWindowController {
@FXML @FXML
private JFXToggleButton fullscreenToggleBtn; private JFXToggleButton fullscreenToggleBtn;
@FXML
private ChoiceBox<String> branchChoisBox;
@FXML @FXML
private AnchorPane mainAnchorPane; private AnchorPane mainAnchorPane;
@ -215,6 +228,9 @@ public class MainWindowController {
@FXML @FXML
private Label updateLbl; private Label updateLbl;
@FXML
private Label branchLbl;
@FXML @FXML
private Label cemuSettingsLbl; private Label cemuSettingsLbl;
@ -239,12 +255,15 @@ public class MainWindowController {
Main main; Main main;
dbController dbController; dbController dbController;
SmmdbApiQuery smmdbApiQuery; SmmdbAPIController smmdbAPIController;
playGame playGame; playGame playGame;
private UpdateController updateController;
private boolean menuTrue = false; private boolean menuTrue = false;
private boolean settingsTrue = false; private boolean settingsTrue = false;
private boolean playTrue = false; private boolean playTrue = false;
private boolean smmdbTrue = false; private boolean smmdbTrue = false;
private boolean autoUpdate = false;
private boolean useBeta = false;
private boolean fullscreen; private boolean fullscreen;
private boolean cloudSync; private boolean cloudSync;
private String cloudService = ""; //set cloud provider (at the moment only GoogleDrive, Dropbox is planed) private String cloudService = ""; //set cloud provider (at the moment only GoogleDrive, Dropbox is planed)
@ -256,8 +275,8 @@ public class MainWindowController {
private String selectedGameTitleID; private String selectedGameTitleID;
private String selectedGameTitle; private String selectedGameTitle;
private String id; private String id;
private String version = "0.2.0"; private String version = "0.2.1";
private String buildNumber = "047"; private String buildNumber = "055";
private String versionName = "Puzzle Plank Galaxy"; private String versionName = "Puzzle Plank Galaxy";
private int xPos = -200; private int xPos = -200;
private int yPos = 17; private int yPos = 17;
@ -272,8 +291,9 @@ public class MainWindowController {
private File dirLinux = new File(System.getProperty("user.home") + "/cemu_UI"); private File dirLinux = new File(System.getProperty("user.home") + "/cemu_UI");
private File configFileWin = new File(dirWin + "/config.xml"); private File configFileWin = new File(dirWin + "/config.xml");
private File configFileLinux = new File(dirLinux + "/config.xml"); private File configFileLinux = new File(dirLinux + "/config.xml");
File pictureCacheWin = new File(dirWin+"/picture_cache"); private File pictureCacheWin = new File(dirWin+"/picture_cache");
File pictureCacheLinux = new File(dirLinux+"/picture_cache"); private File pictureCacheLinux = new File(dirLinux+"/picture_cache");
private ObservableList<String> branches = FXCollections.observableArrayList("stable", "beta");
private ObservableList<String> smmIDs = FXCollections.observableArrayList("fe31b7f2", "44fc5929"); //TODO add more IDs private ObservableList<String> smmIDs = FXCollections.observableArrayList("fe31b7f2", "44fc5929"); //TODO add more IDs
private ObservableList<UIROMDataType> games = FXCollections.observableArrayList(); private ObservableList<UIROMDataType> games = FXCollections.observableArrayList();
ObservableList<SmmdbApiDataType> courses = FXCollections.observableArrayList(); ObservableList<SmmdbApiDataType> courses = FXCollections.observableArrayList();
@ -282,6 +302,7 @@ public class MainWindowController {
Properties props = new Properties(); Properties props = new Properties();
Properties gameProps = new Properties(); Properties gameProps = new Properties();
private static final Logger LOGGER = LogManager.getLogger(MainWindowController.class.getName()); private static final Logger LOGGER = LogManager.getLogger(MainWindowController.class.getName());
private HamburgerBackArrowBasicTransition burgerTask;
private MenuItem edit = new MenuItem("edit"); private MenuItem edit = new MenuItem("edit");
private MenuItem remove = new MenuItem("remove"); private MenuItem remove = new MenuItem("remove");
private MenuItem update = new MenuItem("update"); private MenuItem update = new MenuItem("update");
@ -289,22 +310,22 @@ public class MainWindowController {
private ContextMenu gameContextMenu = new ContextMenu(edit, remove, update, addDLC); private ContextMenu gameContextMenu = new ContextMenu(edit, remove, update, addDLC);
private Label lastGameLabel = new Label(); private Label lastGameLabel = new Label();
private ImageView add_circle_black = new ImageView(new Image("resources/icons/ic_add_circle_black_24dp_1x.png")); private ImageView add_circle_black = new ImageView(new Image("icons/ic_add_circle_black_24dp_1x.png"));
private ImageView info_black = new ImageView(new Image("resources/icons/ic_info_black_24dp_1x.png")); private ImageView info_black = new ImageView(new Image("icons/ic_info_black_24dp_1x.png"));
private ImageView settings_black = new ImageView(new Image("resources/icons/ic_settings_black_24dp_1x.png")); private ImageView settings_black = new ImageView(new Image("icons/ic_settings_black_24dp_1x.png"));
private ImageView cached_black = new ImageView(new Image("resources/icons/ic_cached_black_24dp_1x.png")); private ImageView cached_black = new ImageView(new Image("icons/ic_cached_black_24dp_1x.png"));
private ImageView smmdb_black = new ImageView(new Image("resources/icons/ic_get_app_black_24dp_1x.png")); private ImageView smmdb_black = new ImageView(new Image("icons/ic_get_app_black_24dp_1x.png"));
private ImageView add_circle_white = new ImageView(new Image("resources/icons/ic_add_circle_white_24dp_1x.png")); private ImageView add_circle_white = new ImageView(new Image("icons/ic_add_circle_white_24dp_1x.png"));
private ImageView info_white = new ImageView(new Image("resources/icons/ic_info_white_24dp_1x.png")); private ImageView info_white = new ImageView(new Image("icons/ic_info_white_24dp_1x.png"));
private ImageView settings_white = new ImageView(new Image("resources/icons/ic_settings_white_24dp_1x.png")); private ImageView settings_white = new ImageView(new Image("icons/ic_settings_white_24dp_1x.png"));
private ImageView cached_white = new ImageView(new Image("resources/icons/ic_cached_white_24dp_1x.png")); private ImageView cached_white = new ImageView(new Image("icons/ic_cached_white_24dp_1x.png"));
private ImageView smmdb_white = new ImageView(new Image("resources/icons/ic_get_app_white_24dp_1x.png")); private ImageView smmdb_white = new ImageView(new Image("icons/ic_get_app_white_24dp_1x.png"));
private Image close_black = new Image("resources/icons/close_black_2048x2048.png"); private Image close_black = new Image("icons/close_black_2048x2048.png");
public void setMain(Main main) { public void setMain(Main main) {
this.main = main; this.main = main;
dbController = new dbController(this); dbController = new dbController(this);
smmdbApiQuery = new SmmdbApiQuery(); smmdbAPIController = new SmmdbAPIController();
} }
void initUI() { void initUI() {
@ -320,7 +341,15 @@ public class MainWindowController {
colorPicker.setValue(Color.valueOf(getColor())); colorPicker.setValue(Color.valueOf(getColor()));
fullscreenToggleBtn.setSelected(isFullscreen()); fullscreenToggleBtn.setSelected(isFullscreen());
cloudSyncToggleBtn.setSelected(isCloudSync()); cloudSyncToggleBtn.setSelected(isCloudSync());
edit.setDisable(true); autoUpdateToggleBtn.setSelected(isAutoUpdate());
branchChoisBox.setItems(branches);
if (isUseBeta()) {
branchChoisBox.getSelectionModel().select(1);
} else {
branchChoisBox.getSelectionModel().select(0);
}
applyColor(); applyColor();
//initialize courseTable //initialize courseTable
@ -352,7 +381,7 @@ public class MainWindowController {
void initActions() { void initActions() {
LOGGER.info("initializing Actions ..."); LOGGER.info("initializing Actions ...");
HamburgerBackArrowBasicTransition burgerTask = new HamburgerBackArrowBasicTransition(menuHam); burgerTask = new HamburgerBackArrowBasicTransition(menuHam);
menuHam.addEventHandler(MouseEvent.MOUSE_PRESSED, (e)->{ menuHam.addEventHandler(MouseEvent.MOUSE_PRESSED, (e)->{
if (playTrue) { if (playTrue) {
playBtnSlideOut(); playBtnSlideOut();
@ -362,7 +391,7 @@ public class MainWindowController {
burgerTask.setRate(-1.0); burgerTask.setRate(-1.0);
burgerTask.play(); burgerTask.play();
menuTrue = false; menuTrue = false;
}else{ } else {
sideMenuSlideIn(); sideMenuSlideIn();
burgerTask.setRate(1.0); burgerTask.setRate(1.0);
burgerTask.play(); burgerTask.play();
@ -394,7 +423,88 @@ public class MainWindowController {
alert.initOwner(main.primaryStage); alert.initOwner(main.primaryStage);
alert.showAndWait(); alert.showAndWait();
}else{ }else{
//TODO show edit window String[] gameInfo = dbController.getGameInfo(selectedGameTitleID);
//new Dialog
Dialog<Integer> dialog = new Dialog<>();
dialog.setTitle("edit game");
dialog.setHeaderText("You can edit the tile and rom/cover path.");
// Set the button types.
ButtonType okayBtn = new ButtonType("Okay", ButtonData.OK_DONE);
dialog.getDialogPane().getButtonTypes().addAll(okayBtn, ButtonType.CANCEL);
// Create gameTitle, titleID, gamePath and gameCover TextFields and Labels and two Btn for filechooser
GridPane grid = new GridPane();
grid.setHgap(10);
grid.setVgap(10);
grid.setPadding(new Insets(20, 150, 10, 10));
TextField gameTitleTF = new TextField();
gameTitleTF.setPromptText("game tile");
TextField titleIDTF = new TextField();
titleIDTF.setPromptText("title ID");
TextField romPathTF = new TextField();
romPathTF.setPromptText("ROM path");
TextField gameCoverTF = new TextField();
gameCoverTF.setPromptText("cover path");
gameTitleTF.setText(gameInfo[0]);
titleIDTF.setText(gameInfo[3]);
romPathTF.setText(gameInfo[2]);
gameCoverTF.setText(gameInfo[1]);
titleIDTF.setEditable(false);
Button selectPathBtn = new Button("select .rpx file");
Button selectCoverBtn = new Button("select cover file");
selectPathBtn.setPrefWidth(110);
selectCoverBtn.setPrefWidth(110);
selectPathBtn.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
FileChooser romDirectoryChooser = new FileChooser();
File romDirectory = romDirectoryChooser.showOpenDialog(main.primaryStage);
romPathTF.setText(romDirectory.getAbsolutePath());
}
});
selectCoverBtn.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
FileChooser coverDirectoryChooser = new FileChooser();
File coverDirectory = coverDirectoryChooser.showOpenDialog(main.primaryStage);
gameCoverTF.setText(coverDirectory.getAbsolutePath());
}
});
grid.add(new Label("game title:"), 0, 0);
grid.add(gameTitleTF, 1, 0);
grid.add(new Label("title id:"), 0, 1);
grid.add(titleIDTF, 1, 1);
grid.add(new Label("ROM path:"), 0, 2);
grid.add(romPathTF, 1, 2);
grid.add(selectPathBtn, 2, 2);
grid.add(new Label("cover path:"), 0, 3);
grid.add(gameCoverTF, 1, 3);
grid.add(selectCoverBtn, 2, 3);
dialog.getDialogPane().setContent(grid);
Optional<Integer> result2 = dialog.showAndWait();
if (result2.isPresent()){
dbController.setGameInfo(gameTitleTF.getText(), gameInfo[3], romPathTF.getText(), gameCoverTF.getText());
games.remove(selectedUIDataIndex);
dbController.loadSingleRom(gameInfo[3]);
refreshUIData();
LOGGER.info("successfully edited \"" + gameInfo[0] + "\", new name is \"" + gameTitleTF.getText() + "\"");
}
} }
} }
}); });
@ -605,6 +715,18 @@ public class MainWindowController {
} }
} }
}); });
branchChoisBox.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() {
@Override
public void changed(ObservableValue<? extends Number> ov, Number value, Number new_value) {
if (branchChoisBox.getItems().get((int) new_value).toString() == "beta") {
setUseBeta(true);
} else {
setUseBeta(false);
}
saveSettings();
}
});
LOGGER.info("initializing Actions done!"); LOGGER.info("initializing Actions done!");
} }
@ -615,29 +737,13 @@ public class MainWindowController {
} }
@FXML @FXML
void aboutBtnAction(){ void aboutBtnAction(){
JFXDialogLayout content= new JFXDialogLayout(); String headingText = "cemu_UI";
content.setHeading(new Text("cemu_UI")); String bodyText = "cemu_UI by @Seil0 \nVersion: " + version + " (" + buildNumber + ") \"" + versionName + "\" \n"
content.setBody(new Text("cemu_UI by @Seil0 \nVersion: "+version+" ("+buildNumber+") \""+versionName+"\" \nThis Application is made with free Software\nwww.kellerkinder.xyz")); + "This Application is made with free Software\n"
content.setPrefSize(350, 170); + "www.kellerkinder.xyz";
StackPane stackPane = new StackPane(); JFXInfoDialog aboutDialog = new JFXInfoDialog(headingText, bodyText, dialogBtnStyle, 350, 170, main.pane);
stackPane.autosize(); aboutDialog.show();
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);
main.pane.getChildren().add(stackPane);
AnchorPane.setTopAnchor(stackPane, (main.pane.getHeight()-content.getPrefHeight())/2);
AnchorPane.setLeftAnchor(stackPane, (main.pane.getWidth()-content.getPrefWidth())/2);
dialog.show();
} }
@FXML @FXML
@ -676,7 +782,7 @@ public class MainWindowController {
//start query //start query
courses.removeAll(courses); courses.removeAll(courses);
courses.addAll(smmdbApiQuery.startQuery()); courses.addAll(smmdbAPIController.startQuery());
//add query response to courseTreeTable //add query response to courseTreeTable
for(int i = 0; i < courses.size(); i++){ for(int i = 0; i < courses.size(); i++){
@ -744,13 +850,20 @@ public class MainWindowController {
@FXML @FXML
void updateBtnAction(ActionEvent event) { void updateBtnAction(ActionEvent event) {
// TODO implement and call update method updateController = new UpdateController(this, buildNumber, useBeta);
Thread updateThread = new Thread(updateController);
updateThread.setName("Updater");
updateThread.start();
} }
@FXML @FXML
void autoUpdateToggleBtnAction(ActionEvent event) { void autoUpdateToggleBtnAction(ActionEvent event) {
// TODO implement auto update function if(isAutoUpdate()){
} setAutoUpdate(false);
}else{
setAutoUpdate(true);
}
saveSettings(); }
@FXML @FXML
void smmdbDownloadBtnAction(ActionEvent event){ void smmdbDownloadBtnAction(ActionEvent event){
@ -844,54 +957,43 @@ public class MainWindowController {
if(cloudSync) { if(cloudSync) {
cloudSync = false; cloudSync = false;
} else { } else {
String headingText = "activate cloud savegame sync (beta)";
JFXDialogLayout content= new JFXDialogLayout(); String bodyText = "You just activate the cloud savegame sync function of cemu_UI, "
content.setHeading(new Text("activate cloud savegame sync (beta)")); + "\nwhich is currently in beta. Are you sure you want to do this?";
content.setBody(new Text("You just activate the cloud savegame sync function of cemu_UI, \nwhich is currently in beta. Are you sure you want to do this?"));
StackPane stackPane = new StackPane(); EventHandler<ActionEvent> okayAction = new EventHandler<ActionEvent>(){
stackPane.autosize(); @Override
JFXDialog dialog = new JFXDialog(stackPane, content, JFXDialog.DialogTransition.LEFT, true); public void handle(ActionEvent event){
JFXButton okayBtn = new JFXButton("Okay"); cloudSync = true;
okayBtn.setOnAction(new EventHandler<ActionEvent>(){ //TODO rework for other cloud services
@Override cloudService = "GoogleDrive";
public void handle(ActionEvent event){ if (main.cloudController.initializeConnection(getCloudService(), getCemuPath())) {
cloudSync = true; main.cloudController.sync(getCloudService(), getCemuPath());
//TODO rework for other cloud services saveSettings();
cloudService = "GoogleDrive"; } else {
if (main.cloudController.initializeConnection(getCloudService(), getCemuPath())) { cloudSyncToggleBtn.setSelected(false);
main.cloudController.sync(getCloudService(), getCemuPath());
saveSettings(); //cloud sync init error dialog
} else { String headingText = "Error while initializing cloud sync!";
cloudSyncToggleBtn.setSelected(false); String bodyText = "There was some truble adding your game."
// TODO show error message + "\nPlease upload the app.log (which can be found in the cemu_UI directory)"
} + "\nto \"https://github.com/Seil0/cemu_UI/issues\" so we can fix this.";
JFXInfoDialog cloudSyncErrorDialog = new JFXInfoDialog(headingText, bodyText, dialogBtnStyle, 450, 170, main.pane);
// saveSettings(); cloudSyncErrorDialog.show();
dialog.close(); }
} }
}); };
JFXButton cancelBtn = new JFXButton("Cancel");
cancelBtn.setOnAction(new EventHandler<ActionEvent>(){ EventHandler<ActionEvent> cancelAction = new EventHandler<ActionEvent>(){
@Override @Override
public void handle(ActionEvent event){ public void handle(ActionEvent event){
cloudSyncToggleBtn.setSelected(false); cloudSyncToggleBtn.setSelected(false);
dialog.close(); }
} };
});
Label placeholder = new Label(); JFXOkayCancelDialog cloudSyncErrorDialog = new JFXOkayCancelDialog(headingText, bodyText, dialogBtnStyle,
placeholder.setPrefSize(15, 10); 419, 140, okayAction, cancelAction, main.pane);
okayBtn.setButtonType(com.jfoenix.controls.JFXButton.ButtonType.RAISED); cloudSyncErrorDialog.show();
cancelBtn.setButtonType(com.jfoenix.controls.JFXButton.ButtonType.RAISED);
okayBtn.setPrefHeight(32);
cancelBtn.setPrefHeight(32);
okayBtn.setStyle(dialogBtnStyle);
cancelBtn.setStyle(dialogBtnStyle);
content.setActions(cancelBtn, placeholder, okayBtn);
content.setPrefSize(419, 140);
main.pane.getChildren().add(stackPane);
AnchorPane.setTopAnchor(stackPane, (main.pane.getHeight()-content.getPrefHeight())/2);
AnchorPane.setLeftAnchor(stackPane, (main.pane.getWidth()-content.getPrefWidth())/2);
dialog.show();
} }
} }
@ -903,106 +1005,142 @@ public class MainWindowController {
@FXML @FXML
void addBtnAction(ActionEvent event){ void addBtnAction(ActionEvent event){
boolean exit = false;
String romPath = null; String romPath = null;
String coverPath = null; String coverPath = null;
String coverName = null; String coverName = null;
String title = null; String title = null;
String titleID = null; String titleID = null;
File pictureCache; File pictureCache;
TextInputDialog titleDialog = new TextInputDialog();
titleDialog.setTitle("cemu_UI");
titleDialog.setHeaderText("add new Game");
titleDialog.setContentText("Please enter the name of the game you want to add:");
titleDialog.initOwner(main.primaryStage);
Optional<String> titleResult = titleDialog.showAndWait(); //new Dialog
if (titleResult.isPresent()){ Dialog<Integer> dialog = new Dialog<>();
title = titleResult.get(); dialog.setTitle("add a new game");
}else{ dialog.setHeaderText("add a new game manually to cemu UI");
exit = true;
} // Set the button types.
ButtonType okayBtn = new ButtonType("Okay", ButtonData.OK_DONE);
dialog.getDialogPane().getButtonTypes().addAll(okayBtn, ButtonType.CANCEL);
// Create gameTitle, titleID, gamePath and gameCover TextFields and Labels and two Btn for filechooser
GridPane grid = new GridPane();
grid.setHgap(10);
grid.setVgap(10);
grid.setPadding(new Insets(20, 150, 10, 10));
TextField gameTitleTF = new TextField();
gameTitleTF.setPromptText("game tile");
TextField titleIDTF = new TextField();
titleIDTF.setPromptText("title ID");
TextField romPathTF = new TextField();
romPathTF.setPromptText("ROM path");
TextField gameCoverTF = new TextField();
gameCoverTF.setPromptText("cover path");
if(exit == false){ Button selectPathBtn = new Button("select .rpx file");
TextInputDialog titleIDDialog = new TextInputDialog(); Button selectCoverBtn = new Button("select cover file");
titleIDDialog.setTitle("cemu_UI");
titleIDDialog.setHeaderText("add new Game"); selectPathBtn.setPrefWidth(110);
titleIDDialog.setContentText("Please enter the title-ID (12345678-12345678) \nof the game you want to add:"); selectCoverBtn.setPrefWidth(110);
titleIDDialog.initOwner(main.primaryStage);
selectPathBtn.setOnAction(new EventHandler<ActionEvent>() {
Optional<String> titleIDResult = titleIDDialog.showAndWait(); @Override
if (titleIDResult.isPresent()){ public void handle(ActionEvent event) {
titleID = titleIDResult.get(); FileChooser romDirectoryChooser = new FileChooser();
}else{ File romDirectory = romDirectoryChooser.showOpenDialog(main.primaryStage);
exit = true; romPathTF.setText(romDirectory.getAbsolutePath());
} }
});
selectCoverBtn.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
FileChooser coverDirectoryChooser = new FileChooser();
File coverDirectory = coverDirectoryChooser.showOpenDialog(main.primaryStage);
gameCoverTF.setText(coverDirectory.getAbsolutePath());
}
});
grid.add(new Label("game title:"), 0, 0);
grid.add(gameTitleTF, 1, 0);
grid.add(new Label("title id:"), 0, 1);
grid.add(titleIDTF, 1, 1);
grid.add(new Label("ROM path:"), 0, 2);
grid.add(romPathTF, 1, 2);
grid.add(selectPathBtn, 2, 2);
grid.add(new Label("cover path:"), 0, 3);
grid.add(gameCoverTF, 1, 3);
grid.add(selectCoverBtn, 2, 3);
dialog.getDialogPane().setContent(grid);
Optional<Integer> result2 = dialog.showAndWait();
if (result2.isPresent()){
romPath = romPathTF.getText();
coverPath = gameCoverTF.getText();
title = gameTitleTF.getText();
titleID = titleIDTF.getText();
LOGGER.info("New game data \"" + title + "\", title-ID: " + titleID + "(not a bug!)");
} }
if(exit == false){
Alert romAlert = new Alert(AlertType.CONFIRMATION); //new alert with file-chooser
romAlert.setTitle("cemu_UI");
romAlert.setHeaderText("add new Game");
romAlert.setContentText("Please select the .rpx file from the game you want to add.");
romAlert.initOwner(main.primaryStage);
Optional<ButtonType> result = romAlert.showAndWait();
if (result.get() == ButtonType.OK){
FileChooser directoryChooser = new FileChooser();
File selectedDirectory = directoryChooser.showOpenDialog(main.primaryStage);
romPath = selectedDirectory.getAbsolutePath();
} else {
exit = true;
}
}
if(exit == false){
Alert coverAlert = new Alert(AlertType.CONFIRMATION); //new alert with file-chooser
coverAlert.setTitle("cemu_UI");
coverAlert.setHeaderText("add new Game");
coverAlert.setContentText("Please select the cover for the game you want to add.");
coverAlert.initOwner(main.primaryStage);
Optional<ButtonType> coverResult = coverAlert.showAndWait();
if (coverResult.get() == ButtonType.OK){
FileChooser directoryChooser = new FileChooser();
File selectedDirectory = directoryChooser.showOpenDialog(main.primaryStage);
coverPath = selectedDirectory.getAbsolutePath();
} else {
exit = true;
}
}
/** /**
* if exit == true then don't add a rom * if one parameter dosen't contain any value do not add the game
* else convert the cover to .png add copy it into the picture cache * else convert the cover to .png add copy it into the picture cache,
* then add the rom to the local_roms database * then add the rom to the local_roms database
*/ */
if(exit){ System.out.println(romPath.length());
if (romPath.length() == 0 || coverPath.length() == 0 || title.length() == 0 || titleID.length() == 0) {
LOGGER.info("No parameter set!"); LOGGER.info("No parameter set!");
}else{
//addGame error dialog
JFXDialogLayout content= new JFXDialogLayout();
content.setHeading(new Text("Error while adding a new Game!"));
content.setBody(new Text("There was some truble adding your game."
+ "\nOne of the needed values was empty, please try again to add your game."));
content.setPrefSize(450, 170);
StackPane stackPane = new StackPane();
stackPane.autosize();
JFXDialog errorDialog =new JFXDialog(stackPane, content, JFXDialog.DialogTransition.LEFT, true);
JFXButton button=new JFXButton("Okay");
button.setOnAction(new EventHandler<ActionEvent>(){
@Override
public void handle(ActionEvent event){
errorDialog.close();
}
});
button.setButtonType(com.jfoenix.controls.JFXButton.ButtonType.RAISED);
button.setPrefHeight(32);
button.setStyle(dialogBtnStyle);
content.setActions(button);
main.pane.getChildren().add(stackPane);
AnchorPane.setTopAnchor(stackPane, (main.pane.getHeight()-content.getPrefHeight())/2);
AnchorPane.setLeftAnchor(stackPane, (main.pane.getWidth()-content.getPrefWidth())/2);
errorDialog.show();
} else {
coverName = new File(coverPath).getName(); coverName = new File(coverPath).getName();
try { try {
if(System.getProperty("os.name").equals("Linux")){ if (System.getProperty("os.name").equals("Linux")) {
pictureCache = pictureCacheLinux; pictureCache = getPictureCacheLinux();
}else{ } else {
pictureCache = pictureCacheWin; pictureCache = getPictureCacheWin();
} }
BufferedImage originalImage = ImageIO.read(new File(coverPath));//load cover BufferedImage originalImage = ImageIO.read(new File(coverPath)); //load cover
int type = originalImage.getType() == 0 ? BufferedImage.TYPE_INT_ARGB : originalImage.getType(); int type = originalImage.getType() == 0 ? BufferedImage.TYPE_INT_ARGB : originalImage.getType();
BufferedImage resizeImagePNG = resizeImage(originalImage, type, 400, 600); BufferedImage resizeImagePNG = resizeImage(originalImage, type, 400, 600);
ImageIO.write(resizeImagePNG, "png", new File(pictureCache+"\\"+coverName)); //save image to pictureCache ImageIO.write(resizeImagePNG, "png", new File(pictureCache+"\\"+coverName)); //save image to pictureCache
coverPath = pictureCache+"\\"+coverName; coverPath = pictureCache+"\\"+coverName;
} catch (IOException e) { } catch (IOException e) {
LOGGER.error("Ops something went wrong!", e); LOGGER.error("Ops something went wrong! Error while resizing cover.", e);
} }
try { try {
dbController.addRom(title, coverPath, romPath, titleID, "", "", "", "0"); dbController.addRom(title, coverPath, romPath, titleID, "", "", "", "0");
dbController.loadSingleRom(titleID); dbController.loadSingleRom(titleID);
refreshUIData();
} catch (SQLException e) { } catch (SQLException e) {
LOGGER.error("Oops, something went wrong! Error during adding a game.", e); LOGGER.error("Oops, something went wrong! Error while adding a game.", e);
} }
} }
} }
@ -1014,7 +1152,7 @@ public class MainWindowController {
* @param romPath : path to ROM file (.rpx) * @param romPath : path to ROM file (.rpx)
* @param titleID : ROM ID * @param titleID : ROM ID
*/ */
void addGame(String title, String coverPath, String romPath, String titleID){ public void addGame(String title, String coverPath, String romPath, String titleID){
VBox VBox = new VBox(); VBox VBox = new VBox();
Label gameTitleLabel = new Label(); Label gameTitleLabel = new Label();
JFXButton gameBtn = new JFXButton(); JFXButton gameBtn = new JFXButton();
@ -1093,6 +1231,9 @@ public class MainWindowController {
} }
if (menuTrue) { if (menuTrue) {
sideMenuSlideOut(); sideMenuSlideOut();
burgerTask.setRate(-1.0);
burgerTask.play();
menuTrue = false;
} }
} }
@ -1145,6 +1286,22 @@ public class MainWindowController {
lastTimePlayedBtn.setLayoutX((width/2)+50+20.5); lastTimePlayedBtn.setLayoutX((width/2)+50+20.5);
} }
void checkAutoUpdate() {
if(isAutoUpdate()){
try {
LOGGER.info("AutoUpdate: looking for updates on startup ...");
updateController = new UpdateController(this, buildNumber, useBeta);
Thread updateThread = new Thread(updateController);
updateThread.setName("Updater");
updateThread.start();
updateThread.join();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
private void addCourseDescription(SmmdbApiDataType course) { private void addCourseDescription(SmmdbApiDataType course) {
String courseTheme; String courseTheme;
String gameStyle; String gameStyle;
@ -1272,8 +1429,9 @@ public class MainWindowController {
private void generatePosition() { private void generatePosition() {
int xPosHelperMax; int xPosHelperMax;
//FIXME somehow the window width is set to 8, if we can find a way to get always the real window with /**FIXME somehow the window width is set to 8, if we can find a way to get always the real window with
//(at the beginning we have to use prefWidth after resizing Width) we can remove this *(at the beginning we have to use prefWidth after resizing Width) we can remove this
*/
if (mainAnchorPane.getWidth() < 10) { if (mainAnchorPane.getWidth() < 10) {
xPosHelperMax = (int) Math.floor((mainAnchorPane.getPrefWidth() - 36) / 217); xPosHelperMax = (int) Math.floor((mainAnchorPane.getPrefWidth() - 36) / 217);
} else { } else {
@ -1290,7 +1448,7 @@ public class MainWindowController {
xPosHelper++; xPosHelper++;
} }
// System.out.println("Breit: " + mainAnchorPane.getPrefWidth()); // System.out.println("Breit: " + main.pane.getWidth());
// System.out.println("Breit2: " + mainAnchorPane.getWidth()); // System.out.println("Breit2: " + mainAnchorPane.getWidth());
// System.out.println("xPosHelper: " + xPosHelper); // System.out.println("xPosHelper: " + xPosHelper);
// System.out.println("yPos: " + yPos); // System.out.println("yPos: " + yPos);
@ -1360,7 +1518,7 @@ public class MainWindowController {
} }
} }
void saveSettings(){ public void saveSettings(){
LOGGER.info("saving Settings ..."); LOGGER.info("saving Settings ...");
OutputStream outputStream; //new output-stream OutputStream outputStream; //new output-stream
try { try {
@ -1368,7 +1526,9 @@ public class MainWindowController {
props.setProperty("romPath", getRomPath()); props.setProperty("romPath", getRomPath());
props.setProperty("color", getColor()); props.setProperty("color", getColor());
props.setProperty("fullscreen", String.valueOf(isFullscreen())); props.setProperty("fullscreen", String.valueOf(isFullscreen()));
props.setProperty("cloudSync", String.valueOf(cloudSync)); props.setProperty("cloudSync", String.valueOf(isCloudSync()));
props.setProperty("autoUpdate", String.valueOf(isAutoUpdate()));
props.setProperty("useBeta", String.valueOf(isUseBeta()));
if (getCloudService() == null) { if (getCloudService() == null) {
props.setProperty("cloudService", ""); props.setProperty("cloudService", "");
} else { } else {
@ -1440,6 +1600,20 @@ public class MainWindowController {
setCloudSync(false); setCloudSync(false);
} }
try {
setAutoUpdate(Boolean.parseBoolean(props.getProperty("autoUpdate")));
} catch (Exception e) {
LOGGER.error("cloud not load autoUpdate", e);
setAutoUpdate(false);
}
try {
setUseBeta(Boolean.parseBoolean(props.getProperty("useBeta")));
} catch (Exception e) {
LOGGER.error("cloud not load autoUpdate", e);
setUseBeta(false);
}
try { try {
setCloudService(props.getProperty("cloudService")); setCloudService(props.getProperty("cloudService"));
} catch (Exception e) { } catch (Exception e) {
@ -1610,6 +1784,22 @@ public class MainWindowController {
this.color = color; this.color = color;
} }
public File getPictureCacheLinux() {
return pictureCacheLinux;
}
public void setPictureCacheLinux(File pictureCacheLinux) {
this.pictureCacheLinux = pictureCacheLinux;
}
public File getPictureCacheWin() {
return pictureCacheWin;
}
public void setPictureCacheWin(File pictureCacheWin) {
this.pictureCacheWin = pictureCacheWin;
}
public int getxPos() { public int getxPos() {
return xPos; return xPos;
} }
@ -1650,6 +1840,22 @@ public class MainWindowController {
this.cloudSync = cloudSync; this.cloudSync = cloudSync;
} }
public boolean isAutoUpdate() {
return autoUpdate;
}
public void setAutoUpdate(boolean autoUpdate) {
this.autoUpdate = autoUpdate;
}
public boolean isUseBeta() {
return useBeta;
}
public void setUseBeta(boolean useBeta) {
this.useBeta = useBeta;
}
public String getGameExecutePath() { public String getGameExecutePath() {
return gameExecutePath; return gameExecutePath;
} }
@ -1710,4 +1916,8 @@ public class MainWindowController {
return mainAnchorPane; return mainAnchorPane;
} }
public JFXButton getUpdateBtn() {
return updateBtn;
}
} }

View File

@ -19,13 +19,15 @@
* MA 02110-1301, USA. * MA 02110-1301, USA.
*/ */
package application; package com.cemu_UI.application;
import java.io.IOException; import java.io.IOException;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import com.cemu_UI.controller.dbController;
import javafx.application.Platform; import javafx.application.Platform;
public class playGame extends Thread{ public class playGame extends Thread{
@ -34,7 +36,7 @@ public class playGame extends Thread{
dbController dbController; dbController dbController;
private static final Logger LOGGER = LogManager.getLogger(playGame.class.getName()); private static final Logger LOGGER = LogManager.getLogger(playGame.class.getName());
public playGame(MainWindowController m, dbController db){ public playGame(MainWindowController m, com.cemu_UI.controller.dbController db){
mainWindowController = m; mainWindowController = m;
dbController = db; dbController = db;
} }

View File

@ -19,7 +19,7 @@
* MA 02110-1301, USA. * MA 02110-1301, USA.
*/ */
package application; package com.cemu_UI.controller;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
@ -27,20 +27,22 @@ import java.io.IOException;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import cloudControllerInstances.GoogleDriveController; import com.cemu_UI.application.MainWindowController;
import com.cemu_UI.vendorCloudController.GoogleDriveController;
import javafx.application.Platform; import javafx.application.Platform;
public class CloudController { public class CloudController {
public CloudController(Main ma) { public CloudController(MainWindowController mwc) {
main = ma; this.mwc = mwc;
} }
private Main main; private MainWindowController mwc;
private GoogleDriveController googleDriveController = new GoogleDriveController(); private GoogleDriveController googleDriveController = new GoogleDriveController();
private static final Logger LOGGER = LogManager.getLogger(CloudController.class.getName()); private static final Logger LOGGER = LogManager.getLogger(CloudController.class.getName());
boolean initializeConnection(String cloudService, String cemuDirectory) { public boolean initializeConnection(String cloudService, String cemuDirectory) {
boolean success = false; boolean success = false;
LOGGER.info("sartting cloud initialisation ..."); LOGGER.info("sartting cloud initialisation ...");
@ -62,23 +64,23 @@ public class CloudController {
return success; return success;
} }
void stratupCheck(String cloudService, String cemuDirectory) { public void stratupCheck(String cloudService, String cemuDirectory) {
if(cloudService.equals("GoogleDrive")) { if(cloudService.equals("GoogleDrive")) {
LOGGER.info("starting startup check google drive ..."); LOGGER.info("starting startup check google drive ...");
try { try {
if (!googleDriveController.checkFolder()) { if (!googleDriveController.checkFolder()) {
googleDriveController.creatFolder(); googleDriveController.creatFolder();
main.mainWindowController.saveSettings(); mwc.saveSettings();
Thread thread = new Thread(new Runnable() { Thread thread = new Thread(new Runnable() {
@Override @Override
public void run() { public void run() {
Platform.runLater(() -> { Platform.runLater(() -> {
main.mainWindowController.getPlayBtn().setText("syncing..."); mwc.getPlayBtn().setText("syncing...");
}); });
googleDriveController.uploadAllFiles(); googleDriveController.uploadAllFiles();
Platform.runLater(() -> { Platform.runLater(() -> {
main.mainWindowController.getPlayBtn().setText("play"); mwc.getPlayBtn().setText("play");
}); });
} }
}); });
@ -97,14 +99,14 @@ public class CloudController {
void sync(String cloudService, String cemuDirectory) { public void sync(String cloudService, String cemuDirectory) {
//running sync in a new thread, instead of blocking the main thread //running sync in a new thread, instead of blocking the main thread
Thread thread = new Thread(new Runnable() { Thread thread = new Thread(new Runnable() {
@Override @Override
public void run() { public void run() {
Platform.runLater(() -> { Platform.runLater(() -> {
main.mainWindowController.getPlayBtn().setText("syncing..."); mwc.getPlayBtn().setText("syncing...");
}); });
LOGGER.info("starting synchronization in new thread ..."); LOGGER.info("starting synchronization in new thread ...");
@ -119,9 +121,9 @@ public class CloudController {
} }
Platform.runLater(() -> { Platform.runLater(() -> {
main.mainWindowController.getPlayBtn().setText("play"); mwc.getPlayBtn().setText("play");
}); });
main.mainWindowController.saveSettings(); mwc.saveSettings();
LOGGER.info("synchronization successful!"); LOGGER.info("synchronization successful!");
} }
}); });

View File

@ -19,7 +19,7 @@
* MA 02110-1301, USA. * MA 02110-1301, USA.
*/ */
package application; package com.cemu_UI.controller;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.IOException; import java.io.IOException;
@ -30,18 +30,17 @@ import java.util.ArrayList;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.Logger;
import com.cemu_UI.datatypes.SmmdbApiDataType;
import com.eclipsesource.json.Json; import com.eclipsesource.json.Json;
import com.eclipsesource.json.JsonArray; import com.eclipsesource.json.JsonArray;
import com.eclipsesource.json.JsonValue; import com.eclipsesource.json.JsonValue;
import datatypes.SmmdbApiDataType; public class SmmdbAPIController {
public class SmmdbApiQuery {
private String URL = "http://smmdb.ddns.net/api/getcourses?format=json"; private String URL = "https://smmdb.ddns.net/api/getcourses?format=json";
private static final Logger LOGGER = LogManager.getLogger(SmmdbApiQuery.class.getName()); private static final Logger LOGGER = LogManager.getLogger(SmmdbAPIController.class.getName());
public SmmdbApiQuery() { public SmmdbAPIController() {
//Auto-generated constructor stub //Auto-generated constructor stub
} }

View File

@ -0,0 +1,158 @@
/**
* 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.controller;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import javax.swing.ProgressMonitor;
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.application.MainWindowController;
import com.eclipsesource.json.Json;
import com.eclipsesource.json.JsonArray;
import com.eclipsesource.json.JsonObject;
import com.eclipsesource.json.JsonValue;
import javafx.application.Platform;
public class UpdateController implements Runnable{
private MainWindowController mainWindowController;
private String buildNumber;
private String apiOutput;
private String updateBuildNumber; //tag_name from Github
private String browserDownloadUrl; //update download link
private String githubApiRelease = "https://api.github.com/repos/Seil0/cemu_UI/releases/latest";
private String githubApiBeta = "https://api.github.com/repos/Seil0/cemu_UI/releases";
private URL githubApiUrl;
private boolean useBeta;
private static final Logger LOGGER = LogManager.getLogger(UpdateController.class.getName());
/**
* updater for cemu_UI based on Project HomeFlix
* checks for Updates and download it in case there is one
*/
public UpdateController(MainWindowController mwc, String buildNumber, boolean useBeta){
mainWindowController = mwc;
this.buildNumber = buildNumber;
this.useBeta = useBeta;
}
public void run(){
System.out.println("checking for updates ...");
Platform.runLater(() -> {
mainWindowController.getUpdateBtn().setText("checking for updates ...");
});
try {
if (useBeta) {
githubApiUrl = new URL(githubApiBeta);
} else {
githubApiUrl = new URL(githubApiRelease);
}
// URL githubApiUrl = new URL(githubApiRelease);
BufferedReader ina = new BufferedReader(new InputStreamReader(githubApiUrl.openStream()));
apiOutput = ina.readLine();
ina.close();
} catch (IOException e) {
Platform.runLater(() -> {
LOGGER.error("could not check update version", e);
});
}
if (useBeta) {
JsonArray objectArray = Json.parse("{\"items\": " + apiOutput + "}").asObject().get("items").asArray();
JsonValue object = objectArray.get(0);
JsonArray objectAssets = object.asObject().get("assets").asArray();
updateBuildNumber = object.asObject().getString("tag_name", "");
// updateName = object.asObject().getString("name", "");
// updateChanges = object.asObject().getString("body", "");
for (JsonValue asset : objectAssets) {
browserDownloadUrl = asset.asObject().getString("browser_download_url", "");
}
} else {
JsonObject object = Json.parse(apiOutput).asObject();
JsonArray objectAssets = Json.parse(apiOutput).asObject().get("assets").asArray();
updateBuildNumber = object.getString("tag_name", "");
// updateName = object.getString("name", "");
// updateChanges = object.getString("body", "");
for (JsonValue asset : objectAssets) {
browserDownloadUrl = asset.asObject().getString("browser_download_url", "");
}
}
LOGGER.info("Build: "+buildNumber+", Update: "+updateBuildNumber);
//Compares the program BuildNumber with the current BuildNumber if program BuildNumber < current BuildNumber then perform a update
int iversion = Integer.parseInt(buildNumber);
int iaktVersion = Integer.parseInt(updateBuildNumber.replace(".", ""));
if(iversion >= iaktVersion){
Platform.runLater(() -> {
mainWindowController.getUpdateBtn().setText("no update available");
});
LOGGER.info("no update available");
}else{
Platform.runLater(() -> {
mainWindowController.getUpdateBtn().setText("update available");
});
LOGGER.info("update available");
LOGGER.info("download link: " + browserDownloadUrl);
try {
//open new Http connection, ProgressMonitorInputStream for downloading the data
HttpURLConnection conn = (HttpURLConnection) new URL(browserDownloadUrl).openConnection();
ProgressMonitorInputStream pmis = new ProgressMonitorInputStream(null, "Downloading...", conn.getInputStream());
ProgressMonitor pm = pmis.getProgressMonitor();
pm.setMillisToDecideToPopup(0);
pm.setMillisToPopup(0);
pm.setMinimum(0);// tell the progress bar that we start at the beginning of the stream
pm.setMaximum(conn.getContentLength());// tell the progress bar the total number of bytes we are going to read.
FileUtils.copyInputStreamToFile(pmis, new File("cemu_UI_update.jar")); //download update
org.apache.commons.io.FileUtils.copyFile(new File("cemu_UI_update.jar"), new File("cemu_UI.jar")); //TODO rename update to old name
org.apache.commons.io.FileUtils.deleteQuietly(new File("cemu_UI_update.jar")); //delete update
Runtime.getRuntime().exec("java -jar cemu_UI.jar"); //start again
System.exit(0); //finishes itself
} catch (IOException e) {
Platform.runLater(() -> {
LOGGER.info("could not download update files", e);
});
}
}
}
}

View File

@ -19,7 +19,7 @@
* MA 02110-1301, USA. * MA 02110-1301, USA.
*/ */
package application; package com.cemu_UI.controller;
import java.awt.Graphics2D; import java.awt.Graphics2D;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
@ -45,6 +45,8 @@ import org.apache.logging.log4j.Logger;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;
import com.cemu_UI.application.MainWindowController;
public class dbController { public class dbController {
public dbController(MainWindowController m) { public dbController(MainWindowController m) {
@ -134,15 +136,16 @@ public class dbController {
} }
} }
void addRom(String title, String coverPath, String romPath, String titleID, String productCode, String region, String lastPlayed, String timePlayed) throws SQLException{ public void addRom(String title, String coverPath, String romPath, String titleID, String productCode, String region, String lastPlayed, String timePlayed) throws SQLException{
Statement stmt = connection.createStatement(); Statement stmt = connection.createStatement();
stmt.executeUpdate("insert into local_roms values ('"+title+"','"+coverPath+"','"+romPath+"','"+titleID+"','"+productCode+"','"+region+"','"+lastPlayed+"','"+timePlayed+"')"); stmt.executeUpdate("insert into local_roms values ('"+title+"','"+coverPath+"','"+romPath+"','"+titleID+"',"
+ "'"+productCode+"','"+region+"','"+lastPlayed+"','"+timePlayed+"')");
connection.commit(); connection.commit();
stmt.close(); stmt.close();
LOGGER.info("added \""+title+"\" to ROM database"); LOGGER.info("added \""+title+"\" to ROM database");
} }
void removeRom(String titleID) throws SQLException{ public void removeRom(String titleID) throws SQLException{
Statement stmt = connection.createStatement(); Statement stmt = connection.createStatement();
stmt.executeUpdate("delete from local_roms where titleID = '"+titleID+"'"); stmt.executeUpdate("delete from local_roms where titleID = '"+titleID+"'");
connection.commit(); connection.commit();
@ -167,7 +170,7 @@ public class dbController {
} }
//load one single ROM after manual adding into the mainWindowController //load one single ROM after manual adding into the mainWindowController
void loadSingleRom(String titleID){ public void loadSingleRom(String titleID){
LOGGER.info("loading a single ROM (ID: "+titleID+") into the mainWindowController ..."); LOGGER.info("loading a single ROM (ID: "+titleID+") into the mainWindowController ...");
try { try {
Statement stmt = connection.createStatement(); Statement stmt = connection.createStatement();
@ -183,7 +186,7 @@ public class dbController {
} }
//get all files with .rpx TODO add other formats //get all files with .rpx TODO add other formats
void loadRomDirectory(String directory){ public void loadRomDirectory(String directory){
File dir = new File(directory); File dir = new File(directory);
File appFile; File appFile;
String[] extensions = new String[] { "rpx", "jsp" }; String[] extensions = new String[] { "rpx", "jsp" };
@ -191,15 +194,15 @@ public class dbController {
String coverPath; String coverPath;
if(System.getProperty("os.name").equals("Linux")){ if(System.getProperty("os.name").equals("Linux")){
pictureCache = mainWindowController.pictureCacheLinux; pictureCache = mainWindowController.getPictureCacheLinux();
}else{ }else{
pictureCache = mainWindowController.pictureCacheWin; pictureCache = mainWindowController.getPictureCacheWin();
} }
try { try {
Statement stmt = connectionGames.createStatement(); Statement stmt = connectionGames.createStatement();
LOGGER.info("Getting all .rpx files in " + dir.getCanonicalPath()+" including those in subdirectories");
List<File> files = (List<File>) FileUtils.listFiles(dir, extensions, true); List<File> files = (List<File>) FileUtils.listFiles(dir, extensions, true);
LOGGER.info("Getting all .rpx files in " + dir.getCanonicalPath()+" including those in subdirectories");
for (File file : files) { for (File file : files) {
if(System.getProperty("os.name").equals("Linux")){ if(System.getProperty("os.name").equals("Linux")){
appFile = new File(file.getParent()+"/app.xml"); appFile = new File(file.getParent()+"/app.xml");
@ -266,7 +269,45 @@ public class dbController {
return resizedImage; return resizedImage;
} }
void setLastPlayed(String titleID){ /**
* getting info for a game with titleID
* @param titleID Title-ID of the Game
* @return title, coverPath, romPath, titleID (in this order)
*/
public String[] getGameInfo(String titleID){
String[] gameInfo = new String[4];
LOGGER.info("getting game info for titleID: "+titleID+" ...");
try {
Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery("SELECT * FROM local_roms where titleID = '"+titleID+"'");
while (rs.next()) {
gameInfo[0] = rs.getString(1);// title
gameInfo[1] = rs.getString(2);// coverPath
gameInfo[2] = rs.getString(3);// romPath
gameInfo[3] = rs.getString(4);// titleID
}
stmt.close();
rs.close();
}catch (Exception e){
LOGGER.error("error while getting game info", e);
}
return gameInfo;
}
public void setGameInfo(String title, String titleID, String romPath, String coverPath){
LOGGER.info("setting game info for titleID: "+titleID+" ...");
try {
Statement stmt = connection.createStatement();
stmt.executeUpdate("UPDATE local_roms SET title = '" + title + "', coverPath = '" + coverPath + "',"
+ " romPath = '" + romPath + "' WHERE titleID = '"+titleID+"';");
connection.commit();
stmt.close();
}catch (Exception e){
LOGGER.error("error while setting game info", e);
}
}
public void setLastPlayed(String titleID){
try{ try{
Statement stmt = connection.createStatement(); Statement stmt = connection.createStatement();
stmt.executeUpdate("UPDATE local_roms SET lastPlayed=date('now') WHERE titleID = '"+titleID+"';"); stmt.executeUpdate("UPDATE local_roms SET lastPlayed=date('now') WHERE titleID = '"+titleID+"';");
@ -277,7 +318,7 @@ public class dbController {
} }
} }
String getLastPlayed(String titleID){ public String getLastPlayed(String titleID){
String lastPlayed = null; String lastPlayed = null;
try{ try{
Statement stmt = connection.createStatement(); Statement stmt = connection.createStatement();
@ -291,7 +332,7 @@ public class dbController {
return lastPlayed; return lastPlayed;
} }
void setTotalPlaytime(String timePlayed, String titleID){ public void setTotalPlaytime(String timePlayed, String titleID){
try{ try{
Statement stmt = connection.createStatement(); Statement stmt = connection.createStatement();
stmt.executeUpdate("UPDATE local_roms SET timePlayed='"+timePlayed+"' WHERE titleID = '"+titleID+"';"); stmt.executeUpdate("UPDATE local_roms SET timePlayed='"+timePlayed+"' WHERE titleID = '"+titleID+"';");
@ -303,7 +344,7 @@ public class dbController {
} }
} }
String getTotalPlaytime(String titleID){ public String getTotalPlaytime(String titleID){
String timePlayed = null; String timePlayed = null;
try{ try{
Statement stmt = connection.createStatement(); Statement stmt = connection.createStatement();
@ -317,5 +358,5 @@ public class dbController {
return timePlayed; return timePlayed;
} }
} }

View File

@ -19,7 +19,7 @@
* MA 02110-1301, USA. * MA 02110-1301, USA.
*/ */
package datatypes; package com.cemu_UI.datatypes;
import com.jfoenix.controls.datamodels.treetable.RecursiveTreeObject; import com.jfoenix.controls.datamodels.treetable.RecursiveTreeObject;

View File

@ -19,7 +19,7 @@
* MA 02110-1301, USA. * MA 02110-1301, USA.
*/ */
package datatypes; package com.cemu_UI.datatypes;
import javafx.beans.property.IntegerProperty; import javafx.beans.property.IntegerProperty;
import javafx.beans.property.SimpleIntegerProperty; import javafx.beans.property.SimpleIntegerProperty;

View File

@ -19,7 +19,7 @@
* MA 02110-1301, USA. * MA 02110-1301, USA.
*/ */
package datatypes; package com.cemu_UI.datatypes;
import com.jfoenix.controls.JFXButton; import com.jfoenix.controls.JFXButton;

View File

@ -0,0 +1,86 @@
/**
* 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 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 JFXInfoDialog {
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 JFXInfoDialog(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 Text(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();
}
}

View File

@ -0,0 +1,105 @@
/**
* 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 javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.control.Label;
import javafx.scene.layout.AnchorPane;
import javafx.scene.layout.Pane;
import javafx.scene.layout.StackPane;
import javafx.scene.text.Text;
public class JFXOkayCancelDialog {
private String headingText;
private String bodyText;
private String dialogBtnStyle;
private int dialogWidth;
private int dialogHeight;
private EventHandler<ActionEvent> okayAction;
private EventHandler<ActionEvent> cancelAction;
private Pane pane;
/**
* Creates a new JFoenix Dialog to show some information with okay and cancel option
* @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 okayAction action which is performed if the okay button is clicked
* @param cancelAction action which is performed if the cancel button is clicked
* @param pane pane to which the dialog belongs
*/
public JFXOkayCancelDialog(String headingText, String bodyText, String dialogBtnStyle, int dialogWidth,
int dialogHeight, EventHandler<ActionEvent> okayAction, EventHandler<ActionEvent> cancelAction, Pane pane) {
this.headingText = headingText;
this.bodyText = bodyText;
this.dialogBtnStyle = dialogBtnStyle;
this.dialogWidth = dialogWidth;
this.dialogHeight = dialogHeight;
this.okayAction = okayAction;
this.cancelAction = cancelAction;
this.pane = pane;
}
public void show() {
JFXDialogLayout content= new JFXDialogLayout();
content.setHeading(new Text(headingText));
content.setBody(new Text(bodyText));
StackPane stackPane = new StackPane();
stackPane.autosize();
JFXDialog dialog = new JFXDialog(stackPane, content, JFXDialog.DialogTransition.LEFT, true);
JFXButton okayBtn = new JFXButton("Okay");
okayBtn.addEventHandler(ActionEvent.ACTION, okayAction);
okayBtn.addEventHandler(ActionEvent.ACTION, (e)-> {
dialog.close();
});
okayBtn.setButtonType(com.jfoenix.controls.JFXButton.ButtonType.RAISED);
okayBtn.setPrefHeight(32);
okayBtn.setStyle(dialogBtnStyle);
JFXButton cancelBtn = new JFXButton("Cancel");
cancelBtn.addEventHandler(ActionEvent.ACTION, cancelAction);
cancelBtn.addEventHandler(ActionEvent.ACTION, (e)-> {
dialog.close();
});
cancelBtn.setButtonType(com.jfoenix.controls.JFXButton.ButtonType.RAISED);
cancelBtn.setPrefHeight(32);
cancelBtn.setStyle(dialogBtnStyle);
Label placeholder = new Label();
placeholder.setPrefSize(15, 10);
content.setActions(cancelBtn, placeholder, okayBtn);
content.setPrefSize(dialogWidth, dialogHeight);
pane.getChildren().add(stackPane);
AnchorPane.setTopAnchor(stackPane, (pane.getHeight()-content.getPrefHeight())/2);
AnchorPane.setLeftAnchor(stackPane, (pane.getWidth()-content.getPrefWidth())/2);
dialog.show();
}
}

View File

@ -19,7 +19,7 @@
* MA 02110-1301, USA. * MA 02110-1301, USA.
*/ */
package cloudControllerInstances; package com.cemu_UI.vendorCloudController;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileOutputStream; import java.io.FileOutputStream;
@ -101,7 +101,7 @@ public class GoogleDriveController {
*/ */
public Credential authorize() throws IOException { public Credential authorize() throws IOException {
// Load client secrets. // Load client secrets.
InputStream in = getClass().getClassLoader().getResourceAsStream("resources/client_secret.json"); InputStream in = getClass().getClassLoader().getResourceAsStream("client_secret.json");
GoogleClientSecrets clientSecrets = GoogleClientSecrets.load(JSON_FACTORY, new InputStreamReader(in)); GoogleClientSecrets clientSecrets = GoogleClientSecrets.load(JSON_FACTORY, new InputStreamReader(in));
//FIXME Linux fails to open a new browser window, application crashes, maybe a kde only bug //FIXME Linux fails to open a new browser window, application crashes, maybe a kde only bug

View File

@ -7,6 +7,7 @@
<?import com.jfoenix.controls.JFXToggleButton?> <?import com.jfoenix.controls.JFXToggleButton?>
<?import com.jfoenix.controls.JFXTreeTableView?> <?import com.jfoenix.controls.JFXTreeTableView?>
<?import javafx.geometry.Insets?> <?import javafx.geometry.Insets?>
<?import javafx.scene.control.ChoiceBox?>
<?import javafx.scene.control.Label?> <?import javafx.scene.control.Label?>
<?import javafx.scene.control.ScrollPane?> <?import javafx.scene.control.ScrollPane?>
<?import javafx.scene.image.ImageView?> <?import javafx.scene.image.ImageView?>
@ -16,7 +17,7 @@
<?import javafx.scene.text.Font?> <?import javafx.scene.text.Font?>
<?import javafx.scene.text.TextFlow?> <?import javafx.scene.text.TextFlow?>
<AnchorPane fx:id="mainAnchorPane" prefHeight="600.0" prefWidth="904.0" xmlns="http://javafx.com/javafx/8.0.141" xmlns:fx="http://javafx.com/fxml/1" fx:controller="application.MainWindowController"> <AnchorPane fx:id="mainAnchorPane" prefHeight="600.0" prefWidth="904.0" xmlns="http://javafx.com/javafx/8.0.141" xmlns:fx="http://javafx.com/fxml/1" fx:controller="com.cemu_UI.application.MainWindowController">
<children> <children>
<ScrollPane fx:id="mainScrollPane" fitToWidth="true" layoutY="38.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="38.0"> <ScrollPane fx:id="mainScrollPane" fitToWidth="true" layoutY="38.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="38.0">
<content> <content>
@ -28,7 +29,7 @@
</ScrollPane> </ScrollPane>
<HBox fx:id="topHBox" prefHeight="38.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0"> <HBox fx:id="topHBox" prefHeight="38.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
<children> <children>
<JFXHamburger fx:id="menuHam" prefHeight="38.0" prefWidth="38.0" stylesheets="@MainWindows.css" /> <JFXHamburger fx:id="menuHam" prefHeight="38.0" prefWidth="38.0" stylesheets="@../css/MainWindows.css" />
</children> </children>
</HBox> </HBox>
<VBox fx:id="sideMenuVBox" layoutY="32.0" prefHeight="568.0" prefWidth="175.0" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="38.0"> <VBox fx:id="sideMenuVBox" layoutY="32.0" prefHeight="568.0" prefWidth="175.0" visible="false" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.topAnchor="38.0">
@ -86,8 +87,10 @@
</Label> </Label>
<JFXToggleButton fx:id="cloudSyncToggleBtn" layoutX="10.0" layoutY="247.0" onAction="#cloudSyncToggleBtnAction" text="cloud savegames (Google Drive)" AnchorPane.leftAnchor="10.0" AnchorPane.topAnchor="247.0" /> <JFXToggleButton fx:id="cloudSyncToggleBtn" layoutX="10.0" layoutY="247.0" onAction="#cloudSyncToggleBtnAction" text="cloud savegames (Google Drive)" AnchorPane.leftAnchor="10.0" AnchorPane.topAnchor="247.0" />
<Label fx:id="updateLbl" layoutX="10.0" layoutY="315.0" text="Updates" AnchorPane.leftAnchor="10.0" AnchorPane.topAnchor="315.0" /> <Label fx:id="updateLbl" layoutX="10.0" layoutY="315.0" text="Updates" AnchorPane.leftAnchor="10.0" AnchorPane.topAnchor="315.0" />
<JFXButton fx:id="updateBtn" layoutX="14.0" layoutY="335.0" onAction="#updateBtnAction" prefHeight="32.0" prefWidth="111.0" text="check now!" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="335.0" /> <JFXButton fx:id="updateBtn" layoutX="14.0" layoutY="335.0" onAction="#updateBtnAction" prefHeight="32.0" text="check now!" AnchorPane.leftAnchor="14.0" AnchorPane.topAnchor="335.0" />
<JFXToggleButton fx:id="autoUpdateToggleBtn" layoutX="10.0" layoutY="372.0" onAction="#autoUpdateToggleBtnAction" text="check for updates on startup" AnchorPane.leftAnchor="10.0" AnchorPane.topAnchor="372.0" /> <JFXToggleButton fx:id="autoUpdateToggleBtn" layoutX="10.0" layoutY="372.0" onAction="#autoUpdateToggleBtnAction" text="check for updates on startup" AnchorPane.leftAnchor="10.0" AnchorPane.topAnchor="372.0" />
<ChoiceBox fx:id="branchChoisBox" layoutX="270.0" layoutY="339.0" prefWidth="150.0" AnchorPane.leftAnchor="270.0" AnchorPane.topAnchor="339.0" />
<Label fx:id="branchLbl" layoutX="204.0" layoutY="337.0" prefHeight="32.0" text="Branch" AnchorPane.leftAnchor="204.0" AnchorPane.topAnchor="335.0" />
</children> </children>
</AnchorPane> </AnchorPane>
</content> </content>

View File

Before

Width:  |  Height:  |  Size: 9.3 KiB

After

Width:  |  Height:  |  Size: 9.3 KiB

View File

Before

Width:  |  Height:  |  Size: 222 B

After

Width:  |  Height:  |  Size: 222 B

View File

Before

Width:  |  Height:  |  Size: 233 B

After

Width:  |  Height:  |  Size: 233 B

View File

Before

Width:  |  Height:  |  Size: 235 B

After

Width:  |  Height:  |  Size: 235 B

View File

Before

Width:  |  Height:  |  Size: 245 B

After

Width:  |  Height:  |  Size: 245 B

View File

Before

Width:  |  Height:  |  Size: 114 B

After

Width:  |  Height:  |  Size: 114 B

View File

Before

Width:  |  Height:  |  Size: 116 B

After

Width:  |  Height:  |  Size: 116 B

View File

Before

Width:  |  Height:  |  Size: 222 B

After

Width:  |  Height:  |  Size: 222 B

View File

Before

Width:  |  Height:  |  Size: 232 B

After

Width:  |  Height:  |  Size: 232 B

View File

Before

Width:  |  Height:  |  Size: 322 B

After

Width:  |  Height:  |  Size: 322 B

View File

Before

Width:  |  Height:  |  Size: 326 B

After

Width:  |  Height:  |  Size: 326 B

Some files were not shown because too many files have changed in this diff Show More