From 3d045076d49ee7cc074f670806a823099ea9fb09 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Sat, 7 Nov 2026 12:38:18 +0100 Subject: settings: one snackbar for every page's messages Save, apply and upload results went to the page header, one line capped at 420px and cut with an ellipsis. They now go to a snackbar at the foot of the settings window, wrapped in full: green fades after 6s, yellow and red stay until dismissed or replaced, and changing page clears it. Snack.qml is the singleton pages call (ok, wait, error); Snackbar.qml draws it once in Settings.qml. SaveBar forwards its notice and error, so the 24 pages using it change nothing; the header keeps only the draft's state. The boot logo page calls Snack directly. Co-Authored-By: Claude Opus 5.5 --- desktop/SaveBar.qml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'desktop/SaveBar.qml') diff --git a/desktop/SaveBar.qml b/desktop/SaveBar.qml index 147d00b..239b896 100644 --- a/desktop/SaveBar.qml +++ b/desktop/SaveBar.qml @@ -18,10 +18,11 @@ import QtQuick // does (Apply and Reset for a staged wallpaper or cursor, Save + Restart for // a daemon that rereads only at start); busy shows while a save runs. // -// The outcome of a save is reported here too, not at the foot of the page: -// notice is what a finished save says ("saved"), shown once the page is -// clean, in noticeColor; error is a save refused or failed, which leaves the -// draft dirty, so it is shown over "unsaved changes", in red. +// The outcome of a save goes to the window's snackbar (Snack.qml), where it +// is shown in full: notice is what a finished save says ("saved"), in +// noticeColor, fading by itself; error is a save refused or failed, in red, +// staying until dismissed. Only the draft's state stays here, beside the +// buttons: "unsaved changes", or what is wrong when Save is held back. Row { id: bar property bool dirty: false @@ -37,18 +38,17 @@ Row { signal discard spacing: 8 + onNoticeChanged: if (bar.notice !== "") Snack.show(bar.notice, bar.noticeColor, false) + onErrorChanged: if (bar.error !== "") Snack.error(bar.error) + Text { anchors.verticalCenter: parent.verticalCenter - visible: bar.error !== "" || bar.dirty || bar.notice !== "" - // ponytail: a long message elides; the header has one line. + visible: bar.dirty + // ponytail: a long note elides; the header has one line. width: Math.min(implicitWidth, 420) elide: Text.ElideRight - text: bar.error !== "" ? bar.error - : !bar.dirty ? bar.notice - : !bar.valid ? (bar.note || "fix the fields marked red") : "unsaved changes" - color: bar.error !== "" ? Theme.red - : !bar.dirty ? bar.noticeColor - : bar.valid ? Theme.yellow : Theme.red + text: !bar.valid ? (bar.note || "fix the fields marked red") : "unsaved changes" + color: bar.valid ? Theme.yellow : Theme.red font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 4 } } Button { -- cgit v1.2.3