These _should_ be here

This commit is contained in:
Steve Checkoway
2003-09-10 03:52:20 +00:00
parent 573e9df0b6
commit 535b7cfb61
2 changed files with 69 additions and 0 deletions
@@ -0,0 +1,22 @@
/* InstallerWindowController */
#import <Cocoa/Cocoa.h>
#import "Helper.h"
@interface InstallerWindowController : NSWindowController
{
IBOutlet NSButton *button;
IBOutlet NSTextView *textView;
IBOutlet NSTextField *questionField;
BOOL installing;
Helper *helper;
BOOL finished;
}
- (void)awakeFromNib;
- (void)dealloc;
- (IBAction)pushedButton:(id)sender;
- (void)postMessage:(NSString *)message;
- (void)finishedInstalling:(BOOL)success;
- (BOOL)AskQuestion:(NSString *)question;
- (IBAction)pushedQuestionButton:(id)sender;
@end
@@ -0,0 +1,47 @@
#import "InstallerWindowController.h"
@implementation InstallerWindowController
- (void)awakeFromNib
{
helper = [[Helper alloc] initWithPath:@"files"];
finished = NO;
}
/* This whole method might be unneeded, I can't remember */
- (void)dealloc
{
[helper autorelease];
helper = nil;
}
- (IBAction)pushedButton:(id)sender
{
if (finished)
[NSApp terminate:self];
[sender setEnabled:NO];
[self postMessage:@"Starting installation."];
[NSThread detachNewThreadSelector:@selector(startHelper:) toTarget:helper withObject:self];
}
- (void)postMessage:(NSString *)message
{
NSTextStorage *storage = [textView textStorage];
NSAttributedString *temp = [[[NSAttributedString alloc] initWithString:
[NSString stringWithFormat:@"%@\n", message]] autorelease];
[storage appendAttributedString:temp];
}
- (void)finishedInstalling:(BOOL)success
{
if (success)
{
[button setTitle:@"Quit Installer"];
[button setEnabled:YES];
finished = YES;
}
else
[button setEnabled:YES];
}
@end