broken changes

This commit is contained in:
Mark Gregory
2026-11-05 13:01:47 +00:00
parent abee603250
commit d5b24bff29
6 changed files with 150 additions and 5 deletions
+24 -1
View File
@@ -268,13 +268,14 @@ struct DJDeckControls: View {
}
struct StudioSettingsPane: View {
var showHeading = true
@AppStorage("studioAppearance") private var appearance = "system"
@ObservedObject var model: AppModel
@State private var port = ""
var body: some View {
ScrollView {
VStack(alignment:.leading,spacing:22) {
HStack { VStack(alignment:.leading,spacing:4) { Text("Studio Settings").font(.title2.bold());Text("Changes save automatically on this Mac.").foregroundStyle(.secondary) };Spacer() }
if showHeading { HStack { VStack(alignment:.leading,spacing:4) { Text("Studio Settings").font(.title2.bold());Text("Changes save automatically on this Mac.").foregroundStyle(.secondary) };Spacer() } }
GroupBox("Appearance") {
HStack {
Picker("Appearance",selection:$appearance) {
@@ -608,3 +609,25 @@ struct RotationSongBrowser: View {
.onAppear { if model.selectedSinger == nil { model.selectedSinger = model.venueSingers.first?.id } }
}
}
struct StudioSettingsDialog: View {
@ObservedObject var model: AppModel
@Environment(\.dismiss) private var dismiss
var body: some View {
VStack(spacing:0) {
HStack(spacing:14) {
Image(systemName:"slider.horizontal.3").font(.title2).foregroundStyle(Color.accentColor)
VStack(alignment:.leading,spacing:4) {
Text("Studio Settings").font(.title2.bold())
Text("Karaoke playback, background music and hosting").font(.callout).foregroundStyle(.secondary)
}
Spacer()
}.padding(24)
Divider()
StudioSettingsPane(showHeading:false,model:model)
Divider()
HStack { Text("Changes save automatically on this Mac").font(.caption).foregroundStyle(.secondary);Spacer();Button("Done") { dismiss() }.keyboardShortcut(.defaultAction) }.padding(.horizontal,24).padding(.vertical,16)
}.frame(width:760,height:680).background(Color(nsColor:.windowBackgroundColor))
.alert("Settings",isPresented:Binding(get:{model.error != nil},set:{if !$0 { model.error = nil }})) { Button("OK") { model.error = nil } } message: { Text(model.error ?? "") }
}
}
+14 -3
View File
@@ -674,6 +674,7 @@ struct LibraryView: View {
@ObservedObject var model: AppModel
@State var showDJ = true
@State private var djSongSettings = false
@State private var studioSettingsModal = false
@State private var selected: Int64?
@State private var tableSelection = Set<Int64>()
@State private var waveformDetails = false
@@ -738,7 +739,15 @@ struct LibraryView: View {
Spacer()
if showDJ,["Library","Singer Songs","Playlists"].contains(source) {
Button("Song Settings") { djSongSettings = true }
.popover(isPresented:$djSongSettings) { detailPanel.frame(width:900,height:135).padding(12) }
.sheet(isPresented:$djSongSettings) {
VStack(spacing:0) {
HStack { VStack(alignment:.leading,spacing:4) { Text("Song Settings").font(.title2.bold());Text(selectedSong?.title ?? "Select a karaoke track to adjust its settings").font(.callout).foregroundStyle(.secondary) };Spacer() }.padding(24)
Divider()
detailPanel.frame(height:150).padding(16)
Divider()
HStack { Text("Changes save automatically").font(.caption).foregroundStyle(.secondary);Spacer();Button("Done") { djSongSettings = false }.keyboardShortcut(.defaultAction) }.padding(20)
}.frame(width:920).background(Color(nsColor:.windowBackgroundColor))
}
}
if source == "Library" {
Button { importing = true } label: { Label("Import Music",systemImage:"plus") }.buttonStyle(.bordered)
@@ -774,12 +783,14 @@ struct LibraryView: View {
.background(StudioTheme.frame)
.tint(.accentColor)
.focusedSceneValue(\.nameReinterpretation,NameReinterpretationCommands(perform:{beginReinterpretation()},enabled:["Library","Singer Songs"].contains(source) && (selectedSong != nil || !tableSelection.isEmpty)))
.focusedSceneValue(\.libraryCommands,LibraryCommands(importMusic:{importing = true},songInfo:{editingSong = selectedSong},canEdit:selectedSong != nil,play:playSelected,next:playNext,video:{openWindow(id:"lyrics")},settings:{source = "Settings"}))
.focusedSceneValue(\.libraryCommands,LibraryCommands(importMusic:{importing = true},songInfo:{editingSong = selectedSong},canEdit:selectedSong != nil,play:playSelected,next:playNext,video:{openWindow(id:"lyrics")},settings:{studioSettingsModal = true}))
.sheet(isPresented:$studioSettingsModal) { StudioSettingsDialog(model:model) }
.navigationTitle(source == "Singer Songs" ? (model.singers.first { $0.id == model.selectedSinger }?.name ?? "Singer") : source)
.navigationSubtitle(model.currentVenueName)
.searchable(text:$search,placement:.toolbar,prompt:"Search Music")
.toolbar {
ToolbarItemGroup {
Button { studioSettingsModal = true } label: { Label("Settings",systemImage:"gearshape") }
Button { showDJ.toggle() } label: { Label(showDJ ? "Hide DJ" : "Show DJ",systemImage:"waveform.path") }.help("Show or hide the DJ workspace; playback continues")
Menu {
Button("Import Files or Folder…") { importing = true }
@@ -924,7 +935,7 @@ struct LibraryView: View {
navigationRow("ShowScreens",symbol:"rectangle.on.rectangle")
navigationRow("Singer Web",symbol:"network")
navigationRow("Music Stores",symbol:"bag")
navigationRow("Settings",symbol:"gearshape")
Button { studioSettingsModal = true } label: { Label("Settings…",systemImage:"gearshape").frame(maxWidth:.infinity,alignment:.leading).padding(9) }.buttonStyle(.plain)
}.font(.body).listRowSeparator(.hidden).listRowInsets(EdgeInsets(top:1,leading:8,bottom:1,trailing:8))
}.listStyle(.sidebar)
Divider().padding(.horizontal,14)
+1 -1
View File
@@ -96,7 +96,7 @@ enum FileTagWriter {
guard exporter.supportedFileTypes.contains(type) else { throw LibraryError.message("This container cannot preserve its media during tag export") }
exporter.outputURL = temp;exporter.outputFileType = type
let keys: [AVMetadataKey] = [.commonKeyTitle,.commonKeyArtist,.commonKeyAlbumName,.commonKeyPublisher]
var items = asset.metadata.filter{!keys.contains($0.commonKey ?? AVMetadataKey(rawValue:""))}
var items = try await asset.load(.metadata).filter{!keys.contains($0.commonKey ?? AVMetadataKey(rawValue:""))}
for (identifier,value) in [(AVMetadataIdentifier.commonIdentifierTitle,song.title),(.commonIdentifierArtist,song.artist),(.commonIdentifierAlbumName,song.album),(.commonIdentifierPublisher,song.label)] {
let item = AVMutableMetadataItem();item.identifier = identifier;item.value = value as NSString;items.append(item)
}