MonitorControl/MonitorControl/UI/Cells/PollingCountCellView.swift
Joni Van Roost dd3d026db3
Add Advanced Preferences panel (#97)
- Removed whitelist which caused some issues for some people #105 
- Added `hide OSD` option to `AdvancedPrefsViewController`
- Added `Longer Delay` option to `AdvancedPrefsViewController`
- Added `PollingMode` and `PollingCount` to `AdvancedPrefsViewController` (should help #37)
- Added option to reset all preferences to `AdvancedPrefsViewController`
See the wiki for more info: https://github.com/the0neyouseek/MonitorControl/wiki/Advanced-Preferences
2019-08-28 12:17:35 +02:00

24 lines
655 B
Swift

import Cocoa
import os.log
class PollingCountCellView: NSTableCellView {
var display: Display?
@IBAction func valueChanged(_ sender: NSTextField) {
if let display = display {
let newValue = sender.stringValue
let originalValue = "\(display.getPollingCount())"
if newValue.isEmpty {
self.textField?.stringValue = originalValue
}
if newValue != originalValue,
!newValue.isEmpty,
let newValue = Int(newValue) {
display.setPollingCount(newValue)
os_log("Value changed for polling count: %{public}@", type: .info, "from `\(originalValue)` to `\(newValue)`")
}
}
}
}