commit 24/03/2025

This commit is contained in:
rdkartono
2025-03-24 15:42:39 +07:00
parent 58194d8979
commit fbb68b4da7
14 changed files with 1216 additions and 580 deletions

View File

@@ -2,8 +2,11 @@ package id.co.gtc.erhacam;
import FTP.FTPCheck;
import javafx.application.Platform;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.fxml.FXML;
import javafx.scene.control.Alert;
import javafx.scene.control.CheckBox;
import javafx.scene.control.ComboBox;
import javafx.scene.control.TextField;
import javafx.stage.DirectoryChooser;
@@ -13,6 +16,7 @@ import org.bytedeco.javacv.VideoInputFrameGrabber;
import org.tinylog.Logger;
import java.io.File;
import java.util.Objects;
import static Config.SomeCodes.*;
@@ -39,9 +43,18 @@ public class SettingView {
@FXML
private TextField FTPPath;
@FXML
private TextField Sharpness;
@FXML
private TextField PhotoDirectoryPath;
@FXML
private CheckBox MirrorCamera;
@FXML
private CheckBox FlipCamera;
final FileChooser jfc = new FileChooser();
@@ -68,8 +81,20 @@ public class SettingView {
PhotoDirectoryPath.setText(path);
}
@FXML
private void SharpnessApply(){
String str = Sharpness.getText();
if (ValidDouble(str)){
config.setSharpnessThreshold(Double.parseDouble(str));
config.Save();
} else {
ShowAlert(Alert.AlertType.ERROR, "Sharpness Setting Error", "Sharpness Setting Error", "Sharpness Setting must be a number");
}
}
@FXML
private void CascadeSettingApply(){
String minsize = cascadeMinSize.getText();
String scalefactor = cascadeScaleFactor.getText();
String maxsize = cascadeMaxSize.getText();
@@ -104,6 +129,7 @@ public class SettingView {
} 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){
@@ -123,7 +149,17 @@ public class SettingView {
Logger.error("Unable to detect Cameras, Msg : "+e.getMessage());
}
MirrorCamera.selectedProperty().addListener(((observable, oldValue, newValue) -> {
System.out.println("Mirror option changed to : "+newValue);
config.setMirrorCamera(newValue);
config.Save();
}));
FlipCamera.selectedProperty().addListener((observable, oldValue, newValue) -> {
System.out.println("Flip option changed to : "+newValue);
config.setFlipCamera(newValue);
config.Save();
});
Platform.runLater(()->{
@@ -166,6 +202,12 @@ public class SettingView {
cascadeScaleFactor.setText(String.valueOf(config.getCascadeScaleFactor()));
cascadeMinSize.setText(String.valueOf(config.getCascadeMinSize()));
cascadeMaxSize.setText(String.valueOf(config.getCascadeMaxSize()));
MirrorCamera.setSelected(config.isMirrorCamera());
FlipCamera.setSelected(config.isFlipCamera());
Sharpness.setText(String.valueOf(config.getSharpnessThreshold()));
});
}