diff --git a/Multiplatform/macOS/Preferences/MacPreferencesView.swift b/Multiplatform/macOS/Preferences/MacPreferencesView.swift index cb7585b42..3a35ab725 100644 --- a/Multiplatform/macOS/Preferences/MacPreferencesView.swift +++ b/Multiplatform/macOS/Preferences/MacPreferencesView.swift @@ -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) } } } diff --git a/Multiplatform/macOS/Preferences/Preference Panes/General/GeneralPreferencesView.swift b/Multiplatform/macOS/Preferences/Preference Panes/General/GeneralPreferencesView.swift index edd4a3995..d32441432 100644 --- a/Multiplatform/macOS/Preferences/Preference Panes/General/GeneralPreferencesView.swift +++ b/Multiplatform/macOS/Preferences/Preference Panes/General/GeneralPreferencesView.swift @@ -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) diff --git a/Multiplatform/macOS/Preferences/Preference Panes/Viewing/LayoutPreferencesView.swift b/Multiplatform/macOS/Preferences/Preference Panes/Viewing/LayoutPreferencesView.swift new file mode 100644 index 000000000..ef08cf3b1 --- /dev/null +++ b/Multiplatform/macOS/Preferences/Preference Panes/Viewing/LayoutPreferencesView.swift @@ -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() + } +} diff --git a/NetNewsWire.xcodeproj/project.pbxproj b/NetNewsWire.xcodeproj/project.pbxproj index f31c1e6ee..34748e906 100644 --- a/NetNewsWire.xcodeproj/project.pbxproj +++ b/NetNewsWire.xcodeproj/project.pbxproj @@ -11,6 +11,7 @@ 172199C924AB228900A31D04 /* SettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 172199C824AB228900A31D04 /* SettingsView.swift */; }; 172199ED24AB2E0100A31D04 /* SafariView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 172199EC24AB2E0100A31D04 /* SafariView.swift */; }; 172199F124AB716900A31D04 /* SidebarToolbarModifier.swift in Sources */ = {isa = PBXBuildFile; fileRef = 172199F024AB716900A31D04 /* SidebarToolbarModifier.swift */; }; + 1727B39924C1368D00A4DBDC /* LayoutPreferencesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1727B39824C1368D00A4DBDC /* LayoutPreferencesView.swift */; }; 1729529324AA1CAA00D65E66 /* AccountsPreferencesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1729529024AA1CAA00D65E66 /* AccountsPreferencesView.swift */; }; 1729529424AA1CAA00D65E66 /* AdvancedPreferencesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1729529124AA1CAA00D65E66 /* AdvancedPreferencesView.swift */; }; 1729529524AA1CAA00D65E66 /* GeneralPreferencesView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1729529224AA1CAA00D65E66 /* GeneralPreferencesView.swift */; }; @@ -1802,6 +1803,7 @@ 172199C824AB228900A31D04 /* SettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsView.swift; sourceTree = ""; }; 172199EC24AB2E0100A31D04 /* SafariView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SafariView.swift; sourceTree = ""; }; 172199F024AB716900A31D04 /* SidebarToolbarModifier.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SidebarToolbarModifier.swift; sourceTree = ""; }; + 1727B39824C1368D00A4DBDC /* LayoutPreferencesView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LayoutPreferencesView.swift; sourceTree = ""; }; 1729529024AA1CAA00D65E66 /* AccountsPreferencesView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AccountsPreferencesView.swift; sourceTree = ""; }; 1729529124AA1CAA00D65E66 /* AdvancedPreferencesView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AdvancedPreferencesView.swift; sourceTree = ""; }; 1729529224AA1CAA00D65E66 /* GeneralPreferencesView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneralPreferencesView.swift; sourceTree = ""; }; @@ -2541,6 +2543,14 @@ path = Settings; sourceTree = ""; }; + 1727B37624C1365300A4DBDC /* Viewing */ = { + isa = PBXGroup; + children = ( + 1727B39824C1368D00A4DBDC /* LayoutPreferencesView.swift */, + ); + path = Viewing; + sourceTree = ""; + }; 1729528F24AA1A4F00D65E66 /* Preferences */ = { isa = PBXGroup; children = ( @@ -2555,6 +2565,7 @@ children = ( 1769E2FD24BC589E000E1E8E /* General */, 1769E31F24BC58A4000E1E8E /* Accounts */, + 1727B37624C1365300A4DBDC /* Viewing */, 1769E32024BC58AD000E1E8E /* Advanced */, ); path = "Preference Panes"; @@ -4255,46 +4266,46 @@ TargetAttributes = { 51314636235A7BBE00387FDC = { CreatedOnToolsVersion = 11.2; - DevelopmentTeam = SHJK2V3AJG; + DevelopmentTeam = FQLBNX3GP7; LastSwiftMigration = 1120; ProvisioningStyle = Automatic; }; 513C5CE5232571C2003D4054 = { CreatedOnToolsVersion = 11.0; - DevelopmentTeam = SHJK2V3AJG; + DevelopmentTeam = FQLBNX3GP7; ProvisioningStyle = Automatic; }; 518B2ED12351B3DD00400001 = { CreatedOnToolsVersion = 11.2; - DevelopmentTeam = SHJK2V3AJG; + DevelopmentTeam = FQLBNX3GP7; ProvisioningStyle = Automatic; TestTargetID = 840D617B2029031C009BC708; }; 51C0513C24A77DF800194D5E = { CreatedOnToolsVersion = 12.0; - DevelopmentTeam = SHJK2V3AJG; + DevelopmentTeam = FQLBNX3GP7; ProvisioningStyle = Automatic; }; 51C0514324A77DF800194D5E = { CreatedOnToolsVersion = 12.0; - DevelopmentTeam = SHJK2V3AJG; + DevelopmentTeam = FQLBNX3GP7; ProvisioningStyle = Automatic; }; 6581C73220CED60000F4AD34 = { - DevelopmentTeam = SHJK2V3AJG; + DevelopmentTeam = FQLBNX3GP7; ProvisioningStyle = Automatic; }; 65ED3FA2235DEF6C0081F399 = { - DevelopmentTeam = SHJK2V3AJG; + DevelopmentTeam = FQLBNX3GP7; ProvisioningStyle = Automatic; }; 65ED4090235DEF770081F399 = { - DevelopmentTeam = SHJK2V3AJG; + DevelopmentTeam = FQLBNX3GP7; ProvisioningStyle = Automatic; }; 840D617B2029031C009BC708 = { CreatedOnToolsVersion = 9.3; - DevelopmentTeam = SHJK2V3AJG; + DevelopmentTeam = FQLBNX3GP7; ProvisioningStyle = Automatic; SystemCapabilities = { com.apple.BackgroundModes = { @@ -4304,7 +4315,7 @@ }; 849C645F1ED37A5D003D8FC0 = { CreatedOnToolsVersion = 8.2.1; - DevelopmentTeam = SHJK2V3AJG; + DevelopmentTeam = FQLBNX3GP7; ProvisioningStyle = Automatic; SystemCapabilities = { com.apple.HardenedRuntime = { @@ -4314,7 +4325,7 @@ }; 849C64701ED37A5D003D8FC0 = { CreatedOnToolsVersion = 8.2.1; - DevelopmentTeam = SHJK2V3AJG; + DevelopmentTeam = FQLBNX3GP7; ProvisioningStyle = Automatic; TestTargetID = 849C645F1ED37A5D003D8FC0; }; @@ -5238,6 +5249,7 @@ 51919FB724AABCA100541E64 /* IconImageView.swift in Sources */, 51B54A6924B54A490014348B /* IconView.swift in Sources */, 51E498FA24A808BA00B667CB /* SingleFaviconDownloader.swift in Sources */, + 1727B39924C1368D00A4DBDC /* LayoutPreferencesView.swift in Sources */, 51E4993F24A8713B00B667CB /* ArticleStatusSyncTimer.swift in Sources */, 51E4993724A8680E00B667CB /* Reachability.swift in Sources */, 51B80F4424BE58BF00C6C32D /* SharingServiceDelegate.swift in Sources */,