fix process follows device and process changes are auto-saved
This commit is contained in:
parent
1c2b1c2220
commit
903fd2eff7
2 changed files with 32 additions and 5 deletions
|
|
@ -723,9 +723,8 @@
|
|||
let mode = API.mode.get(),
|
||||
current = settings(),
|
||||
local = isLocalDevice(devicename),
|
||||
dproc = current.devproc[devicename],
|
||||
dev = current.device = CONF.device_from_code(code,mode),
|
||||
proc = current.process,
|
||||
dproc = current.devproc[devicename], // last process name for this device
|
||||
newdev = dproc === undefined, // first time device is selected
|
||||
predev = current.filter[mode], // previous device selection
|
||||
chgdev = predev !== devicename; // device is changing
|
||||
|
|
@ -734,10 +733,12 @@
|
|||
if (code.profiles) {
|
||||
for (let profile of code.profiles) {
|
||||
let profname = profile.processName;
|
||||
// if no saved profile by that name for this mode...
|
||||
if (!current.sproc[mode][profname]) {
|
||||
console.log('adding profile', profname, 'to', mode);
|
||||
current.sproc[mode][profname] = profile;
|
||||
}
|
||||
// if it's a new device, seed the new profile name as last profile
|
||||
if (newdev && !current.devproc[devicename]) {
|
||||
console.log('setting default profile for new device', devicename, 'to', profname);
|
||||
current.devproc[devicename] = dproc = profname;
|
||||
|
|
@ -836,7 +837,9 @@
|
|||
API.view.update_fields();
|
||||
platform.update_size();
|
||||
|
||||
// store current device name for this mode
|
||||
current.filter[mode] = devicename;
|
||||
// cache device record for this mode (restored in setMode)
|
||||
current.cdev[mode] = currentDevice = dev;
|
||||
|
||||
if (dproc) {
|
||||
|
|
@ -994,6 +997,7 @@
|
|||
let exp = btoa(JSON.stringify({
|
||||
version: KIRI.version,
|
||||
device: selected,
|
||||
process: API.process.code(),
|
||||
code: devs[selected],
|
||||
time: Date.now()
|
||||
}));
|
||||
|
|
|
|||
|
|
@ -257,6 +257,7 @@
|
|||
layer_max: 0
|
||||
},
|
||||
device: {
|
||||
code: currentDeviceCode,
|
||||
get: currentDeviceName,
|
||||
set: noop, // set during init
|
||||
clone: noop // set during init
|
||||
|
|
@ -311,6 +312,10 @@
|
|||
grid : function() { return false },
|
||||
local : function() { return false }
|
||||
},
|
||||
process: {
|
||||
code: currentProcessCode,
|
||||
get: currentProcessName
|
||||
},
|
||||
platform,
|
||||
selection,
|
||||
show: {
|
||||
|
|
@ -2185,6 +2190,11 @@
|
|||
if (val === '' && tval == null) {
|
||||
continue;
|
||||
}
|
||||
if (Array.isArray(tval) && Array.isArray(val)) {
|
||||
if (JSON.stringify(tval) == JSON.stringify(val)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (tval != val) {
|
||||
// console.log(key, 'expected', val, 'got', tval);
|
||||
same = false;
|
||||
|
|
@ -2551,13 +2561,14 @@
|
|||
|
||||
function loadSettings(e, named) {
|
||||
let mode = getMode(),
|
||||
name = e ? e.target.getAttribute("load") : named || "default",
|
||||
name = e ? e.target.getAttribute("load") : named || currentProcessName() || "default",
|
||||
load = settings.sproc[mode][name];
|
||||
|
||||
if (!load) return;
|
||||
|
||||
// clone loaded process into settings
|
||||
settings.process = clone(load);
|
||||
// cloning loaded process into settings requires user to save
|
||||
// process before switching devices or risk losing any changes
|
||||
settings.process = load;//clone(load);
|
||||
// update process name
|
||||
settings.process.processName = name;
|
||||
// save named process with the current device
|
||||
|
|
@ -2815,6 +2826,18 @@
|
|||
return settings.filter[getMode()];
|
||||
}
|
||||
|
||||
function currentDeviceCode() {
|
||||
return settings.devices[currentDeviceName()];
|
||||
}
|
||||
|
||||
function currentProcessName() {
|
||||
return settings.cproc[getMode()];
|
||||
}
|
||||
|
||||
function currentProcessCode() {
|
||||
return settings.sproc[getMode()][currentProcessName()];
|
||||
}
|
||||
|
||||
function setControlsVisible(show) {
|
||||
$('mid-lcol').style.display = show ? 'flex' : 'none';
|
||||
$('mid-rcol').style.display = show ? 'flex' : 'none';
|
||||
|
|
|
|||
Loading…
Reference in a new issue