From 421d16ce10de2da06e35fa86985dcf13071322c6 Mon Sep 17 00:00:00 2001 From: qwertyyb Date: Sat, 26 Oct 2019 20:57:16 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=A7=BB=E9=99=A4=E6=97=A0=E7=94=A8?= =?UTF-8?q?=E7=9A=84=E7=B1=BB=E5=9E=8B=E5=AD=97=E6=AE=B5(=E6=9A=82?= =?UTF-8?q?=E6=97=B6=E4=B8=8D=E8=80=83=E8=99=91=E9=99=A4=E6=96=87=E5=AD=97?= =?UTF-8?q?=E4=B9=8B=E5=A4=96=E7=9A=84=E7=B1=BB=E5=9E=8B=E6=94=AF=E6=8C=81?= =?UTF-8?q?),=20=E6=94=B9=E4=B8=BA=E6=97=B6=E9=97=B4=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- YPaste.xcodeproj/project.pbxproj | 8 ++--- YPaste/AppDelegate.swift | 3 ++ YPaste/Base.lproj/Main.storyboard | 24 ++++++++------ YPaste/Info.plist | 2 +- YPaste/SummaryTransformer.swift | 23 ------------- YPaste/Window/Transformers.swift | 53 ++++++++++++++++++++++++++++++ YPaste/Window/ViewController.swift | 1 - 7 files changed, 75 insertions(+), 39 deletions(-) delete mode 100644 YPaste/SummaryTransformer.swift create mode 100644 YPaste/Window/Transformers.swift diff --git a/YPaste.xcodeproj/project.pbxproj b/YPaste.xcodeproj/project.pbxproj index 22701e3..965c5c1 100644 --- a/YPaste.xcodeproj/project.pbxproj +++ b/YPaste.xcodeproj/project.pbxproj @@ -15,7 +15,7 @@ 4596AE6123216A8500F63EBF /* YPaste.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4596AE6023216A8500F63EBF /* YPaste.swift */; }; 4596AE6923216E6C00F63EBF /* YPasteTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4596AE6823216E6C00F63EBF /* YPasteTests.swift */; }; 4596AE712322B5CB00F63EBF /* MainWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4596AE702322B5CB00F63EBF /* MainWindowController.swift */; }; - 4596AE732323CF5800F63EBF /* SummaryTransformer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4596AE722323CF5800F63EBF /* SummaryTransformer.swift */; }; + 4596AE732323CF5800F63EBF /* Transformers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4596AE722323CF5800F63EBF /* Transformers.swift */; }; 67096210235EC02E009068B9 /* TableView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6709620F235EC02E009068B9 /* TableView.swift */; }; 67096213235EC0D7009068B9 /* SearchField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 67096212235EC0D7009068B9 /* SearchField.swift */; }; 67136E302359E04F00EFB448 /* Preferences.xib in Resources */ = {isa = PBXBuildFile; fileRef = 67136E322359E04F00EFB448 /* Preferences.xib */; }; @@ -53,7 +53,7 @@ 4596AE6823216E6C00F63EBF /* YPasteTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YPasteTests.swift; sourceTree = ""; }; 4596AE6A23216E6C00F63EBF /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 4596AE702322B5CB00F63EBF /* MainWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainWindowController.swift; sourceTree = ""; }; - 4596AE722323CF5800F63EBF /* SummaryTransformer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SummaryTransformer.swift; sourceTree = ""; }; + 4596AE722323CF5800F63EBF /* Transformers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Transformers.swift; sourceTree = ""; }; 5798607827522D99BA309E4B /* libPods-YPaste.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-YPaste.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 6709620F235EC02E009068B9 /* TableView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TableView.swift; sourceTree = ""; }; 67096212235EC0D7009068B9 /* SearchField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchField.swift; sourceTree = ""; }; @@ -136,7 +136,6 @@ 4596AE53232025A800F63EBF /* Info.plist */, 4596AE54232025A800F63EBF /* YPaste.entitlements */, 4596AE4B232025A700F63EBF /* YPaste.xcdatamodeld */, - 4596AE722323CF5800F63EBF /* SummaryTransformer.swift */, 67136E322359E04F00EFB448 /* Preferences.xib */, 67C3262B2359D86300248CDE /* PreferencesWindowController.swift */, 67784475235F376800970786 /* PasteboardHandler.swift */, @@ -163,6 +162,7 @@ 4596AE49232025A700F63EBF /* ViewController.swift */, 6790407F235D8C1D00B0C74E /* PasteItemsController.swift */, 4596AE702322B5CB00F63EBF /* MainWindowController.swift */, + 4596AE722323CF5800F63EBF /* Transformers.swift */, ); path = Window; sourceTree = ""; @@ -377,7 +377,7 @@ 4596AE4D232025A700F63EBF /* YPaste.xcdatamodeld in Sources */, 4596AE6123216A8500F63EBF /* YPaste.swift in Sources */, 67096213235EC0D7009068B9 /* SearchField.swift in Sources */, - 4596AE732323CF5800F63EBF /* SummaryTransformer.swift in Sources */, + 4596AE732323CF5800F63EBF /* Transformers.swift in Sources */, 67446E7A235F3EAE0050AB96 /* HotkeyHandler.swift in Sources */, 4596AE4A232025A700F63EBF /* ViewController.swift in Sources */, 4596AE48232025A700F63EBF /* AppDelegate.swift in Sources */, diff --git a/YPaste/AppDelegate.swift b/YPaste/AppDelegate.swift index 6914ee3..7051ddd 100644 --- a/YPaste/AppDelegate.swift +++ b/YPaste/AppDelegate.swift @@ -21,6 +21,9 @@ class AppDelegate: NSObject, NSApplicationDelegate { statusItem?.button!.image = NSImage(named: "statusImage") statusItem?.menu = menu + ValueTransformer.setValueTransformer(SummaryTransformer(), forName: .summaryTransformerName) + ValueTransformer.setValueTransformer(TimeTransformer(), forName: .timeTransformerName) + // check permission let _ = PasteboardHandler.shared.checkAccess(prompt: true) diff --git a/YPaste/Base.lproj/Main.storyboard b/YPaste/Base.lproj/Main.storyboard index 501cb75..2a277f4 100644 --- a/YPaste/Base.lproj/Main.storyboard +++ b/YPaste/Base.lproj/Main.storyboard @@ -1,8 +1,8 @@ - + - + @@ -114,8 +114,8 @@ - - + + @@ -168,7 +168,7 @@ - + @@ -182,17 +182,21 @@ - + - - + + - + + + TimeTransformer + + @@ -219,7 +223,7 @@ -