C6: progress bar from hints.value, maxHistory default -1 (unlimited)
This commit is contained in:
parent
3a9cd59243
commit
20cb306ad6
5 changed files with 50 additions and 8 deletions
|
|
@ -108,9 +108,9 @@ QtObject {
|
|||
item._expireTimer.running = true;
|
||||
}
|
||||
|
||||
// Trim history
|
||||
const maxHistory = M.Modules.notifications.maxHistory || 50;
|
||||
while (root.list.length > maxHistory) {
|
||||
// Trim history (-1 = unlimited)
|
||||
const maxHistory = M.Modules.notifications.maxHistory ?? -1;
|
||||
while (maxHistory > 0 && root.list.length > maxHistory) {
|
||||
const old = root.list.pop();
|
||||
old.finishDismiss();
|
||||
delete root._byId[old.id];
|
||||
|
|
@ -146,8 +146,9 @@ QtObject {
|
|||
onLoaded: {
|
||||
try {
|
||||
const data = JSON.parse(text());
|
||||
const maxHistory = M.Modules.notifications.maxHistory || 50;
|
||||
for (let i = 0; i < Math.min(data.length, maxHistory); i++) {
|
||||
const maxHistory = M.Modules.notifications.maxHistory ?? -1;
|
||||
const limit = maxHistory > 0 ? Math.min(data.length, maxHistory) : data.length;
|
||||
for (let i = 0; i < limit; i++) {
|
||||
const n = data[i];
|
||||
const item = _itemComp.createObject(root, {
|
||||
id: "p_" + (n.id ?? i) + "_" + n.time,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue