refactors ; some new additions to recording which are critical for cctv softwares

This commit is contained in:
2026-01-21 18:09:30 +01:00
parent 3eaf6f0303
commit c32b5d7278
14 changed files with 405 additions and 278 deletions

View File

@@ -8,6 +8,7 @@ import com.github.sarxos.webcam.ds.ipcam.IpCamDriver;
import com.github.sarxos.webcam.ds.ipcam.IpCamMode;
import io.swtc.networking.CameraConfig;
import io.swtc.networking.CameraSettings;
import io.swtc.proccessing.ui.IconSetter;
import javax.swing.*;
import javax.swing.table.DefaultTableCellRenderer;
@@ -37,6 +38,7 @@ public class SwingCCTVManager {
frame = new JFrame("dashboard");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(1000, 600);
frame.setIconImage(IconSetter.getIcon());
this.IFrame = new SwingIFrame();
this.IFrame.show();
@@ -71,14 +73,33 @@ public class SwingCCTVManager {
}
});
JToolBar toolBar = new JToolBar();
Image ogIcon = IconSetter.getIcon();
Image scaledIcon = ogIcon.getScaledInstance(32, 32, Image.SCALE_SMOOTH);
JLabel iconLabel = new JLabel(new ImageIcon(scaledIcon));
toolBar.add(iconLabel);
JLabel textLabel = new JLabel("SWT-CCTV");
toolBar.add(textLabel);
toolBar.add(Box.createRigidArea(new Dimension(10, 0))); // 20px horizontal padding
toolBar.addSeparator(new Dimension(10, 32)); // 10px width, 32px height
JButton btnAdd = new JButton("Add IP Cam");
JButton btnLaunch = new JButton("Launch Stream");
btnAdd.setPreferredSize(new Dimension(100, 32));
btnLaunch.setPreferredSize(new Dimension(120, 32));
toolBar.add(Box.createRigidArea(new Dimension(5,0)));
toolBar.add(btnAdd);
toolBar.addSeparator();
toolBar.add(btnLaunch);
frame.add(toolBar, BorderLayout.NORTH);
frame.add(toolBar, BorderLayout.SOUTH);
frame.add(new JScrollPane(deviceTable), BorderLayout.CENTER);
btnAdd.addActionListener(e -> showAddCameraDialog());
@@ -145,12 +166,14 @@ public class SwingCCTVManager {
}
JPopupMenu menu = new JPopupMenu();
JMenuItem ico = new JMenuItem("test");
JMenuItem launch = new JMenuItem("Launch Live Stream");
JMenuItem delete = new JMenuItem("Remove Device");
launch.addActionListener(al -> launchSelected());
delete.addActionListener(al -> deleteSelected());
menu.add(ico);
menu.add(launch);
menu.addSeparator();
menu.add(delete);