@@ -98,8 +98,8 @@ public class Controller {
98
98
private boolean editingPresets = false ;
99
99
private boolean choosingRunInBackground = false ;
100
100
101
- static DropShadow errorBorder = new DropShadow ();
102
- private static DropShadow borderGlow = new DropShadow ();
101
+ static DropShadow errorBorder = new DropShadow (9.5 , 0f , 0f , Color . RED );
102
+ private static DropShadow borderGlow = new DropShadow (9.5 , 0f , 0f , Color . DARKCYAN );
103
103
104
104
static Controller INSTANCE ;
105
105
@@ -117,19 +117,6 @@ static void afterStageShowing() {
117
117
@ FXML
118
118
public void initialize () {
119
119
INSTANCE = this ;
120
- // create effects
121
- borderGlow .setOffsetY (0f );
122
- borderGlow .setOffsetX (0f );
123
- borderGlow .setColor (Color .DARKCYAN );
124
- borderGlow .setWidth (20 );
125
- borderGlow .setHeight (20 );
126
- errorBorder .setOffsetY (0f );
127
- errorBorder .setOffsetX (0f );
128
- errorBorder .setColor (Color .RED );
129
- errorBorder .setWidth (20 );
130
- errorBorder .setHeight (20 );
131
-
132
- deviceTypeChoiceBox .setItems (FXCollections .observableArrayList (Devices .getDeviceTypes ()));
133
120
134
121
deviceTypeChoiceBox .getSelectionModel ().selectedItemProperty ().addListener ((x , y , newValue ) -> {
135
122
deviceTypeChoiceBox .setEffect (null );
@@ -170,20 +157,8 @@ public void initialize() {
170
157
presetButtons = new ArrayList <>(Arrays .asList (preset1Button , preset2Button , preset3Button , preset4Button , preset5Button , preset6Button , preset7Button , preset8Button , preset9Button , preset10Button ));
171
158
presetButtons .forEach (btn -> btn .setOnAction (this ::presetButtonHandler ));
172
159
173
- // the following is to set the path to save blobs to the correct location
174
- String path = Main .jarDirectory .getAbsolutePath ();
175
- if (path .endsWith ("blobsaver.app/Contents/Java" )) {
176
- path = path .replaceAll ("blobsaver\\ .app/Contents/Java" , "" );
177
- }
178
- if (path .contains ("\\ Program Files" ) || path .contains ("/Applications" )) {
179
- path = System .getProperty ("user.home" );
180
- }
181
- if (path .endsWith (System .getProperty ("file.separator" ))) {
182
- path = path + "Blobs" ;
183
- } else {
184
- path = path + System .getProperty ("file.separator" ) + "Blobs" ;
185
- }
186
- pathField .setText (path );
160
+
161
+ pathField .setText (new File (System .getProperty ("user.home" ), "Blobs" ).getAbsolutePath ());
187
162
188
163
189
164
if (PlatformUtil .isMac ()) {
@@ -250,7 +225,6 @@ public void versionCheckBoxHandler() {
250
225
versionField .setText ("" );
251
226
} else {
252
227
versionField .setEffect (borderGlow );
253
-
254
228
versionField .setDisable (false );
255
229
}
256
230
}
@@ -367,12 +341,12 @@ private void presetButtonHandler(ActionEvent evt) {
367
341
if (presetsToSaveFor .isEmpty ()) {
368
342
appPrefs .putBoolean ("Background setup" , false );
369
343
}
370
- log ("removed " + preset + " from list" );
344
+ System . out . println ("removed " + preset + " from list" );
371
345
backgroundSettingsButton .fire ();
372
346
} else {
373
347
presetsToSaveFor .add (Integer .toString (preset ));
374
348
appPrefs .putBoolean ("Background setup" , true );
375
- log ("added preset" + preset + " to list" );
349
+ System . out . println ("added preset" + preset + " to list" );
376
350
Alert alert = new Alert (Alert .AlertType .INFORMATION , "If it doesn't work, please remove it, fix the error, and add it back" );
377
351
alert .setTitle ("Testing preset " + preset );
378
352
alert .setHeaderText ("Testing preset" );
@@ -657,7 +631,7 @@ private void useMacOSMenuBar() {
657
631
658
632
// needs to be run with Platform.runLater(), otherwise the application menu doesn't show up
659
633
Platform .runLater (() -> tk .setGlobalMenuBar (macOSMenuBar ));
660
- log ("using macOS menu bar" );
634
+ System . out . println ("using macOS menu bar" );
661
635
}
662
636
663
637
public void backgroundSettingsHandler () {
@@ -733,11 +707,9 @@ public void chooseTimeToRunHandler() {
733
707
alert .getDialogPane ().setContent (hBox );
734
708
alert .showAndWait ();
735
709
if ((alert .getResult () != null ) && !ButtonType .CANCEL .equals (alert .getResult ()) && !"" .equals (textField .getText ()) && (choiceBox .getValue () != null )) {
736
- log ("info given" );
737
710
appPrefs .putInt ("Time to run" , Integer .parseInt (textField .getText ()));
738
711
appPrefs .put ("Time unit for background" , choiceBox .getValue ());
739
712
} else {
740
- log ("alert menu canceled" );
741
713
backgroundSettingsButton .fire (); //goes back to main menu
742
714
return ;
743
715
}
@@ -797,8 +769,6 @@ public void resetAppHandler() {
797
769
prefs .clear ();
798
770
prefs .removeNode ();
799
771
prefs .flush ();
800
- File blobsaver_bin = new File (System .getProperty ("user.home" ), ".blobsaver_bin" );
801
- deleteFolder (blobsaver_bin );
802
772
Alert applicationCloseAlert = new Alert (Alert .AlertType .INFORMATION , "The application data and files have been removed. If you are running Windows, you still will need to run the uninstall .exe. Otherwise, you can just delete the .app or .jar file.\n The application will now exit." , ButtonType .OK );
803
773
applicationCloseAlert .showAndWait ();
804
774
Platform .exit ();
@@ -807,22 +777,6 @@ public void resetAppHandler() {
807
777
}
808
778
}
809
779
810
- @ SuppressWarnings ("ResultOfMethodCallIgnored" )
811
- private static void deleteFolder (File folder ) {
812
- if (folder .exists ()) {
813
- File [] files = folder .listFiles ();
814
- if (files != null ) {
815
- Arrays .asList (files ).forEach (file -> {
816
- if (file .isDirectory ()) {
817
- deleteFolder (file );
818
- } else {
819
- file .delete ();
820
- }
821
- });
822
- }
823
- }
824
- }
825
-
826
780
public void debugLogHandler () {
827
781
if (DebugWindow .isShowing ()) {
828
782
DebugWindow .hide ();
@@ -907,8 +861,6 @@ public void readInfo() {
907
861
908
862
public void donate () { openURL ("https://www.paypal.me/airsqrd" ); }
909
863
910
- private static void log (String msg ) { System .out .println (msg ); }
911
-
912
864
@ SuppressWarnings ("Duplicates" )
913
865
public void goButtonHandler () {
914
866
boolean doReturn = false ;
@@ -928,22 +880,20 @@ public void goButtonHandler() {
928
880
doReturn = doReturn || isTextFieldInvalid (!versionCheckBox .isSelected (), versionField );
929
881
doReturn = doReturn || isTextFieldInvalid (betaCheckBox , buildIDField );
930
882
doReturn = doReturn || isTextFieldInvalid (betaCheckBox , ipswField );
931
- if (doReturn ) {
932
- return ;
933
- }
883
+ if (doReturn ) return ;
884
+
934
885
String deviceModel = (String ) deviceModelChoiceBox .getValue ();
935
886
if ("" .equals (deviceModel )) {
936
887
String identifierText = identifierField .getText ();
937
888
try {
938
889
if (identifierText .startsWith ("iPad" ) || identifierText .startsWith ("iPod" ) || identifierText .startsWith ("iPhone" ) || identifierText .startsWith ("AppleTV" )) {
939
890
TSSChecker .run (identifierText );
940
- } else {
941
- identifierField .setEffect (errorBorder );
942
- newUnreportableError ("\" " + identifierText + "\" is not a valid identifier" );
891
+ return ;
943
892
}
944
- } catch (StringIndexOutOfBoundsException e ) {
945
- newUnreportableError ("\" " + identifierText + "\" is not a valid identifier" );
893
+ } catch (StringIndexOutOfBoundsException ignored ) {
946
894
}
895
+ identifierField .setEffect (errorBorder );
896
+ newUnreportableError ("\" " + identifierText + "\" is not a valid identifier" );
947
897
} else {
948
898
TSSChecker .run (textToIdentifier (deviceModel ));
949
899
}
0 commit comments