OSDN Git Service

スクリーンショットをキャッシュするようにした
authormasakih <masakih@users.sourceforge.jp>
Fri, 3 Nov 2017 07:16:16 +0000 (16:16 +0900)
committermasakih <masakih@users.sourceforge.jp>
Fri, 3 Nov 2017 07:16:16 +0000 (16:16 +0900)
KCD/ScreenshotCollectionViewItem.xib
KCD/ScreenshotInformation.swift

index 71641d6..28045b8 100644 (file)
@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11762" systemVersion="16D32" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="13529" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
     <dependencies>
         <deployment identifier="macosx"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11762"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="13529"/>
         <capability name="box content view" minToolsVersion="7.0"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
@@ -53,7 +53,7 @@
                             <rect key="frame" x="1" y="1" width="241" height="15"/>
                             <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                             <subviews>
-                                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Kbm-fL-Jhl">
+                                <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Kbm-fL-Jhl">
                                     <rect key="frame" x="-1" y="-1" width="243" height="17"/>
                                     <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
                                     <textFieldCell key="cell" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Label" usesSingleLineMode="YES" id="oh8-Nq-qD6">
@@ -69,7 +69,7 @@
                         </view>
                         <color key="borderColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
                     </box>
-                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="haC-Q0-wzk">
+                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="haC-Q0-wzk">
                         <rect key="frame" x="3" y="5" width="247" height="14"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
                         <textFieldCell key="cell" controlSize="small" lineBreakMode="truncatingTail" sendsActionOnEndEditing="YES" title="Label" usesSingleLineMode="YES" id="lbH-Tx-LUi">
@@ -93,7 +93,7 @@
                                     <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                     <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" id="XFd-y1-xps"/>
                                     <connections>
-                                        <binding destination="aXc-ZY-djk" name="valueURL" keyPath="representedObject.url" id="GrT-re-OWz"/>
+                                        <binding destination="aXc-ZY-djk" name="value" keyPath="representedObject.image" id="U47-eu-AQS"/>
                                     </connections>
                                 </imageView>
                             </subviews>
index ae73710..248a13f 100644 (file)
@@ -20,6 +20,12 @@ final class ScreenshotInformation: NSObject, NSCoding {
     
     @objc let url: URL
     
+    @objc lazy var image: NSImage? = {
+        
+        guard let image = NSImage(contentsOf: url) else { return Logger.shared.log("Can not load image", value: nil) }
+        return image
+    }()
+    
     @objc var creationDate: Date? {
         
         let attr = try? url.resourceValues(forKeys: [.creationDateKey])