This commit is contained in:
Craig Raw 2025-07-10 08:40:31 +02:00
parent 80105aee62
commit fa10714844
3 changed files with 13 additions and 2 deletions

View file

@ -188,7 +188,8 @@ public class QRScanDialog extends Dialog<QRScanDialog.Result> {
}
});
webcamDeviceProperty.addListener((_, _, newValue) -> {
Config.get().setWebcamDevice(newValue.getUniqueId());
Config.get().setWebcamDevice(newValue.getName());
Config.get().setWebcamDeviceId(newValue.getUniqueId());
if(!Objects.equals(webcamService.getDevice(), newValue)) {
webcamService.cancel();
}

View file

@ -144,7 +144,7 @@ public class WebcamService extends ScheduledService<Image> {
}
} else if(Config.get().getWebcamDevice() != null) {
for(CaptureDevice webcam : availableDevices) {
if(webcam.getUniqueId().equals(Config.get().getWebcamDevice())) {
if(webcam.getUniqueId().equals(Config.get().getWebcamDeviceId())) {
selectedDevice = webcam;
break;
}

View file

@ -63,6 +63,7 @@ public class Config {
private boolean mirrorCapture = true;
private boolean useZbar = true;
private String webcamDevice;
private String webcamDeviceId;
private ServerType serverType;
private Server publicElectrumServer;
private Server coreServer;
@ -437,6 +438,15 @@ public class Config {
flush();
}
public String getWebcamDeviceId() {
return webcamDeviceId;
}
public void setWebcamDeviceId(String webcamDeviceId) {
this.webcamDeviceId = webcamDeviceId;
flush();
}
public ServerType getServerType() {
return serverType;
}