Ver código fonte

Use events for showing config in some more plugins.

pull/289/head
Greg Holmes 9 anos atrás
pai
commit
39c775c380

+ 42
- 1
freedesktop_notifications/src/com/dmdirc/addons/freedesktop_notifications/FDManager.java Ver arquivo

@@ -25,12 +25,19 @@ package com.dmdirc.addons.freedesktop_notifications;
25 25
 import com.dmdirc.ClientModule.GlobalConfig;
26 26
 import com.dmdirc.ClientModule.UserConfig;
27 27
 import com.dmdirc.DMDircMBassador;
28
+import com.dmdirc.config.prefs.PluginPreferencesCategory;
29
+import com.dmdirc.config.prefs.PreferencesCategory;
30
+import com.dmdirc.config.prefs.PreferencesDialogModel;
31
+import com.dmdirc.config.prefs.PreferencesSetting;
32
+import com.dmdirc.config.prefs.PreferencesType;
33
+import com.dmdirc.events.ClientPrefsOpenedEvent;
28 34
 import com.dmdirc.events.UserErrorEvent;
29 35
 import com.dmdirc.interfaces.config.AggregateConfigProvider;
30 36
 import com.dmdirc.interfaces.config.ConfigChangeListener;
31 37
 import com.dmdirc.interfaces.config.ConfigProvider;
32 38
 import com.dmdirc.logger.ErrorLevel;
33 39
 import com.dmdirc.plugins.PluginDomain;
40
+import com.dmdirc.plugins.PluginInfo;
34 41
 import com.dmdirc.plugins.implementations.PluginFilesHelper;
35 42
 import com.dmdirc.ui.messages.Styliser;
36 43
 import com.dmdirc.util.io.StreamUtils;
@@ -43,6 +50,8 @@ import java.io.IOException;
43 50
 import javax.inject.Inject;
44 51
 import javax.inject.Singleton;
45 52
 
53
+import net.engio.mbassy.listener.Handler;
54
+
46 55
 @Singleton
47 56
 public class FDManager implements ConfigChangeListener {
48 57
 
@@ -56,6 +65,7 @@ public class FDManager implements ConfigChangeListener {
56 65
     private final PluginFilesHelper filesHelper;
57 66
     /** The event bus to post errors to. */
58 67
     private final DMDircMBassador eventBus;
68
+    private final PluginInfo pluginInfo;
59 69
     /** notification timeout. */
60 70
     private int timeout;
61 71
     /** notification icon. */
@@ -71,12 +81,14 @@ public class FDManager implements ConfigChangeListener {
71 81
             @UserConfig final ConfigProvider userConfig,
72 82
             @PluginDomain(FreeDesktopNotificationsPlugin.class) final String domain,
73 83
             final PluginFilesHelper filesHelper,
74
-            final DMDircMBassador eventBus) {
84
+            final DMDircMBassador eventBus,
85
+            @PluginDomain(FreeDesktopNotificationsPlugin.class) final PluginInfo pluginInfo) {
75 86
         this.domain = domain;
76 87
         this.config = config;
77 88
         this.userConfig = userConfig;
78 89
         this.filesHelper = filesHelper;
79 90
         this.eventBus = eventBus;
91
+        this.pluginInfo = pluginInfo;
80 92
     }
81 93
 
82 94
     /**
@@ -171,4 +183,33 @@ public class FDManager implements ConfigChangeListener {
171 183
         config.removeListener(this);
172 184
     }
173 185
 
186
+
187
+
188
+    @Handler
189
+    public void showConfig(final ClientPrefsOpenedEvent event) {
190
+        final PreferencesDialogModel manager = event.getModel();
191
+        final PreferencesCategory general = new PluginPreferencesCategory(
192
+                pluginInfo, "FreeDesktop Notifications",
193
+                "General configuration for FreeDesktop Notifications plugin.");
194
+
195
+        general.addSetting(new PreferencesSetting(PreferencesType.INTEGER,
196
+                pluginInfo.getDomain(), "general.timeout", "Timeout",
197
+                "Length of time in seconds before the notification popup closes.",
198
+                manager.getConfigManager(), manager.getIdentity()));
199
+        general.addSetting(new PreferencesSetting(PreferencesType.FILE,
200
+                pluginInfo.getDomain(), "general.icon", "icon",
201
+                "Path to icon to use on the notification.",
202
+                manager.getConfigManager(), manager.getIdentity()));
203
+        general.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
204
+                pluginInfo.getDomain(), "advanced.escapehtml", "Escape HTML",
205
+                "Some Implementations randomly parse HTML, escape it before showing?",
206
+                manager.getConfigManager(), manager.getIdentity()));
207
+        general.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
208
+                pluginInfo.getDomain(), "advanced.stripcodes", "Strip Control Codes",
209
+                "Strip IRC Control codes from messages?",
210
+                manager.getConfigManager(), manager.getIdentity()));
211
+
212
+        manager.getCategory("Plugins").addSubCategory(general);
213
+    }
214
+
174 215
 }

+ 6
- 0
freedesktop_notifications/src/com/dmdirc/addons/freedesktop_notifications/FDModule.java Ver arquivo

@@ -54,4 +54,10 @@ public class FDModule {
54 54
         return new PluginFilesHelper(manager, pluginInfo);
55 55
     }
56 56
 
57
+    @Provides
58
+    @PluginDomain(FreeDesktopNotificationsPlugin.class)
59
+    public PluginInfo getPluginInfo() {
60
+        return pluginInfo;
61
+    }
62
+
57 63
 }

+ 1
- 38
freedesktop_notifications/src/com/dmdirc/addons/freedesktop_notifications/FreeDesktopNotificationsPlugin.java Ver arquivo

@@ -22,11 +22,6 @@
22 22
 
23 23
 package com.dmdirc.addons.freedesktop_notifications;
24 24
 
25
-import com.dmdirc.config.prefs.PluginPreferencesCategory;
26
-import com.dmdirc.config.prefs.PreferencesCategory;
27
-import com.dmdirc.config.prefs.PreferencesDialogModel;
28
-import com.dmdirc.config.prefs.PreferencesSetting;
29
-import com.dmdirc.config.prefs.PreferencesType;
30 25
 import com.dmdirc.plugins.Exported;
31 26
 import com.dmdirc.plugins.PluginInfo;
32 27
 import com.dmdirc.plugins.implementations.BaseCommandPlugin;
@@ -38,15 +33,9 @@ import dagger.ObjectGraph;
38 33
  */
39 34
 public class FreeDesktopNotificationsPlugin extends BaseCommandPlugin {
40 35
 
41
-    /** This plugin's plugin info. */
42
-    private final PluginInfo pluginInfo;
43 36
     /** Manager to show notifications. */
44 37
     private FDManager manager;
45 38
 
46
-    public FreeDesktopNotificationsPlugin(final PluginInfo pluginInfo) {
47
-        this.pluginInfo = pluginInfo;
48
-    }
49
-
50 39
     @Override
51 40
     public void load(final PluginInfo pluginInfo, final ObjectGraph graph) {
52 41
         super.load(pluginInfo, graph);
@@ -81,35 +70,9 @@ public class FreeDesktopNotificationsPlugin extends BaseCommandPlugin {
81 70
      * Called when this plugin is Unloaded.
82 71
      */
83 72
     @Override
84
-    public synchronized void onUnload() {
73
+    public void onUnload() {
85 74
         manager.onUnLoad();
86 75
         super.onUnload();
87 76
     }
88 77
 
89
-    @Override
90
-    public void showConfig(final PreferencesDialogModel manager) {
91
-        final PreferencesCategory general = new PluginPreferencesCategory(
92
-                pluginInfo, "FreeDesktop Notifications",
93
-                "General configuration for FreeDesktop Notifications plugin.");
94
-
95
-        general.addSetting(new PreferencesSetting(PreferencesType.INTEGER,
96
-                pluginInfo.getDomain(), "general.timeout", "Timeout",
97
-                "Length of time in seconds before the notification popup closes.",
98
-                manager.getConfigManager(), manager.getIdentity()));
99
-        general.addSetting(new PreferencesSetting(PreferencesType.FILE,
100
-                pluginInfo.getDomain(), "general.icon", "icon",
101
-                "Path to icon to use on the notification.",
102
-                manager.getConfigManager(), manager.getIdentity()));
103
-        general.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
104
-                pluginInfo.getDomain(), "advanced.escapehtml", "Escape HTML",
105
-                "Some Implementations randomly parse HTML, escape it before showing?",
106
-                manager.getConfigManager(), manager.getIdentity()));
107
-        general.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
108
-                pluginInfo.getDomain(), "advanced.stripcodes", "Strip Control Codes",
109
-                "Strip IRC Control codes from messages?",
110
-                manager.getConfigManager(), manager.getIdentity()));
111
-
112
-        manager.getCategory("Plugins").addSubCategory(general);
113
-    }
114
-
115 78
 }

+ 6
- 0
identd/src/com/dmdirc/addons/identd/IdentModule.java Ver arquivo

@@ -44,4 +44,10 @@ public class IdentModule {
44 44
         return pluginInfo.getDomain();
45 45
     }
46 46
 
47
+    @Provides
48
+    @PluginDomain(IdentdPlugin.class)
49
+    public PluginInfo getPluginInfo() {
50
+        return pluginInfo;
51
+    }
52
+
47 53
 }

