forked from glushchenko/fsnotes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAboutViewController.swift
More file actions
77 lines (66 loc) · 2.47 KB
/
Copy pathAboutViewController.swift
File metadata and controls
77 lines (66 loc) · 2.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
//
// AboutViewController.swift
// FSNotes
//
// Created by Олександр Глущенко on 5/10/19.
// Copyright © 2019 Oleksandr Glushchenko. All rights reserved.
//
import Cocoa
class AboutViewController: NSViewController, NSTableViewDataSource, NSTableViewDelegate {
@IBOutlet weak var translatorsList: NSTableView!
private var languages = [
"Deutsch 🇩🇪",
"Ukrainian🇺🇦",
"Spanish 🇪🇸",
"Arabic 🇮🇶",
"Chinese 🇨🇳",
"Korean 🇰🇷",
"French 🇫🇷",
"Dutch 🇳🇱",
"Portuguese 🇵🇹",
"Italian 🇮🇹",
"Hebrew 🇮🇱",
"Chinese 🇨🇳",
]
private var authors = [
"Michael Barzmann",
"Olena Hlushchenko ♥️",
"aonez (aone@keka.io)",
"Ayad (@ayad0net)",
"Pertim (macwk.com@gmail.com)",
"Wonsup Yoon (pusnow@kaist.ac.kr)",
"Simon Jornet (github.com/jornetsimon)",
"Chris Hendriks (github.com/olikilo)",
"reddit.com/user/endallbeallknowitall",
"Leonardo Bartoletti - leodmc88@gmail.com",
"Will Pazner (github.com/pazner)",
"Holton Jiang (github.com/holton-jiang)"
]
override func viewDidLoad() {
if let dictionary = Bundle.main.infoDictionary,
let ver = dictionary["CFBundleShortVersionString"] as? String,
let build = dictionary["CFBundleVersion"] as? String {
versionLabel.stringValue = "Version \(ver) (\(build))"
versionLabel.isSelectable = true
}
translatorsList.delegate = self
translatorsList.dataSource = self
}
@IBOutlet weak var versionLabel: NSTextField!
@IBAction func openContributorsPage(_ sender: Any) {
let url = URL(string: "https://github.com/glushchenko/fsnotes/graphs/contributors")!
NSWorkspace.shared.open(url)
}
func numberOfRows(in tableView: NSTableView) -> Int {
return languages.count
}
func tableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) -> NSView? {
let result = tableView.makeView(withIdentifier: (tableColumn?.identifier)!, owner: self) as! NSTableCellView
if tableColumn?.identifier.rawValue == "table.about.0" {
result.textField?.stringValue = languages[row]
} else {
result.textField?.stringValue = authors[row]
}
return result
}
}