|
36 | 36 | import javafx.scene.input.KeyCode; |
37 | 37 | import javafx.scene.input.KeyEvent; |
38 | 38 | import javafx.scene.layout.HBox; |
| 39 | +import javafx.scene.layout.Pane; |
39 | 40 | import javafx.scene.layout.VBox; |
40 | 41 | import javafx.stage.FileChooser; |
41 | 42 | import javafx.stage.Modality; |
@@ -66,7 +67,7 @@ public class Controller { |
66 | 67 | @FXML private ToggleButton backgroundSettingsButton; |
67 | 68 |
|
68 | 69 | @FXML private ListView<Prefs.SavedDevice> deviceList; |
69 | | - @FXML private VBox savedDevicesVBox; |
| 70 | + @FXML private Pane savedDevicesVBox; |
70 | 71 |
|
71 | 72 | public static final String initialPath = System.getProperty("user.home") + File.separator + "Blobs"; |
72 | 73 |
|
@@ -174,7 +175,17 @@ public void manualURLCheckBoxHandler() { |
174 | 175 | } |
175 | 176 | } |
176 | 177 |
|
177 | | - public void filePickerHandler() { |
| 178 | + public void ipswPickerHandler() { |
| 179 | + FileChooser chooser = new FileChooser(); |
| 180 | + chooser.setTitle("Choose an IPSW or Build Manifest file"); |
| 181 | + chooser.getExtensionFilters().add(new FileChooser.ExtensionFilter("IPSW files, Plist files", "*.ipsw", "*.plist")); |
| 182 | + File file = chooser.showOpenDialog(Main.primaryStage); |
| 183 | + if (file != null) { |
| 184 | + ipswField.setText(file.toURI().toString()); |
| 185 | + } |
| 186 | + } |
| 187 | + |
| 188 | + public void folderPickerHandler() { |
178 | 189 | File result = Utils.showFilePickerDialog(Main.primaryStage, new File(pathField.getText())); |
179 | 190 | if (result != null) { |
180 | 191 | pathField.setText(result.getAbsolutePath()); |
@@ -301,35 +312,29 @@ public void checkBlobs() { |
301 | 312 | Analytics.checkBlobs(); |
302 | 313 | } |
303 | 314 |
|
304 | | - public void helpLabelHandler(Event evt) { |
| 315 | + public void locationHelp() { |
| 316 | + ButtonType openURL = new ButtonType("Open URL"); |
| 317 | + Alert alert = new Alert(Alert.AlertType.INFORMATION, |
| 318 | + "Click \"Open URL\" to see how to automatically upload blobs you save to the cloud.", openURL, ButtonType.OK); |
| 319 | + alert.setTitle("Tip: Saving Blobs to the Cloud"); |
| 320 | + alert.setHeaderText("Tip"); |
| 321 | + alert.showAndWait(); |
| 322 | + if (openURL.equals(alert.getResult())) { |
| 323 | + Utils.openURL("https://github.com/airsquared/blobsaver/wiki/Automatically-saving-blobs-to-the-cloud"); |
| 324 | + } |
| 325 | + } |
| 326 | + |
| 327 | + public void ipswURLHelp() { |
305 | 328 | if (Main.SHOW_BREAKPOINT) { |
306 | 329 | return; // remember to put a breakpoint here |
307 | 330 | } |
308 | 331 |
|
309 | | - String labelID = ((Label) evt.getSource()).getId(); |
310 | | - |
311 | | - ButtonType openURL = new ButtonType("Open URL"); |
312 | | - ButtonType customOK = new ButtonType("OK", ButtonBar.ButtonData.CANCEL_CLOSE); |
313 | | - Alert alert = new Alert(Alert.AlertType.INFORMATION, "", openURL, customOK); |
314 | | - ((Button) alert.getDialogPane().lookupButton(customOK)).setDefaultButton(true); |
315 | | - String url = switch (labelID) { |
316 | | - case "ipswURLHelp": |
317 | | - alert.setContentText("Get the IPSW download URL for the iOS version from theiphonewiki.com/wiki/Beta_Firmware and paste it here.\n\nIf you already have the IPSW downloaded, you can also supply a 'file:' URL."); |
318 | | - alert.setTitle("Help: IPSW URL"); |
319 | | - alert.setHeaderText("Help"); |
320 | | - yield "https://www.theiphonewiki.com/wiki/Beta_Firmware"; |
321 | | - case "locationHelp": |
322 | | - alert.setContentText("Click \"Open URL\" to see how to automatically upload blobs you save to the cloud."); |
323 | | - alert.setTitle("Tip: Saving Blobs to the Cloud"); |
324 | | - alert.setHeaderText("Tip"); |
325 | | - yield "https://github.com/airsquared/blobsaver/wiki/Automatically-saving-blobs-to-the-cloud"; |
326 | | - default: |
327 | | - throw new IllegalStateException("Unexpected value for labelID: " + labelID); |
328 | | - }; |
| 332 | + Alert alert = new Alert(Alert.AlertType.INFORMATION, |
| 333 | + "You can supply either a URL to an IPSW file or a build manifest (.plist). " + |
| 334 | + "If you already have the file downloaded, you can also use a 'file:' URL to either an IPSW or a build manifest plist."); |
| 335 | + alert.setTitle("Help: IPSW URL"); |
| 336 | + alert.setHeaderText("Help"); |
329 | 337 | alert.showAndWait(); |
330 | | - if (openURL.equals(alert.getResult())) { |
331 | | - Utils.openURL(url); |
332 | | - } |
333 | 338 | } |
334 | 339 |
|
335 | 340 | public void aboutMenuHandler(Event ignored) { |
@@ -551,7 +556,7 @@ public void readInfo() { |
551 | 556 | boardConfigField.setText(LibimobiledeviceUtil.getBoardConfig()); |
552 | 557 | } |
553 | 558 | } catch (LibimobiledeviceUtil.LibimobiledeviceException e) { |
554 | | - System.err.println(e.getMessage()); // don't need full stack trace |
| 559 | + System.err.println(e.getMessage()); // don't need a full stack trace |
555 | 560 | e.showErrorAlert(); |
556 | 561 | } catch (Throwable e) { |
557 | 562 | e.printStackTrace(); |
|
0 commit comments