-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Thant Thet Khin Zaw
committed
May 27, 2011
1 parent
b8d11be
commit 025fd9b
Showing
4 changed files
with
1,672 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// | ||
// KeyMagicUtil.h | ||
// KeyMagic | ||
// | ||
// Created by Thant Thet Khin Zaw on 5/8/11. | ||
// Copyright 2011 N/A. All rights reserved. | ||
// | ||
|
||
#import <Cocoa/Cocoa.h> | ||
#include "KeyMagicTypes.h" | ||
|
||
@interface KeyMagicUtil : NSObject { | ||
|
||
} | ||
|
||
+(NSString*) getKeyboardNameOrTitle:(const InfoList&)infos pathName:(NSString*) filePath; | ||
+(NSImage *) getIconImageFromKeyboard:(const InfoList&)infos; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// | ||
// KeyMagicUtil.m | ||
// KeyMagic | ||
// | ||
// Created by Thant Thet Khin Zaw on 5/8/11. | ||
// Copyright 2011 N/A. All rights reserved. | ||
// | ||
|
||
#import "KeyMagicUtil.h" | ||
|
||
@implementation KeyMagicUtil | ||
|
||
+(NSString*) getKeyboardNameOrTitle:(const InfoList&)infos pathName:(NSString*) filePath | ||
{ | ||
NSString * keyboardName; | ||
if (infos.find('name') != infos.end()) { | ||
Info name = infos.find('name')->second; | ||
keyboardName = [NSString stringWithCString:name.data encoding:NSUTF8StringEncoding]; | ||
} else { | ||
NSString * fileName = [filePath lastPathComponent]; | ||
keyboardName = [fileName substringToIndex:[fileName length] - 4]; | ||
} | ||
return keyboardName; | ||
} | ||
|
||
+(NSImage *) getIconImageFromKeyboard:(const InfoList&)infos | ||
{ | ||
if (infos.find('icon') != infos.end()) { | ||
Info icon = infos.find('icon')->second; | ||
NSData * data = [NSData dataWithBytes:icon.data length:icon.size]; | ||
NSImage * image = [[[NSImage new] autorelease] initWithData:data]; | ||
return image; | ||
} | ||
return nil; | ||
} | ||
|
||
@end |
Oops, something went wrong.