Adds a separate pane for viewing preferences

Fixes #2183
This commit is contained in:
Stuart Breckenridge
2020-07-17 10:01:20 +08:00
parent 8f7b8160a1
commit cda315aa6b
4 changed files with 89 additions and 26 deletions

View File

@@ -10,9 +10,7 @@ import SwiftUI
struct GeneralPreferencesView: View {
@EnvironmentObject private var defaults: AppDefaults
@Environment(\.colorScheme) private var colorScheme
@StateObject private var preferences = GeneralPreferencesModel()
private let colorPalettes = UserInterfaceColorPalette.allCases
var body: some View {
Form {
@@ -42,15 +40,6 @@ struct GeneralPreferencesView: View {
Toggle("Hide Unread Count in Dock", isOn: $defaults.hideDockUnreadCount)
Divider()
Picker("Appearance", selection: $defaults.userInterfaceColorPalette, content: {
ForEach(colorPalettes, id: \.self, content: {
Text($0.description)
})
}).pickerStyle(RadioGroupPickerStyle())
}
.frame(width: 400, alignment: .center)
.lineLimit(2)

View File

@@ -0,0 +1,45 @@
//
// LayoutPreferencesView.swift
// Multiplatform macOS
//
// Created by Stuart Breckenridge on 17/7/20.
// Copyright © 2020 Ranchero Software. All rights reserved.
//
import SwiftUI
struct LayoutPreferencesView: View {
@EnvironmentObject var defaults: AppDefaults
private let colorPalettes = UserInterfaceColorPalette.allCases
var body: some View {
Form {
Picker("Appearance", selection: $defaults.userInterfaceColorPalette, content: {
ForEach(colorPalettes, id: \.self, content: {
Text($0.description)
})
})
Divider()
Text("Timeline: ")
Picker("Number of Lines", selection: $defaults.timelineNumberOfLines, content: {
ForEach(1..<6, content: { i in
Text(String(i))
.tag(Double(i))
})
}).padding(.leading, 16)
Slider(value: $defaults.timelineIconDimensions, in: 20...60, step: 10, minimumValueLabel: Text("Small"), maximumValueLabel: Text("Large"), label: {
Text("Icon Size")
}).padding(.leading, 16)
}
.frame(width: 400, alignment: .center)
}
}
struct SwiftUIView_Previews: PreviewProvider {
static var previews: some View {
LayoutPreferencesView()
}
}