PrefUI // Boost SwiftUI requirements to macOS 13.
This commit is contained in:
parent
f81f2d3b43
commit
fa979137df
|
@ -13,18 +13,17 @@ import LangModelAssembly
|
||||||
import Shared
|
import Shared
|
||||||
import SwiftExtension
|
import SwiftExtension
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
import SwiftUIBackports
|
|
||||||
|
|
||||||
private let loc: String =
|
private let loc: String =
|
||||||
(UserDefaults.current.array(forKey: UserDef.kAppleLanguages.rawValue) as? [String] ?? ["auto"])[0]
|
(UserDefaults.current.array(forKey: UserDef.kAppleLanguages.rawValue) as? [String] ?? ["auto"])[0]
|
||||||
|
|
||||||
@available(macOS 10.15, *)
|
@available(macOS 13, *)
|
||||||
extension VwrPhraseEditorUI {
|
extension VwrPhraseEditorUI {
|
||||||
@Backport.AppStorage("PhraseEditorAutoReloadExternalModifications")
|
@AppStorage("PhraseEditorAutoReloadExternalModifications")
|
||||||
private static var autoReloadExternalModifications: Bool = true
|
private static var autoReloadExternalModifications: Bool = true
|
||||||
}
|
}
|
||||||
|
|
||||||
@available(macOS 10.15, *)
|
@available(macOS 13, *)
|
||||||
public struct VwrPhraseEditorUI: View {
|
public struct VwrPhraseEditorUI: View {
|
||||||
static var txtContentStorage: String = NSLocalizedString(
|
static var txtContentStorage: String = NSLocalizedString(
|
||||||
"Please select Simplified / Traditional Chinese mode above.", comment: ""
|
"Please select Simplified / Traditional Chinese mode above.", comment: ""
|
||||||
|
@ -235,16 +234,10 @@ public struct VwrPhraseEditorUI: View {
|
||||||
Button("Consolidate") {
|
Button("Consolidate") {
|
||||||
consolidate()
|
consolidate()
|
||||||
}.disabled(selInputMode == .imeModeNULL || isLoading)
|
}.disabled(selInputMode == .imeModeNULL || isLoading)
|
||||||
if #available(macOS 11.0, *) {
|
|
||||||
Button("Save") {
|
Button("Save") {
|
||||||
DispatchQueue.main.async { saveAndReload() }
|
DispatchQueue.main.async { saveAndReload() }
|
||||||
}.keyboardShortcut("s", modifiers: [.command])
|
}.keyboardShortcut("s", modifiers: [.command])
|
||||||
.disabled(delegate == nil)
|
.disabled(delegate == nil)
|
||||||
} else {
|
|
||||||
Button("Save") {
|
|
||||||
DispatchQueue.main.async { saveAndReload() }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Button("...") {
|
Button("...") {
|
||||||
DispatchQueue.main.async {
|
DispatchQueue.main.async {
|
||||||
saveAndReload()
|
saveAndReload()
|
||||||
|
@ -256,7 +249,7 @@ public struct VwrPhraseEditorUI: View {
|
||||||
TextEditorEX(text: $txtContent)
|
TextEditorEX(text: $txtContent)
|
||||||
.disabled(selInputMode == .imeModeNULL || isLoading)
|
.disabled(selInputMode == .imeModeNULL || isLoading)
|
||||||
.frame(minWidth: 320, minHeight: 240)
|
.frame(minWidth: 320, minHeight: 240)
|
||||||
.backport.onChange(of: fileChangeIndicator.id) { _ in
|
.onChange(of: fileChangeIndicator.id) { _ in
|
||||||
if Self.autoReloadExternalModifications { update() }
|
if Self.autoReloadExternalModifications { update() }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -291,7 +284,6 @@ public struct VwrPhraseEditorUI: View {
|
||||||
}
|
}
|
||||||
}.disabled(selInputMode == Shared.InputMode.imeModeNULL || isLoading)
|
}.disabled(selInputMode == Shared.InputMode.imeModeNULL || isLoading)
|
||||||
HStack {
|
HStack {
|
||||||
if #available(macOS 12, *) {
|
|
||||||
Toggle(
|
Toggle(
|
||||||
LocalizedStringKey("This editor only: Auto-reload modifications happened outside of this editor"),
|
LocalizedStringKey("This editor only: Auto-reload modifications happened outside of this editor"),
|
||||||
isOn: $selAutoReloadExternalModifications.onChange {
|
isOn: $selAutoReloadExternalModifications.onChange {
|
||||||
|
@ -299,10 +291,6 @@ public struct VwrPhraseEditorUI: View {
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
.controlSize(.small)
|
.controlSize(.small)
|
||||||
} else {
|
|
||||||
Text("Some features are unavailable for macOS 10.15 and macOS 11 due to API limitations.")
|
|
||||||
.font(.system(size: 11.0)).foregroundColor(.secondary)
|
|
||||||
}
|
|
||||||
Spacer()
|
Spacer()
|
||||||
}
|
}
|
||||||
}.onDisappear {
|
}.onDisappear {
|
||||||
|
@ -319,7 +307,7 @@ public struct VwrPhraseEditorUI: View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@available(macOS 10.15, *)
|
@available(macOS 13, *)
|
||||||
struct ContentView_Previews: PreviewProvider {
|
struct ContentView_Previews: PreviewProvider {
|
||||||
static var previews: some View {
|
static var previews: some View {
|
||||||
VwrPhraseEditorUI()
|
VwrPhraseEditorUI()
|
||||||
|
|
|
@ -16,7 +16,7 @@ private let kWindowTitleHeight: Double = 78
|
||||||
|
|
||||||
// InputMethodServerPreferencesWindowControllerClass 非必需。
|
// InputMethodServerPreferencesWindowControllerClass 非必需。
|
||||||
|
|
||||||
@available(macOS 10.15, *)
|
@available(macOS 13, *)
|
||||||
class CtlPrefUI: NSWindowController, NSWindowDelegate {
|
class CtlPrefUI: NSWindowController, NSWindowDelegate {
|
||||||
public static var shared: CtlPrefUI?
|
public static var shared: CtlPrefUI?
|
||||||
|
|
||||||
|
@ -47,13 +47,11 @@ class CtlPrefUI: NSWindowController, NSWindowDelegate {
|
||||||
override func windowDidLoad() {
|
override func windowDidLoad() {
|
||||||
super.windowDidLoad()
|
super.windowDidLoad()
|
||||||
window?.setPosition(vertical: .top, horizontal: .right, padding: 20)
|
window?.setPosition(vertical: .top, horizontal: .right, padding: 20)
|
||||||
if #available(macOS 13, *) {
|
|
||||||
window?.contentView = NSHostingView(
|
window?.contentView = NSHostingView(
|
||||||
rootView: VwrSettingsUI()
|
rootView: VwrSettingsUI()
|
||||||
.fixedSize(horizontal: true, vertical: false)
|
.fixedSize(horizontal: true, vertical: false)
|
||||||
.ignoresSafeArea()
|
.ignoresSafeArea()
|
||||||
)
|
)
|
||||||
}
|
|
||||||
let toolbar = NSToolbar(identifier: "preference toolbar")
|
let toolbar = NSToolbar(identifier: "preference toolbar")
|
||||||
toolbar.allowsUserCustomization = false
|
toolbar.allowsUserCustomization = false
|
||||||
toolbar.autosavesConfiguration = false
|
toolbar.autosavesConfiguration = false
|
||||||
|
@ -61,9 +59,7 @@ class CtlPrefUI: NSWindowController, NSWindowDelegate {
|
||||||
toolbar.delegate = self
|
toolbar.delegate = self
|
||||||
toolbar.selectedItemIdentifier = nil
|
toolbar.selectedItemIdentifier = nil
|
||||||
toolbar.showsBaselineSeparator = true
|
toolbar.showsBaselineSeparator = true
|
||||||
if #available(macOS 11, *) {
|
|
||||||
window?.toolbarStyle = .unifiedCompact
|
window?.toolbarStyle = .unifiedCompact
|
||||||
}
|
|
||||||
window?.toolbar = toolbar
|
window?.toolbar = toolbar
|
||||||
var preferencesTitleName = NSLocalizedString("vChewing Preferences…", comment: "")
|
var preferencesTitleName = NSLocalizedString("vChewing Preferences…", comment: "")
|
||||||
preferencesTitleName.removeLast()
|
preferencesTitleName.removeLast()
|
||||||
|
@ -73,7 +69,7 @@ class CtlPrefUI: NSWindowController, NSWindowDelegate {
|
||||||
|
|
||||||
// MARK: - NSToolbarDelegate.
|
// MARK: - NSToolbarDelegate.
|
||||||
|
|
||||||
@available(macOS 10.15, *)
|
@available(macOS 13, *)
|
||||||
extension CtlPrefUI: NSToolbarDelegate {
|
extension CtlPrefUI: NSToolbarDelegate {
|
||||||
var toolbarIdentifiers: [NSToolbarItem.Identifier] {
|
var toolbarIdentifiers: [NSToolbarItem.Identifier] {
|
||||||
[.init("Collapse or Expand Sidebar")]
|
[.init("Collapse or Expand Sidebar")]
|
||||||
|
@ -96,9 +92,7 @@ extension CtlPrefUI: NSToolbarDelegate {
|
||||||
willBeInsertedIntoToolbar _: Bool
|
willBeInsertedIntoToolbar _: Bool
|
||||||
) -> NSToolbarItem? {
|
) -> NSToolbarItem? {
|
||||||
let item = NSToolbarItem(itemIdentifier: itemIdentifier)
|
let item = NSToolbarItem(itemIdentifier: itemIdentifier)
|
||||||
if #available(macOS 11.0, *) {
|
|
||||||
item.isNavigational = true
|
item.isNavigational = true
|
||||||
}
|
|
||||||
item.target = window?.firstResponder
|
item.target = window?.firstResponder
|
||||||
item.image = NSImage(named: "NSTouchBarSidebarTemplate") ?? .init()
|
item.image = NSImage(named: "NSTouchBarSidebarTemplate") ?? .init()
|
||||||
item.tag = 0
|
item.tag = 0
|
||||||
|
@ -106,3 +100,40 @@ extension CtlPrefUI: NSToolbarDelegate {
|
||||||
return item
|
return item
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MARK: - Shared Static Variables and Constants
|
||||||
|
|
||||||
|
@available(macOS 13, *)
|
||||||
|
extension CtlPrefUI {
|
||||||
|
static let sentenceSeparator: String = {
|
||||||
|
switch PrefMgr.shared.appleLanguages[0] {
|
||||||
|
case "ja":
|
||||||
|
return ""
|
||||||
|
default:
|
||||||
|
if PrefMgr.shared.appleLanguages[0].contains("zh-Han") {
|
||||||
|
return ""
|
||||||
|
} else {
|
||||||
|
return " "
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
static let contentMaxHeight: Double = 490
|
||||||
|
|
||||||
|
static let formWidth: Double = {
|
||||||
|
switch PrefMgr.shared.appleLanguages[0] {
|
||||||
|
case "ja":
|
||||||
|
return 520
|
||||||
|
default:
|
||||||
|
if PrefMgr.shared.appleLanguages[0].contains("zh-Han") {
|
||||||
|
return 500
|
||||||
|
} else {
|
||||||
|
return 580
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
static var isCJKInterface: Bool {
|
||||||
|
PrefMgr.shared.appleLanguages[0].contains("zh-Han") || PrefMgr.shared.appleLanguages[0] == "ja"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ import MainAssembly
|
||||||
import SwiftExtension
|
import SwiftExtension
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
@available(macOS 10.15, *)
|
@available(macOS 13, *)
|
||||||
extension PrefUITabs {
|
extension PrefUITabs {
|
||||||
@ViewBuilder
|
@ViewBuilder
|
||||||
var suiView: some View {
|
var suiView: some View {
|
||||||
|
@ -28,46 +28,6 @@ extension PrefUITabs {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@available(macOS 10.15, *)
|
|
||||||
class CtlPrefUIShared {
|
|
||||||
static var sharedWindow: NSWindow? {
|
|
||||||
CtlPrefUI.shared?.window
|
|
||||||
}
|
|
||||||
|
|
||||||
static let shared = CtlPrefUIShared()
|
|
||||||
static let sentenceSeparator: String = {
|
|
||||||
switch PrefMgr.shared.appleLanguages[0] {
|
|
||||||
case "ja":
|
|
||||||
return ""
|
|
||||||
default:
|
|
||||||
if PrefMgr.shared.appleLanguages[0].contains("zh-Han") {
|
|
||||||
return ""
|
|
||||||
} else {
|
|
||||||
return " "
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
static let contentMaxHeight: Double = 490
|
|
||||||
|
|
||||||
static let formWidth: Double = {
|
|
||||||
switch PrefMgr.shared.appleLanguages[0] {
|
|
||||||
case "ja":
|
|
||||||
return 520
|
|
||||||
default:
|
|
||||||
if PrefMgr.shared.appleLanguages[0].contains("zh-Han") {
|
|
||||||
return 500
|
|
||||||
} else {
|
|
||||||
return 580
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
static var isCJKInterface: Bool {
|
|
||||||
PrefMgr.shared.appleLanguages[0].contains("zh-Han") || PrefMgr.shared.appleLanguages[0] == "ja"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@available(macOS 10.15, *)
|
@available(macOS 10.15, *)
|
||||||
public extension View {
|
public extension View {
|
||||||
func settingsDescription(maxWidth: CGFloat? = .infinity) -> some View {
|
func settingsDescription(maxWidth: CGFloat? = .infinity) -> some View {
|
||||||
|
|
|
@ -12,7 +12,7 @@ import SwiftExtension
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
import SwiftUIBackports
|
import SwiftUIBackports
|
||||||
|
|
||||||
@available(macOS 10.15, *)
|
@available(macOS 13, *)
|
||||||
struct VwrPrefPaneBehavior: View {
|
struct VwrPrefPaneBehavior: View {
|
||||||
// MARK: - AppStorage Variables
|
// MARK: - AppStorage Variables
|
||||||
|
|
||||||
|
@ -217,7 +217,7 @@ struct VwrPrefPaneBehavior: View {
|
||||||
)
|
)
|
||||||
Spacer()
|
Spacer()
|
||||||
Text(
|
Text(
|
||||||
"This feature requires macOS 10.15 and above.".localized + CtlPrefUIShared.sentenceSeparator
|
"This feature requires macOS 10.15 and above.".localized + CtlPrefUI.sentenceSeparator
|
||||||
+ "This feature only needs to parse consecutive NSEvents passed by macOS built-in InputMethodKit framework, hence no necessity of asking end-users for extra privileges of monitoring global keyboard inputs. You are free to investigate our codebase or reverse-engineer this input method to see whether the above statement is trustable.".localized
|
+ "This feature only needs to parse consecutive NSEvents passed by macOS built-in InputMethodKit framework, hence no necessity of asking end-users for extra privileges of monitoring global keyboard inputs. You are free to investigate our codebase or reverse-engineer this input method to see whether the above statement is trustable.".localized
|
||||||
)
|
)
|
||||||
.settingsDescription()
|
.settingsDescription()
|
||||||
|
@ -251,13 +251,13 @@ struct VwrPrefPaneBehavior: View {
|
||||||
.settingsDescription()
|
.settingsDescription()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.formStyled().frame(minWidth: CtlPrefUIShared.formWidth, maxWidth: ceil(CtlPrefUIShared.formWidth * 1.2))
|
}.formStyled().frame(minWidth: CtlPrefUI.formWidth, maxWidth: ceil(CtlPrefUI.formWidth * 1.2))
|
||||||
}
|
}
|
||||||
.frame(maxHeight: CtlPrefUIShared.contentMaxHeight)
|
.frame(maxHeight: CtlPrefUI.contentMaxHeight)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@available(macOS 11.0, *)
|
@available(macOS 13, *)
|
||||||
struct VwrPrefPaneBehavior_Previews: PreviewProvider {
|
struct VwrPrefPaneBehavior_Previews: PreviewProvider {
|
||||||
static var previews: some View {
|
static var previews: some View {
|
||||||
VwrPrefPaneBehavior()
|
VwrPrefPaneBehavior()
|
||||||
|
|
|
@ -12,7 +12,7 @@ import SwiftExtension
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
import SwiftUIBackports
|
import SwiftUIBackports
|
||||||
|
|
||||||
@available(macOS 10.15, *)
|
@available(macOS 13, *)
|
||||||
struct VwrPrefPaneCandidates: View {
|
struct VwrPrefPaneCandidates: View {
|
||||||
// MARK: - AppStorage Variables
|
// MARK: - AppStorage Variables
|
||||||
|
|
||||||
|
@ -190,13 +190,13 @@ struct VwrPrefPaneCandidates: View {
|
||||||
isOn: $enableMouseScrollingForTDKCandidatesCocoa
|
isOn: $enableMouseScrollingForTDKCandidatesCocoa
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}.formStyled().frame(minWidth: CtlPrefUIShared.formWidth, maxWidth: ceil(CtlPrefUIShared.formWidth * 1.2))
|
}.formStyled().frame(minWidth: CtlPrefUI.formWidth, maxWidth: ceil(CtlPrefUI.formWidth * 1.2))
|
||||||
}
|
}
|
||||||
.frame(maxHeight: CtlPrefUIShared.contentMaxHeight)
|
.frame(maxHeight: CtlPrefUI.contentMaxHeight)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@available(macOS 11.0, *)
|
@available(macOS 13, *)
|
||||||
struct VwrPrefPaneCandidates_Previews: PreviewProvider {
|
struct VwrPrefPaneCandidates_Previews: PreviewProvider {
|
||||||
static var previews: some View {
|
static var previews: some View {
|
||||||
VwrPrefPaneCandidates()
|
VwrPrefPaneCandidates()
|
||||||
|
@ -205,7 +205,7 @@ struct VwrPrefPaneCandidates_Previews: PreviewProvider {
|
||||||
|
|
||||||
// MARK: - Selection Key Preferences (View)
|
// MARK: - Selection Key Preferences (View)
|
||||||
|
|
||||||
@available(macOS 10.15, *)
|
@available(macOS 13, *)
|
||||||
private struct VwrPrefPaneCandidates_SelectionKeys: View {
|
private struct VwrPrefPaneCandidates_SelectionKeys: View {
|
||||||
// MARK: - AppStorage Variables
|
// MARK: - AppStorage Variables
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ import SwiftExtension
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
import SwiftUIBackports
|
import SwiftUIBackports
|
||||||
|
|
||||||
@available(macOS 10.15, *)
|
@available(macOS 13, *)
|
||||||
struct VwrPrefPaneCassette: View {
|
struct VwrPrefPaneCassette: View {
|
||||||
// MARK: - AppStorage Variables
|
// MARK: - AppStorage Variables
|
||||||
|
|
||||||
|
@ -185,13 +185,13 @@ struct VwrPrefPaneCassette: View {
|
||||||
.settingsDescription()
|
.settingsDescription()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.formStyled().frame(minWidth: CtlPrefUIShared.formWidth, maxWidth: ceil(CtlPrefUIShared.formWidth * 1.2))
|
}.formStyled().frame(minWidth: CtlPrefUI.formWidth, maxWidth: ceil(CtlPrefUI.formWidth * 1.2))
|
||||||
}
|
}
|
||||||
.frame(maxHeight: CtlPrefUIShared.contentMaxHeight)
|
.frame(maxHeight: CtlPrefUI.contentMaxHeight)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@available(macOS 11.0, *)
|
@available(macOS 13, *)
|
||||||
struct VwrPrefPaneCassette_Previews: PreviewProvider {
|
struct VwrPrefPaneCassette_Previews: PreviewProvider {
|
||||||
static var previews: some View {
|
static var previews: some View {
|
||||||
VwrPrefPaneDictionary()
|
VwrPrefPaneDictionary()
|
||||||
|
|
|
@ -11,7 +11,7 @@ import SwiftExtension
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
import SwiftUIBackports
|
import SwiftUIBackports
|
||||||
|
|
||||||
@available(macOS 10.15, *)
|
@available(macOS 13, *)
|
||||||
struct VwrPrefPaneDevZone: View {
|
struct VwrPrefPaneDevZone: View {
|
||||||
// MARK: - AppStorage Variables
|
// MARK: - AppStorage Variables
|
||||||
|
|
||||||
|
@ -56,13 +56,13 @@ struct VwrPrefPaneDevZone: View {
|
||||||
.settingsDescription()
|
.settingsDescription()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.formStyled().frame(minWidth: CtlPrefUIShared.formWidth, maxWidth: ceil(CtlPrefUIShared.formWidth * 1.2))
|
}.formStyled().frame(minWidth: CtlPrefUI.formWidth, maxWidth: ceil(CtlPrefUI.formWidth * 1.2))
|
||||||
}
|
}
|
||||||
.frame(maxHeight: CtlPrefUIShared.contentMaxHeight)
|
.frame(maxHeight: CtlPrefUI.contentMaxHeight)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@available(macOS 11.0, *)
|
@available(macOS 13, *)
|
||||||
struct VwrPrefPaneDevZone_Previews: PreviewProvider {
|
struct VwrPrefPaneDevZone_Previews: PreviewProvider {
|
||||||
static var previews: some View {
|
static var previews: some View {
|
||||||
VwrPrefPaneDevZone()
|
VwrPrefPaneDevZone()
|
||||||
|
|
|
@ -14,7 +14,7 @@ import SwiftExtension
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
import SwiftUIBackports
|
import SwiftUIBackports
|
||||||
|
|
||||||
@available(macOS 10.15, *)
|
@available(macOS 13, *)
|
||||||
struct VwrPrefPaneDictionary: View {
|
struct VwrPrefPaneDictionary: View {
|
||||||
// MARK: - AppStorage Variables
|
// MARK: - AppStorage Variables
|
||||||
|
|
||||||
|
@ -232,13 +232,13 @@ struct VwrPrefPaneDictionary: View {
|
||||||
.settingsDescription()
|
.settingsDescription()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.formStyled().frame(minWidth: CtlPrefUIShared.formWidth, maxWidth: ceil(CtlPrefUIShared.formWidth * 1.2))
|
}.formStyled().frame(minWidth: CtlPrefUI.formWidth, maxWidth: ceil(CtlPrefUI.formWidth * 1.2))
|
||||||
}
|
}
|
||||||
.frame(maxHeight: CtlPrefUIShared.contentMaxHeight)
|
.frame(maxHeight: CtlPrefUI.contentMaxHeight)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@available(macOS 11.0, *)
|
@available(macOS 13, *)
|
||||||
struct VwrPrefPaneDictionary_Previews: PreviewProvider {
|
struct VwrPrefPaneDictionary_Previews: PreviewProvider {
|
||||||
static var previews: some View {
|
static var previews: some View {
|
||||||
VwrPrefPaneDictionary()
|
VwrPrefPaneDictionary()
|
||||||
|
|
|
@ -12,7 +12,7 @@ import SwiftExtension
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
import SwiftUIBackports
|
import SwiftUIBackports
|
||||||
|
|
||||||
@available(macOS 10.15, *)
|
@available(macOS 13, *)
|
||||||
struct VwrPrefPaneGeneral: View {
|
struct VwrPrefPaneGeneral: View {
|
||||||
@Binding var appleLanguageTag: String
|
@Binding var appleLanguageTag: String
|
||||||
|
|
||||||
|
@ -137,11 +137,9 @@ struct VwrPrefPaneGeneral: View {
|
||||||
let alert = NSAlert(error: NSLocalizedString("Warning", comment: ""))
|
let alert = NSAlert(error: NSLocalizedString("Warning", comment: ""))
|
||||||
alert.informativeText = content
|
alert.informativeText = content
|
||||||
alert.addButton(withTitle: NSLocalizedString("Uncheck", comment: ""))
|
alert.addButton(withTitle: NSLocalizedString("Uncheck", comment: ""))
|
||||||
if #available(macOS 11, *) {
|
|
||||||
alert.buttons.forEach { button in
|
alert.buttons.forEach { button in
|
||||||
button.hasDestructiveAction = true
|
button.hasDestructiveAction = true
|
||||||
}
|
}
|
||||||
}
|
|
||||||
alert.addButton(withTitle: NSLocalizedString("Leave it checked", comment: ""))
|
alert.addButton(withTitle: NSLocalizedString("Leave it checked", comment: ""))
|
||||||
if let window = CtlPrefUI.shared?.window, !shouldNotFartInLieuOfBeep {
|
if let window = CtlPrefUI.shared?.window, !shouldNotFartInLieuOfBeep {
|
||||||
shouldNotFartInLieuOfBeep = true
|
shouldNotFartInLieuOfBeep = true
|
||||||
|
@ -175,13 +173,13 @@ struct VwrPrefPaneGeneral: View {
|
||||||
isOn: $isDebugModeEnabled
|
isOn: $isDebugModeEnabled
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}.formStyled().frame(minWidth: CtlPrefUIShared.formWidth, maxWidth: ceil(CtlPrefUIShared.formWidth * 1.2))
|
}.formStyled().frame(minWidth: CtlPrefUI.formWidth, maxWidth: ceil(CtlPrefUI.formWidth * 1.2))
|
||||||
}
|
}
|
||||||
.frame(maxHeight: CtlPrefUIShared.contentMaxHeight)
|
.frame(maxHeight: CtlPrefUI.contentMaxHeight)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@available(macOS 11.0, *)
|
@available(macOS 13, *)
|
||||||
struct VwrPrefPaneGeneral_Previews: PreviewProvider {
|
struct VwrPrefPaneGeneral_Previews: PreviewProvider {
|
||||||
static var previews: some View {
|
static var previews: some View {
|
||||||
VwrPrefPaneGeneral()
|
VwrPrefPaneGeneral()
|
||||||
|
|
|
@ -13,7 +13,7 @@ import SwiftExtension
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
import SwiftUIBackports
|
import SwiftUIBackports
|
||||||
|
|
||||||
@available(macOS 10.15, *)
|
@available(macOS 13, *)
|
||||||
struct VwrPrefPaneKeyboard: View {
|
struct VwrPrefPaneKeyboard: View {
|
||||||
// MARK: - AppStorage Variables
|
// MARK: - AppStorage Variables
|
||||||
|
|
||||||
|
@ -125,13 +125,13 @@ struct VwrPrefPaneKeyboard: View {
|
||||||
Section(header: Text("Keyboard Shortcuts:")) {
|
Section(header: Text("Keyboard Shortcuts:")) {
|
||||||
VwrPrefPaneKeyboard_KeyboardShortcuts()
|
VwrPrefPaneKeyboard_KeyboardShortcuts()
|
||||||
}
|
}
|
||||||
}.formStyled().frame(minWidth: CtlPrefUIShared.formWidth, maxWidth: ceil(CtlPrefUIShared.formWidth * 1.2))
|
}.formStyled().frame(minWidth: CtlPrefUI.formWidth, maxWidth: ceil(CtlPrefUI.formWidth * 1.2))
|
||||||
}
|
}
|
||||||
.frame(maxHeight: CtlPrefUIShared.contentMaxHeight)
|
.frame(maxHeight: CtlPrefUI.contentMaxHeight)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@available(macOS 10.15, *)
|
@available(macOS 13, *)
|
||||||
private struct VwrPrefPaneKeyboard_KeyboardShortcuts: View {
|
private struct VwrPrefPaneKeyboard_KeyboardShortcuts: View {
|
||||||
// MARK: - AppStorage Variables
|
// MARK: - AppStorage Variables
|
||||||
|
|
||||||
|
@ -218,7 +218,7 @@ private struct VwrPrefPaneKeyboard_KeyboardShortcuts: View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@available(macOS 11.0, *)
|
@available(macOS 13, *)
|
||||||
struct VwrPrefPaneKeyboard_Previews: PreviewProvider {
|
struct VwrPrefPaneKeyboard_Previews: PreviewProvider {
|
||||||
static var previews: some View {
|
static var previews: some View {
|
||||||
VwrPrefPaneKeyboard()
|
VwrPrefPaneKeyboard()
|
||||||
|
|
|
@ -11,7 +11,7 @@ import SwiftExtension
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
import SwiftUIBackports
|
import SwiftUIBackports
|
||||||
|
|
||||||
@available(macOS 10.15, *)
|
@available(macOS 13, *)
|
||||||
struct VwrPrefPaneOutput: View {
|
struct VwrPrefPaneOutput: View {
|
||||||
// MARK: - AppStorage Variables
|
// MARK: - AppStorage Variables
|
||||||
|
|
||||||
|
@ -73,13 +73,13 @@ struct VwrPrefPaneOutput: View {
|
||||||
.settingsDescription()
|
.settingsDescription()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.formStyled().frame(minWidth: CtlPrefUIShared.formWidth, maxWidth: ceil(CtlPrefUIShared.formWidth * 1.2))
|
}.formStyled().frame(minWidth: CtlPrefUI.formWidth, maxWidth: ceil(CtlPrefUI.formWidth * 1.2))
|
||||||
}
|
}
|
||||||
.frame(maxHeight: CtlPrefUIShared.contentMaxHeight)
|
.frame(maxHeight: CtlPrefUI.contentMaxHeight)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@available(macOS 11.0, *)
|
@available(macOS 13, *)
|
||||||
struct VwrPrefPaneOutput_Previews: PreviewProvider {
|
struct VwrPrefPaneOutput_Previews: PreviewProvider {
|
||||||
static var previews: some View {
|
static var previews: some View {
|
||||||
VwrPrefPaneOutput()
|
VwrPrefPaneOutput()
|
||||||
|
|
|
@ -12,7 +12,7 @@ import Shared
|
||||||
import SwiftExtension
|
import SwiftExtension
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
@available(macOS 10.15, *)
|
@available(macOS 13, *)
|
||||||
struct VwrPrefPanePhrases: View {
|
struct VwrPrefPanePhrases: View {
|
||||||
var body: some View {
|
var body: some View {
|
||||||
ScrollView {
|
ScrollView {
|
||||||
|
@ -26,13 +26,13 @@ struct VwrPrefPanePhrases: View {
|
||||||
}
|
}
|
||||||
.padding(4)
|
.padding(4)
|
||||||
.padding()
|
.padding()
|
||||||
.frame(minWidth: CtlPrefUIShared.formWidth, maxWidth: ceil(CtlPrefUIShared.formWidth * 1.2))
|
.frame(minWidth: CtlPrefUI.formWidth, maxWidth: ceil(CtlPrefUI.formWidth * 1.2))
|
||||||
}
|
}
|
||||||
.frame(maxHeight: CtlPrefUIShared.contentMaxHeight)
|
.frame(maxHeight: CtlPrefUI.contentMaxHeight)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@available(macOS 11.0, *)
|
@available(macOS 13, *)
|
||||||
struct VwrPrefPanePhrases_Previews: PreviewProvider {
|
struct VwrPrefPanePhrases_Previews: PreviewProvider {
|
||||||
static var previews: some View {
|
static var previews: some View {
|
||||||
VwrPrefPanePhrases()
|
VwrPrefPanePhrases()
|
||||||
|
|
|
@ -47,6 +47,6 @@ public struct VwrSettingsUI: View {
|
||||||
.frame(minWidth: 128, idealWidth: 128, maxWidth: 128)
|
.frame(minWidth: 128, idealWidth: 128, maxWidth: 128)
|
||||||
PrefUITabs.tabGeneral.suiView
|
PrefUITabs.tabGeneral.suiView
|
||||||
}
|
}
|
||||||
.frame(width: CtlPrefUIShared.formWidth + 140, height: CtlPrefUIShared.contentMaxHeight)
|
.frame(width: CtlPrefUI.formWidth + 140, height: CtlPrefUI.contentMaxHeight)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue