]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Implement "Menu sounds" and "Focus sounds" checkboxes in a more sane way (they were...
authorterencehill <piuntn@gmail.com>
Fri, 22 Apr 2016 17:35:50 +0000 (19:35 +0200)
committerterencehill <piuntn@gmail.com>
Fri, 22 Apr 2016 17:35:50 +0000 (19:35 +0200)
qcsrc/menu/xonotic/checkbox.qc
qcsrc/menu/xonotic/checkbox.qh
qcsrc/menu/xonotic/dialog_settings_audio.qc

index 6015e48bad45369c9b350e4eefe38d29202f2e8a..b863518981b7b9fb5023e881fc695754e7d7cfcb 100644 (file)
@@ -58,6 +58,8 @@ void XonoticCheckBox_setChecked(entity me, float val)
        {
                me.checked = val;
                me.saveCvars(me);
+               if(me.linkedCheckBox)
+                       me.linkedCheckBox.loadCvars(me.linkedCheckBox);
        }
 }
 void XonoticCheckBox_loadCvars(entity me)
index a188f4c0aeb0c61f304d44ba213d5f2ced89a8c7..90a1bf5d4b67e4906223b4c8bf5392e5e82e0dab 100644 (file)
@@ -21,6 +21,7 @@ CLASS(XonoticCheckBox, CheckBox)
 
        ATTRIB(XonoticCheckBox, alpha, float, SKINALPHA_TEXT)
        ATTRIB(XonoticCheckBox, disabledAlpha, float, SKINALPHA_DISABLED)
+       ATTRIB(XonoticCheckBox, linkedCheckBox, entity, NULL)
 ENDCLASS(XonoticCheckBox)
 entity makeXonoticCheckBox_T(float, string, string, string);
 entity makeXonoticCheckBox(float, string, string);
index 4a25682e0b01c95e8e71ed39a06d46e7b81b2ed6..7af8c550032b3dec7e6368f19b6ada4cfe8099d7 100644 (file)
@@ -17,7 +17,7 @@ entity makeXonoticAudioSettingsTab()
 
 void XonoticAudioSettingsTab_fill(entity me)
 {
-       entity e, s;
+       entity e, e2, s;
        entity audioApplyButton = makeXonoticCommandButton(_("Apply immediately"), '0 0 0',
                "snd_restart;"
                "snd_attenuation_method_${menu_snd_attenuation_method};"
@@ -146,13 +146,11 @@ void XonoticAudioSettingsTab_fill(entity me)
        me.TR(me);
                me.TD(me, 1, 3, makeXonoticCheckBox(0, "con_chatsound", _("Chat message sound")));
        me.TR(me);
-               me.hiddenMenuSoundsSlider = makeXonoticSlider_T(1, 1, 1, "menu_sounds",
-                       _("Play sounds when clicking or hovering over menu items"));
-               me.TD(me, 1, 1.2, e = makeXonoticSliderCheckBox(0, 1, me.hiddenMenuSoundsSlider, _("Menu sounds")));
-                       e.tooltip = me.hiddenMenuSoundsSlider.tooltip;
-               me.TD(me, 1, 1.8, e = makeXonoticSliderCheckBox(2, 0, me.hiddenMenuSoundsSlider, _("Focus sounds")));
-                       e.tooltip = me.hiddenMenuSoundsSlider.tooltip;
-               setDependent(e, "menu_sounds", 1, 2);
+               me.TD(me, 1, 1.2, e = makeXonoticCheckBox_T(0, "menu_sounds", _("Menu sounds"),
+                       _("Play sounds when clicking menu items")));
+               me.TD(me, 1, 1.2, e.linkedCheckBox = e2 = makeXonoticCheckBoxEx_T(2, 1, "menu_sounds", _("Focus sounds"),
+                       _("Play sounds when hovering over menu items too")));
+               setDependent(e2, "menu_sounds", 1, 2);
        me.TR(me);
        me.TR(me);
                me.TD(me, 1, 1, makeXonoticTextLabel(0, _("Time announcer:")));