Browse Source

rar

Change-Id: I1eb687317c2d6580b52b582e982b56c254c7645e
Reviewed-on: http://gerrit.dmdirc.com/143
Tested-by: Gregory Holmes <greboid@dmdirc.com>
Reviewed-by: Shane Mc Cormack <shane@dmdirc.com>
Tested-by: Shane Mc Cormack <shane@dmdirc.com>
tags/0.6.3b1
Gregory Holmes 14 years ago
parent
commit
e7f0fb73d8
2 changed files with 22 additions and 5 deletions
  1. BIN
      src/com/dmdirc/res/logo-special.png
  2. 22
    5
      src/com/dmdirc/ui/IconManager.java

BIN
src/com/dmdirc/res/logo-special.png View File


+ 22
- 5
src/com/dmdirc/ui/IconManager.java View File

29
 import java.awt.Image;
29
 import java.awt.Image;
30
 import java.awt.Toolkit;
30
 import java.awt.Toolkit;
31
 import java.net.URL;
31
 import java.net.URL;
32
+import java.util.Calendar;
33
+import java.util.Date;
34
+import java.util.GregorianCalendar;
32
 import java.util.HashMap;
35
 import java.util.HashMap;
33
 import java.util.Map;
36
 import java.util.Map;
34
 
37
 
142
      * @return The URL that should be used to retrieve the specified icon
145
      * @return The URL that should be used to retrieve the specified icon
143
      */
146
      */
144
     private URL getIconURL(final String type) {
147
     private URL getIconURL(final String type) {
148
+        final String iconType = getSpecialIcons(type);
145
         final ClassLoader cldr = Thread.currentThread().getContextClassLoader();
149
         final ClassLoader cldr = Thread.currentThread().getContextClassLoader();
146
-        final URL defaultURL = cldr.getResource("com/dmdirc/res/" + type + ".png");
150
+        final URL defaultURL = cldr.getResource("com/dmdirc/res/" + iconType + ".png");
147
         
151
         
148
         //Get the path for the url
152
         //Get the path for the url
149
-        final String path = IdentityManager.getGlobalConfig().hasOptionString("icon", type)
150
-                ? IdentityManager.getGlobalConfig().getOption("icon", type)
151
-                : "dmdirc://com/dmdirc/res/" + type + ".png";
153
+        final String path = IdentityManager.getGlobalConfig().hasOptionString("icon", iconType)
154
+                ? IdentityManager.getGlobalConfig().getOption("icon", iconType)
155
+                : "dmdirc://com/dmdirc/res/" + iconType + ".png";
152
         
156
         
153
         //Get the url for the speficied path
157
         //Get the url for the speficied path
154
         URL imageURL = URLBuilder.buildURL(path);
158
         URL imageURL = URLBuilder.buildURL(path);
162
             
166
             
163
             if (imageURL == null) {
167
             if (imageURL == null) {
164
                 throw new IllegalArgumentException("Unable to load icon type '"
168
                 throw new IllegalArgumentException("Unable to load icon type '"
165
-                        + type + "', and unable to load default");
169
+                        + iconType + "', and unable to load default");
166
             }
170
             }
167
         }
171
         }
168
         
172
         
169
         return imageURL;
173
         return imageURL;
170
     }
174
     }
171
 
175
 
176
+    private String getSpecialIcons(final String type) {
177
+        final Calendar cal = new GregorianCalendar();
178
+        cal.setTime(new Date());
179
+        if (cal.get(Calendar.MONTH) == Calendar.DECEMBER &&
180
+                cal.get(Calendar.DAY_OF_MONTH) >= 12 &&
181
+                cal.get(Calendar.DAY_OF_MONTH) <= 31) {
182
+           if ("icon".equals(type) || "logo".equals(type)) {
183
+               return "logo-special";
184
+            }
185
+        }
186
+        return type;
187
+    }
188
+
172
     /** {@inheritDoc} */
189
     /** {@inheritDoc} */
173
     @Override
190
     @Override
174
     public void configChanged(final String domain, final String key) {
191
     public void configChanged(final String domain, final String key) {

Loading…
Cancel
Save