mirror of
https://github.com/mitb-archive/filebot
synced 2024-12-22 15:58:52 -05:00
* highlight verification cells (green foreground)
* increase max-heap-size in jnlp descriptor
This commit is contained in:
parent
e58947e6a4
commit
3d9839a73f
@ -29,7 +29,7 @@
|
||||
<resources>
|
||||
<property name="jnlp.packEnabled" value="true" />
|
||||
|
||||
<java version="1.6+" />
|
||||
<java version="1.6+" max-heap-size="256m" />
|
||||
<jar href="filebot.jar" main="true" />
|
||||
<extension name="lib" href="filebot.lib.jnlp" />
|
||||
</resources>
|
||||
|
@ -36,7 +36,7 @@
|
||||
<resources>
|
||||
<property name="jnlp.packEnabled" value="true" />
|
||||
|
||||
<java version="1.6+" />
|
||||
<java version="1.6+" max-heap-size="256m" />
|
||||
<jar href="filebot.jar" main="true" />
|
||||
<extension name="lib" href="filebot.lib.jnlp" />
|
||||
</resources>
|
||||
|
@ -21,6 +21,8 @@ public class ChecksumCellRenderer extends DefaultTableCellRenderer {
|
||||
|
||||
private final SwingWorkerCellRenderer progressRenderer = new SwingWorkerCellRenderer();
|
||||
|
||||
private final Color verificationForeground = new Color(0x009900);
|
||||
|
||||
|
||||
@Override
|
||||
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
|
||||
@ -41,7 +43,7 @@ public class ChecksumCellRenderer extends DefaultTableCellRenderer {
|
||||
|
||||
// if row state is ERROR and if we are not selected use text color RED,
|
||||
// else use default table colors
|
||||
setForeground(isSelected ? table.getSelectionForeground() : isError ? Color.RED : table.getForeground());
|
||||
setForeground(isSelected ? table.getSelectionForeground() : isError ? Color.RED : isVerificationColumn(table, column) ? verificationForeground : table.getForeground());
|
||||
setBackground(isSelected ? table.getSelectionBackground() : table.getBackground());
|
||||
|
||||
// use BOLD font on ERROR
|
||||
@ -59,4 +61,13 @@ public class ChecksumCellRenderer extends DefaultTableCellRenderer {
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
private boolean isVerificationColumn(JTable table, int column) {
|
||||
ChecksumTableModel model = (ChecksumTableModel) table.getModel();
|
||||
int modelColumn = table.getColumnModel().getColumn(column).getModelIndex();
|
||||
|
||||
return model.isVerificationColumn(modelColumn);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -5,11 +5,12 @@ package net.sourceforge.filebot.ui.panel.sfv;
|
||||
import static net.sourceforge.filebot.hash.VerificationUtilities.*;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.event.MouseEvent;
|
||||
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.ListSelectionModel;
|
||||
import javax.swing.table.JTableHeader;
|
||||
import javax.swing.table.TableColumn;
|
||||
import javax.swing.table.TableModel;
|
||||
|
||||
import net.sourceforge.tuned.ui.TunedUtilities.DragDropRowTableUI;
|
||||
|
||||
@ -40,11 +41,32 @@ class ChecksumTable extends JTable {
|
||||
|
||||
|
||||
@Override
|
||||
protected TableModel createDefaultDataModel() {
|
||||
protected ChecksumTableModel createDefaultDataModel() {
|
||||
return new ChecksumTableModel();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected JTableHeader createDefaultTableHeader() {
|
||||
return new JTableHeader(columnModel) {
|
||||
|
||||
@Override
|
||||
public String getToolTipText(MouseEvent evt) {
|
||||
try {
|
||||
int columnIndex = columnModel.getColumnIndexAtX(evt.getX());
|
||||
int modelIndex = columnModel.getColumn(columnIndex).getModelIndex();
|
||||
|
||||
// display column root of checksum column
|
||||
return getModel().getColumnRoot(modelIndex).getPath();
|
||||
} catch (Exception e) {
|
||||
// ignore, column is not a checksum column
|
||||
return null;
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ChecksumTableModel getModel() {
|
||||
return (ChecksumTableModel) super.getModel();
|
||||
|
@ -44,7 +44,7 @@ class ChecksumTableExportHandler extends TextFileExportHandler {
|
||||
|
||||
protected File defaultColumn() {
|
||||
// select first column that is not a verification file column
|
||||
for (File root : model.checksumColumns()) {
|
||||
for (File root : model.getChecksumColumns()) {
|
||||
if (root.isDirectory())
|
||||
return root;
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ import java.util.Set;
|
||||
import javax.swing.table.AbstractTableModel;
|
||||
|
||||
import net.sourceforge.filebot.hash.HashType;
|
||||
import net.sourceforge.tuned.FastFile;
|
||||
import net.sourceforge.tuned.FileUtilities;
|
||||
|
||||
|
||||
@ -37,7 +38,7 @@ class ChecksumTableModel extends AbstractTableModel {
|
||||
public static final String HASH_TYPE_PROPERTY = "hashType";
|
||||
private HashType hashType = HashType.SFV;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String getColumnName(int columnIndex) {
|
||||
switch (columnIndex) {
|
||||
@ -76,13 +77,18 @@ class ChecksumTableModel extends AbstractTableModel {
|
||||
}
|
||||
|
||||
|
||||
protected File getColumnRoot(int columnIndex) {
|
||||
public File getColumnRoot(int columnIndex) {
|
||||
// substract checksum column offset
|
||||
return checksumColumns.get(columnIndex - 2);
|
||||
}
|
||||
|
||||
|
||||
public List<File> checksumColumns() {
|
||||
public boolean isVerificationColumn(int columnIndex) {
|
||||
return columnIndex >= 2 && getColumnRoot(columnIndex).isFile();
|
||||
}
|
||||
|
||||
|
||||
public List<File> getChecksumColumns() {
|
||||
return Collections.unmodifiableList(checksumColumns);
|
||||
}
|
||||
|
||||
@ -195,7 +201,7 @@ class ChecksumTableModel extends AbstractTableModel {
|
||||
cell.addPropertyChangeListener(progressListener);
|
||||
|
||||
if (!checksumColumns.contains(cell.getRoot())) {
|
||||
checksumColumns.add(cell.getRoot());
|
||||
checksumColumns.add(new FastFile(cell.getRoot().getPath()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -242,6 +248,7 @@ class ChecksumTableModel extends AbstractTableModel {
|
||||
fireTableStructureChanged();
|
||||
}
|
||||
|
||||
|
||||
private final PropertyChangeListener stateListener = new PropertyChangeListener() {
|
||||
|
||||
@Override
|
||||
@ -269,13 +276,13 @@ class ChecksumTableModel extends AbstractTableModel {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
protected static abstract class IndexedMap<K, V> extends AbstractList<V> implements Set<V> {
|
||||
|
||||
private final Map<K, Integer> indexMap = new HashMap<K, Integer>(64);
|
||||
private final List<V> list = new ArrayList<V>(64);
|
||||
|
||||
|
||||
|
||||
public abstract K key(V value);
|
||||
|
||||
|
||||
@ -344,9 +351,10 @@ class ChecksumTableModel extends AbstractTableModel {
|
||||
|
||||
}
|
||||
|
||||
|
||||
private final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
|
||||
|
||||
|
||||
|
||||
public void addPropertyChangeListener(PropertyChangeListener listener) {
|
||||
pcs.addPropertyChangeListener(listener);
|
||||
}
|
||||
|
@ -257,7 +257,7 @@ public class SfvPanel extends JComponent {
|
||||
List<File> options = new ArrayList<File>();
|
||||
|
||||
// filter out verification file columns
|
||||
for (File file : table.getModel().checksumColumns()) {
|
||||
for (File file : table.getModel().getChecksumColumns()) {
|
||||
if (file.isDirectory())
|
||||
options.add(file);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user