|
|
@ -20,6 +20,8 @@ class PanelController: ParentPanelController { |
|
|
|
override func awakeFromNib() { |
|
|
|
override func awakeFromNib() { |
|
|
|
super.awakeFromNib() |
|
|
|
super.awakeFromNib() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
enablePerformanceLoggingIfNeccessary() |
|
|
|
|
|
|
|
|
|
|
|
window?.title = "Clocker Panel" |
|
|
|
window?.title = "Clocker Panel" |
|
|
|
window?.setAccessibilityIdentifier("Clocker Panel") |
|
|
|
window?.setAccessibilityIdentifier("Clocker Panel") |
|
|
|
|
|
|
|
|
|
|
@ -39,6 +41,14 @@ class PanelController: ParentPanelController { |
|
|
|
super.updateDefaultPreferences() |
|
|
|
super.updateDefaultPreferences() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private func enablePerformanceLoggingIfNeccessary() { |
|
|
|
|
|
|
|
if !ProcessInfo.processInfo.environment.keys.contains("ENABLE_PERF_LOGGING") { |
|
|
|
|
|
|
|
if #available(OSX 10.14, *) { |
|
|
|
|
|
|
|
PerfLogger.disable() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@objc override func updateDefaultPreferences() { |
|
|
|
@objc override func updateDefaultPreferences() { |
|
|
|
super.updateDefaultPreferences() |
|
|
|
super.updateDefaultPreferences() |
|
|
|
} |
|
|
|
} |
|
|
@ -62,7 +72,7 @@ class PanelController: ParentPanelController { |
|
|
|
|
|
|
|
|
|
|
|
func open() { |
|
|
|
func open() { |
|
|
|
if #available(OSX 10.14, *) { |
|
|
|
if #available(OSX 10.14, *) { |
|
|
|
PerfLogger.signpostBegin() |
|
|
|
PerfLogger.startMarker("Open") |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
guard isWindowLoaded == true else { |
|
|
|
guard isWindowLoaded == true else { |
|
|
@ -100,13 +110,17 @@ class PanelController: ParentPanelController { |
|
|
|
log() |
|
|
|
log() |
|
|
|
|
|
|
|
|
|
|
|
if #available(OSX 10.14, *) { |
|
|
|
if #available(OSX 10.14, *) { |
|
|
|
PerfLogger.signpostEnd() |
|
|
|
PerfLogger.endMarker("Open") |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// New way to set the panel's frame. |
|
|
|
// New way to set the panel's frame. |
|
|
|
// This takes into account the screen's dimensions. |
|
|
|
// This takes into account the screen's dimensions. |
|
|
|
private func setPanelFrame() { |
|
|
|
private func setPanelFrame() { |
|
|
|
|
|
|
|
if #available(OSX 10.14, *) { |
|
|
|
|
|
|
|
PerfLogger.startMarker("Set Panel Frame") |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
guard let appDelegate = NSApplication.shared.delegate as? AppDelegate else { |
|
|
|
guard let appDelegate = NSApplication.shared.delegate as? AppDelegate else { |
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
@ -139,10 +153,17 @@ class PanelController: ParentPanelController { |
|
|
|
statusItemFrame.origin.y = minY |
|
|
|
statusItemFrame.origin.y = minY |
|
|
|
|
|
|
|
|
|
|
|
setFrameTheNewWay(statusItemFrame, screenMaxX) |
|
|
|
setFrameTheNewWay(statusItemFrame, screenMaxX) |
|
|
|
|
|
|
|
if #available(OSX 10.14, *) { |
|
|
|
|
|
|
|
PerfLogger.endMarker("Set Panel Frame") |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private func log() { |
|
|
|
private func log() { |
|
|
|
|
|
|
|
if #available(OSX 10.14, *) { |
|
|
|
|
|
|
|
PerfLogger.startMarker("Logging") |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
let preferences = DataStore.shared().timezones() |
|
|
|
let preferences = DataStore.shared().timezones() |
|
|
|
|
|
|
|
|
|
|
|
guard let theme = DataStore.shared().retrieve(key: CLThemeKey) as? NSNumber, |
|
|
|
guard let theme = DataStore.shared().retrieve(key: CLThemeKey) as? NSNumber, |
|
|
@ -186,17 +207,34 @@ class PanelController: ParentPanelController { |
|
|
|
] |
|
|
|
] |
|
|
|
|
|
|
|
|
|
|
|
Logger.log(object: panelEvent, for: "openedPanel") |
|
|
|
Logger.log(object: panelEvent, for: "openedPanel") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if #available(OSX 10.14, *) { |
|
|
|
|
|
|
|
PerfLogger.endMarker("Logging") |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private func startWindowTimer() { |
|
|
|
private func startWindowTimer() { |
|
|
|
|
|
|
|
if #available(OSX 10.14, *) { |
|
|
|
|
|
|
|
PerfLogger.startMarker("Start Window Timer") |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
stopMenubarTimerIfNeccesary() |
|
|
|
stopMenubarTimerIfNeccesary() |
|
|
|
|
|
|
|
|
|
|
|
if let timer = parentTimer, timer.state == .paused { |
|
|
|
if let timer = parentTimer, timer.state == .paused { |
|
|
|
parentTimer?.start() |
|
|
|
parentTimer?.start() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if #available(OSX 10.14, *) { |
|
|
|
|
|
|
|
PerfLogger.endMarker("Start Window Timer") |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
startTimer() |
|
|
|
startTimer() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if #available(OSX 10.14, *) { |
|
|
|
|
|
|
|
PerfLogger.endMarker("Start Window Timer") |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private func startTimer() { |
|
|
|
private func startTimer() { |
|
|
|