2005-06-02 14:16:43 -04:00
|
|
|
//
|
|
|
|
// FeedbackController.m
|
|
|
|
// Cog
|
|
|
|
//
|
|
|
|
// Created by Vincent Spader on 3/26/05.
|
2005-07-02 17:02:06 -04:00
|
|
|
// Copyright 2005 Vincent Spader All rights reserved.
|
2005-06-02 14:16:43 -04:00
|
|
|
//
|
|
|
|
|
|
|
|
#import "FeedbackController.h"
|
|
|
|
|
|
|
|
|
|
|
|
@implementation FeedbackController
|
|
|
|
|
2009-03-07 20:08:43 -03:00
|
|
|
- (id)init
|
|
|
|
{
|
|
|
|
return [super initWithWindowNibName:@"Feedback"];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (IBAction)showWindow:(id)sender
|
2005-06-02 14:16:43 -04:00
|
|
|
{
|
|
|
|
[fromView setStringValue:@""];
|
|
|
|
[subjectView setStringValue:@""];
|
|
|
|
[messageView setString:@""];
|
|
|
|
|
2009-03-07 20:08:43 -03:00
|
|
|
[super showWindow:sender];
|
2005-06-02 14:16:43 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
- (void)alertDidEnd:(NSAlert *)alert returnCode:(int)returnCode contextInfo:(void *)contextInfo
|
|
|
|
{
|
2007-03-08 22:16:06 -03:00
|
|
|
if ([(NSNumber *)contextInfo boolValue]== YES)
|
2005-06-05 14:52:35 -04:00
|
|
|
{
|
2009-03-07 20:08:43 -03:00
|
|
|
[[self window] close];
|
2005-06-05 14:52:35 -04:00
|
|
|
}
|
2005-06-02 14:16:43 -04:00
|
|
|
}
|
|
|
|
|
2009-03-07 20:08:43 -03:00
|
|
|
- (void)feedbackDidNotSend:(FeedbackSocket *)feedback
|
2005-06-02 14:16:43 -04:00
|
|
|
{
|
2007-07-10 21:20:32 -04:00
|
|
|
NSLog(@"Error sending feedback");
|
2005-06-02 14:16:43 -04:00
|
|
|
|
|
|
|
[sendingIndicator stopAnimation:self];
|
|
|
|
|
|
|
|
NSAlert *alert = [[[NSAlert alloc] init] autorelease];
|
2005-07-11 16:22:53 -04:00
|
|
|
[alert setMessageText:NSLocalizedString(@"FeedbackFailedMessageText", @"")];
|
|
|
|
[alert setInformativeText:NSLocalizedString(@"FeedbackFailedInformativeText", @"")];
|
2005-06-02 14:16:43 -04:00
|
|
|
|
2009-03-07 20:08:43 -03:00
|
|
|
[alert beginSheetModalForWindow:[self window] modalDelegate:self didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:) contextInfo:[NSNumber numberWithBool:NO]];
|
2005-06-02 14:16:43 -04:00
|
|
|
}
|
|
|
|
|
2009-03-07 20:08:43 -03:00
|
|
|
- (void)feedbackDidSend:(FeedbackSocket *)feedback
|
2005-06-02 14:16:43 -04:00
|
|
|
{
|
|
|
|
[sendingIndicator stopAnimation:self];
|
|
|
|
|
|
|
|
NSAlert *alert = [[[NSAlert alloc] init] autorelease];
|
2005-07-11 16:22:53 -04:00
|
|
|
[alert setMessageText:NSLocalizedString(@"FeedbackSuccessMessageText", @"")];
|
|
|
|
[alert setInformativeText:NSLocalizedString(@"FeedbackSuccessInformativeText", @"")];
|
2005-06-02 14:16:43 -04:00
|
|
|
|
2009-03-07 20:08:43 -03:00
|
|
|
[alert beginSheetModalForWindow:[self window] modalDelegate:self didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:) contextInfo:[NSNumber numberWithBool:YES]];
|
2005-06-02 14:16:43 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
- (IBAction)sendFeedback:(id)sender
|
|
|
|
{
|
|
|
|
[sendingIndicator startAnimation:self];
|
|
|
|
|
|
|
|
//Using this so that if its a bad connection, it doesnt sit there looking stupid..or should it
|
|
|
|
feedbackSocket = [[FeedbackSocket alloc] init];
|
|
|
|
[feedbackSocket setDelegate:self];
|
2007-05-27 11:34:04 -04:00
|
|
|
|
|
|
|
NSString *version = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"];
|
2005-06-02 14:16:43 -04:00
|
|
|
|
2007-05-27 11:34:04 -04:00
|
|
|
[feedbackSocket sendFeedback:[fromView stringValue] subject:[subjectView stringValue] message:[messageView string] version:version];
|
2005-06-02 14:16:43 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
- (IBAction)cancel:(id)sender
|
|
|
|
{
|
2009-03-07 20:08:43 -03:00
|
|
|
[[self window] close];
|
2005-06-02 14:16:43 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
@end
|