|
@@ -23,9 +23,6 @@
|
23
|
23
|
package com.dmdirc.config;
|
24
|
24
|
|
25
|
25
|
import com.dmdirc.interfaces.config.ReadOnlyConfigProvider;
|
26
|
|
-import com.dmdirc.ui.Colour;
|
27
|
|
-import com.dmdirc.ui.messages.ColourManager;
|
28
|
|
-import com.dmdirc.util.validators.ColourValidator;
|
29
|
26
|
import com.dmdirc.util.validators.DisabledOptionValidator;
|
30
|
27
|
import com.dmdirc.util.validators.NumericalValidator;
|
31
|
28
|
import com.dmdirc.util.validators.OptionalValidator;
|
|
@@ -37,8 +34,6 @@ import java.util.ArrayList;
|
37
|
34
|
import java.util.Arrays;
|
38
|
35
|
import java.util.List;
|
39
|
36
|
|
40
|
|
-import javax.inject.Provider;
|
41
|
|
-
|
42
|
37
|
/**
|
43
|
38
|
* Defines methods to get options from a config provider in various forms.
|
44
|
39
|
*
|
|
@@ -65,39 +60,6 @@ public abstract class BaseConfigProvider implements ReadOnlyConfigProvider {
|
65
|
60
|
private static final Validator<String> INT_VALIDATOR
|
66
|
61
|
= new OptionalValidator(new NumericalValidator(-1, -1));
|
67
|
62
|
|
68
|
|
- /** A validator for colour settings. */
|
69
|
|
- private static final Validator<String> COLOUR_VALIDATOR
|
70
|
|
- = new OptionalValidator(new ColourValidator());
|
71
|
|
-
|
72
|
|
- /** Manager to use to convert colours. */
|
73
|
|
- private final Provider<ColourManager> colourManager;
|
74
|
|
-
|
75
|
|
- /**
|
76
|
|
- * Creates a new instance of {@link com.dmdirc.interfaces.config.ConfigProvider}.
|
77
|
|
- *
|
78
|
|
- * @param colourManager The colour manager to use to convert colours.
|
79
|
|
- */
|
80
|
|
- public BaseConfigProvider(final Provider<ColourManager> colourManager) {
|
81
|
|
- this.colourManager = colourManager;
|
82
|
|
- }
|
83
|
|
-
|
84
|
|
- /**
|
85
|
|
- * Creates a new instance of {@link com.dmdirc.interfaces.config.ConfigProvider} using the
|
86
|
|
- * singleton colour manager.
|
87
|
|
- *
|
88
|
|
- * @deprecated Should pass in a {@link ColourManager}.
|
89
|
|
- */
|
90
|
|
- @Deprecated
|
91
|
|
- public BaseConfigProvider() {
|
92
|
|
- this(new Provider<ColourManager>() {
|
93
|
|
- /** {@inheritDoc} */
|
94
|
|
- @Override
|
95
|
|
- public ColourManager get() {
|
96
|
|
- return new ColourManager(IdentityManager.getIdentityManager().getGlobalConfiguration());
|
97
|
|
- }
|
98
|
|
- });
|
99
|
|
- }
|
100
|
|
-
|
101
|
63
|
/** {@inheritDoc} */
|
102
|
64
|
@Override
|
103
|
65
|
public String getOption(final String domain, final String option) {
|
|
@@ -138,12 +100,6 @@ public abstract class BaseConfigProvider implements ReadOnlyConfigProvider {
|
138
|
100
|
return hasOptionString(domain, option);
|
139
|
101
|
}
|
140
|
102
|
|
141
|
|
- /** {@inheritDoc} */
|
142
|
|
- @Override
|
143
|
|
- public boolean hasOptionColour(final String domain, final String option) {
|
144
|
|
- return hasOptionString(domain, option, COLOUR_VALIDATOR);
|
145
|
|
- }
|
146
|
|
-
|
147
|
103
|
/** {@inheritDoc} */
|
148
|
104
|
@Override
|
149
|
105
|
public boolean hasOptionBool(final String domain, final String option) {
|
|
@@ -187,15 +143,6 @@ public abstract class BaseConfigProvider implements ReadOnlyConfigProvider {
|
187
|
143
|
return getOption(domain, option).charAt(0);
|
188
|
144
|
}
|
189
|
145
|
|
190
|
|
- /** {@inheritDoc} */
|
191
|
|
- @Override
|
192
|
|
- public Colour getOptionColour(final String domain, final String option,
|
193
|
|
- final String ... fallbacks) {
|
194
|
|
- final String value = getOptionString(domain, option, true, COLOUR_VALIDATOR, fallbacks);
|
195
|
|
-
|
196
|
|
- return value == null ? null : colourManager.get().getColourFromString(value, null);
|
197
|
|
- }
|
198
|
|
-
|
199
|
146
|
/** {@inheritDoc} */
|
200
|
147
|
@Override
|
201
|
148
|
public boolean getOptionBool(final String domain, final String option) {
|