// 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 = ""; } }