Skip to content

Commit 54650c2

Browse files
committed
New UI for choosing presets, Bump to v1.1
1 parent d62e67b commit 54650c2

File tree

5 files changed

+274
-238
lines changed

5 files changed

+274
-238
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ A GUI for saving SHSH blobs using encounter's fork of tsschecker. Supports both
33

44
If you have an antivirus, select "Always Allow" for anything related to tsschecker or Java. An antivirus may cause blobsaver to crash. If that happens please send feedback.
55

6-
![image](https://i.imgur.com/i74ba2a.png)
6+
![image](https://i.imgur.com/QzhemWh.png)
77

88
## Features
99
- Store up to ten devices with presets
@@ -17,7 +17,8 @@ If you have an antivirus, select "Always Allow" for anything related to tsscheck
1717
Please send feedback via [Github Issue](https://github.com/airsquared/blobsaver/issues/new) or [Reddit PM](https://www.reddit.com//message/compose?to=01110101_00101111&subject=Blobsaver+Feedback) if you encounter any bugs/problems or have a feature request.
1818

1919
## TODO:
20-
- Question mark buttons to tell you what each thing does
20+
- Use macOS menu bar
21+
- Explain how to get everything
2122
- Package into .app/.exe [maybe this](https://github.com/Jorl17/jar2app)
2223
- Automatically save blobs for all signed versions
2324
- Daemon to do it automatically in the background

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ plugins {
33
id 'java'
44
}
55

6-
version '1.1alpha'
6+
version '1.1'
77

88
sourceCompatibility = 1.8
99

src/main/java/blobsaver/Controller.java

Lines changed: 37 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
import javafx.scene.control.*;
1313
import javafx.scene.control.Button;
1414
import javafx.scene.control.Label;
15-
import javafx.scene.control.ScrollPane;
1615
import javafx.scene.control.TextField;
1716
import javafx.scene.effect.DropShadow;
17+
import javafx.scene.layout.VBox;
1818
import javafx.scene.paint.Color;
1919
import javafx.stage.DirectoryChooser;
2020
import javafx.stage.FileChooser;
@@ -56,7 +56,7 @@ public class Controller {
5656

5757
@FXML private Label versionLabel;
5858

59-
@FXML private ToggleButton savePresetButton;
59+
@FXML private Button savePresetButton;
6060
@FXML private Button preset1Button;
6161
@FXML private Button preset2Button;
6262
@FXML private Button preset3Button;
@@ -69,7 +69,7 @@ public class Controller {
6969
@FXML private Button preset10Button;
7070
private ArrayList<Button> presetButtons;
7171

72-
@FXML private ScrollPane scrollPane;
72+
@FXML private VBox presetVBox;
7373

7474
@FXML private Button goButton;
7575
@FXML private Button plistPickerButton;
@@ -237,10 +237,14 @@ public void initialize() {
237237
}
238238
pathField.setText(path);
239239

240-
checkForUpdates();
240+
checkForUpdates(false);
241241
}
242242

243243
public void checkForUpdates() {
244+
checkForUpdates(true);
245+
}
246+
247+
private void checkForUpdates(boolean forceCheck) {
244248
Service<Void> service = new Service<Void>() {
245249
@Override
246250
protected Task<Void> createTask() {
@@ -272,7 +276,7 @@ protected Void call() throws Exception {
272276
changelog = "";
273277
}
274278
Preferences appPrefs = Preferences.userRoot().node("airsquared/blobsaver/prefs");
275-
if (!newVersion.equals(Main.appVersion) && !appPrefs.get("Ignore Version", "").equals(newVersion)) {
279+
if (!newVersion.equals(Main.appVersion) && (forceCheck || !appPrefs.get("Ignore Version", "").equals(newVersion))) {
276280
final CountDownLatch latch = new CountDownLatch(1);
277281
final String finalNewVersion = newVersion;
278282
final String finalChangelog = changelog;
@@ -392,6 +396,7 @@ private void run(String device) {
392396
}
393397

394398
File locationToSaveBlobs = new File(pathField.getText());
399+
//noinspection ResultOfMethodCallIgnored
395400
locationToSaveBlobs.mkdirs();
396401
ArrayList<String> args;
397402
args = new ArrayList<>(Arrays.asList(file.getPath(), "-d", device, "-s", "-e", ecidField.getText(), "--save-path", pathField.getText()));
@@ -425,6 +430,7 @@ private void run(String device) {
425430
e.printStackTrace();
426431
}
427432
String tsscheckerLog;
433+
//noinspection ConstantConditions
428434
try (BufferedReader reader = new BufferedReader(new InputStreamReader(proc.getInputStream()))) {
429435
StringBuilder logBuilder = new StringBuilder();
430436
String line;
@@ -462,7 +468,7 @@ private void run(String device) {
462468
&& tsscheckerLog.contains("[Error] [TSSR] faild to build tssrequest")
463469
&& tsscheckerLog.contains("Error] [TSSC] checking tss status failed!")) {
464470
Alert alert = new Alert(Alert.AlertType.ERROR,
465-
"Saving blobs failed. Check the board configuration.\n\nIf this doesn't work, please create a new issue on Github or PM me on Reddit. The log has been copied to your clipboard.",
471+
"Saving blobs failed. Check the board configuration or try again later.\n\nIf this doesn't work, please create a new issue on Github or PM me on Reddit. The log has been copied to your clipboard.",
466472
githubIssue, redditPM, ButtonType.OK);
467473
alert.showAndWait();
468474
reportError(alert, tsscheckerLog);
@@ -491,7 +497,6 @@ private void run(String device) {
491497
newReportableError("The tsschecker process was interrupted.", e.toString());
492498
}
493499

494-
495500
if (!file.delete()) {
496501
newUnreportableError("\"There was an error deleting the temporary file.\"");
497502
}
@@ -682,9 +687,16 @@ private void savePreset(int preset) {
682687
textInputDialog.setHeaderText("Name Preset");
683688
textInputDialog.setContentText("Please enter a name for the preset:");
684689
textInputDialog.showAndWait();
685-
if (!textInputDialog.getResult().equals("") || !(textInputDialog.getResult() == null)) {
686-
Preferences appPrefs = Preferences.userRoot().node("airsquared/blobsaver/prefs");
687-
appPrefs.put("Name Preset" + preset, textInputDialog.getResult());
690+
if (textInputDialog.getResult() != null) {
691+
if (!textInputDialog.getResult().equals("")) {
692+
Preferences appPrefs = Preferences.userRoot().node("airsquared/blobsaver/prefs");
693+
appPrefs.put("Name Preset" + preset, textInputDialog.getResult());
694+
((Button) Main.primaryStage.getScene().lookup("#preset" + preset)).setText("Save in " + textInputDialog.getResult());
695+
} else {
696+
return;
697+
}
698+
} else {
699+
return;
688700
}
689701

690702
Preferences presetPrefs = Preferences.userRoot().node("airsquared/blobsaver/preset" + preset);
@@ -709,18 +721,25 @@ private void savePreset(int preset) {
709721
public void savePresetHandler() {
710722
editingPresets = !editingPresets;
711723
if (editingPresets) {
712-
goButton.setVisible(false);
713-
goButton.setManaged(false);
714724
savePresetButton.setText("Cancel");
715-
scrollPane.setMaxWidth(410.0);
716-
scrollPane.setPrefWidth(410.0);
725+
int depth = 20;
726+
DropShadow borderGlow = new DropShadow();
727+
borderGlow.setOffsetY(0f);
728+
borderGlow.setOffsetX(0f);
729+
borderGlow.setColor(Color.DARKCYAN);
730+
borderGlow.setWidth(depth);
731+
borderGlow.setHeight(depth);
732+
presetVBox.setEffect(borderGlow);
717733
presetButtons.forEach((Button btn) -> btn.setText("Save in " + btn.getText().substring("Load ".length())));
734+
goButton.setDefaultButton(false);
735+
goButton.setDisable(true);
736+
savePresetButton.setDefaultButton(true);
718737
} else {
738+
savePresetButton.setDefaultButton(false);
739+
goButton.setDefaultButton(true);
740+
goButton.setDisable(false);
741+
presetVBox.setEffect(null);
719742
savePresetButton.setText("Save");
720-
scrollPane.setMaxWidth(385.0);
721-
scrollPane.setPrefWidth(385.0);
722-
goButton.setManaged(true);
723-
goButton.setVisible(true);
724743
presetButtons.forEach((Button btn) -> btn.setText("Load " + btn.getText().substring("Save in ".length())));
725744
}
726745
}

src/main/java/blobsaver/Main.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package blobsaver;
22

3-
import com.sun.javafx.PlatformUtil;
43
import javafx.application.Application;
54
import javafx.fxml.FXMLLoader;
65
import javafx.scene.Parent;
@@ -9,7 +8,7 @@
98

109
public class Main extends Application {
1110

12-
static final String appVersion = "v1.1alpha";
11+
static final String appVersion = "v1.1";
1312
static Stage primaryStage;
1413

1514
public static void main(String[] args) {
@@ -21,11 +20,7 @@ public void start(Stage primaryStage) throws Exception {
2120
Main.primaryStage = primaryStage;
2221
Parent root = FXMLLoader.load(getClass().getResource("blobsaver.fxml"));
2322
primaryStage.setTitle("SHSH Blob Saver " + appVersion);
24-
if (PlatformUtil.isWindows()) {
25-
primaryStage.setScene(new Scene(root, 520, 610));
26-
} else {
27-
primaryStage.setScene(new Scene(root, 500, 580));
28-
}
23+
primaryStage.setScene(new Scene(root, 685, 580));
2924
primaryStage.getScene().getStylesheets().add(getClass().getResource("app.css").toExternalForm());
3025
primaryStage.show();
3126
primaryStage.setResizable(false);

0 commit comments

Comments
 (0)