36 lines
1.3 KiB
Swift
36 lines
1.3 KiB
Swift
import Foundation
|
|
import Cocoa
|
|
|
|
class InfoViewController: NSViewController {
|
|
var document: Document?
|
|
|
|
@IBOutlet weak var nameLabel: NSTextField!
|
|
@IBOutlet weak var authorNameField: NSTextField!
|
|
@IBOutlet weak var timeSpentLabel: NSTextField!
|
|
@IBOutlet weak var strokeCountField: NSTextField!
|
|
@IBOutlet weak var layerCountLabel: NSTextField!
|
|
|
|
override func viewWillAppear() {
|
|
super.viewDidAppear()
|
|
|
|
nameLabel.stringValue = "Name: " + document!.info.name
|
|
|
|
if document!.info.authorName.isEmpty {
|
|
authorNameField.stringValue = "Author name is not set."
|
|
} else {
|
|
authorNameField.stringValue = "Author name: " + document!.info.authorName
|
|
}
|
|
|
|
strokeCountField.stringValue = "Number of strokes: " + String(document!.info.strokeCount)
|
|
|
|
let formatter = DateComponentsFormatter()
|
|
formatter.allowedUnits = [.hour, .minute, .second]
|
|
formatter.unitsStyle = .full
|
|
|
|
let formattedString = formatter.string(from: TimeInterval(document!.info.trackedTime))!
|
|
|
|
timeSpentLabel.stringValue = "Time spent: " + formattedString
|
|
|
|
layerCountLabel.stringValue = "Number of layers: " + String(document!.info.layers.count)
|
|
}
|
|
}
|