mirror of
https://github.com/yattee/yattee.git
synced 2024-12-13 13:50:32 +05:30
Minor quality profiles UI improvements (fix #272)
This commit is contained in:
parent
59632e8330
commit
7cbb80847a
@ -108,6 +108,16 @@ class Stream: Equatable, Hashable, Identifiable {
|
|||||||
lhs.sortOrder < rhs.sortOrder
|
lhs.sortOrder < rhs.sortOrder
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var description: String {
|
||||||
|
switch self {
|
||||||
|
case .webm:
|
||||||
|
return "WebM"
|
||||||
|
|
||||||
|
default:
|
||||||
|
return rawValue.uppercased()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static func from(_ string: String) -> Self {
|
static func from(_ string: String) -> Self {
|
||||||
let lowercased = string.lowercased()
|
let lowercased = string.lowercased()
|
||||||
|
|
||||||
@ -172,8 +182,13 @@ class Stream: Equatable, Hashable, Identifiable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var description: String {
|
var description: String {
|
||||||
let formatString = format == .unknown ? "" : " (\(format.rawValue))"
|
let instanceString = instance.isNil ? "" : " - (\(instance!.description))"
|
||||||
return "\(quality)\(formatString) - \(instance?.description ?? "")"
|
return "\(resolutionAndFormat)\(instanceString)"
|
||||||
|
}
|
||||||
|
|
||||||
|
var resolutionAndFormat: String {
|
||||||
|
let formatString = format == .unknown ? "" : " (\(format.description))"
|
||||||
|
return "\(quality)\(formatString)"
|
||||||
}
|
}
|
||||||
|
|
||||||
var assets: [AVURLAsset] {
|
var assets: [AVURLAsset] {
|
||||||
|
@ -245,7 +245,7 @@ struct ControlsOverlay: View {
|
|||||||
Menu {
|
Menu {
|
||||||
qualityProfilePicker
|
qualityProfilePicker
|
||||||
} label: {
|
} label: {
|
||||||
Text(player.qualityProfileSelection?.description ?? "Auto")
|
Text(player.qualityProfileSelection?.description ?? "Automatic")
|
||||||
.frame(maxWidth: 240)
|
.frame(maxWidth: 240)
|
||||||
}
|
}
|
||||||
.transaction { t in t.animation = .none }
|
.transaction { t in t.animation = .none }
|
||||||
@ -259,7 +259,7 @@ struct ControlsOverlay: View {
|
|||||||
Button {
|
Button {
|
||||||
presentingButtonHintAlert = true
|
presentingButtonHintAlert = true
|
||||||
} label: {
|
} label: {
|
||||||
Text(player.qualityProfileSelection?.description ?? "Auto")
|
Text(player.qualityProfileSelection?.description ?? "Automatic")
|
||||||
.lineLimit(1)
|
.lineLimit(1)
|
||||||
.frame(maxWidth: 320)
|
.frame(maxWidth: 320)
|
||||||
}
|
}
|
||||||
@ -298,7 +298,7 @@ struct ControlsOverlay: View {
|
|||||||
Menu {
|
Menu {
|
||||||
StreamControl()
|
StreamControl()
|
||||||
} label: {
|
} label: {
|
||||||
Text(player.streamSelection?.shortQuality ?? "loading")
|
Text(player.streamSelection?.resolutionAndFormat ?? "loading")
|
||||||
.frame(width: 140, height: 40)
|
.frame(width: 140, height: 40)
|
||||||
.foregroundColor(.primary)
|
.foregroundColor(.primary)
|
||||||
}
|
}
|
||||||
|
@ -92,5 +92,6 @@ struct StreamControl: View {
|
|||||||
struct StreamControl_Previews: PreviewProvider {
|
struct StreamControl_Previews: PreviewProvider {
|
||||||
static var previews: some View {
|
static var previews: some View {
|
||||||
StreamControl()
|
StreamControl()
|
||||||
|
.injectFixtureEnvironmentObjects()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user