Skip to content

Commit

Permalink
v0.2.3
Browse files Browse the repository at this point in the history
merge code from v0.2.2
  • Loading branch information
gelosie committed Jan 23, 2013
1 parent c72f7f5 commit c311a52
Show file tree
Hide file tree
Showing 225 changed files with 14,648 additions and 6,571 deletions.
2 changes: 1 addition & 1 deletion BeeDebugger/Bee_Debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@
#import "Bee_Precompile.h"
#import "Bee.h"

@interface BeeDebugger
@interface BeeDebugger : NSObject
+ (void)show;
@end
1 change: 1 addition & 0 deletions BeeDebugger/Bee_DebugMessageBoard.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#if defined(__BEE_DEBUGGER__) && __BEE_DEBUGGER__

#import "Bee_DebugDetailView.h"
#import "Bee_UITableBoard.h"

#pragma mark -

Expand Down
122 changes: 63 additions & 59 deletions BeeDebugger/Bee_DebugMessageBoard.m
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,12 @@ - (void)setMessage:(BeeMessage *)message

@implementation BeeDebugMessageCell

+ (CGSize)cellSize:(NSObject *)data bound:(CGSize)bound
+ (CGSize)sizeInBound:(CGSize)bound forData:(NSObject *)data
{
return CGSizeMake( bound.width, 50.0f );
}

- (void)cellLayout:(BeeUIGridCell *)cell bound:(CGSize)bound
- (void)layoutInBound:(CGSize)bound forCell:(BeeUIGridCell *)cell
{
CGRect timeFrame;
timeFrame.size.width = 70.0f;
Expand Down Expand Up @@ -165,73 +165,77 @@ - (void)load
[self addSubview:_statusLabel];
}

- (void)bindData:(NSObject *)data
- (void)dataWillChange
{
BeeMessage * msg = (BeeMessage *)data;

NSDateFormatter * formatter = [[NSDateFormatter alloc] init];
[formatter setLocale:[[[NSLocale alloc] initWithLocaleIdentifier:@"US"] autorelease]];
[formatter setDateFormat:@"hh:mm:ss"];
NSDate * date2 = [NSDate dateWithTimeIntervalSince1970:msg.initTimeStamp];
_timeLabel.text = [formatter stringFromDate:date2];
[formatter release];

_nameLabel.text = msg.message;

if ( msg.created )
{
_statusLabel.text = @"Created";
_statusLabel.textColor = [UIColor whiteColor];
}
else if ( msg.sending )
{
_statusLabel.text = [NSString stringWithFormat:@"Sending\n%dK / %dK",
[msg.request uploadBytes] / 1024,
[msg.request downloadBytes] / 1024];
_statusLabel.textColor = [UIColor yellowColor];
}
else if ( msg.succeed )
{
// _statusLabel.text = [NSString stringWithFormat:@"Succeed\n%dK / %dK",
// [msg.request uploadBytes] / 1024,
// [msg.request downloadBytes] / 1024];
_statusLabel.text = @"Succeed";
_statusLabel.textColor = [UIColor greenColor];
}
else if ( msg.failed )
[super dataWillChange];
}

- (void)dataDidChanged
{
BeeMessage * msg = (BeeMessage *)self.cellData;
if ( msg )
{
if ( msg.timeout )
NSDateFormatter * formatter = [[NSDateFormatter alloc] init];
[formatter setLocale:[[[NSLocale alloc] initWithLocaleIdentifier:@"US"] autorelease]];
[formatter setDateFormat:@"hh:mm:ss"];
NSDate * date2 = [NSDate dateWithTimeIntervalSince1970:msg.initTimeStamp];
_timeLabel.text = [formatter stringFromDate:date2];
[formatter release];

_nameLabel.text = msg.message;

if ( msg.created )
{
_statusLabel.text = @"Created";
_statusLabel.textColor = [UIColor whiteColor];
}
else if ( msg.sending )
{
_statusLabel.text = @"Timeout";
_statusLabel.textColor = [UIColor redColor];
_statusLabel.text = [NSString stringWithFormat:@"Sending\n%dK / %dK",
[msg.request uploadBytes] / 1024,
[msg.request downloadBytes] / 1024];
_statusLabel.textColor = [UIColor yellowColor];
}
else if ( msg.succeed )
{
// _statusLabel.text = [NSString stringWithFormat:@"Succeed\n%dK / %dK",
// [msg.request uploadBytes] / 1024,
// [msg.request downloadBytes] / 1024];
_statusLabel.text = @"Succeed";
_statusLabel.textColor = [UIColor greenColor];
}
else if ( msg.failed )
{
if ( msg.timeout )
{
_statusLabel.text = @"Timeout";
_statusLabel.textColor = [UIColor redColor];
}
else
{
_statusLabel.text = @"Failed";
_statusLabel.textColor = [UIColor redColor];
}
}
else if ( msg.cancelled )
{
_statusLabel.text = @"Cancelled";
_statusLabel.textColor = [UIColor grayColor];
}
else
{
_statusLabel.text = @"Failed";
_statusLabel.textColor = [UIColor redColor];
_statusLabel.text = @"";
_statusLabel.textColor = [UIColor whiteColor];
}
}
else if ( msg.cancelled )
{
_statusLabel.text = @"Cancelled";
_statusLabel.textColor = [UIColor grayColor];
}
else
{
_statusLabel.text = @"";
_statusLabel.textColor = [UIColor whiteColor];
SAFE_RELEASE_SUBVIEW( _nameLabel );
SAFE_RELEASE_SUBVIEW( _timeLabel );
SAFE_RELEASE_SUBVIEW( _statusLabel );
}
}

