|
|
@ -3,15 +3,13 @@ |
|
|
|
import Cocoa |
|
|
|
import Cocoa |
|
|
|
|
|
|
|
|
|
|
|
struct PreferencesConstants { |
|
|
|
struct PreferencesConstants { |
|
|
|
static let timezoneNameIdentifier = "formattedAddress" |
|
|
|
|
|
|
|
static let customLabelIdentifier = "label" |
|
|
|
|
|
|
|
static let availableTimezoneIdentifier = "availableTimezones" |
|
|
|
|
|
|
|
static let noTimezoneSelectedErrorMessage = "Please select a timezone!" |
|
|
|
static let noTimezoneSelectedErrorMessage = "Please select a timezone!" |
|
|
|
static let maxTimezonesErrorMessage = "Maximum 100 timezones allowed!" |
|
|
|
static let maxTimezonesErrorMessage = "Maximum 100 timezones allowed!" |
|
|
|
static let maxCharactersAllowed = "Only 50 characters allowed!" |
|
|
|
static let maxCharactersAllowed = "Only 50 characters allowed!" |
|
|
|
static let noInternetConnectivityError = "You're offline, maybe?" |
|
|
|
static let noInternetConnectivityError = "You're offline, maybe?" |
|
|
|
static let tryAgainMessage = "Try again, maybe?" |
|
|
|
static let tryAgainMessage = "Try again, maybe?" |
|
|
|
static let offlineErrorMessage = "The Internet connection appears to be offline." |
|
|
|
static let offlineErrorMessage = "The Internet connection appears to be offline." |
|
|
|
|
|
|
|
static let hotKeyPathIdentifier = "values.globalPing" |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
enum RowType { |
|
|
|
enum RowType { |
|
|
@ -299,14 +297,14 @@ class PreferencesViewController: ParentViewController { |
|
|
|
|
|
|
|
|
|
|
|
recorderControl.bind(NSBindingName.value, |
|
|
|
recorderControl.bind(NSBindingName.value, |
|
|
|
to: defaults, |
|
|
|
to: defaults, |
|
|
|
withKeyPath: "values.globalPing", |
|
|
|
withKeyPath: PreferencesConstants.hotKeyPathIdentifier, |
|
|
|
options: nil) |
|
|
|
options: nil) |
|
|
|
|
|
|
|
|
|
|
|
recorderControl.delegate = self |
|
|
|
recorderControl.delegate = self |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
override func observeValue(forKeyPath keyPath: String?, of object: Any?, change _: [NSKeyValueChangeKey: Any]?, context _: UnsafeMutableRawPointer?) { |
|
|
|
override func observeValue(forKeyPath keyPath: String?, of object: Any?, change _: [NSKeyValueChangeKey: Any]?, context _: UnsafeMutableRawPointer?) { |
|
|
|
if let path = keyPath, path == "values.globalPing" { |
|
|
|
if let path = keyPath, path == PreferencesConstants.hotKeyPathIdentifier { |
|
|
|
let hotKeyCenter = PTHotKeyCenter.shared() |
|
|
|
let hotKeyCenter = PTHotKeyCenter.shared() |
|
|
|
let oldHotKey = hotKeyCenter?.hotKey(withIdentifier: path) |
|
|
|
let oldHotKey = hotKeyCenter?.hotKey(withIdentifier: path) |
|
|
|
hotKeyCenter?.unregisterHotKey(oldHotKey) |
|
|
|
hotKeyCenter?.unregisterHotKey(oldHotKey) |
|
|
@ -367,13 +365,11 @@ extension PreferencesViewController: NSTableViewDataSource, NSTableViewDelegate |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func tableView(_: NSTableView, shouldSelectRow row: Int) -> Bool { |
|
|
|
func tableView(_: NSTableView, shouldSelectRow row: Int) -> Bool { |
|
|
|
print("Should Select Row") |
|
|
|
|
|
|
|
let currentRowType = finalArray[row] |
|
|
|
let currentRowType = finalArray[row] |
|
|
|
return !(currentRowType == .timezoneHeader || currentRowType == .cityHeader) |
|
|
|
return !(currentRowType == .timezoneHeader || currentRowType == .cityHeader) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func tableView(_: NSTableView, selectionIndexesForProposedSelection proposedSelectionIndexes: IndexSet) -> IndexSet { |
|
|
|
func tableView(_: NSTableView, selectionIndexesForProposedSelection proposedSelectionIndexes: IndexSet) -> IndexSet { |
|
|
|
// print("Selection Indexes for Proposed Selection: \(proposedSelectionIndexes.first!)") |
|
|
|
|
|
|
|
return proposedSelectionIndexes |
|
|
|
return proposedSelectionIndexes |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|