Permalink
Browse files

adding working version of deb asset

  • Loading branch information...
1 parent d53cb8e commit 712eb902954e3c8077b572d63df065c052092068 @tomcool420 committed Dec 12, 2010
View
@@ -12,5 +12,6 @@
@interface SMFDebAsset : SMFBaseAsset {
NSString *_path;
}
-
+-(id)initWithPath:(NSString *)path;
+-(void)parseDebResult:(NSArray *)info;
@end
View
@@ -7,6 +7,8 @@
//
#import "SMFDebAsset.h"
+#import "SMFMediaPreview.h"
+#import "SMFThemeInfo.h"
@implementation SMFDebAsset
@@ -27,11 +29,54 @@ -(id)initWithPath:(NSString *)path
{
NSString *s = [NSString stringWithCString:line];
[lines addObject:s];
- NSLog(@"%@",s);
}
}
pclose(fp);
+ [self parseDebResult:lines];
+ [lines release];
+ [_image release];
+ _image = [[[SMFThemeInfo sharedTheme] packageImage] retain];
}
return self;
}
+-(void)parseDebResult:(NSArray *)info
+{
+ for(NSString *s in info)
+ {
+ NSArray *c = [s componentsSeparatedByString:@":"];
+ if ([c count]>1) {
+ NSString *key = [[c objectAtIndex:0] substringFromIndex:1];
+ NSString *object = [[c objectAtIndex:1] substringFromIndex:1];
+ if ([key caseInsensitiveCompare:@"Name"]==NSOrderedSame)
+ [self setTitle:object];
+ else if([key caseInsensitiveCompare:@"Description"]==NSOrderedSame)
+ [self setSummary:object];
+ else
+ [_meta setObject:object forKey:key];
+ }
+ }
+}
+-(NSDictionary *)orderedDictionary
+{
+ NSMutableArray *orderedKeys = [[NSMutableArray alloc] init];
+ NSMutableArray *objects = [[NSMutableArray alloc] init];
+ NSArray *keys = [NSArray arrayWithObjects:@"Version",@"Author",@"Maintainer",@"Section",nil];
+ for (NSString *key in keys) {
+ if ([[_meta allKeys] containsObject:key]) {
+ [orderedKeys addObject:key];
+ [objects addObject:[_meta objectForKey:key]];
+ }
+ }
+ NSMutableDictionary *a=[[NSMutableDictionary alloc] init];
+ if([_meta objectForKey:METADATA_TITLE]!=nil)
+ [a setObject:[_meta objectForKey:METADATA_TITLE] forKey:METADATA_TITLE];
+ if([_meta objectForKey:METADATA_SUMMARY]!=nil)
+ [a setObject:[_meta objectForKey:METADATA_SUMMARY] forKey:METADATA_SUMMARY];
+ [a setObject:orderedKeys forKey:METADATA_CUSTOM_KEYS];
+ [a setObject:objects forKey:METADATA_CUSTOM_OBJECTS];
+ [orderedKeys release];
+ [objects release];
+ return [a autorelease];
+
+}
@end
View
@@ -55,6 +55,12 @@ -(id)previewControlForItem:(long)row
if ([[f pathExtension] localizedCaseInsensitiveCompare:@"deb"]==NSOrderedSame) {
NSLog(@"***###***");
SMFDebAsset *asset = [[SMFDebAsset alloc] initWithPath:f];
+ if (asset!=nil) {
+ SMFMediaPreview *p = [[SMFMediaPreview alloc]init];
+ [p setAsset:asset];
+ [asset release];
+ return [p autorelease];
+ }
}
}
return [super previewControlForItem:row];
View
@@ -16,4 +16,5 @@
-(BRImage *)colorAppleTVNameImage;
-(BRImage *)keyboardIcon;
-(BRImage *)btstackIcon;
+-(BRImage *)packageImage;
@end
View
@@ -27,4 +27,8 @@ -(BRImage *)btstackIcon
{
return [BRImage imageWithPath:[[NSBundle bundleForClass:[self class]]pathForResource:@"btstack" ofType:@"png"]];
}
+-(BRImage *)packageImage
+{
+ return [BRImage imageWithPath:[[NSBundle bundleForClass:[self class]]pathForResource:@"package" ofType:@"png"]];
+}
@end
View
@@ -1,9 +1,9 @@
Package: org.tomcool.smframework
Name: SMFramework
-Version: 0.5.3-17
+Version: 0.5.3-21
Architecture: iphoneos-arm
Description: Framework for most packages written by me
Maintainer: Thomas Cool <thomas.cool@me.com>
Author: Thomas Cool <thomas.cool@me.com>
Section: Development
-Installed-Size: 348
+Installed-Size: 380
@@ -16,4 +16,5 @@
-(BRImage *)colorAppleTVNameImage;
-(BRImage *)keyboardIcon;
-(BRImage *)btstackIcon;
+-(BRImage *)packageImage;
@end
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.
View
Binary file not shown.

0 comments on commit 712eb90

Please sign in to comment.