2022-06-21 01:58:22 +00:00
|
|
|
//
|
|
|
|
// AboutWIndowController.swift
|
|
|
|
// Cog
|
|
|
|
//
|
|
|
|
// Created by Kevin López Brante on 20-06-22.
|
|
|
|
//
|
|
|
|
|
|
|
|
import Cocoa
|
2022-06-22 02:17:03 +00:00
|
|
|
import WebKit
|
2022-06-21 01:58:22 +00:00
|
|
|
|
|
|
|
class AboutWindowController: NSWindowController {
|
|
|
|
|
|
|
|
@IBOutlet weak var appName: NSTextField!
|
|
|
|
@IBOutlet weak var appVersion: NSTextField!
|
|
|
|
@IBOutlet weak var appCopyright: NSTextField!
|
|
|
|
|
2022-06-22 02:17:03 +00:00
|
|
|
@IBOutlet weak var creditsView: WKWebView!
|
2022-06-21 01:58:22 +00:00
|
|
|
|
|
|
|
override var windowNibName: NSNib.Name? {
|
|
|
|
return "AboutWindowController"
|
|
|
|
}
|
|
|
|
|
|
|
|
@IBOutlet weak var vfxView: NSVisualEffectView!
|
|
|
|
|
|
|
|
override func windowDidLoad() {
|
|
|
|
super.windowDidLoad()
|
|
|
|
|
|
|
|
self.window?.center()
|
|
|
|
self.window?.isMovableByWindowBackground = true
|
|
|
|
|
2022-06-22 02:17:03 +00:00
|
|
|
creditsView.setValue(false, forKey: "drawsBackground")
|
|
|
|
|
2022-06-21 01:58:22 +00:00
|
|
|
|
|
|
|
// fill up labels
|
|
|
|
|
|
|
|
appName.stringValue = Bundle.main.object(forInfoDictionaryKey: "CFBundleName") as! String
|
|
|
|
|
|
|
|
let shortVersionString = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as! String
|
2022-06-21 13:27:29 +00:00
|
|
|
let fullVersionString = Bundle.main.object(forInfoDictionaryKey: "GitVersion") as! String
|
2022-06-21 01:58:22 +00:00
|
|
|
|
|
|
|
appVersion.stringValue = String.localizedStringWithFormat( NSLocalizedString("Version %@ (%@)", comment: "Version string"), shortVersionString, fullVersionString);
|
|
|
|
|
|
|
|
appCopyright.stringValue = Bundle.main.object(forInfoDictionaryKey: "NSHumanReadableCopyright") as! String
|
|
|
|
|
|
|
|
if let creditsFile = Bundle.main.url(forResource: "Credits", withExtension: "html") {
|
|
|
|
let data = try! Data(contentsOf: creditsFile)
|
|
|
|
|
2022-06-22 02:17:03 +00:00
|
|
|
creditsView.loadHTMLString(String(data: data, encoding: .utf8) ?? "Could not load credits.", baseURL: nil)
|
|
|
|
|
2022-06-21 01:58:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|