| 1 |
/* |
| 2 |
* Copyright (c) 2004-2005 The Lupin Project. All rights reserved. |
| 3 |
* |
| 4 |
* Redistribution and use in source and binary forms, with or without modification, are permitted |
| 5 |
* provided that the following conditions are met: |
| 6 |
* |
| 7 |
* 1. Redistributions of source code must retain the above copyright notice, this list of conditions |
| 8 |
* and the following disclaimer. |
| 9 |
* |
| 10 |
* 2. Redistributions in binary form must reproduce the above copyright notice, this list of |
| 11 |
* conditions and the following disclaimer in the documentation and/or other materials provided |
| 12 |
* with the distribution. |
| 13 |
* |
| 14 |
* THIS SOFTWARE IS PROVIDED BY THE LUPIN PROJECT ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, |
| 15 |
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 16 |
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE LUPIN PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, |
| 17 |
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 18 |
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 19 |
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
| 20 |
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 21 |
* POSSIBILITY OF SUCH DAMAGE. |
| 22 |
*/ |
| 23 |
|
| 24 |
#import "LPProcessWindowController.h" |
| 25 |
|
| 26 |
@implementation LPProcessWindowController |
| 27 |
|
| 28 |
- (LPProcessWindowController*)initWithWindowNibName:(NSString*)windowNibName plugin:(NSObject<LupinPluginProtocol>*)plugin |
| 29 |
{ |
| 30 |
_plugin = plugin; |
| 31 |
[_plugin retain]; |
| 32 |
return [super initWithWindowNibName:windowNibName]; |
| 33 |
} |
| 34 |
|
| 35 |
- (void)dealloc |
| 36 |
{ |
| 37 |
[_plugin release]; |
| 38 |
[self close]; |
| 39 |
} |
| 40 |
|
| 41 |
- (IBAction)stopProcess:(id)sender |
| 42 |
{ |
| 43 |
NSLog([[self document] className]); |
| 44 |
//[self close]; |
| 45 |
/* |
| 46 |
[_progressIndicator setIndeterminate:NO]; |
| 47 |
[NSThread detachNewThreadSelector:@selector(showProcessThread) toTarget:self withObject:nil]; |
| 48 |
*/ |
| 49 |
//! ��������������������������������������������������������������������� |
| 50 |
[_progressIndicator startAnimation:nil]; |
| 51 |
} |
| 52 |
|
| 53 |
- (void)showProcessThread |
| 54 |
{ |
| 55 |
NSAutoreleasePool* pool; |
| 56 |
NSString* title = @"Extracting..."; |
| 57 |
NSNumber* perProgress; |
| 58 |
int i; |
| 59 |
pool = [[NSAutoreleasePool alloc] init]; |
| 60 |
for (i=0;i<30;i++) { |
| 61 |
//[_progressIndicator animate:nil]; //!��������������������������������������������������������� |
| 62 |
perProgress = [_plugin processInfo:&title]; |
| 63 |
if (perProgress) { |
| 64 |
[_progressIndicator setDoubleValue:[perProgress doubleValue]]; |
| 65 |
} else { |
| 66 |
[_progressIndicator setIndeterminate:YES]; |
| 67 |
} |
| 68 |
if (title) [_infoTextField setStringValue:title]; |
| 69 |
} |
| 70 |
[NSThread sleepUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.01]]; |
| 71 |
//NSLog(@"perProgress=%@",[perProgress stringValue]); |
| 72 |
[pool release]; |
| 73 |
} |
| 74 |
|
| 75 |
@end |