Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
paulpacifico authored Nov 22, 2024
1 parent a90250a commit 9f81f6c
Show file tree
Hide file tree
Showing 6 changed files with 260 additions and 128 deletions.
126 changes: 123 additions & 3 deletions src/application/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import java.awt.event.AdjustmentListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
Expand Down Expand Up @@ -130,6 +131,8 @@ public class Settings {
public static JCheckBox btnDisableVideoPlayer = new JCheckBox(Shutter.language.getProperty("btnDisableVideoPlayer"));
public static JCheckBox btnDisableMinimizedWindow = new JCheckBox(Shutter.language.getProperty("btnDisableMinimizedWindow"));
public static JTextField txtExclude = new JTextField();
public static JCheckBox btnCustomFFmpegPath = new JCheckBox(Shutter.language.getProperty("btnCustomFFmpegPath"));
public static JTextField txtCustomFFmpegPath = new JTextField();
private JLabel defaultOutput1 = new JLabel(Shutter.language.getProperty("output") + "1 " + Shutter.language.getProperty("toDefault"));
private JLabel defaultOutput2 = new JLabel(Shutter.language.getProperty("output") + "2 " + Shutter.language.getProperty("toDefault"));
private JLabel defaultOutput3 = new JLabel(Shutter.language.getProperty("output") + "3 " + Shutter.language.getProperty("toDefault"));
Expand Down Expand Up @@ -160,6 +163,8 @@ public Settings() {
btnDisableVideoPlayer.setName("btnDisableVideoPlayer");
btnDisableMinimizedWindow.setName("btnDisableMinimizedWindow");
btnEmptyListAtEnd.setName("btnEmptyListAtEnd");
btnCustomFFmpegPath.setName("btnCustomFFmpegPath");
txtCustomFFmpegPath.setName("txtCustomFFmpegPath");
lblDestination1.setName("lblDestination1");
lblDestination2.setName("lblDestination2");
lblDestination3.setName("lblDestination3");
Expand All @@ -172,10 +177,10 @@ public Settings() {
txtImageDuration.setName("txtImageDuration");
comboLanguage.setName("comboLanguage");

frame.setSize(370, 722);
frame.setSize(370, 742);
if (Shutter.getLanguage.equals(Locale.of("ru").getDisplayLanguage()) || Shutter.getLanguage.equals(Locale.of("uk").getDisplayLanguage()))
{
frame.setSize(frame.getWidth() + 30, frame.getHeight());
frame.setSize(frame.getWidth() + 50, frame.getHeight());
}

frame.getContentPane().setBackground(new Color(30,30,35));
Expand Down Expand Up @@ -340,6 +345,7 @@ public void actionPerformed(ActionEvent arg0) {

@Override
public void actionPerformed(ActionEvent arg0) {

if (btnExclude.isSelected())
{
txtExclude.setEnabled(true);
Expand Down Expand Up @@ -463,8 +469,116 @@ public void actionPerformed(ActionEvent arg0) {
comboAction.setEnabled(false);
frame.getContentPane().add(comboAction);

btnCustomFFmpegPath.setFont(new Font(Shutter.freeSansFont, Font.PLAIN, 12));
btnCustomFFmpegPath.setBounds(12, btnEndingAction.getLocation().y + btnEndingAction.getHeight() + 10, btnCustomFFmpegPath.getPreferredSize().width, 16);
frame.getContentPane().add(btnCustomFFmpegPath);

btnCustomFFmpegPath.addActionListener(new ActionListener(){

@Override
public void actionPerformed(ActionEvent arg0) {

if (btnCustomFFmpegPath.isSelected())
{
txtCustomFFmpegPath.setEnabled(true);

if (Settings.txtCustomFFmpegPath.getText().equals("") == false)
{
VideoPlayer.PathToFFMPEG = Settings.txtCustomFFmpegPath.getText();
}
}
else
{
txtCustomFFmpegPath.setEnabled(false);

VideoPlayer.PathToFFMPEG = Shutter.class.getProtectionDomain().getCodeSource().getLocation().getPath();

if (System.getProperty("os.name").contains("Windows"))
{
VideoPlayer.PathToFFMPEG = VideoPlayer.PathToFFMPEG.substring(1,VideoPlayer.PathToFFMPEG.length()-1);
VideoPlayer.PathToFFMPEG = VideoPlayer.PathToFFMPEG.substring(0,(int) (VideoPlayer.PathToFFMPEG.lastIndexOf("/"))).replace("%20", " ") + "\\Library\\ffmpeg.exe";
}
else
{
VideoPlayer.PathToFFMPEG = VideoPlayer.PathToFFMPEG.substring(0,VideoPlayer.PathToFFMPEG.length()-1);
VideoPlayer.PathToFFMPEG = VideoPlayer.PathToFFMPEG.substring(0,(int) (VideoPlayer.PathToFFMPEG.lastIndexOf("/"))).replace("%20", "\\ ") + "/Library/ffmpeg";
}
}

if (VideoPlayer.videoPath != null)
{
VideoPlayer.btnStop.doClick();
}
}
});

txtCustomFFmpegPath.setFont(new Font(Shutter.freeSansFont, Font.PLAIN, 12));

if (btnCustomFFmpegPath.isSelected())
{
txtCustomFFmpegPath.setEnabled(true);
}
else
txtCustomFFmpegPath.setEnabled(false);

txtCustomFFmpegPath.setText("/usr/bin/ffmpeg");
txtCustomFFmpegPath.setBounds(btnCustomFFmpegPath.getX() + btnCustomFFmpegPath.getWidth() + 6, btnCustomFFmpegPath.getLocation().y - 4, frame.getWidth() - (btnCustomFFmpegPath.getLocation().x + btnCustomFFmpegPath.getWidth()) - 32, 21);
frame.getContentPane().add(txtCustomFFmpegPath);

txtCustomFFmpegPath.addKeyListener(new KeyListener() {

@Override
public void keyPressed(KeyEvent arg0) {
}

@Override
public void keyReleased(KeyEvent e) {

if (txtCustomFFmpegPath.getText().length() > 0 && e.getKeyCode() == KeyEvent.VK_ENTER)
{
if (btnCustomFFmpegPath.isSelected())
{
txtCustomFFmpegPath.setEnabled(true);

if (Settings.txtCustomFFmpegPath.getText().equals("") == false)
{
VideoPlayer.PathToFFMPEG = Settings.txtCustomFFmpegPath.getText();
}
}
else
{
txtCustomFFmpegPath.setEnabled(false);

VideoPlayer.PathToFFMPEG = Shutter.class.getProtectionDomain().getCodeSource().getLocation().getPath();

if (System.getProperty("os.name").contains("Windows"))
{
VideoPlayer.PathToFFMPEG = VideoPlayer.PathToFFMPEG.substring(1,VideoPlayer.PathToFFMPEG.length()-1);
VideoPlayer.PathToFFMPEG = VideoPlayer.PathToFFMPEG.substring(0,(int) (VideoPlayer.PathToFFMPEG.lastIndexOf("/"))).replace("%20", " ") + "\\Library\\ffmpeg.exe";
}
else
{
VideoPlayer.PathToFFMPEG = VideoPlayer.PathToFFMPEG.substring(0,VideoPlayer.PathToFFMPEG.length()-1);
VideoPlayer.PathToFFMPEG = VideoPlayer.PathToFFMPEG.substring(0,(int) (VideoPlayer.PathToFFMPEG.lastIndexOf("/"))).replace("%20", "\\ ") + "/Library/ffmpeg";
}
}

if (VideoPlayer.videoPath != null)
{
VideoPlayer.btnStop.doClick();
}
}

}

@Override
public void keyTyped(KeyEvent arg0) {
}

});

btnPreviewOutput.setFont(new Font(Shutter.freeSansFont, Font.PLAIN, 12));
btnPreviewOutput.setBounds(12, btnEndingAction.getLocation().y + btnEndingAction.getHeight() + 10, btnPreviewOutput.getPreferredSize().width, 16);
btnPreviewOutput.setBounds(12, btnCustomFFmpegPath.getLocation().y + btnCustomFFmpegPath.getHeight() + 10, btnPreviewOutput.getPreferredSize().width, 16);
frame.getContentPane().add(btnPreviewOutput);

btnPreviewOutput.addActionListener(new ActionListener() {
Expand Down Expand Up @@ -1656,6 +1770,12 @@ else if (eElement.getElementsByTagName("Name").item(0).getFirstChild().getTextCo
{
videoWebCaseMetadata = Boolean.valueOf(eElement.getElementsByTagName("Value").item(0).getFirstChild().getTextContent());
}

//customFFmpeg
if (btnCustomFFmpegPath.isSelected() && txtCustomFFmpegPath.getText().equals("") == false)
{
VideoPlayer.PathToFFMPEG = txtCustomFFmpegPath.getText();
}
}
}
}
Expand Down
93 changes: 72 additions & 21 deletions src/application/Shutter.java
Original file line number Diff line number Diff line change
Expand Up @@ -12140,89 +12140,80 @@ public void actionPerformed(ActionEvent arg0) {

JLabel watermarkTopLeft = new JLabel("\u2196");
watermarkTopLeft.setName("watermarkTopLeft");
watermarkTopLeft.setBackground(new Color(42,42,47));
watermarkTopLeft.setBackground(new Color(42,42,47,0));
watermarkTopLeft.setHorizontalAlignment(SwingConstants.CENTER);
watermarkTopLeft.setOpaque(true);
watermarkTopLeft.setFont(new Font(freeSansFont, Font.PLAIN, 12));
watermarkTopLeft.setSize(28, 16);
watermarkTopLeft.setLocation(grpWatermark.getWidth() / 2 - 270 / 2, caseAddWatermark.getY() + caseAddWatermark.getHeight() + 2);
grpWatermark.add(watermarkTopLeft);

JLabel watermarkLeft = new JLabel("\u2190");
watermarkLeft.setName("watermarkLeft");
watermarkLeft.setBackground(new Color(42,42,47));
watermarkLeft.setBackground(new Color(42,42,47,0));
watermarkLeft.setHorizontalAlignment(SwingConstants.CENTER);
watermarkLeft.setOpaque(true);
watermarkLeft.setFont(new Font(freeSansFont, Font.PLAIN, 12));
watermarkLeft.setSize(watermarkTopLeft.getSize());
watermarkLeft.setLocation(watermarkTopLeft.getX() + watermarkTopLeft.getWidth() + 2, watermarkTopLeft.getY());
watermarkLeft.setLocation(watermarkTopLeft.getX() + watermarkTopLeft.getWidth() + 2, watermarkTopLeft.getY() - 2);
grpWatermark.add(watermarkLeft);

JLabel watermarkBottomLeft = new JLabel("\u2199");
watermarkBottomLeft.setName("watermarkBottomLeft");
watermarkBottomLeft.setBackground(new Color(42,42,47));
watermarkBottomLeft.setBackground(new Color(42,42,47,0));
watermarkBottomLeft.setHorizontalAlignment(SwingConstants.CENTER);
watermarkBottomLeft.setOpaque(true);
watermarkBottomLeft.setFont(new Font(freeSansFont, Font.PLAIN, 12));
watermarkBottomLeft.setSize(watermarkTopLeft.getSize());
watermarkBottomLeft.setLocation(watermarkLeft.getX() + watermarkLeft.getWidth() + 2, watermarkTopLeft.getY());
grpWatermark.add(watermarkBottomLeft);

JLabel watermarkTop = new JLabel("\u2191");
watermarkTop.setName("watermarkTop");
watermarkTop.setBackground(new Color(42,42,47));
watermarkTop.setBackground(new Color(42,42,47,0));
watermarkTop.setHorizontalAlignment(SwingConstants.CENTER);
watermarkTop.setOpaque(true);
watermarkTop.setFont(new Font(freeSansFont, Font.PLAIN, 12));
watermarkTop.setSize(watermarkTopLeft.getSize());
watermarkTop.setLocation(watermarkBottomLeft.getX() + watermarkBottomLeft.getWidth() + 2, watermarkTopLeft.getY());
grpWatermark.add(watermarkTop);

JLabel watermarkCenter = new JLabel("\u2500");
watermarkCenter.setName("watermarkCenter");
watermarkCenter.setBackground(new Color(42,42,47));
watermarkCenter.setBackground(new Color(42,42,47,0));
watermarkCenter.setHorizontalAlignment(SwingConstants.CENTER);
watermarkCenter.setOpaque(true);
watermarkCenter.setFont(new Font(freeSansFont, Font.PLAIN, 12));
watermarkCenter.setSize(watermarkTopLeft.getSize());
watermarkCenter.setLocation(watermarkTop.getX() + watermarkTop.getWidth() + 2, watermarkTopLeft.getY());
watermarkCenter.setLocation(watermarkTop.getX() + watermarkTop.getWidth() + 2, watermarkTopLeft.getY() - 1);
grpWatermark.add(watermarkCenter);

JLabel watermarkBottom = new JLabel("\u2193");
watermarkBottom.setName("watermarkBottom");
watermarkBottom.setBackground(new Color(42,42,47));
watermarkBottom.setBackground(new Color(42,42,47,0));
watermarkBottom.setHorizontalAlignment(SwingConstants.CENTER);
watermarkBottom.setOpaque(true);
watermarkBottom.setFont(new Font(freeSansFont, Font.PLAIN, 12));
watermarkBottom.setSize(watermarkTopLeft.getSize());
watermarkBottom.setLocation(watermarkCenter.getX() + watermarkCenter.getWidth() + 2, watermarkTopLeft.getY());
grpWatermark.add(watermarkBottom);

JLabel watermarkTopRight = new JLabel("\u2197");
watermarkTopRight.setName("watermarkTopRight");
watermarkTopRight.setBackground(new Color(42,42,47));
watermarkTopRight.setBackground(new Color(42,42,47,0));
watermarkTopRight.setHorizontalAlignment(SwingConstants.CENTER);
watermarkTopRight.setOpaque(true);
watermarkTopRight.setFont(new Font(freeSansFont, Font.PLAIN, 12));
watermarkTopRight.setSize(watermarkTopLeft.getSize());
watermarkTopRight.setLocation(watermarkBottom.getX() + watermarkBottom.getWidth() + 2, watermarkTopLeft.getY());
grpWatermark.add(watermarkTopRight);

JLabel watermarkRight = new JLabel("\u2192");
watermarkRight.setName("watermarkRight");
watermarkRight.setBackground(new Color(42,42,47));
watermarkRight.setBackground(new Color(42,42,47,0));
watermarkRight.setHorizontalAlignment(SwingConstants.CENTER);
watermarkRight.setOpaque(true);
watermarkRight.setFont(new Font(freeSansFont, Font.PLAIN, 12));
watermarkRight.setSize(watermarkTopLeft.getSize());
watermarkRight.setLocation(watermarkTopRight.getX() + watermarkTopRight.getWidth() + 2, watermarkTopLeft.getY());
watermarkRight.setLocation(watermarkTopRight.getX() + watermarkTopRight.getWidth() + 2, watermarkTopLeft.getY() - 2);
grpWatermark.add(watermarkRight);

JLabel watermarkBottomRight = new JLabel("\u2198");
watermarkBottomRight.setName("watermarkBottomRight");
watermarkBottomRight.setBackground(new Color(42,42,47));
watermarkBottomRight.setBackground(new Color(42,42,47,0));
watermarkBottomRight.setHorizontalAlignment(SwingConstants.CENTER);
watermarkBottomRight.setOpaque(true);
watermarkBottomRight.setFont(new Font(freeSansFont, Font.PLAIN, 12));
watermarkBottomRight.setSize(watermarkTopLeft.getSize());
watermarkBottomRight.setLocation(watermarkRight.getX() + watermarkRight.getWidth() + 2, watermarkTopLeft.getY());
Expand Down Expand Up @@ -12265,6 +12256,23 @@ public void mouseReleased(MouseEvent arg0) {
watermarkRight.addMouseListener(watermarkPositions);
watermarkBottomRight.addMouseListener(watermarkPositions);

JPanel panelForButtons = new JPanel() {

@Override
public void paintComponent(Graphics g) {

Graphics2D g2d = (Graphics2D) g;

g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

g2d.setColor(new Color(42,42,47));
g2d.fillRoundRect(0, 0, (watermarkBottomRight.getX() + watermarkBottomRight.getWidth()) - watermarkTopLeft.getX() + 4, 18, 15, 15);
}

};
panelForButtons.setBounds(watermarkTopLeft.getX() - 2, watermarkTopLeft.getY() - 2, (watermarkBottomRight.getX() + watermarkBottomRight.getWidth()) - watermarkTopLeft.getX() + 4, 18);
grpWatermark.add(panelForButtons);

JLabel watermarkPosX = new JLabel(Shutter.language.getProperty("posX"));
watermarkPosX.setHorizontalAlignment(SwingConstants.RIGHT);
watermarkPosX.setEnabled(false);
Expand Down Expand Up @@ -19504,6 +19512,7 @@ private static void setGPUOptions() {
if ("Apple ProRes".equals(function) && System.getProperty("os.name").contains("Mac") && arch.equals("arm64")
|| "H.264".equals(function) || "H.265".equals(function) || "H.266".equals(function) || "AV1".equals(function)
|| System.getProperty("os.name").contains("Windows") && "VP9".equals(function)
|| System.getProperty("os.name").contains("Windows") && "FFV1".equals(function)
|| System.getProperty("os.name").contains("Windows") && language.getProperty("functionPicture").equals(function) && comboFilter.getSelectedItem().toString().equals(".avif"))
{
lblHWaccel.setVisible(true);
Expand Down Expand Up @@ -20112,6 +20121,48 @@ else if (language.getProperty("functionInsert").equals(function))
comboFilter.setModel(model);
}

//HWaccel
if (action && System.getProperty("os.name").contains("Windows") && "FFV1".equals(function))
{
Thread hwaccel = new Thread(new Runnable() {

@Override
public void run() {

comboAccel.setEnabled(false);

try {

FFMPEG.hwaccel("-f lavfi -i nullsrc -t 1 -c:v ffv1_vulkan -s 640x360 -f null -" + '"');
do {
Thread.sleep(10);
} while (FFMPEG.runProcess.isAlive());

if (FFMPEG.error == false)
graphicsAccel.add("Vulkan Video");

if (comboAccel.getModel().getSize() != graphicsAccel.size())
{
comboAccel.setModel(new DefaultComboBoxModel(graphicsAccel.toArray()));
}

//load hwaccel value after checking gpu capabilities
if (Utils.loadEncFile != null && Utils.hwaccel != "")
{
comboAccel.setSelectedItem(Utils.hwaccel);
}

} catch (Exception e) {}

if (comboAccel.getItemCount() > 1)
comboAccel.setEnabled(true);
}

});
hwaccel.start();

}

//grpSetAudio
grpSetAudio.removeAll();
grpSetAudio.add(caseNormalizeAudio);
Expand Down
10 changes: 6 additions & 4 deletions src/application/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -1997,10 +1997,10 @@ public static void loadThemes() {
UIManager.put("ScrollBar.thumbArc", 999);
UIManager.put("Button.arc", 15);
UIManager.put("CheckBox.arc", 15);
UIManager.put("TextField.arc", 10);
UIManager.put("ProgressBar.arc", 10);
UIManager.put("TextComponent.arc", 10);
UIManager.put("Component.arc", 10);
UIManager.put("TextField.arc", 15);
UIManager.put("ProgressBar.arc", 15);
UIManager.put("TextComponent.arc", 15);
UIManager.put("Component.arc", 15);
UIManager.put("PopupMenu.arc", 15);
UIManager.put("ScrollPane.arc", 5);

Expand Down Expand Up @@ -2082,7 +2082,9 @@ public static void loadThemes() {
UIManager.put("MenuBar.foreground", new Color(235,235,240));

UIManager.put("PopupMenu.border", BorderFactory.createLineBorder(new Color(30,30,35)));
UIManager.put("PopupMenu.borderColor", new Color(30,30,35));
UIManager.put("PopupMenu.background", new Color(42,42,47));
UIManager.put("PopupMenu.borderCornerRadius", 15);

UIManager.put("Panel.selectionForeground", Color.WHITE);
UIManager.put("TextPane.selectionForeground", Color.WHITE);
Expand Down
Loading

0 comments on commit 9f81f6c

Please sign in to comment.