@@ -63,6 +63,11 @@ public class GuiTabEditor extends GuiFactory implements Consumer<ButtonElement>
6363 */
6464 private ButtonElement whitelistButton ;
6565
66+ /**
67+ * A button for toggling notification sounds.
68+ */
69+ private ButtonElement notifyButton ;
70+
6671 /**
6772 * The button to save the tab and return to the parent.
6873 */
@@ -108,7 +113,8 @@ public void accept(final ButtonElement buttonElement) {
108113 if (editingTab != null ) {
109114 // Save the changes.
110115 editingTab .updatePattern (patternElement .getTextField ().getText (),
111- !((Boolean ) expertModeButton .getMetadata ()), ((Boolean ) whitelistButton .getMetadata ()));
116+ !((Boolean ) expertModeButton .getMetadata ()), ((Boolean ) whitelistButton .getMetadata ()),
117+ ((Boolean ) notifyButton .getMetadata ()));
112118 editingTab .setPrefix (prefixElement .getTextField ().getText ());
113119 } else {
114120 // Create a new tab.
@@ -117,7 +123,8 @@ public void accept(final ButtonElement buttonElement) {
117123 patternElement .getTextField ().getText (),
118124 !((Boolean ) expertModeButton .getMetadata ()),
119125 ((Boolean ) whitelistButton .getMetadata ()),
120- prefixElement .getTextField ().getText ()
126+ prefixElement .getTextField ().getText (),
127+ ((Boolean ) notifyButton .getMetadata ())
121128 );
122129 }
123130 tabManager .saveState ();
@@ -138,6 +145,12 @@ public void accept(final ButtonElement buttonElement) {
138145
139146 // Update visuals to reflect the change.
140147 updateCaptions ();
148+ } else if (buttonElement == notifyButton ) {
149+ // Toggle the button's state in the metadata.
150+ notifyButton .setMetadata (!((Boolean ) notifyButton .getMetadata ()));
151+
152+ // Update visuals.
153+ updateCaptions ();
141154 }
142155 }
143156
@@ -192,8 +205,12 @@ protected void createGui() {
192205 addBlank (new Positioning ().relativeWidth (4 ));
193206
194207 whitelistButton = addButton (this ,
195- new Positioning ().relativeWidth (40 ).absoluteHeight (20 ). breakRow ( ));
208+ new Positioning ().relativeWidth (19 ).absoluteHeight (20 ));
196209 whitelistButton .setMetadata (editingTab == null || editingTab .isWhitelist ());
210+ addBlank (new Positioning ().relativeWidth (1 ));
211+
212+ notifyButton = addButton (this , new Positioning ().relativeWidth (19 ).absoluteHeight (20 ).breakRow ());
213+ notifyButton .setMetadata (editingTab != null && editingTab .isNotify ());
197214 addBlank (new Positioning ().breakRow ().absoluteHeight (10 ));
198215
199216 // At this point, all elements having captions are created.
@@ -211,7 +228,9 @@ protected void createGui() {
211228 0xA0A0A0 );
212229 addText (new Positioning ().breakRow ()).setText ("You can edit existing tabs by right clicking them" ,
213230 0xA0A0A0 );
214- addText (new Positioning ()).setText ("Don't use expert mode unless you understand regular expressions!" ,
231+ addText (new Positioning ().breakRow ()).setText ("Don't use expert mode unless you understand regular expressions!" ,
232+ 0xA0A0A0 );
233+ addText (new Positioning ()).setText ("Notifications play a sound when a new message is received in this tab" ,
215234 0xA0A0A0 );
216235
217236 saveButton = addButton (this , new Positioning ().alignBottom ().relativeWidth (27 ).absoluteHeight (20 ));
@@ -244,6 +263,9 @@ private void updateCaptions() {
244263 whitelistButton .getButton ().displayString =
245264 ((Boolean ) whitelistButton .getMetadata ()) ? "Whitelist" : "Blacklist" ;
246265
266+ notifyButton .getButton ().displayString =
267+ ((Boolean ) notifyButton .getMetadata ()) ? "Notify: Yes" : "Notify: No" ;
268+
247269 if ((Boolean ) expertModeButton .getMetadata ()) {
248270 // Provide expert caption.
249271 patternCaption .setText ("Tab Pattern (regular expression)" , 0xA0A0A0 );
0 commit comments