mirror of
https://github.com/LizardByte/Sunshine.git
synced 2026-02-04 16:15:27 +00:00
feat(display): add display mode remapping option (#3529)
Co-authored-by: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com>
This commit is contained in:
@ -33,7 +33,6 @@
|
||||
<general
|
||||
v-if="currentTab === 'general'"
|
||||
:config="config"
|
||||
:global-prep-cmd="global_prep_cmd"
|
||||
:platform="platform">
|
||||
</general>
|
||||
|
||||
@ -127,7 +126,6 @@
|
||||
restarted: false,
|
||||
config: null,
|
||||
currentTab: "general",
|
||||
global_prep_cmd: [],
|
||||
tabs: [ // TODO: Move the options to each Component instead, encapsulate.
|
||||
{
|
||||
id: "general",
|
||||
@ -136,7 +134,7 @@
|
||||
"locale": "en",
|
||||
"sunshine_name": "",
|
||||
"min_log_level": 2,
|
||||
"global_prep_cmd": "[]",
|
||||
"global_prep_cmd": [],
|
||||
"notify_pre_releases": "disabled",
|
||||
},
|
||||
},
|
||||
@ -178,6 +176,7 @@
|
||||
"dd_manual_refresh_rate": "",
|
||||
"dd_hdr_option": "auto",
|
||||
"dd_config_revert_delay": 3000,
|
||||
"dd_mode_remapping": {"mixed": [], "resolution_only": [], "refresh_rate_only": []},
|
||||
"dd_wa_hdr_toggle": "disabled",
|
||||
"min_fps_factor": 1,
|
||||
},
|
||||
@ -320,17 +319,23 @@
|
||||
|
||||
// TODO: let each tab's Component handle it's own data instead of doing it here
|
||||
|
||||
// Parse the special options before population if available
|
||||
const specialOptions = ["dd_mode_remapping", "global_prep_cmd"]
|
||||
for (const optionKey of specialOptions) {
|
||||
if (this.config.hasOwnProperty(optionKey)) {
|
||||
this.config[optionKey] = JSON.parse(this.config[optionKey]);
|
||||
}
|
||||
}
|
||||
|
||||
// Populate default values from tabs options
|
||||
this.tabs.forEach(tab => {
|
||||
Object.keys(tab.options).forEach(optionKey => {
|
||||
if (this.config[optionKey] === undefined) {
|
||||
this.config[optionKey] = tab.options[optionKey];
|
||||
// Make sure to copy by value
|
||||
this.config[optionKey] = JSON.parse(JSON.stringify(tab.options[optionKey]));
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
this.config.global_prep_cmd = this.config.global_prep_cmd || [];
|
||||
this.global_prep_cmd = JSON.parse(this.config.global_prep_cmd);
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
@ -338,26 +343,26 @@
|
||||
this.$forceUpdate()
|
||||
},
|
||||
serialize() {
|
||||
this.config.global_prep_cmd = JSON.stringify(this.global_prep_cmd);
|
||||
let config = JSON.parse(JSON.stringify(this.config));
|
||||
config.global_prep_cmd = JSON.stringify(config.global_prep_cmd);
|
||||
config.dd_mode_remapping = JSON.stringify(config.dd_mode_remapping);
|
||||
return config;
|
||||
},
|
||||
save() {
|
||||
this.saved = false;
|
||||
this.restarted = false;
|
||||
this.serialize();
|
||||
|
||||
// create a temp copy of this.config to use for the post request
|
||||
let config = JSON.parse(JSON.stringify(this.config))
|
||||
let config = this.serialize();
|
||||
|
||||
// delete default values from this.config
|
||||
this.tabs.forEach(tab => {
|
||||
Object.keys(tab.options).forEach(optionKey => {
|
||||
let delete_value = false
|
||||
|
||||
if (["global_prep_cmd"].includes(optionKey)) {
|
||||
let config_value, default_value
|
||||
|
||||
config_value = JSON.parse(config[optionKey])
|
||||
default_value = JSON.parse(tab.options[optionKey])
|
||||
if (["global_prep_cmd", "dd_mode_remapping"].includes(optionKey)) {
|
||||
const config_value = config[optionKey]
|
||||
const default_value = JSON.stringify(tab.options[optionKey])
|
||||
|
||||
if (config_value === default_value) {
|
||||
delete_value = true
|
||||
|
||||
Reference in New Issue
Block a user