Cleanup.
This commit is contained in:
@@ -132,11 +132,7 @@ class CmdViewController: NSViewController {
|
||||
|
||||
private var updateButton: NSButton = {
|
||||
let button = NSButton()
|
||||
button.image = NSImage(systemSymbolName: "arrow.down.circle.fill", accessibilityDescription: nil)?
|
||||
.withSymbolConfiguration(
|
||||
NSImage.SymbolConfiguration(textStyle: .title2, scale: .large)
|
||||
.applying(.init(paletteColors: [.white, .systemGreen]))
|
||||
)
|
||||
button.image = NSImage(systemSymbolName: "arrow.down.circle.fill", accessibilityDescription: nil)?.withSymbolConfiguration(NSImage.SymbolConfiguration(textStyle: .title2, scale: .large) .applying(.init(paletteColors: [.white, .systemGreen])))
|
||||
button.isBordered = false
|
||||
button.action = #selector(updateApp)
|
||||
button.sizeToFit()
|
||||
@@ -327,17 +323,14 @@ class CmdViewController: NSViewController {
|
||||
}
|
||||
|
||||
private func resetReloadButton() {
|
||||
reloadButton.image = systemImage("arrow.clockwise.circle.fill",
|
||||
.title2, .large,
|
||||
.init(paletteColors: [.white,
|
||||
.systemBlue]))
|
||||
reloadButton.image = systemImage("arrow.clockwise.circle.fill", .title2, .large, .init(paletteColors: [.white, .systemBlue]))
|
||||
reloadButton.action = #selector(reloadWidget)
|
||||
reloadButton.toolTip = "Reload Current"
|
||||
}
|
||||
|
||||
private func startReloadTextTimer() {
|
||||
timer = DispatchSource.makeTimerSource(queue: DispatchQueue.global())
|
||||
timer?.schedule(deadline: .now(), repeating: .seconds(1))
|
||||
timer?.schedule(deadline: .now(), repeating: .milliseconds(500))
|
||||
timer?.setEventHandler { [weak self] in
|
||||
DispatchQueue.main.async {
|
||||
guard let controller = self, let file = controller.cmdFile else { return }
|
||||
@@ -349,24 +342,16 @@ class CmdViewController: NSViewController {
|
||||
}
|
||||
|
||||
private func setupKeyEvents() {
|
||||
keyboardEvents = LocalEventMonitor(mask: [.flagsChanged, .keyDown],
|
||||
handler:
|
||||
{ [weak self] event in
|
||||
keyboardEvents = LocalEventMonitor(mask: [.flagsChanged, .keyDown], handler: { [weak self] event in
|
||||
let modifiers = event.modifierFlags.rawValue
|
||||
let key = event.keyCode
|
||||
|
||||
if modsContains(keys: OSShift, in: modifiers) {
|
||||
self?.reloadButton.image =
|
||||
systemImage("arrow.clockwise.circle.fill", .title2,
|
||||
.large,.init(paletteColors: [.white,
|
||||
.systemCyan]))
|
||||
self?.reloadButton.image = systemImage("arrow.clockwise.circle.fill", .title2, .large,.init(paletteColors: [.white, .systemCyan]))
|
||||
self?.reloadButton.action = #selector(self?.reloadWidgets)
|
||||
self?.reloadButton.toolTip = "Reload All"
|
||||
} else {
|
||||
self?.reloadButton.image =
|
||||
systemImage("arrow.clockwise.circle.fill", .title2,
|
||||
.large, .init(paletteColors: [.white,
|
||||
.systemBlue]))
|
||||
self?.reloadButton.image = systemImage("arrow.clockwise.circle.fill", .title2, .large, .init(paletteColors: [.white, .systemBlue]))
|
||||
self?.reloadButton.action = #selector(self?.reloadWidget)
|
||||
self?.reloadButton.toolTip = "Reload Current"
|
||||
}
|
||||
@@ -383,10 +368,8 @@ class CmdViewController: NSViewController {
|
||||
}
|
||||
} else if modsContains(keys: OSCmd | OSShift, in: modifiers) {
|
||||
if key == kVK_ANSI_R {
|
||||
// NOTE: We need to resign the window in order to
|
||||
// prevent the program from intercepting the
|
||||
// events, which result in sounds beign made for
|
||||
// missing performKeyEquivalent.
|
||||
// NOTE: We need to resign the window in order to prevent the program from intercepting the events, which result in sounds
|
||||
// beign made for missing performKeyEquivalent.
|
||||
self?.view.window?.resignKey()
|
||||
self?.reloadWidgets()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user