- (void)unload
{
SAFE_RELEASE_SUBVIEW( _nameLabel );
SAFE_RELEASE_SUBVIEW( _timeLabel );
SAFE_RELEASE_SUBVIEW( _statusLabel );

[super unload];
}

@end

#pragma mark -
Expand Down Expand Up @@ -267,7 +271,7 @@ - (void)handleUISignal:(BeeUISignal *)signal

- (void)handleTick:(NSTimeInterval)elapsed
{
[self syncReloadData];
[self reloadData];
}

#pragma mark -
Expand All @@ -277,7 +281,7 @@ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPa
{
NSObject * data = [[BeeDebugMessageModel sharedInstance].history objectAtIndex:indexPath.row];
CGSize bound = CGSizeMake( self.viewSize.width, 0.0f );
return [BeeDebugMessageCell cellSize:data bound:bound].height;
return [BeeDebugMessageCell sizeInBound:bound forData:data].height;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
Expand All @@ -290,7 +294,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
BeeUITableViewCell * cell = (BeeUITableViewCell *)[self dequeueWithContentClass:[BeeDebugMessageCell class]];
if ( cell )
{
[cell bindData:[[BeeDebugMessageModel sharedInstance].history objectAtIndex:indexPath.row]];
cell.cellData = [[BeeDebugMessageModel sharedInstance].history objectAtIndex:indexPath.row];
return cell;
}

Expand Down
1 change: 1 addition & 0 deletions BeeDebugger/Bee_DebugNetworkBoard.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#import "Bee_DebugPlotsView.h"
#import "Bee_DebugSampleView.h"
#import "Bee_DebugDetailView.h"
#import "Bee_UITableBoard.h"

#pragma mark -

Expand Down
113 changes: 61 additions & 52 deletions BeeDebugger/Bee_DebugNetworkBoard.m
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@ - (void)setRequest:(BeeRequest *)req

@implementation BeeDebugNetworkCell

+ (CGSize)cellSize:(NSObject *)data bound:(CGSize)bound
+ (CGSize)sizeInBound:(CGSize)bound forData:(NSObject *)data
{
return CGSizeMake( bound.width, 50.0f );
}

- (void)cellLayout:(BeeUIGridCell *)cell bound:(CGSize)bound
- (void)layoutInBound:(CGSize)bound forCell:(BeeUIGridCell *)cell
{
CGRect timeFrame;
timeFrame.size.width = 70.0f;
Expand Down Expand Up @@ -126,59 +126,68 @@ - (void)unload
[super unload];
}

- (void)bindData:(NSObject *)data
- (void)dataWillChange
{
BeeRequest * req = (BeeRequest *)data;

NSDateFormatter * formatter = [[NSDateFormatter alloc] init];
[formatter setLocale:[[[NSLocale alloc] initWithLocaleIdentifier:@"US"] autorelease]];
[formatter setDateFormat:@"hh:mm:ss"];
NSDate * date2 = [NSDate dateWithTimeIntervalSince1970:req.initTimeStamp];
_timeLabel.text = [formatter stringFromDate:date2];
[formatter release];

_urlLabel.text = [req.url absoluteString];
[super dataWillChange];
}

NSUInteger upSize = req.postLength;
NSUInteger downSize = [[req rawResponseData] length];
- (void)dataDidChanged
{
[super dataDidChanged];

if ( req.created )
{
_statusLabel.textColor = [UIColor whiteColor];
_statusLabel.text = @"Pending";
}
else if ( req.sending )
{
_statusLabel.textColor = [UIColor yellowColor];
_statusLabel.text = [NSString stringWithFormat:@"Sending\n%@/%@",
[BeeDebugUtility number2String:upSize],
[BeeDebugUtility number2String:downSize]];
}
else if ( req.recving )
BeeRequest * req = (BeeRequest *)self.cellData;
if ( req )
{
_statusLabel.textColor = [UIColor yellowColor];
_statusLabel.text = [NSString stringWithFormat:@"Recving\n%@/%@",
[BeeDebugUtility number2String:upSize],
[BeeDebugUtility number2String:downSize]];
}
else if ( req.failed )
{
_statusLabel.textColor = [UIColor redColor];
_statusLabel.text = [NSString stringWithFormat:@"Failed\nerr%d", req.responseStatusCode];
}
else if ( req.succeed )
{
_statusLabel.textColor = [UIColor greenColor];
_statusLabel.text = [NSString stringWithFormat:@"Succeed\n%@/%@",
[BeeDebugUtility number2String:upSize],
[BeeDebugUtility number2String:downSize]];
NSDateFormatter * formatter = [[NSDateFormatter alloc] init];
[formatter setLocale:[[[NSLocale alloc] initWithLocaleIdentifier:@"US"] autorelease]];
[formatter setDateFormat:@"hh:mm:ss"];
NSDate * date2 = [NSDate dateWithTimeIntervalSince1970:req.initTimeStamp];
_timeLabel.text = [formatter stringFromDate:date2];
[formatter release];

_urlLabel.text = [req.url absoluteString];

NSUInteger upSize = req.postLength;
NSUInteger downSize = [[req rawResponseData] length];

if ( req.created )
{
_statusLabel.textColor = [UIColor whiteColor];
_statusLabel.text = @"Pending";
}
else if ( req.sending )
{
_statusLabel.textColor = [UIColor yellowColor];
_statusLabel.text = [NSString stringWithFormat:@"Sending\n%@/%@",
[BeeDebugUtility number2String:upSize],
[BeeDebugUtility number2String:downSize]];
}
else if ( req.recving )
{
_statusLabel.textColor = [UIColor yellowColor];
_statusLabel.text = [NSString stringWithFormat:@"Recving\n%@/%@",
[BeeDebugUtility number2String:upSize],
[BeeDebugUtility number2String:downSize]];
}
else if ( req.failed )
{
_statusLabel.textColor = [UIColor redColor];
_statusLabel.text = [NSString stringWithFormat:@"Failed\nerr%d", req.responseStatusCode];
}
else if ( req.succeed )
{
_statusLabel.textColor = [UIColor greenColor];
_statusLabel.text = [NSString stringWithFormat:@"Succeed\n%@/%@",
[BeeDebugUtility number2String:upSize],
[BeeDebugUtility number2String:downSize]];

// _statusLabel.text = @"Succeed";
}
else if ( req.cancelled )
{
_statusLabel.textColor = [UIColor grayColor];
_statusLabel.text = @"Cancelled";
// _statusLabel.text = @"Succeed";
}
else if ( req.cancelled )
{
_statusLabel.textColor = [UIColor grayColor];
_statusLabel.text = @"Cancelled";
}
}
}

Expand Down Expand Up @@ -233,15 +242,15 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
BeeUITableViewCell * cell = [self dequeueWithContentClass:[BeeDebugNetworkCell class]];
if ( cell )
{
[cell bindData:[[BeeDebugNetworkModel sharedInstance].history objectAtIndex:indexPath.row]];
cell.cellData = [[BeeDebugNetworkModel sharedInstance].history objectAtIndex:indexPath.row];
}
return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
CGSize bound = CGSizeMake( self.viewSize.width, 0.0f );
return [BeeDebugNetworkCell cellSize:nil bound:bound].height;
return [BeeDebugNetworkCell sizeInBound:bound forData:nil].height;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
Expand Down
1 change: 1 addition & 0 deletions BeeDebugger/Bee_DebugSandboxBoard.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
#import "Bee_DebugPlotsView.h"
#import "Bee_DebugSampleView.h"
#import "Bee_DebugDetailView.h"
#import "Bee_UITableBoard.h"

#pragma mark -

Expand Down
Loading

0 comments on commit c311a52

Please sign in to comment.