Skip to content

Commit

Permalink
Fix tool tips (#500)
Browse files Browse the repository at this point in the history
* fix: title bar tooptip

* feat: add update tool tips status when change shortcut

* pref: pref UI when shortcut is empty

* Update Easydict/objc/ViewController/Window/WindowManager/EZWindowManager.m

Co-authored-by: Tisfeng <[email protected]>

* Update Easydict/Swift/Feature/Configuration/Configuration+Defaults.swift

Co-authored-by: Phillip Song <[email protected]>

* pref: move same logic into common func

* pref: pref update window title bar code

* perf: improve code, reduce duplicat code

* refactor: change cancellables types from Array to Set

---------

Co-authored-by: Tisfeng <[email protected]>
Co-authored-by: Phillip Song <[email protected]>
  • Loading branch information
3 people authored Apr 11, 2024
1 parent 06929ff commit 84458c0
Show file tree
Hide file tree
Showing 7 changed files with 290 additions and 247 deletions.
23 changes: 23 additions & 0 deletions Easydict/Swift/Feature/Configuration/Configuration+Defaults.swift
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,29 @@ class DefaultsWrapper<T: Defaults.Serializable> {
}
}

// MARK: - ShortcutWrapper

@propertyWrapper
class ShortcutWrapper<T: KeyCombo> {
// MARK: Lifecycle

init(_ key: Defaults.Key<T?>) {
self.key = key
}

// MARK: Internal

let key: Defaults.Key<T?>

var wrappedValue: String {
let keyCombo = Defaults[key]
if let keyCombo, keyCombo.doubledModifiers {
return keyCombo.keyEquivalentModifierMaskString + keyCombo.keyEquivalentModifierMaskString
}
return (keyCombo?.keyEquivalentModifierMaskString ?? "") + (keyCombo?.keyEquivalent ?? "")
}
}

// Service Configuration
extension Defaults.Keys {
// OpenAI
Expand Down
Loading

0 comments on commit 84458c0

Please sign in to comment.