mirror of
https://github.com/Ranchero-Software/NetNewsWire
synced 2025-08-12 06:26:36 +00:00
@@ -10,7 +10,8 @@ import SwiftUI
|
||||
enum PreferencePane: Int, CaseIterable {
|
||||
case general = 0
|
||||
case accounts = 1
|
||||
case advanced = 2
|
||||
case viewing = 2
|
||||
case advanced = 3
|
||||
|
||||
var description: String {
|
||||
switch self {
|
||||
@@ -18,6 +19,8 @@ enum PreferencePane: Int, CaseIterable {
|
||||
return "General"
|
||||
case .accounts:
|
||||
return "Accounts"
|
||||
case .viewing:
|
||||
return "Appearance"
|
||||
case .advanced:
|
||||
return "Advanced"
|
||||
}
|
||||
@@ -38,6 +41,9 @@ struct MacPreferencesView: View {
|
||||
case .accounts:
|
||||
AccountsPreferencesView()
|
||||
.environmentObject(defaults)
|
||||
case .viewing:
|
||||
LayoutPreferencesView()
|
||||
.environmentObject(defaults)
|
||||
case .advanced:
|
||||
AdvancedPreferencesView()
|
||||
.environmentObject(defaults)
|
||||
@@ -56,7 +62,7 @@ struct MacPreferencesView: View {
|
||||
}.foregroundColor(
|
||||
preferencePane == .general ? Color("AccentColor") : Color.gray
|
||||
)
|
||||
}).frame(width: 70)
|
||||
}).frame(width: 70, height: 50)
|
||||
Button(action: {
|
||||
preferencePane = .accounts
|
||||
}, label: {
|
||||
@@ -67,7 +73,18 @@ struct MacPreferencesView: View {
|
||||
}.foregroundColor(
|
||||
preferencePane == .accounts ? Color("AccentColor") : Color.gray
|
||||
)
|
||||
}).frame(width: 70)
|
||||
}).frame(width: 70, height: 50)
|
||||
Button(action: {
|
||||
preferencePane = .viewing
|
||||
}, label: {
|
||||
VStack {
|
||||
Image(systemName: "eyeglasses")
|
||||
.font(.title2)
|
||||
Text("Viewing")
|
||||
}.foregroundColor(
|
||||
preferencePane == .viewing ? Color("AccentColor") : Color.gray
|
||||
)
|
||||
}).frame(width: 70, height: 50)
|
||||
Button(action: {
|
||||
preferencePane = .advanced
|
||||
}, label: {
|
||||
@@ -78,7 +95,7 @@ struct MacPreferencesView: View {
|
||||
}.foregroundColor(
|
||||
preferencePane == .advanced ? Color("AccentColor") : Color.gray
|
||||
)
|
||||
}).frame(width: 70)
|
||||
}).frame(width: 70, height: 50)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user