Commit 21032025

This commit is contained in:
2025-03-21 14:24:05 +07:00
parent b248c59e32
commit 80d468a79a
37 changed files with 858 additions and 964 deletions

View File

@@ -6,6 +6,7 @@ import javafx.fxml.FXML;
import javafx.scene.control.Alert;
import javafx.scene.control.ComboBox;
import javafx.scene.control.TextField;
import javafx.stage.DirectoryChooser;
import javafx.stage.FileChooser;
import lombok.val;
import org.bytedeco.javacv.VideoInputFrameGrabber;
@@ -13,21 +14,9 @@ import org.tinylog.Logger;
import java.io.File;
import static Config.SomeCodes.ValidString;
import static Config.SomeCodes.config;
import static Config.SomeCodes.*;
public class SettingView {
@FXML
private TextField AudioPhase1;
@FXML
private TextField AudioPhase2;
@FXML
private TextField AudioPhase3;
@FXML
private TextField AudioPhase4;
@FXML
private TextField AudioPhase5;
@FXML
private ComboBox<String> CameraLeft90;
@FXML
@@ -50,6 +39,11 @@ public class SettingView {
@FXML
private TextField FTPPath;
@FXML
private TextField PhotoDirectoryPath;
final FileChooser jfc = new FileChooser();
String[] cameranames = null;
@@ -63,6 +57,17 @@ public class SettingView {
@FXML
private TextField cascadeMaxSize;
@FXML
private void ChangePhotoDirectoryPath(){
DirectoryChooser dc = new DirectoryChooser();
dc.setTitle("Select Directory");
String path = dc.showDialog(null).getAbsolutePath();
config.SetPhotoDirectory(path);
config.Save();
PhotoDirectoryPath.setText(path);
}
@FXML
private void CascadeSettingApply(){
String minsize = cascadeMinSize.getText();
@@ -87,11 +92,8 @@ public class SettingView {
Detectors.setFaceMaxSize(max);
Detectors.setFaceMinSize(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();
ShowAlert(Alert.AlertType.INFORMATION, "Cascade Setting", "Cascade Setting Saved", "Cascade Setting Saved Successfully");
} 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");
@@ -105,11 +107,7 @@ public class SettingView {
}
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();
ShowAlert(Alert.AlertType.ERROR, "Cascade Setting Error", "Cascade Setting Error", content);
}
@FXML
@@ -129,11 +127,6 @@ public class SettingView {
Platform.runLater(()->{
AudioPhase1.setText(config.getAudioPhase1());
AudioPhase2.setText(config.getAudioPhase2());
AudioPhase3.setText(config.getAudioPhase3());
AudioPhase4.setText(config.getAudioPhase4());
AudioPhase5.setText(config.getAudioPhase5());
CameraLeft90.getItems().clear();
CameraLeft45.getItems().clear();
@@ -168,6 +161,8 @@ public class SettingView {
FTPPass.setText(config.getFTPPass());
FTPPath.setText(config.getFTPPath());
PhotoDirectoryPath.setText(config.getPhotoDirectory());
cascadeScaleFactor.setText(String.valueOf(config.getCascadeScaleFactor()));
cascadeMinSize.setText(String.valueOf(config.getCascadeMinSize()));
cascadeMaxSize.setText(String.valueOf(config.getCascadeMaxSize()));
@@ -178,52 +173,6 @@ public class SettingView {
config.Save();
}
@FXML
private void BrowseAudioPhase1(){
File file = jfc.showOpenDialog(null);
if (file!=null){
config.SetAudioPhase1(file.getAbsolutePath());
AudioPhase1.setText(config.getAudioPhase1());
}
}
@FXML
private void BrowseAudioPhase2(){
File file = jfc.showOpenDialog(null);
if (file!=null){
config.SetAudioPhase2(file.getAbsolutePath());
AudioPhase2.setText(config.getAudioPhase2());
}
}
@FXML
private void BrowseAudioPhase3(){
File file = jfc.showOpenDialog(null);
if (file!=null){
config.SetAudioPhase3(file.getAbsolutePath());
AudioPhase3.setText(config.getAudioPhase3());
}
}
@FXML
private void BrowseAudioPhase4(){
File file = jfc.showOpenDialog(null);
if (file!=null){
config.SetAudioPhase4(file.getAbsolutePath());
AudioPhase4.setText(config.getAudioPhase4());
}
}
@FXML
private void BrowseAudioPhase5(){
File file = jfc.showOpenDialog(null);
if (file!=null){
config.SetAudioPhase5(file.getAbsolutePath());
AudioPhase5.setText(config.getAudioPhase5());
}
}
@FXML
private void ApplyCameraLeft90(){
config.SetCameraLeft90(CameraLeft90.getValue());
@@ -261,18 +210,8 @@ public class SettingView {
config.SetFTPPass(FTPPass.getText());
config.SetFTPPath(FTPPath.getText());
val alert = new Alert(Alert.AlertType.INFORMATION);
alert.setTitle("FTP Configuration");
alert.setHeaderText("FTP Configuration Saved");
alert.setContentText("FTP Configuration Saved Successfully");
alert.showAndWait();
} else {
val alert = new Alert(Alert.AlertType.ERROR);
alert.setTitle("FTP Error");
alert.setHeaderText("FTP Configuration Error");
alert.setContentText("FTP Configuration is incorrect, please check your FTP Configuration");
alert.showAndWait();
}
ShowAlert(Alert.AlertType.INFORMATION, "FTP Configuration", "FTP Configuration Saved", "FTP Configuration Saved Successfully");
} else ShowAlert(Alert.AlertType.ERROR, "FTP Error", "FTP Configuration Error", "FTP Configuration is incorrect, please check your FTP Configuration");
}
}