mirror of
https://github.com/cranci1/Sora.git
synced 2026-04-20 16:12:50 +00:00
ok added settings
This commit is contained in:
parent
2f91209647
commit
c7c9e5407c
2 changed files with 83 additions and 2 deletions
|
|
@ -27,7 +27,7 @@ struct SettingsViewData: View {
|
|||
.alert(isPresented: $showEraseAppDataAlert) {
|
||||
Alert(
|
||||
title: Text("Confirm Erase App Data"),
|
||||
message: Text("Are you sure you want to erase all app data? This action cannot be undone. (The app will then restart)"),
|
||||
message: Text("Are you sure you want to erase all app data? This action cannot be undone. (The app will then close)"),
|
||||
primaryButton: .destructive(Text("Erase")) {
|
||||
eraseAppData()
|
||||
},
|
||||
|
|
@ -43,7 +43,7 @@ struct SettingsViewData: View {
|
|||
.alert(isPresented: $showRemoveDocumentsAlert) {
|
||||
Alert(
|
||||
title: Text("Confirm Remove All Files"),
|
||||
message: Text("Are you sure you want to remove all files in the documents folder? This will also remove all modules and you will lose the favorite items. This action cannot be undone. (The app will then restart)"),
|
||||
message: Text("Are you sure you want to remove all files in the documents folder? This will also remove all modules and you will lose the favorite items. This action cannot be undone. (The app will then close)"),
|
||||
primaryButton: .destructive(Text("Remove")) {
|
||||
removeAllFilesInDocuments()
|
||||
},
|
||||
|
|
|
|||
|
|
@ -56,7 +56,88 @@ struct SettingsViewPlayer: View {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
SubtitleSettingsSection()
|
||||
}
|
||||
.navigationTitle("Player")
|
||||
}
|
||||
}
|
||||
|
||||
struct SubtitleSettingsSection: View {
|
||||
@State private var foregroundColor: String = SubtitleSettingsManager.shared.settings.foregroundColor
|
||||
@State private var fontSize: Double = SubtitleSettingsManager.shared.settings.fontSize
|
||||
@State private var shadowRadius: Double = SubtitleSettingsManager.shared.settings.shadowRadius
|
||||
@State private var backgroundEnabled: Bool = SubtitleSettingsManager.shared.settings.backgroundEnabled
|
||||
@State private var bottomPadding: CGFloat = SubtitleSettingsManager.shared.settings.bottomPadding
|
||||
|
||||
private let colors = ["white", "yellow", "green", "blue", "red", "purple"]
|
||||
private let shadowOptions = [0, 1, 3, 6]
|
||||
|
||||
var body: some View {
|
||||
Section(header: Text("Subtitle Settings")) {
|
||||
HStack {
|
||||
Text("Subtitle Color")
|
||||
Spacer()
|
||||
Menu(foregroundColor) {
|
||||
ForEach(colors, id: \.self) { color in
|
||||
Button(action: {
|
||||
foregroundColor = color
|
||||
SubtitleSettingsManager.shared.update { settings in
|
||||
settings.foregroundColor = color
|
||||
}
|
||||
}) {
|
||||
Text(color.capitalized)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HStack {
|
||||
Text("Shadow")
|
||||
Spacer()
|
||||
Menu("\(Int(shadowRadius))") {
|
||||
ForEach(shadowOptions, id: \.self) { option in
|
||||
Button(action: {
|
||||
shadowRadius = Double(option)
|
||||
SubtitleSettingsManager.shared.update { settings in
|
||||
settings.shadowRadius = Double(option)
|
||||
}
|
||||
}) {
|
||||
Text("\(option)")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HStack {
|
||||
Text("Font Size:")
|
||||
Spacer()
|
||||
Stepper("\(Int(fontSize))", value: $fontSize, in: 12...36, step: 1)
|
||||
.onChange(of: fontSize) { newValue in
|
||||
SubtitleSettingsManager.shared.update { settings in
|
||||
settings.fontSize = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
HStack {
|
||||
Text("Bottom Padding:")
|
||||
Spacer()
|
||||
Stepper("\(Int(bottomPadding))", value: $bottomPadding, in: 0...50, step: 1)
|
||||
.onChange(of: bottomPadding) { newValue in
|
||||
SubtitleSettingsManager.shared.update { settings in
|
||||
settings.bottomPadding = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Toggle("Background Enabled", isOn: $backgroundEnabled)
|
||||
.tint(.accentColor)
|
||||
.onChange(of: backgroundEnabled) { newValue in
|
||||
SubtitleSettingsManager.shared.update { settings in
|
||||
settings.backgroundEnabled = newValue
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue