mirror of
https://github.com/zxing/zxing.git
synced 2025-02-02 05:41:08 -08:00
license and whitespace only
git-svn-id: https://zxing.googlecode.com/svn/trunk@2444 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
39cd6a78bb
commit
35069ed41d
|
@ -1,10 +1,19 @@
|
|||
//
|
||||
// BarcodesAppDelegate.m
|
||||
// Barcodes
|
||||
//
|
||||
// Created by Romain Pechayre on 11/14/10.
|
||||
// Copyright 2010 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
// -*- mode:objc; c-basic-offset:2; indent-tabs-mode:nil -*-
|
||||
/**
|
||||
* Copyright 2010-2012 ZXing authors All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#import "BarcodesAppDelegate.h"
|
||||
|
||||
|
@ -18,37 +27,37 @@
|
|||
#pragma mark Application lifecycle
|
||||
|
||||
- (BOOL)myOpenURL:(NSURL*)url {
|
||||
if (!url) return NO;
|
||||
if ([[url scheme] isEqualToString:@"zxing"]) {
|
||||
if ([[url host] isEqualToString:@"scan"]) {
|
||||
NSArray *pairs = [[url query] componentsSeparatedByString:@"&"];
|
||||
if (!url) return NO;
|
||||
if ([[url scheme] isEqualToString:@"zxing"]) {
|
||||
if ([[url host] isEqualToString:@"scan"]) {
|
||||
NSArray *pairs = [[url query] componentsSeparatedByString:@"&"];
|
||||
|
||||
for (NSString *pair in pairs) {
|
||||
NSArray *elements = [pair componentsSeparatedByString:@"="];
|
||||
NSString *key = [[elements objectAtIndex:0] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
|
||||
NSString *val = [[elements objectAtIndex:1] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
|
||||
for (NSString *pair in pairs) {
|
||||
NSArray *elements = [pair componentsSeparatedByString:@"="];
|
||||
NSString *key = [[elements objectAtIndex:0] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
|
||||
NSString *val = [[elements objectAtIndex:1] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
|
||||
|
||||
if ([key isEqualToString:@"ret"]) {
|
||||
[[NSUserDefaults standardUserDefaults] setObject:val forKey:@"returnURL"];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
[[self viewController] scan:nil];
|
||||
}
|
||||
if ([key isEqualToString:@"SCAN_FORMATS"]) {
|
||||
// Storing these, but they effect nothing yet.
|
||||
NSArray *formats = [val componentsSeparatedByString:@","];
|
||||
[[NSUserDefaults standardUserDefaults] setObject:formats forKey:@"scanFormats"];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
}
|
||||
}
|
||||
if ([key isEqualToString:@"ret"]) {
|
||||
[[NSUserDefaults standardUserDefaults] setObject:val forKey:@"returnURL"];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
[[self viewController] scan:nil];
|
||||
}
|
||||
return YES;
|
||||
} else {
|
||||
return NO;
|
||||
if ([key isEqualToString:@"SCAN_FORMATS"]) {
|
||||
// Storing these, but they effect nothing yet.
|
||||
NSArray *formats = [val componentsSeparatedByString:@","];
|
||||
[[NSUserDefaults standardUserDefaults] setObject:formats forKey:@"scanFormats"];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
}
|
||||
}
|
||||
}
|
||||
return YES;
|
||||
} else {
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)registerView:(ZXMainViewController*)controller {
|
||||
[self setViewController:controller];
|
||||
[self setViewController:controller];
|
||||
}
|
||||
|
||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
||||
|
@ -64,7 +73,7 @@
|
|||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
}
|
||||
|
||||
// Override point for customization after application launch.
|
||||
// Override point for customization after application launch.
|
||||
window.rootViewController = tabBarController;
|
||||
[self.window makeKeyAndVisible];
|
||||
|
||||
|
@ -73,49 +82,49 @@
|
|||
|
||||
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url
|
||||
{
|
||||
return [self myOpenURL: url];
|
||||
return [self myOpenURL: url];
|
||||
}
|
||||
|
||||
- (void)applicationWillResignActive:(UIApplication *)application {
|
||||
/*
|
||||
Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
|
||||
Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
|
||||
*/
|
||||
/*
|
||||
Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
|
||||
Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
- (void)applicationDidEnterBackground:(UIApplication *)application {
|
||||
/*
|
||||
Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
|
||||
If your application supports background execution, called instead of applicationWillTerminate: when the user quits.
|
||||
*/
|
||||
/*
|
||||
Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
|
||||
If your application supports background execution, called instead of applicationWillTerminate: when the user quits.
|
||||
*/
|
||||
|
||||
// Clear the return URL so the application goes back to working as normal...
|
||||
[[NSUserDefaults standardUserDefaults] removeObjectForKey:@"returnURL"];
|
||||
[[NSUserDefaults standardUserDefaults] removeObjectForKey:@"scanFormats"];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
// Clear the return URL so the application goes back to working as normal...
|
||||
[[NSUserDefaults standardUserDefaults] removeObjectForKey:@"returnURL"];
|
||||
[[NSUserDefaults standardUserDefaults] removeObjectForKey:@"scanFormats"];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
}
|
||||
|
||||
|
||||
- (void)applicationWillEnterForeground:(UIApplication *)application {
|
||||
/*
|
||||
Called as part of transition from the background to the inactive state: here you can undo many of the changes made on entering the background.
|
||||
*/
|
||||
/*
|
||||
Called as part of transition from the background to the inactive state: here you can undo many of the changes made on entering the background.
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
- (void)applicationDidBecomeActive:(UIApplication *)application {
|
||||
/*
|
||||
Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
|
||||
*/
|
||||
/*
|
||||
Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
- (void)applicationWillTerminate:(UIApplication *)application {
|
||||
/*
|
||||
Called when the application is about to terminate.
|
||||
See also applicationDidEnterBackground:.
|
||||
*/
|
||||
/*
|
||||
Called when the application is about to terminate.
|
||||
See also applicationDidEnterBackground:.
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
@ -123,9 +132,9 @@
|
|||
#pragma mark Memory management
|
||||
|
||||
- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application {
|
||||
/*
|
||||
Free up as much memory as possible by purging cached data objects that can be recreated (or reloaded from disk) later.
|
||||
*/
|
||||
/*
|
||||
Free up as much memory as possible by purging cached data objects that can be recreated (or reloaded from disk) later.
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// -*- mode:objc; tab-width:2; indent-tabs-mode:nil; c-basic-offset:2 -*-
|
||||
/*
|
||||
* Copyright 2011 ZXing authors All rights reserved.
|
||||
* Copyright 2010-2012 ZXing authors All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
// -*- mode:objc; c-basic-offset:2; indent-tabs-mode:nil -*-
|
||||
/**
|
||||
* Copyright 2009 Jeff Verkoeyen
|
||||
* Copyright 2009-2012 ZXing authors All rights reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
@ -57,7 +57,7 @@
|
|||
|
||||
- (id)initWithDelegate:(id<ZXingDelegate>)scanDelegate showCancel:(BOOL)shouldShowCancel OneDMode:(BOOL)shouldUseoOneDMode {
|
||||
|
||||
return [self initWithDelegate:scanDelegate showCancel:shouldShowCancel OneDMode:shouldUseoOneDMode showLicense:YES];
|
||||
return [self initWithDelegate:scanDelegate showCancel:shouldShowCancel OneDMode:shouldUseoOneDMode showLicense:YES];
|
||||
}
|
||||
|
||||
- (id)initWithDelegate:(id<ZXingDelegate>)scanDelegate showCancel:(BOOL)shouldShowCancel OneDMode:(BOOL)shouldUseoOneDMode showLicense:(BOOL)shouldShowLicense {
|
||||
|
@ -244,7 +244,7 @@
|
|||
|
||||
- (void)decoder:(Decoder *)decoder
|
||||
decodingImage:(UIImage *)image
|
||||
usingSubset:(UIImage *)subset {
|
||||
usingSubset:(UIImage *)subset {
|
||||
}
|
||||
|
||||
- (void)presentResultForString:(NSString *)resultString {
|
||||
|
@ -290,13 +290,13 @@
|
|||
}
|
||||
|
||||
/*
|
||||
- (void)stopPreview:(NSNotification*)notification {
|
||||
- (void)stopPreview:(NSNotification*)notification {
|
||||
// NSLog(@"stop preview");
|
||||
}
|
||||
}
|
||||
|
||||
- (void)notification:(NSNotification*)notification {
|
||||
- (void)notification:(NSNotification*)notification {
|
||||
// NSLog(@"notification %@", notification.name);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
#pragma mark -
|
||||
|
@ -360,40 +360,40 @@ static bool isIPad() {
|
|||
|
||||
/*
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver:self
|
||||
selector:@selector(stopPreview:)
|
||||
name:AVCaptureSessionDidStopRunningNotification
|
||||
object:self.captureSession];
|
||||
addObserver:self
|
||||
selector:@selector(stopPreview:)
|
||||
name:AVCaptureSessionDidStopRunningNotification
|
||||
object:self.captureSession];
|
||||
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver:self
|
||||
selector:@selector(notification:)
|
||||
name:AVCaptureSessionDidStopRunningNotification
|
||||
object:self.captureSession];
|
||||
addObserver:self
|
||||
selector:@selector(notification:)
|
||||
name:AVCaptureSessionDidStopRunningNotification
|
||||
object:self.captureSession];
|
||||
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver:self
|
||||
selector:@selector(notification:)
|
||||
name:AVCaptureSessionRuntimeErrorNotification
|
||||
object:self.captureSession];
|
||||
addObserver:self
|
||||
selector:@selector(notification:)
|
||||
name:AVCaptureSessionRuntimeErrorNotification
|
||||
object:self.captureSession];
|
||||
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver:self
|
||||
selector:@selector(notification:)
|
||||
name:AVCaptureSessionDidStartRunningNotification
|
||||
object:self.captureSession];
|
||||
addObserver:self
|
||||
selector:@selector(notification:)
|
||||
name:AVCaptureSessionDidStartRunningNotification
|
||||
object:self.captureSession];
|
||||
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver:self
|
||||
selector:@selector(notification:)
|
||||
name:AVCaptureSessionWasInterruptedNotification
|
||||
object:self.captureSession];
|
||||
addObserver:self
|
||||
selector:@selector(notification:)
|
||||
name:AVCaptureSessionWasInterruptedNotification
|
||||
object:self.captureSession];
|
||||
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver:self
|
||||
selector:@selector(notification:)
|
||||
name:AVCaptureSessionInterruptionEndedNotification
|
||||
object:self.captureSession];
|
||||
addObserver:self
|
||||
selector:@selector(notification:)
|
||||
name:AVCaptureSessionInterruptionEndedNotification
|
||||
object:self.captureSession];
|
||||
*/
|
||||
|
||||
if (!self.prevLayer) {
|
||||
|
@ -509,15 +509,15 @@ didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
|
|||
[self.prevLayer removeFromSuperlayer];
|
||||
|
||||
/*
|
||||
// heebee jeebees here ... is iOS still writing into the layer?
|
||||
if (self.prevLayer) {
|
||||
layer.session = nil;
|
||||
AVCaptureVideoPreviewLayer* layer = prevLayer;
|
||||
[self.prevLayer retain];
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 12000000000), dispatch_get_main_queue(), ^{
|
||||
[layer release];
|
||||
});
|
||||
}
|
||||
// heebee jeebees here ... is iOS still writing into the layer?
|
||||
if (self.prevLayer) {
|
||||
layer.session = nil;
|
||||
AVCaptureVideoPreviewLayer* layer = prevLayer;
|
||||
[self.prevLayer retain];
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 12000000000), dispatch_get_main_queue(), ^{
|
||||
[layer release];
|
||||
});
|
||||
}
|
||||
*/
|
||||
|
||||
self.prevLayer = nil;
|
||||
|
|
Loading…
Reference in a new issue