|
@@ -30,13 +30,13 @@ import com.dmdirc.addons.ui_swing.SelectionListener;
|
30
|
30
|
import com.dmdirc.addons.ui_swing.SwingController;
|
31
|
31
|
import com.dmdirc.addons.ui_swing.UIUtilities;
|
32
|
32
|
import com.dmdirc.addons.ui_swing.components.frames.TextFrame;
|
33
|
|
-import com.dmdirc.config.IdentityManager;
|
34
|
33
|
import com.dmdirc.config.prefs.PluginPreferencesCategory;
|
35
|
34
|
import com.dmdirc.config.prefs.PreferencesCategory;
|
36
|
35
|
import com.dmdirc.config.prefs.PreferencesDialogModel;
|
37
|
36
|
import com.dmdirc.config.prefs.PreferencesSetting;
|
38
|
37
|
import com.dmdirc.config.prefs.PreferencesType;
|
39
|
38
|
import com.dmdirc.interfaces.ConfigChangeListener;
|
|
39
|
+import com.dmdirc.interfaces.IdentityController;
|
40
|
40
|
import com.dmdirc.parser.interfaces.ChannelClientInfo;
|
41
|
41
|
import com.dmdirc.parser.interfaces.ChannelInfo;
|
42
|
42
|
import com.dmdirc.parser.interfaces.ClientInfo;
|
|
@@ -57,7 +57,9 @@ public final class WindowStatusPlugin extends BasePlugin
|
57
|
57
|
/** The panel we use in the status bar. */
|
58
|
58
|
private final WindowStatusPanel panel;
|
59
|
59
|
/** Parent Swing UI. */
|
60
|
|
- private SwingController controller;
|
|
60
|
+ private final SwingController controller;
|
|
61
|
+ /** Identity controller to read settings from. */
|
|
62
|
+ private final IdentityController identityController;
|
61
|
63
|
/** Should we show the real name in queries? */
|
62
|
64
|
private boolean showname;
|
63
|
65
|
/** Should we show users without modes? */
|
|
@@ -70,11 +72,18 @@ public final class WindowStatusPlugin extends BasePlugin
|
70
|
72
|
/**
|
71
|
73
|
* Creates a new instance of WindowStatusPlugin.
|
72
|
74
|
*
|
73
|
|
- * @param pluginInfo This plugin's plugin info
|
|
75
|
+ * @param pluginInfo This plugin's plugin info.
|
|
76
|
+ * @param controller The parent {@link SwingController}.
|
|
77
|
+ * @param identityController The controller to read settings from.
|
74
|
78
|
*/
|
75
|
|
- public WindowStatusPlugin(final PluginInfo pluginInfo) {
|
|
79
|
+ public WindowStatusPlugin(
|
|
80
|
+ final PluginInfo pluginInfo,
|
|
81
|
+ final SwingController controller,
|
|
82
|
+ final IdentityController identityController) {
|
76
|
83
|
super();
|
77
|
84
|
this.pluginInfo = pluginInfo;
|
|
85
|
+ this.controller = controller;
|
|
86
|
+ this.identityController = identityController;
|
78
|
87
|
|
79
|
88
|
panel = UIUtilities.invokeAndWait(
|
80
|
89
|
new Callable<WindowStatusPanel>() {
|
|
@@ -90,12 +99,9 @@ public final class WindowStatusPlugin extends BasePlugin
|
90
|
99
|
/** {@inheritDoc} */
|
91
|
100
|
@Override
|
92
|
101
|
public void onLoad() {
|
93
|
|
- controller = (SwingController) pluginInfo.getMetaData().getManager()
|
94
|
|
- .getPluginInfoByName("ui_swing").getPlugin();
|
95
|
102
|
controller.getSwingStatusBar().addComponent(panel);
|
96
|
103
|
controller.getMainFrame().addSelectionListener(this);
|
97
|
|
- IdentityManager.getIdentityManager().getGlobalConfiguration()
|
98
|
|
- .addChangeListener(getDomain(), this);
|
|
104
|
+ identityController.getGlobalConfiguration().addChangeListener(getDomain(), this);
|
99
|
105
|
updateCache();
|
100
|
106
|
}
|
101
|
107
|
|
|
@@ -104,7 +110,6 @@ public final class WindowStatusPlugin extends BasePlugin
|
104
|
110
|
public void onUnload() {
|
105
|
111
|
controller.getMainFrame().removeSelectionListener(this);
|
106
|
112
|
controller.getSwingStatusBar().removeComponent(panel);
|
107
|
|
- controller = null;
|
108
|
113
|
}
|
109
|
114
|
|
110
|
115
|
/** {@inheritDoc} */
|
|
@@ -115,11 +120,11 @@ public final class WindowStatusPlugin extends BasePlugin
|
115
|
120
|
|
116
|
121
|
/** Updates the cached config settings. */
|
117
|
122
|
private void updateCache() {
|
118
|
|
- showname = IdentityManager.getIdentityManager().getGlobalConfiguration()
|
|
123
|
+ showname = identityController.getGlobalConfiguration()
|
119
|
124
|
.getOptionBool(getDomain(), "client.showname");
|
120
|
|
- shownone = IdentityManager.getIdentityManager().getGlobalConfiguration()
|
|
125
|
+ shownone = identityController.getGlobalConfiguration()
|
121
|
126
|
.getOptionBool(getDomain(), "channel.shownone");
|
122
|
|
- nonePrefix = IdentityManager.getIdentityManager().getGlobalConfiguration()
|
|
127
|
+ nonePrefix = identityController.getGlobalConfiguration()
|
123
|
128
|
.getOption(getDomain(), "channel.noneprefix");
|
124
|
129
|
updateStatus();
|
125
|
130
|
}
|
|
@@ -129,7 +134,7 @@ public final class WindowStatusPlugin extends BasePlugin
|
129
|
134
|
final TextFrame active = controller.getMainFrame().getActiveFrame();
|
130
|
135
|
|
131
|
136
|
if (active != null) {
|
132
|
|
- updateStatus(active == null ? null : active.getContainer());
|
|
137
|
+ updateStatus(active.getContainer());
|
133
|
138
|
}
|
134
|
139
|
}
|
135
|
140
|
|
|
@@ -149,8 +154,8 @@ public final class WindowStatusPlugin extends BasePlugin
|
149
|
154
|
textString.append(((Server) current).getName());
|
150
|
155
|
} else if (current instanceof Channel) {
|
151
|
156
|
final ChannelInfo chan = ((Channel) current).getChannelInfo();
|
152
|
|
- final Map<Integer, String> names = new HashMap<Integer, String>();
|
153
|
|
- final Map<Integer, Integer> types = new HashMap<Integer, Integer>();
|
|
157
|
+ final Map<Integer, String> names = new HashMap<>();
|
|
158
|
+ final Map<Integer, Integer> types = new HashMap<>();
|
154
|
159
|
|
155
|
160
|
textString.append(chan.getName());
|
156
|
161
|
textString.append(" - Nicks: ");
|