Rettelser og reset

This commit is contained in:
2026-04-19 11:28:28 +02:00
parent f0a4b4dfa7
commit 80407e98fb
8 changed files with 148 additions and 19 deletions

View File

@@ -312,9 +312,14 @@ class LibraryPanel(QWidget):
missing = song.get("file_missing", False)
dance_parts = []
choreos = song.get("dance_choreographers", [])
for i, d in enumerate(dances):
lvl = dance_levels[i] if i < len(dance_levels) else ""
dance_parts.append(f"{d} / {lvl}" if lvl else d)
choreo = choreos[i] if i < len(choreos) else ""
part = f"{d} / {lvl}" if lvl else d
if choreo:
part += f" · {choreo}"
dance_parts.append(part)
dance_str = " · " + " | ".join(dance_parts) if dance_parts else ""
prefix = "" if missing else ""

View File

@@ -144,7 +144,9 @@ class PlaylistManagerDialog(QDialog):
for row in data.get("songs", []):
with get_db() as conn:
dances = conn.execute(
"SELECT dance_name FROM song_dances WHERE song_id=? ORDER BY dance_order",
"""SELECT d.name FROM song_dances sd
JOIN dances d ON d.id = sd.dance_id
WHERE sd.song_id=? ORDER BY sd.dance_order""",
(row["id"],)
).fetchall()
songs.append({
@@ -157,7 +159,7 @@ class PlaylistManagerDialog(QDialog):
"local_path": row.get("local_path", ""),
"file_format": row.get("file_format", ""),
"file_missing": bool(row.get("file_missing", False)),
"dances": [d["dance_name"] for d in dances],
"dances": [d["name"] for d in dances],
})
self.playlist_loaded.emit(pl["name"], songs)
self._load_status.setText(f"✓ Indlæst: {pl['name']} ({len(songs)} sange)")
@@ -277,7 +279,9 @@ class PlaylistManagerDialog(QDialog):
# Hent danse
with get_db() as conn:
dances = conn.execute(
"SELECT dance_name FROM song_dances WHERE song_id=? ORDER BY dance_order",
"""SELECT d.name FROM song_dances sd
JOIN dances d ON d.id = sd.dance_id
WHERE sd.song_id=? ORDER BY sd.dance_order""",
(row["id"],)
).fetchall()
found.append({
@@ -290,7 +294,7 @@ class PlaylistManagerDialog(QDialog):
"local_path": row["local_path"],
"file_format": row["file_format"],
"file_missing": bool(row["file_missing"]),
"dances": [d["dance_name"] for d in dances],
"dances": [d["name"] for d in dances],
})
elif os.path.exists(p) and is_supported(p):
# Filen er ikke scannet endnu — høst tags og tilføj

View File

@@ -120,6 +120,27 @@ class TagEditorDialog(QDialog):
grp = QGroupBox(_("tags.dances"))
layout = QVBoxLayout(grp)
# Kolonneoverskrifter
hdr = QWidget()
hdr_layout = QHBoxLayout(hdr)
hdr_layout.setContentsMargins(0, 0, 0, 0)
hdr_layout.setSpacing(4)
lbl_dans = QLabel("Dans")
lbl_dans.setObjectName("result_count")
lbl_niveau = QLabel("Niveau")
lbl_niveau.setObjectName("result_count")
lbl_niveau.setFixedWidth(130)
lbl_choreo = QLabel("Koreograf")
lbl_choreo.setObjectName("result_count")
lbl_choreo.setFixedWidth(140)
lbl_btn = QLabel("") # plads til knapper
lbl_btn.setFixedWidth(72)
hdr_layout.addWidget(lbl_dans, stretch=2)
hdr_layout.addWidget(lbl_niveau)
hdr_layout.addWidget(lbl_choreo)
hdr_layout.addWidget(lbl_btn)
layout.addWidget(hdr)
# Eksisterende danse
scroll = QScrollArea()
scroll.setWidgetResizable(True)
@@ -175,6 +196,8 @@ class TagEditorDialog(QDialog):
edit = DanceLineEdit("Dans...", self)
edit.setText(name)
edit.setToolTip(name)
edit.textChanged.connect(lambda txt, e=edit: e.setToolTip(txt))
row_layout.addWidget(edit, stretch=2)
# Niveau-dropdown
@@ -195,8 +218,12 @@ class TagEditorDialog(QDialog):
choreo_edit.setText(choreographer)
choreo_edit.setPlaceholderText("Koreograf...")
choreo_edit.setFixedWidth(140)
choreo_edit.setToolTip(choreographer)
choreo_edit.textChanged.connect(
lambda txt, ce=choreo_edit: self._show_choreo_suggestions(txt, ce)
lambda txt, ce=choreo_edit: (
ce.setToolTip(txt),
self._show_choreo_suggestions(txt, ce)
)
)
row_layout.addWidget(choreo_edit)