Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ee6b4bd

Browse files
authored
Move to ventura-style preferences and refactor preferences (#1213)
* add initial ventura-style preferences ui * fix lint errors * refactor Settings -> Preferences * add comments and rename GeneralSettings -> Preferences * make font size 12 and images 20x20 * minor rephrase * add venturacolors.swift * fix colors * fix text-misaligment * remove VStack, fixing an issue * preferences initial refactor * continue preference refactor * refactor SourceControlGeneralView.swift and start refactor on SourceControlGitView * refactor SourceControlGitView and fix lint errors * fix issue * fix code inconstencies * fix warnings * edit docs * fix docs problem * remove public * Partially fix search issue * fix luah5#3 * add explicit values, fix luah5#1 and intiate fix to issue where text if cut-off * small changes * add default selection
1 parent dd8fce2 commit ee6b4bd

File tree

20 files changed

+1184
-458
lines changed

20 files changed

+1184
-458
lines changed

‎CodeEdit.xcodeproj/project.pbxproj‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,9 @@
331331
6CFF967829BEBCF600182D6F /* MainCommands.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CFF967729BEBCF600182D6F /* MainCommands.swift */; };
332332
6CFF967A29BEBD2400182D6F /* ViewCommands.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CFF967929BEBD2400182D6F /* ViewCommands.swift */; };
333333
6CFF967C29BEBD5200182D6F /* WindowCommands.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CFF967B29BEBD5200182D6F /* WindowCommands.swift */; };
334+
850C631029D6B01D00E1444C /* VenturaPreferences.swift in Sources */ = {isa = PBXBuildFile; fileRef = 850C630F29D6B01D00E1444C /* VenturaPreferences.swift */; };
335+
850C631229D6B03400E1444C /* Page.swift in Sources */ = {isa = PBXBuildFile; fileRef = 850C631129D6B03400E1444C /* Page.swift */; };
336+
850C631829D6D56800E1444C /* VenturaColors.swift in Sources */ = {isa = PBXBuildFile; fileRef = 850C631729D6D56800E1444C /* VenturaColors.swift */; };
334337
B60BE8BD297A167600841125 /* AcknowledgementRowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B60BE8BC297A167600841125 /* AcknowledgementRowView.swift */; };
335338
B658FB3427DA9E1000EA4DBD /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B658FB3327DA9E1000EA4DBD /* Assets.xcassets */; };
336339
B658FB3727DA9E1000EA4DBD /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B658FB3627DA9E1000EA4DBD /* Preview Assets.xcassets */; };
@@ -729,6 +732,9 @@
729732
6CFF967729BEBCF600182D6F /* MainCommands.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainCommands.swift; sourceTree = "<group>"; };
730733
6CFF967929BEBD2400182D6F /* ViewCommands.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewCommands.swift; sourceTree = "<group>"; };
731734
6CFF967B29BEBD5200182D6F /* WindowCommands.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WindowCommands.swift; sourceTree = "<group>"; };
735+
850C630F29D6B01D00E1444C /* VenturaPreferences.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VenturaPreferences.swift; sourceTree = "<group>"; };
736+
850C631129D6B03400E1444C /* Page.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Page.swift; sourceTree = "<group>"; };
737+
850C631729D6D56800E1444C /* VenturaColors.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VenturaColors.swift; sourceTree = "<group>"; };
732738
B60BE8BC297A167600841125 /* AcknowledgementRowView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AcknowledgementRowView.swift; sourceTree = "<group>"; };
733739
B658FB2C27DA9E0F00EA4DBD /* CodeEdit.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CodeEdit.app; sourceTree = BUILT_PRODUCTS_DIR; };
734740
B658FB3127DA9E0F00EA4DBD /* WorkspaceView.swift */ = {isa = PBXFileReference; indentWidth = 4; lastKnownFileType = sourcecode.swift; path = WorkspaceView.swift; sourceTree = "<group>"; tabWidth = 4; };
@@ -2272,6 +2278,9 @@
22722278
58D01C85293167DC00C5B6B4 /* Utils */,
22732279
6C5AB9D629C1496E003B5F96 /* SceneID.swift */,
22742280
0468438427DC76E200F8E88E /* AppDelegate.swift */,
2281+
850C631729D6D56800E1444C /* VenturaColors.swift */,
2282+
850C630F29D6B01D00E1444C /* VenturaPreferences.swift */,
2283+
850C631129D6B03400E1444C /* Page.swift */,
22752284
5C4BB1E028212B1E00A92FB2 /* World.swift */,
22762285
B658FB3327DA9E1000EA4DBD /* Assets.xcassets */,
22772286
B658FB3827DA9E1000EA4DBD /* CodeEdit.entitlements */,
@@ -2716,6 +2725,7 @@
27162725
587B9E7B29301D8F00AC7927 /* GitHubRouter.swift in Sources */,
27172726
201169E22837B3D800F92B46 /* SourceControlNavigatorChangesView.swift in Sources */,
27182727
20EBB507280C32D300F3A5DA /* QuickHelpInspectorView.swift in Sources */,
2728+
850C631029D6B01D00E1444C /* VenturaPreferences.swift in Sources */,
27192729
DE6405A62817734700881FDF /* TabBarNative.swift in Sources */,
27202730
587B9E5C29301D8F00AC7927 /* Parameters.swift in Sources */,
27212731
58798235292E30B90085B254 /* FeedbackModel.swift in Sources */,
@@ -2735,6 +2745,8 @@
27352745
587D9B782933BF5700BF7490 /* Interface.swift in Sources */,
27362746
6CFF967A29BEBD2400182D6F /* ViewCommands.swift in Sources */,
27372747
2072FA1E280D891500C7F8D4 /* FileLocation.swift in Sources */,
2748+
850C631229D6B03400E1444C /* Page.swift in Sources */,
2749+
850C631829D6D56800E1444C /* VenturaColors.swift in Sources */,
27382750
587B9E6729301D8F00AC7927 /* GitLabEventData.swift in Sources */,
27392751
B66A4E4529C8E86D004573B4 /* CommandsFixes.swift in Sources */,
27402752
5882252F292C280D00E83CDE /* StatusBarClearButton.swift in Sources */,

