Browse Source

Port expanding settings to use prefs components. Remove hardcoded values from settings dialogs.

Fixes CLIENT-26
Fixes CLIENT-88

Depends-On: I2d8a4b2a0adc480a03750abc4d82b4c6809e2ce8
Depends-On: I69c5fd43b97244343b824aa7c2cf1d8bb71ba741

Change-Id: Ica55307fa7527a5c4f835cbb9b5afdfded88c328
Reviewed-on: http://gerrit.dmdirc.com/1836
Automatic-Compile: DMDirc Local Commits <dmdirc@googlemail.com>
Reviewed-by: Chris Smith <chris@dmdirc.com>
tags/0.7rc1
Greg Holmes 13 years ago
parent
commit
8e879f6149

+ 24
- 2
src/com/dmdirc/addons/ui_swing/components/ImageButton.java View File

@@ -30,9 +30,11 @@ import javax.swing.Icon;
30 30
 import javax.swing.JButton;
31 31
 
32 32
 /**
33
- * Image button.
33
+ * Image button, also has the ability to hold an object.
34
+ *
35
+ * <T> Type of object the button holds.
34 36
  */
35
-public class ImageButton extends JButton {
37
+public class ImageButton<T> extends JButton {
36 38
 
37 39
     /**
38 40
      * A version number for this class. It should be changed whenever the class
@@ -40,6 +42,8 @@ public class ImageButton extends JButton {
40 42
      * objects being unserialized with the new class).
41 43
      */
42 44
     private static final long serialVersionUID = 2;
45
+    /** Button object. */
46
+    private T object;
43 47
 
44 48
     /**
45 49
      * Creates a new instance of ImageButton.
@@ -95,4 +99,22 @@ public class ImageButton extends JButton {
95 99
         setRolloverIcon(icon);
96 100
         setPressedIcon(icon);
97 101
     }
102
+
103
+    /**
104
+     * Sets the object for this button.
105
+     *
106
+     * @param object Object to hold
107
+     */
108
+    public void setObject(final T object) {
109
+        this.object = object;
110
+    }
111
+
112
+    /**
113
+     * Get's this buttons object.
114
+     *
115
+     * @return This button's object
116
+     */
117
+    public T getObject() {
118
+        return object;
119
+    }
98 120
 }

+ 15
- 131
src/com/dmdirc/addons/ui_swing/components/expandingsettings/AddOptionPanel.java View File

@@ -23,28 +23,18 @@
23 23
 package com.dmdirc.addons.ui_swing.components.expandingsettings;
24 24
 
25 25
 import com.dmdirc.addons.ui_swing.UIUtilities;
26
-import com.dmdirc.addons.ui_swing.components.FontPicker;
27
-import com.dmdirc.addons.ui_swing.components.colours.ColourChooser;
28 26
 import com.dmdirc.addons.ui_swing.components.renderers.AddOptionCellRenderer;
29
-import com.dmdirc.config.prefs.PreferencesType;
30 27
 
31 28
 import java.awt.Component;
32
-import java.awt.Font;
33 29
 import java.awt.event.ActionEvent;
34 30
 import java.awt.event.ActionListener;
35
-import java.nio.charset.Charset;
36 31
 
37
-import javax.swing.AbstractAction;
38 32
 import javax.swing.DefaultComboBoxModel;
39 33
 import javax.swing.JButton;
40
-import javax.swing.JCheckBox;
41 34
 import javax.swing.JComboBox;
35
+import javax.swing.JComponent;
42 36
 import javax.swing.JLabel;
43 37
 import javax.swing.JPanel;
44
-import javax.swing.JSpinner;
45
-import javax.swing.JTextField;
46
-import javax.swing.KeyStroke;
47
-import javax.swing.SpinnerNumberModel;
48 38
 
49 39
 import net.miginfocom.swing.MigLayout;
50 40
 
@@ -69,18 +59,6 @@ public class AddOptionPanel extends JPanel implements ActionListener {
69 59
     private JButton addOptionButton;
70 60
     /** Current add option input. */
71 61
     private Component addInputCurrent;
72
-    /** Add option colour chooser. */
73
-    private ColourChooser addInputColourChooser;
74
-    /** Add option textfield. */
75
-    private JTextField addInputText;
76
-    /** Add option checkbox. */
77
-    private JCheckBox addInputCheckbox;
78
-    /** Add option checkbox. */
79
-    private JSpinner addInputSpinner;
80
-    /** Add option font picker. */
81
-    private FontPicker addInputFontPicker;
82
-    /** Add option combobox. */
83
-    private JComboBox addInputComboBox;
84 62
     /** Add option checkbox. */
85 63
     private JLabel addInputNone;
86 64
 
@@ -108,15 +86,7 @@ public class AddOptionPanel extends JPanel implements ActionListener {
108 86
 
109 87
         addOptionComboBox.setRenderer(new AddOptionCellRenderer(parent));
110 88
 
111
-        addInputColourChooser = new ColourChooser();
112
-        addInputText = new JTextField();
113
-        addInputCheckbox = new JCheckBox();
114
-        addInputCheckbox.setOpaque(UIUtilities.getTabbedPaneOpaque());
115
-        addInputSpinner = new JSpinner(new SpinnerNumberModel());
116 89
         addInputNone = new JLabel("");
117
-        addInputFontPicker = new FontPicker("Dialog");
118
-        addInputComboBox = new JComboBox(new DefaultComboBoxModel());
119
-        addInputComboBox.setPrototypeDisplayValue("test");
120 90
         addInputCurrent = addInputNone;
121 91
 
122 92
         addOptionComboBox.setEnabled(false);
@@ -126,21 +96,10 @@ public class AddOptionPanel extends JPanel implements ActionListener {
126 96
     /** Initialises listeners. */
127 97
     private void initListeners() {
128 98
         //Only fire events on selection not on highlight
129
-        addOptionComboBox.putClientProperty("JComboBox.isTableCellEditor", Boolean.TRUE);
99
+        addOptionComboBox.putClientProperty("JComboBox.isTableCellEditor",
100
+                Boolean.TRUE);
130 101
         addOptionComboBox.addActionListener(this);
131 102
         addOptionButton.addActionListener(this);
132
-
133
-        addInputText.getActionMap().put("enter", new AbstractAction() {
134
-
135
-            private static final long serialVersionUID = 2;
136
-
137
-            /** {@inheritDoc} */
138
-            @Override
139
-            public void actionPerformed(final ActionEvent e) {
140
-                addOptionButton.doClick();
141
-            }
142
-        });
143
-        addInputText.getInputMap().put(KeyStroke.getKeyStroke("ENTER"), "enter");
144 103
     }
145 104
 
146 105
     /** Lays out the components. */
@@ -161,15 +120,9 @@ public class AddOptionPanel extends JPanel implements ActionListener {
161 120
      *
162 121
      * @param optionName Option name
163 122
      */
164
-    protected void addOption(final String optionName) {
165
-        ((DefaultComboBoxModel) addOptionComboBox.getModel()).addElement(
166
-                optionName);
167
-        if ("channel.encoding".equals(optionName)) {
168
-            ((DefaultComboBoxModel) addInputComboBox.getModel()).removeAllElements();
169
-            for (Object argument : Charset.availableCharsets().keySet()) {
170
-                ((DefaultComboBoxModel) addInputComboBox.getModel()).addElement(argument);
171
-            }
172
-        }
123
+    protected void addOption(final JComponent setting) {
124
+        ((DefaultComboBoxModel) addOptionComboBox.getModel())
125
+                .addElement(setting);
173 126
         addOptionButton.setEnabled(true);
174 127
         addOptionComboBox.setEnabled(true);
175 128
     }
@@ -179,9 +132,9 @@ public class AddOptionPanel extends JPanel implements ActionListener {
179 132
      *
180 133
      * @param optionName Option name
181 134
      */
182
-    protected void delOption(final String optionName) {
183
-        ((DefaultComboBoxModel) addOptionComboBox.getModel()).removeElement(
184
-                optionName);
135
+    protected void delOption(final JComponent setting) {
136
+        ((DefaultComboBoxModel) addOptionComboBox.getModel())
137
+                .removeElement(setting);
185 138
         if (addOptionComboBox.getModel().getSize() == 0) {
186 139
             addOptionComboBox.setEnabled(false);
187 140
             addOptionButton.setEnabled(false);
@@ -200,37 +153,11 @@ public class AddOptionPanel extends JPanel implements ActionListener {
200 153
      *
201 154
      * @param type Option type
202 155
      */
203
-    private void switchInputField(final PreferencesType type) {
204
-        if (type == null) {
156
+    private void switchInputField(final JComponent setting) {
157
+        if (setting == null) {
205 158
             addInputCurrent = addInputNone;
206 159
         } else {
207
-            switch (type) {
208
-                case TEXT:
209
-                    addInputText.setText("");
210
-                    addInputCurrent = addInputText;
211
-                    break;
212
-                case BOOLEAN:
213
-                    addInputCheckbox.setSelected(false);
214
-                    addInputCurrent = addInputCheckbox;
215
-                    break;
216
-                case COLOUR:
217
-                    addInputColourChooser.clearColour();
218
-                    addInputCurrent = addInputColourChooser;
219
-                    break;
220
-                case INTEGER:
221
-                    addInputSpinner.setValue(0);
222
-                    addInputCurrent = addInputSpinner;
223
-                    break;
224
-                case FONT:
225
-                    addInputCurrent = addInputFontPicker;
226
-                    break;
227
-                case MULTICHOICE:
228
-                    addInputCurrent = addInputComboBox;
229
-                    break;
230
-                default:
231
-                    addInputCurrent = addInputNone;
232
-                    break;
233
-            }
160
+            addInputCurrent = setting;
234 161
         }
235 162
 
236 163
         layoutComponents();
@@ -250,53 +177,10 @@ public class AddOptionPanel extends JPanel implements ActionListener {
250 177
                 addOptionComboBox.setEnabled(false);
251 178
                 addOptionButton.setEnabled(false);
252 179
             }
253
-            switchInputField(parent.getOptionType(
254
-                    (String) addOptionComboBox.getSelectedItem()));
180
+            switchInputField(((JComponent) addOptionComboBox.getSelectedItem()));
255 181
         } else if (e.getSource() == addOptionButton) {
256
-            final PreferencesType type = parent.getOptionType(
257
-                    (String) addOptionComboBox.getSelectedItem());
258
-
259
-            switch (type) {
260
-                case TEXT:
261
-                    parent.addCurrentOption(
262
-                            (String) addOptionComboBox.getSelectedItem(),
263
-                            type,
264
-                            addInputText.getText());
265
-                    break;
266
-                case BOOLEAN:
267
-                    parent.addCurrentOption(
268
-                            (String) addOptionComboBox.getSelectedItem(),
269
-                            type,
270
-                            String.valueOf(addInputCheckbox.isSelected()));
271
-                    break;
272
-                case COLOUR:
273
-                    parent.addCurrentOption(
274
-                            (String) addOptionComboBox.getSelectedItem(),
275
-                            type,
276
-                            addInputColourChooser.getColour());
277
-                    break;
278
-                case INTEGER:
279
-                    parent.addCurrentOption(
280
-                            (String) addOptionComboBox.getSelectedItem(),
281
-                            type,
282
-                            addInputSpinner.getValue().toString());
283
-                    break;
284
-                case FONT:
285
-                    parent.addCurrentOption(
286
-                            (String) addOptionComboBox.getSelectedItem(),
287
-                            type,
288
-                            ((Font) addInputFontPicker.getSelectedItem()).getFamily());
289
-                    break;
290
-                case MULTICHOICE:
291
-                    parent.addCurrentOption((String) addOptionComboBox.getSelectedItem(),
292
-                            type,
293
-                            (String) addInputComboBox.getSelectedItem());
294
-                    break;
295
-                default:
296
-                    break;
297
-            }
298
-
299
-            delOption((String) addOptionComboBox.getSelectedItem());
182
+            parent.addCurrentOption((JComponent) addOptionComboBox.getSelectedItem());
183
+            delOption((JComponent) addOptionComboBox.getSelectedItem());
300 184
         }
301 185
     }
302 186
 

+ 27
- 196
src/com/dmdirc/addons/ui_swing/components/expandingsettings/CurrentOptionsPanel.java View File

@@ -23,36 +23,25 @@
23 23
 package com.dmdirc.addons.ui_swing.components.expandingsettings;
24 24
 
25 25
 import com.dmdirc.addons.ui_swing.UIUtilities;
26
-import com.dmdirc.addons.ui_swing.components.FontPicker;
27 26
 import com.dmdirc.addons.ui_swing.components.ImageButton;
28
-import com.dmdirc.addons.ui_swing.components.colours.ColourChooser;
29
-import com.dmdirc.config.prefs.PreferencesType;
30 27
 import com.dmdirc.ui.IconManager;
31 28
 
32
-import java.awt.Font;
33 29
 import java.awt.event.ActionEvent;
34 30
 import java.awt.event.ActionListener;
35
-import java.nio.charset.Charset;
36
-import java.util.HashMap;
37
-import java.util.Map;
38
-import java.util.Map.Entry;
31
+import java.util.ArrayList;
32
+import java.util.List;
39 33
 
40
-import javax.swing.DefaultComboBoxModel;
41
-import javax.swing.JCheckBox;
42
-import javax.swing.JComboBox;
43 34
 import javax.swing.JComponent;
44 35
 import javax.swing.JLabel;
45 36
 import javax.swing.JPanel;
46
-import javax.swing.JSpinner;
47
-import javax.swing.JTextField;
48
-import javax.swing.SpinnerNumberModel;
49 37
 
50 38
 import net.miginfocom.swing.MigLayout;
51 39
 
52 40
 /**
53 41
  * Current options panel.
54 42
  */
55
-public final class CurrentOptionsPanel extends JPanel implements ActionListener {
43
+public final class CurrentOptionsPanel extends JPanel implements
44
+        ActionListener {
56 45
 
57 46
     /**
58 47
      * A version number for this class. It should be changed whenever the class
@@ -60,22 +49,10 @@ public final class CurrentOptionsPanel extends JPanel implements ActionListener
60 49
      * objects being unserialized with the new class).
61 50
      */
62 51
     private static final long serialVersionUID = 2;
63
-
64 52
     /** Parent settings panel. */
65 53
     private final SettingsPanel parent;
66
-
67
-    /** config option -> text fields. */
68
-    private Map<String, JTextField> textFields;
69
-    /** config option -> checkboxes. */
70
-    private Map<String, JCheckBox> checkBoxes;
71
-    /** config option -> colours. */
72
-    private Map<String, ColourChooser> colours;
73
-    /** config option -> spinners. */
74
-    private Map<String, JSpinner> spinners;
75
-    /** config option -> spinners. */
76
-    private Map<String, FontPicker> fonts;
77
-    /** config option -> comboboxes. */
78
-    private Map<String, JComboBox> comboboxes;
54
+    /** Curent options to display. */
55
+    private final List<JComponent> settings;
79 56
 
80 57
     /**
81 58
      * Creates a new instance of CurrentOptionsPanel.
@@ -88,27 +65,12 @@ public final class CurrentOptionsPanel extends JPanel implements ActionListener
88 65
         this.parent = parent;
89 66
 
90 67
         this.setOpaque(UIUtilities.getTabbedPaneOpaque());
91
-        initComponents();
92
-    }
93
-
94
-    /** Initialises the components. */
95
-    private void initComponents() {
96
-        textFields = new HashMap<String, JTextField>();
97
-        checkBoxes = new HashMap<String, JCheckBox>();
98
-        colours = new HashMap<String, ColourChooser>();
99
-        spinners = new HashMap<String, JSpinner>();
100
-        fonts = new HashMap<String, FontPicker>();
101
-        comboboxes = new HashMap<String, JComboBox>();
68
+        settings = new ArrayList<JComponent>();
102 69
     }
103 70
 
104 71
     /** Clears all the current options. */
105 72
     protected void clearOptions() {
106
-        textFields.clear();
107
-        checkBoxes.clear();
108
-        colours.clear();
109
-        spinners.clear();
110
-        fonts.clear();
111
-        comboboxes.clear();
73
+        settings.clear();
112 74
         populateCurrentSettings();
113 75
     }
114 76
 
@@ -119,36 +81,8 @@ public final class CurrentOptionsPanel extends JPanel implements ActionListener
119 81
      * @param type Option type
120 82
      * @param value Option value
121 83
      */
122
-    protected void addOption(final String optionName,
123
-            final PreferencesType type, final String value) {
124
-        switch (type) {
125
-            case TEXT:
126
-                textFields.put(optionName, new JTextField(value));
127
-                break;
128
-            case BOOLEAN:
129
-                checkBoxes.put(optionName, new JCheckBox("", Boolean.parseBoolean(value)));
130
-                break;
131
-            case COLOUR:
132
-                colours.put(optionName, new ColourChooser(value, true, true));
133
-                break;
134
-            case INTEGER:
135
-                spinners.put(optionName, new JSpinner(new SpinnerNumberModel()));
136
-                spinners.get(optionName).setValue(Integer.parseInt(value));
137
-                break;
138
-            case FONT:
139
-                fonts.put(optionName, new FontPicker(value));
140
-                break;
141
-            case MULTICHOICE:
142
-                if ("channel.encoding".equals(optionName)) {
143
-                    comboboxes.put(optionName, new JComboBox(
144
-                            new DefaultComboBoxModel(Charset.availableCharsets()
145
-                            .keySet().toArray())));
146
-                    comboboxes.get(optionName).setSelectedItem(value);
147
-                }
148
-                break;
149
-            default:
150
-                throw new IllegalArgumentException("Illegal Type: " + type);
151
-        }
84
+    protected void addOption(final JComponent setting) {
85
+        settings.add(setting);
152 86
 
153 87
         populateCurrentSettings();
154 88
     }
@@ -159,85 +93,11 @@ public final class CurrentOptionsPanel extends JPanel implements ActionListener
159 93
      * @param optionName Option to delete
160 94
      * @param type Option type
161 95
      */
162
-    protected void delOption(final String optionName,
163
-            final PreferencesType type) {
164
-        switch (type) {
165
-            case TEXT:
166
-                textFields.remove(optionName);
167
-                break;
168
-            case BOOLEAN:
169
-                checkBoxes.remove(optionName);
170
-                break;
171
-            case COLOUR:
172
-                colours.remove(optionName);
173
-                break;
174
-            case INTEGER:
175
-                spinners.remove(optionName);
176
-                break;
177
-            case FONT:
178
-                fonts.remove(optionName);
179
-                break;
180
-            case MULTICHOICE:
181
-                comboboxes.remove(optionName);
182
-                break;
183
-            default:
184
-                throw new IllegalArgumentException("Illegal Type: " + type);
185
-        }
186
-
96
+    protected void delOption(final JComponent setting) {
97
+        settings.remove(setting);
187 98
         populateCurrentSettings();
188 99
     }
189 100
 
190
-    /**
191
-     * Retrives an options value.
192
-     *
193
-     * @param optionName Option to delete
194
-     * @param type Option type
195
-     *
196
-     * @return Option value or a blank string
197
-     */
198
-    public String getOption(final String optionName, final PreferencesType type) {
199
-        String returnValue = null;
200
-        switch (type) {
201
-            case TEXT:
202
-                if (textFields.containsKey(optionName)) {
203
-                    returnValue =  textFields.get(optionName).getText();
204
-                }
205
-                break;
206
-            case BOOLEAN:
207
-                if (checkBoxes.containsKey(optionName)) {
208
-                    if (checkBoxes.get(optionName).isSelected()) {
209
-                        returnValue = "true";
210
-                    } else {
211
-                        returnValue = "false";
212
-                    }
213
-                }
214
-                break;
215
-            case COLOUR:
216
-                if (colours.containsKey(optionName)) {
217
-                    returnValue = colours.get(optionName).getColour();
218
-                }
219
-                break;
220
-            case INTEGER:
221
-                if (spinners.containsKey(optionName)) {
222
-                    returnValue = spinners.get(optionName).getValue().toString();
223
-                }
224
-                break;
225
-            case FONT:
226
-                if (fonts.containsKey(optionName)) {
227
-                    returnValue = ((Font) fonts.get(optionName).getSelectedItem()).getFamily();
228
-                }
229
-                break;
230
-            case MULTICHOICE:
231
-                if (comboboxes.containsKey(optionName)) {
232
-                    returnValue = (String) ((DefaultComboBoxModel) comboboxes.get(optionName).getModel()).getSelectedItem();
233
-                }
234
-                break;
235
-            default:
236
-                throw new IllegalArgumentException("Illegal Type: " + type);
237
-        }
238
-        return returnValue;
239
-    }
240
-
241 101
     /**
242 102
      * Adds an option to the current options pane.
243 103
      * @param configName config option name
@@ -245,21 +105,22 @@ public final class CurrentOptionsPanel extends JPanel implements ActionListener
245 105
      * @param panel parent panel
246 106
      * @param component Option component to add
247 107
      */
248
-    private void addCurrentOption(final String configName, final String displayName,
249
-            final JPanel panel, final JComponent component) {
108
+    private void addCurrentOption(final JComponent component) {
250 109
         final JLabel label = new JLabel();
251
-        final ImageButton button = new ImageButton(configName,
110
+        final ImageButton<JComponent> button = new ImageButton(
111
+                component.getName(),
252 112
                 IconManager.getIconManager().getIcon("close-inactive"),
253 113
                 IconManager.getIconManager().getIcon("close-active"));
114
+        button.setObject(component);
254 115
 
255
-        label.setText(displayName + ": ");
116
+        label.setText(component.getName() + ": ");
256 117
         label.setLabelFor(component);
257 118
 
258 119
         button.addActionListener(this);
259 120
 
260
-        panel.add(label);
261
-        panel.add(component, "growx, pushx");
262
-        panel.add(button, "wrap");
121
+        add(label);
122
+        add(component, "");
123
+        add(button, "wrap");
263 124
     }
264 125
 
265 126
 
@@ -267,44 +128,12 @@ public final class CurrentOptionsPanel extends JPanel implements ActionListener
267 128
     protected void populateCurrentSettings() {
268 129
         setVisible(false);
269 130
 
270
-        setLayout(new MigLayout("fillx, aligny top"));
131
+        setLayout(new MigLayout("fillx, aligny top, wmax 100%"));
271 132
 
272 133
         removeAll();
273 134
 
274
-        for (Entry<String, JTextField> entry : textFields.entrySet()) {
275
-            addCurrentOption(entry.getKey(),
276
-                    parent.getOptionName(entry.getKey()),
277
-                    this, entry.getValue());
278
-        }
279
-
280
-        for (Entry<String, JCheckBox> entry : checkBoxes.entrySet()) {
281
-            addCurrentOption(entry.getKey(),
282
-                    parent.getOptionName(entry.getKey()),
283
-                    this, entry.getValue());
284
-        }
285
-
286
-        for (Entry<String, ColourChooser> entry : colours.entrySet()) {
287
-            addCurrentOption(entry.getKey(),
288
-                    parent.getOptionName(entry.getKey()),
289
-                    this, entry.getValue());
290
-        }
291
-
292
-        for (Entry<String, JSpinner> entry : spinners.entrySet()) {
293
-            addCurrentOption(entry.getKey(),
294
-                    parent.getOptionName(entry.getKey()),
295
-                    this, entry.getValue());
296
-        }
297
-
298
-        for (Entry<String, FontPicker> entry : fonts.entrySet()) {
299
-            addCurrentOption(entry.getKey(),
300
-                    parent.getOptionName(entry.getKey()),
301
-                    this, entry.getValue());
302
-        }
303
-
304
-        for (Entry<String, JComboBox> entry : comboboxes.entrySet()) {
305
-            addCurrentOption(entry.getKey(),
306
-                    parent.getOptionName(entry.getKey()),
307
-                    this, entry.getValue());
135
+        for (JComponent setting : settings) {
136
+            addCurrentOption(setting);
308 137
         }
309 138
 
310 139
         setVisible(true);
@@ -317,8 +146,10 @@ public final class CurrentOptionsPanel extends JPanel implements ActionListener
317 146
      */
318 147
     @Override
319 148
     public void actionPerformed(final ActionEvent e) {
320
-        delOption(e.getActionCommand(), parent.getOptionType(e.getActionCommand()));
321
-        parent.addAddableOption(e.getActionCommand());
149
+        final JComponent setting = ((ImageButton<JComponent>)
150
+                e.getSource()).getObject();
151
+        delOption(setting);
152
+        parent.addAddableOption(setting);
322 153
     }
323 154
 
324 155
 }

+ 53
- 75
src/com/dmdirc/addons/ui_swing/components/expandingsettings/SettingsPanel.java View File

@@ -22,16 +22,17 @@
22 22
 
23 23
 package com.dmdirc.addons.ui_swing.components.expandingsettings;
24 24
 
25
+import com.dmdirc.addons.ui_swing.PrefsComponentFactory;
25 26
 import com.dmdirc.addons.ui_swing.UIUtilities;
26 27
 import com.dmdirc.addons.ui_swing.components.text.TextLabel;
27 28
 import com.dmdirc.config.Identity;
28
-import com.dmdirc.config.prefs.PreferencesType;
29
+import com.dmdirc.config.prefs.PreferencesCategory;
30
+import com.dmdirc.config.prefs.PreferencesSetting;
29 31
 
30
-import java.util.LinkedHashMap;
31
-import java.util.Map;
32
-import java.util.Map.Entry;
32
+import com.dmdirc.util.DoubleMap;
33 33
 
34 34
 import javax.swing.BorderFactory;
35
+import javax.swing.JComponent;
35 36
 import javax.swing.JPanel;
36 37
 import javax.swing.JScrollPane;
37 38
 import javax.swing.UIManager;
@@ -48,13 +49,11 @@ public class SettingsPanel extends JPanel {
48 49
      * structure is changed (or anything else that would prevent serialized
49 50
      * objects being unserialized with the new class).
50 51
      */
51
-    private static final long serialVersionUID = 2;
52
+    private static final long serialVersionUID = 3;
52 53
     /** Config manager. */
53 54
     private final transient Identity config;
54
-    /** config option -> name. */
55
-    private Map<String, String> names;
56
-    /** config option -> type. */
57
-    private Map<String, PreferencesType> types;
55
+    /** Current Settings. */
56
+    private final DoubleMap<PreferencesSetting, JComponent> settings;
58 57
     /** Info label. */
59 58
     private TextLabel infoLabel;
60 59
     /** Current options panel. */
@@ -65,6 +64,8 @@ public class SettingsPanel extends JPanel {
65 64
     private JScrollPane scrollPane;
66 65
     /** Use external padding. */
67 66
     private final boolean padding;
67
+    /** Preferences Category. */
68
+    private PreferencesCategory category;
68 69
 
69 70
     /**
70 71
      * Creates a new instance of SettingsPanel.
@@ -87,6 +88,8 @@ public class SettingsPanel extends JPanel {
87 88
             final boolean padding) {
88 89
         super();
89 90
 
91
+        settings = new DoubleMap<PreferencesSetting, JComponent>();
92
+
90 93
         this.setOpaque(UIUtilities.getTabbedPaneOpaque());
91 94
         this.config = config;
92 95
         this.padding = padding;
@@ -101,16 +104,11 @@ public class SettingsPanel extends JPanel {
101 104
      * @param infoText Info blurb.
102 105
      */
103 106
     private void initComponents(final String infoText) {
104
-        names = new LinkedHashMap<String, String>();
105
-        types = new LinkedHashMap<String, PreferencesType>();
106
-
107 107
         infoLabel = new TextLabel(infoText);
108 108
         infoLabel.setVisible(!infoText.isEmpty());
109 109
 
110
-        addOptionPanel =
111
-                new AddOptionPanel(this);
112
-        currentOptionsPanel =
113
-                new CurrentOptionsPanel(this);
110
+        addOptionPanel = new AddOptionPanel(this);
111
+        currentOptionsPanel = new CurrentOptionsPanel(this);
114 112
         scrollPane = new JScrollPane(currentOptionsPanel);
115 113
 
116 114
         scrollPane.setBorder(BorderFactory.createTitledBorder(UIManager.
@@ -129,9 +127,9 @@ public class SettingsPanel extends JPanel {
129 127
         setLayout(new MigLayout("fill, wrap 1, hidemode 3, "
130 128
                 + (padding ? "ins rel" : "ins 0")));
131 129
 
132
-        add(infoLabel, "growx, pushx");
133
-        add(scrollPane, "grow, push");
134
-        add(addOptionPanel, "growx, pushx");
130
+        add(infoLabel, "growx");
131
+        add(scrollPane, "grow, pushy");
132
+        add(addOptionPanel, "growx");
135 133
     }
136 134
 
137 135
     /**
@@ -141,25 +139,25 @@ public class SettingsPanel extends JPanel {
141 139
      * @param displayName Display name
142 140
      * @param type Option type
143 141
      */
144
-    public void addOption(final String optionName, final String displayName,
145
-            final PreferencesType type) {
142
+    public void addOption(final PreferencesCategory category) {
146 143
         if (config == null) {
147 144
             return;
148 145
         }
149 146
 
150
-        if (optionName.indexOf('.') == -1) {
151
-            return;
152
-        }
153
-        final String[] splitOption = optionName.split("\\.");
154
-
155
-        names.put(optionName, displayName);
156
-        types.put(optionName, type);
147
+        this.category = category;
157 148
 
158
-        if (config.hasOptionString(splitOption[0], splitOption[1])) {
159
-            addCurrentOption(optionName, type,
160
-                    config.getOption(splitOption[0], splitOption[1]));
161
-        } else {
162
-            addAddableOption(optionName);
149
+        for (PreferencesSetting setting : category.getSettings()) {
150
+            if (settings.get(setting) == null) {
151
+                final JComponent component = PrefsComponentFactory
152
+                        .getComponent(setting);
153
+                component.setName(setting.getTitle());
154
+                settings.put(setting, component);
155
+            }
156
+            if (setting.isSet()) {
157
+                addCurrentOption(settings.get(setting));
158
+            } else {
159
+                addAddableOption(settings.get(setting));
160
+            }
163 161
         }
164 162
     }
165 163
 
@@ -168,31 +166,23 @@ public class SettingsPanel extends JPanel {
168 166
         addOptionPanel.clearOptions();
169 167
         currentOptionsPanel.clearOptions();
170 168
 
171
-        for (Entry<String, PreferencesType> entry : types.entrySet()) {
172
-            final String[] splitOption = entry.getKey().split("\\.");
173
-
174
-            if (config.hasOptionString(splitOption[0], splitOption[1])) {
175
-                addCurrentOption(entry.getKey(), entry.getValue(),
176
-                        config.getOption(splitOption[0], splitOption[1]));
169
+        for (PreferencesSetting setting : category.getSettings()) {
170
+            if (setting.isSet()) {
171
+                addCurrentOption(settings.get(setting));
177 172
             } else {
178
-                addAddableOption(entry.getKey());
173
+                addAddableOption(settings.get(setting));
179 174
             }
180 175
         }
181 176
     }
182 177
 
183 178
     /** Saves the options to the config. */
184 179
     public void save() {
185
-        for (Entry<String, PreferencesType> entry : types.entrySet()) {
186
-            final String value =
187
-                    currentOptionsPanel.getOption(entry.getKey(),
188
-                    entry.getValue());
189
-            final String[] splitOption = entry.getKey().split("\\.");
190
-            if (value == null) {
191
-                config.unsetOption(splitOption[0], splitOption[1]);
192
-            } else {
193
-                config.setOption(splitOption[0], splitOption[1], value);
194
-            }
195
-        }
180
+        category.save();
181
+    }
182
+
183
+    /** Dismisses the options changed. */
184
+    public void dismiss() {
185
+        category.dismiss();
196 186
     }
197 187
 
198 188
     /**
@@ -202,9 +192,8 @@ public class SettingsPanel extends JPanel {
202 192
      * @param type Option type
203 193
      * @param value Option value
204 194
      */
205
-    protected void addCurrentOption(final String optionName,
206
-            final PreferencesType type, final String value) {
207
-        currentOptionsPanel.addOption(optionName, type, value);
195
+    protected void addCurrentOption(final JComponent setting) {
196
+        currentOptionsPanel.addOption(setting);
208 197
     }
209 198
 
210 199
     /**
@@ -213,9 +202,8 @@ public class SettingsPanel extends JPanel {
213 202
      * @param optionName Option to delete
214 203
      * @param type Option type
215 204
      */
216
-    protected void removeCurrentOption(final String optionName,
217
-            final PreferencesType type) {
218
-        currentOptionsPanel.delOption(optionName, type);
205
+    protected void removeCurrentOption(final JComponent setting) {
206
+        currentOptionsPanel.delOption(setting);
219 207
     }
220 208
 
221 209
     /**
@@ -223,29 +211,19 @@ public class SettingsPanel extends JPanel {
223 211
      *
224 212
      * @param optionName Option name
225 213
      */
226
-    protected void addAddableOption(final String optionName) {
227
-        addOptionPanel.addOption(optionName);
228
-    }
229
-
230
-    /**
231
-     * Returns the display name for a config option.
232
-     *
233
-     * @param optionName Option name to return the name for
234
-     *
235
-     * @return Display name for a specified option
236
-     */
237
-    public String getOptionName(final String optionName) {
238
-        return names.get(optionName);
214
+    protected void addAddableOption(final JComponent setting) {
215
+        settings.getKey(setting).setValue(null);
216
+        addOptionPanel.addOption(setting);
239 217
     }
240 218
 
241 219
     /**
242
-     * Returns the option type for a config option.
220
+     * Returns the component associated with a setting.
243 221
      *
244
-     * @param optionName Option name to return the type of
222
+     * @param component The component to get the setting for
245 223
      *
246
-     * @return Option type for a specified option
224
+     * @return Setting or null if not found
247 225
      */
248
-    public PreferencesType getOptionType(final String optionName) {
249
-        return types.get(optionName);
226
+    public PreferencesSetting getSettingForComponent(final JComponent comp) {
227
+        return settings.getKey(comp);
250 228
     }
251 229
 }

+ 22
- 13
src/com/dmdirc/addons/ui_swing/components/renderers/AddOptionCellRenderer.java View File

@@ -23,10 +23,12 @@
23 23
 package com.dmdirc.addons.ui_swing.components.renderers;
24 24
 
25 25
 import com.dmdirc.addons.ui_swing.components.expandingsettings.SettingsPanel;
26
+import com.dmdirc.config.prefs.PreferencesSetting;
26 27
 
27 28
 import java.awt.Component;
28 29
 
29 30
 import javax.swing.DefaultListCellRenderer;
31
+import javax.swing.JComponent;
30 32
 import javax.swing.JList;
31 33
 
32 34
 /**
@@ -40,19 +42,18 @@ public final class AddOptionCellRenderer extends DefaultListCellRenderer {
40 42
      * objects being unserialized with the new class).
41 43
      */
42 44
     private static final long serialVersionUID = 1;
43
-    
44
-    /** Settings panel parent. */
45
-    private final SettingsPanel parent;
46
-    
45
+    /** Parent settings panel. */
46
+    private final SettingsPanel settingsPanel;
47
+
47 48
     /**
48
-     * Instantiates the renderer.
49
+     * Creates a new add option cell renderer.
49 50
      *
50
-     * @param parent Parent settings panel
51
+     * @param settingsPanel Parent settings panel
51 52
      */
52
-    public AddOptionCellRenderer(final SettingsPanel parent) {
53
+    public AddOptionCellRenderer(final SettingsPanel settingsPanel) {
53 54
         super();
54 55
         
55
-        this.parent = parent;
56
+        this.settingsPanel = settingsPanel;
56 57
     }
57 58
     
58 59
     /** {@inheritDoc} */
@@ -62,13 +63,21 @@ public final class AddOptionCellRenderer extends DefaultListCellRenderer {
62 63
             final Object value,
63 64
             final int index,
64 65
             final boolean isSelected,
65
-            final boolean cellHasFocus) {
66
-        final String selected = (String) value;
67
-        
66
+            final boolean cellHasFocus) {       
68 67
         super.getListCellRendererComponent(list, value, index, isSelected,
69 68
                 cellHasFocus);
70
-        
71
-        setText(parent.getOptionName(selected));
69
+
70
+        final PreferencesSetting setting;
71
+        if (value instanceof JComponent) {
72
+            setting = settingsPanel.getSettingForComponent((JComponent) value);
73
+        } else {
74
+            setting = null;
75
+        }
76
+        if (setting == null) {
77
+           setText(value.toString());
78
+        } else {
79
+            setText(setting.getTitle());
80
+        }
72 81
         
73 82
         return this;
74 83
     }

+ 5
- 41
src/com/dmdirc/addons/ui_swing/dialogs/channelsetting/ChannelSettingsDialog.java View File

@@ -28,7 +28,7 @@ import com.dmdirc.addons.ui_swing.components.expandingsettings.SettingsPanel;
28 28
 import com.dmdirc.addons.ui_swing.dialogs.StandardDialog;
29 29
 import com.dmdirc.config.Identity;
30 30
 import com.dmdirc.config.IdentityManager;
31
-import com.dmdirc.config.prefs.PreferencesType;
31
+import com.dmdirc.config.prefs.PreferencesManager;
32 32
 import com.dmdirc.ui.interfaces.InputWindow;
33 33
 
34 34
 import java.awt.Window;
@@ -71,7 +71,7 @@ public final class ChannelSettingsDialog extends StandardDialog implements
71 71
     /** Channel identity file. */
72 72
     private final Identity identity;
73 73
     /** Channel window. */
74
-    private InputWindow channelWindow;
74
+    private final InputWindow channelWindow;
75 75
 
76 76
     /**
77 77
      * Creates a new instance of ChannelSettingsDialog.
@@ -195,45 +195,9 @@ public final class ChannelSettingsDialog extends StandardDialog implements
195 195
         channelSettingsPane = new SettingsPanel(identity,
196 196
                 "These settings are specific to this channel on this network,"
197 197
                 + " any settings specified here will overwrite global settings");
198
-
199
-        channelSettingsPane.addOption("channel.splitusermodes",
200
-                "Split user modes", PreferencesType.BOOLEAN);
201
-        channelSettingsPane.addOption("channel.sendwho",
202
-                "Send channel WHOs", PreferencesType.BOOLEAN);
203
-        channelSettingsPane.addOption("channel.showmodeprefix",
204
-                "Show mode prefixes", PreferencesType.BOOLEAN);
205
-        channelSettingsPane.addOption("ui.shownickcoloursinnicklist",
206
-                "Show colours in nicklist", PreferencesType.BOOLEAN);
207
-        channelSettingsPane.addOption("ui.shownickcoloursintext",
208
-                "Show colours in textpane", PreferencesType.BOOLEAN);
209
-        channelSettingsPane.addOption("general.cyclemessage",
210
-                "Cycle message", PreferencesType.TEXT);
211
-        channelSettingsPane.addOption("general.kickmessage",
212
-                "Kick message", PreferencesType.TEXT);
213
-        channelSettingsPane.addOption("general.partmessage",
214
-                "Part message", PreferencesType.TEXT);
215
-        channelSettingsPane.addOption("ui.backgroundcolour",
216
-                "Background colour", PreferencesType.COLOUR);
217
-        channelSettingsPane.addOption("ui.foregroundcolour",
218
-                "Foreground colour", PreferencesType.COLOUR);
219
-        channelSettingsPane.addOption("ui.frameBufferSize",
220
-                "Frame buffer size", PreferencesType.INTEGER);
221
-        channelSettingsPane.addOption("ui.textPaneFontName",
222
-                "Textpane font name", PreferencesType.FONT);
223
-        channelSettingsPane.addOption("ui.textPaneFontSize",
224
-                "Textpane font size", PreferencesType.INTEGER);
225
-        channelSettingsPane.addOption("ui.inputbuffersize",
226
-                "Input buffer size", PreferencesType.INTEGER);
227
-        channelSettingsPane.addOption("ui.inputbackgroundcolour",
228
-                "Inputfield background colour", PreferencesType.COLOUR);
229
-        channelSettingsPane.addOption("ui.inputforegroundcolour",
230
-                "Inputfield foreground colour", PreferencesType.COLOUR);
231
-        channelSettingsPane.addOption("ui.nicklistbackgroundcolour",
232
-                "Nicklist background colour", PreferencesType.COLOUR);
233
-        channelSettingsPane.addOption("ui.nicklistforegroundcolour",
234
-                "Nicklist foreground colour", PreferencesType.COLOUR);
235
-        channelSettingsPane.addOption("channel.encoding", "Encoding",
236
-                PreferencesType.MULTICHOICE);
198
+        channelSettingsPane.addOption(PreferencesManager
199
+                .getPreferencesManager().getChannelSettings(
200
+                channel.getConfigManager(), identity));
237 201
     }
238 202
 
239 203
     /** Initialises listeners for this dialog. */

+ 10
- 71
src/com/dmdirc/addons/ui_swing/dialogs/serverlist/Settings.java View File

@@ -26,7 +26,9 @@ import com.dmdirc.addons.ui_swing.components.expandingsettings.SettingsPanel;
26 26
 import com.dmdirc.config.IdentityManager;
27 27
 import com.dmdirc.addons.serverlists.ServerGroup;
28 28
 import com.dmdirc.addons.serverlists.ServerGroupItem;
29
-import com.dmdirc.config.prefs.PreferencesType;
29
+import com.dmdirc.config.ConfigManager;
30
+import com.dmdirc.config.Identity;
31
+import com.dmdirc.config.prefs.PreferencesManager;
30 32
 
31 33
 import java.util.HashMap;
32 34
 import java.util.Map;
@@ -117,7 +119,9 @@ public class Settings extends JPanel implements ServerListListener {
117 119
                 panels.put(item, new SettingsPanel(IdentityManager.
118 120
                         getServerConfig(item.getName()), "", false));
119 121
             }
120
-            addSettings(panels.get(item));
122
+            addSettings(panels.get(item), new ConfigManager("irc", "", 
123
+                    item.getGroup().getNetwork(), item.getName()),
124
+                    IdentityManager.getServerConfig(item.getName()));
121 125
         }
122 126
         return panels.get(item);
123 127
     }
@@ -151,74 +155,9 @@ public class Settings extends JPanel implements ServerListListener {
151 155
      * 
152 156
      * @param settingsPanel Settings panel to add settings to
153 157
      */
154
-    private void addSettings(final SettingsPanel settingsPanel) {
155
-        settingsPanel.addOption("channel.splitusermodes", "Split user modes",
156
-                PreferencesType.BOOLEAN);
157
-        settingsPanel.addOption("channel.sendwho", "Send WHO",
158
-                PreferencesType.BOOLEAN);
159
-        settingsPanel.addOption("channel.showmodeprefix", "Show mode prefix",
160
-                PreferencesType.BOOLEAN);
161
-
162
-        settingsPanel.addOption("general.cyclemessage", "Cycle message",
163
-                PreferencesType.TEXT);
164
-        settingsPanel.addOption("general.kickmessage", "Kick message",
165
-                PreferencesType.TEXT);
166
-        settingsPanel.addOption("general.partmessage", "Part message",
167
-                PreferencesType.TEXT);
168
-
169
-        settingsPanel.addOption("ui.backgroundcolour", "Background colour",
170
-                PreferencesType.COLOUR);
171
-        settingsPanel.addOption("ui.foregroundcolour", "Foreground colour",
172
-                PreferencesType.COLOUR);
173
-        settingsPanel.addOption("ui.frameBufferSize", "Textpane buffer limit",
174
-                PreferencesType.INTEGER);
175
-
176
-        settingsPanel.addOption("ui.inputBufferSize", "Input buffer size",
177
-                PreferencesType.INTEGER);
178
-        settingsPanel.addOption("ui.textPaneFontName", "Textpane font name",
179
-                PreferencesType.TEXT);
180
-        settingsPanel.addOption("ui.textPaneFontSize", "Textpane font size",
181
-                PreferencesType.INTEGER);
182
-
183
-        settingsPanel.addOption("ui.inputbackgroundcolour",
184
-                "Input field background colour",
185
-                PreferencesType.COLOUR);
186
-        settingsPanel.addOption("ui.inputforegroundcolour",
187
-                "Input field foreground colour",
188
-                PreferencesType.COLOUR);
189
-        settingsPanel.addOption("ui.nicklistbackgroundcolour",
190
-                "Nicklist background colour",
191
-                PreferencesType.COLOUR);
192
-        settingsPanel.addOption("ui.nicklistforegroundcolour",
193
-                "Nicklist foreground colour",
194
-                PreferencesType.COLOUR);
195
-        settingsPanel.addOption("ui.shownickcoloursinnicklist",
196
-                "Show coloured nicks in nicklist",
197
-                PreferencesType.BOOLEAN);
198
-        settingsPanel.addOption("ui.shownickcoloursintext",
199
-                "Show coloured nicks in textpane",
200
-                PreferencesType.BOOLEAN);
201
-
202
-        settingsPanel.addOption("general.closechannelsonquit",
203
-                "Close channels on quit",
204
-                PreferencesType.BOOLEAN);
205
-        settingsPanel.addOption("general.closechannelsondisconnect",
206
-                "Close channels on disconnect",
207
-                PreferencesType.BOOLEAN);
208
-        settingsPanel.addOption("general.closequeriesonquit",
209
-                "Close queries on quit",
210
-                PreferencesType.BOOLEAN);
211
-        settingsPanel.addOption("general.closequeriesondisconnect",
212
-                "Close queries on disconnect",
213
-                PreferencesType.BOOLEAN);
214
-        settingsPanel.addOption("general.quitmessage", "Quit message",
215
-                PreferencesType.TEXT);
216
-        settingsPanel.addOption("general.reconnectmessage", "Reconnect message",
217
-                PreferencesType.TEXT);
218
-        settingsPanel.addOption("general.rejoinchannels",
219
-                "Rejoin channels on reconnect",
220
-                PreferencesType.BOOLEAN);
221
-        settingsPanel.addOption("general.pingtimeout", "Ping timeout",
222
-                PreferencesType.INTEGER);
158
+    private void addSettings(final SettingsPanel settingsPanel,
159
+            final ConfigManager manager, final Identity identity) {
160
+        settingsPanel.addOption(PreferencesManager.getPreferencesManager()
161
+                .getServerSettings(manager, identity));
223 162
     }
224 163
 }

+ 4
- 70
src/com/dmdirc/addons/ui_swing/dialogs/serversetting/ServerSettingsDialog.java View File

@@ -29,7 +29,7 @@ import com.dmdirc.addons.ui_swing.components.expandingsettings.SettingsPanel;
29 29
 import com.dmdirc.addons.ui_swing.dialogs.StandardDialog;
30 30
 import com.dmdirc.addons.ui_swing.dialogs.StandardQuestionDialog;
31 31
 import com.dmdirc.config.Identity;
32
-import com.dmdirc.config.prefs.PreferencesType;
32
+import com.dmdirc.config.prefs.PreferencesManager;
33 33
 
34 34
 import java.awt.Window;
35 35
 import java.awt.event.ActionEvent;
@@ -67,7 +67,7 @@ public final class ServerSettingsDialog extends StandardDialog implements Action
67 67
     /** The tabbed pane. */
68 68
     private JTabbedPane tabbedPane;
69 69
     /** Parent window. */
70
-    private Window parentWindow;
70
+    private final Window parentWindow;
71 71
 
72 72
     /**
73 73
      * Creates a new instance of ServerSettingsDialog.
@@ -181,74 +181,8 @@ public final class ServerSettingsDialog extends StandardDialog implements Action
181 181
 
182 182
     /** Adds the settings to the panel. */
183 183
     private void addSettings() {
184
-        settingsPanel.addOption("channel.splitusermodes", "Split user modes",
185
-                PreferencesType.BOOLEAN);
186
-        settingsPanel.addOption("channel.sendwho", "Send WHO",
187
-                PreferencesType.BOOLEAN);
188
-        settingsPanel.addOption("channel.showmodeprefix", "Show mode prefix",
189
-                PreferencesType.BOOLEAN);
190
-
191
-        settingsPanel.addOption("general.cyclemessage", "Cycle message",
192
-                PreferencesType.TEXT);
193
-        settingsPanel.addOption("general.kickmessage", "Kick message",
194
-                PreferencesType.TEXT);
195
-        settingsPanel.addOption("general.partmessage", "Part message",
196
-                PreferencesType.TEXT);
197
-
198
-        settingsPanel.addOption("ui.backgroundcolour", "Background colour",
199
-                PreferencesType.COLOUR);
200
-        settingsPanel.addOption("ui.foregroundcolour", "Foreground colour",
201
-                PreferencesType.COLOUR);
202
-        settingsPanel.addOption("ui.frameBufferSize", "Textpane buffer limit",
203
-                PreferencesType.INTEGER);
204
-        
205
-        settingsPanel.addOption("ui.inputBufferSize", "Input buffer size",
206
-                PreferencesType.INTEGER);
207
-        settingsPanel.addOption("ui.textPaneFontName", "Textpane font name",
208
-                PreferencesType.TEXT);
209
-        settingsPanel.addOption("ui.textPaneFontSize", "Textpane font size",
210
-                PreferencesType.INTEGER);
211
-        
212
-        settingsPanel.addOption("ui.inputbackgroundcolour",
213
-                "Input field background colour",
214
-                PreferencesType.COLOUR);
215
-        settingsPanel.addOption("ui.inputforegroundcolour",
216
-                "Input field foreground colour",
217
-                PreferencesType.COLOUR);
218
-        settingsPanel.addOption("ui.nicklistbackgroundcolour",
219
-                "Nicklist background colour",
220
-                PreferencesType.COLOUR);
221
-        settingsPanel.addOption("ui.nicklistforegroundcolour",
222
-                "Nicklist foreground colour",
223
-                PreferencesType.COLOUR);
224
-        settingsPanel.addOption("ui.shownickcoloursinnicklist",
225
-                "Show coloured nicks in nicklist",
226
-                PreferencesType.BOOLEAN);
227
-        settingsPanel.addOption("ui.shownickcoloursintext",
228
-                "Show coloured nicks in textpane",
229
-                PreferencesType.BOOLEAN);
230
-
231
-        settingsPanel.addOption("general.closechannelsonquit",
232
-                "Close channels on quit",
233
-                PreferencesType.BOOLEAN);
234
-        settingsPanel.addOption("general.closechannelsondisconnect",
235
-                "Close channels on disconnect",
236
-                PreferencesType.BOOLEAN);
237
-        settingsPanel.addOption("general.closequeriesonquit",
238
-                "Close queries on quit",
239
-                PreferencesType.BOOLEAN);
240
-        settingsPanel.addOption("general.closequeriesondisconnect",
241
-                "Close queries on disconnect",
242
-                PreferencesType.BOOLEAN);
243
-        settingsPanel.addOption("general.quitmessage", "Quit message",
244
-                PreferencesType.TEXT);
245
-        settingsPanel.addOption("general.reconnectmessage", "Reconnect message",
246
-                PreferencesType.TEXT);
247
-        settingsPanel.addOption("general.rejoinchannels",
248
-                "Rejoin channels on reconnect",
249
-                PreferencesType.BOOLEAN);
250
-        settingsPanel.addOption("general.pingtimeout", "Ping timeout",
251
-                PreferencesType.INTEGER);
184
+        settingsPanel.addOption(PreferencesManager.getPreferencesManager()
185
+                .getServerSettings(server.getConfigManager(), server.getServerIdentity()));
252 186
     }
253 187
 
254 188
     /** Initialises listeners for this dialog. */

Loading…
Cancel
Save