Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions CodeEdit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,9 @@
6CFF967829BEBCF600182D6F /* MainCommands.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CFF967729BEBCF600182D6F /* MainCommands.swift */; };
6CFF967A29BEBD2400182D6F /* ViewCommands.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CFF967929BEBD2400182D6F /* ViewCommands.swift */; };
6CFF967C29BEBD5200182D6F /* WindowCommands.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6CFF967B29BEBD5200182D6F /* WindowCommands.swift */; };
850C631029D6B01D00E1444C /* VenturaPreferences.swift in Sources */ = {isa = PBXBuildFile; fileRef = 850C630F29D6B01D00E1444C /* VenturaPreferences.swift */; };
850C631229D6B03400E1444C /* Page.swift in Sources */ = {isa = PBXBuildFile; fileRef = 850C631129D6B03400E1444C /* Page.swift */; };
850C631829D6D56800E1444C /* VenturaColors.swift in Sources */ = {isa = PBXBuildFile; fileRef = 850C631729D6D56800E1444C /* VenturaColors.swift */; };
B60BE8BD297A167600841125 /* AcknowledgementRowView.swift in Sources */ = {isa = PBXBuildFile; fileRef = B60BE8BC297A167600841125 /* AcknowledgementRowView.swift */; };
B658FB3427DA9E1000EA4DBD /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B658FB3327DA9E1000EA4DBD /* Assets.xcassets */; };
B658FB3727DA9E1000EA4DBD /* Preview Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B658FB3627DA9E1000EA4DBD /* Preview Assets.xcassets */; };
Expand Down Expand Up @@ -729,6 +732,9 @@
6CFF967729BEBCF600182D6F /* MainCommands.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainCommands.swift; sourceTree = "<group>"; };
6CFF967929BEBD2400182D6F /* ViewCommands.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewCommands.swift; sourceTree = "<group>"; };
6CFF967B29BEBD5200182D6F /* WindowCommands.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WindowCommands.swift; sourceTree = "<group>"; };
850C630F29D6B01D00E1444C /* VenturaPreferences.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VenturaPreferences.swift; sourceTree = "<group>"; };
850C631129D6B03400E1444C /* Page.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Page.swift; sourceTree = "<group>"; };
850C631729D6D56800E1444C /* VenturaColors.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VenturaColors.swift; sourceTree = "<group>"; };
B60BE8BC297A167600841125 /* AcknowledgementRowView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AcknowledgementRowView.swift; sourceTree = "<group>"; };
B658FB2C27DA9E0F00EA4DBD /* CodeEdit.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CodeEdit.app; sourceTree = BUILT_PRODUCTS_DIR; };
B658FB3127DA9E0F00EA4DBD /* WorkspaceView.swift */ = {isa = PBXFileReference; indentWidth = 4; lastKnownFileType = sourcecode.swift; path = WorkspaceView.swift; sourceTree = "<group>"; tabWidth = 4; };
Expand Down Expand Up @@ -2272,6 +2278,9 @@
58D01C85293167DC00C5B6B4 /* Utils */,
6C5AB9D629C1496E003B5F96 /* SceneID.swift */,
0468438427DC76E200F8E88E /* AppDelegate.swift */,
850C631729D6D56800E1444C /* VenturaColors.swift */,
850C630F29D6B01D00E1444C /* VenturaPreferences.swift */,
850C631129D6B03400E1444C /* Page.swift */,
5C4BB1E028212B1E00A92FB2 /* World.swift */,
B658FB3327DA9E1000EA4DBD /* Assets.xcassets */,
B658FB3827DA9E1000EA4DBD /* CodeEdit.entitlements */,
Expand Down Expand Up @@ -2716,6 +2725,7 @@
587B9E7B29301D8F00AC7927 /* GitHubRouter.swift in Sources */,
201169E22837B3D800F92B46 /* SourceControlNavigatorChangesView.swift in Sources */,
20EBB507280C32D300F3A5DA /* QuickHelpInspectorView.swift in Sources */,
850C631029D6B01D00E1444C /* VenturaPreferences.swift in Sources */,
DE6405A62817734700881FDF /* TabBarNative.swift in Sources */,
587B9E5C29301D8F00AC7927 /* Parameters.swift in Sources */,
58798235292E30B90085B254 /* FeedbackModel.swift in Sources */,
Expand All @@ -2735,6 +2745,8 @@
587D9B782933BF5700BF7490 /* Interface.swift in Sources */,
6CFF967A29BEBD2400182D6F /* ViewCommands.swift in Sources */,
2072FA1E280D891500C7F8D4 /* FileLocation.swift in Sources */,
850C631229D6B03400E1444C /* Page.swift in Sources */,
850C631829D6D56800E1444C /* VenturaColors.swift in Sources */,
587B9E6729301D8F00AC7927 /* GitLabEventData.swift in Sources */,
B66A4E4529C8E86D004573B4 /* CommandsFixes.swift in Sources */,
5882252F292C280D00E83CDE /* StatusBarClearButton.swift in Sources */,
Expand Down
92 changes: 6 additions & 86 deletions CodeEdit/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -211,98 +211,18 @@ final class AppDelegate: NSObject, NSApplicationDelegate, ObservableObject {
}

