@@ -31,6 +31,12 @@ public class WelcomeViewFXController {
3131 @ FXML private CheckBox systemButton ;
3232 @ FXML private CheckBox securityButton ;
3333 @ FXML private Label securityLabel ;
34+ @ FXML private Button logFilesDirButton ;
35+ @ FXML private Button reportDirButton ;
36+
37+ @ FXML private CheckBox noLogsBox ;
38+ @ FXML private CheckBox saveInAppDirectoryBox ;
39+
3440
3541 @ Autowired public appConfig appConfig ;
3642
@@ -50,9 +56,11 @@ private void scan(ActionEvent event) throws IOException {
5056 String logDir = logFilesDirField .getText ();
5157 String reportDir = reportDirField .getText ();
5258
53- if (logDir .isEmpty () || reportDir .isEmpty ()) {
54- informationLabel .setText ("Please select both directories." );
55- return ;
59+ if (!noLogsBox .isSelected ()) {
60+ if (logDir .isEmpty () || reportDir .isEmpty ()) {
61+ informationLabel .setText ("Please select both directories." );
62+ return ;
63+ }
5664 }
5765
5866 if (!appButton .isSelected () && !systemButton .isSelected () && !securityButton .isSelected ()) {
@@ -146,4 +154,76 @@ private boolean askForSecurityPermission() {
146154
147155 return alert .showAndWait ().filter (btn -> btn == ButtonType .OK ).isPresent ();
148156 }
157+ @ FXML
158+ private void noLogsBoxOn (ActionEvent event ) throws IOException {
159+ if (noLogsBox .isSelected ()) {
160+ appConfig .setNoLogs (true );
161+
162+ appConfig .setSaveInExeDir (false );
163+ saveInAppDirectoryBox .setSelected (false );
164+ saveInAppDirectoryBox .setDisable (true );
165+
166+ logFilesDirButton .setDisable (true );
167+ reportDirButton .setDisable (true );
168+
169+ logFilesDirField .clear ();
170+ reportDirField .clear ();
171+
172+ appConfig .setLogsDir (null );
173+ appConfig .setReportDir (null );
174+
175+ } else {
176+ appConfig .setNoLogs (false );
177+ saveInAppDirectoryBox .setDisable (false );
178+
179+ if (appConfig .isSaveInExeDir ()) {
180+ String baseDir = System .getProperty ("user.dir" );
181+ String logs = baseDir + "/logs" ;
182+ String reports = baseDir + "/reports" ;
183+
184+ appConfig .setSaveInExeDir (true );
185+ appConfig .setLogsDir (logs );
186+ appConfig .setReportDir (reports );
187+
188+ logFilesDirField .setText (logs );
189+ reportDirField .setText (reports );
190+
191+ logFilesDirButton .setDisable (true );
192+ reportDirButton .setDisable (true );
193+
194+ } else {
195+ logFilesDirButton .setDisable (false );
196+ reportDirButton .setDisable (false );
197+ }
198+ }
199+ }
200+ @ FXML
201+ private void saveInAppDirectoryBoxOn (ActionEvent event ) throws IOException {
202+ if (saveInAppDirectoryBox .isSelected ()) {
203+ appConfig .setSaveInExeDir (true );
204+
205+ String baseDir = System .getProperty ("user.dir" );
206+ String logs = baseDir + "/logs" ;
207+ String reports = baseDir + "/reports" ;
208+
209+ logFilesDirField .setText (logs );
210+ reportDirField .setText (reports );
211+
212+ logFilesDirButton .setDisable (true );
213+ reportDirButton .setDisable (true );
214+
215+ new File (logs ).mkdirs ();
216+ new File (reports ).mkdirs ();
217+
218+ appConfig .setLogsDir (logs );
219+ appConfig .setReportDir (reports );
220+
221+ } else {
222+ appConfig .setSaveInExeDir (false );
223+
224+ logFilesDirButton .setDisable (false );
225+ reportDirButton .setDisable (false );
226+
227+ }
228+ }
149229}
0 commit comments