+ 85
- 0
identd/src/com/dmdirc/addons/identd/IdentdManager.java Ver arquivo

@@ -24,12 +24,20 @@ package com.dmdirc.addons.identd;
24 24
 
25 25
 import com.dmdirc.ClientModule.GlobalConfig;
26 26
 import com.dmdirc.DMDircMBassador;
27
+import com.dmdirc.config.prefs.PluginPreferencesCategory;
28
+import com.dmdirc.config.prefs.PreferencesCategory;
29
+import com.dmdirc.config.prefs.PreferencesDialogModel;
30
+import com.dmdirc.config.prefs.PreferencesSetting;
31
+import com.dmdirc.config.prefs.PreferencesType;
32
+import com.dmdirc.events.ClientPrefsOpenedEvent;
27 33
 import com.dmdirc.events.ServerConnectErrorEvent;
28 34
 import com.dmdirc.events.ServerConnectedEvent;
29 35
 import com.dmdirc.events.ServerConnectingEvent;
30 36
 import com.dmdirc.interfaces.Connection;
31 37
 import com.dmdirc.interfaces.config.AggregateConfigProvider;
32 38
 import com.dmdirc.plugins.PluginDomain;
39
+import com.dmdirc.plugins.PluginInfo;
40
+import com.dmdirc.util.validators.PortValidator;
33 41
 
34 42
 import java.util.ArrayList;
35 43
 import java.util.List;
@@ -50,11 +58,14 @@ public class IdentdManager {
50 58
     private final IdentdServer server;
51 59
     /** Event bus to subscribe to events on. */
52 60
     private final DMDircMBassador eventBus;
61
+    private final PluginInfo pluginInfo;
53 62
 
54 63
     @Inject
55 64
     public IdentdManager(@GlobalConfig final AggregateConfigProvider config,
56 65
             @PluginDomain(IdentdPlugin.class) final String domain,
66
+            @PluginDomain(IdentdPlugin.class) final PluginInfo pluginInfo,
57 67
             final IdentdServer server, final DMDircMBassador eventBus) {
68
+        this.pluginInfo = pluginInfo;
58 69
         connections = new ArrayList<>();
59 70
         this.config = config;
60 71
         this.domain = domain;
@@ -113,4 +124,78 @@ public class IdentdManager {
113 124
             }
114 125
     }
115 126
 
127
+
128
+
129
+    @Handler
130
+    public void showConfig(final ClientPrefsOpenedEvent event) {
131
+        final PreferencesDialogModel manager = event.getModel();
132
+        final PreferencesCategory general = new PluginPreferencesCategory(
133
+                pluginInfo, "Identd",
134
+                "General Identd Plugin config ('Lower' options take priority "
135
+                        + "over those above them)");
136
+        final PreferencesCategory advanced = new PluginPreferencesCategory(
137
+                pluginInfo, "Advanced",
138
+                "Advanced Identd Plugin config - Only edit these if you need "
139
+                        + "to/know what you are doing. Editing these could prevent "
140
+                        + "access to some servers. ('Lower' options take priority over "
141
+                        + "those above them)");
142
+
143
+        general.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
144
+                domain, "general.useUsername", "Use connection "
145
+                + "username rather than system username", "If this is enabled,"
146
+                + " the username for the connection will be used rather than '"
147
+                + System.getProperty("user.name") + '\'',
148
+                manager.getConfigManager(), manager.getIdentity()));
149
+        general.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
150
+                domain, "general.useNickname", "Use connection "
151
+                + "nickname rather than system username", "If this is enabled, "
152
+                + "the nickname for the connection will be used rather than '"
153
+                + System.getProperty("user.name") + '\'',
154
+                manager.getConfigManager(), manager.getIdentity()));
155
+        general.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
156
+                domain, "general.useCustomName", "Use custom name" + " all the time",
157
+                "If this is enabled, the name specified below" + " will be used all the time",
158
+                manager.getConfigManager(),
159
+                manager.getIdentity()));
160
+        general.addSetting(new PreferencesSetting(PreferencesType.TEXT,
161
+                domain, "general.customName", "Custom Name to use",
162
+                "The custom name to use when 'Use Custom Name' is enabled",
163
+                manager.getConfigManager(), manager.getIdentity()));
164
+        advanced.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
165
+                domain, "advanced.alwaysOn", "Always have ident " + "port open",
166
+                "By default the identd only runs when there are "
167
+                        + "active connection attempts. This overrides that.",
168
+                manager.getConfigManager(), manager.getIdentity()));
169
+        advanced.addSetting(new PreferencesSetting(PreferencesType.INTEGER,
170
+                new PortValidator(), domain, "advanced.port",
171
+                "What port should the identd listen on", "Default port is 113,"
172
+                + " this is probably useless if changed unless you port forward"
173
+                + " ident to a different port", manager.getConfigManager(),
174
+                manager.getIdentity()));
175
+        advanced.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
176
+                domain, "advanced.useCustomSystem", "Use custom OS",
177
+                "By default the plugin uses 'UNIX' or 'WIN32' as the system "
178
+                        + "type, this can be overridden by enabling this.",
179
+                manager.getConfigManager(), manager.getIdentity()));
180
+        advanced.addSetting(new PreferencesSetting(PreferencesType.TEXT,
181
+                domain, "advanced.customSystem", "Custom OS to use",
182
+                "The custom system to use when 'Use Custom System' is enabled",
183
+                manager.getConfigManager(), manager.getIdentity()));
184
+        advanced.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
185
+                domain, "advanced.isHiddenUser", "Respond to ident"
186
+                + " requests with HIDDEN-USER error", "By default the plugin will"
187
+                + " give a USERID response, this can force an 'ERROR :"
188
+                + " HIDDEN-USER' response instead.", manager.getConfigManager(),
189
+                manager.getIdentity()));
190
+        advanced.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
191
+                domain, "advanced.isNoUser", "Respond to ident"
192
+                + " requests with NO-USER error", "By default the plugin will"
193
+                + " give a USERID response, this can force an 'ERROR : NO-USER'"
194
+                + " response instead. (Overrides HIDDEN-USER)",
195
+                manager.getConfigManager(), manager.getIdentity()));
196
+
197
+        manager.getCategory("Plugins").addSubCategory(general);
198
+        general.addSubCategory(advanced);
199
+    }
200
+
116 201
 }

