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
0 parents
commit 30e41b7
Showing
27 changed files
with
4,020 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 @@ | ||
*.pbxproj -crlf -diff -merge |
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,9 @@ | ||
.DS_Store | ||
*.swp | ||
*~.nib | ||
|
||
build/ | ||
|
||
*.pbxuser | ||
*.perspective | ||
*.perspectivev3 |
Large diffs are not rendered by default.
Oops, something went wrong.
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,16 @@ | ||
// | ||
// AddTemplateView.h | ||
// Final-Templates | ||
// | ||
// Created by Rune Madsen on 4/8/10. | ||
// Copyright 2010 New York University. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
|
||
@interface AddTemplateView : UIViewController { | ||
|
||
} | ||
|
||
@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,63 @@ | ||
// | ||
// AddTemplateView.m | ||
// Final-Templates | ||
// | ||
// Created by Rune Madsen on 4/8/10. | ||
// Copyright 2010 New York University. All rights reserved. | ||
// | ||
|
||
#import "AddTemplateView.h" | ||
|
||
|
||
@implementation AddTemplateView | ||
|
||
/* | ||
// The designated initializer. Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad. | ||
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { | ||
if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) { | ||
// Custom initialization | ||
} | ||
return self; | ||
} | ||
*/ | ||
|
||
/* | ||
// Implement loadView to create a view hierarchy programmatically, without using a nib. | ||
- (void)loadView { | ||
} | ||
*/ | ||
|
||
/* | ||
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib. | ||
- (void)viewDidLoad { | ||
[super viewDidLoad]; | ||
} | ||
*/ | ||
|
||
/* | ||
// Override to allow orientations other than the default portrait orientation. | ||
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { | ||
// Return YES for supported orientations | ||
return (interfaceOrientation == UIInterfaceOrientationPortrait); | ||
} | ||
*/ | ||
|
||
- (void)didReceiveMemoryWarning { | ||
// Releases the view if it doesn't have a superview. | ||
[super didReceiveMemoryWarning]; | ||
|
||
// Release any cached data, images, etc that aren't in use. | ||
} | ||
|
||
- (void)viewDidUnload { | ||
// Release any retained subviews of the main view. | ||
// e.g. self.myOutlet = nil; | ||
} | ||
|
||
|
||
- (void)dealloc { | ||
[super dealloc]; | ||
} | ||
|
||
|
||
@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,20 @@ | ||
// | ||
// AddTemplateViewController.h | ||
// Final-Templates | ||
// | ||
// Created by Rune Madsen on 4/8/10. | ||
// Copyright 2010 New York University. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
|
||
@interface AddTemplateViewController : UIViewController { | ||
|
||
IBOutlet UITextField * templateName; | ||
IBOutlet UIButton* saveButton; | ||
} | ||
|
||
- (IBAction) save:(id)sender; | ||
|
||
@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,41 @@ | ||
// | ||
// AddTemplateViewController.m | ||
// Final-Templates | ||
// | ||
// Created by Rune Madsen on 4/8/10. | ||
// Copyright 2010 New York University. All rights reserved. | ||
// | ||
|
||
#import "AddTemplateViewController.h" | ||
|
||
|
||
@implementation AddTemplateViewController | ||
|
||
- (IBAction) save:(id)sender | ||
{ | ||
NSNotificationCenter * dc = [NSNotificationCenter defaultCenter]; | ||
[dc postNotification:[NSNotification notificationWithName:@"SaveNewTemplate" object:self]]; | ||
|
||
[self dismissModalViewControllerAnimated:YES]; | ||
} | ||
|
||
- (void)didReceiveMemoryWarning | ||
{ | ||
// Releases the view if it doesn't have a superview. | ||
[super didReceiveMemoryWarning]; | ||
|
||
// Release any cached data, images, etc that aren't in use. | ||
} | ||
|
||
- (void)viewDidUnload { | ||
// Release any retained subviews of the main view. | ||
// e.g. self.myOutlet = nil; | ||
} | ||
|
||
|
||
- (void)dealloc { | ||
[super dealloc]; | ||
} | ||
|
||
|
||
@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,19 @@ | ||
// | ||
// Final_TemplatesAppDelegate.h | ||
// Final-Templates | ||
// | ||
// Created by Rune Madsen on 4/7/10. | ||
// Copyright New York University 2010. All rights reserved. | ||
// | ||
|
||
@interface Final_TemplatesAppDelegate : NSObject <UIApplicationDelegate> { | ||
|
||
UIWindow *window; | ||
UINavigationController *navigationController; | ||
} | ||
|
||
@property (nonatomic, retain) IBOutlet UIWindow *window; | ||
@property (nonatomic, retain) IBOutlet UINavigationController *navigationController; | ||
|
||
@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,45 @@ | ||
// | ||
// Final_TemplatesAppDelegate.m | ||
// Final-Templates | ||
// | ||
// Created by Rune Madsen on 4/7/10. | ||
// Copyright New York University 2010. All rights reserved. | ||
// | ||
|
||
#import "Final_TemplatesAppDelegate.h" | ||
#import "RootViewController.h" | ||
|
||
@implementation Final_TemplatesAppDelegate | ||
|
||
@synthesize window; | ||
@synthesize navigationController; | ||
|
||
#pragma mark - | ||
#pragma mark Application lifecycle | ||
|
||
- (void)applicationDidFinishLaunching:(UIApplication *)application | ||
{ | ||
[window addSubview:[navigationController view]]; | ||
[window makeKeyAndVisible]; | ||
} | ||
|
||
|
||
- (void)applicationWillTerminate:(UIApplication *)application | ||
{ | ||
// Save data if appropriate | ||
} | ||
|
||
|
||
#pragma mark - | ||
#pragma mark Memory management | ||
|
||
- (void)dealloc | ||
{ | ||
[navigationController release]; | ||
[window release]; | ||
[super dealloc]; | ||
} | ||
|
||
|
||
@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,25 @@ | ||
// if you want gzip/zip suport you need to uncomment the ZLIB_SUPPORT define | ||
// and make sure to add -lz to the Other Linker Flags in the build tab | ||
// your project target (get info on your project target to find it) | ||
// Thanks to Martin Ceperly. | ||
|
||
//#define ZLIB_SUPPORT // don't uncomment this until you add the -lz linker flag to your project target | ||
|
||
#ifdef ZLIB_SUPPORT | ||
#import "zlib.h" | ||
#endif | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
@interface LCFileHelpers : NSObject | ||
{ | ||
} | ||
|
||
+ (NSArray*) allDocuments; | ||
+ (NSString*) pathToFileInDocuments:(NSString*)fileName; | ||
|
||
#ifdef ZLIB_SUPPORT | ||
+ (BOOL) ungzipFile: (NSString *)sourceFilenameString toDestination:(NSString *)destFilenameString; | ||
#endif | ||
|
||
@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,68 @@ | ||
#import "LCFileHelpers.h" | ||
|
||
#ifdef ZLIB_SUPPORT | ||
#define CHUNK_SIZE 256000 // 256K buffer in memory | ||
#endif | ||
|
||
@implementation LCFileHelpers | ||
|
||
+ (NSArray*) allDocuments | ||
{ | ||
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); | ||
NSString *documentDirectory = [(NSString*)[paths objectAtIndex:0] stringByAppendingFormat:@"/"]; | ||
paths = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:documentDirectory error:NULL]; | ||
return paths; | ||
} | ||
|
||
+ (NSString*) pathToFileInDocuments:(NSString*)fileName | ||
{ | ||
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); | ||
NSString *documentsDirectory = [paths objectAtIndex:0]; | ||
return [documentsDirectory stringByAppendingPathComponent:fileName]; | ||
} | ||
|
||
#ifdef ZLIB_SUPPORT | ||
+ (BOOL) ungzipFile: (NSString *)sourceFilenameString toDestination:(NSString *)destFilenameString | ||
{ | ||
const char *sourceFilename = [sourceFilenameString cStringUsingEncoding:NSUTF8StringEncoding]; | ||
const char *destFilename = [destFilenameString cStringUsingEncoding:NSUTF8StringEncoding]; | ||
|
||
unsigned char out[CHUNK_SIZE]; | ||
|
||
gzFile theFile = gzopen(sourceFilename, "rb"); | ||
if(theFile == NULL) { | ||
NSLog(@"error opening gz file"); | ||
return NO; | ||
} | ||
|
||
FILE *outFile = fopen(destFilename, "wb"); | ||
if(outFile == NULL) { | ||
NSLog(@"error opening destination file"); | ||
return NO; | ||
} | ||
|
||
long totalBytes = 0; | ||
int readResult = 0; | ||
|
||
do { | ||
readResult = gzread(theFile, out, CHUNK_SIZE); | ||
if(readResult > 0) { | ||
fwrite(out, 1, readResult, outFile); | ||
totalBytes += readResult; | ||
} | ||
} while (readResult > 0); | ||
|
||
gzclose(theFile); | ||
fclose(outFile); | ||
|
||
if(readResult == 0) { | ||
NSLog(@"successfully uncompressed gz file, resulting file is %d bytes", totalBytes); | ||
return YES; | ||
} else { | ||
NSLog(@"error reading data from gz file"); | ||
return NO; | ||
} | ||
} | ||
#endif | ||
|
||
@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,27 @@ | ||
// | ||
// RootViewController.h | ||
// Final-Templates | ||
// | ||
// Created by Rune Madsen on 4/7/10. | ||
// Copyright New York University 2010. All rights reserved. | ||
// | ||
|
||
#import "TemplateViewController.h" | ||
#import "TemplatesLoader.h" | ||
#import "AddTemplateViewController.h" | ||
#import "Template.h" | ||
|
||
@interface RootViewController : UITableViewController { | ||
|
||
TemplateViewController * templateView; | ||
AddTemplateViewController * addTemplateView; | ||
TemplatesLoader * loader; | ||
} | ||
|
||
@property (nonatomic, retain) TemplateViewController * templateView; | ||
@property (nonatomic, retain) AddTemplateViewController * addTemplateView; | ||
@property (nonatomic, retain) TemplatesLoader * loader; | ||
|
||
- (void) saveNewTemplate:(id)sender; | ||
|
||
@end |
Oops, something went wrong.