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/Snack.qml | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 desktop/Snack.qml (limited to 'desktop/Snack.qml') diff --git a/desktop/Snack.qml b/desktop/Snack.qml new file mode 100644 index 0000000..b955ad2 --- /dev/null +++ b/desktop/Snack.qml @@ -0,0 +1,41 @@ +// Copyright (C) 2026 Danilo M. +// +// This program is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License version 2 as +// published by the Free Software Foundation. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +pragma Singleton + +import Quickshell +import QtQuick + +// The settings window's one message, shown by Snackbar.qml at the foot of the +// window: what a save, an apply or an upload said. A page calls ok(), wait() +// or error(); a new message replaces the last. ok() fades by itself, wait() +// and error() stay until dismissed or replaced. SaveBar forwards its notice +// and error here, so a page using it needs nothing more. +Singleton { + id: root + + property string text: "" + property color color: Theme.green + property bool sticky: false + // Bumped on every show, so the same text twice restarts the fade. + property int serial: 0 + + function show(text, color, sticky) { + root.text = text; + root.color = color; + root.sticky = !!sticky; + root.serial++; + } + function ok(text) { root.show(text, Theme.green, false); } + function wait(text) { root.show(text, Theme.yellow, true); } + function error(text) { root.show(text, Theme.red, true); } + function clear() { root.text = ""; } +} -- cgit v1.2.3