code clean up
* smmdb api query is not started anymore on closing the smmdb window * general code clean up
This commit is contained in:
parent
dbd52cbe9c
commit
9f0956a674
|
@ -1,2 +1,3 @@
|
||||||
/application/
|
/application/
|
||||||
/datatypes/
|
/datatypes/
|
||||||
|
/libraries/
|
||||||
|
|
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.
Binary file not shown.
Binary file not shown.
|
@ -16,16 +16,14 @@
|
||||||
* TREE TABLE CSS
|
* TREE TABLE CSS
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
.tree-table-view {
|
.tree-table-view {
|
||||||
-fx-tree-table-color: rgba(0, 168, 204, 0.2);
|
-fx-tree-table-color: rgba(0, 168, 204, 0.2);
|
||||||
-fx-tree-table-rippler-color: rgba(0, 168, 204, 0.4);
|
-fx-tree-table-rippler-color: rgba(0, 168, 204, 0.4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.tree-table-view:focused .tree-table-row-cell:selected {
|
.tree-table-view:focused .tree-table-row-cell:selected {
|
||||||
-fx-background-color: -fx-tree-table-color;
|
-fx-background-color: -fx-tree-table-color;
|
||||||
-fx-table-cell-border-color: -fx-tree-table-color;
|
-fx-table-cell-border-color: -fx-tree-table-color;
|
||||||
-fx-text-fill: BLACK;
|
-fx-text-fill: BLACK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,13 +31,10 @@
|
||||||
-fx-text-fill: BLACK;
|
-fx-text-fill: BLACK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.tree-table-view .jfx-rippler {
|
.tree-table-view .jfx-rippler {
|
||||||
-jfx-rippler-fill: -fx-tree-table-rippler-color;
|
-jfx-rippler-fill: -fx-tree-table-rippler-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.tree-table-view .column-header,
|
.tree-table-view .column-header,
|
||||||
.tree-table-view .column-header-background,
|
.tree-table-view .column-header-background,
|
||||||
.tree-table-view .column-header-background .filler {
|
.tree-table-view .column-header-background .filler {
|
||||||
|
|
Binary file not shown.
|
@ -216,7 +216,7 @@ public class MainWindowController {
|
||||||
private String color;
|
private String color;
|
||||||
private String dialogBtnStyle;
|
private String dialogBtnStyle;
|
||||||
private String version = "0.1.6";
|
private String version = "0.1.6";
|
||||||
private String buildNumber = "033";
|
private String buildNumber = "035";
|
||||||
private String versionName = "Throwback Galaxy";
|
private String versionName = "Throwback Galaxy";
|
||||||
private int xPos = -200;
|
private int xPos = -200;
|
||||||
private int yPos = 17;
|
private int yPos = 17;
|
||||||
|
@ -263,7 +263,6 @@ public class MainWindowController {
|
||||||
smmdbApiQuery = new SmmdbApiQuery();
|
smmdbApiQuery = new SmmdbApiQuery();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked") //FIXME SuppressWarnings
|
|
||||||
void initUI(){
|
void initUI(){
|
||||||
cemuTextField.setText(cemuPath);
|
cemuTextField.setText(cemuPath);
|
||||||
romTextField.setText(romPath);
|
romTextField.setText(romPath);
|
||||||
|
@ -287,7 +286,10 @@ public class MainWindowController {
|
||||||
starsColumn.setCellValueFactory(cellData -> cellData.getValue().getValue().stars.asObject());
|
starsColumn.setCellValueFactory(cellData -> cellData.getValue().getValue().stars.asObject());
|
||||||
timeColumn.setCellValueFactory(cellData -> cellData.getValue().getValue().time.asObject());
|
timeColumn.setCellValueFactory(cellData -> cellData.getValue().getValue().time.asObject());
|
||||||
|
|
||||||
courseTreeTable.getColumns().setAll(titleColumn, timeColumn, starsColumn, idColumn);
|
courseTreeTable.getColumns().add(titleColumn);
|
||||||
|
courseTreeTable.getColumns().add(timeColumn);
|
||||||
|
courseTreeTable.getColumns().add(starsColumn);
|
||||||
|
courseTreeTable.getColumns().add(idColumn);
|
||||||
courseTreeTable.getColumns().get(3).setVisible(false); //hide idColumn (important)
|
courseTreeTable.getColumns().get(3).setVisible(false); //hide idColumn (important)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -376,7 +378,7 @@ public class MainWindowController {
|
||||||
games.remove(selectedUIDataIndex);
|
games.remove(selectedUIDataIndex);
|
||||||
dbController.removeRom(selectedGameTitleID);
|
dbController.removeRom(selectedGameTitleID);
|
||||||
//remove all games form gamesAnchorPane (UI)
|
//remove all games form gamesAnchorPane (UI)
|
||||||
gamesAnchorPane.getChildren().removeAll(games);
|
gamesAnchorPane.getChildren().removeAll(gamesAnchorPane.getChildren());
|
||||||
//reset position
|
//reset position
|
||||||
xPos = -200;
|
xPos = -200;
|
||||||
yPos = 17;
|
yPos = 17;
|
||||||
|
@ -634,21 +636,19 @@ public class MainWindowController {
|
||||||
} else {
|
} else {
|
||||||
smmdbAnchorPane.setVisible(true);
|
smmdbAnchorPane.setVisible(true);
|
||||||
smmdbTrue = true;
|
smmdbTrue = true;
|
||||||
}
|
|
||||||
|
|
||||||
//start query
|
//start query
|
||||||
courses.addAll(smmdbApiQuery.startQuery());
|
courses.removeAll(courses);
|
||||||
|
courses.addAll(smmdbApiQuery.startQuery());
|
||||||
System.out.println("size: " + courses.size());
|
|
||||||
System.out.println(courses.get(3).getNintendoid());
|
//add query response to courseTreeTable
|
||||||
|
for(int i = 0; i < courses.size(); i++){
|
||||||
//add query response to courseTreeTable
|
CourseTableDataType helpCourse = new CourseTableDataType(courses.get(i).getTitle(), courses.get(i).getId(),
|
||||||
for(int i = 0; i < courses.size(); i++){
|
courses.get(i).getTime(), courses.get(i).getStars());
|
||||||
CourseTableDataType helpCourse = new CourseTableDataType(courses.get(i).getTitle(), courses.get(i).getId(),
|
|
||||||
courses.get(i).getTime(), courses.get(i).getStars());
|
root.getChildren().add(new TreeItem<CourseTableDataType>(helpCourse)); //add data to root-node
|
||||||
|
}
|
||||||
root.getChildren().add(new TreeItem<CourseTableDataType>(helpCourse)); //add data to root-node
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
|
@ -740,9 +740,7 @@ public class MainWindowController {
|
||||||
|
|
||||||
//get all existing courses in smm directory, new name is highest number +1
|
//get all existing courses in smm directory, new name is highest number +1
|
||||||
for (int j = 0; j < courses.length; j++) {
|
for (int j = 0; j < courses.length; j++) {
|
||||||
System.out.println(courses[j].getName());
|
|
||||||
int courseNumber = Integer.parseInt(courses[j].getName().substring(6));
|
int courseNumber = Integer.parseInt(courses[j].getName().substring(6));
|
||||||
|
|
||||||
if (courseNumber > highestCourseNumber) {
|
if (courseNumber > highestCourseNumber) {
|
||||||
highestCourseNumber = courseNumber;
|
highestCourseNumber = courseNumber;
|
||||||
}
|
}
|
||||||
|
@ -751,7 +749,7 @@ public class MainWindowController {
|
||||||
String number = "000" + (highestCourseNumber +1);
|
String number = "000" + (highestCourseNumber +1);
|
||||||
courseName = "course" + number.substring(number.length() -3, number.length());
|
courseName = "course" + number.substring(number.length() -3, number.length());
|
||||||
File courseDirectory = new File(outputFile + "mlc01/emulatorSave/" + smmIDs.get(i) + "/");
|
File courseDirectory = new File(outputFile + "mlc01/emulatorSave/" + smmIDs.get(i) + "/");
|
||||||
System.out.println("Path: " + courseDirectory.getPath());
|
|
||||||
destination = courseDirectory.getPath();
|
destination = courseDirectory.getPath();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -763,6 +761,7 @@ public class MainWindowController {
|
||||||
//rename zipfile
|
//rename zipfile
|
||||||
File course = new File(destination + "/course000");
|
File course = new File(destination + "/course000");
|
||||||
course.renameTo( new File(destination + "/" + courseName));
|
course.renameTo( new File(destination + "/" + courseName));
|
||||||
|
System.out.println("Added new course: " + courseName + ", full path is: " + destination + "/" + courseName);
|
||||||
} catch (ZipException e) {
|
} catch (ZipException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
System.err.println("an error occurred during unziping the file!");
|
System.err.println("an error occurred during unziping the file!");
|
||||||
|
|
|
@ -16,16 +16,14 @@
|
||||||
* TREE TABLE CSS
|
* TREE TABLE CSS
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
.tree-table-view {
|
.tree-table-view {
|
||||||
-fx-tree-table-color: rgba(0, 168, 204, 0.2);
|
-fx-tree-table-color: rgba(0, 168, 204, 0.2);
|
||||||
-fx-tree-table-rippler-color: rgba(0, 168, 204, 0.4);
|
-fx-tree-table-rippler-color: rgba(0, 168, 204, 0.4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.tree-table-view:focused .tree-table-row-cell:selected {
|
.tree-table-view:focused .tree-table-row-cell:selected {
|
||||||
-fx-background-color: -fx-tree-table-color;
|
-fx-background-color: -fx-tree-table-color;
|
||||||
-fx-table-cell-border-color: -fx-tree-table-color;
|
-fx-table-cell-border-color: -fx-tree-table-color;
|
||||||
-fx-text-fill: BLACK;
|
-fx-text-fill: BLACK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -33,13 +31,10 @@
|
||||||
-fx-text-fill: BLACK;
|
-fx-text-fill: BLACK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
.tree-table-view .jfx-rippler {
|
.tree-table-view .jfx-rippler {
|
||||||
-jfx-rippler-fill: -fx-tree-table-rippler-color;
|
-jfx-rippler-fill: -fx-tree-table-rippler-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.tree-table-view .column-header,
|
.tree-table-view .column-header,
|
||||||
.tree-table-view .column-header-background,
|
.tree-table-view .column-header-background,
|
||||||
.tree-table-view .column-header-background .filler {
|
.tree-table-view .column-header-background .filler {
|
||||||
|
|
|
@ -37,92 +37,80 @@ public class SmmdbApiQuery {
|
||||||
BufferedReader ina = new BufferedReader(new InputStreamReader(apiUrl.openStream()));
|
BufferedReader ina = new BufferedReader(new InputStreamReader(apiUrl.openStream()));
|
||||||
output = ina.readLine();
|
output = ina.readLine();
|
||||||
ina.close();
|
ina.close();
|
||||||
|
System.out.println("response from " + URL + " was valid");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
System.out.println("error while making api request or reading response");
|
System.out.println("error while making api request or reading response");
|
||||||
|
System.out.println("response from " + URL + " was: " + output);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println(URL);
|
String apiOutput = "{ \"courses\": " + output + "}";
|
||||||
System.out.println("{ \"courses\": " + output + "}");
|
|
||||||
|
|
||||||
String apiOutput = "{ \"courses\": " + output + "}";
|
|
||||||
|
|
||||||
JsonArray items = Json.parse(apiOutput).asObject().get("courses").asArray();
|
JsonArray items = Json.parse(apiOutput).asObject().get("courses").asArray();
|
||||||
|
|
||||||
for (JsonValue item : items) {
|
for (JsonValue item : items) {
|
||||||
int courseTheme, gameStyle, difficulty, lastmodified, uploaded, autoScroll, stars ,time;
|
int courseTheme, gameStyle, difficulty, lastmodified, uploaded, autoScroll, stars ,time;
|
||||||
String owner, id, nintendoid, title;
|
String owner, id, nintendoid, title;
|
||||||
|
|
||||||
//geht
|
|
||||||
try {
|
try {
|
||||||
courseTheme = item.asObject().getInt("courseTheme", 9);
|
courseTheme = item.asObject().getInt("courseTheme", 9);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
courseTheme = 9;
|
courseTheme = 9;
|
||||||
}
|
}
|
||||||
|
|
||||||
//geht
|
|
||||||
try {
|
try {
|
||||||
gameStyle = item.asObject().getInt("gameStyle", 9);
|
gameStyle = item.asObject().getInt("gameStyle", 9);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
gameStyle = 9;
|
gameStyle = 9;
|
||||||
}
|
}
|
||||||
|
|
||||||
//geht
|
|
||||||
try {
|
try {
|
||||||
difficulty = item.asObject().getInt("difficulty", 9);
|
difficulty = item.asObject().getInt("difficulty", 9);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
difficulty = 9;
|
difficulty = 9;
|
||||||
}
|
}
|
||||||
|
|
||||||
//geht
|
|
||||||
try {
|
try {
|
||||||
lastmodified = item.asObject().getInt("lastmodified", 9);
|
lastmodified = item.asObject().getInt("lastmodified", 9);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
lastmodified = 9;
|
lastmodified = 9;
|
||||||
}
|
}
|
||||||
|
|
||||||
//geht
|
|
||||||
try {
|
try {
|
||||||
uploaded = item.asObject().getInt("uploaded", 9);
|
uploaded = item.asObject().getInt("uploaded", 9);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
uploaded = 9;
|
uploaded = 9;
|
||||||
}
|
}
|
||||||
|
|
||||||
//geht
|
|
||||||
try {
|
try {
|
||||||
autoScroll = item.asObject().getInt("autoScroll", 9);
|
autoScroll = item.asObject().getInt("autoScroll", 9);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
autoScroll = 9;
|
autoScroll = 9;
|
||||||
}
|
}
|
||||||
|
|
||||||
//geht
|
|
||||||
try {
|
try {
|
||||||
stars = item.asObject().getInt("stars", 9);
|
stars = item.asObject().getInt("stars", 9);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
stars = 9;
|
stars = 9;
|
||||||
}
|
}
|
||||||
|
|
||||||
//geht
|
|
||||||
try {
|
try {
|
||||||
time = item.asObject().getInt("time", 9);
|
time = item.asObject().getInt("time", 9);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
time = 9;
|
time = 9;
|
||||||
}
|
}
|
||||||
|
|
||||||
//geht
|
|
||||||
try {
|
try {
|
||||||
owner = item.asObject().getString("owner", "");
|
owner = item.asObject().getString("owner", "");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
owner = "notset";
|
owner = "notset";
|
||||||
}
|
}
|
||||||
|
|
||||||
//geht
|
|
||||||
try {
|
try {
|
||||||
id = item.asObject().getString("id", "");
|
id = item.asObject().getString("id", "");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
id = "notset";
|
id = "notset";
|
||||||
}
|
}
|
||||||
|
|
||||||
//geht
|
|
||||||
try {
|
try {
|
||||||
nintendoid = item.asObject().getString("nintendoid", "");
|
nintendoid = item.asObject().getString("nintendoid", "");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
Loading…
Reference in New Issue