Skip to content

Commit

Permalink
reduce the insanity in iphone
Browse files Browse the repository at this point in the history
git-svn-id: https://zxing.googlecode.com/svn/trunk@2634 59b500cc-1b3d-0410-9834-0bbf25fbcc57
  • Loading branch information
[email protected] committed Apr 7, 2013
1 parent af0300b commit b7eda3b
Show file tree
Hide file tree
Showing 149 changed files with 507 additions and 12,197 deletions.
3 changes: 3 additions & 0 deletions iphone/Barcodes/Barcodes.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,7 @@
"-Objc",
);
PRODUCT_NAME = Barcodes;
TARGETED_DEVICE_FAMILY = "1,2";
VALID_ARCHS = "armv7 armv7s";
};
name = Debug;
Expand All @@ -604,6 +605,7 @@
);
PRODUCT_NAME = Barcodes;
PROVISIONING_PROFILE = "";
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
VALID_ARCHS = "armv7 armv7s";
};
Expand Down Expand Up @@ -662,6 +664,7 @@
"-Objc",
);
PRODUCT_NAME = Barcodes;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
VALID_ARCHS = "armv7 armv7s";
};
Expand Down
2 changes: 1 addition & 1 deletion iphone/Barcodes/Classes/ScanViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPa
return TITLE_HEIGHT;
} else if (indexPath.row == 1) {
CGSize size = [[result stringForDisplay] sizeWithFont:bodyFont constrainedToSize:CGSizeMake(280.0, TEXT_VIEW_HEIGHT) lineBreakMode:UILineBreakModeWordWrap];
#ifdef DEBUG
#ifdef ZXING_DEBUG
NSLog(@"text size = %f", size.height);
#endif
return fminf(TEXT_VIEW_HEIGHT, fmaxf(44, size.height + 24));
Expand Down
11 changes: 6 additions & 5 deletions iphone/Barcodes/Classes/ZXMainViewController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
//

#import "ZXMainViewController.h"
#import <QRCodeReader.h>
#import <MultiFormatReader.h>
#import <UniversalResultParser.h>
#import <ParsedResult.h>
#import <ResultAction.h>
Expand Down Expand Up @@ -52,7 +52,7 @@ - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interface

- (IBAction)scan:(id)sender {
ZXingWidgetController *widController = [[ZXingWidgetController alloc] initWithDelegate:self showCancel:YES OneDMode:NO];
QRCodeReader* qrcodeReader = [[QRCodeReader alloc] init];
MultiFormatReader* qrcodeReader = [[MultiFormatReader alloc] init];
NSSet *readers = [[NSSet alloc ] initWithObjects:qrcodeReader,nil];
[qrcodeReader release];
widController.readers = readers;
Expand Down Expand Up @@ -109,7 +109,7 @@ - (void)dealloc {
#pragma mark ZXingDelegateMethods
- (void)zxingController:(ZXingWidgetController*)controller didScanResult:(NSString *)resultString {
[self dismissModalViewControllerAnimated:YES];
#ifdef DEBUG
#ifdef ZXING_DEBUG
NSLog(@"result has %d actions", actions ? 0 : actions.count);
#endif
Scan * scan = [[Database sharedDatabase] addScanWithText:resultString];
Expand Down Expand Up @@ -175,6 +175,7 @@ - (void)zxingControllerDidCancel:(ZXingWidgetController*)controller {
cancelButtonTitle:@"Cancel"
otherButtonTitles:@"Return", nil];
[alert show];
[alert release];
}
}

Expand All @@ -195,15 +196,15 @@ - (void)performResultAction {

if (self.actions.count == 1) {
ResultAction *action = [self.actions lastObject];
#ifdef DEBUG
#ifdef ZXING_DEBUG
NSLog(@"Result has the single action, (%@) '%@', performing it",
NSStringFromClass([action class]), [action title]);
#endif
[self performSelector:@selector(confirmAndPerformAction:)
withObject:action
afterDelay:0.0];
} else {
#ifdef DEBUG
#ifdef ZXING_DEBUG
NSLog(@"Result has multiple actions, popping up an action sheet");
#endif
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithFrame:self.view.bounds];
Expand Down
59 changes: 10 additions & 49 deletions iphone/ScanTest/Classes/RootViewController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -16,35 +16,7 @@
*/

#import "RootViewController.h"

#ifndef ZXQR
#define ZXQR 1
#endif

#if ZXQR
#import "QRCodeReader.h"
#endif

#ifndef ZXAZ
#define ZXAZ 1
#endif

#if ZXAZ
#import "AztecReader.h"
#endif

#ifndef ZX1D
#define ZX1D 1
#endif

#if ZX1D
#import "MultiFormatOneDReader.h"
#endif

@interface RootViewController()

@end

#import "MultiFormatReader.h"

@implementation RootViewController
@synthesize resultsView;
Expand All @@ -65,33 +37,20 @@ - (IBAction)scanPressed:(id)sender {

NSMutableSet *readers = [[NSMutableSet alloc ] init];

#if ZXQR
QRCodeReader* qrcodeReader = [[QRCodeReader alloc] init];
[readers addObject:qrcodeReader];
[qrcodeReader release];
#endif

#if ZXAZ
AztecReader *aztecReader = [[AztecReader alloc] init];
[readers addObject:aztecReader];
[aztecReader release];
#endif

#if ZX1D
{
MultiFormatOneDReader* reader = [[MultiFormatOneDReader alloc] init];
[readers addObject:reader];
[reader release];
}
#endif
MultiFormatReader* reader = [[MultiFormatReader alloc] init];
[readers addObject:reader];
[reader release];

widController.readers = readers;
[readers release];

NSBundle *mainBundle = [NSBundle mainBundle];
widController.soundToPlay =
[NSURL fileURLWithPath:[mainBundle pathForResource:@"beep-beep" ofType:@"aiff"] isDirectory:NO];

[self presentModalViewController:widController animated:YES];
// [self presentViewController:widController animated:YES completion:nil];

[widController release];
}

Expand All @@ -105,10 +64,12 @@ - (void)zxingController:(ZXingWidgetController*)controller didScanResult:(NSStri
[resultsView setNeedsDisplay];
}
[self dismissModalViewControllerAnimated:NO];
// [self dismissViewControllerAnimated:NO completion:nil];
}

- (void)zxingControllerDidCancel:(ZXingWidgetController*)controller {
[self dismissModalViewControllerAnimated:YES];
[self dismissModalViewControllerAnimated:NO];
// [self dismissViewControllerAnimated:YES completion:nil];
}

- (void)viewDidUnload {
Expand Down
10 changes: 6 additions & 4 deletions iphone/ScanTest/ScanTest-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleDisplayName</key>
Expand All @@ -30,5 +26,11 @@
<true/>
<key>NSMainNibFile</key>
<string>MainWindow</string>
<key>NSMainNibFile~ipad</key>
<string>MainWindow-iPad</string>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
</dict>
</plist>
16 changes: 16 additions & 0 deletions iphone/ScanTest/ScanTest.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
3B0A5DB91444C492000EC568 /* Icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 3B0A5DB81444C492000EC568 /* Icon.png */; };
3B331CEE161BB74E007313B6 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 3B331CED161BB74E007313B6 /* [email protected] */; };
3B43FDCB15939575001CD5C9 /* libZXingWidget.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1F027F7E11A7BAD4006B06DE /* libZXingWidget.a */; };
3B6AA67A1710EF3400DF84C0 /* MainWindow-iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 3B6AA6791710EF3400DF84C0 /* MainWindow-iPad.xib */; };
3BCED5C8120F84C900131FA0 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3BCED5C7120F84C900131FA0 /* AVFoundation.framework */; };
3BCED5CE120F84E000131FA0 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3BCED5CD120F84E000131FA0 /* CoreVideo.framework */; };
3BCED5EB120F885C00131FA0 /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3BCED5EA120F885C00131FA0 /* CoreMedia.framework */; };
Expand Down Expand Up @@ -67,6 +68,7 @@
28F335F01007B36200424DE2 /* RootViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = RootViewController.xib; sourceTree = "<group>"; };
3B0A5DB81444C492000EC568 /* Icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Icon.png; sourceTree = "<group>"; };
3B331CED161BB74E007313B6 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
3B6AA6791710EF3400DF84C0 /* MainWindow-iPad.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = "MainWindow-iPad.xib"; path = "iPad/MainWindow-iPad.xib"; sourceTree = "<group>"; };
3BCED5C7120F84C900131FA0 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; };
3BCED5CD120F84E000131FA0 /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = System/Library/Frameworks/CoreVideo.framework; sourceTree = SDKROOT; };
3BCED5EA120F885C00131FA0 /* CoreMedia.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMedia.framework; path = System/Library/Frameworks/CoreMedia.framework; sourceTree = SDKROOT; };
Expand Down Expand Up @@ -133,6 +135,7 @@
080E96DDFE201D6D7F000001 /* Classes */,
29B97315FDCFA39411CA2CEA /* Other Sources */,
29B97317FDCFA39411CA2CEA /* Resources */,
3B6AA6781710EF3400DF84C0 /* iPad */,
29B97323FDCFA39411CA2CEA /* Frameworks */,
19C28FACFE9D520D11CA2CBB /* Products */,
);
Expand Down Expand Up @@ -175,6 +178,14 @@
name = Frameworks;
sourceTree = "<group>";
};
3B6AA6781710EF3400DF84C0 /* iPad */ = {
isa = PBXGroup;
children = (
3B6AA6791710EF3400DF84C0 /* MainWindow-iPad.xib */,
);
name = iPad;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
Expand Down Expand Up @@ -257,6 +268,7 @@
E548755C119C62B9001CC0F8 /* beep-beep.aiff in Resources */,
3B0A5DB91444C492000EC568 /* Icon.png in Resources */,
3B331CEE161BB74E007313B6 /* [email protected] in Resources */,
3B6AA67A1710EF3400DF84C0 /* MainWindow-iPad.xib in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -298,13 +310,15 @@
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
"GCC_THUMB_SUPPORT[arch=armv6]" = NO;
INFOPLIST_FILE = "ScanTest-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 4.3;
LIBRARY_SEARCH_PATHS = "$(inherited)";
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "";
PRESERVE_DEAD_CODE_INITS_AND_TERMS = YES;
PRODUCT_NAME = ScanTest;
"PROVISIONING_PROFILE[sdk=*]" = "";
STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = dynamic;
TARGETED_DEVICE_FAMILY = "1,2";
};
name = Debug;
};
Expand All @@ -319,7 +333,9 @@
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
"GCC_THUMB_SUPPORT[arch=armv6]" = NO;
INFOPLIST_FILE = "ScanTest-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 4.3;
PRODUCT_NAME = ScanTest;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
name = Release;
Expand Down
Loading

0 comments on commit b7eda3b

Please sign in to comment.