SWFファイル内の画像を表示/書き出しするGUIツール
Revisión | 42c558683218c5d1a95631c1612fb0eaa7ea96ea (tree) |
---|---|
Tiempo | 2016-09-30 21:42:03 |
Autor | masakih <masakih@user...> |
Commiter | masakih |
バックグランドで展開するようにした
@@ -106,7 +106,7 @@ | ||
106 | 106 | <autoresizingMask key="autoresizingMask"/> |
107 | 107 | </scroller> |
108 | 108 | </scrollView> |
109 | - <customView fixedFrame="YES" id="LpT-ka-bol"> | |
109 | + <customView id="LpT-ka-bol"> | |
110 | 110 | <rect key="frame" x="216" y="0.0" width="404" height="500"/> |
111 | 111 | <autoresizingMask key="autoresizingMask"/> |
112 | 112 | <subviews> |
@@ -118,7 +118,21 @@ | ||
118 | 118 | <binding destination="UYM-GR-Pyx" name="value" keyPath="selection.image" id="OXx-Tm-x6k"/> |
119 | 119 | </connections> |
120 | 120 | </imageView> |
121 | + <progressIndicator wantsLayer="YES" horizontalHuggingPriority="750" verticalHuggingPriority="750" maxValue="100" displayedWhenStopped="NO" bezeled="NO" indeterminate="YES" style="spinning" translatesAutoresizingMaskIntoConstraints="NO" id="GJm-eC-XNA"> | |
122 | + <rect key="frame" x="186" y="234" width="32" height="32"/> | |
123 | + <connections> | |
124 | + <binding destination="-2" name="animate" keyPath="didExtract" id="aoV-ny-qDc"> | |
125 | + <dictionary key="options"> | |
126 | + <string key="NSValueTransformerName">NSNegateBoolean</string> | |
127 | + </dictionary> | |
128 | + </binding> | |
129 | + </connections> | |
130 | + </progressIndicator> | |
121 | 131 | </subviews> |
132 | + <constraints> | |
133 | + <constraint firstItem="GJm-eC-XNA" firstAttribute="centerY" secondItem="LpT-ka-bol" secondAttribute="centerY" id="Scp-bL-Khr"/> | |
134 | + <constraint firstItem="GJm-eC-XNA" firstAttribute="centerX" secondItem="LpT-ka-bol" secondAttribute="centerX" id="rCv-Tc-5bO"/> | |
135 | + </constraints> | |
122 | 136 | </customView> |
123 | 137 | </subviews> |
124 | 138 | <holdingPriorities> |
@@ -137,7 +151,7 @@ | ||
137 | 151 | <connections> |
138 | 152 | <outlet property="delegate" destination="-2" id="0bl-1N-x8E"/> |
139 | 153 | </connections> |
140 | - <point key="canvasLocation" x="746" y="-74"/> | |
154 | + <point key="canvasLocation" x="942" y="-140"/> | |
141 | 155 | </window> |
142 | 156 | <arrayController objectClassName="HMSwfImage" editable="NO" id="UYM-GR-Pyx"> |
143 | 157 | <connections> |
@@ -22,6 +22,8 @@ | ||
22 | 22 | @property (copy) NSArray<HMSwfImage *> *swfImages; |
23 | 23 | |
24 | 24 | @property (strong) HMTemporaryDirectory *temporaryDirectorhy; |
25 | + | |
26 | +@property BOOL didExtract; | |
25 | 27 | @end |
26 | 28 | |
27 | 29 | @implementation HMSwfDocument |
@@ -54,34 +56,37 @@ | ||
54 | 56 | self.fileURL.path |
55 | 57 | ]; |
56 | 58 | |
57 | - [task launch]; | |
58 | - [task waitUntilExit]; | |
59 | - | |
60 | - // TODO: タスクがエラーだった時の処理を追加 | |
61 | - | |
62 | - // TODO: terminationHandlerにする | |
63 | - NSFileManager *fm = [NSFileManager defaultManager]; | |
64 | - NSArray<NSURL *> *imageURLs = [fm contentsOfDirectoryAtURL:self.temporaryDirectorhy.URL | |
65 | - includingPropertiesForKeys:nil | |
66 | - options:0 | |
67 | - error:NULL]; | |
68 | - NSMutableArray<HMSwfImage *> *images = [NSMutableArray array]; | |
69 | - for(NSURL *imageURL in imageURLs) { | |
70 | - NSImage *image = [[NSImage alloc] initWithContentsOfURL:imageURL]; | |
71 | - if(!image) { | |
72 | - NSLog(@"can not create image from %@", imageURL.path); | |
73 | - continue; | |
59 | + task.terminationHandler = ^(NSTask *task) { | |
60 | + NSFileManager *fm = [NSFileManager defaultManager]; | |
61 | + NSArray<NSURL *> *imageURLs = [fm contentsOfDirectoryAtURL:self.temporaryDirectorhy.URL | |
62 | + includingPropertiesForKeys:nil | |
63 | + options:0 | |
64 | + error:NULL]; | |
65 | + NSMutableArray<HMSwfImage *> *images = [NSMutableArray array]; | |
66 | + for(NSURL *imageURL in imageURLs) { | |
67 | + NSImage *image = [[NSImage alloc] initWithContentsOfURL:imageURL]; | |
68 | + if(!image) { | |
69 | + NSLog(@"can not create image from %@", imageURL.path); | |
70 | + continue; | |
71 | + } | |
72 | + HMSwfImage *swfImage = [HMSwfImage new]; | |
73 | + swfImage.image = image; | |
74 | + swfImage.filepath = imageURL.path; | |
75 | + | |
76 | + [images addObject:swfImage]; | |
74 | 77 | } |
75 | - HMSwfImage *swfImage = [HMSwfImage new]; | |
76 | - swfImage.image = image; | |
77 | - swfImage.filepath = imageURL.path; | |
78 | 78 | |
79 | - [images addObject:swfImage]; | |
80 | - } | |
79 | + NSArray<HMSwfImage *> *swfImages = [images sortedArrayUsingComparator:^NSComparisonResult(HMSwfImage * _Nonnull obj1, HMSwfImage * _Nonnull obj2) { | |
80 | + return [obj1.name numericCompare:obj2.name]; | |
81 | + }]; | |
82 | + | |
83 | + dispatch_async(dispatch_get_main_queue(), ^{ | |
84 | + self.swfImages = swfImages; | |
85 | + self.didExtract = YES; | |
86 | + }); | |
87 | + }; | |
81 | 88 | |
82 | - self.swfImages = [images sortedArrayUsingComparator:^NSComparisonResult(HMSwfImage * _Nonnull obj1, HMSwfImage * _Nonnull obj2) { | |
83 | - return [obj1.name numericCompare:obj2.name]; | |
84 | - }]; | |
89 | + [task launch]; | |
85 | 90 | |
86 | 91 | return YES; |
87 | 92 | } |