Bring back multi-icon goodness.
Added a util in samskivert to do the song & dance with reflection to find it for us.
This commit is contained in:
@@ -112,8 +112,8 @@ public class Application
|
|||||||
/** The error background image for {@link RotatingBackgrounds}. */
|
/** The error background image for {@link RotatingBackgrounds}. */
|
||||||
public String errorBackground;
|
public String errorBackground;
|
||||||
|
|
||||||
/** The path (relative to the appdir) of an image for the window icon. */
|
/** The paths (relative to the appdir) of images for the window icon. */
|
||||||
public String iconImage;
|
public String[] iconImages;
|
||||||
|
|
||||||
/** The path (relative to the appdir) to a single background image. */
|
/** The path (relative to the appdir) to a single background image. */
|
||||||
public String backgroundImage;
|
public String backgroundImage;
|
||||||
@@ -598,7 +598,7 @@ public class Application
|
|||||||
}
|
}
|
||||||
ui.progressImage = (String)cdata.get("ui.progress_image");
|
ui.progressImage = (String)cdata.get("ui.progress_image");
|
||||||
ui.rotatingBackgrounds = ConfigUtil.getMultiValue(cdata, "ui.rotating_background");
|
ui.rotatingBackgrounds = ConfigUtil.getMultiValue(cdata, "ui.rotating_background");
|
||||||
ui.iconImage = (String)cdata.get("ui.icon");
|
ui.iconImages = ConfigUtil.getMultiValue(cdata, "ui.icon");
|
||||||
ui.errorBackground = (String)cdata.get("ui.error_background");
|
ui.errorBackground = (String)cdata.get("ui.error_background");
|
||||||
_dockIconPath = (String)cdata.get("ui.mac_dock_icon");
|
_dockIconPath = (String)cdata.get("ui.mac_dock_icon");
|
||||||
if (_dockIconPath == null) {
|
if (_dockIconPath == null) {
|
||||||
|
|||||||
@@ -27,23 +27,24 @@ package com.threerings.getdown.launcher;
|
|||||||
|
|
||||||
import java.awt.Container;
|
import java.awt.Container;
|
||||||
import java.awt.Image;
|
import java.awt.Image;
|
||||||
import java.awt.event.WindowEvent;
|
|
||||||
import java.awt.event.WindowAdapter;
|
import java.awt.event.WindowAdapter;
|
||||||
import javax.swing.JFrame;
|
import java.awt.event.WindowEvent;
|
||||||
import javax.swing.WindowConstants;
|
import java.io.BufferedOutputStream;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.BufferedOutputStream;
|
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.samskivert.swing.util.SwingUtil;
|
import javax.swing.JFrame;
|
||||||
|
import javax.swing.WindowConstants;
|
||||||
|
|
||||||
import com.samskivert.util.StringUtil;
|
import com.samskivert.util.StringUtil;
|
||||||
|
|
||||||
|
import com.samskivert.swing.util.SwingUtil;
|
||||||
|
|
||||||
import static com.threerings.getdown.Log.log;
|
import static com.threerings.getdown.Log.log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -124,14 +125,24 @@ public class GetdownApp
|
|||||||
_frame.setTitle(title);
|
_frame.setTitle(title);
|
||||||
_frame.getContentPane().removeAll();
|
_frame.getContentPane().removeAll();
|
||||||
}
|
}
|
||||||
if (_ifc.iconImage != null) {
|
|
||||||
Image img = loadImage(_ifc.iconImage);
|
if (_ifc.iconImages != null) {
|
||||||
if (img == null) {
|
ArrayList<Image> icons = new ArrayList<Image>();
|
||||||
log.warning("Failed to load icon", "iconImage", _ifc.iconImage);
|
for (String path : _ifc.iconImages) {
|
||||||
|
Image img = loadImage(path);
|
||||||
|
if (img == null) {
|
||||||
|
log.warning("Error loading icon image", "path", path);
|
||||||
|
} else {
|
||||||
|
icons.add(img);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (icons.isEmpty()) {
|
||||||
|
log.warning("Failed to load any icons", "iconImages", _ifc.iconImages);
|
||||||
} else {
|
} else {
|
||||||
_frame.setIconImage(img);
|
SwingUtil.setWindowIcons(_frame, icons);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
|
_frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
|
||||||
return _frame.getContentPane();
|
return _frame.getContentPane();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user