KMBatchOperateBaseWindowController.swift 4.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. //
  2. // KMBatchOperateBaseWindowController.swift
  3. // PDF Reader Pro
  4. //
  5. // Created by kdanmobile on 2023/10/26.
  6. //
  7. import Cocoa
  8. @objcMembers class KMBatchOperateBaseWindowController: NSWindowController{
  9. var files: [KMBatchOperateFile]?
  10. var operateType: KMBatchOperationType?{
  11. willSet{
  12. }
  13. didSet {
  14. switch operateType {
  15. case .Convert:
  16. self.window!.title = NSLocalizedString("Convert", comment: "")
  17. case .Merge:
  18. self.window!.title = NSLocalizedString("Merge", comment: "")
  19. case .Compress:
  20. self.window!.title = NSLocalizedString("Compress", comment: "")
  21. case .AddPassword:
  22. self.window!.title = NSLocalizedString("Set Passwords", comment: "")
  23. case .RemovePassword:
  24. self.window!.title = NSLocalizedString("Remove Security", comment: "")
  25. case .AddWatermark:
  26. self.window!.title = NSLocalizedString("Add Watermark", comment: "")
  27. case .RemoveWatermark:
  28. self.window!.title = NSLocalizedString("Remove Watermark", comment: "")
  29. case .AddBackground:
  30. self.window!.title = NSLocalizedString("Add Background", comment: "")
  31. case .RemoveBackground:
  32. self.window!.title = NSLocalizedString("Remove Background", comment: "")
  33. case .AddHeaderFooter:
  34. self.window!.title = NSLocalizedString("Add Header & Footer", comment: "")
  35. case .RemoveHeaderFooter:
  36. self.window!.title = NSLocalizedString("Remove Header & Footer", comment: "")
  37. case .AddBates:
  38. self.window!.title = NSLocalizedString("Add Bates Numbers", comment: "")
  39. case .RemoveBates:
  40. self.window!.title = NSLocalizedString("Remove Bates Numbers", comment: "")
  41. case .CreatePDF:
  42. self.window!.title = NSLocalizedString("Image To PDF", comment: "")
  43. case .OCR:
  44. self.window!.title = NSLocalizedString("OCR", comment: "")
  45. default :
  46. self.window!.title = NSLocalizedString("Convert", comment: "")
  47. }
  48. }
  49. }
  50. override func windowDidLoad() {
  51. super.windowDidLoad()
  52. self.configuUI()
  53. files = NSMutableArray() as? [KMBatchOperateFile]
  54. }
  55. func configuUI() {
  56. let splitViewController = KMBatchOperateSplitViewController(nibName: "KMBatchOperateSplitViewController", bundle: nil)
  57. contentViewController = splitViewController
  58. }
  59. func switchToOperateType(_ operateType: KMBatchOperationType, files: [KMBatchOperateFile]) {
  60. self.files = files
  61. (self.contentViewController as? KMBatchOperateSplitViewController)?.switchToOperateType(operateType: operateType, files: files)
  62. self.operateType = operateType
  63. }
  64. func checkNeedPasswordSwitchToOperateType(operateType: KMBatchOperationType, files: [KMBatchOperateFile]) {
  65. self.files = files
  66. (self.contentViewController as! KMBatchOperateSplitViewController).checkNeedPasswordSwitchToOperateType(operateType, files: files)
  67. self.operateType = operateType
  68. }
  69. func switchToConvertType(convertType: KMConvertWithPDFType) {
  70. (self.contentViewController as! KMBatchOperateSplitViewController).switchToConvertType(convertType)
  71. }
  72. func watermarkInterfaceSelectWatermark(watermark: KMWatermarkModel) {
  73. (self.contentViewController as! KMBatchOperateSplitViewController).watermarkInterfaceSelectWatermark(watermark)
  74. }
  75. func backgroundInterfaceSelectBackGround(background: KMBackgroundModel) {
  76. (self.contentViewController as! KMBatchOperateSplitViewController).backgroundInterfaceSelectBackground(background)
  77. }
  78. func headerFooterInterfaceSelectHeaderFooter(headerFooter: KMHeaderFooterObject) {
  79. (self.contentViewController as! KMBatchOperateSplitViewController).headerFooterInterfaceSelectHeaderFooter(headerFooter)
  80. }
  81. func batesInterfaceSelectBates(headerFooter: KMHeaderFooterObject) {
  82. (self.contentViewController as! KMBatchOperateSplitViewController).headerFooterInterfaceSelectHeaderFooter(headerFooter)
  83. }
  84. }