+ 0
- 71
identd/src/com/dmdirc/addons/identd/IdentdPlugin.java Ver arquivo

@@ -74,75 +74,4 @@ public class IdentdPlugin extends BasePlugin {
74 74
         identdManager.onLoad();
75 75
     }
76 76
 
77
-    @Override
78
-    public void showConfig(final PreferencesDialogModel manager) {
79
-        final PreferencesCategory general = new PluginPreferencesCategory(
80
-                pluginInfo, "Identd",
81
-                "General Identd Plugin config ('Lower' options take priority "
82
-                + "over those above them)");
83
-        final PreferencesCategory advanced = new PluginPreferencesCategory(
84
-                pluginInfo, "Advanced",
85
-                "Advanced Identd Plugin config - Only edit these if you need "
86
-                + "to/know what you are doing. Editing these could prevent "
87
-                + "access to some servers. ('Lower' options take priority over "
88
-                + "those above them)");
89
-
90
-        general.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
91
-                domain, "general.useUsername", "Use connection "
92
-                + "username rather than system username", "If this is enabled,"
93
-                + " the username for the connection will be used rather than '"
94
-                + System.getProperty("user.name") + '\'',
95
-                manager.getConfigManager(), manager.getIdentity()));
96
-        general.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
97
-                domain, "general.useNickname", "Use connection "
98
-                + "nickname rather than system username", "If this is enabled, "
99
-                + "the nickname for the connection will be used rather than '"
100
-                + System.getProperty("user.name") + '\'',
101
-                manager.getConfigManager(), manager.getIdentity()));
102
-        general.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
103
-                domain, "general.useCustomName", "Use custom name" + " all the time",
104
-                "If this is enabled, the name specified below" + " will be used all the time",
105
-                manager.getConfigManager(),
106
-                manager.getIdentity()));
107
-        general.addSetting(new PreferencesSetting(PreferencesType.TEXT,
108
-                domain, "general.customName", "Custom Name to use",
109
-                "The custom name to use when 'Use Custom Name' is enabled",
110
-                manager.getConfigManager(), manager.getIdentity()));
111
-        advanced.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
112
-                domain, "advanced.alwaysOn", "Always have ident " + "port open",
113
-                "By default the identd only runs when there are "
114
-                + "active connection attempts. This overrides that.",
115
-                manager.getConfigManager(), manager.getIdentity()));
116
-        advanced.addSetting(new PreferencesSetting(PreferencesType.INTEGER,
117
-                new PortValidator(), domain, "advanced.port",
118
-                "What port should the identd listen on", "Default port is 113,"
119
-                + " this is probably useless if changed unless you port forward"
120
-                + " ident to a different port", manager.getConfigManager(),
121
-                manager.getIdentity()));
122
-        advanced.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
123
-                domain, "advanced.useCustomSystem", "Use custom OS",
124
-                "By default the plugin uses 'UNIX' or 'WIN32' as the system "
125
-                + "type, this can be overridden by enabling this.",
126
-                manager.getConfigManager(), manager.getIdentity()));
127
-        advanced.addSetting(new PreferencesSetting(PreferencesType.TEXT,
128
-                domain, "advanced.customSystem", "Custom OS to use",
129
-                "The custom system to use when 'Use Custom System' is enabled",
130
-                manager.getConfigManager(), manager.getIdentity()));
131
-        advanced.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
132
-                domain, "advanced.isHiddenUser", "Respond to ident"
133
-                + " requests with HIDDEN-USER error", "By default the plugin will"
134
-                + " give a USERID response, this can force an 'ERROR :"
135
-                + " HIDDEN-USER' response instead.", manager.getConfigManager(),
136
-                manager.getIdentity()));
137
-        advanced.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
138
-                domain, "advanced.isNoUser", "Respond to ident"
139
-                + " requests with NO-USER error", "By default the plugin will"
140
-                + " give a USERID response, this can force an 'ERROR : NO-USER'"
141
-                + " response instead. (Overrides HIDDEN-USER)",
142
-                manager.getConfigManager(), manager.getIdentity()));
143
-
144
-        manager.getCategory("Plugins").addSubCategory(general);
145
-        general.addSubCategory(advanced);
146
-    }
147
-
148 77
 }

+ 37
- 0
lagdisplay/src/com/dmdirc/addons/lagdisplay/LagDisplayManager.java Ver arquivo

@@ -31,6 +31,12 @@ import com.dmdirc.addons.ui_swing.components.frames.TextFrame;
31 31
 import com.dmdirc.addons.ui_swing.events.SwingEventBus;
32 32
 import com.dmdirc.addons.ui_swing.events.SwingWindowSelectedEvent;
33 33
 import com.dmdirc.addons.ui_swing.interfaces.ActiveFrameManager;
34
+import com.dmdirc.config.prefs.PluginPreferencesCategory;
35
+import com.dmdirc.config.prefs.PreferencesCategory;
36
+import com.dmdirc.config.prefs.PreferencesDialogModel;
37
+import com.dmdirc.config.prefs.PreferencesSetting;
38
+import com.dmdirc.config.prefs.PreferencesType;
39
+import com.dmdirc.events.ClientPrefsOpenedEvent;
34 40
 import com.dmdirc.events.ServerDisconnectedEvent;
35 41
 import com.dmdirc.events.ServerGotPingEvent;
36 42
 import com.dmdirc.events.ServerNoPingEvent;
@@ -42,6 +48,7 @@ import com.dmdirc.interfaces.Connection;
42 48
 import com.dmdirc.interfaces.config.AggregateConfigProvider;
43 49
 import com.dmdirc.interfaces.config.ConfigChangeListener;
44 50
 import com.dmdirc.plugins.PluginDomain;
51
+import com.dmdirc.plugins.PluginInfo;
45 52
 import com.dmdirc.util.collections.RollingList;
46 53
 
47 54
 import java.util.Date;
