Skip to content
This repository has been archived by the owner on May 6, 2020. It is now read-only.

Commit

Permalink
Code Review
Browse files Browse the repository at this point in the history
  • Loading branch information
ikorich committed Dec 23, 2014
1 parent 4c92f3d commit 5f1c61f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 18 deletions.
22 changes: 12 additions & 10 deletions iResource/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,15 @@ - (void)gatherResources

resourceManager.successCompletionBlock = ^(NSDictionary *resources) {

weakSelf.resourceData = resources;
[weakSelf.typesBox removeAllItems];

[weakSelf.typesBox addItemsWithObjectValues:[resources allKeys]];

[weakSelf.typesBox selectItemAtIndex:0];
if (resources.count)
{
weakSelf.resourceData = resources;
[weakSelf.typesBox removeAllItems];

[weakSelf.typesBox addItemsWithObjectValues:[resources allKeys]];

[weakSelf.typesBox selectItemAtIndex:0];
}

dispatch_async(dispatch_get_main_queue(), ^{

Expand Down Expand Up @@ -211,10 +214,9 @@ - (void)didChangedSelectionCollectionItemView:(NSCollectionViewItem *)collection
[[QLPreviewPanel sharedPreviewPanel] reloadData];

//need delay for write data
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.01 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{

[[QLPreviewPanel sharedPreviewPanel] refreshCurrentPreviewItem];
});
dispatch_async(dispatch_get_main_queue(), ^{
[[QLPreviewPanel sharedPreviewPanel] refreshCurrentPreviewItem];
});
}

self.selectedResource = collectionViewItem.representedObject;
Expand Down
6 changes: 3 additions & 3 deletions iResource/ResourceCollectionItemView.m
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,15 @@ - (void)drawRect:(NSRect)dirtyRect

if (_isSelected)
{
fillColor = [NSColor colorWithCalibratedRed: 0.851 green: 0.851 blue: 0.851 alpha: 1];
strokeColor = [NSColor colorWithCalibratedRed: 0.408 green: 0.592 blue: 0.855 alpha: 1];
fillColor = [NSColor colorWithCalibratedWhite:0.850 alpha:1.000];
strokeColor = [NSColor colorWithCalibratedRed:0.400 green:0.650 blue:0.900 alpha:1.000];

filedColor = [NSColor blackColor];
}
else
{
fillColor = [NSColor clearColor];
strokeColor = [NSColor colorWithCalibratedRed: 0.749 green: 0.749 blue: 0.749 alpha: 1];
strokeColor = [NSColor colorWithCalibratedWhite:0.850 alpha:1.000];
filedColor = [NSColor grayColor];
}

Expand Down
14 changes: 9 additions & 5 deletions iResource/ResourceManager/RSRCManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,15 @@ - (void)parseData
for (NSUInteger i = 0; i < resourceTypeCount; ++i)
{
NSString *type = [NSString stringWithUTF8String:[[file readDataOfLength:BYTE_4] bytes]];
NSUInteger count = [weakSelf parseIntFromData:[file readDataOfLength:BYTE_2]];

[file readDataOfLength:BYTE_2];

weakSelf.resourceData[type] = @(++count);
if (type)
{
NSUInteger count = [weakSelf parseIntFromData:[file readDataOfLength:BYTE_2]];

[file readDataOfLength:BYTE_2];

weakSelf.resourceData[type] = @(++count);
}
}

NSMutableDictionary *IDs = [NSMutableDictionary dictionary];
Expand All @@ -74,7 +78,7 @@ - (void)parseData

[file seekToFileOffset:weakSelf.startDataPosition];

for(NSString *type in [resourceData allKeys])
for (NSString *type in [resourceData allKeys])
{
NSMutableArray *resources = [NSMutableArray array];

Expand Down

0 comments on commit 5f1c61f

Please sign in to comment.