forked from IngmarStein/Monolingual
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ProgressViewController.swift
57 lines (46 loc) · 1.33 KB
/
ProgressViewController.swift
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
/*
* Copyright (C) 2001, 2002 Joshua Schrier (jschrier@mac.com),
* 2004-2014 Ingmar Stein
*/
import Cocoa
protocol ProgressViewControllerDelegate : class {
func progressViewControllerDidCancel(progressViewController: ProgressViewController)
}
class ProgressViewController : NSViewController {
@IBOutlet weak var progressBar: NSProgressIndicator!
@IBOutlet weak var applicationText: NSTextField!
@IBOutlet weak var fileText: NSTextField!
weak var delegate : ProgressViewControllerDelegate?
var file : String {
get {
return self.fileText.stringValue
}
set {
self.fileText.stringValue = newValue
}
}
var text : String {
get {
return self.applicationText.stringValue
}
set {
self.applicationText.stringValue = newValue
}
}
override func viewDidLoad() {
self.progressBar.usesThreadedAnimation = true
self.applicationText.stringValue = NSLocalizedString("Removing...", comment:"")
self.fileText.stringValue = ""
}
override func viewWillAppear() {
self.progressBar.startAnimation(self)
}
override func viewWillDisappear() {
self.progressBar.stopAnimation(self)
}
@IBAction func cancelButton(sender: AnyObject) {
self.applicationText.stringValue = NSLocalizedString("Canceling operation...", comment:"")
self.fileText.stringValue = ""
self.delegate?.progressViewControllerDidCancel(self)
}
}