@@ -71,6 +78,7 @@ public class LagDisplayManager implements ConfigChangeListener {
71 78
     private final Provider<LagDisplayPanel> panelProvider;
72 79
     /** The settings domain to use. */
73 80
     private final String domain;
81
+    private final PluginInfo pluginInfo;
74 82
     /** Config to read global settings from. */
75 83
     private final AggregateConfigProvider globalConfig;
76 84
     /** A cache of ping times. */
@@ -92,12 +100,14 @@ public class LagDisplayManager implements ConfigChangeListener {
92 100
             final ActiveFrameManager activeFrameManager,
93 101
             final Provider<LagDisplayPanel> panelProvider,
94 102
             @PluginDomain(LagDisplayPlugin.class) final String domain,
103
+            @PluginDomain(LagDisplayPlugin.class) final PluginInfo pluginInfo,
95 104
             @GlobalConfig final AggregateConfigProvider globalConfig) {
96 105
         this.eventBus = eventBus;
97 106
         this.swingEventBus = swingEventBus;
98 107
         this.activeFrameManager = activeFrameManager;
99 108
         this.panelProvider = panelProvider;
100 109
         this.domain = domain;
110
+        this.pluginInfo = pluginInfo;
101 111
         this.globalConfig = globalConfig;
102 112
     }
103 113
 
@@ -299,4 +309,31 @@ public class LagDisplayManager implements ConfigChangeListener {
299 309
                 .filter(connection::equals).isPresent();
300 310
     }
301 311
 
312
+
313
+
314
+    @Handler
315
+    public void showConfig(final ClientPrefsOpenedEvent event) {
316
+        final PreferencesDialogModel manager = event.getModel();
317
+        final PreferencesCategory cat = new PluginPreferencesCategory(
318
+                pluginInfo, "Lag display plugin", "");
319
+        cat.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
320
+                pluginInfo.getDomain(), "usealternate",
321
+                "Alternate method", "Use an alternate method of determining "
322
+                + "lag which bypasses bouncers or proxies that may reply?",
323
+                manager.getConfigManager(), manager.getIdentity()));
324
+        cat.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
325
+                pluginInfo.getDomain(), "graph", "Show graph", "Show a graph of ping times "
326
+                + "for the current server in the information popup?",
327
+                manager.getConfigManager(), manager.getIdentity()));
328
+        cat.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
329
+                pluginInfo.getDomain(), "labels", "Show labels", "Show labels on selected "
330
+                + "points on the ping graph?",
331
+                manager.getConfigManager(), manager.getIdentity()));
332
+        cat.addSetting(new PreferencesSetting(PreferencesType.INTEGER,
333
+                pluginInfo.getDomain(), "history", "Graph points", "Number of data points "
334
+                + "to plot on the graph, if enabled.",
335
+                manager.getConfigManager(), manager.getIdentity()));
336
+        manager.getCategory("Plugins").addSubCategory(cat);
337
+    }
338
+
302 339
 }

+ 11
- 5
lagdisplay/src/com/dmdirc/addons/lagdisplay/LagDisplayModule.java Ver arquivo

@@ -24,6 +24,7 @@ package com.dmdirc.addons.lagdisplay;
24 24
 
25 25
 import com.dmdirc.addons.ui_swing.injection.SwingModule;
26 26
 import com.dmdirc.plugins.PluginDomain;
27
+import com.dmdirc.plugins.PluginInfo;
27 28
 
28 29
 import dagger.Module;
29 30
 import dagger.Provides;
@@ -34,17 +35,22 @@ import dagger.Provides;
34 35
 @Module(injects = LagDisplayManager.class, addsTo = SwingModule.class)
35 36
 public class LagDisplayModule {
36 37
 
37
-    /** The domain for plugin settings. */
38
-    private final String domain;
38
+    private final PluginInfo pluginInfo;
39 39
 
40
-    public LagDisplayModule(final String domain) {
41
-        this.domain = domain;
40
+    public LagDisplayModule(final PluginInfo pluginInfo) {
41
+        this.pluginInfo = pluginInfo;
42 42
     }
43 43
 
44 44
     @Provides
45 45
     @PluginDomain(LagDisplayPlugin.class)
46 46
     public String getDomain() {
47
-        return domain;
47
+        return pluginInfo.getDomain();
48
+    }
49
+
50
+    @Provides
51
+    @PluginDomain(LagDisplayPlugin.class)
52
+    public PluginInfo getPluginInfo() {
53
+        return pluginInfo;
48 54
     }
49 55
 
50 56
 }

+ 1
- 42
lagdisplay/src/com/dmdirc/addons/lagdisplay/LagDisplayPlugin.java Ver arquivo

@@ -22,11 +22,6 @@
22 22
 
23 23
 package com.dmdirc.addons.lagdisplay;
24 24
 
25
-import com.dmdirc.config.prefs.PluginPreferencesCategory;
26
-import com.dmdirc.config.prefs.PreferencesCategory;
27
-import com.dmdirc.config.prefs.PreferencesDialogModel;
28
-import com.dmdirc.config.prefs.PreferencesSetting;
29
-import com.dmdirc.config.prefs.PreferencesType;
30 25
 import com.dmdirc.plugins.PluginInfo;
31 26
 import com.dmdirc.plugins.implementations.BasePlugin;
32 27
 
@@ -37,25 +32,14 @@ import dagger.ObjectGraph;
37 32
  */
38 33
 public final class LagDisplayPlugin extends BasePlugin {
39 34
 
40
-    /** This plugin's plugin info. */
41
-    private final PluginInfo pluginInfo;
42 35
     /** The manager currently in use. */
43 36
     private LagDisplayManager manager;
44 37
 
45
-    /**
46
-     * Creates a new LagDisplayPlugin.
47
-     *
48
-     * @param pluginInfo This plugin's plugin info
49
-     */
50
-    public LagDisplayPlugin(final PluginInfo pluginInfo) {
51
-        this.pluginInfo = pluginInfo;
52
-    }
53
-
54 38
     @Override
55 39
     public void load(final PluginInfo pluginInfo, final ObjectGraph graph) {
56 40
         super.load(pluginInfo, graph);
57 41
 
58
-        setObjectGraph(graph.plus(new LagDisplayModule(pluginInfo.getDomain())));
42
+        setObjectGraph(graph.plus(new LagDisplayModule(pluginInfo)));
59 43
         manager = getObjectGraph().get(LagDisplayManager.class);
60 44
     }
61 45
 
@@ -68,29 +52,4 @@ public final class LagDisplayPlugin extends BasePlugin {
68 52
     public void onUnload() {
69 53
         manager.unload();
70 54
     }
71
-
72
-    @Override
73
-    public void showConfig(final PreferencesDialogModel manager) {
74
-        final PreferencesCategory cat = new PluginPreferencesCategory(
75
-                pluginInfo, "Lag display plugin", "");
76
-        cat.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
77
-                pluginInfo.getDomain(), "usealternate",
78
-                "Alternate method", "Use an alternate method of determining "
79
-                + "lag which bypasses bouncers or proxies that may reply?",
80
-                manager.getConfigManager(), manager.getIdentity()));
81
-        cat.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
82
-                pluginInfo.getDomain(), "graph", "Show graph", "Show a graph of ping times "
83
-                + "for the current server in the information popup?",
84
-                manager.getConfigManager(), manager.getIdentity()));
85
-        cat.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
86
-                pluginInfo.getDomain(), "labels", "Show labels", "Show labels on selected "
87
-                + "points on the ping graph?",
88
-                manager.getConfigManager(), manager.getIdentity()));
89
-        cat.addSetting(new PreferencesSetting(PreferencesType.INTEGER,
90
-                pluginInfo.getDomain(), "history", "Graph points", "Number of data points "
91
-                + "to plot on the graph, if enabled.",
92
-                manager.getConfigManager(), manager.getIdentity()));
93
-        manager.getCategory("Plugins").addSubCategory(cat);
94
-    }
95
-
96 55
 }

+ 87
- 0
logging/src/com/dmdirc/addons/logging/LoggingManager.java Ver arquivo

@@ -27,6 +27,11 @@ import com.dmdirc.DMDircMBassador;
27 27
 import com.dmdirc.FrameContainer;
28 28
 import com.dmdirc.Query;
29 29
 import com.dmdirc.commandline.CommandLineOptionsModule.Directory;
30
+import com.dmdirc.config.prefs.PluginPreferencesCategory;
31
+import com.dmdirc.config.prefs.PreferencesCategory;
32
+import com.dmdirc.config.prefs.PreferencesDialogModel;
33
+import com.dmdirc.config.prefs.PreferencesSetting;
34
+import com.dmdirc.config.prefs.PreferencesType;
30 35
 import com.dmdirc.events.BaseChannelActionEvent;
31 36
 import com.dmdirc.events.BaseChannelMessageEvent;
32 37
 import com.dmdirc.events.BaseQueryActionEvent;
@@ -41,6 +46,7 @@ import com.dmdirc.events.ChannelOpenedEvent;
41 46
 import com.dmdirc.events.ChannelPartEvent;
