Skip to content
This repository has been archived by the owner on Jul 31, 2023. It is now read-only.

Commit

Permalink
Add missing "add folder" button to the GUI
Browse files Browse the repository at this point in the history
Drag & drop already had that feature but I forgot to add it to the GUI.
Also added tooltips to the buttons because why not.
  • Loading branch information
BrunoReX committed Mar 9, 2018
1 parent 3196342 commit 749f0a7
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 2 deletions.
2 changes: 1 addition & 1 deletion readme.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
JMkvpropedit v1.4.2
JMkvpropedit v1.4.3

A batch GUI for mkvpropedit (part of MKVToolNix) written in Java.
It should work on Windows, Linux and other *nixes (not tested).
Expand Down
41 changes: 40 additions & 1 deletion src/io/github/brunorex/JMkvpropedit.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

public class JMkvpropedit {

private static final String VERSION_NUMBER = "1.4.2";
private static final String VERSION_NUMBER = "1.4.3";
private static final int MAX_STREAMS = 100;
private static String[] argsArray;

Expand Down Expand Up @@ -175,6 +175,7 @@ public boolean isCellEditable(int row, int column) {
private DefaultListModel<String> modelFiles;
private JList<String> listFiles;
private JButton btnAddFiles;
private JButton btnAddFolder;
private JButton btnRemoveFiles;
private JButton btnTopFiles;
private JButton btnUpFiles;
Expand Down Expand Up @@ -446,18 +447,33 @@ private void initialize() {
btnAddFiles.setContentAreaFilled(false);
btnAddFiles.setFocusPainted(false);
btnAddFiles.setOpaque(false);
btnAddFiles.setToolTipText("Add files");
pnlListToolbar.add(btnAddFiles);

Component verticalStrut1 = Box.createVerticalStrut(10);
pnlListToolbar.add(verticalStrut1);

btnAddFolder = new JButton("");
btnAddFolder.setIcon(new ImageIcon(JMkvpropedit.class.getResource("/res/list-add-folder.png")));
btnAddFolder.setMargin(new Insets(0, 0, 0, 0));
btnAddFolder.setBorderPainted(false);
btnAddFolder.setContentAreaFilled(false);
btnAddFolder.setFocusPainted(false);
btnAddFolder.setOpaque(false);
btnAddFolder.setToolTipText("Add folder");
pnlListToolbar.add(btnAddFolder);

Component verticalStrut1b = Box.createVerticalStrut(10);
pnlListToolbar.add(verticalStrut1b);

btnRemoveFiles = new JButton("");
btnRemoveFiles.setIcon(new ImageIcon(JMkvpropedit.class.getResource("/res/list-remove.png")));
btnRemoveFiles.setMargin(new Insets(0, 0, 0, 0));
btnRemoveFiles.setBorderPainted(false);
btnRemoveFiles.setContentAreaFilled(false);
btnRemoveFiles.setFocusPainted(false);
btnRemoveFiles.setOpaque(false);
btnRemoveFiles.setToolTipText("Remove selected files");
pnlListToolbar.add(btnRemoveFiles);

Component verticalStrut2 = Box.createVerticalStrut(10);
Expand All @@ -470,6 +486,7 @@ private void initialize() {
btnTopFiles.setContentAreaFilled(false);
btnTopFiles.setFocusPainted(false);
btnTopFiles.setOpaque(false);
btnTopFiles.setToolTipText("Move selected files to the top");
pnlListToolbar.add(btnTopFiles);

Component verticalStrut3 = Box.createVerticalStrut(10);
Expand All @@ -482,6 +499,7 @@ private void initialize() {
btnUpFiles.setContentAreaFilled(false);
btnUpFiles.setFocusPainted(false);
btnUpFiles.setOpaque(false);
btnUpFiles.setToolTipText("Move selected files up");
pnlListToolbar.add(btnUpFiles);

Component verticalStrut4 = Box.createVerticalStrut(10);
Expand All @@ -494,6 +512,7 @@ private void initialize() {
btnDownFiles.setContentAreaFilled(false);
btnDownFiles.setFocusPainted(false);
btnDownFiles.setOpaque(false);
btnDownFiles.setToolTipText("Move selected files down");
pnlListToolbar.add(btnDownFiles);

Component verticalStrut5 = Box.createVerticalStrut(10);
Expand All @@ -506,6 +525,7 @@ private void initialize() {
btnBottomFiles.setContentAreaFilled(false);
btnBottomFiles.setFocusPainted(false);
btnBottomFiles.setOpaque(false);
btnBottomFiles.setToolTipText("Move selected files to the bottom");
pnlListToolbar.add(btnBottomFiles);

Component verticalStrut6 = Box.createVerticalStrut(10);
Expand All @@ -518,6 +538,7 @@ private void initialize() {
btnClearFiles.setContentAreaFilled(false);
btnClearFiles.setFocusPainted(false);
btnClearFiles.setOpaque(false);
btnClearFiles.setToolTipText("Clear file list");
pnlListToolbar.add(btnClearFiles);

JPanel pnlGeneral = new JPanel();
Expand Down Expand Up @@ -1623,6 +1644,24 @@ public void actionPerformed(ActionEvent e) {
}
});

btnAddFolder.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
File folder = null;

chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
chooser.setDialogTitle("Select folder with Matroska files to edit");
chooser.setAcceptAllFileFilterUsed(false);

int open = chooser.showOpenDialog(frmJMkvpropedit);

if (open == JFileChooser.APPROVE_OPTION) {
folder = chooser.getSelectedFile();
addMkvFilesFromFolder(folder);
}

}
});

btnRemoveFiles.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (modelFiles.getSize() > 0) {
Expand Down
Binary file added src/res/list-add-folder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 749f0a7

Please sign in to comment.