1
0
mirror of https://github.com/yattee/yattee.git synced 2024-12-14 22:30:32 +05:30

Fix advanced settings layout (#213)

This commit is contained in:
Arkadiusz Fal 2022-07-03 22:32:26 +02:00
parent 95c963eca8
commit 1732aa6267

View File

@ -33,21 +33,18 @@ struct AdvancedSettings: View {
HStack { HStack {
Text("cache-secs") Text("cache-secs")
#if os(macOS) .frame(minWidth: 140, alignment: .leading)
.frame(minWidth: 120, alignment: .leading)
#endif
TextField("cache-secs", text: $mpvCacheSecs) TextField("cache-secs", text: $mpvCacheSecs)
} }
.multilineTextAlignment(.trailing)
HStack { HStack {
Text("cache-pause-wait") Text("cache-pause-wait")
#if os(macOS) .frame(minWidth: 140, alignment: .leading)
.frame(minWidth: 120, alignment: .leading)
#endif
TextField("cache-pause-wait", text: $mpvCachePauseWait) TextField("cache-pause-wait", text: $mpvCachePauseWait)
} }
.multilineTextAlignment(.trailing)
} }
.multilineTextAlignment(.trailing)
Section(header: manifestHeader) { Section(header: manifestHeader) {
TextField("URL", text: $instancesManifest) TextField("URL", text: $instancesManifest)
@ -60,11 +57,21 @@ struct AdvancedSettings: View {
} }
@ViewBuilder var mpvFooter: some View { @ViewBuilder var mpvFooter: some View {
let url = "https://mpv.io/manual/master"
VStack(alignment: .leading) { VStack(alignment: .leading) {
Text("Restart the app to apply the settings above.") Text("Restart the app to apply the settings above.")
HStack(spacing: 2) { VStack(alignment: .leading, spacing: 2) {
Text("More info can be found in") #if os(tvOS)
Link("MPV Documentation", destination: URL(string: "https://mpv.io/manual/master")!) Text("More info can be found in MPV Documentation:")
Text(url)
#else
Text("More info can be found in:")
Link("MPV Documentation", destination: URL(string: url)!)
#if os(macOS)
.onHover(perform: onHover(_:))
#endif
#endif
} }
} }
.foregroundColor(.secondary) .foregroundColor(.secondary)
@ -77,6 +84,16 @@ struct AdvancedSettings: View {
var showMPVPlaybackStatsToggle: some View { var showMPVPlaybackStatsToggle: some View {
Toggle("Show playback statistics", isOn: $showMPVPlaybackStats) Toggle("Show playback statistics", isOn: $showMPVPlaybackStats)
} }
#if os(macOS)
private func onHover(_ inside: Bool) {
if inside {
NSCursor.pointingHand.push()
} else {
NSCursor.pop()
}
}
#endif
} }
struct AdvancedSettings_Previews: PreviewProvider { struct AdvancedSettings_Previews: PreviewProvider {