42 47
 import com.dmdirc.events.ChannelQuitEvent;
43 48
 import com.dmdirc.events.ChannelTopicChangeEvent;
49
+import com.dmdirc.events.ClientPrefsOpenedEvent;
44 50
 import com.dmdirc.events.QueryClosedEvent;
45 51
 import com.dmdirc.events.QueryOpenedEvent;
46 52
 import com.dmdirc.events.UserErrorEvent;
@@ -52,6 +58,7 @@ import com.dmdirc.interfaces.config.AggregateConfigProvider;
52 58
 import com.dmdirc.interfaces.config.ConfigChangeListener;
53 59
 import com.dmdirc.logger.ErrorLevel;
54 60
 import com.dmdirc.plugins.PluginDomain;
61
+import com.dmdirc.plugins.PluginInfo;
55 62
 import com.dmdirc.ui.WindowManager;
56 63
 import com.dmdirc.ui.messages.BackBufferFactory;
57 64
 import com.dmdirc.ui.messages.Styliser;
@@ -97,6 +104,7 @@ public class LoggingManager implements ConfigChangeListener {
97 104
     private static final Object FORMAT_LOCK = new Object();
98 105
     /** This plugin's plugin info. */
99 106
     private final String domain;
107
+    private final PluginInfo pluginInfo;
100 108
     /** Global config. */
101 109
     private final AggregateConfigProvider config;
102 110
     /** The manager to add history windows to. */
@@ -125,12 +133,14 @@ public class LoggingManager implements ConfigChangeListener {
125 133
 
126 134
     @Inject
127 135
     public LoggingManager(@PluginDomain(LoggingPlugin.class) final String domain,
136
+            @PluginDomain(LoggingPlugin.class) final PluginInfo pluginInfo,
128 137
             @GlobalConfig final AggregateConfigProvider globalConfig,
129 138
             final WindowManager windowManager, final DMDircMBassador eventBus,
130 139
             @Directory(LoggingModule.LOGS_DIRECTORY) final Provider<String> directoryProvider,
131 140
             final BackBufferFactory backBufferFactory,
132 141
             final LogFileLocator locator) {
133 142
         this.domain = domain;
143
+        this.pluginInfo = pluginInfo;
134 144
         this.config = globalConfig;
135 145
         this.windowManager = windowManager;
136 146
         this.eventBus = eventBus;
@@ -603,6 +613,83 @@ public class LoggingManager implements ConfigChangeListener {
603 613
         backbufferLines = config.getOptionInt(domain, "backbuffer.lines");
604 614
     }
605 615
 
616
+    @Handler
617
+    public void showConfig(final ClientPrefsOpenedEvent event) {
618
+        final PreferencesDialogModel manager = event.getModel();
619
+        final PreferencesCategory general = new PluginPreferencesCategory(
620
+                pluginInfo, "Logging", "General configuration for Logging plugin.");
621
+        final PreferencesCategory backbuffer = new PluginPreferencesCategory(
622
+                pluginInfo, "Back Buffer", "Options related to the automatic backbuffer");
623
+        final PreferencesCategory advanced = new PluginPreferencesCategory(
624
+                pluginInfo, "Advanced",
625
+                "Advanced configuration for Logging plugin. You shouldn't need to edit this unless you know what you are doing.");
626
+
627
+        general.addSetting(new PreferencesSetting(PreferencesType.DIRECTORY,
628
+                pluginInfo.getDomain(), "general.directory", "Directory",
629
+                "Directory for log files", manager.getConfigManager(),
630
+                manager.getIdentity()));
631
+        general.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
632
+                pluginInfo.getDomain(), "general.networkfolders",
633
+                "Separate logs by network",
634
+                "Should the files be stored in a sub-dir with the networks name?",
635
+                manager.getConfigManager(), manager.getIdentity()));
636
+        general.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
637
+                pluginInfo.getDomain(), "general.addtime", "Timestamp logs",
638
+                "Should a timestamp be added to the log files?",
639
+                manager.getConfigManager(), manager.getIdentity()));
640
+        general.addSetting(new PreferencesSetting(PreferencesType.TEXT,
641
+                pluginInfo.getDomain(), "general.timestamp", "Timestamp format",
642
+                "The String to pass to 'SimpleDateFormat' to format the timestamp",
643
+                manager.getConfigManager(), manager.getIdentity()));
644
+        general.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
645
+                pluginInfo.getDomain(), "general.stripcodes", "Strip Control Codes",
646
+                "Remove known irc control codes from lines before saving?",
647
+                manager.getConfigManager(), manager.getIdentity()));
648
+        general.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
649
+                pluginInfo.getDomain(), "general.channelmodeprefix",
650
+                "Show channel mode prefix", "Show the @,+ etc next to nicknames",
651
+                manager.getConfigManager(), manager.getIdentity()));
652
+
653
+        backbuffer.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
654
+                pluginInfo.getDomain(), "backbuffer.autobackbuffer", "Automatically display",
655
+                "Automatically display the backbuffer when a channel is joined",
656
+                manager.getConfigManager(), manager.getIdentity()));
657
+        backbuffer.addSetting(new PreferencesSetting(PreferencesType.COLOUR,
658
+                pluginInfo.getDomain(), "backbuffer.colour", "Colour to use for display",
659
+                "Colour used when displaying the backbuffer",
660
+                manager.getConfigManager(), manager.getIdentity()));
661
+        backbuffer.addSetting(new PreferencesSetting(PreferencesType.INTEGER,
662
+                pluginInfo.getDomain(), "backbuffer.lines", "Number of lines to show",
663
+                "Number of lines used when displaying backbuffer",
664
+                manager.getConfigManager(), manager.getIdentity()));
665
+        backbuffer.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
666
+                pluginInfo.getDomain(), "backbuffer.timestamp", "Show Formatter-Timestamp",
667
+                "Should the line be added to the frame with the timestamp from "
668
+                        + "the formatter aswell as the file contents",
669
+                manager.getConfigManager(), manager.getIdentity()));
670
+
671
+        advanced.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
672
+                pluginInfo.getDomain(), "advanced.filenamehash", "Add Filename hash",
673
+                "Add the MD5 hash of the channel/client name to the filename. "
674
+                        + "(This is used to allow channels with similar names "
675
+                        + "(ie a _ not a  -) to be logged separately)",
676
+                manager.getConfigManager(), manager.getIdentity()));
677
+
678
+        advanced.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
679
+                pluginInfo.getDomain(), "advanced.usedate", "Use Date directories",
680
+                "Should the log files be in separate directories based on the date?",
681
+                manager.getConfigManager(), manager.getIdentity()));
682
+        advanced.addSetting(new PreferencesSetting(PreferencesType.TEXT,
683
+                pluginInfo.getDomain(), "advanced.usedateformat", "Archive format",
684
+                "The String to pass to 'SimpleDateFormat' to format the "
685
+                        + "directory name(s) for archiving",
686
+                manager.getConfigManager(), manager.getIdentity()));
687
+
688
+        general.addSubCategory(backbuffer.setInline());
689
+        general.addSubCategory(advanced.setInline());
690
+        manager.getCategory("Plugins").addSubCategory(general.setInlineAfter());
691
+    }
692
+
606 693
     /** Open File. */
607 694
     private static class OpenFile {
608 695
 

+ 11
- 4
logging/src/com/dmdirc/addons/logging/LoggingModule.java Ver arquivo

@@ -30,6 +30,7 @@ import com.dmdirc.commandline.CommandLineOptionsModule.DirectoryType;
30 30
 import com.dmdirc.interfaces.config.AggregateConfigProvider;
31 31
 import com.dmdirc.interfaces.config.ConfigProvider;
32 32
 import com.dmdirc.plugins.PluginDomain;
33
+import com.dmdirc.plugins.PluginInfo;
33 34
 
34 35
 import java.io.File;
35 36
 
@@ -44,16 +45,16 @@ public class LoggingModule {
44 45
 
45 46
     public static final String LOGS_DIRECTORY = "logs";
46 47
 
47
-    private final String domain;
48
+    private final PluginInfo pluginInfo;
48 49
 
49
-    public LoggingModule(final String domain) {
50
-        this.domain = domain;
50
+    public LoggingModule(final PluginInfo pluginInfo) {
51
+        this.pluginInfo = pluginInfo;
51 52
     }
52 53
 
53 54
     @Provides
54 55
     @PluginDomain(LoggingPlugin.class)
55 56
     public String getDomain() {
56
-        return domain;
57
+        return pluginInfo.getDomain();
57 58
     }
58 59
 
59 60
     @Provides
@@ -72,4 +73,10 @@ public class LoggingModule {
72 73
         return globalConfig.getOptionString(domain, "general.directory");
73 74
     }
74 75
 
76
+    @Provides
77
+    @PluginDomain(LoggingPlugin.class)
78
+    public PluginInfo getPluginInfo() {
79
+        return pluginInfo;
80
+    }
81
+
75 82
 }

+ 0
- 93
logging/src/com/dmdirc/addons/logging/LoggingPlugin.java Ver arquivo

@@ -22,11 +22,6 @@
22 22
 
23 23
 package com.dmdirc.addons.logging;
24 24
 
25
-import com.dmdirc.config.prefs.PluginPreferencesCategory;
26
-import com.dmdirc.config.prefs.PreferencesCategory;
27
-import com.dmdirc.config.prefs.PreferencesDialogModel;
28
-import com.dmdirc.config.prefs.PreferencesSetting;
29
-import com.dmdirc.config.prefs.PreferencesType;
30 25
 import com.dmdirc.plugins.PluginInfo;
31 26
 import com.dmdirc.plugins.implementations.BaseCommandPlugin;
32 27
 
@@ -37,21 +32,9 @@ import dagger.ObjectGraph;
37 32
  */
38 33
 public class LoggingPlugin extends BaseCommandPlugin {
39 34
 
40
-    /** This plugin's plugin info. */
41
-    private final PluginInfo pluginInfo;
42
-
43 35
     /** The manager in use. */
44 36
     private LoggingManager manager;
45 37
 
46
-    /**
47
-     * Creates a new instance of this plugin.
48
-     *
49
-     * @param pluginInfo This plugin's plugin info
50
-     */
51
-    public LoggingPlugin(final PluginInfo pluginInfo) {
52
-        this.pluginInfo = pluginInfo;
53
-    }
54
-
55 38
     @Override
56 39
     public void load(final PluginInfo pluginInfo, final ObjectGraph graph) {
57 40
         super.load(pluginInfo, graph);
@@ -74,80 +57,4 @@ public class LoggingPlugin extends BaseCommandPlugin {
74 57
         manager.unload();
75 58
     }
76 59
 
77
-    @Override
78
-    public void showConfig(final PreferencesDialogModel manager) {
79
-        final PreferencesCategory general = new PluginPreferencesCategory(
80
-                pluginInfo, "Logging", "General configuration for Logging plugin.");
81
-        final PreferencesCategory backbuffer = new PluginPreferencesCategory(
82
-                pluginInfo, "Back Buffer", "Options related to the automatic backbuffer");
83
-        final PreferencesCategory advanced = new PluginPreferencesCategory(
84
-                pluginInfo, "Advanced",
85
-                "Advanced configuration for Logging plugin. You shouldn't need to edit this unless you know what you are doing.");
86
-
87
-        general.addSetting(new PreferencesSetting(PreferencesType.DIRECTORY,
88
-                pluginInfo.getDomain(), "general.directory", "Directory",
89
-                "Directory for log files", manager.getConfigManager(),
90
-                manager.getIdentity()));
91
-        general.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
92
-                pluginInfo.getDomain(), "general.networkfolders",
93
-                "Separate logs by network",
94
-                "Should the files be stored in a sub-dir with the networks name?",
95
-                manager.getConfigManager(), manager.getIdentity()));
96
-        general.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
97
-                pluginInfo.getDomain(), "general.addtime", "Timestamp logs",
98
-                "Should a timestamp be added to the log files?",
99
-                manager.getConfigManager(), manager.getIdentity()));
100
-        general.addSetting(new PreferencesSetting(PreferencesType.TEXT,
101
-                pluginInfo.getDomain(), "general.timestamp", "Timestamp format",
102
-                "The String to pass to 'SimpleDateFormat' to format the timestamp",
103
-                manager.getConfigManager(), manager.getIdentity()));
104
-        general.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
105
-                pluginInfo.getDomain(), "general.stripcodes", "Strip Control Codes",
106
-                "Remove known irc control codes from lines before saving?",
107
-                manager.getConfigManager(), manager.getIdentity()));
108
-        general.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
109
-                pluginInfo.getDomain(), "general.channelmodeprefix",
110
-                "Show channel mode prefix", "Show the @,+ etc next to nicknames",
111
-                manager.getConfigManager(), manager.getIdentity()));
112
-
113
-        backbuffer.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
114
-                pluginInfo.getDomain(), "backbuffer.autobackbuffer", "Automatically display",
115
-                "Automatically display the backbuffer when a channel is joined",
116
-                manager.getConfigManager(), manager.getIdentity()));
117
-        backbuffer.addSetting(new PreferencesSetting(PreferencesType.COLOUR,
118
-                pluginInfo.getDomain(), "backbuffer.colour", "Colour to use for display",
119
-                "Colour used when displaying the backbuffer",
120
-                manager.getConfigManager(), manager.getIdentity()));
121
-        backbuffer.addSetting(new PreferencesSetting(PreferencesType.INTEGER,
122
-                pluginInfo.getDomain(), "backbuffer.lines", "Number of lines to show",
123
-                "Number of lines used when displaying backbuffer",
124
-                manager.getConfigManager(), manager.getIdentity()));
125
-        backbuffer.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
126
-                pluginInfo.getDomain(), "backbuffer.timestamp", "Show Formatter-Timestamp",
127
-                "Should the line be added to the frame with the timestamp from "
128
-                + "the formatter aswell as the file contents",
129
-                manager.getConfigManager(), manager.getIdentity()));
130
-
131
-        advanced.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
132
-                pluginInfo.getDomain(), "advanced.filenamehash", "Add Filename hash",
133
-                "Add the MD5 hash of the channel/client name to the filename. "
134
-                + "(This is used to allow channels with similar names "
135
-                + "(ie a _ not a  -) to be logged separately)",
136
-                manager.getConfigManager(), manager.getIdentity()));
137
-
138
-        advanced.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
139
-                pluginInfo.getDomain(), "advanced.usedate", "Use Date directories",
140
-                "Should the log files be in separate directories based on the date?",
141
-                manager.getConfigManager(), manager.getIdentity()));
142
-        advanced.addSetting(new PreferencesSetting(PreferencesType.TEXT,
143
-                pluginInfo.getDomain(), "advanced.usedateformat", "Archive format",
144
-                "The String to pass to 'SimpleDateFormat' to format the "
145
-                + "directory name(s) for archiving",
146
-                manager.getConfigManager(), manager.getIdentity()));
147
-
148
-        general.addSubCategory(backbuffer.setInline());
149
-        general.addSubCategory(advanced.setInline());
150
-        manager.getCategory("Plugins").addSubCategory(general.setInlineAfter());
151
-    }
152
-
153 60
 }

