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,6 +29,9 @@ import com.dmdirc.util.URLBuilder;
29 29
 import java.awt.Image;
30 30
 import java.awt.Toolkit;
31 31
 import java.net.URL;
32
+import java.util.Calendar;
33
+import java.util.Date;
34
+import java.util.GregorianCalendar;
32 35
 import java.util.HashMap;
33 36
 import java.util.Map;
34 37
 
@@ -142,13 +145,14 @@ public final class IconManager implements ConfigChangeListener {
142 145
      * @return The URL that should be used to retrieve the specified icon
143 146
      */
144 147
     private URL getIconURL(final String type) {
148
+        final String iconType = getSpecialIcons(type);
145 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 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 157
         //Get the url for the speficied path
154 158
         URL imageURL = URLBuilder.buildURL(path);
@@ -162,13 +166,26 @@ public final class IconManager implements ConfigChangeListener {
162 166
             
163 167
             if (imageURL == null) {
164 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 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 189
     /** {@inheritDoc} */
173 190
     @Override
174 191
     public void configChanged(final String domain, final String key) {

Loading…
Cancel
Save