| @@ -34,32 +34,59 @@ struct SettingsScreen: View { |
| 34 | 34 | } |
| 35 | 35 | .listRowBackground(ProBanner.rowBackground) |
| 36 | 36 | Section { |
| 37 | | LabeledContent("Folder", value: model.configFolder?.lastPathComponent ?? String(localized: "none.folder", defaultValue: "None", comment: "No configuration folder chosen")) |
| 38 | | Button(model.configFolder == nil ? "Choose Folder…" : "Choose Another Folder…") { choosing = true } |
| 39 | | if model.configFolder != nil { |
| 40 | | NavigationLink("Edit config.toml") { ConfigFileEditor(model: model) } |
| 37 | let _ = model.settingsVersion |
| 38 | NavigationLink { |
| 39 | ThemePickerScreen(model: model, appearance: .light) |
| 40 | } label: { |
| 41 | LabeledContent("Light Theme", value: ThemePickerScreen.current(.light).displayName) |
| 41 | 42 | } |
| 42 | | NavigationLink("Import from Emacs") { EmacsImportScreen(model: model) } |
| 43 | | if model.configFolder != nil { |
| 44 | | Button("Stop Using This Folder", role: .destructive) { model.setConfigFolder(nil) } |
| 43 | NavigationLink { |
| 44 | ThemePickerScreen(model: model, appearance: .dark) |
| 45 | } label: { |
| 46 | LabeledContent("Dark Theme", value: ThemePickerScreen.current(.dark).displayName) |
| 47 | } |
| 48 | NavigationLink { |
| 49 | AppIconScreen(current: $appIcon) |
| 50 | } label: { |
| 51 | LabeledContent("App Icon", value: AppIcons.name(appIcon)) |
| 52 | } |
| 53 | Picker("Body Font", selection: Binding { |
| 54 | UserDefaults.standard.string(forKey: "themeBodyFont") ?? "" |
| 55 | } set: { model.set("themeBodyFont", to: .string($0)) }) { |
| 56 | let body = UserDefaults.standard.string(forKey: "themeBodyFont") ?? "" |
| 57 | Text("Same as Font").tag("") |
| 58 | Text("System").tag("system") |
| 59 | ForEach(Self.proportionalFamilies, id: \.self) { Text($0).tag($0) } |
| 60 | if !["", "system"].contains(body), !Self.proportionalFamilies.contains(body) { Text(body).tag(body) } |
| 61 | } |
| 62 | .pickerStyle(.navigationLink) |
| 63 | Picker("Text Width", selection: Binding { |
| 64 | UserDefaults.standard.integer(forKey: "themeTextWidth") |
| 65 | } set: { model.set("themeTextWidth", to: .integer($0)) }) { |
| 66 | let width = UserDefaults.standard.integer(forKey: "themeTextWidth") |
| 67 | Text("Whole Screen").tag(0) |
| 68 | ForEach([60, 70, 80, 90, 100, 120], id: \.self) { Text("\($0) columns").tag($0) } |
| 69 | if ![0, 60, 70, 80, 90, 100, 120].contains(width) { Text("\(width) columns").tag(width) } |
| 45 | 70 | } |
| 46 | | ForEach(model.configProblems, id: \.self) { Text($0).foregroundStyle(.red) } |
| 47 | 71 | } header: { |
| 48 | | Text("Configuration") |
| 72 | Text("Appearance") |
| 49 | 73 | } footer: { |
| 50 | | Text("A folder with config.toml and capture.toml, such as a synced copy of ~/.config/orgstar from your Mac. Changes to them apply as they sync.") |
| 74 | Text("With a Body Font, prose uses it while tables, code, dates, tags and drawers keep the monospaced font. Text Width keeps lines to that many columns, centred, on a screen wider than that.") |
| 51 | 75 | } |
| 52 | 76 | Section { |
| 53 | 77 | let _ = model.settingsVersion |
| 54 | 78 | Toggle("Show days without entries", isOn: Binding { |
| 55 | 79 | OrgPreferences.agendaShowAllDates() |
| 56 | 80 | } set: { model.set("agendaShowAllDates", to: .bool($0)) }) |
| 81 | .help(Text(verbatim: "org-agenda-show-all-dates")) |
| 57 | 82 | Toggle("Habits only today", isOn: Binding { |
| 58 | 83 | OrgPreferences.habitsOnlyForToday() |
| 59 | 84 | } set: { model.set("habitsOnlyForToday", to: .bool($0)) }) |
| 85 | .help(Text(verbatim: "org-habit-show-habits-only-for-today")) |
| 60 | 86 | Toggle("Exclude archived tasks", isOn: Binding { |
| 61 | 87 | OrgPreferences.agendaExcludeArchives() |
| 62 | 88 | } set: { model.set("agendaExcludeArchives", to: .bool($0)) }) |
| 89 | .help(Text(verbatim: "agenda-exclude-archives")) |
| 63 | 90 | Picker("Blocked entries", selection: Binding { |
| 64 | 91 | UserDefaults.standard.string(forKey: "agendaDimBlockedTasks") ?? "t" |
| 65 | 92 | } set: { model.set("agendaDimBlockedTasks", to: .string($0)) }) { |
| @@ -67,6 +94,7 @@ struct SettingsScreen: View { |
| 67 | 94 | Text("Hidden").tag("invisible") |
| 68 | 95 | Text("Shown as usual").tag("nil") |
| 69 | 96 | } |
| 97 | .help(Text(verbatim: "org-agenda-dim-blocked-tasks")) |
| 70 | 98 | } header: { |
| 71 | 99 | Text("Agenda") |
| 72 | 100 | } footer: { |
| @@ -74,17 +102,21 @@ struct SettingsScreen: View { |
| 74 | 102 | } |
| 75 | 103 | Section { |
| 76 | 104 | let _ = model.settingsVersion |
| 77 | | Toggle("Not done before TODO children", isOn: Binding { |
| 105 | Toggle("Entries can't be done before their TODO children", isOn: Binding { |
| 78 | 106 | UserDefaults.standard.bool(forKey: "enforceTodoDependencies") |
| 79 | 107 | } set: { model.set("enforceTodoDependencies", to: .bool($0)) }) |
| 80 | | Toggle("Not done with unchecked boxes", isOn: Binding { |
| 108 | .help(Text(verbatim: "org-enforce-todo-dependencies")) |
| 109 | Toggle("Entries can't be done with unchecked boxes", isOn: Binding { |
| 81 | 110 | UserDefaults.standard.bool(forKey: "enforceTodoCheckboxDependencies") |
| 82 | 111 | } set: { model.set("enforceTodoCheckboxDependencies", to: .bool($0)) }) |
| 112 | .help(Text(verbatim: "org-enforce-todo-checkbox-dependencies")) |
| 83 | 113 | } header: { |
| 84 | 114 | Text("TODO Dependencies") |
| 85 | 115 | } footer: { |
| 86 | 116 | Text("org-enforce-todo-dependencies and org-enforce-todo-checkbox-dependencies.") |
| 87 | 117 | } |
| 118 | calendarSection |
| 119 | reminderSection |
| 88 | 120 | Section { |
| 89 | 121 | if badges == true { |
| 90 | 122 | LabeledContent("Overdue Count on Icon", value: "On") |
| @@ -106,52 +138,26 @@ struct SettingsScreen: View { |
| 106 | 138 | if badges == false { Text("Turn on Badges in orgstar's notification settings.") } |
| 107 | 139 | } |
| 108 | 140 | Section { |
| 109 | | let _ = model.settingsVersion |
| 110 | | NavigationLink { |
| 111 | | ThemePickerScreen(model: model, appearance: .light) |
| 112 | | } label: { |
| 113 | | LabeledContent("Light Theme", value: ThemePickerScreen.current(.light).displayName) |
| 114 | | } |
| 115 | | NavigationLink { |
| 116 | | ThemePickerScreen(model: model, appearance: .dark) |
| 117 | | } label: { |
| 118 | | LabeledContent("Dark Theme", value: ThemePickerScreen.current(.dark).displayName) |
| 119 | | } |
| 120 | | NavigationLink { |
| 121 | | AppIconScreen(current: $appIcon) |
| 122 | | } label: { |
| 123 | | LabeledContent("App Icon", value: AppIcons.name(appIcon)) |
| 124 | | } |
| 125 | | Picker("Body Font", selection: Binding { |
| 126 | | UserDefaults.standard.string(forKey: "themeBodyFont") ?? "" |
| 127 | | } set: { model.set("themeBodyFont", to: .string($0)) }) { |
| 128 | | let body = UserDefaults.standard.string(forKey: "themeBodyFont") ?? "" |
| 129 | | Text("Same as Font").tag("") |
| 130 | | Text("System").tag("system") |
| 131 | | ForEach(Self.proportionalFamilies, id: \.self) { Text($0).tag($0) } |
| 132 | | if !["", "system"].contains(body), !Self.proportionalFamilies.contains(body) { Text(body).tag(body) } |
| 141 | LabeledContent("Folder", value: model.configFolder?.lastPathComponent ?? String(localized: "none.folder", defaultValue: "None", comment: "No configuration folder chosen")) |
| 142 | Button(model.configFolder == nil ? "Choose Folder…" : "Choose Another Folder…") { choosing = true } |
| 143 | if model.configFolder != nil { |
| 144 | NavigationLink("Edit config.toml") { ConfigFileEditor(model: model) } |
| 133 | 145 | } |
| 134 | | .pickerStyle(.navigationLink) |
| 135 | | Picker("Text Width", selection: Binding { |
| 136 | | UserDefaults.standard.integer(forKey: "themeTextWidth") |
| 137 | | } set: { model.set("themeTextWidth", to: .integer($0)) }) { |
| 138 | | let width = UserDefaults.standard.integer(forKey: "themeTextWidth") |
| 139 | | Text("Whole Screen").tag(0) |
| 140 | | ForEach([60, 70, 80, 90, 100, 120], id: \.self) { Text("\($0) columns").tag($0) } |
| 141 | | if ![0, 60, 70, 80, 90, 100, 120].contains(width) { Text("\(width) columns").tag(width) } |
| 146 | NavigationLink("Import from Emacs") { EmacsImportScreen(model: model) } |
| 147 | if model.configFolder != nil { |
| 148 | Button("Stop Using This Folder", role: .destructive) { model.setConfigFolder(nil) } |
| 142 | 149 | } |
| 150 | ForEach(model.configProblems, id: \.self) { Text($0).foregroundStyle(.red) } |
| 143 | 151 | } header: { |
| 144 | | Text("Appearance") |
| 152 | Text("Configuration") |
| 145 | 153 | } footer: { |
| 146 | | Text("With a Body Font, prose uses it while tables, code, dates, tags and drawers keep the monospaced font. Text Width keeps lines to that many columns, centred, on a screen wider than that.") |
| 154 | Text("A folder with config.toml and capture.toml, such as a synced copy of ~/.config/orgstar from your Mac. Changes to them apply as they sync.") |
| 147 | 155 | } |
| 148 | | calendarSection |
| 149 | | reminderSection |
| 150 | 156 | Section("In use") { |
| 151 | 157 | let _ = model.settingsVersion |
| 152 | 158 | LabeledContent("TODO keywords", value: todoKeywords) |
| 153 | 159 | LabeledContent("Agenda", value: agenda) |
| 154 | | LabeledContent("Reminders", value: OrgPreferences.reminders() ? "\(OrgPreferences.reminderLead()) min before" : "Off") |
| 160 | LabeledContent("Notifications", value: OrgPreferences.reminders() ? "\(OrgPreferences.reminderLead()) min before" : "Off") |
| 155 | 161 | LabeledContent("Capture templates", value: CaptureTemplates.load().templates.map(\.key).joined(separator: " ")) |
| 156 | 162 | LabeledContent("Theme", value: themeInUse) |
| 157 | 163 | LabeledContent("Font", value: font) |