+ 26
- 0
systray/src/com/dmdirc/addons/systray/SystrayManager.java Ver arquivo

@@ -25,10 +25,17 @@ package com.dmdirc.addons.systray;
25 25
 import com.dmdirc.ClientModule.GlobalConfig;
26 26
 import com.dmdirc.DMDircMBassador;
27 27
 import com.dmdirc.addons.ui_swing.MainFrame;
28
+import com.dmdirc.config.prefs.PluginPreferencesCategory;
29
+import com.dmdirc.config.prefs.PreferencesCategory;
30
+import com.dmdirc.config.prefs.PreferencesDialogModel;
31
+import com.dmdirc.config.prefs.PreferencesSetting;
32
+import com.dmdirc.config.prefs.PreferencesType;
28 33
 import com.dmdirc.events.ClientMinimisedEvent;
34
+import com.dmdirc.events.ClientPrefsOpenedEvent;
29 35
 import com.dmdirc.interfaces.config.AggregateConfigProvider;
30 36
 import com.dmdirc.plugins.PluginDomain;
31 37
 import com.dmdirc.addons.ui_swing.components.IconManager;
38
+import com.dmdirc.plugins.PluginInfo;
32 39
 import com.dmdirc.ui.messages.Styliser;
33 40
 
34 41
 import java.awt.AWTException;
@@ -48,6 +55,7 @@ import net.engio.mbassy.listener.Handler;
48 55
 
49 56
 public class SystrayManager implements ActionListener, MouseListener {
50 57
 
58
+    private final PluginInfo pluginInfo;
51 59
     /** Main frame instance. */
52 60
     private final MainFrame mainFrame;
53 61
     /** This plugin's settings domain. */
@@ -65,11 +73,13 @@ public class SystrayManager implements ActionListener, MouseListener {
65 73
     public SystrayManager(
66 74
             @GlobalConfig final AggregateConfigProvider globalConfig,
67 75
             @PluginDomain(SystrayPlugin.class) final String domain,
76
+            @PluginDomain(SystrayPlugin.class) final PluginInfo pluginInfo,
68 77
             final MainFrame mainFrame,
69 78
             final IconManager iconManager,
70 79
             final DMDircMBassador eventBus) {
71 80
         this.globalConfig = globalConfig;
72 81
         this.domain = domain;
82
+        this.pluginInfo = pluginInfo;
73 83
         this.mainFrame = mainFrame;
74 84
         this.iconManager = iconManager;
75 85
         this.eventBus = eventBus;
@@ -158,6 +168,22 @@ public class SystrayManager implements ActionListener, MouseListener {
158 168
         }
159 169
     }
160 170
 
171
+    @Handler
172
+    public void showConfig(final ClientPrefsOpenedEvent event) {
173
+        final PreferencesDialogModel manager = event.getModel();
174
+        final PreferencesCategory category = new PluginPreferencesCategory(
175
+                pluginInfo, "System Tray",
176
+                "General configuration settings");
177
+
178
+        category.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
179
+                pluginInfo.getDomain(), "autominimise", "Auto-hide DMDirc when minimised",
180
+                "If this option is enabled, the systray plugin will hide DMDirc"
181
+                        + " to the system tray whenever DMDirc is minimised",
182
+                manager.getConfigManager(), manager.getIdentity()));
183
+
184
+        manager.getCategory("Plugins").addSubCategory(category);
185
+    }
186
+
161 187
     @Override
162 188
     public void mousePressed(final MouseEvent e) {
163 189
         //Ignore

+ 6
- 0
systray/src/com/dmdirc/addons/systray/SystrayModule.java Ver arquivo

@@ -44,4 +44,10 @@ public class SystrayModule {
44 44
         return pluginInfo.getDomain();
45 45
     }
46 46
 
47
+    @Provides
48
+    @PluginDomain(SystrayPlugin.class)
49
+    public PluginInfo getPluginInfo() {
50
+        return pluginInfo;
51
+    }
52
+
47 53
 }

+ 0
- 32
systray/src/com/dmdirc/addons/systray/SystrayPlugin.java Ver arquivo

@@ -22,11 +22,6 @@
22 22
 
23 23
 package com.dmdirc.addons.systray;
24 24
 
25
-import com.dmdirc.config.prefs.PluginPreferencesCategory;
26
-import com.dmdirc.config.prefs.PreferencesCategory;
27
-import com.dmdirc.config.prefs.PreferencesDialogModel;
28
-import com.dmdirc.config.prefs.PreferencesSetting;
29
-import com.dmdirc.config.prefs.PreferencesType;
30 25
 import com.dmdirc.plugins.Exported;
31 26
 import com.dmdirc.plugins.PluginInfo;
32 27
 import com.dmdirc.plugins.implementations.BaseCommandPlugin;
@@ -42,20 +37,9 @@ import dagger.ObjectGraph;
42 37
  */
43 38
 public class SystrayPlugin extends BaseCommandPlugin {
44 39
 
45
-    /** This plugin's plugin info. */
46
-    private final PluginInfo pluginInfo;
47 40
     /** Systray manager. */
48 41
     private SystrayManager manager;
49 42
 
50
-    /**
51
-     * Creates a new system tray plugin.
52
-     *
53
-     * @param pluginInfo This plugin's plugin info.
54
-     */
55
-    public SystrayPlugin(final PluginInfo pluginInfo) {
56
-        this.pluginInfo = pluginInfo;
57
-    }
58
-
59 43
     @Override
60 44
     public void load(final PluginInfo pluginInfo, final ObjectGraph graph) {
61 45
         super.load(pluginInfo, graph);
@@ -97,20 +81,4 @@ public class SystrayPlugin extends BaseCommandPlugin {
97 81
         manager.unload();
98 82
         super.onUnload();
99 83
     }
100
-
101
-    @Override
102
-    public void showConfig(final PreferencesDialogModel manager) {
103
-        final PreferencesCategory category = new PluginPreferencesCategory(
104
-                pluginInfo, "System Tray",
105
-                "General configuration settings");
106
-
107
-        category.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
108
-                pluginInfo.getDomain(), "autominimise", "Auto-hide DMDirc when minimised",
109
-                "If this option is enabled, the systray plugin will hide DMDirc"
110
-                + " to the system tray whenever DMDirc is minimised",
111
-                manager.getConfigManager(), manager.getIdentity()));
112
-
113
-        manager.getCategory("Plugins").addSubCategory(category);
114
-    }
115
-
116 84
 }

+ 1
- 42
windowflashing/src/com/dmdirc/addons/windowflashing/WindowFlashing.java Ver arquivo

@@ -22,11 +22,6 @@
22 22
 
23 23
 package com.dmdirc.addons.windowflashing;
24 24
 
25
-import com.dmdirc.config.prefs.PluginPreferencesCategory;
26
-import com.dmdirc.config.prefs.PreferencesCategory;
27
-import com.dmdirc.config.prefs.PreferencesDialogModel;
28
-import com.dmdirc.config.prefs.PreferencesSetting;
29
-import com.dmdirc.config.prefs.PreferencesType;
30 25
 import com.dmdirc.plugins.Exported;
31 26
 import com.dmdirc.plugins.PluginInfo;
32 27
 import com.dmdirc.plugins.implementations.BaseCommandPlugin;
