These _should_ be here
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user