mirror of
https://github.com/mitb-archive/filebot
synced 2025-03-09 22:09:47 -04:00
Fix various Dark Mode issues
This commit is contained in:
parent
8aa798318a
commit
9dd8044097
@ -1,6 +1,7 @@
|
|||||||
|
|
||||||
package net.filebot.ui;
|
package net.filebot.ui;
|
||||||
|
|
||||||
|
import static net.filebot.ui.ThemeSupport.*;
|
||||||
|
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
|
|
||||||
@ -16,17 +17,15 @@ import net.filebot.util.ui.ProgressIndicator;
|
|||||||
import net.filebot.util.ui.SwingUI;
|
import net.filebot.util.ui.SwingUI;
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
|
|
||||||
|
|
||||||
public class FileBotTabComponent extends JComponent {
|
public class FileBotTabComponent extends JComponent {
|
||||||
|
|
||||||
private ProgressIndicator progressIndicator = new ProgressIndicator();
|
private ProgressIndicator progressIndicator = getProgressIndicator();
|
||||||
private JLabel textLabel = new JLabel();
|
private JLabel textLabel = new JLabel();
|
||||||
private JLabel iconLabel = new JLabel();
|
private JLabel iconLabel = new JLabel();
|
||||||
private AbstractButton closeButton = createCloseButton();
|
private AbstractButton closeButton = createCloseButton();
|
||||||
|
|
||||||
private boolean loading = false;
|
private boolean loading = false;
|
||||||
|
|
||||||
|
|
||||||
public FileBotTabComponent() {
|
public FileBotTabComponent() {
|
||||||
iconLabel.setHorizontalAlignment(SwingConstants.CENTER);
|
iconLabel.setHorizontalAlignment(SwingConstants.CENTER);
|
||||||
textLabel.setHorizontalAlignment(SwingConstants.LEFT);
|
textLabel.setHorizontalAlignment(SwingConstants.LEFT);
|
||||||
@ -42,45 +41,37 @@ public class FileBotTabComponent extends JComponent {
|
|||||||
add(closeButton, "gap unrel:push, hidemode 3, align center 45%");
|
add(closeButton, "gap unrel:push, hidemode 3, align center 45%");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setLoading(boolean loading) {
|
public void setLoading(boolean loading) {
|
||||||
this.loading = loading;
|
this.loading = loading;
|
||||||
progressIndicator.setVisible(loading);
|
progressIndicator.setVisible(loading);
|
||||||
iconLabel.setVisible(!loading);
|
iconLabel.setVisible(!loading);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public boolean isLoading() {
|
public boolean isLoading() {
|
||||||
return loading;
|
return loading;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setIcon(Icon icon) {
|
public void setIcon(Icon icon) {
|
||||||
iconLabel.setIcon(icon);
|
iconLabel.setIcon(icon);
|
||||||
progressIndicator.setPreferredSize(icon != null ? SwingUI.getDimension(icon) : progressIndicator.getMinimumSize());
|
progressIndicator.setPreferredSize(icon != null ? SwingUI.getDimension(icon) : progressIndicator.getMinimumSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public Icon getIcon() {
|
public Icon getIcon() {
|
||||||
return iconLabel.getIcon();
|
return iconLabel.getIcon();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setText(String text) {
|
public void setText(String text) {
|
||||||
textLabel.setText(text);
|
textLabel.setText(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getText() {
|
public String getText() {
|
||||||
return textLabel.getText();
|
return textLabel.getText();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public AbstractButton getCloseButton() {
|
public AbstractButton getCloseButton() {
|
||||||
return closeButton;
|
return closeButton;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected AbstractButton createCloseButton() {
|
protected AbstractButton createCloseButton() {
|
||||||
Icon icon = ResourceManager.getIcon("tab.close");
|
Icon icon = ResourceManager.getIcon("tab.close");
|
||||||
Icon rolloverIcon = ResourceManager.getIcon("tab.close.hover");
|
Icon rolloverIcon = ResourceManager.getIcon("tab.close.hover");
|
||||||
|
@ -11,7 +11,6 @@ import static net.filebot.Settings.*;
|
|||||||
import static net.filebot.ui.ThemeSupport.*;
|
import static net.filebot.ui.ThemeSupport.*;
|
||||||
import static net.filebot.util.ui.SwingUI.*;
|
import static net.filebot.util.ui.SwingUI.*;
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.awt.Desktop;
|
import java.awt.Desktop;
|
||||||
import java.awt.Dialog.ModalExclusionType;
|
import java.awt.Dialog.ModalExclusionType;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
@ -253,7 +252,7 @@ public class MainFrame extends JFrame {
|
|||||||
private static class PanelCellRenderer extends DefaultFancyListCellRenderer {
|
private static class PanelCellRenderer extends DefaultFancyListCellRenderer {
|
||||||
|
|
||||||
public PanelCellRenderer() {
|
public PanelCellRenderer() {
|
||||||
super(10, 0, new Color(0x163264));
|
super(10, 0, getPanelSelectionBorderColor());
|
||||||
|
|
||||||
// center labels in list
|
// center labels in list
|
||||||
setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0));
|
setLayout(new FlowLayout(FlowLayout.CENTER, 0, 0));
|
||||||
|
@ -5,6 +5,7 @@ import static javax.swing.BorderFactory.*;
|
|||||||
import static net.filebot.Logging.*;
|
import static net.filebot.Logging.*;
|
||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
|
import java.awt.Insets;
|
||||||
import java.awt.LinearGradientPaint;
|
import java.awt.LinearGradientPaint;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
@ -18,6 +19,8 @@ import com.bulenkov.iconloader.util.ColorUtil;
|
|||||||
|
|
||||||
import net.filebot.util.SystemProperty;
|
import net.filebot.util.SystemProperty;
|
||||||
import net.filebot.util.ui.GradientStyle;
|
import net.filebot.util.ui.GradientStyle;
|
||||||
|
import net.filebot.util.ui.ProgressIndicator;
|
||||||
|
import net.filebot.util.ui.RoundBorder;
|
||||||
import net.filebot.util.ui.SelectionPainter;
|
import net.filebot.util.ui.SelectionPainter;
|
||||||
import net.filebot.util.ui.notification.SeparatorBorder;
|
import net.filebot.util.ui.notification.SeparatorBorder;
|
||||||
import net.filebot.util.ui.notification.SeparatorBorder.Position;
|
import net.filebot.util.ui.notification.SeparatorBorder.Position;
|
||||||
@ -67,6 +70,22 @@ public class ThemeSupport {
|
|||||||
return theme.getLinkSelectionForeground();
|
return theme.getLinkSelectionForeground();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Color getActiveColor() {
|
||||||
|
return new Color(0x6495ED);// CornflowerBlue
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Color getPassiveColor() {
|
||||||
|
return Color.gray;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Color getVerificationColor() {
|
||||||
|
return new Color(0x009900);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Color getPanelSelectionBorderColor() {
|
||||||
|
return new Color(0x163264);
|
||||||
|
}
|
||||||
|
|
||||||
public static LinearGradientPaint getPanelBackgroundGradient(int x, int y, int w, int h) {
|
public static LinearGradientPaint getPanelBackgroundGradient(int x, int y, int w, int h) {
|
||||||
float[] gradientFractions = { 0.0f, 0.5f, 1.0f };
|
float[] gradientFractions = { 0.0f, 0.5f, 1.0f };
|
||||||
Color[] gradientColors = { getColor(0xF6F6F6), getColor(0xF8F8F8), getColor(0xF3F3F3) };
|
Color[] gradientColors = { getColor(0xF6F6F6), getColor(0xF8F8F8), getColor(0xF3F3F3) };
|
||||||
@ -74,10 +93,26 @@ public class ThemeSupport {
|
|||||||
return new LinearGradientPaint(x, y, w, h, gradientFractions, gradientColors);
|
return new LinearGradientPaint(x, y, w, h, gradientFractions, gradientColors);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SeparatorBorder getSeparatorBorder(Position position) {
|
public static Border getRoundBorder() {
|
||||||
|
return new RoundBorder(getColor(0xACACAC), 12, new Insets(1, 1, 1, 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Border getSeparatorBorder(Position position) {
|
||||||
return new SeparatorBorder(1, getColor(0xB4B4B4), getColor(0xACACAC), GradientStyle.LEFT_TO_RIGHT, position);
|
return new SeparatorBorder(1, getColor(0xB4B4B4), getColor(0xACACAC), GradientStyle.LEFT_TO_RIGHT, position);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Border getHorizontalRule() {
|
||||||
|
return new SeparatorBorder(2, new Color(0, 0, 0, 90), GradientStyle.TOP_TO_BOTTOM, SeparatorBorder.Position.BOTTOM);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ProgressIndicator getProgressIndicator() {
|
||||||
|
return new ProgressIndicator(Color.orange, withAlpha(getColor(0x000000), 0.25f));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Color withAlpha(Color color, float alpha) {
|
||||||
|
return new Color(((int) ((alpha * 255)) << 24) | (color.getRGB() & 0x00FFFFFF), true);
|
||||||
|
}
|
||||||
|
|
||||||
public enum Theme {
|
public enum Theme {
|
||||||
|
|
||||||
System {
|
System {
|
||||||
@ -154,8 +189,8 @@ public class ThemeSupport {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public Color getColor(int rgba) {
|
public Color getColor(int rgb) {
|
||||||
return new Color(rgba);
|
return new Color(rgb);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isDark() {
|
public boolean isDark() {
|
||||||
|
@ -6,7 +6,6 @@ import static net.filebot.ui.ThemeSupport.*;
|
|||||||
import static net.filebot.util.FileUtilities.*;
|
import static net.filebot.util.FileUtilities.*;
|
||||||
import static net.filebot.util.ui.SwingUI.*;
|
import static net.filebot.util.ui.SwingUI.*;
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileFilter;
|
import java.io.FileFilter;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -34,11 +33,9 @@ import net.filebot.archive.Archive;
|
|||||||
import net.filebot.archive.FileMapper;
|
import net.filebot.archive.FileMapper;
|
||||||
import net.filebot.cli.ConflictAction;
|
import net.filebot.cli.ConflictAction;
|
||||||
import net.filebot.util.FileUtilities;
|
import net.filebot.util.FileUtilities;
|
||||||
import net.filebot.util.ui.GradientStyle;
|
|
||||||
import net.filebot.util.ui.LoadingOverlayPane;
|
import net.filebot.util.ui.LoadingOverlayPane;
|
||||||
import net.filebot.util.ui.ProgressMonitor;
|
import net.filebot.util.ui.ProgressMonitor;
|
||||||
import net.filebot.util.ui.ProgressMonitor.ProgressWorker;
|
import net.filebot.util.ui.ProgressMonitor.ProgressWorker;
|
||||||
import net.filebot.util.ui.notification.SeparatorBorder;
|
|
||||||
import net.filebot.vfs.FileInfo;
|
import net.filebot.vfs.FileInfo;
|
||||||
import net.filebot.vfs.SimpleFileInfo;
|
import net.filebot.vfs.SimpleFileInfo;
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
@ -62,7 +59,7 @@ class ExtractTool extends Tool<TableModel> {
|
|||||||
table.setRowHeight(25);
|
table.setRowHeight(25);
|
||||||
|
|
||||||
JScrollPane tableScrollPane = new JScrollPane(table);
|
JScrollPane tableScrollPane = new JScrollPane(table);
|
||||||
tableScrollPane.setBorder(new SeparatorBorder(2, new Color(0, 0, 0, 90), GradientStyle.TOP_TO_BOTTOM, SeparatorBorder.Position.BOTTOM));
|
tableScrollPane.setBorder(getHorizontalRule());
|
||||||
|
|
||||||
setLayout(new MigLayout("insets 0, nogrid, fill", "align center", "[fill][pref!]"));
|
setLayout(new MigLayout("insets 0, nogrid, fill", "align center", "[fill][pref!]"));
|
||||||
add(new LoadingOverlayPane(tableScrollPane, this, "25px", "30px"), "grow, wrap");
|
add(new LoadingOverlayPane(tableScrollPane, this, "25px", "30px"), "grow, wrap");
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
package net.filebot.ui.filter;
|
package net.filebot.ui.filter;
|
||||||
|
|
||||||
import static java.util.Collections.*;
|
import static java.util.Collections.*;
|
||||||
|
import static net.filebot.ui.ThemeSupport.*;
|
||||||
import static net.filebot.util.FileUtilities.*;
|
import static net.filebot.util.FileUtilities.*;
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -19,9 +19,7 @@ import javax.swing.tree.TreeNode;
|
|||||||
|
|
||||||
import net.filebot.ui.filter.FileTree.FolderNode;
|
import net.filebot.ui.filter.FileTree.FolderNode;
|
||||||
import net.filebot.ui.transfer.DefaultTransferHandler;
|
import net.filebot.ui.transfer.DefaultTransferHandler;
|
||||||
import net.filebot.util.ui.GradientStyle;
|
|
||||||
import net.filebot.util.ui.LoadingOverlayPane;
|
import net.filebot.util.ui.LoadingOverlayPane;
|
||||||
import net.filebot.util.ui.notification.SeparatorBorder;
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
|
|
||||||
class SplitTool extends Tool<TreeModel> {
|
class SplitTool extends Tool<TreeModel> {
|
||||||
@ -34,7 +32,7 @@ class SplitTool extends Tool<TreeModel> {
|
|||||||
super("Parts");
|
super("Parts");
|
||||||
|
|
||||||
JScrollPane treeScrollPane = new JScrollPane(tree);
|
JScrollPane treeScrollPane = new JScrollPane(tree);
|
||||||
treeScrollPane.setBorder(new SeparatorBorder(2, new Color(0, 0, 0, 90), GradientStyle.TOP_TO_BOTTOM, SeparatorBorder.Position.BOTTOM));
|
treeScrollPane.setBorder(getHorizontalRule());
|
||||||
|
|
||||||
JSpinner spinner = new JSpinner(spinnerModel);
|
JSpinner spinner = new JSpinner(spinnerModel);
|
||||||
spinner.setEditor(new JSpinner.NumberEditor(spinner, "#"));
|
spinner.setEditor(new JSpinner.NumberEditor(spinner, "#"));
|
||||||
|
@ -10,7 +10,6 @@ import static net.filebot.util.JsonUtilities.*;
|
|||||||
import static net.filebot.util.RegularExpressions.*;
|
import static net.filebot.util.RegularExpressions.*;
|
||||||
import static net.filebot.util.ui.SwingUI.*;
|
import static net.filebot.util.ui.SwingUI.*;
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
import java.awt.Window;
|
import java.awt.Window;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
@ -145,7 +144,7 @@ class BindingDialog extends JDialog {
|
|||||||
|
|
||||||
// highlight cell
|
// highlight cell
|
||||||
if (!isSelected) {
|
if (!isSelected) {
|
||||||
setForeground(new Color(0x6495ED)); // CornflowerBlue
|
setForeground(getActiveColor());
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// could not evaluate expression
|
// could not evaluate expression
|
||||||
@ -153,7 +152,7 @@ class BindingDialog extends JDialog {
|
|||||||
|
|
||||||
// highlight cell
|
// highlight cell
|
||||||
if (!isSelected) {
|
if (!isSelected) {
|
||||||
setForeground(Color.gray);
|
setForeground(getPassiveColor());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ public class FormatDialog extends JDialog {
|
|||||||
private JLabel status = new JLabel();
|
private JLabel status = new JLabel();
|
||||||
|
|
||||||
private FormatExpressionTextArea editor = new FormatExpressionTextArea();
|
private FormatExpressionTextArea editor = new FormatExpressionTextArea();
|
||||||
private ProgressIndicator progressIndicator = new ProgressIndicator();
|
private ProgressIndicator progressIndicator = getProgressIndicator();
|
||||||
|
|
||||||
private JLabel title = new JLabel();
|
private JLabel title = new JLabel();
|
||||||
private JPanel help = new JPanel(new MigLayout("insets 0, nogrid, novisualpadding, fillx"));
|
private JPanel help = new JPanel(new MigLayout("insets 0, nogrid, novisualpadding, fillx"));
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package net.filebot.ui.rename;
|
package net.filebot.ui.rename;
|
||||||
|
|
||||||
|
import static net.filebot.ui.ThemeSupport.*;
|
||||||
import static net.filebot.util.FileUtilities.*;
|
import static net.filebot.util.FileUtilities.*;
|
||||||
import static net.filebot.util.ui.SwingUI.*;
|
|
||||||
|
|
||||||
import java.awt.AlphaComposite;
|
import java.awt.AlphaComposite;
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
@ -137,7 +137,7 @@ class RenameListCellRenderer extends DefaultFancyListCellRenderer {
|
|||||||
|
|
||||||
if (renameModel.hasComplement(index)) {
|
if (renameModel.hasComplement(index)) {
|
||||||
setOpaque(true); // enable paint background
|
setOpaque(true); // enable paint background
|
||||||
setBackground(derive(warningGradientBeginColor, (1 - matchProbablity) * 0.5f)); // alpha indicates match probability
|
setBackground(withAlpha(warningGradientBeginColor, (1 - matchProbablity) * 0.5f)); // alpha indicates match probability
|
||||||
|
|
||||||
if (matchProbablity < 1) {
|
if (matchProbablity < 1) {
|
||||||
if (isSelected) {
|
if (isSelected) {
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
package net.filebot.ui.sfv;
|
package net.filebot.ui.sfv;
|
||||||
|
|
||||||
|
|
||||||
import static java.awt.Font.*;
|
import static java.awt.Font.*;
|
||||||
import static net.filebot.util.ui.SwingUI.*;
|
import static net.filebot.ui.ThemeSupport.*;
|
||||||
|
import static net.filebot.util.ExceptionUtilities.*;
|
||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
@ -14,15 +14,11 @@ import javax.swing.SwingWorker;
|
|||||||
import javax.swing.SwingWorker.StateValue;
|
import javax.swing.SwingWorker.StateValue;
|
||||||
import javax.swing.table.DefaultTableCellRenderer;
|
import javax.swing.table.DefaultTableCellRenderer;
|
||||||
|
|
||||||
import net.filebot.util.ExceptionUtilities;
|
|
||||||
|
|
||||||
|
|
||||||
public class ChecksumCellRenderer extends DefaultTableCellRenderer {
|
public class ChecksumCellRenderer extends DefaultTableCellRenderer {
|
||||||
|
|
||||||
private final SwingWorkerCellRenderer progressRenderer = new SwingWorkerCellRenderer();
|
private final SwingWorkerCellRenderer progressRenderer = new SwingWorkerCellRenderer();
|
||||||
|
|
||||||
private final Color verificationForeground = new Color(0x009900);
|
private final Color verificationForeground = getVerificationColor();
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
|
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
|
||||||
@ -52,17 +48,16 @@ public class ChecksumCellRenderer extends DefaultTableCellRenderer {
|
|||||||
if (pendingWorker) {
|
if (pendingWorker) {
|
||||||
setText("Pending...");
|
setText("Pending...");
|
||||||
} else if (value == null && !isSelected) {
|
} else if (value == null && !isSelected) {
|
||||||
setBackground(derive(table.getGridColor(), 0.1f));
|
setBackground(withAlpha(table.getGridColor(), 0.1f));
|
||||||
} else if (value instanceof FileNotFoundException) {
|
} else if (value instanceof FileNotFoundException) {
|
||||||
setText("File not found");
|
setText("File not found");
|
||||||
} else if (value instanceof Throwable) {
|
} else if (value instanceof Throwable) {
|
||||||
setText(ExceptionUtilities.getRootCauseMessage((Throwable) value));
|
setText(getRootCauseMessage((Throwable) value));
|
||||||
}
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private boolean isVerificationColumn(JTable table, int column) {
|
private boolean isVerificationColumn(JTable table, int column) {
|
||||||
ChecksumTableModel model = (ChecksumTableModel) table.getModel();
|
ChecksumTableModel model = (ChecksumTableModel) table.getModel();
|
||||||
int modelColumn = table.getColumnModel().getColumn(column).getModelIndex();
|
int modelColumn = table.getColumnModel().getColumn(column).getModelIndex();
|
||||||
|
@ -69,7 +69,6 @@ import net.filebot.util.ui.AbstractBean;
|
|||||||
import net.filebot.util.ui.DashedSeparator;
|
import net.filebot.util.ui.DashedSeparator;
|
||||||
import net.filebot.util.ui.EmptySelectionModel;
|
import net.filebot.util.ui.EmptySelectionModel;
|
||||||
import net.filebot.util.ui.LinkButton;
|
import net.filebot.util.ui.LinkButton;
|
||||||
import net.filebot.util.ui.RoundBorder;
|
|
||||||
import net.filebot.vfs.MemoryFile;
|
import net.filebot.vfs.MemoryFile;
|
||||||
import net.filebot.web.SubtitleDescriptor;
|
import net.filebot.web.SubtitleDescriptor;
|
||||||
import net.filebot.web.SubtitleProvider;
|
import net.filebot.web.SubtitleProvider;
|
||||||
@ -80,6 +79,7 @@ class SubtitleAutoMatchDialog extends JDialog {
|
|||||||
|
|
||||||
private static final Color hashMatchColor = new Color(0xFAFAD2); // LightGoldenRodYellow
|
private static final Color hashMatchColor = new Color(0xFAFAD2); // LightGoldenRodYellow
|
||||||
private static final Color nameMatchColor = new Color(0xFFEBCD); // BlanchedAlmond
|
private static final Color nameMatchColor = new Color(0xFFEBCD); // BlanchedAlmond
|
||||||
|
|
||||||
private final JPanel hashMatcherServicePanel = createServicePanel(hashMatchColor);
|
private final JPanel hashMatcherServicePanel = createServicePanel(hashMatchColor);
|
||||||
private final JPanel nameMatcherServicePanel = createServicePanel(nameMatchColor);
|
private final JPanel nameMatcherServicePanel = createServicePanel(nameMatchColor);
|
||||||
|
|
||||||
@ -112,7 +112,7 @@ class SubtitleAutoMatchDialog extends JDialog {
|
|||||||
|
|
||||||
protected JPanel createServicePanel(Color color) {
|
protected JPanel createServicePanel(Color color) {
|
||||||
JPanel panel = new JPanel(new MigLayout("hidemode 3, novisualpadding"));
|
JPanel panel = new JPanel(new MigLayout("hidemode 3, novisualpadding"));
|
||||||
panel.setBorder(new RoundBorder());
|
panel.setBorder(getRoundBorder());
|
||||||
panel.setOpaque(false);
|
panel.setOpaque(false);
|
||||||
panel.setBackground(color);
|
panel.setBackground(color);
|
||||||
panel.setVisible(false);
|
panel.setVisible(false);
|
||||||
@ -452,7 +452,7 @@ class SubtitleAutoMatchDialog extends JDialog {
|
|||||||
}
|
}
|
||||||
if (f < 0.9f) {
|
if (f < 0.9f) {
|
||||||
setOpaque(true);
|
setOpaque(true);
|
||||||
setBackground(derive(Color.RED, (1 - f) * 0.5f));
|
setBackground(withAlpha(Color.RED, (1 - f) * 0.5f));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
|
|
||||||
package net.filebot.util.ui;
|
package net.filebot.util.ui;
|
||||||
|
|
||||||
|
import static net.filebot.ui.ThemeSupport.*;
|
||||||
|
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
import java.awt.Graphics;
|
import java.awt.Graphics;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
@ -69,7 +71,7 @@ public class ListView extends JList {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void paintBlockSelection(Graphics2D g2d, Rectangle selection) {
|
protected void paintBlockSelection(Graphics2D g2d, Rectangle selection) {
|
||||||
g2d.setPaint(SwingUI.derive(getSelectionBackground(), 0.3f));
|
g2d.setPaint(withAlpha(getSelectionBackground(), 0.3f));
|
||||||
g2d.fill(selection);
|
g2d.fill(selection);
|
||||||
|
|
||||||
g2d.setPaint(getSelectionBackground());
|
g2d.setPaint(getSelectionBackground());
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
|
|
||||||
package net.filebot.util.ui;
|
package net.filebot.util.ui;
|
||||||
|
|
||||||
|
import static net.filebot.ui.ThemeSupport.*;
|
||||||
|
|
||||||
import javax.swing.JComponent;
|
import javax.swing.JComponent;
|
||||||
|
|
||||||
import net.miginfocom.swing.MigLayout;
|
import net.miginfocom.swing.MigLayout;
|
||||||
@ -22,7 +24,7 @@ public class LoadingOverlayPane extends JComponent {
|
|||||||
public LoadingOverlayPane(JComponent component, JComponent propertyChangeSource, String offsetX, String offsetY) {
|
public LoadingOverlayPane(JComponent component, JComponent propertyChangeSource, String offsetX, String offsetY) {
|
||||||
setLayout(new MigLayout("insets 0, fill"));
|
setLayout(new MigLayout("insets 0, fill"));
|
||||||
|
|
||||||
animationComponent = new ProgressIndicator();
|
animationComponent = getProgressIndicator();
|
||||||
animationComponent.setVisible(false);
|
animationComponent.setVisible(false);
|
||||||
|
|
||||||
add(animationComponent, String.format("pos n %s 100%%-%s n", offsetY != null ? offsetY : "8px", offsetX != null ? offsetX : "20px"));
|
add(animationComponent, String.format("pos n %s 100%%-%s n", offsetY != null ? offsetY : "8px", offsetX != null ? offsetX : "20px"));
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
|
|
||||||
package net.filebot.util.ui;
|
package net.filebot.util.ui;
|
||||||
|
|
||||||
|
|
||||||
import java.awt.BasicStroke;
|
import java.awt.BasicStroke;
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
@ -20,7 +19,6 @@ import java.awt.geom.Rectangle2D;
|
|||||||
import javax.swing.JComponent;
|
import javax.swing.JComponent;
|
||||||
import javax.swing.Timer;
|
import javax.swing.Timer;
|
||||||
|
|
||||||
|
|
||||||
public class ProgressIndicator extends JComponent {
|
public class ProgressIndicator extends JComponent {
|
||||||
|
|
||||||
private float radius = 4.0f;
|
private float radius = 4.0f;
|
||||||
@ -29,9 +27,6 @@ public class ProgressIndicator extends JComponent {
|
|||||||
private float strokeWidth = 2f;
|
private float strokeWidth = 2f;
|
||||||
private Stroke stroke = new BasicStroke(strokeWidth, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND);
|
private Stroke stroke = new BasicStroke(strokeWidth, BasicStroke.CAP_BUTT, BasicStroke.JOIN_ROUND);
|
||||||
|
|
||||||
private Color progressShapeColor = Color.orange;
|
|
||||||
private Color backgroundShapeColor = new Color(0f, 0f, 0f, 0.25f);
|
|
||||||
|
|
||||||
private final Rectangle2D frame = new Rectangle2D.Double();
|
private final Rectangle2D frame = new Rectangle2D.Double();
|
||||||
private final Ellipse2D circle = new Ellipse2D.Double();
|
private final Ellipse2D circle = new Ellipse2D.Double();
|
||||||
private final Dimension baseSize = new Dimension(32, 32);
|
private final Dimension baseSize = new Dimension(32, 32);
|
||||||
@ -41,8 +36,13 @@ public class ProgressIndicator extends JComponent {
|
|||||||
|
|
||||||
private Timer updateTimer;
|
private Timer updateTimer;
|
||||||
|
|
||||||
|
private final Color progressShapeColor;
|
||||||
|
private final Color backgroundShapeColor;
|
||||||
|
|
||||||
|
public ProgressIndicator(Color progressShapeColor, Color backgroundShapeColor) {
|
||||||
|
this.progressShapeColor = progressShapeColor;
|
||||||
|
this.backgroundShapeColor = backgroundShapeColor;
|
||||||
|
|
||||||
public ProgressIndicator() {
|
|
||||||
setPreferredSize(baseSize);
|
setPreferredSize(baseSize);
|
||||||
|
|
||||||
addComponentListener(new ComponentAdapter() {
|
addComponentListener(new ComponentAdapter() {
|
||||||
@ -52,7 +52,6 @@ public class ProgressIndicator extends JComponent {
|
|||||||
startAnimation();
|
startAnimation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void componentHidden(ComponentEvent e) {
|
public void componentHidden(ComponentEvent e) {
|
||||||
stopAnimation();
|
stopAnimation();
|
||||||
@ -60,14 +59,12 @@ public class ProgressIndicator extends JComponent {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void animateOnce() {
|
public void animateOnce() {
|
||||||
if ((alpha += (speed / 1000)) >= 1) {
|
if ((alpha += (speed / 1000)) >= 1) {
|
||||||
alpha -= Math.floor(alpha);
|
alpha -= Math.floor(alpha);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void paintComponent(Graphics g) {
|
public void paintComponent(Graphics g) {
|
||||||
Graphics2D g2d = (Graphics2D) g;
|
Graphics2D g2d = (Graphics2D) g;
|
||||||
@ -83,7 +80,6 @@ public class ProgressIndicator extends JComponent {
|
|||||||
paintShapes(g2d);
|
paintShapes(g2d);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void paintShapes(Graphics2D g2d) {
|
private void paintShapes(Graphics2D g2d) {
|
||||||
circle.setFrame(frame);
|
circle.setFrame(frame);
|
||||||
|
|
||||||
@ -110,12 +106,10 @@ public class ProgressIndicator extends JComponent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private double getTheta(double value, double max) {
|
private double getTheta(double value, double max) {
|
||||||
return (value / max) * 2 * Math.PI;
|
return (value / max) * 2 * Math.PI;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void startAnimation() {
|
public void startAnimation() {
|
||||||
if (updateTimer == null) {
|
if (updateTimer == null) {
|
||||||
updateTimer = new Timer(20, new ActionListener() {
|
updateTimer = new Timer(20, new ActionListener() {
|
||||||
@ -131,7 +125,6 @@ public class ProgressIndicator extends JComponent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void stopAnimation() {
|
public void stopAnimation() {
|
||||||
if (updateTimer != null) {
|
if (updateTimer != null) {
|
||||||
updateTimer.stop();
|
updateTimer.stop();
|
||||||
@ -139,17 +132,14 @@ public class ProgressIndicator extends JComponent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setShapeCount(int indeterminateShapeCount) {
|
public void setShapeCount(int indeterminateShapeCount) {
|
||||||
this.shapeCount = indeterminateShapeCount;
|
this.shapeCount = indeterminateShapeCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setSpeed(double speed) {
|
public void setSpeed(double speed) {
|
||||||
this.speed = speed;
|
this.speed = speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public double getSpeed() {
|
public double getSpeed() {
|
||||||
return speed;
|
return speed;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
|
|
||||||
package net.filebot.util.ui;
|
package net.filebot.util.ui;
|
||||||
|
|
||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
import java.awt.Graphics;
|
import java.awt.Graphics;
|
||||||
@ -11,34 +10,23 @@ import java.awt.RenderingHints;
|
|||||||
|
|
||||||
import javax.swing.border.AbstractBorder;
|
import javax.swing.border.AbstractBorder;
|
||||||
|
|
||||||
|
|
||||||
public class RoundBorder extends AbstractBorder {
|
public class RoundBorder extends AbstractBorder {
|
||||||
|
|
||||||
private final Color color;
|
private final Color color;
|
||||||
private final Insets insets;
|
private final Insets insets;
|
||||||
private final int arc;
|
private final int arc;
|
||||||
|
|
||||||
|
|
||||||
public RoundBorder() {
|
|
||||||
this.color = new Color(0xACACAC);
|
|
||||||
this.arc = 12;
|
|
||||||
this.insets = new Insets(1, 1, 1, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public RoundBorder(Color color, int arc, Insets insets) {
|
public RoundBorder(Color color, int arc, Insets insets) {
|
||||||
this.color = color;
|
this.color = color;
|
||||||
this.arc = arc;
|
this.arc = arc;
|
||||||
this.insets = insets;
|
this.insets = insets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isBorderOpaque() {
|
public boolean isBorderOpaque() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
|
public void paintBorder(Component c, Graphics g, int x, int y, int width, int height) {
|
||||||
Graphics2D g2d = (Graphics2D) g.create();
|
Graphics2D g2d = (Graphics2D) g.create();
|
||||||
@ -53,13 +41,11 @@ public class RoundBorder extends AbstractBorder {
|
|||||||
g2d.dispose();
|
g2d.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Insets getBorderInsets(Component c) {
|
public Insets getBorderInsets(Component c) {
|
||||||
return new Insets(insets.top, insets.left, insets.bottom, insets.right);
|
return new Insets(insets.top, insets.left, insets.bottom, insets.right);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Insets getBorderInsets(Component c, Insets insets) {
|
public Insets getBorderInsets(Component c, Insets insets) {
|
||||||
insets.top = this.insets.top;
|
insets.top = this.insets.top;
|
||||||
|
@ -126,10 +126,6 @@ public final class SwingUI {
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Color derive(Color color, float alpha) {
|
|
||||||
return new Color(((int) ((alpha * 255)) << 24) | (color.getRGB() & 0x00FFFFFF), true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String toHex(Color c) {
|
public static String toHex(Color c) {
|
||||||
return c == null ? "inherit" : String.format("#%02x%02x%02x", c.getRed(), c.getGreen(), c.getBlue());
|
return c == null ? "inherit" : String.format("#%02x%02x%02x", c.getRed(), c.getGreen(), c.getBlue());
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user