Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 109 lines (88 sloc) 2.211 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
//
// TagInfoPaneViewController.m
// XboxLiveStatus
//
// Created by Daniel Harper on 25/05/2010.
// Copyright 2010 AO. All rights reserved.
//

#import "TagInfoPaneViewController.h"


@implementation TagInfoPaneViewController
@synthesize tag;
@synthesize isOpen;

-(id)init
{
if(self == [super init])
{

self = [super initWithWindowNibName:@"TagInfoPane"];
isOpen = NO;
}
return self;
}

-(void)show
{
[self window];
[self.window makeKeyAndOrderFront:self];
[self populateWindow];
isOpen = YES;
}

-(void)windowDidLoad
{
isOpen = YES;
[self populateWindow];
}

-(void)populateWindow
{
NSLog(@"%@ | Populating window with data for tag: '%@'", [self className], tag.name);
[tagName setStringValue:tag.name];
NSString *statusFormatted = [tag.currentActivity stringByReplacingOccurrencesOfString:@" ~ " withString:@"\r\n"];
statusFormatted = [statusFormatted stringByReplacingOccurrencesOfString:@" " withString:@"\r\n"];

[tagStatus setStringValue:statusFormatted];
[tagGamerScore setIntValue:[tag.gamerScore intValue]];
[tagImage setImage:tag.avatar];

if(tag.currentlyPlaying != nil)
[gameImage setImage:[tag.currentlyPlaying getImage]];
else
[gameImage setImage:[NSImage imageNamed:@"question"]];

[tagCountry setStringValue:tag.country];

if(tag.isGold)
[tagAccountType setStringValue:@"Gold"];
else
[tagAccountType setStringValue:@"Silver"];

if(tag.online)
[onlineInd setHidden:NO];
else
[onlineInd setHidden:YES];


[self.window setTitle:[NSString stringWithFormat:@"%@'s info", tag.name]];
}

-(IBAction)clickedImage:(id)sender
{
if(gameImage == sender)
{
NSLog(@"Game Image clicked!");
}
else
{
NSLog(@"Tag image clicked!");
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:tag.profileURL]];
}

}

- (void)reset
{
NSString *updating = @"Updating...";
[tagStatus setStringValue:updating];
[tagGamerScore setStringValue:updating];
[tagAccountType setStringValue:updating];
[tagCountry setStringValue:updating];
[onlineInd setHidden:YES];
}

- (void)windowWillClose:(NSNotification *)notification
{
isOpen = NO;
}

-(void)dealloc
{
NSLog(@"%@ | dealloc called", [self className]);
[tag release];
[super dealloc];
}
@end
Something went wrong with that request. Please try again.