fix for icon change. e1003c20ff

Signed-off-by: rattatwinko <seppmutterman@gmail.com>
This commit is contained in:
2026-02-02 12:31:02 +01:00
parent e1003c20ff
commit 701d95ab2d
3 changed files with 18 additions and 10 deletions

View File

@@ -25,7 +25,6 @@ public class SwingIFrame {
private boolean blackbg = false;
private final Color bgcolor = Color.decode("#336B6A");
private final Color defDesktopBg = Color.WHITE;
private final JPopupMenu popupMenu = new JPopupMenu();
@@ -55,7 +54,8 @@ public class SwingIFrame {
desktopIconManager.addIcon(
"Export Evidence",
IconSetter.getSaveIconAsImageIcon(),
EvidenceExportFrame::showExport
/* e1003c20ff00c637d963ce21fd685fed6460602a: Fix to icon, need to pass parent! Or Override method which is dumb */
() -> EvidenceExportFrame.showExport(mainFrame)
);
}

View File

@@ -1,5 +1,6 @@
package io.swtc.proccessing.ui.desktop.evidence;
import io.swtc.proccessing.ui.IconSetter;
import io.swtc.proccessing.ui.ShowError;
import io.swtc.recording.evidence.USBExportManager;
@@ -15,17 +16,25 @@ public class EvidenceExportFrame extends JFrame {
private final JLabel statusLabel;
private final JLabel detailLabel;
private final JButton actionBtn;
private final JFrame parent; /* neccessary to get icon working, inheritance is a bitch */
private EvidenceExportFrame(Path sourceDir, Path usbTargetDir, JFrame parent) {
this.parent = parent;
private EvidenceExportFrame(Path sourceDir, Path usbTargetDir) {
setTitle("Export");
setSize(400, 220);
setLocationRelativeTo(null);
setLocationRelativeTo(this.parent);
setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
JPanel contentPane = new JPanel();
contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS));
contentPane.setBorder(new EmptyBorder(25, 25, 25, 25));
ImageIcon ico = IconSetter.getSaveIconAsImageIcon();
this.setIconImage(ico.getImage());
statusLabel = new JLabel("Starting export");
statusLabel.setAlignmentX(Component.LEFT_ALIGNMENT);
statusLabel.setFont(new Font(statusLabel.getFont().getName(), Font.BOLD, 14));
@@ -61,7 +70,7 @@ public class EvidenceExportFrame extends JFrame {
return;
}
int confirm = JOptionPane.showConfirmDialog(this,
int confirm = JOptionPane.showConfirmDialog(this.parent,
"Stop export?", "Confirm", JOptionPane.YES_NO_OPTION);
if (confirm == JOptionPane.YES_OPTION) dispose();
}
@@ -91,7 +100,7 @@ public class EvidenceExportFrame extends JFrame {
);
}
public static void showExport() {
public static void showExport(JFrame parent) {
SwingUtilities.invokeLater(() -> {
File videoDir = new File(System.getProperty("user.home"), "Videos/swtcctv-rec");
if (!videoDir.exists()) {
@@ -101,9 +110,9 @@ public class EvidenceExportFrame extends JFrame {
JFileChooser chooser = new JFileChooser();
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
if (chooser.showOpenDialog(parent) == JFileChooser.APPROVE_OPTION) {
Path target = chooser.getSelectedFile().toPath().resolve("swtcctv-rec_" + System.currentTimeMillis() / 1000);
new EvidenceExportFrame(videoDir.toPath(), target);
new EvidenceExportFrame(videoDir.toPath(), target, parent);
}
});
}

View File

@@ -18,7 +18,6 @@ public class MediaSink {
recorder.setVideoCodec(avcodec.AV_CODEC_ID_H264);
recorder.setFormat("mp4");
recorder.setPixelFormat(avutil.AV_PIX_FMT_BGR24);
recorder.setFrameRate(config.fps());
/* this is essentially just building FFmpeg? Would've used ProccessBuilder for this lol */
recorder.setVideoOption("pixel_format", "yuv420p");
@@ -26,7 +25,7 @@ public class MediaSink {
recorder.setVideoOption("crf", String.valueOf(config.crf()));
recorder.setVideoOption("tune", "zerolatency");
recorder.setVideoOption("x264opts", "keyint=40:min-keyint=20");
recorder.setVideoBitrate(0); // 0 tells the recorder to respect CRF strictly
recorder.setVideoBitrate(0); // javacv respects bitrate already ; this is for my own safety
recorder.setGopSize(config.fps() * 2);
recorder.start();