Video details toolbar and inspector settings

This commit is contained in:
Arkadiusz Fal
2022-11-13 23:36:46 +01:00
parent 7cc3cd950b
commit 041a28e7a0
8 changed files with 97 additions and 9 deletions

View File

@@ -6,6 +6,9 @@ struct PlayerSettings: View {
@Default(.playerInstanceID) private var playerInstanceID
@Default(.playerSidebar) private var playerSidebar
@Default(.playerDetailsPageButtonLabelStyle) private var playerDetailsPageButtonLabelStyle
@Default(.detailsToolbarPosition) private var detailsToolbarPosition
@Default(.showInspector) private var showInspector
@Default(.playerControlsLayout) private var playerControlsLayout
@Default(.fullScreenPlayerControlsLayout) private var fullScreenPlayerControlsLayout
@Default(.horizontalPlayerGestureEnabled) private var horizontalPlayerGestureEnabled
@@ -106,6 +109,19 @@ struct PlayerSettings: View {
}
}
#if !os(tvOS)
Section(header: SettingsHeader(text: "Video Details").padding(.bottom, videoDetailsHeaderPadding)) {
SettingsHeader(text: "Buttons labels".localized(), secondary: true)
detailsButtonLabelStylePicker
SettingsHeader(text: "Show Inspector".localized(), secondary: true)
showInspectorPicker
SettingsHeader(text: "Pages toolbar position".localized(), secondary: true)
detailsToolbarPositionPicker
}
#endif
#if os(iOS)
Section(header: SettingsHeader(text: "Orientation".localized())) {
if idiom == .pad {
@@ -127,6 +143,14 @@ struct PlayerSettings: View {
}
}
private var videoDetailsHeaderPadding: Double {
#if os(macOS)
5.0
#else
0.0
#endif
}
private var sourcePicker: some View {
Picker("Source", selection: $playerInstanceID) {
Text("Instance of current account").tag(String?.none)
@@ -172,6 +196,31 @@ struct PlayerSettings: View {
.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)
}
.modifier(SettingsPickerModifier())
}
private var showInspectorPicker: some View {
Picker("Inspector visibility", selection: $showInspector) {
Text("Always").tag(ShowInspectorSetting.always)
Text("Only for local files and URLs").tag(ShowInspectorSetting.onlyLocal)
}
.modifier(SettingsPickerModifier())
}
private var detailsToolbarPositionPicker: some View {
Picker("Pages toolbar position", selection: $detailsToolbarPosition) {
ForEach(DetailsToolbarPositionSetting.allCases, id: \.self) { setting in
Text(setting.rawValue.capitalized).tag(setting)
}
}
.modifier(SettingsPickerModifier())
}
private var horizontalPlayerGestureEnabledToggle: some View {
Toggle("Seek with horizontal swipe on video", isOn: $horizontalPlayerGestureEnabled)
}
@@ -287,6 +336,7 @@ struct PlayerSettings_Previews: PreviewProvider {
VStack(alignment: .leading) {
PlayerSettings()
}
.frame(minHeight: 800)
.injectFixtureEnvironmentObjects()
}
}

View File

@@ -223,7 +223,7 @@ struct SettingsView: View {
case .browsing:
return 580
case .player:
return 680
return 850
case .quality:
return 420
case .history: