mirror of
https://github.com/yattee/yattee.git
synced 2025-04-28 07:50:33 +05:30
Add setting for player action buttons label style
This commit is contained in:
parent
59eda3af26
commit
8ec06b0d59
@ -187,11 +187,12 @@ extension Defaults.Keys {
|
||||
static let showMPVPlaybackStats = Key<Bool>("showMPVPlaybackStats", default: false)
|
||||
|
||||
#if os(macOS)
|
||||
static let playerDetailsPageButtonLabelStyleDefault = PlayerDetailsPageButtonLabelStyle.iconAndText
|
||||
static let playerDetailsPageButtonLabelStyleDefault = ButtonLabelStyle.iconAndText
|
||||
#else
|
||||
static let playerDetailsPageButtonLabelStyleDefault = UIDevice.current.userInterfaceIdiom == .phone ? PlayerDetailsPageButtonLabelStyle.iconOnly : .iconAndText
|
||||
static let playerDetailsPageButtonLabelStyleDefault = UIDevice.current.userInterfaceIdiom == .phone ? ButtonLabelStyle.iconOnly : .iconAndText
|
||||
#endif
|
||||
static let playerDetailsPageButtonLabelStyle = Key<PlayerDetailsPageButtonLabelStyle>("playerDetailsPageButtonLabelStyle", default: playerDetailsPageButtonLabelStyleDefault)
|
||||
static let playerActionsButtonLabelStyle = Key<ButtonLabelStyle>("playerActionsButtonLabelStyle", default: .iconAndText)
|
||||
static let playerDetailsPageButtonLabelStyle = Key<ButtonLabelStyle>("playerDetailsPageButtonLabelStyle", default: playerDetailsPageButtonLabelStyleDefault)
|
||||
|
||||
static let systemControlsCommands = Key<SystemControlsCommands>("systemControlsCommands", default: .restartAndAdvanceToNext)
|
||||
static let mpvCacheSecs = Key<String>("mpvCacheSecs", default: "120")
|
||||
@ -305,7 +306,7 @@ enum WatchedVideoPlayNowBehavior: String, Defaults.Serializable {
|
||||
}
|
||||
#endif
|
||||
|
||||
enum PlayerDetailsPageButtonLabelStyle: String, CaseIterable, Defaults.Serializable {
|
||||
enum ButtonLabelStyle: String, CaseIterable, Defaults.Serializable {
|
||||
case iconOnly, iconAndText
|
||||
|
||||
var text: Bool {
|
||||
|
@ -9,6 +9,8 @@ struct VideoActions: View {
|
||||
|
||||
var video: Video?
|
||||
|
||||
@Default(.playerActionsButtonLabelStyle) private var playerActionsButtonLabelStyle
|
||||
|
||||
var body: some View {
|
||||
HStack {
|
||||
if let video {
|
||||
@ -82,13 +84,15 @@ struct VideoActions: View {
|
||||
VStack(spacing: 3) {
|
||||
Image(systemName: systemImage)
|
||||
.frame(width: 20, height: 20)
|
||||
Text(name)
|
||||
.foregroundColor(.secondary)
|
||||
.font(.caption2)
|
||||
.allowsTightening(true)
|
||||
if playerActionsButtonLabelStyle.text {
|
||||
Text(name)
|
||||
.foregroundColor(.secondary)
|
||||
.font(.caption2)
|
||||
.allowsTightening(true)
|
||||
}
|
||||
}
|
||||
.padding(.horizontal, 6)
|
||||
.padding(.vertical, 5)
|
||||
.padding(.horizontal, playerActionsButtonLabelStyle.text ? 6 : 12)
|
||||
.padding(.vertical, playerActionsButtonLabelStyle.text ? 5 : 10)
|
||||
.contentShape(Rectangle())
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
|
@ -6,6 +6,7 @@ struct PlayerSettings: View {
|
||||
@Default(.playerInstanceID) private var playerInstanceID
|
||||
|
||||
@Default(.playerSidebar) private var playerSidebar
|
||||
@Default(.playerActionsButtonLabelStyle) private var playerActionsButtonLabelStyle
|
||||
@Default(.playerDetailsPageButtonLabelStyle) private var playerDetailsPageButtonLabelStyle
|
||||
@Default(.detailsToolbarPosition) private var detailsToolbarPosition
|
||||
@Default(.showInspector) private var showInspector
|
||||
@ -92,7 +93,7 @@ struct PlayerSettings: View {
|
||||
}
|
||||
#endif
|
||||
|
||||
Section(header: SettingsHeader(text: "Interface".localized())) {
|
||||
let interface = Section(header: SettingsHeader(text: "Interface".localized())) {
|
||||
#if os(iOS)
|
||||
if idiom == .pad {
|
||||
sidebarPicker
|
||||
@ -109,9 +110,22 @@ struct PlayerSettings: View {
|
||||
}
|
||||
}
|
||||
|
||||
#if os(tvOS)
|
||||
if !accounts.isEmpty {
|
||||
interface
|
||||
}
|
||||
#elseif os(macOS)
|
||||
interface
|
||||
#elseif os(iOS)
|
||||
if idiom == .pad || !accounts.isEmpty {
|
||||
interface
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !os(tvOS)
|
||||
Section(header: SettingsHeader(text: "Video Details").padding(.bottom, videoDetailsHeaderPadding)) {
|
||||
SettingsHeader(text: "Buttons labels".localized(), secondary: true)
|
||||
playerActionsButtonLabelStylePicker
|
||||
detailsButtonLabelStylePicker
|
||||
|
||||
SettingsHeader(text: "Show Inspector".localized(), secondary: true)
|
||||
@ -196,10 +210,18 @@ struct PlayerSettings: View {
|
||||
.modifier(SettingsPickerModifier())
|
||||
}
|
||||
|
||||
private var playerActionsButtonLabelStylePicker: some View {
|
||||
Picker("Video actions buttons", selection: $playerActionsButtonLabelStyle) {
|
||||
Text("Show only icons").tag(ButtonLabelStyle.iconOnly)
|
||||
Text("Show icons and text when space permits").tag(ButtonLabelStyle.iconAndText)
|
||||
}
|
||||
.modifier(SettingsPickerModifier())
|
||||
}
|
||||
|
||||
private var detailsButtonLabelStylePicker: some View {
|
||||
Picker("Buttons labels", selection: $playerDetailsPageButtonLabelStyle) {
|
||||
Text("Show only icons").tag(PlayerDetailsPageButtonLabelStyle.iconOnly)
|
||||
Text("Show icons and text when space permits").tag(PlayerDetailsPageButtonLabelStyle.iconAndText)
|
||||
Picker("Pages buttons", selection: $playerDetailsPageButtonLabelStyle) {
|
||||
Text("Show only icons").tag(ButtonLabelStyle.iconOnly)
|
||||
Text("Show icons and text when space permits").tag(ButtonLabelStyle.iconAndText)
|
||||
}
|
||||
.modifier(SettingsPickerModifier())
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user