// MARK: - Preferences
private lazy var preferencesWindowController = PreferencesWindowController(
private lazy var preferencesWindowController: PreferencesWindowController = PreferencesWindowController(
panes: [
// TODO: Remove this and just use VenturaPreferences()
Preferences.Pane(
identifier: Preferences.PaneIdentifier("GeneralSettings"),
title: "General",
identifier: Preferences.PaneIdentifier("Preferences"),
title: "Preferences",
toolbarIcon: NSImage(systemSymbolName: "gearshape", accessibilityDescription: nil)!
) {
GeneralPreferencesView()
.environmentObject(updater)
},
Preferences.Pane(
identifier: Preferences.PaneIdentifier("Accounts"),
title: "Accounts",
toolbarIcon: NSImage(systemSymbolName: "at", accessibilityDescription: nil)!
) {
AccountPreferencesView()
},
Preferences.Pane(
identifier: Preferences.PaneIdentifier("Behaviors"),
title: "Behaviors",
toolbarIcon: NSImage(systemSymbolName: "flowchart", accessibilityDescription: nil)!
) {
PreferencesPlaceholderView()
},
Preferences.Pane(
identifier: Preferences.PaneIdentifier("Navigation"),
title: "Navigation",
toolbarIcon: NSImage(
systemSymbolName: "arrow.triangle.turn.up.right.diamond",
accessibilityDescription: nil
)!
) {
PreferencesPlaceholderView()
},
Preferences.Pane(
identifier: Preferences.PaneIdentifier("Themes"),
title: "Themes",
toolbarIcon: NSImage(systemSymbolName: "paintbrush", accessibilityDescription: nil)!
) {
ThemePreferencesView()
},
Preferences.Pane(
identifier: Preferences.PaneIdentifier("TextEditing"),
title: "Text Editing",
toolbarIcon: NSImage(systemSymbolName: "square.and.pencil", accessibilityDescription: nil)!
) {
TextEditingPreferencesView()
},
Preferences.Pane(
identifier: Preferences.PaneIdentifier("Terminal"),
title: "Terminal",
toolbarIcon: NSImage(systemSymbolName: "terminal", accessibilityDescription: nil)!
) {
TerminalPreferencesView()
},
Preferences.Pane(
identifier: Preferences.PaneIdentifier("KeyBindings"),
title: "Key Bindings",
toolbarIcon: NSImage(systemSymbolName: "keyboard", accessibilityDescription: nil)!
) {
KeybindingsPreferencesView()
},
Preferences.Pane(
identifier: Preferences.PaneIdentifier("SourceControl"),
title: "Source Control",
toolbarIcon: NSImage.vault
) {
SourceControlPreferencesView()
},
Preferences.Pane(
identifier: Preferences.PaneIdentifier("Components"),
title: "Components",
toolbarIcon: NSImage(systemSymbolName: "puzzlepiece", accessibilityDescription: nil)!
) {
PreferencesPlaceholderView()
},
Preferences.Pane(
identifier: Preferences.PaneIdentifier("Locations"),
title: "Locations",
toolbarIcon: NSImage(systemSymbolName: "externaldrive", accessibilityDescription: nil)!
) {
LocationsPreferencesView()
},
Preferences.Pane(
identifier: Preferences.PaneIdentifier("Advanced"),
title: "Advanced",
toolbarIcon: NSImage(systemSymbolName: "gearshape.2", accessibilityDescription: nil)!
) {
PreferencesPlaceholderView()
VenturaPreferences(updater: updater)
}
],
animated: false
animated: true
)

// MARK: NSDocumentController delegate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,14 @@

import SwiftUI

// swiftlint:disable for_where
struct AccountPreferencesView: View {

// MARK: - View

var body: some View {
accountsSection
}

@StateObject
private var prefs: AppPreferencesModel = .shared

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

@State
var accountSelection: SourceControlAccounts.ID?
}

var body: some View {
// swiftlint:disable for_where
private extension AccountPreferencesView {

// MARK: - Sections

private var accountsSection: some View {
VStack(alignment: .leading, spacing: 16) {
HStack(spacing: 1) {
accountSelectionView
Expand All @@ -41,6 +53,8 @@ struct AccountPreferencesView: View {
}
}

// MARK: - Preference Views

private var accountSelectionView: some View {
VStack(alignment: .leading, spacing: 1) {
PreferencesToolbar {
Expand Down Expand Up @@ -159,6 +173,8 @@ struct AccountPreferencesView: View {
.background(EffectView(.contentBackground))
}

// MARK: - Functions

private func getSourceControlAccount(selectedAccountId: String) -> SourceControlAccounts? {
let gitAccounts = prefs.preferences.accounts.sourceControlAccounts.gitAccount
return gitAccounts.first { $0.id == selectedAccountId }
Expand All @@ -174,5 +190,4 @@ struct AccountPreferencesView: View {
}
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,7 @@ import SwiftUI

/// A view that implements the `General` preference section
struct GeneralPreferencesView: View {
private let inputWidth: Double = 160
private let textEditorWidth: Double = 220
private let textEditorHeight: Double = 30

@EnvironmentObject
var updater: SoftwareUpdater

@StateObject
private var prefs: AppPreferencesModel = .shared

@State
private var openInCodeEdit: Bool = true

init() {
guard let defaults = UserDefaults.init(
suiteName: "austincondiff.CodeEdit.shared"
) else {
print("Failed to get/init shared defaults")
return
}

self.openInCodeEdit = defaults.bool(forKey: "enableOpenInCE")
}
// MARK: - View

var body: some View {
PreferencesContent {
Expand All @@ -58,11 +36,38 @@ struct GeneralPreferencesView: View {
updaterSection
}
}
.frame(minHeight: 650)
.frame(width: 715)
}

private let inputWidth: Double = 160
private let textEditorWidth: Double = 220
private let textEditorHeight: Double = 30

@EnvironmentObject
var updater: SoftwareUpdater

@StateObject
private var prefs: AppPreferencesModel = .shared

@State
private var openInCodeEdit: Bool = true

init() {
guard let defaults = UserDefaults.init(
suiteName: "austincondiff.CodeEdit.shared"
) else {
print("Failed to get/init shared defaults")
return
}

self.openInCodeEdit = defaults.bool(forKey: "enableOpenInCE")
}
}

/// The extension of the view with all the preferences
private extension GeneralPreferencesView {
// MARK: - Sections

var appearanceSection: some View {
PreferencesSection("Appearance") {
Picker("Appearance", selection: $prefs.preferences.general.appAppearance) {
Expand Down Expand Up @@ -294,6 +299,18 @@ private extension GeneralPreferencesView {
}
}

var autoSaveSection: some View {
PreferencesSection("Auto Save Behavior", hideLabels: false) {
Toggle(
"Automatically save changes to disk",
isOn: $prefs.preferences.general.isAutoSaveOn
)
.toggleStyle(.checkbox)
}
}

// MARK: - Preference Views

private var lastUpdatedString: String {
if let lastUpdatedDate = updater.lastUpdateCheckDate {
return Self.formatter.string(from: lastUpdatedDate)
Expand All @@ -308,21 +325,6 @@ private extension GeneralPreferencesView {
return copy
}

private static let formatter = configure(DateFormatter()) {
$0.dateStyle = .medium
$0.timeStyle = .medium
}

var autoSaveSection: some View {
PreferencesSection("Auto Save Behavior", hideLabels: false) {
Toggle(
"Automatically save changes to disk",
isOn: $prefs.preferences.general.isAutoSaveOn
)
.toggleStyle(.checkbox)
}
}

func fallbackShellInstallation(commandPath: String, destinationPath: String) {
let cmd = [
"osascript",
Expand Down Expand Up @@ -372,4 +374,11 @@ private extension GeneralPreferencesView {
.toggleStyle(.checkbox)
}
}

// MARK: - Formatters

private static let formatter = configure(DateFormatter()) {
$0.dateStyle = .medium
$0.timeStyle = .medium
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,27 @@
import SwiftUI

struct KeybindingsPreferencesView: View {

// MARK: - View

var body: some View {
mainSection
}
}

private extension KeybindingsPreferencesView {

// MARK: - Sections

private var mainSection: some View {
PreferencesContent {
Text("Implementation needed")
implementationNeededText
}
}

// MARK: - Preference Views

private var implementationNeededText: some View {
Text("Implementation needed")
}
}
Loading