// 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. import QtQuick import "../.." Column { id: dev signal go(string name) readonly property var p: Sonix.player spacing: 10 component Line: Row { id: line property string k: "" property string v: "" spacing: 10 Text { width: 110 text: line.k font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 2 } color: Theme.subtext } Text { textFormat: Text.PlainText text: line.v font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 2 } color: Theme.text } } Line { k: "Name"; v: Sonix.name } Line { k: "Address"; v: `${Sonix.host}:${Sonix.port}` } Line { k: "Battery" v: dev.p.battery === undefined ? "\u2026" : dev.p.battery + "%" + (dev.p.charging ? ", charging" : "") } Row { spacing: 10 Text { width: 110 text: "Accent" font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 2 } color: Theme.subtext } Rectangle { width: 18; height: 18; radius: 4 color: dev.p.accent || "transparent" border.width: 1 border.color: Qt.alpha(Theme.text, 0.2) } Text { textFormat: Text.PlainText text: dev.p.accent || "" font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 2 } color: Theme.text } } Line { k: "Library" v: dev.p.scanning ? `scanning\u2026 ${dev.p.scan_count ?? 0} found` : dev.p.tracks === undefined ? "\u2026" : dev.p.tracks + " tracks" } Line { k: "Now" v: (["stopped", "playing", "paused"][dev.p.state || 0] ?? "stopped") + (dev.p.title ? " \u00b7 " + dev.p.title : "") } Row { spacing: 8 Button { text: "Rescan" enabled: !dev.p.scanning onClicked: Sonix.command({ do: "scan" }, null, (ok, d, err) => msg.text = ok ? "" : err) } Button { text: "Open Wi-Fi transfer" onClicked: Qt.openUrlExternally(`http://${Sonix.host}/`) } Button { text: "Boot logo\u2026" onClicked: dev.go("bootlogo") } } Text { width: dev.width wrapMode: Text.Wrap text: "Wi-Fi transfer answers only while its page is open on the player." font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 5 } color: Theme.subtext } Text { id: msg visible: text !== "" width: dev.width wrapMode: Text.Wrap font { family: Theme.fontFamily; pixelSize: Theme.fontSize - 4 } color: Theme.red } }