aboutsummaryrefslogtreecommitdiffstats
path: root/desktop/modules/companion/ArtistsModule.qml
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/modules/companion/ArtistsModule.qml')
-rw-r--r--desktop/modules/companion/ArtistsModule.qml67
1 files changed, 0 insertions, 67 deletions
diff --git a/desktop/modules/companion/ArtistsModule.qml b/desktop/modules/companion/ArtistsModule.qml
deleted file mode 100644
index a0d23f4..0000000
--- a/desktop/modules/companion/ArtistsModule.qml
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright (C) 2026 Danilo M. <danix@danix.xyz>
-//
-// 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 "../.."
-import "../../companion/Lines.js" as Lines
-
-// The lines the companion says when a track by an artist she knows starts,
-// matched as a case-insensitive substring of the player's artist. Same
-// draft, Save and Reset as PhrasesModule, on Prefs.companionArtists and
-// Lines.artists; the page's cls field holds the artist.
-Module {
- id: am
- name: "artists"
- label: "Companion artists"
- // nf-fa-music, present in Inconsolata Nerd Font.
- icon: "\uf001"
- settings: true
- group: "Companion"
- keywords: ["companion", "artist", "music", "song", "track", "line", "say", "2b"]
- searchItems: am.shown.map((a, i) => ({ text: a.cls + ": " + a.lines.join(" / "), key: "app:" + i }))
-
- property var draft: null
- property bool resetting: false
- readonly property var shown: am.draft ?? Lines.appList(Prefs.companionArtists, Lines.artists)
- readonly property bool valid: am.shown.every(a => String(a.cls).trim() !== ""
- && (a.lines || []).some(l => String(l).trim() !== ""))
- dirty: am.draft !== null
-
- function edit(list) { am.draft = list; am.resetting = false; }
- function reset() { am.draft = Lines.appList(null, Lines.artists); am.resetting = true; }
- function save() {
- if (am.resetting) Prefs.resetCompanionArtists();
- else Prefs.setCompanionArtists(Lines.toMap(am.draft));
- am.discard();
- }
- function discard() { am.draft = null; am.resetting = false; }
-
- page: Component {
- Page {
- title: "Companion artists"
- actions: Component {
- SaveBar { dirty: am.dirty; valid: am.valid; note: "every artist needs a name and a phrase"
- onSave: am.save(); onDiscard: am.discard() }
- }
- PhrasesPage {
- width: parent.width
- owner: am
- intro: "When a track by an artist she knows starts or changes, she says one of their lines at "
- + "random, under her 30 s line cooldown. The name matches any part of the player's artist, "
- + "ignoring case, so \"daft punk\" also catches \"Daft Punk, Pharrell Williams\". "
- + "Save applies at once."
- keyHint: "artist, e.g. linkin park"
- addText: "Add artist"
- saved: Prefs.companionArtists
- }
- }
- }
-}