disable ds options conditionally

This commit is contained in:
thecozies 2024-03-30 10:36:23 -05:00
parent 1caf81e1cf
commit 7648753fe7
4 changed files with 41 additions and 14 deletions

View File

@ -21,9 +21,9 @@
<div class="config-option__list">
<input type="radio" name="downsampling" data-checked="ds_option" value="1" id="ds_windowed" style="nav-up:#tab_graphics"/>
<label class="config-option__tab-label" for="ds_windowed">Off</label>
<input type="radio" name="downsampling" data-checked="ds_option" value="2" id="ds_2x" style="nav-up:#tab_graphics"/>
<input type="radio" name="downsampling" data-attrif-disabled="res_option == 'Auto'" data-checked="ds_option" value="2" id="ds_2x" style="nav-up:#tab_graphics"/>
<label class="config-option__tab-label" for="ds_2x">2x</label>
<input type="radio" name="downsampling" data-checked="ds_option" value="4" id="ds_4x" style="nav-right:none;nav-up:#tab_graphics"/>
<input type="radio" name="downsampling" data-attrif-disabled="res_option == 'Auto'" data-checked="ds_option" value="4" id="ds_4x" style="nav-right:none;nav-up:#tab_graphics"/>
<label class="config-option__tab-label" for="ds_4x">4x</label>
</div>
<div class="config-option__details">{{ds_info}}</div>

File diff suppressed because one or more lines are too long

View File

@ -103,23 +103,34 @@
input.radio {
@extend %nav-all;
@include trans-colors-opa;
visibility: visible;
width: 0;
height: 0;
&:checked + .config-option__tab-label {
border-bottom: 1dp;
border-color: $color-border-hard;
&:not(:disabled) {
&:checked + .config-option__tab-label {
border-bottom: 1dp;
border-color: $color-border-hard;
&:hover {
cursor: default;
}
}
&:focus + .config-option__tab-label,
&:hover + .config-option__tab-label {
color: $color-text;
}
}
&:disabled + .config-option__tab-label {
opacity: 0.5;
&:hover {
cursor: default;
}
}
&:focus + .config-option__tab-label,
&:hover + .config-option__tab-label {
color: $color-text;
}
}
input.range slidertrack {

View File

@ -45,7 +45,11 @@ template <typename T>
void bind_option(Rml::DataModelConstructor& constructor, const std::string& name, T* option) {
constructor.BindFunc(name,
[option](Rml::Variant& out) { get_option(*option, out); },
[option](const Rml::Variant& in) { set_option(*option, in); graphics_model_handle.DirtyVariable("options_changed"); graphics_model_handle.DirtyVariable("ds_info"); }
[option](const Rml::Variant& in) {
set_option(*option, in);
graphics_model_handle.DirtyVariable("options_changed");
graphics_model_handle.DirtyVariable("ds_info");
}
);
};
@ -293,7 +297,15 @@ public:
}
new_options = ultramodern::get_graphics_config();
bind_option(constructor, "res_option", &new_options.res_option);
constructor.BindFunc("res_option",
[](Rml::Variant& out) { get_option(new_options.res_option, out); },
[](const Rml::Variant& in) {
set_option(new_options.res_option, in);
graphics_model_handle.DirtyVariable("options_changed");
graphics_model_handle.DirtyVariable("ds_info");
graphics_model_handle.DirtyVariable("ds_option");
}
);
bind_option(constructor, "wm_option", &new_options.wm_option);
bind_option(constructor, "ar_option", &new_options.ar_option);
bind_option(constructor, "msaa_option", &new_options.msaa_option);
@ -308,7 +320,11 @@ public:
});
constructor.BindFunc("ds_option",
[](Rml::Variant& out) {
out = new_options.ds_option;
if (new_options.res_option == ultramodern::Resolution::Auto) {
out = 1;
} else {
out = new_options.ds_option;
}
},
[](const Rml::Variant& in) {
new_options.ds_option = in.Get<int>();