diff --git a/iphone/Barcodes/Barcodes-Info.plist b/iphone/Barcodes/Barcodes-Info.plist
index 041d4ac0a..5b2e1bd07 100644
--- a/iphone/Barcodes/Barcodes-Info.plist
+++ b/iphone/Barcodes/Barcodes-Info.plist
@@ -6,6 +6,8 @@
English
CFBundleDisplayName
${PRODUCT_NAME}
+ CFBundleDocumentTypes
+
CFBundleExecutable
${EXECUTABLE_NAME}
CFBundleIconFile
@@ -20,13 +22,37 @@
APPL
CFBundleSignature
????
+ CFBundleURLTypes
+
+
+ CFBundleTypeRole
+ Viewer
+ CFBundleURLIconFile
+ icon@2x
+ CFBundleURLName
+ com.rpechayr.zxing
+ CFBundleURLSchemes
+
+ zxing
+
+
+
CFBundleVersion
1.0
LSRequiresIPhoneOS
NSMainNibFile
MainWindow
+ UIRequiredDeviceCapabilities
+
+ still-camera
+ video-camera
+
UIStatusBarHidden
+ UTExportedTypeDeclarations
+
+ UTImportedTypeDeclarations
+
diff --git a/iphone/Barcodes/Barcodes.xcodeproj/project.pbxproj b/iphone/Barcodes/Barcodes.xcodeproj/project.pbxproj
index 88ee6576f..d8e6933ee 100755
--- a/iphone/Barcodes/Barcodes.xcodeproj/project.pbxproj
+++ b/iphone/Barcodes/Barcodes.xcodeproj/project.pbxproj
@@ -575,6 +575,41 @@
};
name = Release;
};
+ 1F81B3E012F1E42200659778 /* Distribution */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution: Romain Pechayre";
+ GCC_C_LANGUAGE_STANDARD = c99;
+ GCC_VERSION = 4.2;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ HEADER_SEARCH_PATHS = (
+ ../../cpp/core/src,
+ "../ZXingWidget/Classes/**",
+ );
+ IPHONEOS_DEPLOYMENT_TARGET = 4.1;
+ OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
+ PREBINDING = NO;
+ "PROVISIONING_PROFILE[sdk=iphoneos*]" = "27669F64-E861-4AE5-B39E-E93E68BFC37D";
+ SDKROOT = iphoneos;
+ };
+ name = Distribution;
+ };
+ 1F81B3E112F1E42200659778 /* Distribution */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = YES;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = Barcodes_Prefix.pch;
+ GCC_VERSION = 4.2;
+ INFOPLIST_FILE = "Barcodes-Info.plist";
+ PRODUCT_NAME = Barcodes;
+ VALIDATE_PRODUCT = YES;
+ };
+ name = Distribution;
+ };
C01FCF4F08A954540054247B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
@@ -582,7 +617,7 @@
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: Romain Pechayre (2CQ4EGKG4S)";
GCC_C_LANGUAGE_STANDARD = c99;
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
- GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
+ GCC_VERSION = 4.2;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = (
@@ -591,8 +626,8 @@
);
IPHONEOS_DEPLOYMENT_TARGET = 4.1;
PREBINDING = NO;
- "PROVISIONING_PROFILE[sdk=iphoneos*]" = "A74F7EF8-F2D5-4961-891C-BB2D09877990";
- SDKROOT = iphoneos4.2;
+ "PROVISIONING_PROFILE[sdk=iphoneos*]" = "613CA1B9-372B-44AF-BDD8-9F204D0C27C9";
+ SDKROOT = iphoneos;
};
name = Debug;
};
@@ -602,6 +637,7 @@
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
GCC_C_LANGUAGE_STANDARD = c99;
+ GCC_VERSION = 4.2;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = (
@@ -623,6 +659,7 @@
buildConfigurations = (
1D6058940D05DD3E006BFB54 /* Debug */,
1D6058950D05DD3E006BFB54 /* Release */,
+ 1F81B3E112F1E42200659778 /* Distribution */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
@@ -632,6 +669,7 @@
buildConfigurations = (
C01FCF4F08A954540054247B /* Debug */,
C01FCF5008A954540054247B /* Release */,
+ 1F81B3E012F1E42200659778 /* Distribution */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
diff --git a/iphone/Barcodes/Barcodes.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/iphone/Barcodes/Barcodes.xcodeproj/project.xcworkspace/contents.xcworkspacedata
new file mode 100644
index 000000000..b9620b8ff
--- /dev/null
+++ b/iphone/Barcodes/Barcodes.xcodeproj/project.xcworkspace/contents.xcworkspacedata
@@ -0,0 +1,7 @@
+
+
+
+
+
diff --git a/iphone/ZXingWidget/Classes/OverlayView.h b/iphone/ZXingWidget/Classes/OverlayView.h
index 641211b9a..9ea0d1443 100755
--- a/iphone/ZXingWidget/Classes/OverlayView.h
+++ b/iphone/ZXingWidget/Classes/OverlayView.h
@@ -26,12 +26,14 @@
id delegate;
BOOL oneDMode;
CGRect cropRect;
+ NSString *displayedMessage;
}
@property (nonatomic, retain) NSMutableArray* points;
@property (nonatomic, assign) id delegate;
@property (nonatomic, assign) BOOL oneDMode;
@property (nonatomic, assign) CGRect cropRect;
+@property (nonatomic, copy) NSString *displayedMessage;
- (id)initWithFrame:(CGRect)theFrame cancelEnabled:(BOOL)isCancelEnabled oneDMode:(BOOL)isOneDModeEnabled;
diff --git a/iphone/ZXingWidget/Classes/OverlayView.m b/iphone/ZXingWidget/Classes/OverlayView.m
index 627a1b2a7..f51f65e17 100755
--- a/iphone/ZXingWidget/Classes/OverlayView.m
+++ b/iphone/ZXingWidget/Classes/OverlayView.m
@@ -31,6 +31,7 @@ static const CGFloat kPadding = 10;
@synthesize cancelButton;
@synthesize cropRect;
@synthesize instructionsLabel;
+@synthesize displayedMessage;
////////////////////////////////////////////////////////////////////////////////////////////////////
- (id) initWithFrame:(CGRect)theFrame cancelEnabled:(BOOL)isCancelEnabled oneDMode:(BOOL)isOneDModeEnabled {
@@ -63,7 +64,6 @@ static const CGFloat kPadding = 10;
[self addSubview:cancelButton];
[self addSubview:imageView];
}
-
}
return self;
}
@@ -80,6 +80,7 @@ static const CGFloat kPadding = 10;
[imageView release];
[_points release];
[instructionsLabel release];
+ [displayedMessage release];
[super dealloc];
}
@@ -124,9 +125,14 @@ static const CGFloat kPadding = 10;
return point;
}
+#define kTextMargin 10
+
////////////////////////////////////////////////////////////////////////////////////////////////////
- (void)drawRect:(CGRect)rect {
[super drawRect:rect];
+ if (displayedMessage == nil) {
+ self.displayedMessage = @"Place a barcode inside the viewfinder rectangle to scan it.";
+ }
CGContextRef c = UIGraphicsGetCurrentContext();
if (nil != _points) {
@@ -149,13 +155,11 @@ static const CGFloat kPadding = 10;
CGContextShowTextAtPoint(c, 74.0, 285.0, text, 49);
}
else {
- char *text = "Place a barcode inside the";
- char *text2 = "viewfinder rectangle to scan it.";
- CGContextSelectFont(c, "Helvetica", 18, kCGEncodingMacRoman);
- CGContextScaleCTM(c, -1.0, 1.0);
- CGContextRotateCTM(c, M_PI);
- CGContextShowTextAtPoint(c, 48.0, -45.0, text, 26);
- CGContextShowTextAtPoint(c, 33.0, -70.0, text2, 32);
+ UIFont *font = [UIFont systemFontOfSize:18];
+ CGSize constraint = CGSizeMake(rect.size.width - 2 * kTextMargin, cropRect.origin.y);
+ CGSize displaySize = [displayedMessage sizeWithFont:font constrainedToSize:constraint];
+ CGRect displayRect = CGRectMake((rect.size.width - displaySize.width) / 2 , cropRect.origin.y - displaySize.height, displaySize.width, displaySize.height);
+ [self.displayedMessage drawInRect:displayRect withFont:font lineBreakMode:UILineBreakModeWordWrap alignment:UITextAlignmentCenter];
}
CGContextRestoreGState(c);
int offset = rect.size.width / 2;
diff --git a/iphone/ZXingWidget/Classes/ZXingWidgetController.h b/iphone/ZXingWidget/Classes/ZXingWidgetController.h
index 7a52a97f0..a3e36c45e 100755
--- a/iphone/ZXingWidget/Classes/ZXingWidgetController.h
+++ b/iphone/ZXingWidget/Classes/ZXingWidgetController.h
@@ -63,6 +63,9 @@
- (id)initWithDelegate:(id)delegate showCancel:(BOOL)shouldShowCancel OneDMode:(BOOL)shouldUseoOneDMode;
- (BOOL)fixedFocus;
+- (void)setTorch:(BOOL)status;
+- (BOOL)torchIsOn;
+
@end
@protocol ZXingDelegate
diff --git a/iphone/ZXingWidget/Classes/ZXingWidgetController.m b/iphone/ZXingWidget/Classes/ZXingWidgetController.m
index e73ff7bb2..409055a2b 100755
--- a/iphone/ZXingWidget/Classes/ZXingWidgetController.m
+++ b/iphone/ZXingWidget/Classes/ZXingWidgetController.m
@@ -284,6 +284,9 @@
}
*/
+#pragma mark -
+#pragma mark AVFoundation
+
- (void)initCapture {
#if HAS_AVFF
AVCaptureDeviceInput *captureInput =
@@ -470,4 +473,39 @@ didOutputSampleBuffer:(CMSampleBufferRef)sampleBuffer
#endif
}
+#pragma mark - Torch
+
+- (void)setTorch:(BOOL)status {
+ Class captureDeviceClass = NSClassFromString(@"AVCaptureDevice");
+ if (captureDeviceClass != nil) {
+
+ AVCaptureDevice *device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
+
+ [device lockForConfiguration:nil];
+ if ( [device hasTorch] ) {
+ if ( status ) {
+ [device setTorchMode:AVCaptureTorchModeOn];
+ } else {
+ [device setTorchMode:AVCaptureTorchModeOn];
+ }
+ }
+ [device unlockForConfiguration];
+
+ }
+}
+
+- (BOOL)torchIsOn {
+ Class captureDeviceClass = NSClassFromString(@"AVCaptureDevice");
+ if (captureDeviceClass != nil) {
+
+ AVCaptureDevice *device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
+
+ if ( [device hasTorch] ) {
+ return [device torchMode] == AVCaptureTorchModeOn;
+ }
+ [device unlockForConfiguration];
+ }
+ return NO;
+}
+
@end
diff --git a/iphone/ZXingWidget/Classes/parsedResults/BusinessCardParsedResult.m b/iphone/ZXingWidget/Classes/parsedResults/BusinessCardParsedResult.m
index ff8334b9f..a1a42d8e2 100644
--- a/iphone/ZXingWidget/Classes/parsedResults/BusinessCardParsedResult.m
+++ b/iphone/ZXingWidget/Classes/parsedResults/BusinessCardParsedResult.m
@@ -35,6 +35,7 @@
- (NSString *)stringForDisplay {
NSMutableString *result = [NSMutableString stringWithString:self.name];
+ if (self.jobTitle) [result appendFormat:@"\n%@",self.jobTitle];
if (self.organization) [result appendFormat:@"\n%@",self.organization];
if (self.phoneNumbers) {
for (NSString *number in self.phoneNumbers) {
diff --git a/iphone/ZXingWidget/ZXingWidget.xcodeproj/project.pbxproj b/iphone/ZXingWidget/ZXingWidget.xcodeproj/project.pbxproj
index 10d158064..f26153c4e 100644
--- a/iphone/ZXingWidget/ZXingWidget.xcodeproj/project.pbxproj
+++ b/iphone/ZXingWidget/ZXingWidget.xcodeproj/project.pbxproj
@@ -1181,6 +1181,7 @@
);
PRESERVE_DEAD_CODE_INITS_AND_TERMS = NO;
PRODUCT_NAME = ZXingWidget;
+ SDKROOT = iphoneos;
SEPARATE_STRIP = NO;
SKIP_INSTALL = YES;
};
@@ -1198,6 +1199,7 @@
HEADER_SEARCH_PATHS = ../../cpp/core/src;
INSTALL_PATH = /usr/local/lib;
PRODUCT_NAME = ZXingWidget;
+ SDKROOT = iphoneos;
};
name = Release;
};
diff --git a/iphone/ZXingWidget/ZXingWidget.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/iphone/ZXingWidget/ZXingWidget.xcodeproj/project.xcworkspace/contents.xcworkspacedata
new file mode 100644
index 000000000..19590b390
--- /dev/null
+++ b/iphone/ZXingWidget/ZXingWidget.xcodeproj/project.xcworkspace/contents.xcworkspacedata
@@ -0,0 +1,7 @@
+
+
+
+
+