diff --git a/Easydict.xcodeproj/project.pbxproj b/Easydict.xcodeproj/project.pbxproj index 567d56cab..663778224 100644 --- a/Easydict.xcodeproj/project.pbxproj +++ b/Easydict.xcodeproj/project.pbxproj @@ -226,6 +226,7 @@ 276742092B3DC230002A2C75 /* AboutTab.swift in Sources */ = {isa = PBXBuildFile; fileRef = 276742052B3DC230002A2C75 /* AboutTab.swift */; }; 278322602B0FB0EA0026644C /* CaiyunResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2783225F2B0FB0EA0026644C /* CaiyunResponse.swift */; }; 278322622B0FB8EF0026644C /* CaiyunTranslateType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 278322612B0FB8EF0026644C /* CaiyunTranslateType.swift */; }; + 278540342B3DE04F004E9488 /* GeneralTab.swift in Sources */ = {isa = PBXBuildFile; fileRef = 278540332B3DE04F004E9488 /* GeneralTab.swift */; }; 27FE95272B3DC55F000AD654 /* EasydictApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27FE95262B3DC55F000AD654 /* EasydictApp.swift */; }; 27FE98052B3DCB09000AD654 /* NewAppManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27FE98042B3DCB09000AD654 /* NewAppManager.swift */; }; 27FE98092B3DD536000AD654 /* SettingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 27FE98082B3DD536000AD654 /* SettingView.swift */; }; @@ -678,6 +679,7 @@ 276742052B3DC230002A2C75 /* AboutTab.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AboutTab.swift; sourceTree = ""; }; 2783225F2B0FB0EA0026644C /* CaiyunResponse.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CaiyunResponse.swift; sourceTree = ""; }; 278322612B0FB8EF0026644C /* CaiyunTranslateType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CaiyunTranslateType.swift; sourceTree = ""; }; + 278540332B3DE04F004E9488 /* GeneralTab.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GeneralTab.swift; sourceTree = ""; }; 27B7919C2AEC36A1006E07C6 /* Easydict.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Easydict.xcconfig; sourceTree = ""; }; 27B7919D2AEC36A1006E07C6 /* Easydict-debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = "Easydict-debug.xcconfig"; sourceTree = ""; }; 27B791A02AEC3A5C006E07C6 /* Easydict-debug.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = "Easydict-debug.entitlements"; sourceTree = ""; }; @@ -1987,6 +1989,7 @@ 27FE980C2B3DD749000AD654 /* Tabs */ = { isa = PBXGroup; children = ( + 278540332B3DE04F004E9488 /* GeneralTab.swift */, 276742042B3DC230002A2C75 /* PrivacyTab.swift */, 276742052B3DC230002A2C75 /* AboutTab.swift */, ); @@ -2503,6 +2506,7 @@ 03CF88632B137F650030C199 /* Array+Convenience.swift in Sources */, 03B0231229231FA6001C7E63 /* NSObject+DarkMode.m in Sources */, 03B0233829231FA6001C7E63 /* MMOrderedDictionary.m in Sources */, + 278540342B3DE04F004E9488 /* GeneralTab.swift in Sources */, 03BDA7BC2A26DA280079D04F /* XPMArgumentSignature.m in Sources */, 03B0230229231FA6001C7E63 /* EZWordResultView.m in Sources */, 0399C6A529A747E600B4AFCC /* EZDeepLTranslateResponse.m in Sources */, diff --git a/Easydict/App/Localizable.xcstrings b/Easydict/App/Localizable.xcstrings index bde5bab28..b85497d7d 100644 --- a/Easydict/App/Localizable.xcstrings +++ b/Easydict/App/Localizable.xcstrings @@ -1683,6 +1683,16 @@ } } }, + "other" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "其他" + } + } + } + }, "Parameter Error" : { "comment" : "Error description", "localizations" : { diff --git a/Easydict/Feature/Configuration/EZConfiguration.h b/Easydict/Feature/Configuration/EZConfiguration.h index df79dbfb7..d9722a539 100644 --- a/Easydict/Feature/Configuration/EZConfiguration.h +++ b/Easydict/Feature/Configuration/EZConfiguration.h @@ -12,8 +12,10 @@ NS_ASSUME_NONNULL_BEGIN +FOUNDATION_EXPORT NSString *const kHideMainWindowKey; +FOUNDATION_EXPORT NSString *const kLaunchAtStartupKey; FOUNDATION_EXPORT NSString *const kHideMenuBarIconKey; -FOUNDATION_EXPORT NSString *const kEnableBetaNewApp; +FOUNDATION_EXPORT NSString *const kEnableBetaNewAppKey; static NSString *const EZQuickLinkButtonUpdateNotification = @"EZQuickLinkButtonUpdateNotification"; diff --git a/Easydict/Feature/Configuration/EZConfiguration.m b/Easydict/Feature/Configuration/EZConfiguration.m index f30aa2ecb..01042f008 100644 --- a/Easydict/Feature/Configuration/EZConfiguration.m +++ b/Easydict/Feature/Configuration/EZConfiguration.m @@ -31,8 +31,6 @@ static NSString *const kForceAutoGetSelectedText = @"EZConfiguration_kForceAutoGetSelectedText"; static NSString *const kDisableEmptyCopyBeepKey = @"EZConfiguration_kDisableEmptyCopyBeepKey"; static NSString *const kClickQueryKey = @"EZConfiguration_kClickQueryKey"; -static NSString *const kLaunchAtStartupKey = @"EZConfiguration_kLaunchAtStartupKey"; -static NSString *const kHideMainWindowKey = @"EZConfiguration_kHideMainWindowKey"; static NSString *const kAutoQueryOCTTextKey = @"EZConfiguration_kAutoQueryOCTTextKey"; static NSString *const kAutoQuerySelectedTextKey = @"EZConfiguration_kAutoQuerySelectedTextKey"; static NSString *const kAutoQueryPastedTextKey = @"EZConfiguration_kAutoQueryPastedTextKey"; @@ -45,8 +43,6 @@ static NSString *const kShowGoogleLinkKey = @"EZConfiguration_kShowGoogleLinkKey"; static NSString *const kShowEudicLinkKey = @"EZConfiguration_kShowEudicLinkKey"; static NSString *const kShowAppleDictionaryLinkKey = @"EZConfiguration_kShowAppleDictionaryLinkKey"; -NSString *const kHideMenuBarIconKey = @"EZConfiguration_kHideMenuBarIconKey"; -NSString *const kEnableBetaNewApp = @"EZConfiguration_kEnableBetaNewApp"; static NSString *const kShowFixedWindowPositionKey = @"EZConfiguration_kShowFixedWindowPositionKey"; static NSString *const kShortcutSelectTranslateWindowTypeKey = @"EZConfiguration_kShortcutSelectTranslateWindowTypeKey"; static NSString *const kMouseSelectTranslateWindowTypeKey = @"EZConfiguration_kMouseSelectTranslateWindowTypeKey"; @@ -57,6 +53,10 @@ static NSString *const kClearInputKey = @"EZConfiguration_kClearInputKey"; static NSString *const kTranslationControllerFontKey = @"EZConfiguration_kTranslationControllerFontKey"; +NSString *const kHideMainWindowKey = @"EZConfiguration_kHideMainWindowKey"; +NSString *const kLaunchAtStartupKey = @"EZConfiguration_kLaunchAtStartupKey"; +NSString *const kHideMenuBarIconKey = @"EZConfiguration_kHideMenuBarIconKey"; +NSString *const kEnableBetaNewAppKey = @"EZConfiguration_kEnableBetaNewAppKey"; @interface EZConfiguration () @@ -367,7 +367,7 @@ - (void)setHideMenuBarIcon:(BOOL)hideMenuBarIcon { - (void)setEnableBetaNewApp:(BOOL)enableBetaNewApp { _enableBetaNewApp = enableBetaNewApp; - [NSUserDefaults mm_write:@(enableBetaNewApp) forKey:kEnableBetaNewApp]; + [NSUserDefaults mm_write:@(enableBetaNewApp) forKey:kEnableBetaNewAppKey]; [self logSettings:@{@"enable_beta_new_app" : @(enableBetaNewApp)}]; } diff --git a/Easydict/NewApp/NewAppManager.swift b/Easydict/NewApp/NewAppManager.swift index 38af57ccf..8b3d9a8dc 100644 --- a/Easydict/NewApp/NewAppManager.swift +++ b/Easydict/NewApp/NewAppManager.swift @@ -15,7 +15,7 @@ public final class NewAppManager: NSObject { override private init() { super.init() } - private static var enableKey: String { kEnableBetaNewApp } + private static var enableKey: String { kEnableBetaNewAppKey } /// 新的 MenuBarExtra 对齐 EZStatusItem & 可以放弃 macOS 13- 支持后全量 @objc diff --git a/Easydict/NewApp/View/SettingView/SettingView.swift b/Easydict/NewApp/View/SettingView/SettingView.swift index 1e59b1bab..2e5da7bf3 100644 --- a/Easydict/NewApp/View/SettingView/SettingView.swift +++ b/Easydict/NewApp/View/SettingView/SettingView.swift @@ -12,6 +12,9 @@ import SwiftUI struct SettingView: View { var body: some View { TabView { + GeneralTab() + .tabItem { Label("setting_general", systemImage: "gear") } + .frame(width: 500, height: 400) PrivacyTab() .tabItem { Label("privacy", systemImage: "hand.raised.square") } .frame(width: 500, height: 400) diff --git a/Easydict/NewApp/View/SettingView/Tabs/GeneralTab.swift b/Easydict/NewApp/View/SettingView/Tabs/GeneralTab.swift new file mode 100644 index 000000000..e9368eaea --- /dev/null +++ b/Easydict/NewApp/View/SettingView/Tabs/GeneralTab.swift @@ -0,0 +1,56 @@ +// +// GeneralTab.swift +// Easydict +// +// Created by Kyle on 2023/12/29. +// Copyright © 2023 izual. All rights reserved. +// + +import SwiftUI + +@available(macOS 13, *) +struct GeneralTab: View { + var body: some View { + Form { + Section { + HStack { + Text("show_main_window") + Toggle(isOn: $hideMainWindow) { + Text("hide_main_window") + } + } + HStack { + Text("launch") + Toggle(isOn: $launchAtStartup) { + Text("launch_at_startup") + } + } + HStack { + Text("menu_bar_icon") + Toggle(isOn: $hideMenuBarIcon) { + Text("hide_menu_bar_icon") + } + } + HStack { + Text("beta_new_app") + Toggle(isOn: $enableBetaNewApp) { + Text("enable_beta_new_app") + } + } + } header: { + Text("other") + } + } + .formStyle(.grouped) + } + + @AppStorage(kHideMainWindowKey) private var hideMainWindow = false + @AppStorage(kLaunchAtStartupKey) private var launchAtStartup = false + @AppStorage(kHideMenuBarIconKey) private var hideMenuBarIcon = false + @AppStorage(kEnableBetaNewAppKey) private var enableBetaNewApp = false +} + +@available(macOS 13, *) +#Preview { + GeneralTab() +}