| @@ -34,32 +34,59 @@ struct SettingsScreen: View { |
| 34 | } |
34 | } |
| 35 | .listRowBackground(ProBanner.rowBackground) |
35 | .listRowBackground(ProBanner.rowBackground) |
| 36 | Section { |
36 | Section { |
| 37 | LabeledContent("Folder", value: model.configFolder?.lastPathComponent ?? String(localized: "none.folder", defaultValue: "None", comment: "No configuration folder chosen")) |
37 | let _ = model.settingsVersion |
| 38 | Button(model.configFolder == nil ? "Choose Folder…" : "Choose Another Folder…") { choosing = true } |
38 | NavigationLink { |
| 39 | if model.configFolder != nil { |
39 | ThemePickerScreen(model: model, appearance: .light) |
| 40 | NavigationLink("Edit config.toml") { ConfigFileEditor(model: model) } |
40 | } label: { |
| |
41 | LabeledContent("Light Theme", value: ThemePickerScreen.current(.light).displayName) |
| 41 | } |
42 | } |
| 42 | NavigationLink("Import from Emacs") { EmacsImportScreen(model: model) } |
43 | NavigationLink { |
| 43 | if model.configFolder != nil { |
44 | ThemePickerScreen(model: model, appearance: .dark) |
| 44 | Button("Stop Using This Folder", role: .destructive) { model.setConfigFolder(nil) } |
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 | } header: { |
71 | } header: { |
| 48 | Text("Configuration") |
72 | Text("Appearance") |
| 49 | } footer: { |
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 | Section { |
76 | Section { |
| 53 | let _ = model.settingsVersion |
77 | let _ = model.settingsVersion |
| 54 | Toggle("Show days without entries", isOn: Binding { |
78 | Toggle("Show days without entries", isOn: Binding { |
| 55 | OrgPreferences.agendaShowAllDates() |
79 | OrgPreferences.agendaShowAllDates() |
| 56 | } set: { model.set("agendaShowAllDates", to: .bool($0)) }) |
80 | } set: { model.set("agendaShowAllDates", to: .bool($0)) }) |
| |
81 | .help(Text(verbatim: "org-agenda-show-all-dates")) |
| 57 | Toggle("Habits only today", isOn: Binding { |
82 | Toggle("Habits only today", isOn: Binding { |
| 58 | OrgPreferences.habitsOnlyForToday() |
83 | OrgPreferences.habitsOnlyForToday() |
| 59 | } set: { model.set("habitsOnlyForToday", to: .bool($0)) }) |
84 | } set: { model.set("habitsOnlyForToday", to: .bool($0)) }) |
| |
85 | .help(Text(verbatim: "org-habit-show-habits-only-for-today")) |
| 60 | Toggle("Exclude archived tasks", isOn: Binding { |
86 | Toggle("Exclude archived tasks", isOn: Binding { |
| 61 | OrgPreferences.agendaExcludeArchives() |
87 | OrgPreferences.agendaExcludeArchives() |
| 62 | } set: { model.set("agendaExcludeArchives", to: .bool($0)) }) |
88 | } set: { model.set("agendaExcludeArchives", to: .bool($0)) }) |
| |
89 | .help(Text(verbatim: "agenda-exclude-archives")) |
| 63 | Picker("Blocked entries", selection: Binding { |
90 | Picker("Blocked entries", selection: Binding { |
| 64 | UserDefaults.standard.string(forKey: "agendaDimBlockedTasks") ?? "t" |
91 | UserDefaults.standard.string(forKey: "agendaDimBlockedTasks") ?? "t" |
| 65 | } set: { model.set("agendaDimBlockedTasks", to: .string($0)) }) { |
92 | } set: { model.set("agendaDimBlockedTasks", to: .string($0)) }) { |
| @@ -67,6 +94,7 @@ struct SettingsScreen: View { |
| 67 | Text("Hidden").tag("invisible") |
94 | Text("Hidden").tag("invisible") |
| 68 | Text("Shown as usual").tag("nil") |
95 | Text("Shown as usual").tag("nil") |
| 69 | } |
96 | } |
| |
97 | .help(Text(verbatim: "org-agenda-dim-blocked-tasks")) |
| 70 | } header: { |
98 | } header: { |
| 71 | Text("Agenda") |
99 | Text("Agenda") |
| 72 | } footer: { |
100 | } footer: { |
| @@ -74,17 +102,21 @@ struct SettingsScreen: View { |
| 74 | } |
102 | } |
| 75 | Section { |
103 | Section { |
| 76 | let _ = model.settingsVersion |
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 | UserDefaults.standard.bool(forKey: "enforceTodoDependencies") |
106 | UserDefaults.standard.bool(forKey: "enforceTodoDependencies") |
| 79 | } set: { model.set("enforceTodoDependencies", to: .bool($0)) }) |
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 | UserDefaults.standard.bool(forKey: "enforceTodoCheckboxDependencies") |
110 | UserDefaults.standard.bool(forKey: "enforceTodoCheckboxDependencies") |
| 82 | } set: { model.set("enforceTodoCheckboxDependencies", to: .bool($0)) }) |
111 | } set: { model.set("enforceTodoCheckboxDependencies", to: .bool($0)) }) |
| |
112 | .help(Text(verbatim: "org-enforce-todo-checkbox-dependencies")) |
| 83 | } header: { |
113 | } header: { |
| 84 | Text("TODO Dependencies") |
114 | Text("TODO Dependencies") |
| 85 | } footer: { |
115 | } footer: { |
| 86 | Text("org-enforce-todo-dependencies and org-enforce-todo-checkbox-dependencies.") |
116 | Text("org-enforce-todo-dependencies and org-enforce-todo-checkbox-dependencies.") |
| 87 | } |
117 | } |
| |
118 | calendarSection |
| |
119 | reminderSection |
| 88 | Section { |
120 | Section { |
| 89 | if badges == true { |
121 | if badges == true { |
| 90 | LabeledContent("Overdue Count on Icon", value: "On") |
122 | LabeledContent("Overdue Count on Icon", value: "On") |
| @@ -106,52 +138,26 @@ struct SettingsScreen: View { |
| 106 | if badges == false { Text("Turn on Badges in orgstar's notification settings.") } |
138 | if badges == false { Text("Turn on Badges in orgstar's notification settings.") } |
| 107 | } |
139 | } |
| 108 | Section { |
140 | Section { |
| 109 | let _ = model.settingsVersion |
141 | LabeledContent("Folder", value: model.configFolder?.lastPathComponent ?? String(localized: "none.folder", defaultValue: "None", comment: "No configuration folder chosen")) |
| 110 | NavigationLink { |
142 | Button(model.configFolder == nil ? "Choose Folder…" : "Choose Another Folder…") { choosing = true } |
| 111 | ThemePickerScreen(model: model, appearance: .light) |
143 | if model.configFolder != nil { |
| 112 | } label: { |
144 | NavigationLink("Edit config.toml") { ConfigFileEditor(model: model) } |
| 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) } |
| |
| 133 | } |
145 | } |
| 134 | .pickerStyle(.navigationLink) |
146 | NavigationLink("Import from Emacs") { EmacsImportScreen(model: model) } |
| 135 | Picker("Text Width", selection: Binding { |
147 | if model.configFolder != nil { |
| 136 | UserDefaults.standard.integer(forKey: "themeTextWidth") |
148 | Button("Stop Using This Folder", role: .destructive) { model.setConfigFolder(nil) } |
| 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) } |
| |
| 142 | } |
149 | } |
| |
150 | ForEach(model.configProblems, id: \.self) { Text($0).foregroundStyle(.red) } |
| 143 | } header: { |
151 | } header: { |
| 144 | Text("Appearance") |
152 | Text("Configuration") |
| 145 | } footer: { |
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 | Section("In use") { |
156 | Section("In use") { |
| 151 | let _ = model.settingsVersion |
157 | let _ = model.settingsVersion |
| 152 | LabeledContent("TODO keywords", value: todoKeywords) |
158 | LabeledContent("TODO keywords", value: todoKeywords) |
| 153 | LabeledContent("Agenda", value: agenda) |
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 | LabeledContent("Capture templates", value: CaptureTemplates.load().templates.map(\.key).joined(separator: " ")) |
161 | LabeledContent("Capture templates", value: CaptureTemplates.load().templates.map(\.key).joined(separator: " ")) |
| 156 | LabeledContent("Theme", value: themeInUse) |
162 | LabeledContent("Theme", value: themeInUse) |
| 157 | LabeledContent("Font", value: font) |
163 | LabeledContent("Font", value: font) |