Skip to content

Commit

Permalink
Move to macOS Ventura-style Settings in place of Preferences (#1215)
Browse files Browse the repository at this point in the history
* 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

* Rearranged files. Window size adjustments. Worked on the settings view to get it closer to our target

* Created a custom settings window to set the toolbar style

* Added General Settings page.

* Cleaned up code in GeneralSettingsView

* add new settings panes

* fix lint errors

* fix problem with settings

* Reverted Luah's changes from his PR

* Reintroduced Luah's changes

* Added Text Editing settings page. Started theme settings page

* Improved tab width selection

Signed-off-by: Wouter01 <wouterhennen@gmail.com>

* Added themes settings page

* Added constrainHeightToWindow modifier so sheets in Settings will constrain their height to be within the parent window.

* Cleaned up code and reduced padding on theme color preview

* Enabled saving of theme details form.

* Fixed searcher gap. Fixed title alignment. Added back button when looking at details view.

* Fixed search bar

Signed-off-by: Wouter01 <wouterhennen@gmail.com>

* Added sign in and details views for Accounts Settings

* Added dark appearance for GitHub icon

* Added custom Form so we can show custom titlebar background based on scroll position.

* Cleaned up locations settings page

* Fixed issues with settings toolbar background on scroll. Implemented tabs in source control settings page.

* fixed scrollbar offset

Signed-off-by: Wouter01 <wouterhennen@gmail.com>

* Cleaned up SettingsForm

* Fixed some issues with the accounts add and sign in sheets

* When clicking cancel from account sign in, it will take the user back to account selection

* Moved models from AppPreferences to Settings

* More Settings file structure updates

* Renamed models - AppPreferences to Settings, AppPreferencesModel to SettingsModel

* Added AppSettings prop wrapper, Settings subscript

Signed-off-by: Wouter01 <wouterhennen@gmail.com>

* Merged Accounts and SourceControlAccounts. Removed SourceControlProvider in preference to SourceControlAccounts.Provider. Removed AppPreferences and defaulted to Settings. Renamed gitAccount to gitAccounts as it is an array of SourceControlAccount. Added zero-state for accounts settings. Renamed all setting-related models to use Settings instead of Preferences.

* Moved settings references to use new usage pattern

* Dirty trick for search bar

Signed-off-by: Wouter01 <wouterhennen@gmail.com>

* Cleaned up account selection and signing sheets. Disabled scroll.

* Added transition to scrolled shadow in settings window

* Setting theme by appearance when applicable

* Code cleanup

* Added fix for sidebar collapsing

Signed-off-by: Wouter01 <wouterhennen@gmail.com>

* fix swiftlint error

* Added new icon buttonStyle for the upcoming settings table view toolbar. Added new ExternalLink view that we are using in Locations settings.

* Removed SettingsTable from project.pbxproj

* Improved font selection in text editing and terminal settings. Added a toggle to use text editor font in terminal settings. Using the grouped form stepper throughout.

* Updated monospaced font picker to get fonts after rendering so the rest of the UI is not delayed while retrieving fonts.

* Fixed lint error

* Simplified theme setting page by removing terminal theme section. Fixed some of the theme settings options to work as expected.

* Added subtle shadowing to settings sidebar icons.

* Fixed tests, deleted FontPicker

* Removed FontPickerView - not used anymore

---------

Signed-off-by: Wouter01 <wouterhennen@gmail.com>
Co-authored-by: luah5 <128280019+luah5@users.noreply.github.com>
Co-authored-by: luah5 <raymondvleeshouwer@gmail.com>
Co-authored-by: Wouter01 <wouterhennen@gmail.com>
Co-authored-by: Lukas Pistrol <lukas@pistrol.com>
  • Loading branch information
5 people authored Apr 26, 2023
1 parent d6a2f30 commit 9ed6467
Show file tree
Hide file tree
Showing 133 changed files with 3,616 additions and 3,665 deletions.
685 changes: 325 additions & 360 deletions CodeEdit.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,15 @@
"version" : "0.7.1"
}
},
{
"identity" : "swiftui-introspect",
"kind" : "remoteSourceControl",
"location" : "https://github.com/siteline/SwiftUI-Introspect",
"state" : {
"revision" : "c18951c747ab62af7c15e17a81bd37d4fd5a9979",
"version" : "0.2.3"
}
},
{
"identity" : "textformation",
"kind" : "remoteSourceControl",
Expand Down
103 changes: 2 additions & 101 deletions CodeEdit/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate, ObservableObject {

func applicationDidFinishLaunching(_ notification: Notification) {
enableWindowSizeSaveOnQuit()
AppPreferencesModel.shared.preferences.general.appAppearance.applyAppearance()
Settings.shared.preferences.general.appAppearance.applyAppearance()
checkForFilesToOpen()

NSApp.closeWindow(.welcome, .about)
Expand Down Expand Up @@ -75,7 +75,7 @@ final class AppDelegate: NSObject, NSApplicationDelegate, ObservableObject {
}

func handleOpen() {
let behavior = AppPreferencesModel.shared.preferences.general.reopenBehavior
let behavior = Settings.shared.preferences.general.reopenBehavior

switch behavior {
case .welcome:
Expand Down Expand Up @@ -137,10 +137,6 @@ final class AppDelegate: NSObject, NSApplicationDelegate, ObservableObject {

// MARK: - Open windows

@IBAction func openPreferences(_ sender: Any) {
preferencesWindowController.show()
}

@IBAction private func openWelcome(_ sender: Any) {
NSApp.openWindow(.welcome)
}
Expand Down Expand Up @@ -210,101 +206,6 @@ final class AppDelegate: NSObject, NSApplicationDelegate, ObservableObject {
UserDefaults.standard.setValue(true, forKey: "NSQuitAlwaysKeepsWindows")
}

// MARK: - Preferences
private lazy var preferencesWindowController = PreferencesWindowController(
panes: [
Preferences.Pane(
identifier: Preferences.PaneIdentifier("GeneralSettings"),
title: "General",
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()
}
],
animated: false
)

// MARK: NSDocumentController delegate

@objc func documentController(_ docController: NSDocumentController, didCloseAll: Bool, contextInfo: Any) {
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "BitBucketIcon.png",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
6 changes: 6 additions & 0 deletions CodeEdit/Assets.xcassets/Icons/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
22 changes: 22 additions & 0 deletions CodeEdit/Assets.xcassets/Icons/GitHubIcon.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"images" : [
{
"filename" : "GitHubIcon.png",
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "GitHubIcon-Dark.png",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions CodeEdit/Assets.xcassets/Icons/GitLabIcon.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"images" : [
{
"filename" : "GitLabIcon.png",
"idiom" : "universal"
},
{
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"filename" : "GitLabIcon-Dark.png",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 3 additions & 8 deletions CodeEdit/CodeEditApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,20 @@ import SwiftUI
@main
struct CodeEditApp: App {
@NSApplicationDelegateAdaptor var appdelegate: AppDelegate
let updater: SoftwareUpdater = SoftwareUpdater()

init() {
_ = CodeEditDocumentController.shared
NSMenuItem.swizzle()
NSSplitViewItem.swizzle()
}

var body: some Scene {

WelcomeWindow()

AboutWindow()

Settings {
VStack {
Text("Hello world!")
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
}
.defaultSize(width: 500, height: 500)
SettingsWindow()
.commands {
CodeEditCommands()
}
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 9ed6467

Please sign in to comment.