From 535b7cfb612c6efb3419d55a42dcead251505c67 Mon Sep 17 00:00:00 2001 From: Steve Checkoway Date: Wed, 10 Sep 2003 03:52:20 +0000 Subject: [PATCH] These _should_ be here --- .../Installer/InstallerWindowController.h | 22 +++++++++ .../Installer/InstallerWindowController.m | 47 +++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 stepmania/PBProject/Installer/InstallerWindowController.h create mode 100644 stepmania/PBProject/Installer/InstallerWindowController.m diff --git a/stepmania/PBProject/Installer/InstallerWindowController.h b/stepmania/PBProject/Installer/InstallerWindowController.h new file mode 100644 index 0000000000..987af9922d --- /dev/null +++ b/stepmania/PBProject/Installer/InstallerWindowController.h @@ -0,0 +1,22 @@ +/* InstallerWindowController */ + +#import +#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 diff --git a/stepmania/PBProject/Installer/InstallerWindowController.m b/stepmania/PBProject/Installer/InstallerWindowController.m new file mode 100644 index 0000000000..1a3609aee3 --- /dev/null +++ b/stepmania/PBProject/Installer/InstallerWindowController.m @@ -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