Skip to content

Commit

Permalink
[IMP] Mode naming coherence
Browse files Browse the repository at this point in the history
  • Loading branch information
Pyroh committed May 6, 2020
1 parent 2aae5be commit 8589c49
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 34 deletions.
8 changes: 4 additions & 4 deletions Fluor/Controllers/BehaviorController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ class BehaviorController: NSObject, BehaviorDidChangeObserver, DefaultModeViewCo
private var fnDownTimestamp: TimeInterval? = nil
private var shouldHandleFNKey: Bool = false

private var currentMode: FKeyMode = .apple
private var onLaunchKeyboardMode: FKeyMode = .apple
private var currentMode: FKeyMode = .media
private var onLaunchKeyboardMode: FKeyMode = .media
private var currentAppID: String = ""
private var currentAppURL: URL?
private var currentAppName: String?
Expand Down Expand Up @@ -212,10 +212,10 @@ class BehaviorController: NSObject, BehaviorDidChangeObserver, DefaultModeViewCo
catch { AppErrorManager.terminateApp(withReason: error.localizedDescription) }

switch mode {
case .apple:
case .media:
os_log("Switch to Apple Mode for %@", self.currentAppID)
self.statusMenuController.statusItem.image = AppManager.default.useLightIcon ? #imageLiteral(resourceName: "AppleMode") : #imageLiteral(resourceName: "IconAppleMode")
case .other:
case .function:
NSLog("Switch to Other Mode for %@", self.currentAppID)
self.statusMenuController.statusItem.image = AppManager.default.useLightIcon ? #imageLiteral(resourceName: "OtherMode") : #imageLiteral(resourceName: "IconOtherMode")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ class RulesEditorViewController: NSViewController, BehaviorDidChangeObserver {
let bundle = Bundle(url: url)!
let id = bundle.bundleIdentifier!

AppManager.default.propagate(behavior: .apple, forApp: id, at: url, from: .rule)
return Rule(id: id, url: url, behavior: .apple)
AppManager.default.propagate(behavior: .media, forApp: id, at: url, from: .rule)
return Rule(id: id, url: url, behavior: .media)
}
rulesSet.formUnion(items)
}
Expand Down
12 changes: 6 additions & 6 deletions Fluor/Models/AppManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class AppManager: BehaviorDidChangePoster {
/// The defaut behavior manager.
static let `default`: AppManager = AppManager()

@Defaults(key: .keyboardMode, defaultValue: .apple)
@Defaults(key: .keyboardMode, defaultValue: .media)
var defaultFKeyMode: FKeyMode

@Defaults(key: .switchMethod, defaultValue: .window)
Expand All @@ -75,7 +75,7 @@ class AppManager: BehaviorDidChangePoster {
@Defaults(key: .restoreStateAsBeforeStartup, defaultValue: false)
var shouldRestorePreviousState: Bool

@Defaults(key: .onQuitState, defaultValue: .apple)
@Defaults(key: .onQuitState, defaultValue: .media)
var onQuitState: FKeyMode

@Defaults(key: .disabledOnLunch, defaultValue: false)
Expand Down Expand Up @@ -176,10 +176,10 @@ class AppManager: BehaviorDidChangePoster {
switch behavior {
case .inferred:
return self.defaultFKeyMode
case .apple:
return .apple
case .other:
return .other
case .media:
return .media
case .function:
return .function
}
}

Expand Down
44 changes: 22 additions & 22 deletions Fluor/Models/Enums.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,46 +29,46 @@
import DefaultsWrapper

@objc enum FKeyMode: Int {
case apple = 0
case other
case media = 0
case function

var behavior: AppBehavior {
switch self {
case .apple:
return .apple
case .other:
return .other
case .media:
return .media
case .function:
return .function
}
}

var counterPart: FKeyMode {
switch self {
case .apple: return .other
case .other: return .apple
case .media: return .function
case .function: return .media
}
}

var label: String {
switch self {
case .apple:
return NSLocalizedString("Media keys", comment: "")
case .other:
return NSLocalizedString("Function keys", comment: "")
case .media:
return NSLocalizedString("Media key", comment: "")
case .function:
return NSLocalizedString("Function key", comment: "")
}
}
}

@objc enum AppBehavior: Int {
case inferred = 0
case apple
case other
case media
case function

var counterPart: AppBehavior {
switch self {
case .apple:
return .other
case .other:
return .apple
case .media:
return .function
case .function:
return .media
default:
return .inferred
}
Expand All @@ -78,10 +78,10 @@ import DefaultsWrapper
switch self {
case .inferred:
return NSLocalizedString("Same as default", comment: "")
case .apple:
return NSLocalizedString("Media keys", comment: "")
case .other:
return NSLocalizedString("Function keys", comment: "")
case .media:
return NSLocalizedString("Media key", comment: "")
case .function:
return NSLocalizedString("Function key", comment: "")
}
}
}
Expand Down
Binary file modified Fluor/en.lproj/Localizable.strings
Binary file not shown.

0 comments on commit 8589c49

Please sign in to comment.