AboutWindow adjustments
Allow opening links in default browser Close window on Esc Add rounded cornerslastfm
parent
05eb1c38a0
commit
43467b6978
|
@ -8,7 +8,7 @@
|
||||||
import Cocoa
|
import Cocoa
|
||||||
import WebKit
|
import WebKit
|
||||||
|
|
||||||
class AboutWindowController: NSWindowController {
|
class AboutWindowController: NSWindowController, WKNavigationDelegate {
|
||||||
|
|
||||||
@IBOutlet weak var appName: NSTextField!
|
@IBOutlet weak var appName: NSTextField!
|
||||||
@IBOutlet weak var appVersion: NSTextField!
|
@IBOutlet weak var appVersion: NSTextField!
|
||||||
|
@ -30,6 +30,8 @@ class AboutWindowController: NSWindowController {
|
||||||
|
|
||||||
creditsView.setValue(false, forKey: "drawsBackground")
|
creditsView.setValue(false, forKey: "drawsBackground")
|
||||||
|
|
||||||
|
vfxView.wantsLayer = true
|
||||||
|
vfxView.layer?.cornerRadius = 4
|
||||||
|
|
||||||
// fill up labels
|
// fill up labels
|
||||||
|
|
||||||
|
@ -49,6 +51,21 @@ class AboutWindowController: NSWindowController {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
creditsView.navigationDelegate = self
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {
|
||||||
|
if navigationAction.navigationType == .linkActivated,
|
||||||
|
let url = navigationAction.request.url {
|
||||||
|
NSWorkspace.shared.open(url)
|
||||||
|
decisionHandler(.cancel)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
decisionHandler(.allow)
|
||||||
|
}
|
||||||
|
|
||||||
|
@objc func cancel(_ sender: Any?) {
|
||||||
|
close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue