• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javac++androidlinuxc#objective-cqt誰得cocoawindowspythonphprubygameguibathyscaphec翻訳omegat計画中(planning stage)frameworktwittertestdombtronvb.netdirectxarduinopreviewerゲームエンジン

SWFファイル内の画像を表示/書き出しするGUIツール


Commit MetaInfo

Revision42c558683218c5d1a95631c1612fb0eaa7ea96ea (tree)
Zeit2016-09-30 21:42:03
Autormasakih <masakih@user...>
Commitermasakih

Log Message

バックグランドで展開するようにした

Ändern Zusammenfassung

Diff

--- a/KoreNoKaraSu/Base.lproj/HMSwfDocument.xib
+++ b/KoreNoKaraSu/Base.lproj/HMSwfDocument.xib
@@ -106,7 +106,7 @@
106106 <autoresizingMask key="autoresizingMask"/>
107107 </scroller>
108108 </scrollView>
109- <customView fixedFrame="YES" id="LpT-ka-bol">
109+ <customView id="LpT-ka-bol">
110110 <rect key="frame" x="216" y="0.0" width="404" height="500"/>
111111 <autoresizingMask key="autoresizingMask"/>
112112 <subviews>
@@ -118,7 +118,21 @@
118118 <binding destination="UYM-GR-Pyx" name="value" keyPath="selection.image" id="OXx-Tm-x6k"/>
119119 </connections>
120120 </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>
121131 </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>
122136 </customView>
123137 </subviews>
124138 <holdingPriorities>
@@ -137,7 +151,7 @@
137151 <connections>
138152 <outlet property="delegate" destination="-2" id="0bl-1N-x8E"/>
139153 </connections>
140- <point key="canvasLocation" x="746" y="-74"/>
154+ <point key="canvasLocation" x="942" y="-140"/>
141155 </window>
142156 <arrayController objectClassName="HMSwfImage" editable="NO" id="UYM-GR-Pyx">
143157 <connections>
--- a/KoreNoKaraSu/HMSwfDocument.m
+++ b/KoreNoKaraSu/HMSwfDocument.m
@@ -22,6 +22,8 @@
2222 @property (copy) NSArray<HMSwfImage *> *swfImages;
2323
2424 @property (strong) HMTemporaryDirectory *temporaryDirectorhy;
25+
26+@property BOOL didExtract;
2527 @end
2628
2729 @implementation HMSwfDocument
@@ -54,34 +56,37 @@
5456 self.fileURL.path
5557 ];
5658
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];
7477 }
75- HMSwfImage *swfImage = [HMSwfImage new];
76- swfImage.image = image;
77- swfImage.filepath = imageURL.path;
7878
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+ };
8188
82- self.swfImages = [images sortedArrayUsingComparator:^NSComparisonResult(HMSwfImage * _Nonnull obj1, HMSwfImage * _Nonnull obj2) {
83- return [obj1.name numericCompare:obj2.name];
84- }];
89+ [task launch];
8590
8691 return YES;
8792 }