KMBatchOperateBaseWindowController.swift 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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: KMNBaseWindowController{
  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("", comment: "")
  43. default :
  44. self.window!.title = NSLocalizedString("Convert", comment: "")
  45. }
  46. }
  47. }
  48. override func windowDidLoad() {
  49. super.windowDidLoad()
  50. self.configuUI()
  51. files = NSMutableArray() as? [KMBatchOperateFile]
  52. window?.titlebarAppearsTransparent = true
  53. }
  54. override func updateUIThemeColor() {
  55. super.updateUIThemeColor()
  56. KMMainThreadExecute {
  57. self.window?.backgroundColor = KMNColorTools.colorBg_layoutMiddle()
  58. }
  59. }
  60. func configuUI() {
  61. let splitViewController = KMBatchOperateSplitViewController(nibName: "KMBatchOperateSplitViewController", bundle: nil)
  62. contentViewController = splitViewController
  63. }
  64. func switchToOperateType(_ operateType: KMBatchOperationType, files: [KMBatchOperateFile]) {
  65. self.files = files
  66. (self.contentViewController as? KMBatchOperateSplitViewController)?.switchToOperateType(operateType: operateType, files: files)
  67. self.operateType = operateType
  68. }
  69. func checkNeedPasswordSwitchToOperateType(operateType: KMBatchOperationType, files: [KMBatchOperateFile]) {
  70. self.files = files
  71. (self.contentViewController as! KMBatchOperateSplitViewController).checkNeedPasswordSwitchToOperateType(operateType, files: files)
  72. self.operateType = operateType
  73. }
  74. func switchToConvertType(convertType: KMConvertWithPDFType) {
  75. (self.contentViewController as! KMBatchOperateSplitViewController).switchToConvertType(convertType)
  76. }
  77. func backgroundInterfaceSelectBackGround(background: KMBackgroundModel) {
  78. (self.contentViewController as! KMBatchOperateSplitViewController).backgroundInterfaceSelectBackground(background)
  79. }
  80. func headerFooterInterfaceSelectHeaderFooter(headerFooter: KMHeaderFooterModel) {
  81. (self.contentViewController as! KMBatchOperateSplitViewController).headerFooterInterfaceSelectHeaderFooter(headerFooter)
  82. }
  83. func batesInterfaceSelectBates(headerFooter: KMHeaderFooterModel) {
  84. (self.contentViewController as! KMBatchOperateSplitViewController).headerFooterInterfaceSelectHeaderFooter(headerFooter)
  85. }
  86. }