Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(64)

Unified Diff: Classes/ZXingAppDelegate.m

Issue 2347: ZXing iPhone Client: first partially functional version Base URL: https://zxing.googlecode.com/svn/trunk/iphone/
Patch Set: ifdef:d out the repeated rotation of greyscale images Created 16 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Classes/ZXingAppDelegate.h ('k') | Core/Src/BarcodeFormat.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Classes/ZXingAppDelegate.m
===================================================================
--- Classes/ZXingAppDelegate.m (revision 404)
+++ Classes/ZXingAppDelegate.m (working copy)
@@ -1,3 +1,9 @@
+//
+// ZXingAppDelegate.m
+// ZXing
+//
+// Created by Christian Brunschen on 23/04/2008.
+//
/*
* Copyright 2008 Google Inc.
*
@@ -14,40 +20,56 @@
* limitations under the License.
*/
-//
-// ZXingAppDelegate.m
-// ZXing
-//
-// Created by Christian Brunschen on 23/04/2008.
-//
#import "ZXingAppDelegate.h"
#import "DecoderViewController.h"
+#import "RotatingNavigationController.h"
@implementation ZXingAppDelegate
@synthesize window;
@synthesize viewController;
+@synthesize navigationController;
- (void)applicationDidFinishLaunching:(UIApplication *)application {
- /* create the view controller */
- DecoderViewController *vc = [[DecoderViewController alloc] init];
- self.viewController = vc;
- [vc release];
-
- // hook up the view controller's view to be in the window
- [window addSubview:viewController.view];
-
- // show the window
- [window makeKeyAndVisible];
-
- // pick and decode
- [viewController pickAndDecode];
+ /* create the view controller */
+ DecoderViewController *vc =
+ [[DecoderViewController alloc] initWithNibName:@"DecoderView"
+ bundle:[NSBundle mainBundle]];
+ self.viewController = vc;
+ [vc release];
+
+ navigationController = [[RotatingNavigationController alloc]
+ initWithRootViewController:viewController];
+
+ // hook up the view controller's view to be in the window
+ [window addSubview:navigationController.view];
+
+ // show the window
+ [window makeKeyAndVisible];
+
+ if ([[NSUserDefaults standardUserDefaults] boolForKey:@"autoChoosePicture"]) {
+ // pick and decode using the first available source type in priority order
+#define N_SOURCE_TYPES 3
+ UIImagePickerControllerSourceType sourceTypes[N_SOURCE_TYPES] = {
+ UIImagePickerControllerSourceTypeCamera,
+ UIImagePickerControllerSourceTypeSavedPhotosAlbum,
+ UIImagePickerControllerSourceTypePhotoLibrary
+ };
+
+ for (int i = 0; i < N_SOURCE_TYPES; i++) {
+ if ([UIImagePickerController isSourceTypeAvailable:sourceTypes[i]]) {
+ [viewController pickAndDecodeFromSource:sourceTypes[i]];
+ break;
+ }
+ }
+#undef N_SOURCE_TYPES
+ }
}
- (void)dealloc {
- [window release];
- [super dealloc];
+ [window release];
+ [super dealloc];
}
@end
« no previous file with comments | « Classes/ZXingAppDelegate.h ('k') | Core/Src/BarcodeFormat.h » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b