removed unwanted bar now with waveforms, major updates and enhancements
This commit is contained in:
@@ -719,6 +719,7 @@ struct ImportProgressPanel: View {
|
||||
var background: (() -> Void)? = nil
|
||||
var isMove = false
|
||||
var activity: String? = nil
|
||||
var waveformStatus: BackgroundWaveformStatus? = nil
|
||||
private var fraction: Double { progress.total > 0 ? min(1,max(0,Double(progress.completed)/Double(progress.total))) : 0 }
|
||||
private var accent: Color { progress.failure != nil || progress.cancelled ? .orange : progress.finished ? .green : .cyan }
|
||||
private var title: String { if let activity { return progress.finished ? (progress.cancelled ? "Cancelled" : progress.failure == nil ? "Library Updated" : "Library Needs Attention") : activity };if isMove { return progress.finished ? (progress.cancelled ? "Move Cancelled" : progress.failure == nil ? "Move Complete" : "Move Needs Attention") : "Moving Media and Waveforms" };return progress.finished ? (progress.cancelled ? "Import Cancelled" : progress.failure == nil ? "Import Complete" : "Import Needs Attention") : "Importing Music" }
|
||||
@@ -755,7 +756,8 @@ struct ImportProgressPanel: View {
|
||||
count("Skipped",value:progress.skipped,color:.orange)
|
||||
count("Remaining",value:progress.total > 0 ? max(0,progress.total-progress.completed) : -1,color:.cyan)
|
||||
}
|
||||
ImportLogView(progress:progress,title:activity != nil ? "Library Log" : isMove ? "Transfer Log" : "Import Log").frame(height:260)
|
||||
if let waveformStatus { waveformStatus }
|
||||
ImportLogView(progress:progress,title:activity != nil ? "Library Log" : isMove ? "Transfer Log" : "Import Log").frame(height:waveformStatus == nil ? 260 : 200)
|
||||
Divider()
|
||||
HStack {
|
||||
Text(progress.finished ? "Review the log or copy it before closing." : isMove ? "Copies are verified before originals are removed." : "You can cancel safely; completed tracks stay in your library.").font(.caption).foregroundStyle(.secondary)
|
||||
@@ -785,7 +787,8 @@ struct ImportLogView: View {
|
||||
var title = "Import Log"
|
||||
@State private var follow = true
|
||||
var body: some View {
|
||||
let lines = progress.reportLines
|
||||
let allLines = progress.reportLines
|
||||
let lines = Array(allLines.suffix(300))
|
||||
VStack(alignment:.leading,spacing:8) {
|
||||
HStack {
|
||||
Text(title).font(.headline)
|
||||
@@ -793,13 +796,14 @@ struct ImportLogView: View {
|
||||
if !progress.finished { Toggle("Follow log",isOn:$follow).toggleStyle(.checkbox).controlSize(.small) }
|
||||
Button("Copy Log") { NSPasteboard.general.clearContents();NSPasteboard.general.setString(progress.logText,forType:.string) }
|
||||
}
|
||||
if allLines.count > lines.count { Text("Showing the latest \(lines.count.formatted()) of \(allLines.count.formatted()) entries. Copy Log includes the full report.").font(.caption).foregroundStyle(.secondary) }
|
||||
ScrollViewReader { reader in
|
||||
ScrollView {
|
||||
LazyVStack(alignment:.leading,spacing:7) {
|
||||
ForEach(lines.indices,id:\.self) { index in
|
||||
let line = lines[index]
|
||||
HStack(alignment:.top,spacing:8) {
|
||||
Circle().fill(line.hasPrefix("[FAILED]") ? Color.red : line.hasPrefix("[SKIPPED]") ? Color.orange : Color.green).frame(width:5,height:5).padding(.top,5)
|
||||
Circle().fill(line.hasPrefix("[FAILED]") ? Color.red : (line.hasPrefix("[SKIPPED]") || line.hasPrefix("[WARNING]")) ? Color.orange : Color.green).frame(width:5,height:5).padding(.top,5)
|
||||
Text(line).font(.system(size:11,design:.monospaced)).textSelection(.enabled).frame(maxWidth:.infinity,alignment:.leading)
|
||||
}.id(index)
|
||||
}
|
||||
@@ -807,7 +811,7 @@ struct ImportLogView: View {
|
||||
}.padding(12)
|
||||
}.background(Color(nsColor:.textBackgroundColor),in:RoundedRectangle(cornerRadius:8))
|
||||
.overlay(RoundedRectangle(cornerRadius:8).strokeBorder(.primary.opacity(0.06)))
|
||||
.onStudioChange(of:lines.count) { _ in if follow,let last = lines.indices.last { reader.scrollTo(last,anchor:.bottom) } }
|
||||
.onStudioChange(of:allLines.count) { _ in if follow,let last = lines.indices.last { reader.scrollTo(last,anchor:.bottom) } }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user