@@ -40,19 +35,12 @@ public class WindowFlashing extends BaseCommandPlugin {
40 35
 
41 36
     /** Window flashing manager. */
42 37
     private WindowFlashingManager manager;
43
-    /** This plugin's plugin info. */
44
-    private PluginInfo pluginInfo;
45
-
46
-    public WindowFlashing(final PluginInfo pluginInfo) {
47
-        this.pluginInfo = pluginInfo;
48
-    }
49 38
 
50 39
     @Override
51 40
     public void load(final PluginInfo pluginInfo, final ObjectGraph graph) {
52 41
         super.load(pluginInfo, graph);
53
-        this.pluginInfo = pluginInfo;
54 42
 
55
-        setObjectGraph(graph.plus(new WindowFlashingModule()));
43
+        setObjectGraph(graph.plus(new WindowFlashingModule(pluginInfo)));
56 44
         registerCommand(FlashWindow.class, FlashWindow.INFO);
57 45
         manager = getObjectGraph().get(WindowFlashingManager.class);
58 46
     }
@@ -80,33 +68,4 @@ public class WindowFlashing extends BaseCommandPlugin {
80 68
         manager.onUnload();
81 69
     }
82 70
 
83
-    @Override
84
-    public void showConfig(final PreferencesDialogModel manager) {
85
-        final PreferencesCategory category = new PluginPreferencesCategory(
86
-                pluginInfo, "Window Flashing",
87
-                "General configuration for window flashing plugin.");
88
-
89
-        category.addSetting(new PreferencesSetting(
90
-                PreferencesType.OPTIONALINTEGER, pluginInfo.getDomain(), "blinkrate",
91
-                "Blink rate", "Specifies the rate at which the taskbar and or "
92
-                + "caption will blink, if unspecified this will be your cursor "
93
-                + "blink rate.",
94
-                manager.getConfigManager(), manager.getIdentity()));
95
-        category.addSetting(new PreferencesSetting(
96
-                PreferencesType.OPTIONALINTEGER, pluginInfo.getDomain(), "flashcount",
97
-                "Flash count", "Specifies the number of times to blink, if "
98
-                + "unspecified this will blink indefinitely",
99
-                manager.getConfigManager(), manager.getIdentity()));
100
-        category.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
101
-                pluginInfo.getDomain(), "flashtaskbar", "Flash taskbar",
102
-                "Should the taskbar entry flash?",
103
-                manager.getConfigManager(), manager.getIdentity()));
104
-        category.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
105
-                pluginInfo.getDomain(), "flashcaption", "Flash caption",
106
-                "Should the window caption flash?",
107
-                manager.getConfigManager(), manager.getIdentity()));
108
-
109
-        manager.getCategory("Plugins").addSubCategory(category);
110
-    }
111
-
112 71
 }

+ 43
- 0
windowflashing/src/com/dmdirc/addons/windowflashing/WindowFlashingManager.java Ver arquivo

@@ -27,8 +27,16 @@ import com.dmdirc.DMDircMBassador;
27 27
 import com.dmdirc.addons.ui_swing.MainFrame;
28 28
 import com.dmdirc.config.ConfigBinder;
29 29
 import com.dmdirc.config.ConfigBinding;
30
+import com.dmdirc.config.prefs.PluginPreferencesCategory;
31
+import com.dmdirc.config.prefs.PreferencesCategory;
32
+import com.dmdirc.config.prefs.PreferencesDialogModel;
33
+import com.dmdirc.config.prefs.PreferencesSetting;
34
+import com.dmdirc.config.prefs.PreferencesType;
30 35
 import com.dmdirc.events.ClientFocusGainedEvent;
36
+import com.dmdirc.events.ClientPrefsOpenedEvent;
31 37
 import com.dmdirc.interfaces.config.AggregateConfigProvider;
38
+import com.dmdirc.plugins.PluginDomain;
39
+import com.dmdirc.plugins.PluginInfo;
32 40
 
33 41
 import javax.inject.Inject;
34 42
 import javax.inject.Singleton;
@@ -44,6 +52,7 @@ import net.engio.mbassy.listener.Handler;
44 52
 @Singleton
45 53
 public class WindowFlashingManager {
46 54
 
55
+    private final PluginInfo pluginInfo;
47 56
     /** Swing main frame. */
48 57
     private final MainFrame mainFrame;
49 58
     /** Event bus. */
@@ -70,8 +79,10 @@ public class WindowFlashingManager {
70 79
     @Inject
71 80
     public WindowFlashingManager(
72 81
             @GlobalConfig final AggregateConfigProvider config,
82
+            @PluginDomain(WindowFlashing.class) final PluginInfo pluginInfo,
73 83
             final MainFrame mainFrame,
74 84
             final DMDircMBassador eventBus) {
85
+        this.pluginInfo = pluginInfo;
75 86
         this.mainFrame = mainFrame;
76 87
         this.eventBus = eventBus;
77 88
         binder = config.getBinder();
@@ -165,4 +176,36 @@ public class WindowFlashingManager {
165 176
         }
166 177
     }
167 178
 
179
+
180
+
181
+    @Handler
182
+    public void showConfig(final ClientPrefsOpenedEvent event) {
183
+        final PreferencesDialogModel manager = event.getModel();
184
+        final PreferencesCategory category = new PluginPreferencesCategory(
185
+                pluginInfo, "Window Flashing",
186
+                "General configuration for window flashing plugin.");
187
+
188
+        category.addSetting(new PreferencesSetting(
189
+                PreferencesType.OPTIONALINTEGER, pluginInfo.getDomain(), "blinkrate",
190
+                "Blink rate", "Specifies the rate at which the taskbar and or "
191
+                + "caption will blink, if unspecified this will be your cursor "
192
+                + "blink rate.",
193
+                manager.getConfigManager(), manager.getIdentity()));
194
+        category.addSetting(new PreferencesSetting(
195
+                PreferencesType.OPTIONALINTEGER, pluginInfo.getDomain(), "flashcount",
196
+                "Flash count", "Specifies the number of times to blink, if "
197
+                + "unspecified this will blink indefinitely",
198
+                manager.getConfigManager(), manager.getIdentity()));
199
+        category.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
200
+                pluginInfo.getDomain(), "flashtaskbar", "Flash taskbar",
201
+                "Should the taskbar entry flash?",
202
+                manager.getConfigManager(), manager.getIdentity()));
203
+        category.addSetting(new PreferencesSetting(PreferencesType.BOOLEAN,
204
+                pluginInfo.getDomain(), "flashcaption", "Flash caption",
205
+                "Should the window caption flash?",
206
+                manager.getConfigManager(), manager.getIdentity()));
207
+
208
+        manager.getCategory("Plugins").addSubCategory(category);
209
+    }
210
+
168 211
 }

+ 15
- 0
windowflashing/src/com/dmdirc/addons/windowflashing/WindowFlashingModule.java Ver arquivo

@@ -23,12 +23,27 @@
23 23
 package com.dmdirc.addons.windowflashing;
24 24
 
25 25
 import com.dmdirc.addons.ui_swing.injection.SwingModule;
26
+import com.dmdirc.plugins.PluginDomain;
27
+import com.dmdirc.plugins.PluginInfo;
26 28
 
27 29
 import dagger.Module;
30
+import dagger.Provides;
28 31
 
29 32
 /**
30 33
  * DI Module for the window flashing module.
31 34
  */
32 35
 @Module(injects = {WindowFlashingManager.class, FlashWindow.class}, addsTo = SwingModule.class)
33 36
 public class WindowFlashingModule {
37
+
38
+    private final PluginInfo pluginInfo;
39
+
40
+    public WindowFlashingModule(final PluginInfo pluginInfo) {
41
+        this.pluginInfo = pluginInfo;
42
+    }
43
+
44
+    @Provides
45
+    @PluginDomain(WindowFlashing.class)
46
+    public PluginInfo getPluginInfo() {
47
+        return pluginInfo;
48
+    }
34 49
 }

Carregando…
Cancelar
Salvar