浏览代码

feat: add quality threshold slider to Soulseek settings (chunk 3)

Exposes the previously hidden slskd.qualityThreshold UserDefaults key
as a slider (30-150, step 10, default 80) in Settings. Works in both
managed and external server modes.

Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
aldiss 2 月之前
父节点
当前提交
e24abc856f
共有 1 个文件被更改,包括 20 次插入0 次删除
  1. 20 0
      Sources/Views/SettingsView.swift

+ 20 - 0
Sources/Views/SettingsView.swift

@@ -693,6 +693,7 @@ private struct SlskdSettings: View {
     @State private var soulseekPassword: String = SlskdCredentials.shared.password ?? ""
     @State private var connectionStatus: SlskdConnectionStatus = .unknown
     @State private var isTesting = false
+    @AppStorage("slskd.qualityThreshold") private var qualityThreshold: Int = 80
     /// H-6: Track whether credentials have unsaved changes.
     @State private var hasUnsavedCredentials = false
     /// H-6: Debounce timer to avoid saving on every keystroke.
@@ -733,6 +734,25 @@ private struct SlskdSettings: View {
                 externalModeSection
             }
 
+            // Quality threshold (both modes)
+            VStack(alignment: .leading, spacing: 6) {
+                HStack {
+                    Text("Quality Threshold")
+                        .font(.headline)
+                    Spacer()
+                    Text("\(qualityThreshold)")
+                        .font(.system(.body, design: .monospaced))
+                        .foregroundStyle(.secondary)
+                }
+                Slider(value: Binding(
+                    get: { Double(qualityThreshold) },
+                    set: { qualityThreshold = Int($0) }
+                ), in: 30...150, step: 10)
+                Text("Sources scoring below \(qualityThreshold) are grayed out. Higher = stricter (FLAC preferred). Lower = more results.")
+                    .font(.caption)
+                    .foregroundStyle(.secondary)
+            }
+
             Divider()
 
             // Connection test (both modes)