‎CodeEdit/AppDelegate.swift‎

Lines changed: 6 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -211,98 +211,18 @@ final class AppDelegate: NSObject, NSApplicationDelegate, ObservableObject {
211211
}
212212

213213
// MARK: - Preferences
214-
private lazy var preferencesWindowController = PreferencesWindowController(
214+
private lazy var preferencesWindowController:PreferencesWindowController = PreferencesWindowController(
215215
panes: [
216+
// TODO: Remove this and just use VenturaPreferences()
216217
Preferences.Pane(
217-
identifier: Preferences.PaneIdentifier("GeneralSettings"),
218-
title: "General",
218+
identifier: Preferences.PaneIdentifier("Preferences"),
219+
title: "Preferences",
219220
toolbarIcon: NSImage(systemSymbolName: "gearshape", accessibilityDescription: nil)!
220221
) {
221-
GeneralPreferencesView()
222-
.environmentObject(updater)
223-
},
224-
Preferences.Pane(
225-
identifier: Preferences.PaneIdentifier("Accounts"),
226-
title: "Accounts",
227-
toolbarIcon: NSImage(systemSymbolName: "at", accessibilityDescription: nil)!
228-
) {
229-
AccountPreferencesView()
230-
},
231-
Preferences.Pane(
232-
identifier: Preferences.PaneIdentifier("Behaviors"),
233-
title: "Behaviors",
234-
toolbarIcon: NSImage(systemSymbolName: "flowchart", accessibilityDescription: nil)!
235-
) {
236-
PreferencesPlaceholderView()
237-
},
238-
Preferences.Pane(
239-
identifier: Preferences.PaneIdentifier("Navigation"),
240-
title: "Navigation",
241-
toolbarIcon: NSImage(
242-
systemSymbolName: "arrow.triangle.turn.up.right.diamond",
243-
accessibilityDescription: nil
244-
)!
245-
) {
246-
PreferencesPlaceholderView()
247-
},
248-
Preferences.Pane(
249-
identifier: Preferences.PaneIdentifier("Themes"),
250-
title: "Themes",
251-
toolbarIcon: NSImage(systemSymbolName: "paintbrush", accessibilityDescription: nil)!
252-
) {
253-
ThemePreferencesView()
254-
},
255-
Preferences.Pane(
256-
identifier: Preferences.PaneIdentifier("TextEditing"),
257-
title: "Text Editing",
258-
toolbarIcon: NSImage(systemSymbolName: "square.and.pencil", accessibilityDescription: nil)!
259-
) {
260-
TextEditingPreferencesView()
261-
},
262-
Preferences.Pane(
263-
identifier: Preferences.PaneIdentifier("Terminal"),
264-
title: "Terminal",
265-
toolbarIcon: NSImage(systemSymbolName: "terminal", accessibilityDescription: nil)!
266-
) {
267-
TerminalPreferencesView()
268-
},
269-
Preferences.Pane(
270-
identifier: Preferences.PaneIdentifier("KeyBindings"),
271-
title: "Key Bindings",
272-
toolbarIcon: NSImage(systemSymbolName: "keyboard", accessibilityDescription: nil)!
273-
) {
274-
KeybindingsPreferencesView()
275-
},
276-
Preferences.Pane(
277-
identifier: Preferences.PaneIdentifier("SourceControl"),
278-
title: "Source Control",
279-
toolbarIcon: NSImage.vault
280-
) {
281-
SourceControlPreferencesView()
282-
},
283-
Preferences.Pane(
284-
identifier: Preferences.PaneIdentifier("Components"),
285-
title: "Components",
286-
toolbarIcon: NSImage(systemSymbolName: "puzzlepiece", accessibilityDescription: nil)!
287-
) {
288-
PreferencesPlaceholderView()
289-
},
290-
Preferences.Pane(
291-
identifier: Preferences.PaneIdentifier("Locations"),
292-
title: "Locations",
293-
toolbarIcon: NSImage(systemSymbolName: "externaldrive", accessibilityDescription: nil)!
294-
) {
295-
LocationsPreferencesView()
296-
},
297-
Preferences.Pane(
298-
identifier: Preferences.PaneIdentifier("Advanced"),
299-
title: "Advanced",
300-
toolbarIcon: NSImage(systemSymbolName: "gearshape.2", accessibilityDescription: nil)!
301-
) {
302-
PreferencesPlaceholderView()
222+
VenturaPreferences(updater: updater)
303223
}
304224
],
305-
animated: false
225+
animated: true
306226
)
307227

308228
// MARK: NSDocumentController delegate

‎CodeEdit/Features/AppPreferences/Sections/AccountsPreferences/AccountPreferencesView.swift‎

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,14 @@
77

88
import SwiftUI
99

10-
// swiftlint:disable for_where
1110
struct AccountPreferencesView: View {
11+
12+
// MARK: - View
13+
14+
var body: some View {
15+
accountsSection
16+
}
17+
1218
@StateObject
1319
private var prefs: AppPreferencesModel = .shared
1420

@@ -20,8 +26,14 @@ struct AccountPreferencesView: View {
2026

2127
@State
2228
var accountSelection: SourceControlAccounts.ID?
29+
}
2330

24-
var body: some View {
31+
// swiftlint:disable for_where
32+
private extension AccountPreferencesView {
33+
34+
// MARK: - Sections
35+
36+
private var accountsSection: some View {
2537
VStack(alignment: .leading, spacing: 16) {
2638
HStack(spacing: 1) {
2739
accountSelectionView
@@ -41,6 +53,8 @@ struct AccountPreferencesView: View {
4153
}
4254
}
4355

56+
// MARK: - Preference Views
57+
4458
private var accountSelectionView: some View {
4559
VStack(alignment: .leading, spacing: 1) {
4660
PreferencesToolbar {
@@ -159,6 +173,8 @@ struct AccountPreferencesView: View {
159173
.background(EffectView(.contentBackground))
160174
}
161175

176+
// MARK: - Functions
177+
162178
private func getSourceControlAccount(selectedAccountId: String) -> SourceControlAccounts? {
163179
let gitAccounts = prefs.preferences.accounts.sourceControlAccounts.gitAccount
164180
return gitAccounts.first { 0ドル.id == selectedAccountId }
@@ -174,5 +190,4 @@ struct AccountPreferencesView: View {
174190
}
175191
}
176192
}
177-
178193
}

‎CodeEdit/Features/AppPreferences/Sections/GeneralPreferences/GeneralPreferencesView.swift‎

Lines changed: 48 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -9,29 +9,7 @@ import SwiftUI
99

1010
/// A view that implements the `General` preference section
1111
struct GeneralPreferencesView: View {
12-
private let inputWidth: Double = 160
13-
private let textEditorWidth: Double = 220
14-
private let textEditorHeight: Double = 30
15-
16-
@EnvironmentObject
17-
var updater: SoftwareUpdater
18-
19-
@StateObject
20-
private var prefs: AppPreferencesModel = .shared
21-
22-
@State
23-
private var openInCodeEdit: Bool = true
24-
25-
init() {
26-
guard let defaults = UserDefaults.init(
27-
suiteName: "austincondiff.CodeEdit.shared"
28-
) else {
29-
print("Failed to get/init shared defaults")
30-
return
31-
}
32-
33-
self.openInCodeEdit = defaults.bool(forKey: "enableOpenInCE")
34-
}
12+
// MARK: - View
3513

3614
var body: some View {
3715
PreferencesContent {
@@ -58,11 +36,38 @@ struct GeneralPreferencesView: View {
5836
updaterSection
5937
}
6038
}
61-
.frame(minHeight: 650)
39+
.frame(width: 715)
40+
}
41+
42+
private let inputWidth: Double = 160
43+
private let textEditorWidth: Double = 220
44+
private let textEditorHeight: Double = 30
45+
46+
@EnvironmentObject
47+
var updater: SoftwareUpdater
48+
49+
@StateObject
50+
private var prefs: AppPreferencesModel = .shared
51+
52+
@State
53+
private var openInCodeEdit: Bool = true
54+
55+
init() {
56+
guard let defaults = UserDefaults.init(
57+
suiteName: "austincondiff.CodeEdit.shared"
58+
) else {
59+
print("Failed to get/init shared defaults")
60+
return
61+
}
62+
63+
self.openInCodeEdit = defaults.bool(forKey: "enableOpenInCE")
6264
}
6365
}
6466

67+
/// The extension of the view with all the preferences
6568
private extension GeneralPreferencesView {
69+
// MARK: - Sections
70+
6671
var appearanceSection: some View {
6772
PreferencesSection("Appearance") {
6873
Picker("Appearance", selection: $prefs.preferences.general.appAppearance) {
@@ -294,6 +299,18 @@ private extension GeneralPreferencesView {
294299
}
295300
}
296301

302+
var autoSaveSection: some View {
303+
PreferencesSection("Auto Save Behavior", hideLabels: false) {
304+
Toggle(
305+
"Automatically save changes to disk",
306+
isOn: $prefs.preferences.general.isAutoSaveOn
307+
)
308+
.toggleStyle(.checkbox)
309+
}
310+
}
311+
312+
// MARK: - Preference Views
313+
297314
private var lastUpdatedString: String {
298315
if let lastUpdatedDate = updater.lastUpdateCheckDate {
299316
return Self.formatter.string(from: lastUpdatedDate)
@@ -308,21 +325,6 @@ private extension GeneralPreferencesView {
308325
return copy
309326
}
310327

311-
private static let formatter = configure(DateFormatter()) {
312-
0ドル.dateStyle = .medium
313-
0ドル.timeStyle = .medium
314-
}
315-
316-
var autoSaveSection: some View {
317-
PreferencesSection("Auto Save Behavior", hideLabels: false) {
318-
Toggle(
319-
"Automatically save changes to disk",
320-
isOn: $prefs.preferences.general.isAutoSaveOn
321-
)
322-
.toggleStyle(.checkbox)
323-
}
324-
}
325-
326328
func fallbackShellInstallation(commandPath: String, destinationPath: String) {
327329
let cmd = [
328330
"osascript",
@@ -372,4 +374,11 @@ private extension GeneralPreferencesView {
372374
.toggleStyle(.checkbox)
373375
}
374376
}
377+
378+
// MARK: - Formatters
379+
380+
private static let formatter = configure(DateFormatter()) {
381+
0ドル.dateStyle = .medium
382+
0ドル.timeStyle = .medium
383+
}
375384
}

‎CodeEdit/Features/AppPreferences/Sections/KeybindingsPreferences/KeybindingsPreferencesView.swift‎

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,27 @@
88
import SwiftUI
99

1010
struct KeybindingsPreferencesView: View {
11+
12+
// MARK: - View
13+
1114
var body: some View {
15+
mainSection
16+
}
17+
}
18+
19+
private extension KeybindingsPreferencesView {
20+
21+
// MARK: - Sections
22+
23+
private var mainSection: some View {
1224
PreferencesContent {
13-
Text("Implementation needed")
25+
implementationNeededText
1426
}
1527
}
28+
29+
// MARK: - Preference Views
30+
31+
private var implementationNeededText: some View {
32+
Text("Implementation needed")
33+
}
1634
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /