* on Mac setting Frame.IconImage will override the default preview behaviour (which is bad)

This commit is contained in:
Reinhard Pointner 2014-10-18 15:52:35 +00:00
parent a2dcb4dc84
commit 60c7d298e5
4 changed files with 20 additions and 44 deletions

View File

@ -9,6 +9,7 @@ import static net.filebot.util.ui.SwingUI.*;
import java.awt.Desktop; import java.awt.Desktop;
import java.awt.Dialog.ModalityType; import java.awt.Dialog.ModalityType;
import java.awt.Image;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.WindowAdapter; import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent; import java.awt.event.WindowEvent;
@ -30,6 +31,8 @@ import java.security.PermissionCollection;
import java.security.Permissions; import java.security.Permissions;
import java.security.Policy; import java.security.Policy;
import java.security.ProtectionDomain; import java.security.ProtectionDomain;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.Properties; import java.util.Properties;
import java.util.Scanner; import java.util.Scanner;
@ -275,12 +278,21 @@ public class Main {
} }
}); });
// window settings // configure main window
if (isMacApp()) { if (isMacApp()) {
// Mac OS X specific configuration
MacAppUtilities.initializeApplication(); MacAppUtilities.initializeApplication();
MacAppUtilities.setWindowCanFullScreen(frame); MacAppUtilities.setWindowCanFullScreen(frame);
} else {
// Windows / Linux specific configuration
List<Image> images = new ArrayList<Image>(3);
for (String i : new String[] { "window.icon.large", "window.icon.medium", "window.icon.small" }) {
images.add(ResourceManager.getImage(i));
}
frame.setIconImages(images);
} }
frame.setLocationByPlatform(true); frame.setLocationByPlatform(true);
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
// start application // start application
frame.setVisible(true); frame.setVisible(true);

View File

@ -5,7 +5,6 @@ import static net.filebot.util.ui.SwingUI.*;
import java.awt.BorderLayout; import java.awt.BorderLayout;
import java.awt.Color; import java.awt.Color;
import java.awt.Dialog.ModalExclusionType; import java.awt.Dialog.ModalExclusionType;
import java.awt.Image;
import java.awt.event.ActionEvent; import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent; import java.awt.event.KeyEvent;
import java.awt.event.WindowAdapter; import java.awt.event.WindowAdapter;
@ -16,9 +15,7 @@ import java.io.IOException;
import java.io.PrintStream; import java.io.PrintStream;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.net.URI; import java.net.URI;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import javax.script.Bindings; import javax.script.Bindings;
@ -52,12 +49,6 @@ public class GroovyPad extends JFrame {
public GroovyPad() throws IOException { public GroovyPad() throws IOException {
super("Groovy Pad"); super("Groovy Pad");
List<Image> images = new ArrayList<Image>(3);
for (String i : new String[] { "window.icon.large", "window.icon.medium", "window.icon.small" }) {
images.add(ResourceManager.getImage(i));
}
setIconImages(images);
JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, true, createEditor(), createOutputLog()); JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, true, createEditor(), createOutputLog());
splitPane.setResizeWeight(0.7); splitPane.setResizeWeight(0.7);

View File

@ -10,7 +10,6 @@ import java.awt.Color;
import java.awt.Cursor; import java.awt.Cursor;
import java.awt.Dialog.ModalExclusionType; import java.awt.Dialog.ModalExclusionType;
import java.awt.FlowLayout; import java.awt.FlowLayout;
import java.awt.Image;
import java.awt.dnd.DropTarget; import java.awt.dnd.DropTarget;
import java.awt.dnd.DropTargetAdapter; import java.awt.dnd.DropTargetAdapter;
import java.awt.dnd.DropTargetDragEvent; import java.awt.dnd.DropTargetDragEvent;
@ -20,8 +19,6 @@ import java.awt.event.ActionEvent;
import java.awt.event.WindowAdapter; import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent; import java.awt.event.WindowEvent;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
@ -40,7 +37,6 @@ import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener; import javax.swing.event.ListSelectionListener;
import net.filebot.Analytics; import net.filebot.Analytics;
import net.filebot.ResourceManager;
import net.filebot.Settings; import net.filebot.Settings;
import net.filebot.cli.GroovyPad; import net.filebot.cli.GroovyPad;
import net.filebot.mac.MacAppUtilities; import net.filebot.mac.MacAppUtilities;
@ -68,13 +64,6 @@ public class MainFrame extends JFrame {
public MainFrame() { public MainFrame() {
super(Settings.getApplicationName()); super(Settings.getApplicationName());
// set taskbar / taskswitch icons
List<Image> images = new ArrayList<Image>(3);
for (String i : new String[] { "window.icon.large", "window.icon.medium", "window.icon.small" }) {
images.add(ResourceManager.getImage(i));
}
setIconImages(images);
try { try {
// restore selected panel // restore selected panel
selectionList.setSelectedIndex(Integer.parseInt(persistentSelectedPanel.getValue())); selectionList.setSelectedIndex(Integer.parseInt(persistentSelectedPanel.getValue()));

View File

@ -1,38 +1,23 @@
package net.filebot.ui; package net.filebot.ui;
import java.awt.Image;
import java.awt.datatransfer.Transferable; import java.awt.datatransfer.Transferable;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JFrame; import javax.swing.JFrame;
import net.filebot.ResourceManager;
import net.filebot.ui.transfer.TransferablePolicy; import net.filebot.ui.transfer.TransferablePolicy;
import net.filebot.ui.transfer.TransferablePolicy.TransferAction; import net.filebot.ui.transfer.TransferablePolicy.TransferAction;
import net.filebot.util.ExceptionUtilities; import net.filebot.util.ExceptionUtilities;
import net.miginfocom.swing.MigLayout; import net.miginfocom.swing.MigLayout;
public class SinglePanelFrame extends JFrame { public class SinglePanelFrame extends JFrame {
private final JComponent panel; private final JComponent panel;
public SinglePanelFrame(PanelBuilder builder) { public SinglePanelFrame(PanelBuilder builder) {
super(builder.getName()); super(builder.getName());
panel = builder.create(); panel = builder.create();
// set taskbar / taskswitch icons
List<Image> images = new ArrayList<Image>(3);
for (String i : new String[] { "window.icon.large", "window.icon.medium", "window.icon.small" }) {
images.add(ResourceManager.getImage(i));
}
setIconImages(images);
JComponent c = (JComponent) getContentPane(); JComponent c = (JComponent) getContentPane();
c.setLayout(new MigLayout("insets 0, nogrid, fill", "fill", "fill")); c.setLayout(new MigLayout("insets 0, nogrid, fill", "fill", "fill"));
c.add(panel); c.add(panel);
@ -40,7 +25,6 @@ public class SinglePanelFrame extends JFrame {
setSize(760, 480); setSize(760, 480);
} }
public SinglePanelFrame publish(Transferable transferable) { public SinglePanelFrame publish(Transferable transferable) {
TransferablePolicy policy = (TransferablePolicy) panel.getClientProperty("transferablePolicy"); TransferablePolicy policy = (TransferablePolicy) panel.getClientProperty("transferablePolicy");