Trial 04022025

This commit is contained in:
2025-02-04 08:48:28 +07:00
parent a60fe56510
commit 29884c03ed
24 changed files with 16423 additions and 158594 deletions

View File

@@ -13,6 +13,7 @@ import org.tinylog.Logger;
import java.io.File;
import static Config.SomeCodes.ValidString;
import static Config.SomeCodes.config;
public class SettingView {
@@ -53,6 +54,64 @@ public class SettingView {
String[] cameranames = null;
@FXML
private TextField cascadeMinSize;
@FXML
private TextField cascadeScaleFactor;
@FXML
private TextField cascadeMaxSize;
@FXML
private void CascadeSettingApply(){
String minsize = cascadeMinSize.getText();
String scalefactor = cascadeScaleFactor.getText();
String maxsize = cascadeMaxSize.getText();
if (ValidString(minsize)){
if (ValidString(maxsize)){
if (ValidString(scalefactor)){
try{
int min = Integer.parseInt(minsize);
double scale = Double.parseDouble(scalefactor);
int max = Integer.parseInt(maxsize);
if (scale> 1.0){
if (min>0){
if (max>min){
config.setCascadeMaxSize(max);
config.setCascadeMinSize(min);
config.setCascadeScaleFactor(scale);
config.Save();
Detectors.setMaxSize(max);
Detectors.setMinSize(min);
Detectors.setScaleFactor(scale);
val alert = new Alert(Alert.AlertType.INFORMATION);
alert.setTitle("Cascade Setting");
alert.setHeaderText("Cascade Setting Saved");
alert.setContentText("Cascade Setting Saved Successfully");
alert.showAndWait();
} else show_cascade_alert("Max Size must be greater than Min Size");
} else show_cascade_alert("Min Size must be greater than 0");
} else show_cascade_alert("Scale Factor must be greater than 1.0");
} catch (NumberFormatException e){
show_cascade_alert("Min Size, Scale Factor, and Max Size must be a number");
}
} else show_cascade_alert("Scale Factor must not empty");
} else show_cascade_alert("Max Size must not empty");
} else show_cascade_alert("Min Size must not empty");
}
private void show_cascade_alert(String content){
val alert = new Alert(Alert.AlertType.ERROR);
alert.setTitle("Cascade Setting Error");
alert.setHeaderText("Cascade Setting Error");
alert.setContentText(content);
alert.showAndWait();
}
@FXML
public void initialize(){
FileChooser.ExtensionFilter filter = new FileChooser.ExtensionFilter("Audio File", "wav","mp3");
@@ -108,6 +167,10 @@ public class SettingView {
FTPUser.setText(config.getFTPUser());
FTPPass.setText(config.getFTPPass());
FTPPath.setText(config.getFTPPath());
cascadeScaleFactor.setText(String.valueOf(config.getCascadeScaleFactor()));
cascadeMinSize.setText(String.valueOf(config.getCascadeMinSize()));
cascadeMaxSize.setText(String.valueOf(config.getCascadeMaxSize()));
});
}