|
@@ -53,7 +53,7 @@ public class OsdPlugin extends BaseCommandPlugin implements
|
53
|
53
|
/** Config OSD Window. */
|
54
|
54
|
private OsdWindow osdWindow;
|
55
|
55
|
/** The OSD Manager that this plugin is using. */
|
56
|
|
- private OsdManager osdManager;
|
|
56
|
+ private final OsdManager osdManager;
|
57
|
57
|
/** X-axis position of OSD. */
|
58
|
58
|
private int x;
|
59
|
59
|
/** Y-axis potion of OSD. */
|
|
@@ -73,6 +73,8 @@ public class OsdPlugin extends BaseCommandPlugin implements
|
73
|
73
|
private final ColourManager colourManager;
|
74
|
74
|
/** The window that the OSDs will be associated with. */
|
75
|
75
|
private final MainFrame mainFrame;
|
|
76
|
+ /** This plugin's settings domain. */
|
|
77
|
+ private final String domain;
|
76
|
78
|
|
77
|
79
|
/**
|
78
|
80
|
* Creates a new instance of this plugin.
|
|
@@ -93,46 +95,46 @@ public class OsdPlugin extends BaseCommandPlugin implements
|
93
|
95
|
this.identityController = identityController;
|
94
|
96
|
this.colourManager = colourManager;
|
95
|
97
|
this.mainFrame = swingController.getMainFrame();
|
96
|
|
- osdManager = new OsdManager(mainFrame, identityController, this, colourManager);
|
|
98
|
+ this.domain = pluginInfo.getDomain();
|
|
99
|
+ osdManager = new OsdManager(mainFrame, identityController, this, colourManager, pluginInfo);
|
97
|
100
|
registerCommand(new OsdCommand(commandController, osdManager), OsdCommand.INFO);
|
98
|
101
|
}
|
99
|
102
|
|
100
|
|
- /** {@inheritDoc} */
|
101
|
103
|
@Override
|
102
|
104
|
public void showConfig(final PreferencesDialogModel manager) {
|
103
|
105
|
x = identityController.getGlobalConfiguration()
|
104
|
|
- .getOptionInt(getDomain(), "locationX");
|
|
106
|
+ .getOptionInt(domain, "locationX");
|
105
|
107
|
y = identityController.getGlobalConfiguration()
|
106
|
|
- .getOptionInt(getDomain(), "locationY");
|
|
108
|
+ .getOptionInt(domain, "locationY");
|
107
|
109
|
|
108
|
110
|
final PreferencesCategory category = new PluginPreferencesCategory(
|
109
|
111
|
pluginInfo, "OSD",
|
110
|
112
|
"General configuration for OSD plugin.", "category-osd");
|
111
|
113
|
|
112
|
114
|
fontSizeSetting = new PreferencesSetting(PreferencesType.INTEGER,
|
113
|
|
- getDomain(), "fontSize", "Font size", "Changes the font " + "size of the OSD",
|
|
115
|
+ domain, "fontSize", "Font size", "Changes the font " + "size of the OSD",
|
114
|
116
|
manager.getConfigManager(),
|
115
|
117
|
manager.getIdentity()).registerChangeListener(this);
|
116
|
118
|
backgroundSetting = new PreferencesSetting(PreferencesType.COLOUR,
|
117
|
|
- getDomain(), "bgcolour", "Background colour",
|
|
119
|
+ domain, "bgcolour", "Background colour",
|
118
|
120
|
"Background colour for the OSD", manager.getConfigManager(),
|
119
|
121
|
manager.getIdentity()).registerChangeListener(this);
|
120
|
122
|
foregroundSetting = new PreferencesSetting(PreferencesType.COLOUR,
|
121
|
|
- getDomain(), "fgcolour", "Foreground colour",
|
|
123
|
+ domain, "fgcolour", "Foreground colour",
|
122
|
124
|
"Foreground colour for the OSD", manager.getConfigManager(),
|
123
|
125
|
manager.getIdentity()).registerChangeListener(this);
|
124
|
126
|
widthSetting = new PreferencesSetting(PreferencesType.INTEGER,
|
125
|
|
- getDomain(), "width", "OSD Width", "Width of the OSD Window",
|
|
127
|
+ domain, "width", "OSD Width", "Width of the OSD Window",
|
126
|
128
|
manager.getConfigManager(), manager.getIdentity())
|
127
|
129
|
.registerChangeListener(this);
|
128
|
130
|
timeoutSetting = new PreferencesSetting(PreferencesType.OPTIONALINTEGER,
|
129
|
131
|
new OptionalValidator(new NumericalValidator(1, Integer.MAX_VALUE)),
|
130
|
|
- getDomain(), "timeout", "Timeout", "Length of time in "
|
|
132
|
+ domain, "timeout", "Timeout", "Length of time in "
|
131
|
133
|
+ "seconds before the OSD window closes", manager.getConfigManager(),
|
132
|
134
|
manager.getIdentity());
|
133
|
135
|
maxWindowsSetting = new PreferencesSetting(PreferencesType.OPTIONALINTEGER,
|
134
|
136
|
new OptionalValidator(new NumericalValidator(1, Integer.MAX_VALUE)),
|
135
|
|
- getDomain(), "maxWindows", "Maximum open windows",
|
|
137
|
+ domain, "maxWindows", "Maximum open windows",
|
136
|
138
|
"Maximum number of OSD windows that will be displayed at any given time",
|
137
|
139
|
manager.getConfigManager(), manager.getIdentity());
|
138
|
140
|
|
|
@@ -150,7 +152,7 @@ public class OsdPlugin extends BaseCommandPlugin implements
|
150
|
152
|
posOptions.put(policy.name(), policy.getDescription());
|
151
|
153
|
}
|
152
|
154
|
|
153
|
|
- category.addSetting(new PreferencesSetting(getDomain(), "newbehaviour",
|
|
155
|
+ category.addSetting(new PreferencesSetting(domain, "newbehaviour",
|
154
|
156
|
"New window policy", "What to do when an OSD Window "
|
155
|
157
|
+ "is opened when there are other, existing windows open",
|
156
|
158
|
posOptions, manager.getConfigManager(), manager.getIdentity()));
|
|
@@ -163,10 +165,8 @@ public class OsdPlugin extends BaseCommandPlugin implements
|
163
|
165
|
/** {@inheritDoc} */
|
164
|
166
|
@Override
|
165
|
167
|
public void categorySelected(final PreferencesCategory category) {
|
166
|
|
- osdWindow = new OsdWindow(
|
167
|
|
- mainFrame,
|
168
|
|
- identityController, this, osdManager, colourManager, -1,
|
169
|
|
- "Please drag this OSD to position", true, x, y);
|
|
168
|
+ osdWindow = new OsdWindow(mainFrame, identityController, osdManager, colourManager,
|
|
169
|
+ -1, "Please drag this OSD to position", true, x, y, domain);
|
170
|
170
|
osdWindow.setBackgroundColour(backgroundSetting.getValue());
|
171
|
171
|
osdWindow.setForegroundColour(foregroundSetting.getValue());
|
172
|
172
|
osdWindow.setFontSize(Integer.parseInt(fontSizeSetting.getValue()));
|
|
@@ -185,10 +185,8 @@ public class OsdPlugin extends BaseCommandPlugin implements
|
185
|
185
|
/** {@inheritDoc} */
|
186
|
186
|
@Override
|
187
|
187
|
public void save() {
|
188
|
|
- identityController.getUserSettings()
|
189
|
|
- .setOption(getDomain(), "locationX", x);
|
190
|
|
- identityController.getUserSettings()
|
191
|
|
- .setOption(getDomain(), "locationY", y);
|
|
188
|
+ identityController.getUserSettings().setOption(domain, "locationX", x);
|
|
189
|
+ identityController.getUserSettings().setOption(domain, "locationY", y);
|
192
|
190
|
}
|
193
|
191
|
|
194
|
192
|
/** {@inheritDoc} */
|