Browse Source

Issue 1737

git-svn-id: http://svn.dmdirc.com/trunk@4641 00569f92-eb28-0410-84fd-f71c24880f
tags/0.6.3m1rc1
Chris Smith 16 years ago
parent
commit
b407fcf478

+ 2
- 1
src/com/dmdirc/addons/dcc/DCCPlugin.java View File

@@ -465,6 +465,7 @@ public final class DCCPlugin extends Plugin implements ActionListener {
465 465
 		defaults.setOption(MY_DOMAIN, "firewall.ports.endPort", "11019");
466 466
 		
467 467
 		final String url = "plugin://dcc:com/dmdirc/addons/dcc/res/";
468
+        defaults.setOption("icon", "category-dcc", url + "transfers.png");
468 469
 		defaults.setOption("icon", "dcc", url + "transfers.png");
469 470
 		defaults.setOption("icon", "dcc-chat-active", url + "chat.png");
470 471
 		defaults.setOption("icon", "dcc-chat-inactive", url + "chat-inactive.png");
@@ -554,7 +555,7 @@ public final class DCCPlugin extends Plugin implements ActionListener {
554 555
 	/** {@inheritDoc} */
555 556
 	@Override
556 557
 	public void showConfig(final PreferencesManager manager) {
557
-		final PreferencesCategory general = new PreferencesCategory("DCC", "");
558
+		final PreferencesCategory general = new PreferencesCategory("DCC", "", "category-dcc");
558 559
 		final PreferencesCategory firewall = new PreferencesCategory("Firewall", "");
559 560
 		final PreferencesCategory sending = new PreferencesCategory("Sending", "");
560 561
 		final PreferencesCategory receiving = new PreferencesCategory("Receiving", "");

+ 4
- 2
src/com/dmdirc/addons/mediasource_vlc/VlcMediaSourcePlugin.java View File

@@ -188,7 +188,8 @@ public class VlcMediaSourcePlugin extends Plugin implements MediaSource {
188 188
     /** {@inheritDoc} */
189 189
     @Override    
190 190
     public void onLoad() {
191
-        // Do nothing
191
+        IdentityManager.getAddonIdentity().setOption("icon", "category-vlc",
192
+                "plugin://vlcmediasource:com/dmdirc/addons/mediasource_vlc/vlc.png");
192 193
     }
193 194
 
194 195
     /** {@inheritDoc} */
@@ -200,7 +201,8 @@ public class VlcMediaSourcePlugin extends Plugin implements MediaSource {
200 201
     /** {@inheritDoc} */
201 202
     @Override
202 203
     public void showConfig(final PreferencesManager manager) {
203
-        final PreferencesCategory general = new PreferencesCategory("VLC Media Source", "");
204
+        final PreferencesCategory general = new PreferencesCategory("VLC Media Source",
205
+                "", "category-vlc");
204 206
         final PreferencesCategory instr = new PreferencesCategory("Instructions",
205 207
                 "", new InstructionsPanel());
206 208
         

BIN
src/com/dmdirc/addons/mediasource_vlc/vlc.png View File


+ 4
- 1
src/com/dmdirc/addons/nowplaying/NowPlayingPlugin.java View File

@@ -73,6 +73,9 @@ public class NowPlayingPlugin extends Plugin implements ActionListener  {
73 73
         
74 74
         ActionManager.addListener(this, CoreActionType.PLUGIN_LOADED,
75 75
                 CoreActionType.PLUGIN_UNLOADED);
76
+
77
+        IdentityManager.getConfigIdentity().setOption("icon", "category-nowplaying",
78
+                "plugin://nowplaying:com/dmdirc/addons/nowplaying/nowplaying.png");
76 79
         
77 80
         for (PluginInfo target : PluginManager.getPluginManager().getPluginInfos()) {
78 81
             if (target.isLoaded()) {
@@ -98,7 +101,7 @@ public class NowPlayingPlugin extends Plugin implements ActionListener  {
98 101
         final ConfigPanel configPanel = new ConfigPanel(this, order);
99 102
         
100 103
         final PreferencesCategory category = new PreferencesCategory("Now Playing",
101
-                "", configPanel);
104
+                "", "category-nowplaying", configPanel);
102 105
         manager.getCategory("Plugins").addSubCategory(category);
103 106
     }
104 107
     

BIN
src/com/dmdirc/addons/nowplaying/nowplaying.png View File


+ 80
- 0
src/com/dmdirc/addons/nowplaying/nowplaying.svg View File

@@ -0,0 +1,80 @@
1
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
3
+<svg
4
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
5
+   xmlns:cc="http://creativecommons.org/ns#"
6
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
7
+   xmlns:svg="http://www.w3.org/2000/svg"
8
+   xmlns="http://www.w3.org/2000/svg"
9
+   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
10
+   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
11
+   width="16px"
12
+   height="16px"
13
+   id="svg2450"
14
+   sodipodi:version="0.32"
15
+   inkscape:version="0.46"
16
+   sodipodi:docname="nowplaying.svg"
17
+   inkscape:output_extension="org.inkscape.output.svg.inkscape">
18
+  <defs
19
+     id="defs2452">
20
+    <inkscape:perspective
21
+       sodipodi:type="inkscape:persp3d"
22
+       inkscape:vp_x="0 : 8 : 1"
23
+       inkscape:vp_y="0 : 1000 : 0"
24
+       inkscape:vp_z="16 : 8 : 1"
25
+       inkscape:persp3d-origin="8 : 5.3333333 : 1"
26
+       id="perspective2458" />
27
+  </defs>
28
+  <sodipodi:namedview
29
+     id="base"
30
+     pagecolor="#ffffff"
31
+     bordercolor="#666666"
32
+     borderopacity="1.0"
33
+     inkscape:pageopacity="0.0"
34
+     inkscape:pageshadow="2"
35
+     inkscape:zoom="22.197802"
36
+     inkscape:cx="5.5386024"
37
+     inkscape:cy="8"
38
+     inkscape:current-layer="layer1"
39
+     showgrid="true"
40
+     inkscape:grid-bbox="true"
41
+     inkscape:document-units="px"
42
+     inkscape:window-width="1151"
43
+     inkscape:window-height="654"
44
+     inkscape:window-x="0"
45
+     inkscape:window-y="295">
46
+    <inkscape:grid
47
+       type="xygrid"
48
+       id="grid2460" />
49
+  </sodipodi:namedview>
50
+  <metadata
51
+     id="metadata2455">
52
+    <rdf:RDF>
53
+      <cc:Work
54
+         rdf:about="">
55
+        <dc:format>image/svg+xml</dc:format>
56
+        <dc:type
57
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
58
+      </cc:Work>
59
+    </rdf:RDF>
60
+  </metadata>
61
+  <g
62
+     id="layer1"
63
+     inkscape:label="Layer 1"
64
+     inkscape:groupmode="layer">
65
+    <path
66
+       sodipodi:type="arc"
67
+       style="opacity:1;fill:#800080;fill-opacity:1;fill-rule:evenodd;stroke:#800080;stroke-width:0.2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
68
+       id="path2462"
69
+       sodipodi:cx="6.3519802"
70
+       sodipodi:cy="11.112128"
71
+       sodipodi:rx="2.7930694"
72
+       sodipodi:ry="2.8155942"
73
+       d="M 9.1450496,11.112128 A 2.7930694,2.8155942 0 1 1 3.5589108,11.112128 A 2.7930694,2.8155942 0 1 1 9.1450496,11.112128 z"
74
+       transform="translate(-0.9460396,0.3603961)" />
75
+    <path
76
+       style="fill:none;fill-rule:evenodd;stroke:#800080;stroke-width:1.89999998;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
77
+       d="M 7.1915538,12.286342 L 8.1736822,3.1003096 C 8.1736822,3.1003096 11.2885,7.0470597 13.585397,4.4414127"
78
+       id="path2464" />
79
+  </g>
80
+</svg>

+ 11
- 1
src/com/dmdirc/config/defaults/default/defaults View File

@@ -16,6 +16,7 @@ keysections:
16 16
   popups
17 17
   protocol
18 18
   plugin-addonid
19
+  icon
19 20
 
20 21
 identity:
21 22
   name=DMDirc default settings
@@ -211,4 +212,13 @@ plugin-addonid:
211 212
   timeplugin=6
212 213
   urlcatcher=25
213 214
   userlevel=21
214
-  windowstatus=13
215
+  windowstatus=13
216
+
217
+icon:
218
+  category-addons=dmdirc://com/dmdirc/res/addon.png
219
+  category-advanced=dmdirc://com/dmdirc/res/cog.png
220
+  category-connection=dmdirc://com/dmdirc/res/server.png
221
+  category-gui=dmdirc://com/dmdirc/res/monitor.png
222
+  category-messages=dmdirc://com/dmdirc/res/feedback.png
223
+  category-updates=dmdirc://com/dmdirc/res/update.png
224
+  category-urlhandlers=dmdirc://com/dmdirc/res/urls.png

+ 44
- 3
src/com/dmdirc/config/prefs/PreferencesCategory.java View File

@@ -40,6 +40,9 @@ public class PreferencesCategory {
40 40
     
41 41
     /** A description of this category. */
42 42
     private final String description;
43
+
44
+    /** The icon to use for this category. */
45
+    private final String icon;
43 46
     
44 47
     /** Whether or not this category is inline. */
45 48
     private boolean isInline = false;
@@ -66,20 +69,48 @@ public class PreferencesCategory {
66 69
      * @param description The description of this category
67 70
      */
68 71
     public PreferencesCategory(final String title, final String description) {
69
-        this(title, description, null);
72
+        this(title, description, null, null);
70 73
     }
71
-    
74
+
75
+    /**
76
+     * Creates a new preferences category that contains settings.
77
+     *
78
+     * @since 0.6.3
79
+     * @param title The title of this preferences category
80
+     * @param description The description of this category
81
+     * @param icon The icon to use for this category
82
+     */
83
+    public PreferencesCategory(final String title, final String description,
84
+            final String icon) {
85
+        this(title, description, icon, null);
86
+    }
87
+
72 88
     /**
73 89
      * Creates a new preferences category that contains an object.
74
-     * 
90
+     *
75 91
      * @param title The title of this preferences category
76 92
      * @param description The description of this category
77 93
      * @param object The replacement object for this category
78 94
      */
79 95
     public PreferencesCategory(final String title, final String description,
80 96
             final PreferencesInterface object) {
97
+        this(title, description, null, object);
98
+    }
99
+    
100
+    /**
101
+     * Creates a new preferences category that contains an object.
102
+     *
103
+     * @since 0.6.3
104
+     * @param title The title of this preferences category
105
+     * @param description The description of this category
106
+     * @param icon The icon to use for this category
107
+     * @param object The replacement object for this category
108
+     */
109
+    public PreferencesCategory(final String title, final String description,
110
+            final String icon, final PreferencesInterface object) {
81 111
         this.title = title;
82 112
         this.description = description;
113
+        this.icon = icon;
83 114
         this.object = object;
84 115
     }
85 116
     
@@ -186,6 +217,16 @@ public class PreferencesCategory {
186 217
     public String getTitle() {
187 218
         return title;
188 219
     }
220
+
221
+    /**
222
+     * Retrieves the icon to use for this category.
223
+     *
224
+     * @return This category's icon
225
+     * @since 0.6.3
226
+     */
227
+    public String getIcon() {
228
+        return icon;
229
+    }
189 230
     
190 231
     /**
191 232
      * Determines if this category has a replacement object.

+ 15
- 8
src/com/dmdirc/config/prefs/PreferencesManager.java View File

@@ -161,7 +161,8 @@ public class PreferencesManager {
161 161
      * Creates and adds the "Connection" category.
162 162
      */
163 163
     private void addConnectionCategory() {
164
-        final PreferencesCategory category = new PreferencesCategory("Connection", "");
164
+        final PreferencesCategory category = new PreferencesCategory("Connection",
165
+                "", "category-connection");
165 166
 
166 167
         category.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
167 168
                 "general", "closechannelsonquit", "false", "Close channels on quit",
@@ -201,7 +202,8 @@ public class PreferencesManager {
201 202
      * Creates and adds the "Messages" category.
202 203
      */
203 204
     private void addMessagesCategory() {
204
-        final PreferencesCategory category = new PreferencesCategory("Messages", "");
205
+        final PreferencesCategory category = new PreferencesCategory("Messages",
206
+                "", "category-messages");
205 207
 
206 208
         category.addSetting(new PreferencesSetting(PreferencesType.TEXT,
207 209
                 "general", "closemessage", "DMDirc exiting",
@@ -298,7 +300,8 @@ public class PreferencesManager {
298 300
      * Creates and adds the "Advanced" category.
299 301
      */
300 302
     private void addAdvancedCategory() {
301
-        final PreferencesCategory category = new PreferencesCategory("Advanced", "");
303
+        final PreferencesCategory category = new PreferencesCategory("Advanced", 
304
+                "", "category-advanced");
302 305
 
303 306
         category.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
304 307
                 "browser", "userlaunchdelay", "false", "Use browser launch delay",
@@ -337,7 +340,8 @@ public class PreferencesManager {
337 340
         final Map<String, String> lafs = new HashMap<String, String>();
338 341
         final Map<String, String> framemanagers = new HashMap<String, String>();
339 342
         final Map<String, String> fmpositions = new HashMap<String, String>();
340
-        final PreferencesCategory category = new PreferencesCategory("GUI", "");
343
+        final PreferencesCategory category = new PreferencesCategory("GUI", "",
344
+                "category-gui");
341 345
 
342 346
         framemanagers.put("treeview", "Treeview");
343 347
         framemanagers.put("buttonbar", "Button bar");
@@ -414,7 +418,8 @@ public class PreferencesManager {
414 418
     private void addThemesCategory(final PreferencesCategory parent) {
415 419
         // TODO: Abstract the panel
416 420
 
417
-        parent.addSubCategory(new PreferencesCategory("Themes", "", new ThemePanel()));        
421
+        parent.addSubCategory(new PreferencesCategory("Themes", "",
422
+                "category-addons", new ThemePanel()));
418 423
     }
419 424
 
420 425
     /**
@@ -486,7 +491,8 @@ public class PreferencesManager {
486 491
     private void addPluginsCategory() {
487 492
         // TODO: Abstract the panel
488 493
 
489
-        addCategory(new PreferencesCategory("Plugins", "", new PluginPanel()));
494
+        addCategory(new PreferencesCategory("Plugins", "", "category-addons",
495
+                new PluginPanel()));
490 496
     }
491 497
 
492 498
     /**
@@ -495,7 +501,8 @@ public class PreferencesManager {
495 501
     private void addUpdatesCategory() {
496 502
         // TODO: Abstract the panel
497 503
 
498
-        addCategory(new PreferencesCategory("Updates", "", new UpdateConfigPanel()));
504
+        addCategory(new PreferencesCategory("Updates", "", "category-updates",
505
+                new UpdateConfigPanel()));
499 506
     }
500 507
 
501 508
     /**
@@ -506,7 +513,7 @@ public class PreferencesManager {
506 513
 
507 514
         addCategory(new PreferencesCategory("URL Handlers",
508 515
                 "Configure how DMDirc handles different types of URLs",
509
-                new URLConfigPanel()));
516
+                "category-urlhandlers", new URLConfigPanel()));
510 517
     }
511 518
 
512 519
     /**

BIN
src/com/dmdirc/res/addon.png View File


BIN
src/com/dmdirc/res/cog.png View File


BIN
src/com/dmdirc/res/monitor.png View File


BIN
src/com/dmdirc/res/urls.png View File


+ 4
- 19
src/com/dmdirc/ui/IconManager.java View File

@@ -135,26 +135,11 @@ public final class IconManager implements ConfigChangeListener {
135 135
         //Get the url for the speficied path
136 136
         URL imageURL = URLBuilder.buildURL(path);
137 137
         
138
-        try {
139
-            //if the path didnt exist see if its a file
140
-            if (imageURL == null) {
141
-                final File file = new File(path);
142
-                if (file.exists()) {
143
-                    imageURL = file.toURI().toURL();
144
-                } else {
145
-                    imageURL = defaultURL;
146
-                }
147
-            }
148
-            
149
-            //check if the url has content
150
-            if (imageURL == null || imageURL.getContent() == null)  {
151
-                imageURL = defaultURL;
152
-            }
153
-        } catch (IOException ex) {
154
-            imageURL = defaultURL;
138
+        if (imageURL == null && defaultURL != null) {
139
+           imageURL = defaultURL;
155 140
         }
156
-        
157
-        if (imageURL == null) {
141
+
142
+        if (imageURL == null && defaultURL == null) {
158 143
             imageURL = cldr.getResource("com/dmdirc/res/icon.png");
159 144
             
160 145
             if (imageURL == null) {

+ 1
- 1
src/com/dmdirc/ui/swing/components/renderers/ProfileListCellRenderer.java View File

@@ -22,7 +22,7 @@
22 22
 
23 23
 package com.dmdirc.ui.swing.components.renderers;
24 24
 
25
-import com.dmdirc.ui.swing.dialogs.profiles.Profile;
25
+import com.dmdirc.config.Profile;
26 26
 
27 27
 import java.awt.Component;
28 28
 

+ 14
- 5
src/com/dmdirc/ui/swing/dialogs/prefs/PreferencesTreeCellRenderer.java View File

@@ -22,6 +22,8 @@
22 22
 
23 23
 package com.dmdirc.ui.swing.dialogs.prefs;
24 24
 
25
+import com.dmdirc.config.prefs.PreferencesCategory;
26
+import com.dmdirc.ui.IconManager;
25 27
 import java.awt.Component;
26 28
 import java.awt.Dimension;
27 29
 import java.awt.Font;
@@ -29,6 +31,7 @@ import java.awt.Font;
29 31
 import javax.swing.BorderFactory;
30 32
 import javax.swing.JLabel;
31 33
 import javax.swing.JTree;
34
+import javax.swing.tree.DefaultMutableTreeNode;
32 35
 import javax.swing.tree.TreeCellRenderer;
33 36
 
34 37
 import net.miginfocom.layout.PlatformDefaults;
@@ -63,11 +66,17 @@ public class PreferencesTreeCellRenderer extends JLabel implements TreeCellRende
63 66
     public final Component getTreeCellRendererComponent(final JTree tree,
64 67
             final Object value, final boolean sel, final boolean expanded,
65 68
             final boolean leaf, final int row, final boolean focused) {
66
-        setPreferredSize(new Dimension(100000,
67
-                getFont().getSize() + padding));
68
-        setBorder(BorderFactory.createEmptyBorder(0, 0, padding,
69
-                padding));
70
-        setText(value.toString());
69
+        if (((DefaultMutableTreeNode) value).getUserObject() instanceof PreferencesCategory) {
70
+            final PreferencesCategory cat = (PreferencesCategory)
71
+                    ((DefaultMutableTreeNode) value).getUserObject();
72
+
73
+            setText(cat.getTitle());
74
+            setIcon(IconManager.getIconManager().getIcon(cat.getIcon()));
75
+        }
76
+
77
+        setPreferredSize(new Dimension(100000, Math.max(16,
78
+                getFont().getSize()) + padding));
79
+        setBorder(BorderFactory.createEmptyBorder(0, 0, padding, padding));
71 80
         setBackground(tree.getBackground());
72 81
         setForeground(tree.getForeground());
73 82
         setOpaque(true);

+ 31
- 7
src/com/dmdirc/ui/swing/dialogs/prefs/SwingPreferencesDialog.java View File

@@ -230,6 +230,8 @@ public final class SwingPreferencesDialog extends StandardDialog implements
230 230
 
231 231
     /**
232 232
      * Resets the content of the tooltip.
233
+     *
234
+     * @since 0.6.3
233 235
      */
234 236
     protected void resetTooltip() {
235 237
         tooltip.setFont(tooltip.getFont().deriveFont(Font.ITALIC));
@@ -240,6 +242,7 @@ public final class SwingPreferencesDialog extends StandardDialog implements
240 242
      * Sets the content of the tooltip area to the specified text.
241 243
      *
242 244
      * @param text The text to be displayed
245
+     * @since 0.6.3
243 246
      */
244 247
     protected void setTooltip(final String text) {
245 248
         tooltip.setFont(tooltip.getFont().deriveFont(Font.PLAIN));
@@ -251,6 +254,7 @@ public final class SwingPreferencesDialog extends StandardDialog implements
251 254
      * listeners to any {@link JComponent} with a tooltip set.
252 255
      *
253 256
      * @param components The components to iterate over
257
+     * @since 0.6.3
254 258
      */
255 259
     protected void addMouseListeners(final Component[] components) {
256 260
         for (Component component : components) {
@@ -349,7 +353,7 @@ public final class SwingPreferencesDialog extends StandardDialog implements
349 353
         final String path = namePrefix + "/" + category.getTitle();
350 354
         DefaultMutableTreeNode newNode;
351 355
 
352
-        newNode = new DefaultMutableTreeNode(category.getTitle());
356
+        newNode = new DefaultMutableTreeNode(category);
353 357
 
354 358
         categories.put(category, panel);
355 359
         nodes.put(newNode, path);
@@ -360,7 +364,7 @@ public final class SwingPreferencesDialog extends StandardDialog implements
360 364
 
361 365
         mainPanel.add(scrollPane, path);
362 366
         ((DefaultTreeModel) tabList.getModel()).insertNodeInto(newNode,
363
-                parentNode, parentNode.getChildCount());
367
+                rootNode, parentNode.getChildCount());
364 368
         tabList.scrollPathToVisible(new TreePath(newNode.getPath()));
365 369
 
366 370
         initCategory(category, panel, newNode, path);
@@ -531,31 +535,51 @@ public final class SwingPreferencesDialog extends StandardDialog implements
531 535
         }
532 536
     }
533 537
 
534
-    /** {@inheritDoc} */
538
+    /**
539
+     * {@inheritDoc}
540
+     *
541
+     * @since 0.6.3
542
+     */
535 543
     @Override
536 544
     public void mouseClicked(final MouseEvent e) {
537 545
         // Not used
538 546
     }
539 547
 
540
-    /** {@inheritDoc} */
548
+    /**
549
+     * {@inheritDoc}
550
+     *
551
+     * @since 0.6.3
552
+     */
541 553
     @Override
542 554
     public void mousePressed(final MouseEvent e) {
543 555
         // Not used
544 556
     }
545 557
 
546
-    /** {@inheritDoc} */
558
+    /**
559
+     * {@inheritDoc}
560
+     *
561
+     * @since 0.6.3
562
+     */
547 563
     @Override
548 564
     public void mouseReleased(final MouseEvent e) {
549 565
         // Not used
550 566
     }
551 567
 
552
-    /** {@inheritDoc} */
568
+    /**
569
+     * {@inheritDoc}
570
+     *
571
+     * @since 0.6.3
572
+     */
553 573
     @Override
554 574
     public void mouseEntered(final MouseEvent e) {
555 575
         setTooltip(tooltips.get(e.getComponent()));
556 576
     }
557 577
 
558
-    /** {@inheritDoc} */
578
+    /**
579
+     * {@inheritDoc}
580
+     *
581
+     * @since 0.6.3
582
+     */
559 583
     @Override
560 584
     public void mouseExited(final MouseEvent e) {
561 585
         resetTooltip();

Loading…
Cancel
Save