あれとこれのコンバータ
Revision | 947da00e58b62ddf2066871eb164e98e0aee9abd (tree) |
---|---|
Time | 2011-11-30 23:42:07 |
Author | masakih <masakih@user...> |
Commiter | masakih |
CoreData -> SQLite 変換を一部実装。
@@ -18,6 +18,7 @@ | ||
18 | 18 | <string>NSTextField</string> |
19 | 19 | <string>NSTextFieldCell</string> |
20 | 20 | <string>NSButtonCell</string> |
21 | + <string>NSDateFormatter</string> | |
21 | 22 | <string>NSButton</string> |
22 | 23 | <string>NSCustomObject</string> |
23 | 24 | </object> |
@@ -43,7 +44,7 @@ | ||
43 | 44 | <object class="NSWindowTemplate" id="1005"> |
44 | 45 | <int key="NSWindowStyleMask">1</int> |
45 | 46 | <int key="NSWindowBacking">2</int> |
46 | - <string key="NSWindowRect">{{196, 240}, {480, 203}}</string> | |
47 | + <string key="NSWindowRect">{{196, 240}, {413, 186}}</string> | |
47 | 48 | <int key="NSWTFlags">544735232</int> |
48 | 49 | <string key="NSWindowTitle">Window</string> |
49 | 50 | <string key="NSWindowClass">NSWindow</string> |
@@ -58,7 +59,7 @@ | ||
58 | 59 | <reference key="NSNextResponder" ref="1006"/> |
59 | 60 | <int key="NSvFlags">1292</int> |
60 | 61 | <object class="NSPSMatrix" key="NSDrawMatrix"/> |
61 | - <string key="NSFrame">{{18, 56}, {444, 20}}</string> | |
62 | + <string key="NSFrame">{{18, 56}, {377, 20}}</string> | |
62 | 63 | <reference key="NSSuperview" ref="1006"/> |
63 | 64 | <reference key="NSWindow"/> |
64 | 65 | <reference key="NSNextKeyView" ref="298109841"/> |
@@ -69,7 +70,7 @@ | ||
69 | 70 | <object class="NSButton" id="298109841"> |
70 | 71 | <reference key="NSNextResponder" ref="1006"/> |
71 | 72 | <int key="NSvFlags">268</int> |
72 | - <string key="NSFrame">{{384, 12}, {82, 32}}</string> | |
73 | + <string key="NSFrame">{{317, 12}, {82, 32}}</string> | |
73 | 74 | <reference key="NSSuperview" ref="1006"/> |
74 | 75 | <reference key="NSWindow"/> |
75 | 76 | <reference key="NSNextKeyView"/> |
@@ -97,7 +98,7 @@ | ||
97 | 98 | <object class="NSTextField" id="751752688"> |
98 | 99 | <reference key="NSNextResponder" ref="1006"/> |
99 | 100 | <int key="NSvFlags">268</int> |
100 | - <string key="NSFrame">{{17, 166}, {446, 17}}</string> | |
101 | + <string key="NSFrame">{{17, 149}, {446, 17}}</string> | |
101 | 102 | <reference key="NSSuperview" ref="1006"/> |
102 | 103 | <reference key="NSWindow"/> |
103 | 104 | <reference key="NSNextKeyView" ref="404229335"/> |
@@ -133,17 +134,18 @@ | ||
133 | 134 | <object class="NSTextField" id="404229335"> |
134 | 135 | <reference key="NSNextResponder" ref="1006"/> |
135 | 136 | <int key="NSvFlags">268</int> |
136 | - <string key="NSFrame">{{29, 87}, {434, 71}}</string> | |
137 | + <string key="NSFrame">{{29, 107}, {367, 34}}</string> | |
137 | 138 | <reference key="NSSuperview" ref="1006"/> |
138 | 139 | <reference key="NSWindow"/> |
139 | - <reference key="NSNextKeyView" ref="795345144"/> | |
140 | + <reference key="NSNextKeyView" ref="865304595"/> | |
140 | 141 | <string key="NSReuseIdentifierKey">_NS:360</string> |
141 | 142 | <string key="NSAntiCompressionPriority">{250, 750}</string> |
142 | 143 | <bool key="NSEnabled">YES</bool> |
143 | 144 | <object class="NSTextFieldCell" key="NSCell" id="474223137"> |
144 | 145 | <int key="NSCellFlags">67239424</int> |
145 | 146 | <int key="NSCellFlags2">272629760</int> |
146 | - <string key="NSContents">Multiline Label</string> | |
147 | + <string type="base64-UTF8" key="NSContents">Q29udmVydGluZyB0aHJlYWQgaW5mb3JtYXRpb25zIC4uLiAgICAgICAgICAgICAgICAgICAgICAgICAg | |
148 | +ICAgICAgICAgICAKaG9nZQ</string> | |
147 | 149 | <object class="NSFont" key="NSSupport"> |
148 | 150 | <string key="NSName">LucidaGrande</string> |
149 | 151 | <double key="NSSize">13</double> |
@@ -155,8 +157,67 @@ | ||
155 | 157 | <reference key="NSTextColor" ref="598119629"/> |
156 | 158 | </object> |
157 | 159 | </object> |
160 | + <object class="NSTextField" id="129281907"> | |
161 | + <reference key="NSNextResponder" ref="1006"/> | |
162 | + <int key="NSvFlags">268</int> | |
163 | + <string key="NSFrame">{{339, 84}, {57, 17}}</string> | |
164 | + <reference key="NSSuperview" ref="1006"/> | |
165 | + <reference key="NSWindow"/> | |
166 | + <reference key="NSNextKeyView" ref="795345144"/> | |
167 | + <string key="NSReuseIdentifierKey">_NS:3944</string> | |
168 | + <bool key="NSEnabled">YES</bool> | |
169 | + <object class="NSTextFieldCell" key="NSCell" id="889304367"> | |
170 | + <int key="NSCellFlags">68288064</int> | |
171 | + <int key="NSCellFlags2">71304192</int> | |
172 | + <object class="NSDate" key="NSContents"> | |
173 | + <double key="NS.time">-978339600</double> | |
174 | + </object> | |
175 | + <reference key="NSSupport" ref="343840516"/> | |
176 | + <object class="NSDateFormatter" key="NSFormatter" id="337277413"> | |
177 | + <object class="NSMutableDictionary" key="NS.attributes"> | |
178 | + <bool key="EncodedWithXMLCoder">YES</bool> | |
179 | + <object class="NSArray" key="dict.sortedKeys"> | |
180 | + <bool key="EncodedWithXMLCoder">YES</bool> | |
181 | + <string>formatterBehavior</string> | |
182 | + <string>timeStyle</string> | |
183 | + </object> | |
184 | + <object class="NSMutableArray" key="dict.values"> | |
185 | + <bool key="EncodedWithXMLCoder">YES</bool> | |
186 | + <integer value="1040"/> | |
187 | + <integer value="2"/> | |
188 | + </object> | |
189 | + </object> | |
190 | + <string key="NS.format">H:mm:ss</string> | |
191 | + <bool key="NS.natural">NO</bool> | |
192 | + </object> | |
193 | + <string key="NSCellIdentifier">_NS:3944</string> | |
194 | + <reference key="NSControlView" ref="129281907"/> | |
195 | + <reference key="NSBackgroundColor" ref="9884855"/> | |
196 | + <reference key="NSTextColor" ref="598119629"/> | |
197 | + </object> | |
198 | + </object> | |
199 | + <object class="NSTextField" id="865304595"> | |
200 | + <reference key="NSNextResponder" ref="1006"/> | |
201 | + <int key="NSvFlags">268</int> | |
202 | + <string key="NSFrame">{{29, 84}, {77, 17}}</string> | |
203 | + <reference key="NSSuperview" ref="1006"/> | |
204 | + <reference key="NSWindow"/> | |
205 | + <reference key="NSNextKeyView" ref="129281907"/> | |
206 | + <string key="NSReuseIdentifierKey">_NS:3944</string> | |
207 | + <bool key="NSEnabled">YES</bool> | |
208 | + <object class="NSTextFieldCell" key="NSCell" id="632324638"> | |
209 | + <int key="NSCellFlags">68288064</int> | |
210 | + <int key="NSCellFlags2">71304192</int> | |
211 | + <string key="NSContents">1000/1000</string> | |
212 | + <reference key="NSSupport" ref="343840516"/> | |
213 | + <string key="NSCellIdentifier">_NS:3944</string> | |
214 | + <reference key="NSControlView" ref="865304595"/> | |
215 | + <reference key="NSBackgroundColor" ref="9884855"/> | |
216 | + <reference key="NSTextColor" ref="598119629"/> | |
217 | + </object> | |
218 | + </object> | |
158 | 219 | </object> |
159 | - <string key="NSFrameSize">{480, 203}</string> | |
220 | + <string key="NSFrameSize">{413, 186}</string> | |
160 | 221 | <reference key="NSSuperview"/> |
161 | 222 | <reference key="NSWindow"/> |
162 | 223 | <reference key="NSNextKeyView" ref="751752688"/> |
@@ -190,7 +251,7 @@ | ||
190 | 251 | <string key="label">animate: inProgress</string> |
191 | 252 | <reference key="source" ref="795345144"/> |
192 | 253 | <reference key="destination" ref="1001"/> |
193 | - <object class="NSNibBindingConnector" key="connector"> | |
254 | + <object class="NSNibBindingConnector" key="connector" id="287540750"> | |
194 | 255 | <reference key="NSSource" ref="795345144"/> |
195 | 256 | <reference key="NSDestination" ref="1001"/> |
196 | 257 | <string key="NSLabel">animate: inProgress</string> |
@@ -203,6 +264,60 @@ | ||
203 | 264 | </object> |
204 | 265 | <object class="IBConnectionRecord"> |
205 | 266 | <object class="IBBindingConnection" key="connection"> |
267 | + <string key="label">maxValue: amount</string> | |
268 | + <reference key="source" ref="795345144"/> | |
269 | + <reference key="destination" ref="1001"/> | |
270 | + <object class="NSNibBindingConnector" key="connector" id="727006681"> | |
271 | + <reference key="NSSource" ref="795345144"/> | |
272 | + <reference key="NSDestination" ref="1001"/> | |
273 | + <string key="NSLabel">maxValue: amount</string> | |
274 | + <string key="NSBinding">maxValue</string> | |
275 | + <string key="NSKeyPath">amount</string> | |
276 | + <int key="NSNibBindingConnectorVersion">2</int> | |
277 | + </object> | |
278 | + </object> | |
279 | + <int key="connectionID">17</int> | |
280 | + </object> | |
281 | + <object class="IBConnectionRecord"> | |
282 | + <object class="IBBindingConnection" key="connection"> | |
283 | + <string key="label">value: count</string> | |
284 | + <reference key="source" ref="795345144"/> | |
285 | + <reference key="destination" ref="1001"/> | |
286 | + <object class="NSNibBindingConnector" key="connector"> | |
287 | + <reference key="NSSource" ref="795345144"/> | |
288 | + <reference key="NSDestination" ref="1001"/> | |
289 | + <string key="NSLabel">value: count</string> | |
290 | + <string key="NSBinding">value</string> | |
291 | + <string key="NSKeyPath">count</string> | |
292 | + <reference key="NSPreviousConnector" ref="727006681"/> | |
293 | + <int key="NSNibBindingConnectorVersion">2</int> | |
294 | + </object> | |
295 | + </object> | |
296 | + <int key="connectionID">18</int> | |
297 | + </object> | |
298 | + <object class="IBConnectionRecord"> | |
299 | + <object class="IBBindingConnection" key="connection"> | |
300 | + <string key="label">isIndeterminate: amount</string> | |
301 | + <reference key="source" ref="795345144"/> | |
302 | + <reference key="destination" ref="1001"/> | |
303 | + <object class="NSNibBindingConnector" key="connector"> | |
304 | + <reference key="NSSource" ref="795345144"/> | |
305 | + <reference key="NSDestination" ref="1001"/> | |
306 | + <string key="NSLabel">isIndeterminate: amount</string> | |
307 | + <string key="NSBinding">isIndeterminate</string> | |
308 | + <string key="NSKeyPath">amount</string> | |
309 | + <object class="NSDictionary" key="NSOptions"> | |
310 | + <string key="NS.key.0">NSValueTransformerName</string> | |
311 | + <string key="NS.object.0">NSNegateBoolean</string> | |
312 | + </object> | |
313 | + <reference key="NSPreviousConnector" ref="287540750"/> | |
314 | + <int key="NSNibBindingConnectorVersion">2</int> | |
315 | + </object> | |
316 | + </object> | |
317 | + <int key="connectionID">20</int> | |
318 | + </object> | |
319 | + <object class="IBConnectionRecord"> | |
320 | + <object class="IBBindingConnection" key="connection"> | |
206 | 321 | <string key="label">value: label</string> |
207 | 322 | <reference key="source" ref="751752688"/> |
208 | 323 | <reference key="destination" ref="1001"/> |
@@ -233,6 +348,83 @@ | ||
233 | 348 | </object> |
234 | 349 | <int key="connectionID">16</int> |
235 | 350 | </object> |
351 | + <object class="IBConnectionRecord"> | |
352 | + <object class="IBBindingConnection" key="connection"> | |
353 | + <string key="label">value: progressTime</string> | |
354 | + <reference key="source" ref="129281907"/> | |
355 | + <reference key="destination" ref="1001"/> | |
356 | + <object class="NSNibBindingConnector" key="connector"> | |
357 | + <reference key="NSSource" ref="129281907"/> | |
358 | + <reference key="NSDestination" ref="1001"/> | |
359 | + <string key="NSLabel">value: progressTime</string> | |
360 | + <string key="NSBinding">value</string> | |
361 | + <string key="NSKeyPath">progressTime</string> | |
362 | + <int key="NSNibBindingConnectorVersion">2</int> | |
363 | + </object> | |
364 | + </object> | |
365 | + <int key="connectionID">24</int> | |
366 | + </object> | |
367 | + <object class="IBConnectionRecord"> | |
368 | + <object class="IBBindingConnection" key="connection"> | |
369 | + <string key="label">displayPatternValue1: count</string> | |
370 | + <reference key="source" ref="865304595"/> | |
371 | + <reference key="destination" ref="1001"/> | |
372 | + <object class="NSNibBindingConnector" key="connector" id="621183444"> | |
373 | + <reference key="NSSource" ref="865304595"/> | |
374 | + <reference key="NSDestination" ref="1001"/> | |
375 | + <string key="NSLabel">displayPatternValue1: count</string> | |
376 | + <string key="NSBinding">displayPatternValue1</string> | |
377 | + <string key="NSKeyPath">count</string> | |
378 | + <object class="NSDictionary" key="NSOptions"> | |
379 | + <string key="NS.key.0">NSDisplayPattern</string> | |
380 | + <string key="NS.object.0">%{value1}@/%{value2}@</string> | |
381 | + </object> | |
382 | + <int key="NSNibBindingConnectorVersion">2</int> | |
383 | + </object> | |
384 | + </object> | |
385 | + <int key="connectionID">28</int> | |
386 | + </object> | |
387 | + <object class="IBConnectionRecord"> | |
388 | + <object class="IBBindingConnection" key="connection"> | |
389 | + <string key="label">displayPatternValue2: amount</string> | |
390 | + <reference key="source" ref="865304595"/> | |
391 | + <reference key="destination" ref="1001"/> | |
392 | + <object class="NSNibBindingConnector" key="connector"> | |
393 | + <reference key="NSSource" ref="865304595"/> | |
394 | + <reference key="NSDestination" ref="1001"/> | |
395 | + <string key="NSLabel">displayPatternValue2: amount</string> | |
396 | + <string key="NSBinding">displayPatternValue2</string> | |
397 | + <string key="NSKeyPath">amount</string> | |
398 | + <object class="NSDictionary" key="NSOptions"> | |
399 | + <string key="NS.key.0">NSDisplayPattern</string> | |
400 | + <string key="NS.object.0">%{value1}@/%{value2}@</string> | |
401 | + </object> | |
402 | + <reference key="NSPreviousConnector" ref="621183444"/> | |
403 | + <int key="NSNibBindingConnectorVersion">2</int> | |
404 | + </object> | |
405 | + </object> | |
406 | + <int key="connectionID">29</int> | |
407 | + </object> | |
408 | + <object class="IBConnectionRecord"> | |
409 | + <object class="IBBindingConnection" key="connection"> | |
410 | + <string key="label">hidden: amount</string> | |
411 | + <reference key="source" ref="865304595"/> | |
412 | + <reference key="destination" ref="1001"/> | |
413 | + <object class="NSNibBindingConnector" key="connector"> | |
414 | + <reference key="NSSource" ref="865304595"/> | |
415 | + <reference key="NSDestination" ref="1001"/> | |
416 | + <string key="NSLabel">hidden: amount</string> | |
417 | + <string key="NSBinding">hidden</string> | |
418 | + <string key="NSKeyPath">amount</string> | |
419 | + <object class="NSDictionary" key="NSOptions"> | |
420 | + <string key="NS.key.0">NSValueTransformerName</string> | |
421 | + <string key="NS.object.0">NSNegateBoolean</string> | |
422 | + </object> | |
423 | + <int key="NSNibBindingConnectorVersion">2</int> | |
424 | + </object> | |
425 | + </object> | |
426 | + <int key="connectionID">31</int> | |
427 | + </object> | |
236 | 428 | </object> |
237 | 429 | <object class="IBMutableOrderedSet" key="objectRecords"> |
238 | 430 | <object class="NSArray" key="orderedObjects"> |
@@ -280,7 +472,9 @@ | ||
280 | 472 | <reference ref="751752688"/> |
281 | 473 | <reference ref="404229335"/> |
282 | 474 | <reference ref="795345144"/> |
475 | + <reference ref="865304595"/> | |
283 | 476 | <reference ref="298109841"/> |
477 | + <reference ref="129281907"/> | |
284 | 478 | </object> |
285 | 479 | <reference key="parent" ref="1005"/> |
286 | 480 | </object> |
@@ -331,6 +525,43 @@ | ||
331 | 525 | <reference key="object" ref="474223137"/> |
332 | 526 | <reference key="parent" ref="404229335"/> |
333 | 527 | </object> |
528 | + <object class="IBObjectRecord"> | |
529 | + <int key="objectID">21</int> | |
530 | + <reference key="object" ref="129281907"/> | |
531 | + <object class="NSMutableArray" key="children"> | |
532 | + <bool key="EncodedWithXMLCoder">YES</bool> | |
533 | + <reference ref="889304367"/> | |
534 | + </object> | |
535 | + <reference key="parent" ref="1006"/> | |
536 | + </object> | |
537 | + <object class="IBObjectRecord"> | |
538 | + <int key="objectID">22</int> | |
539 | + <reference key="object" ref="889304367"/> | |
540 | + <object class="NSMutableArray" key="children"> | |
541 | + <bool key="EncodedWithXMLCoder">YES</bool> | |
542 | + <reference ref="337277413"/> | |
543 | + </object> | |
544 | + <reference key="parent" ref="129281907"/> | |
545 | + </object> | |
546 | + <object class="IBObjectRecord"> | |
547 | + <int key="objectID">23</int> | |
548 | + <reference key="object" ref="337277413"/> | |
549 | + <reference key="parent" ref="889304367"/> | |
550 | + </object> | |
551 | + <object class="IBObjectRecord"> | |
552 | + <int key="objectID">25</int> | |
553 | + <reference key="object" ref="865304595"/> | |
554 | + <object class="NSMutableArray" key="children"> | |
555 | + <bool key="EncodedWithXMLCoder">YES</bool> | |
556 | + <reference ref="632324638"/> | |
557 | + </object> | |
558 | + <reference key="parent" ref="1006"/> | |
559 | + </object> | |
560 | + <object class="IBObjectRecord"> | |
561 | + <int key="objectID">26</int> | |
562 | + <reference key="object" ref="632324638"/> | |
563 | + <reference key="parent" ref="865304595"/> | |
564 | + </object> | |
334 | 565 | </object> |
335 | 566 | </object> |
336 | 567 | <object class="NSMutableDictionary" key="flattenedProperties"> |
@@ -345,6 +576,12 @@ | ||
345 | 576 | <string>1.NSWindowTemplate.visibleAtLaunch</string> |
346 | 577 | <string>10.IBPluginDependency</string> |
347 | 578 | <string>2.IBPluginDependency</string> |
579 | + <string>21.IBPluginDependency</string> | |
580 | + <string>22.IBPluginDependency</string> | |
581 | + <string>23.IBDateFormatterBehaviorMetadataKey</string> | |
582 | + <string>23.IBPluginDependency</string> | |
583 | + <string>25.IBPluginDependency</string> | |
584 | + <string>26.IBPluginDependency</string> | |
348 | 585 | <string>4.IBPluginDependency</string> |
349 | 586 | <string>5.IBPluginDependency</string> |
350 | 587 | <string>6.IBPluginDependency</string> |
@@ -364,6 +601,12 @@ | ||
364 | 601 | <string>com.apple.InterfaceBuilder.CocoaPlugin</string> |
365 | 602 | <string>com.apple.InterfaceBuilder.CocoaPlugin</string> |
366 | 603 | <string>com.apple.InterfaceBuilder.CocoaPlugin</string> |
604 | + <integer value="1"/> | |
605 | + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> | |
606 | + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> | |
607 | + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> | |
608 | + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> | |
609 | + <string>com.apple.InterfaceBuilder.CocoaPlugin</string> | |
367 | 610 | <string>com.apple.InterfaceBuilder.CocoaPlugin</string> |
368 | 611 | <string>com.apple.InterfaceBuilder.CocoaPlugin</string> |
369 | 612 | <string>com.apple.InterfaceBuilder.CocoaPlugin</string> |
@@ -382,7 +625,7 @@ | ||
382 | 625 | <reference key="dict.values" ref="1002"/> |
383 | 626 | </object> |
384 | 627 | <nil key="sourceID"/> |
385 | - <int key="maxID">16</int> | |
628 | + <int key="maxID">31</int> | |
386 | 629 | </object> |
387 | 630 | <object class="IBClassDescriber" key="IBDocument.Classes"> |
388 | 631 | <object class="NSMutableArray" key="referencedPartialClassDescriptions"> |
@@ -11,9 +11,13 @@ | ||
11 | 11 | @interface BSCDProgressPanelController : NSWindowController |
12 | 12 | |
13 | 13 | @property BOOL inProgress; |
14 | +@property NSUInteger amount; | |
15 | +@property NSUInteger count; | |
14 | 16 | @property (retain) NSString *label; |
15 | 17 | @property (retain) NSString *message; |
16 | 18 | |
19 | +@property (retain) NSDate *progressTime; | |
20 | + | |
17 | 21 | - (IBAction)cancel:(id)sender; |
18 | 22 | |
19 | 23 | @end |
@@ -11,9 +11,13 @@ | ||
11 | 11 | @implementation BSCDProgressPanelController |
12 | 12 | |
13 | 13 | @synthesize inProgress = _inProgress; |
14 | +@synthesize amount = _amount; | |
15 | +@synthesize count = _count; | |
14 | 16 | @synthesize label = _label; |
15 | 17 | @synthesize message = _message; |
16 | 18 | |
19 | +@synthesize progressTime = _progressTime; | |
20 | + | |
17 | 21 | - (id)init |
18 | 22 | { |
19 | 23 | return [self initWithWindowNibName:@"BSCDProgressPanel"]; |
@@ -29,6 +33,13 @@ | ||
29 | 33 | return self; |
30 | 34 | } |
31 | 35 | |
36 | +- (NSWindow *)window | |
37 | +{ | |
38 | + NSWindow *window = [super window]; | |
39 | + [window center]; | |
40 | + return window; | |
41 | +} | |
42 | + | |
32 | 43 | - (IBAction)cancel:(id)sender |
33 | 44 | { |
34 | 45 | [NSApp abortModal]; |
@@ -13,6 +13,10 @@ | ||
13 | 13 | #import "BSCDProgressPanelController.h" |
14 | 14 | |
15 | 15 | |
16 | +#import "BSBoardInformationObject.h" | |
17 | +#import "BSThreadInformationObject.h" | |
18 | + | |
19 | + | |
16 | 20 | @implementation BSDCAppDelegate |
17 | 21 | |
18 | 22 | @synthesize window = _window; |
@@ -27,7 +31,7 @@ | ||
27 | 31 | { |
28 | 32 | // Insert code here to initialize your application |
29 | 33 | self.cdManager = [BSCoreDataManager defaultManager]; |
30 | - [DatabaseManager defaultManager]; | |
34 | + [DatabaseManager setupDatabase]; | |
31 | 35 | } |
32 | 36 | |
33 | 37 |
@@ -61,18 +65,104 @@ | ||
61 | 65 | return bathyscapheSupportFolderPath; |
62 | 66 | } |
63 | 67 | |
68 | +- (void)setTimeToPanel:(BSCDProgressPanelController *)panel since:(NSDate *)date | |
69 | +{ | |
70 | + NSDate *now = [NSDate dateWithTimeIntervalSinceNow:0.0]; | |
71 | + panel.progressTime = [NSDate dateWithTimeIntervalSince1970:[now timeIntervalSinceDate:date] - [[NSTimeZone systemTimeZone] secondsFromGMT]]; | |
72 | +} | |
64 | 73 | - (IBAction)convertToSQLite:(id)sender |
65 | 74 | { |
75 | + NSDate *startTime = [NSDate dateWithTimeIntervalSinceNow:0.0]; | |
76 | + | |
66 | 77 | BSCDProgressPanelController *panel = [[BSCDProgressPanelController alloc] init]; |
78 | + [self setTimeToPanel:panel since:startTime]; | |
79 | + panel.label = @"Convert from CoreData to SQLite data"; | |
80 | + panel.message = @"Converting data ..."; | |
67 | 81 | |
68 | 82 | NSModalSession session = [NSApp beginModalSessionForWindow:panel.window]; |
69 | 83 | |
70 | - while( ([NSApp runModalSession:session] == NSRunContinuesResponse) ) { | |
71 | - sleep(1); | |
72 | - NSLog(@"hoge"); | |
84 | + if( ([NSApp runModalSession:session] != NSRunContinuesResponse) ) goto finish; | |
85 | + | |
86 | + BSCoreDataManager *cdm = [BSCoreDataManager defaultManager]; | |
87 | + NSArray *boards = [cdm fetchDataForEntityName:@"BoardInformation" predicate:nil]; | |
88 | + [self setTimeToPanel:panel since:startTime]; | |
89 | + | |
90 | + DatabaseManager *dm = [DatabaseManager defaultManager]; | |
91 | + [self setTimeToPanel:panel since:startTime]; | |
92 | + | |
93 | + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; | |
94 | + panel.message = @"Converting board informations ..."; | |
95 | + panel.amount = [boards count]; | |
96 | + for(BSBoardInformationObject *board in boards) { | |
97 | + [self setTimeToPanel:panel since:startTime]; | |
98 | + if( ([NSApp runModalSession:session] != NSRunContinuesResponse) ) goto finish; | |
99 | + | |
100 | + panel.count++; | |
101 | + if(NSNotFound != [dm boardIDForURLString:board.boardURL]) { | |
102 | + NSLog(@"Duplicate board url (%@)", board.boardURL); | |
103 | + continue; | |
104 | + } | |
105 | + | |
106 | + [dm registerBoardName:board.boardName URLString:board.boardURL]; | |
73 | 107 | } |
108 | + panel.amount = 0; | |
109 | + panel.count = 0; | |
110 | + [pool release]; | |
111 | + [self setTimeToPanel:panel since:startTime]; | |
112 | + | |
113 | + panel.message = @"Converting board histories ..."; | |
114 | + | |
115 | + | |
116 | + [self setTimeToPanel:panel since:startTime]; | |
117 | + pool = [[NSAutoreleasePool alloc] init]; | |
118 | + panel.message = @"Converting thread informations ..."; | |
119 | + for(BSBoardInformationObject *board in boards) { | |
120 | + [self setTimeToPanel:panel since:startTime]; | |
121 | + if( ([NSApp runModalSession:session] != NSRunContinuesResponse) ) goto finish; | |
122 | + | |
123 | + NSUInteger boardID = [dm boardIDForURLString:board.boardURL]; | |
124 | + NSSet *threads = board.threads; | |
125 | + panel.amount = [threads count]; | |
126 | + for(BSThreadInformationObject *thread in threads) { | |
127 | + NSAutoreleasePool *pool2 = [[NSAutoreleasePool alloc] init]; | |
128 | + [self setTimeToPanel:panel since:startTime]; | |
129 | + panel.count++; | |
130 | + panel.message = [NSString stringWithFormat:@"Converting thread informations ...\n%@", board.boardName]; | |
131 | + | |
132 | + if( ([NSApp runModalSession:session] != NSRunContinuesResponse) ) { | |
133 | + [pool2 release]; | |
134 | + goto finish; | |
135 | + } | |
136 | + | |
137 | + [dm insertThreadOfIdentifier:thread.threadID | |
138 | + title:thread.threadName | |
139 | + count:[thread.numberOfAll integerValue] | |
140 | + date:thread.modifiedDate | |
141 | + isDatOchi:[thread.isDatOchi boolValue] | |
142 | + atBoard:boardID]; | |
143 | + if(thread.lastWrittenDate) { | |
144 | + [dm setLastWriteDate:thread.lastWrittenDate | |
145 | + atBoardID:boardID | |
146 | + threadIdentifier:thread.threadID]; | |
147 | + } | |
148 | + | |
149 | + // number of read | |
150 | + | |
151 | + // label | |
152 | + | |
153 | + [pool2 release]; | |
154 | + } | |
155 | + panel.amount = 0; | |
156 | + panel.count = 0; | |
157 | + } | |
158 | + | |
159 | + | |
160 | + // Fav | |
74 | 161 | |
162 | +finish: | |
163 | + [pool release]; | |
75 | 164 | [NSApp endModalSession:session]; |
165 | + [panel.window close]; | |
76 | 166 | [panel release]; |
77 | 167 | } |
78 | 168 |