Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
airsquared committed Jan 26, 2019
2 parents a8dac30 + 74bb770 commit 8c0588d
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 19 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ If you have an antivirus or firewall, you may need to disable some other setting
Please send feedback via [Github Issue](https://github.com/airsquared/blobsaver/issues/new/choose) 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.

## TODO:
- Fix reading the information from the device on Windows
- Better notifications
See Github issues tagged [enhancement](https://github.com/airsquared/blobsaver/labels/enhancement)

## Built With
- JDK 8
Expand Down
42 changes: 28 additions & 14 deletions src/main/java/com/airsquared/blobsaver/Controller.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.Menu;
import javafx.scene.control.MenuBar;
import javafx.scene.control.MenuItem;
import javafx.scene.control.TextField;
import javafx.scene.control.*;
import javafx.scene.effect.DropShadow;
import javafx.scene.input.MouseEvent;
Expand All @@ -52,12 +58,7 @@

import static com.airsquared.blobsaver.Main.appPrefs;
import static com.airsquared.blobsaver.Main.primaryStage;
import static com.airsquared.blobsaver.Shared.githubIssue;
import static com.airsquared.blobsaver.Shared.newReportableError;
import static com.airsquared.blobsaver.Shared.newUnreportableError;
import static com.airsquared.blobsaver.Shared.redditPM;
import static com.airsquared.blobsaver.Shared.reportError;
import static com.airsquared.blobsaver.Shared.resizeAlertButtons;
import static com.airsquared.blobsaver.Shared.*;

public class Controller {

Expand Down Expand Up @@ -335,7 +336,7 @@ public void initialize() {
@Override
public void handle(WindowEvent event) {
useMacOSMenuBar();
log("using macos menu bar");
log("using macOS menu bar");
primaryStage.removeEventHandler(event.getEventType(), this);
}
});
Expand Down Expand Up @@ -813,7 +814,6 @@ public void helpLabelHandler(MouseEvent evt) {
e.printStackTrace();
}
}
alert.showAndWait();
break;
case "boardConfig":
openLink = new ButtonType("BMSSM app");
Expand Down Expand Up @@ -852,11 +852,23 @@ public void aboutMenuHandler() {
ButtonType viewLicense = new ButtonType("View License");
ButtonType librariesUsed = new ButtonType("Libraries Used");
ButtonType donate = new ButtonType("Donate!");
Alert alert = new Alert(Alert.AlertType.INFORMATION, "About text here", librariesUsed, viewLicense, donate, githubRepo, ButtonType.OK);
ButtonType customOK = new ButtonType("OK", ButtonBar.ButtonData.CANCEL_CLOSE);
Alert alert = new Alert(Alert.AlertType.INFORMATION, "About text here",
librariesUsed, viewLicense, donate, githubRepo, customOK);
alert.setTitle("About");

//Deactivate default behavior for librariesUsed Button:
Button libButton = (Button) alert.getDialogPane().lookupButton(librariesUsed);
libButton.setDefaultButton(false);

//Activate default behavior for OK-Button:
Button OkButton = (Button) alert.getDialogPane().lookupButton(customOK);
OkButton.setDefaultButton(true);

alert.setHeaderText("blobsaver " + Main.appVersion);
alert.setContentText("blobsaver Copyright (c) 2018 airsquared\n\n" +
"This program is licensed under GNU GPL v3.0-only");

resizeAlertButtons(alert);
alert.showAndWait();
switch (alert.getResult().getText()) {
Expand Down Expand Up @@ -886,7 +898,7 @@ public void aboutMenuHandler() {
out.close();
licenseFile.deleteOnExit();
licenseFile.setReadOnly();
java.awt.Desktop.getDesktop().edit(licenseFile);
Desktop.getDesktop().edit(licenseFile);
} catch (IOException e) {
e.printStackTrace();
}
Expand All @@ -910,7 +922,7 @@ public void aboutMenuHandler() {
out.close();
libsUsedFile.deleteOnExit();
libsUsedFile.setReadOnly();
java.awt.Desktop.getDesktop().edit(libsUsedFile);
Desktop.getDesktop().edit(libsUsedFile);
} catch (IOException e) {
e.printStackTrace();
}
Expand Down Expand Up @@ -957,7 +969,7 @@ private void useMacOSMenuBar() {
windowMenu.getItems().add(tk.createMinimizeMenuItem());
windowMenu.getItems().add(tk.createCycleWindowsItem());

MenuItem debugLogMenuItem = new MenuItem("Open/Close Debug log");
MenuItem debugLogMenuItem = new MenuItem("Open/Close Debug Log");
debugLogMenuItem.setOnAction(event -> {
debugLogHandler();
tk.setMenuBar(DebugWindow.getDebugStage(), macOSMenuBar);
Expand Down Expand Up @@ -1136,7 +1148,9 @@ public void resetAppHandler() {
try {
Alert confirmationAlert = new Alert(Alert.AlertType.CONFIRMATION, "Are you sure you would like to uninstall this application?", ButtonType.NO, ButtonType.YES);
confirmationAlert.showAndWait();
if ((confirmationAlert.getResult() == null) || ButtonType.CANCEL.equals(confirmationAlert.getResult()) || ButtonType.NO.equals(confirmationAlert.getResult())) {
if ((confirmationAlert.getResult() == null)
|| ButtonType.CANCEL.equals(confirmationAlert.getResult())
|| ButtonType.NO.equals(confirmationAlert.getResult())) {
return;
}
Preferences prefs = Preferences.userRoot().node("airsquared/blobsaver");
Expand Down Expand Up @@ -1486,4 +1500,4 @@ public void goButtonHandler() {
run(Shared.textToIdentifier(deviceModel));
}
}
}
}
6 changes: 3 additions & 3 deletions src/main/resources/com/airsquared/blobsaver/blobsaver.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<VBox maxHeight="Infinity" maxWidth="-Infinity" minHeight="580.0" prefWidth="500.0">
<MenuBar fx:id="menuBar">
<Menu mnemonicParsing="false" text="Options">
<MenuItem mnemonicParsing="false" onAction="#debugLogHandler" text="Debug log"/>
<MenuItem mnemonicParsing="false" onAction="#debugLogHandler" text="Debug Log"/>
<MenuItem mnemonicParsing="false" onAction="#checkBlobs" text="Check for valid blobs..."/>
<MenuItem mnemonicParsing="false" onAction="#checkForUpdatesHandler"
text="Check for Updates..."/>
Expand All @@ -48,8 +48,8 @@
text="How do I get a crash log?"/>
</Menu>
<MenuItem mnemonicParsing="false" onAction="#newGithubIssue"
text="Send Feedback(Github Issue)"/>
<MenuItem mnemonicParsing="false" onAction="#sendRedditPM" text="Send Feedback(Reddit PM)"/>
text="Send Feedback (Github Issue)"/>
<MenuItem mnemonicParsing="false" onAction="#sendRedditPM" text="Send Feedback (Reddit PM)"/>
<SeparatorMenuItem mnemonicParsing="false"/>
<MenuItem mnemonicParsing="false" onAction="#donate" text="Donate!"/>
<SeparatorMenuItem mnemonicParsing="false"/>
Expand Down

0 comments on commit 8c0588d

Please sign in to comment.