diff options
Diffstat (limited to 'desktop/modules/appearance/Udt.qml')
| -rw-r--r-- | desktop/modules/appearance/Udt.qml | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/desktop/modules/appearance/Udt.qml b/desktop/modules/appearance/Udt.qml index a4bf296..98fbba7 100644 --- a/desktop/modules/appearance/Udt.qml +++ b/desktop/modules/appearance/Udt.qml @@ -150,4 +150,59 @@ Singleton { code === 0 ? "" : `install.sh exited ${code}, its output is in the steps window`); } } + + // The consumers come from install.sh itself, one c_<name> function each, + // so adding one in unified-desktop-theme needs no edit here. + property list<string> consumers: [] + // name -> what it themes, the comment on its function line. + property var consumerInfo: ({}) + // name -> "software" or "hardware", for the page's two lists. + property var consumerKind: ({}) + function refreshStatus() { + statusProc.running = false; + statusProc.running = true; + } + + Process { + id: statusProc + command: [`${root.repo}/install.sh`, "--list"] + stdout: StdioCollector { + onStreamFinished: { + const rows = text.trim().split("\n").filter(s => s.length).map(l => l.split("\t")); + // QML's JS engine has no Object.fromEntries. + const info = {}, kind = {}; + for (const [n, k, d] of rows) { kind[n] = k; info[n] = d ?? ""; } + root.consumerInfo = info; + root.consumerKind = kind; + root.consumers = rows.map(r => r[0]); + } + } + } + + // One run at a time, so two never race over the generated files. + // "*" is every consumer at once, install.sh with no argument. + // install.sh hands a failure's output to the steps window itself. + property string reapplying: "" + // name -> true (ok) / false (failed), for the run this session. + property var reapplied: ({}) + function reapply(name) { + if (applying || reapplying !== "") return; + reapplying = name; + reapplyProc.command = [`${root.repo}/install.sh`].concat(name === "*" ? [] : [name]); + reapplyProc.running = true; + } + function isReapplying(name) { return reapplying === "*" || reapplying === name; } + + Process { + id: reapplyProc + onExited: code => { + const next = Object.assign({}, root.reapplied); + // ponytail: a full run marks every row by the one exit code, since + // install.sh stops at the first failure without naming it. + for (const n of root.reapplying === "*" ? root.consumers : [root.reapplying]) + next[n] = code === 0; + root.reapplied = next; + root.reapplying = ""; + } + } } |
