[iphone/barcodes] integration of archive barcodes view in progress. Default images added, including version suitable for iPhone 4
git-svn-id: https://zxing.googlecode.com/svn/trunk@1654 59b500cc-1b3d-0410-9834-0bbf25fbcc57
|
@ -33,6 +33,24 @@
|
||||||
1FB432881290295C002D63E8 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1FB4327F1290295C002D63E8 /* MainWindow.xib */; };
|
1FB432881290295C002D63E8 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1FB4327F1290295C002D63E8 /* MainWindow.xib */; };
|
||||||
1FB432891290295C002D63E8 /* Message.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1FB432811290295C002D63E8 /* Message.xib */; };
|
1FB432891290295C002D63E8 /* Message.xib in Resources */ = {isa = PBXBuildFile; fileRef = 1FB432811290295C002D63E8 /* Message.xib */; };
|
||||||
1FB4352E12904F56002D63E8 /* MessageViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1FB4352D12904F56002D63E8 /* MessageViewController.m */; };
|
1FB4352E12904F56002D63E8 /* MessageViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1FB4352D12904F56002D63E8 /* MessageViewController.m */; };
|
||||||
|
1FB4365712918DA9002D63E8 /* ArchiveController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1FB4365412918DA9002D63E8 /* ArchiveController.m */; };
|
||||||
|
1FB4365812918DA9002D63E8 /* Database.m in Sources */ = {isa = PBXBuildFile; fileRef = 1FB4365612918DA9002D63E8 /* Database.m */; };
|
||||||
|
1FB4366512918E90002D63E8 /* business-card.png in Resources */ = {isa = PBXBuildFile; fileRef = 1FB4365A12918E90002D63E8 /* business-card.png */; };
|
||||||
|
1FB4366612918E90002D63E8 /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = 1FB4365B12918E90002D63E8 /* Default.png */; };
|
||||||
|
1FB4366712918E90002D63E8 /* email.png in Resources */ = {isa = PBXBuildFile; fileRef = 1FB4365C12918E90002D63E8 /* email.png */; };
|
||||||
|
1FB4366812918E90002D63E8 /* filmroll-2.png in Resources */ = {isa = PBXBuildFile; fileRef = 1FB4365D12918E90002D63E8 /* filmroll-2.png */; };
|
||||||
|
1FB4366912918E90002D63E8 /* link1.png in Resources */ = {isa = PBXBuildFile; fileRef = 1FB4365E12918E90002D63E8 /* link1.png */; };
|
||||||
|
1FB4366A12918E90002D63E8 /* link2.png in Resources */ = {isa = PBXBuildFile; fileRef = 1FB4365F12918E90002D63E8 /* link2.png */; };
|
||||||
|
1FB4366B12918E90002D63E8 /* map-pin.png in Resources */ = {isa = PBXBuildFile; fileRef = 1FB4366012918E90002D63E8 /* map-pin.png */; };
|
||||||
|
1FB4366C12918E90002D63E8 /* phone.png in Resources */ = {isa = PBXBuildFile; fileRef = 1FB4366112918E90002D63E8 /* phone.png */; };
|
||||||
|
1FB4366D12918E90002D63E8 /* photolib.png in Resources */ = {isa = PBXBuildFile; fileRef = 1FB4366212918E90002D63E8 /* photolib.png */; };
|
||||||
|
1FB4366E12918E90002D63E8 /* sms.png in Resources */ = {isa = PBXBuildFile; fileRef = 1FB4366312918E90002D63E8 /* sms.png */; };
|
||||||
|
1FB4366F12918E90002D63E8 /* text.png in Resources */ = {isa = PBXBuildFile; fileRef = 1FB4366412918E90002D63E8 /* text.png */; };
|
||||||
|
1FB4367512918F63002D63E8 /* Scan.m in Sources */ = {isa = PBXBuildFile; fileRef = 1FB4367412918F63002D63E8 /* Scan.m */; };
|
||||||
|
1FB4367D12918FAF002D63E8 /* ScanCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 1FB4367C12918FAF002D63E8 /* ScanCell.m */; };
|
||||||
|
1FB4369612918FF0002D63E8 /* ScanViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 1FB4369512918FF0002D63E8 /* ScanViewController.m */; };
|
||||||
|
1FB4369A12919014002D63E8 /* libsqlite3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 1FB4369912919014002D63E8 /* libsqlite3.dylib */; };
|
||||||
|
1FB436DF129194E7002D63E8 /* scans.db in Resources */ = {isa = PBXBuildFile; fileRef = 1FB436DE129194E7002D63E8 /* scans.db */; };
|
||||||
288765FD0DF74451002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765FC0DF74451002DB57D /* CoreGraphics.framework */; };
|
288765FD0DF74451002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765FC0DF74451002DB57D /* CoreGraphics.framework */; };
|
||||||
28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 28AD733E0D9D9553002E5188 /* MainWindow.xib */; };
|
28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 28AD733E0D9D9553002E5188 /* MainWindow.xib */; };
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
@ -98,6 +116,29 @@
|
||||||
1FB4329712902973002D63E8 /* sv */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = sv; path = sv.lproj/Message.xib; sourceTree = "<group>"; };
|
1FB4329712902973002D63E8 /* sv */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = sv; path = sv.lproj/Message.xib; sourceTree = "<group>"; };
|
||||||
1FB4352C12904F56002D63E8 /* MessageViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MessageViewController.h; sourceTree = "<group>"; };
|
1FB4352C12904F56002D63E8 /* MessageViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MessageViewController.h; sourceTree = "<group>"; };
|
||||||
1FB4352D12904F56002D63E8 /* MessageViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MessageViewController.m; sourceTree = "<group>"; };
|
1FB4352D12904F56002D63E8 /* MessageViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MessageViewController.m; sourceTree = "<group>"; };
|
||||||
|
1FB4365312918DA9002D63E8 /* ArchiveController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArchiveController.h; sourceTree = "<group>"; };
|
||||||
|
1FB4365412918DA9002D63E8 /* ArchiveController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ArchiveController.m; sourceTree = "<group>"; };
|
||||||
|
1FB4365512918DA9002D63E8 /* Database.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Database.h; sourceTree = "<group>"; };
|
||||||
|
1FB4365612918DA9002D63E8 /* Database.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Database.m; sourceTree = "<group>"; };
|
||||||
|
1FB4365A12918E90002D63E8 /* business-card.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "business-card.png"; path = "images/business-card.png"; sourceTree = "<group>"; };
|
||||||
|
1FB4365B12918E90002D63E8 /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Default.png; path = images/Default.png; sourceTree = "<group>"; };
|
||||||
|
1FB4365C12918E90002D63E8 /* email.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = email.png; path = images/email.png; sourceTree = "<group>"; };
|
||||||
|
1FB4365D12918E90002D63E8 /* filmroll-2.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "filmroll-2.png"; path = "images/filmroll-2.png"; sourceTree = "<group>"; };
|
||||||
|
1FB4365E12918E90002D63E8 /* link1.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = link1.png; path = images/link1.png; sourceTree = "<group>"; };
|
||||||
|
1FB4365F12918E90002D63E8 /* link2.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = link2.png; path = images/link2.png; sourceTree = "<group>"; };
|
||||||
|
1FB4366012918E90002D63E8 /* map-pin.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "map-pin.png"; path = "images/map-pin.png"; sourceTree = "<group>"; };
|
||||||
|
1FB4366112918E90002D63E8 /* phone.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = phone.png; path = images/phone.png; sourceTree = "<group>"; };
|
||||||
|
1FB4366212918E90002D63E8 /* photolib.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = photolib.png; path = images/photolib.png; sourceTree = "<group>"; };
|
||||||
|
1FB4366312918E90002D63E8 /* sms.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = sms.png; path = images/sms.png; sourceTree = "<group>"; };
|
||||||
|
1FB4366412918E90002D63E8 /* text.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = text.png; path = images/text.png; sourceTree = "<group>"; };
|
||||||
|
1FB4367312918F63002D63E8 /* Scan.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Scan.h; sourceTree = "<group>"; };
|
||||||
|
1FB4367412918F63002D63E8 /* Scan.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Scan.m; sourceTree = "<group>"; };
|
||||||
|
1FB4367B12918FAF002D63E8 /* ScanCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScanCell.h; sourceTree = "<group>"; };
|
||||||
|
1FB4367C12918FAF002D63E8 /* ScanCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ScanCell.m; sourceTree = "<group>"; };
|
||||||
|
1FB4369412918FF0002D63E8 /* ScanViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScanViewController.h; sourceTree = "<group>"; };
|
||||||
|
1FB4369512918FF0002D63E8 /* ScanViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ScanViewController.m; sourceTree = "<group>"; };
|
||||||
|
1FB4369912919014002D63E8 /* libsqlite3.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libsqlite3.dylib; path = usr/lib/libsqlite3.dylib; sourceTree = SDKROOT; };
|
||||||
|
1FB436DE129194E7002D63E8 /* scans.db */ = {isa = PBXFileReference; lastKnownFileType = file; path = scans.db; sourceTree = "<group>"; };
|
||||||
288765FC0DF74451002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
|
288765FC0DF74451002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
|
||||||
28AD733E0D9D9553002E5188 /* MainWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MainWindow.xib; sourceTree = "<group>"; };
|
28AD733E0D9D9553002E5188 /* MainWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MainWindow.xib; sourceTree = "<group>"; };
|
||||||
29B97316FDCFA39411CA2CEA /* main.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = main.mm; sourceTree = "<group>"; };
|
29B97316FDCFA39411CA2CEA /* main.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = main.mm; sourceTree = "<group>"; };
|
||||||
|
@ -121,6 +162,7 @@
|
||||||
1FB43100129008B9002D63E8 /* CoreMedia.framework in Frameworks */,
|
1FB43100129008B9002D63E8 /* CoreMedia.framework in Frameworks */,
|
||||||
1FB431AB12901D7D002D63E8 /* AddressBook.framework in Frameworks */,
|
1FB431AB12901D7D002D63E8 /* AddressBook.framework in Frameworks */,
|
||||||
1FB431B112901D8C002D63E8 /* AddressBookUI.framework in Frameworks */,
|
1FB431B112901D8C002D63E8 /* AddressBookUI.framework in Frameworks */,
|
||||||
|
1FB4369A12919014002D63E8 /* libsqlite3.dylib in Frameworks */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
@ -130,6 +172,16 @@
|
||||||
080E96DDFE201D6D7F000001 /* Classes */ = {
|
080E96DDFE201D6D7F000001 /* Classes */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
1FB4369412918FF0002D63E8 /* ScanViewController.h */,
|
||||||
|
1FB4369512918FF0002D63E8 /* ScanViewController.m */,
|
||||||
|
1FB4367B12918FAF002D63E8 /* ScanCell.h */,
|
||||||
|
1FB4367C12918FAF002D63E8 /* ScanCell.m */,
|
||||||
|
1FB4367312918F63002D63E8 /* Scan.h */,
|
||||||
|
1FB4367412918F63002D63E8 /* Scan.m */,
|
||||||
|
1FB4365312918DA9002D63E8 /* ArchiveController.h */,
|
||||||
|
1FB4365412918DA9002D63E8 /* ArchiveController.m */,
|
||||||
|
1FB4365512918DA9002D63E8 /* Database.h */,
|
||||||
|
1FB4365612918DA9002D63E8 /* Database.m */,
|
||||||
1FB4352C12904F56002D63E8 /* MessageViewController.h */,
|
1FB4352C12904F56002D63E8 /* MessageViewController.h */,
|
||||||
1FB4352D12904F56002D63E8 /* MessageViewController.m */,
|
1FB4352D12904F56002D63E8 /* MessageViewController.m */,
|
||||||
1D3623240D0F684500981E51 /* BarcodesAppDelegate.h */,
|
1D3623240D0F684500981E51 /* BarcodesAppDelegate.h */,
|
||||||
|
@ -168,6 +220,17 @@
|
||||||
1FB4302D128FFF46002D63E8 /* images */ = {
|
1FB4302D128FFF46002D63E8 /* images */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
1FB4365A12918E90002D63E8 /* business-card.png */,
|
||||||
|
1FB4365B12918E90002D63E8 /* Default.png */,
|
||||||
|
1FB4365C12918E90002D63E8 /* email.png */,
|
||||||
|
1FB4365D12918E90002D63E8 /* filmroll-2.png */,
|
||||||
|
1FB4365E12918E90002D63E8 /* link1.png */,
|
||||||
|
1FB4365F12918E90002D63E8 /* link2.png */,
|
||||||
|
1FB4366012918E90002D63E8 /* map-pin.png */,
|
||||||
|
1FB4366112918E90002D63E8 /* phone.png */,
|
||||||
|
1FB4366212918E90002D63E8 /* photolib.png */,
|
||||||
|
1FB4366312918E90002D63E8 /* sms.png */,
|
||||||
|
1FB4366412918E90002D63E8 /* text.png */,
|
||||||
1FB4303A129000B4002D63E8 /* ZxingLarge.png */,
|
1FB4303A129000B4002D63E8 /* ZxingLarge.png */,
|
||||||
1FB4302E128FFF56002D63E8 /* icon.png */,
|
1FB4302E128FFF56002D63E8 /* icon.png */,
|
||||||
1FB4302F128FFF56002D63E8 /* icon@2x.png */,
|
1FB4302F128FFF56002D63E8 /* icon@2x.png */,
|
||||||
|
@ -200,6 +263,7 @@
|
||||||
29B97317FDCFA39411CA2CEA /* Resources */ = {
|
29B97317FDCFA39411CA2CEA /* Resources */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
1FB436DE129194E7002D63E8 /* scans.db */,
|
||||||
1FB432751290295C002D63E8 /* About.html */,
|
1FB432751290295C002D63E8 /* About.html */,
|
||||||
1FB432771290295C002D63E8 /* DecoderView.xib */,
|
1FB432771290295C002D63E8 /* DecoderView.xib */,
|
||||||
1FB432791290295C002D63E8 /* Hints.html */,
|
1FB432791290295C002D63E8 /* Hints.html */,
|
||||||
|
@ -228,6 +292,7 @@
|
||||||
1FB430FF129008B9002D63E8 /* CoreMedia.framework */,
|
1FB430FF129008B9002D63E8 /* CoreMedia.framework */,
|
||||||
1FB431AA12901D7D002D63E8 /* AddressBook.framework */,
|
1FB431AA12901D7D002D63E8 /* AddressBook.framework */,
|
||||||
1FB431B012901D8C002D63E8 /* AddressBookUI.framework */,
|
1FB431B012901D8C002D63E8 /* AddressBookUI.framework */,
|
||||||
|
1FB4369912919014002D63E8 /* libsqlite3.dylib */,
|
||||||
);
|
);
|
||||||
name = Frameworks;
|
name = Frameworks;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
|
@ -314,6 +379,18 @@
|
||||||
1FB432871290295C002D63E8 /* Localizable.strings in Resources */,
|
1FB432871290295C002D63E8 /* Localizable.strings in Resources */,
|
||||||
1FB432881290295C002D63E8 /* MainWindow.xib in Resources */,
|
1FB432881290295C002D63E8 /* MainWindow.xib in Resources */,
|
||||||
1FB432891290295C002D63E8 /* Message.xib in Resources */,
|
1FB432891290295C002D63E8 /* Message.xib in Resources */,
|
||||||
|
1FB4366512918E90002D63E8 /* business-card.png in Resources */,
|
||||||
|
1FB4366612918E90002D63E8 /* Default.png in Resources */,
|
||||||
|
1FB4366712918E90002D63E8 /* email.png in Resources */,
|
||||||
|
1FB4366812918E90002D63E8 /* filmroll-2.png in Resources */,
|
||||||
|
1FB4366912918E90002D63E8 /* link1.png in Resources */,
|
||||||
|
1FB4366A12918E90002D63E8 /* link2.png in Resources */,
|
||||||
|
1FB4366B12918E90002D63E8 /* map-pin.png in Resources */,
|
||||||
|
1FB4366C12918E90002D63E8 /* phone.png in Resources */,
|
||||||
|
1FB4366D12918E90002D63E8 /* photolib.png in Resources */,
|
||||||
|
1FB4366E12918E90002D63E8 /* sms.png in Resources */,
|
||||||
|
1FB4366F12918E90002D63E8 /* text.png in Resources */,
|
||||||
|
1FB436DF129194E7002D63E8 /* scans.db in Resources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
@ -328,6 +405,11 @@
|
||||||
1D3623260D0F684500981E51 /* BarcodesAppDelegate.m in Sources */,
|
1D3623260D0F684500981E51 /* BarcodesAppDelegate.m in Sources */,
|
||||||
1FB430371290002C002D63E8 /* ZXMainViewController.mm in Sources */,
|
1FB430371290002C002D63E8 /* ZXMainViewController.mm in Sources */,
|
||||||
1FB4352E12904F56002D63E8 /* MessageViewController.m in Sources */,
|
1FB4352E12904F56002D63E8 /* MessageViewController.m in Sources */,
|
||||||
|
1FB4365712918DA9002D63E8 /* ArchiveController.m in Sources */,
|
||||||
|
1FB4365812918DA9002D63E8 /* Database.m in Sources */,
|
||||||
|
1FB4367512918F63002D63E8 /* Scan.m in Sources */,
|
||||||
|
1FB4367D12918FAF002D63E8 /* ScanCell.m in Sources */,
|
||||||
|
1FB4369612918FF0002D63E8 /* ScanViewController.m in Sources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
|
41
iphone/Barcodes/Classes/ArchiveController.h
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
//
|
||||||
|
// ArchiveController.h
|
||||||
|
// UIShowcase
|
||||||
|
//
|
||||||
|
// Created by Christian Brunschen on 29/05/2008.
|
||||||
|
/*
|
||||||
|
* Copyright 2008 ZXing authors
|
||||||
|
*
|
||||||
|
* 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 <UIKit/UIKit.h>
|
||||||
|
|
||||||
|
//@class DecoderViewController;
|
||||||
|
|
||||||
|
@interface ArchiveController : UITableViewController {
|
||||||
|
NSMutableArray *scans;
|
||||||
|
NSMutableArray *results;
|
||||||
|
// DecoderViewController *decoderViewController;
|
||||||
|
NSDateFormatter *dateFormatter;
|
||||||
|
}
|
||||||
|
|
||||||
|
@property (nonatomic, retain) NSMutableArray *scans;
|
||||||
|
@property (nonatomic, retain) NSMutableArray *results;
|
||||||
|
//@property (nonatomic, retain) DecoderViewController *decoderViewController;
|
||||||
|
@property (nonatomic, retain) NSDateFormatter *dateFormatter;
|
||||||
|
|
||||||
|
- (NSInteger)scanIndexForRow:(NSInteger)row;
|
||||||
|
- (id)init;
|
||||||
|
|
||||||
|
@end
|
160
iphone/Barcodes/Classes/ArchiveController.m
Normal file
|
@ -0,0 +1,160 @@
|
||||||
|
//
|
||||||
|
// ArchiveController.m
|
||||||
|
// UIShowcase
|
||||||
|
//
|
||||||
|
// Created by Christian Brunschen on 29/05/2008.
|
||||||
|
/*
|
||||||
|
* Copyright 2008 ZXing authors
|
||||||
|
*
|
||||||
|
* 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 "ArchiveController.h"
|
||||||
|
#import "Database.h"
|
||||||
|
#import "Scan.h"
|
||||||
|
#import "ResultParser.h"
|
||||||
|
#import "ParsedResult.h"
|
||||||
|
//#import "DecoderViewController.h"
|
||||||
|
#import "ScanViewController.h"
|
||||||
|
#import "ScanCell.h"
|
||||||
|
|
||||||
|
@implementation ArchiveController
|
||||||
|
|
||||||
|
@synthesize scans;
|
||||||
|
@synthesize results;
|
||||||
|
//@synthesize decoderViewController;
|
||||||
|
@synthesize dateFormatter;
|
||||||
|
|
||||||
|
- (id)init {
|
||||||
|
if ((self = [super initWithStyle:UITableViewStylePlain])) {
|
||||||
|
scans = [[NSMutableArray alloc] init];
|
||||||
|
results = [[NSMutableArray alloc] init];
|
||||||
|
dateFormatter = [[NSDateFormatter alloc] init];
|
||||||
|
}
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
||||||
|
return [scans count];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||||
|
return 44.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||||
|
static NSString *ScanIdentifier = @"ScanIdentifier";
|
||||||
|
|
||||||
|
ScanCell *cell = (ScanCell *)[tableView dequeueReusableCellWithIdentifier:ScanIdentifier];
|
||||||
|
if (cell == nil) {
|
||||||
|
cell = [[[ScanCell alloc] initWithFrame:CGRectZero reuseIdentifier:ScanIdentifier] autorelease];
|
||||||
|
}
|
||||||
|
|
||||||
|
// Configure the cell
|
||||||
|
int idx = [self scanIndexForRow:indexPath.row];
|
||||||
|
Scan *scan = [scans objectAtIndex:idx];
|
||||||
|
[cell setScan:scan];
|
||||||
|
return cell;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||||
|
//[decoderViewController showScan:[scans objectAtIndex:[self scanIndexForRow:indexPath.row]]];
|
||||||
|
int idx = [self scanIndexForRow:indexPath.row];
|
||||||
|
Scan *scan = [scans objectAtIndex:idx];
|
||||||
|
ParsedResult *result = [results objectAtIndex:idx];
|
||||||
|
ScanViewController *scanViewController = [[ScanViewController alloc] initWithResult:result forScan:scan];
|
||||||
|
[self.navigationController pushViewController:scanViewController animated:YES];
|
||||||
|
[scanViewController release];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||||
|
if (editingStyle == UITableViewCellEditingStyleDelete) {
|
||||||
|
int idx = [self scanIndexForRow:indexPath.row];
|
||||||
|
Scan *scan = [self.scans objectAtIndex:idx];
|
||||||
|
// delete the scan from the database ...
|
||||||
|
[[Database sharedDatabase] deleteScan:scan];
|
||||||
|
// ... delete the scan from our in-memory cache of the database ...
|
||||||
|
[scans removeObjectAtIndex:idx];
|
||||||
|
// ... delete the corresponding result from our in-memory cache ...
|
||||||
|
[results removeObjectAtIndex:idx];
|
||||||
|
// ... and remove the row from the table view.
|
||||||
|
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
|
||||||
|
// [tableView reloadData];
|
||||||
|
} else if (editingStyle == UITableViewCellEditingStyleInsert) {
|
||||||
|
// no insertions!
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void)dealloc {
|
||||||
|
[scans release];
|
||||||
|
[results release];
|
||||||
|
//[decoderViewController release];
|
||||||
|
[dateFormatter release];
|
||||||
|
[super dealloc];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void)viewDidLoad {
|
||||||
|
[super viewDidLoad];
|
||||||
|
self.title = NSLocalizedString(@"ScanArchiveTitle", @"Scan Archive");
|
||||||
|
self.navigationItem.rightBarButtonItem = [self editButtonItem];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void)viewWillAppear:(BOOL)animated {
|
||||||
|
[super viewWillAppear:animated];
|
||||||
|
self.scans = [NSMutableArray arrayWithArray:[[Database sharedDatabase] scans]];
|
||||||
|
self.results = [NSMutableArray arrayWithCapacity:self.scans.count];
|
||||||
|
for (Scan *scan in scans) {
|
||||||
|
[results addObject:[ResultParser parsedResultForString:scan.text]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)viewDidAppear:(BOOL)animated {
|
||||||
|
[super viewDidAppear:animated];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)viewWillDisappear:(BOOL)animated {
|
||||||
|
self.scans = nil;
|
||||||
|
self.results = nil;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)viewDidDisappear:(BOOL)animated {
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)didReceiveMemoryWarning {
|
||||||
|
[super didReceiveMemoryWarning];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSInteger)scanIndexForRow:(NSInteger)row {
|
||||||
|
return scans.count - 1 - row;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
41
iphone/Barcodes/Classes/Database.h
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
//
|
||||||
|
// Database.h
|
||||||
|
// ZXing
|
||||||
|
//
|
||||||
|
// Created by Christian Brunschen on 29/05/2008.
|
||||||
|
/*
|
||||||
|
* Copyright 2008 ZXing authors
|
||||||
|
*
|
||||||
|
* 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 <UIKit/UIKit.h>
|
||||||
|
#import <sqlite3.h>
|
||||||
|
|
||||||
|
@class Scan;
|
||||||
|
|
||||||
|
@interface Database : NSObject {
|
||||||
|
sqlite3 *connection;
|
||||||
|
int nextScanIdent;
|
||||||
|
}
|
||||||
|
|
||||||
|
@property sqlite3 *connection;
|
||||||
|
@property int nextScanIdent;
|
||||||
|
|
||||||
|
+ (id)sharedDatabase;
|
||||||
|
|
||||||
|
- (void)addScanWithText:(NSString *)text;
|
||||||
|
- (NSArray *)scans;
|
||||||
|
- (void)deleteScan:(Scan *)scan;
|
||||||
|
|
||||||
|
@end
|
115
iphone/Barcodes/Classes/Database.m
Normal file
|
@ -0,0 +1,115 @@
|
||||||
|
//
|
||||||
|
// Database.m
|
||||||
|
// ZXing
|
||||||
|
//
|
||||||
|
// Created by Christian Brunschen on 29/05/2008.
|
||||||
|
/*
|
||||||
|
* Copyright 2008 ZXing authors
|
||||||
|
*
|
||||||
|
* 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 "Database.h"
|
||||||
|
#import "Scan.h"
|
||||||
|
|
||||||
|
@implementation Database
|
||||||
|
|
||||||
|
static sqlite3_stmt *maxIdStatement;
|
||||||
|
static sqlite3_stmt *selectAllStatement;
|
||||||
|
static sqlite3_stmt *insertStatement;
|
||||||
|
static sqlite3_stmt *deleteStatement;
|
||||||
|
|
||||||
|
@synthesize connection;
|
||||||
|
@synthesize nextScanIdent;
|
||||||
|
|
||||||
|
static Database *sharedDatabase = nil;
|
||||||
|
|
||||||
|
+ (id)sharedDatabase {
|
||||||
|
if (!sharedDatabase) {
|
||||||
|
sharedDatabase = [[self alloc] init];
|
||||||
|
|
||||||
|
BOOL success;
|
||||||
|
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||||
|
NSError *error;
|
||||||
|
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
|
||||||
|
NSString *documentsDirectory = [paths objectAtIndex:0];
|
||||||
|
NSString *writableDBPath = [documentsDirectory stringByAppendingPathComponent:@"scans.db"];
|
||||||
|
success = [fileManager fileExistsAtPath:writableDBPath];
|
||||||
|
if (!success) {
|
||||||
|
// The writable database does not exist, so copy the default to the appropriate location.
|
||||||
|
NSString *defaultDBPath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"scans.db"];
|
||||||
|
success = [fileManager copyItemAtPath:defaultDBPath toPath:writableDBPath error:&error];
|
||||||
|
if (!success) {
|
||||||
|
NSAssert1(0, @"Failed to create writable database file with message '%@'.", [error localizedDescription]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sqlite3 *connection;
|
||||||
|
sqlite3_open([writableDBPath UTF8String], &connection);
|
||||||
|
sharedDatabase.connection = connection;
|
||||||
|
|
||||||
|
static const char *maxIdSql = "SELECT MAX(id) FROM SCAN";
|
||||||
|
sqlite3_prepare_v2(connection, maxIdSql, -1, &maxIdStatement, NULL);
|
||||||
|
|
||||||
|
static const char *selectAllSql = "SELECT id, text, stamp FROM SCAN ORDER BY id";
|
||||||
|
sqlite3_prepare_v2(connection, selectAllSql, -1, &selectAllStatement, NULL);
|
||||||
|
|
||||||
|
static const char *insertSql =
|
||||||
|
"INSERT INTO SCAN (id, text, stamp) VALUES (?, ?, ?)";
|
||||||
|
sqlite3_prepare_v2(connection, insertSql, -1, &insertStatement, NULL);
|
||||||
|
|
||||||
|
static const char *deleteSql = "DELETE FROM SCAN WHERE id = ?";
|
||||||
|
sqlite3_prepare_v2(connection, deleteSql, -1, &deleteStatement, NULL);
|
||||||
|
|
||||||
|
if (SQLITE_ROW == sqlite3_step(maxIdStatement)) {
|
||||||
|
int maxId = sqlite3_column_int(maxIdStatement, 0);
|
||||||
|
sharedDatabase.nextScanIdent = maxId + 1;
|
||||||
|
sqlite3_reset(maxIdStatement);
|
||||||
|
} else {
|
||||||
|
NSLog(@"failed to read max ID from database\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return sharedDatabase;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)addScanWithText:(NSString *)text {
|
||||||
|
sqlite3_bind_int(insertStatement, 1, nextScanIdent++);
|
||||||
|
sqlite3_bind_text(insertStatement, 2, [text UTF8String], -1, SQLITE_TRANSIENT);
|
||||||
|
sqlite3_bind_double(insertStatement, 3, [[NSDate date] timeIntervalSince1970]);
|
||||||
|
sqlite3_step(insertStatement);
|
||||||
|
sqlite3_reset(insertStatement);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSArray *)scans {
|
||||||
|
NSMutableArray *scans = [NSMutableArray array];
|
||||||
|
while (SQLITE_ROW == sqlite3_step(selectAllStatement)) {
|
||||||
|
int ident = sqlite3_column_int(selectAllStatement, 0);
|
||||||
|
NSString *text = [NSString stringWithUTF8String:(char *)sqlite3_column_text(selectAllStatement, 1)];
|
||||||
|
NSDate *stamp = [NSDate dateWithTimeIntervalSince1970:sqlite3_column_double(selectAllStatement, 2)];
|
||||||
|
Scan *scan = [[Scan alloc] initWithIdent:ident text:text stamp:stamp];
|
||||||
|
[scans addObject:scan];
|
||||||
|
[scan release];
|
||||||
|
}
|
||||||
|
sqlite3_reset(selectAllStatement);
|
||||||
|
return scans;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)deleteScan:(Scan *)scan {
|
||||||
|
sqlite3_bind_int(deleteStatement, 1, [scan ident]);
|
||||||
|
sqlite3_step(deleteStatement);
|
||||||
|
sqlite3_reset(deleteStatement);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@end
|
37
iphone/Barcodes/Classes/Scan.h
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
//
|
||||||
|
// Scan.h
|
||||||
|
// ZXing
|
||||||
|
//
|
||||||
|
// Created by Christian Brunschen on 29/05/2008.
|
||||||
|
/*
|
||||||
|
* Copyright 2008 ZXing authors
|
||||||
|
*
|
||||||
|
* 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 <UIKit/UIKit.h>
|
||||||
|
|
||||||
|
|
||||||
|
@interface Scan : NSObject {
|
||||||
|
NSInteger ident;
|
||||||
|
NSString *text;
|
||||||
|
NSDate *stamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
@property NSInteger ident;
|
||||||
|
@property (nonatomic, copy) NSString *text;
|
||||||
|
@property (nonatomic, retain) NSDate *stamp;
|
||||||
|
|
||||||
|
- (id)initWithIdent:(int)i text:(NSString *)t stamp:(NSDate *)s;
|
||||||
|
|
||||||
|
@end
|
40
iphone/Barcodes/Classes/Scan.m
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
//
|
||||||
|
// Scan.m
|
||||||
|
// ZXing
|
||||||
|
//
|
||||||
|
// Created by Christian Brunschen on 29/05/2008.
|
||||||
|
/*
|
||||||
|
* Copyright 2008 ZXing authors
|
||||||
|
*
|
||||||
|
* 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 "Scan.h"
|
||||||
|
|
||||||
|
|
||||||
|
@implementation Scan
|
||||||
|
|
||||||
|
@synthesize ident;
|
||||||
|
@synthesize text;
|
||||||
|
@synthesize stamp;
|
||||||
|
|
||||||
|
- (id)initWithIdent:(int)i text:(NSString *)t stamp:(NSDate *)s {
|
||||||
|
if ((self = [super init]) != nil) {
|
||||||
|
self.ident = i;
|
||||||
|
self.text = t;
|
||||||
|
self.stamp = s;
|
||||||
|
}
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
42
iphone/Barcodes/Classes/ScanCell.h
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
//
|
||||||
|
// ScanCell.h
|
||||||
|
// ZXing
|
||||||
|
//
|
||||||
|
// Created by Christian Brunschen on 30/06/2008.
|
||||||
|
/*
|
||||||
|
* Copyright 2008 ZXing authors
|
||||||
|
*
|
||||||
|
* 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 <UIKit/UIKit.h>
|
||||||
|
|
||||||
|
@class Scan;
|
||||||
|
@class ParsedResult;
|
||||||
|
|
||||||
|
@interface ScanCell : UITableViewCell {
|
||||||
|
Scan *scan;
|
||||||
|
ParsedResult *result;
|
||||||
|
UIImageView *imageView;
|
||||||
|
UILabel *textView;
|
||||||
|
UILabel *dateView;
|
||||||
|
UILabel *timeView;
|
||||||
|
}
|
||||||
|
|
||||||
|
@property (nonatomic, retain) Scan *scan;
|
||||||
|
@property (nonatomic, retain) UIImageView *imageView;
|
||||||
|
@property (nonatomic, retain) UILabel *textView;
|
||||||
|
@property (nonatomic, retain) UILabel *dateView;
|
||||||
|
@property (nonatomic, retain) UILabel *timeView;
|
||||||
|
|
||||||
|
@end
|
175
iphone/Barcodes/Classes/ScanCell.m
Normal file
|
@ -0,0 +1,175 @@
|
||||||
|
//
|
||||||
|
// ScanCell.m
|
||||||
|
// ZXing
|
||||||
|
//
|
||||||
|
// Created by Christian Brunschen on 30/06/2008.
|
||||||
|
/*
|
||||||
|
* Copyright 2008 ZXing authors
|
||||||
|
*
|
||||||
|
* 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 "ScanCell.h"
|
||||||
|
#import "Scan.h"
|
||||||
|
#import "ParsedResult.h"
|
||||||
|
#import "ResultParser.h"
|
||||||
|
|
||||||
|
static NSDateFormatter *_makeDateFormatter(NSDateFormatterStyle dateStyle,
|
||||||
|
NSDateFormatterStyle timeStyle) {
|
||||||
|
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
|
||||||
|
[dateFormatter setDateStyle:dateStyle];
|
||||||
|
[dateFormatter setTimeStyle:timeStyle];
|
||||||
|
return dateFormatter;
|
||||||
|
}
|
||||||
|
|
||||||
|
static NSString *_dateString(NSDate *date) {
|
||||||
|
static NSDateFormatter *dateFormatter = nil;
|
||||||
|
if (!dateFormatter) {
|
||||||
|
dateFormatter =
|
||||||
|
_makeDateFormatter(NSDateFormatterShortStyle, NSDateFormatterNoStyle);
|
||||||
|
}
|
||||||
|
return [dateFormatter stringFromDate:date];
|
||||||
|
}
|
||||||
|
|
||||||
|
static NSString *_timeString(NSDate *date) {
|
||||||
|
static NSDateFormatter *timeFormatter = nil;
|
||||||
|
if (!timeFormatter) {
|
||||||
|
timeFormatter =
|
||||||
|
|
||||||
|
_makeDateFormatter(NSDateFormatterNoStyle, NSDateFormatterShortStyle);
|
||||||
|
}
|
||||||
|
return [timeFormatter stringFromDate:date];
|
||||||
|
}
|
||||||
|
|
||||||
|
#define VIEW_PADDING 2.0
|
||||||
|
#define IMAGE_SIZE 40.0
|
||||||
|
#define EDITING_INSET 10.0
|
||||||
|
#define CONTENT_HEIGHT (IMAGE_SIZE + 2.0 * VIEW_PADDING)
|
||||||
|
#define DATE_TIME_WIDTH 50.0
|
||||||
|
|
||||||
|
@implementation ScanCell
|
||||||
|
|
||||||
|
@synthesize imageView;
|
||||||
|
@synthesize textView;
|
||||||
|
@synthesize dateView;
|
||||||
|
@synthesize timeView;
|
||||||
|
|
||||||
|
|
||||||
|
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
|
||||||
|
if ((self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])) {
|
||||||
|
imageView = [[UIImageView alloc] initWithFrame:CGRectZero];
|
||||||
|
imageView.contentMode = UIViewContentModeCenter;
|
||||||
|
[self.contentView addSubview:imageView];
|
||||||
|
|
||||||
|
textView = [[UILabel alloc] initWithFrame:CGRectZero];
|
||||||
|
textView.font = [UIFont boldSystemFontOfSize:[UIFont systemFontSize]];
|
||||||
|
textView.textAlignment = UITextAlignmentLeft;
|
||||||
|
textView.textColor = [UIColor blackColor];
|
||||||
|
[self.contentView addSubview:textView];
|
||||||
|
|
||||||
|
dateView = [[UILabel alloc] initWithFrame:CGRectZero];
|
||||||
|
dateView.font = [UIFont systemFontOfSize:(2 * [UIFont systemFontSize]) / 3];
|
||||||
|
dateView.textAlignment = UITextAlignmentRight;
|
||||||
|
dateView.textColor = [UIColor grayColor];
|
||||||
|
[self.contentView addSubview:dateView];
|
||||||
|
|
||||||
|
timeView = [[UILabel alloc] initWithFrame:CGRectZero];
|
||||||
|
timeView.font = [UIFont systemFontOfSize:(2 * [UIFont systemFontSize]) / 3];
|
||||||
|
timeView.textAlignment = UITextAlignmentRight;
|
||||||
|
timeView.textColor = [UIColor grayColor];
|
||||||
|
[self.contentView addSubview:timeView];
|
||||||
|
}
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (CGRect) _imageViewFrame {
|
||||||
|
CGRect frame = CGRectMake(VIEW_PADDING, VIEW_PADDING, IMAGE_SIZE, IMAGE_SIZE);
|
||||||
|
if (self.editing) {
|
||||||
|
frame.origin.x += EDITING_INSET;
|
||||||
|
}
|
||||||
|
return frame;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (CGRect) _textViewFrame {
|
||||||
|
CGRect frame = CGRectMake(2 * VIEW_PADDING + IMAGE_SIZE, VIEW_PADDING, self.contentView.bounds.size.width - IMAGE_SIZE - DATE_TIME_WIDTH - 3 * VIEW_PADDING, CONTENT_HEIGHT - 2 * VIEW_PADDING);
|
||||||
|
if (self.editing) {
|
||||||
|
frame.origin.x += EDITING_INSET;
|
||||||
|
frame.size.width += DATE_TIME_WIDTH + VIEW_PADDING - EDITING_INSET;
|
||||||
|
}
|
||||||
|
return frame;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (CGRect) _timeViewFrame {
|
||||||
|
float x = CGRectGetMaxX(self.contentView.bounds) - DATE_TIME_WIDTH - VIEW_PADDING;
|
||||||
|
CGRect frame = CGRectMake(x, VIEW_PADDING, DATE_TIME_WIDTH, (CONTENT_HEIGHT - 2 * VIEW_PADDING) / 2);
|
||||||
|
return frame;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (CGRect) _dateViewFrame {
|
||||||
|
float x = CGRectGetMaxX(self.contentView.bounds) - DATE_TIME_WIDTH - VIEW_PADDING;
|
||||||
|
CGRect frame = CGRectMake(x, (CONTENT_HEIGHT - 2 * VIEW_PADDING) / 2, DATE_TIME_WIDTH, (CONTENT_HEIGHT - 2 * VIEW_PADDING) / 2);
|
||||||
|
return frame;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void)layoutSubviews {
|
||||||
|
[super layoutSubviews];
|
||||||
|
|
||||||
|
[imageView setFrame:[self _imageViewFrame]];
|
||||||
|
[textView setFrame:[self _textViewFrame]];
|
||||||
|
[dateView setFrame:[self _dateViewFrame]];
|
||||||
|
[timeView setFrame:[self _timeViewFrame]];
|
||||||
|
if (self.editing) {
|
||||||
|
dateView.alpha = 0.0;
|
||||||
|
timeView.alpha = 0.0;
|
||||||
|
} else {
|
||||||
|
dateView.alpha = 1.0;
|
||||||
|
timeView.alpha = 1.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
- (void)setScan:(Scan *)newScan {
|
||||||
|
if (newScan != scan) {
|
||||||
|
[newScan retain];
|
||||||
|
[scan release];
|
||||||
|
scan = newScan;
|
||||||
|
[result release];
|
||||||
|
result = [[ResultParser parsedResultForString:[scan text]] retain];
|
||||||
|
|
||||||
|
imageView.image = [result icon];
|
||||||
|
textView.text = [result stringForDisplay];
|
||||||
|
|
||||||
|
NSDate *date = [scan stamp];
|
||||||
|
dateView.text = _dateString(date);
|
||||||
|
timeView.text = _timeString(date);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (Scan *)scan {
|
||||||
|
return scan;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)dealloc {
|
||||||
|
[imageView release];
|
||||||
|
[textView release];
|
||||||
|
[dateView release];
|
||||||
|
[timeView release];
|
||||||
|
[scan release];
|
||||||
|
[result release];
|
||||||
|
[super dealloc];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@end
|
39
iphone/Barcodes/Classes/ScanViewController.h
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
//
|
||||||
|
// ScanViewController.h
|
||||||
|
// ZXing
|
||||||
|
//
|
||||||
|
// Created by Christian Brunschen on 24/06/2008.
|
||||||
|
/*
|
||||||
|
* Copyright 2008 ZXing authors
|
||||||
|
*
|
||||||
|
* 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 <UIKit/UIKit.h>
|
||||||
|
#import "Scan.h"
|
||||||
|
#import "ParsedResult.h"
|
||||||
|
|
||||||
|
@interface ScanViewController : UITableViewController {
|
||||||
|
IBOutlet ParsedResult *result;
|
||||||
|
IBOutlet Scan *scan;
|
||||||
|
UIFont *bodyFont;
|
||||||
|
NSDateFormatter *dateFormatter;
|
||||||
|
}
|
||||||
|
|
||||||
|
@property (nonatomic, retain) ParsedResult *result;
|
||||||
|
@property (nonatomic, retain) Scan *scan;
|
||||||
|
@property (nonatomic, retain) NSDateFormatter *dateFormatter;
|
||||||
|
|
||||||
|
- (id)initWithResult:(ParsedResult *)r forScan:(Scan *)s;
|
||||||
|
|
||||||
|
@end
|
255
iphone/Barcodes/Classes/ScanViewController.m
Normal file
|
@ -0,0 +1,255 @@
|
||||||
|
//
|
||||||
|
// ScanViewController.m
|
||||||
|
// ZXing
|
||||||
|
//
|
||||||
|
// Created by Christian Brunschen on 24/06/2008.
|
||||||
|
/*
|
||||||
|
* Copyright 2008 ZXing authors
|
||||||
|
*
|
||||||
|
* 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 "ScanViewController.h"
|
||||||
|
#import "ResultAction.h"
|
||||||
|
|
||||||
|
|
||||||
|
#define TEXT_VIEW_TAG 0x17
|
||||||
|
#define DATETIME_VIEW_TAG 0x18
|
||||||
|
#define BUTTON_LABEL_TAG 0x19
|
||||||
|
#define TITLE_HEIGHT 44
|
||||||
|
#define BODY_HEIGHT 88
|
||||||
|
|
||||||
|
@implementation ScanViewController
|
||||||
|
|
||||||
|
@synthesize result;
|
||||||
|
@synthesize scan;
|
||||||
|
@synthesize dateFormatter;
|
||||||
|
|
||||||
|
#define FONT_NAME @"TimesNewRomanPSMT"
|
||||||
|
#define FONT_SIZE 16
|
||||||
|
|
||||||
|
- (id)initWithResult:(ParsedResult *)r forScan:(Scan *)s {
|
||||||
|
if ((self = [super initWithStyle:UITableViewStyleGrouped])) {
|
||||||
|
self.result = r;
|
||||||
|
self.scan = s;
|
||||||
|
self.title = NSLocalizedString(@"ScanViewController title", @"Scan");
|
||||||
|
dateFormatter = [[NSDateFormatter alloc] init];
|
||||||
|
[dateFormatter setDateStyle:NSDateFormatterLongStyle];
|
||||||
|
[dateFormatter setTimeStyle:NSDateFormatterLongStyle];
|
||||||
|
bodyFont = [[UIFont fontWithName:FONT_NAME size:FONT_SIZE] retain];
|
||||||
|
}
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
|
||||||
|
return [[result actions] count] ? 2 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
||||||
|
switch (section) {
|
||||||
|
case 0:
|
||||||
|
return 3;
|
||||||
|
case 1:
|
||||||
|
return [[result actions] count];
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (UITableViewCell *)cellWithIdentifier:(NSString *)identifier inTableView:(UITableView *)tableView {
|
||||||
|
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
|
||||||
|
if (cell == nil) {
|
||||||
|
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:identifier] autorelease];
|
||||||
|
}
|
||||||
|
return cell;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (UITableViewCell *)titleCellInTableView:(UITableView *)tableView {
|
||||||
|
static NSString *TitleIdentifier = @"ScanViewTitleIdentifier";
|
||||||
|
return [self cellWithIdentifier:TitleIdentifier inTableView:tableView];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (UITableViewCell *)datetimeCellInTableView:(UITableView *)tableView {
|
||||||
|
static NSString *DatetimeIdentifier = @"ScanViewDatetimeIdentifier";
|
||||||
|
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:DatetimeIdentifier];
|
||||||
|
if (cell == nil) {
|
||||||
|
cell = [[[UITableViewCell alloc] initWithFrame:CGRectMake(0, 0, 320, 34) reuseIdentifier:DatetimeIdentifier] autorelease];
|
||||||
|
UILabel *label = [cell textLabel];
|
||||||
|
label.font = [UIFont systemFontOfSize:[UIFont systemFontSize] * 2.0 / 3.0];
|
||||||
|
label.textColor = [UIColor grayColor];
|
||||||
|
label.textAlignment = UITextAlignmentCenter;
|
||||||
|
}
|
||||||
|
return cell;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (UITableViewCell *)bodyCellInTableView:(UITableView *)tableView {
|
||||||
|
static NSString *BodyIdentifier = @"ScanViewBodyIdentifier";
|
||||||
|
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:BodyIdentifier];
|
||||||
|
if (cell == nil) {
|
||||||
|
cell = [[[UITableViewCell alloc] initWithFrame:CGRectMake(0, 0, 320, BODY_HEIGHT) reuseIdentifier:BodyIdentifier] autorelease];
|
||||||
|
UITextView *textView = [[UITextView alloc] initWithFrame:CGRectInset(cell.contentView.bounds, 6, 6)];
|
||||||
|
textView.font = bodyFont;
|
||||||
|
[textView setTag:TEXT_VIEW_TAG];
|
||||||
|
textView.editable = NO;
|
||||||
|
[textView setAutoresizingMask:(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight)];
|
||||||
|
[cell.contentView addSubview:textView];
|
||||||
|
[textView release];
|
||||||
|
}
|
||||||
|
return cell;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (UITableViewCell *)buttonCellInTableView:(UITableView *)tableView {
|
||||||
|
static NSString *ButtonIdentifier = @"ScanViewButtonIdentifier";
|
||||||
|
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ButtonIdentifier];
|
||||||
|
if (cell == nil) {
|
||||||
|
cell = [[[UITableViewCell alloc] initWithFrame:CGRectMake(0, 0, 320, 44) reuseIdentifier:ButtonIdentifier] autorelease];
|
||||||
|
UILabel *label = [[UILabel alloc] initWithFrame:CGRectInset(cell.contentView.bounds, 6, 6)];
|
||||||
|
label.font = [UIFont boldSystemFontOfSize:[UIFont systemFontSize]];
|
||||||
|
[label setTag:BUTTON_LABEL_TAG];
|
||||||
|
label.lineBreakMode = UILineBreakModeMiddleTruncation;
|
||||||
|
label.textColor = [UIColor grayColor];
|
||||||
|
label.textAlignment = UITextAlignmentCenter;
|
||||||
|
[label setAutoresizingMask:(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight)];
|
||||||
|
[cell.contentView addSubview:label];
|
||||||
|
[label release];
|
||||||
|
}
|
||||||
|
return cell;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define TEXT_VIEW_HEIGHT 330.0
|
||||||
|
|
||||||
|
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||||
|
if (indexPath.section == 0) {
|
||||||
|
if (indexPath.row == 0) {
|
||||||
|
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
|
||||||
|
NSLog(@"text size = %f", size.height);
|
||||||
|
#endif
|
||||||
|
return fminf(TEXT_VIEW_HEIGHT, fmaxf(44, size.height + 24));
|
||||||
|
} else if (indexPath.row == 2) {
|
||||||
|
return 24.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return tableView.rowHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||||
|
UITableViewCell *cell;
|
||||||
|
|
||||||
|
if (indexPath.section == 0) {
|
||||||
|
if (indexPath.row == 0) {
|
||||||
|
cell = [self titleCellInTableView:tableView];
|
||||||
|
UIImageView *imageView = cell.imageView;
|
||||||
|
imageView.image = [result icon];
|
||||||
|
UILabel *textLabel = cell.textLabel;
|
||||||
|
textLabel.text = [[result class] typeName];
|
||||||
|
} else if (indexPath.row == 1) {
|
||||||
|
cell = [self bodyCellInTableView:tableView];
|
||||||
|
UITextView *textView = (UITextView *)[cell viewWithTag:TEXT_VIEW_TAG];
|
||||||
|
textView.text = [result stringForDisplay];
|
||||||
|
} else if (indexPath.row == 2) {
|
||||||
|
cell = [self datetimeCellInTableView:tableView];
|
||||||
|
UILabel *textLabel = cell.textLabel;
|
||||||
|
textLabel.text = [dateFormatter stringFromDate:[scan stamp]];
|
||||||
|
}
|
||||||
|
} else if (indexPath.section == 1) {
|
||||||
|
cell = [self buttonCellInTableView:tableView];
|
||||||
|
ResultAction *action = [[result actions] objectAtIndex:indexPath.row];
|
||||||
|
UILabel *label = (UILabel *)[cell viewWithTag:BUTTON_LABEL_TAG];
|
||||||
|
label.text = [action title];
|
||||||
|
}
|
||||||
|
|
||||||
|
return cell;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)performAction:(ResultAction *)action {
|
||||||
|
[action performActionWithController:self shouldConfirm:NO];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||||
|
if (indexPath.section == 1) {
|
||||||
|
ResultAction *action = [[result actions] objectAtIndex:indexPath.row];
|
||||||
|
[self performSelector:@selector(performAction:) withObject:action afterDelay:0.0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||||
|
|
||||||
|
if (editingStyle == UITableViewCellEditingStyleDelete) {
|
||||||
|
}
|
||||||
|
if (editingStyle == UITableViewCellEditingStyleInsert) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
||||||
|
if (indexPath.section != 1) {
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
return indexPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void)dealloc {
|
||||||
|
[result release];
|
||||||
|
[scan release];
|
||||||
|
[bodyFont release];
|
||||||
|
[dateFormatter release];
|
||||||
|
[super dealloc];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void)viewDidLoad {
|
||||||
|
[super viewDidLoad];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
- (void)viewWillAppear:(BOOL)animated {
|
||||||
|
[super viewWillAppear:animated];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)viewDidAppear:(BOOL)animated {
|
||||||
|
[super viewDidAppear:animated];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)viewWillDisappear:(BOOL)animated {
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)viewDidDisappear:(BOOL)animated {
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)didReceiveMemoryWarning {
|
||||||
|
[super didReceiveMemoryWarning];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
|
|
||||||
- (IBAction)scan:(id)sender;
|
- (IBAction)scan:(id)sender;
|
||||||
- (IBAction)info:(id)sender;
|
- (IBAction)info:(id)sender;
|
||||||
|
- (IBAction)showArchive:(id)sender;
|
||||||
|
|
||||||
- (void)zxingController:(ZXingWidgetController*)controller didScanResult:(NSString *)result;
|
- (void)zxingController:(ZXingWidgetController*)controller didScanResult:(NSString *)result;
|
||||||
- (void)zxingControllerDidCancel:(ZXingWidgetController*)controller;
|
- (void)zxingControllerDidCancel:(ZXingWidgetController*)controller;
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
#import <UniversalResultParser.h>
|
#import <UniversalResultParser.h>
|
||||||
#import <ParsedResult.h>
|
#import <ParsedResult.h>
|
||||||
#import <ResultAction.h>
|
#import <ResultAction.h>
|
||||||
|
#import "ArchiveController.h"
|
||||||
|
#import "Database.h"
|
||||||
|
|
||||||
@implementation ZXMainViewController
|
@implementation ZXMainViewController
|
||||||
@synthesize resultParser;
|
@synthesize resultParser;
|
||||||
|
@ -84,6 +86,14 @@
|
||||||
[aboutController release];
|
[aboutController release];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (IBAction)showArchive:(id)sender {
|
||||||
|
ArchiveController *archiveController = [[ArchiveController alloc] init];
|
||||||
|
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:archiveController];
|
||||||
|
[self presentModalViewController:navController animated:YES];
|
||||||
|
[navController release];
|
||||||
|
[archiveController release];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)messageViewControllerWantsToBeDispissed:(MessageViewController *)controller {
|
- (void)messageViewControllerWantsToBeDispissed:(MessageViewController *)controller {
|
||||||
[self dismissModalViewControllerAnimated:YES];
|
[self dismissModalViewControllerAnimated:YES];
|
||||||
}
|
}
|
||||||
|
@ -120,6 +130,7 @@
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
NSLog(@"result has %d actions", actions ? 0 : actions.count);
|
NSLog(@"result has %d actions", actions ? 0 : actions.count);
|
||||||
#endif
|
#endif
|
||||||
|
[[Database sharedDatabase] addScanWithText:resultString];
|
||||||
[self performResultAction];
|
[self performResultAction];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -107,6 +107,25 @@
|
||||||
<bytes key="NSWhite">MC41AA</bytes>
|
<bytes key="NSWhite">MC41AA</bytes>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
|
<object class="IBUIButton" id="528239131">
|
||||||
|
<reference key="NSNextResponder" ref="191373211"/>
|
||||||
|
<int key="NSvFlags">292</int>
|
||||||
|
<string key="NSFrame">{{96, 412}, {128, 28}}</string>
|
||||||
|
<reference key="NSSuperview" ref="191373211"/>
|
||||||
|
<bool key="IBUIOpaque">NO</bool>
|
||||||
|
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
|
||||||
|
<int key="IBUIContentHorizontalAlignment">0</int>
|
||||||
|
<int key="IBUIContentVerticalAlignment">0</int>
|
||||||
|
<reference key="IBUIFont" ref="50803580"/>
|
||||||
|
<int key="IBUIButtonType">1</int>
|
||||||
|
<string key="IBUINormalTitle">Archives</string>
|
||||||
|
<reference key="IBUIHighlightedTitleColor" ref="85817449"/>
|
||||||
|
<object class="NSColor" key="IBUINormalTitleColor">
|
||||||
|
<int key="NSColorSpace">1</int>
|
||||||
|
<bytes key="NSRGB">MC4xOTYwNzg0MzQ2IDAuMzA5ODAzOTMyOSAwLjUyMTU2ODY1NgA</bytes>
|
||||||
|
</object>
|
||||||
|
<reference key="IBUINormalTitleShadowColor" ref="931878472"/>
|
||||||
|
</object>
|
||||||
<object class="IBUIButton" id="171320148">
|
<object class="IBUIButton" id="171320148">
|
||||||
<reference key="NSNextResponder" ref="191373211"/>
|
<reference key="NSNextResponder" ref="191373211"/>
|
||||||
<int key="NSvFlags">292</int>
|
<int key="NSvFlags">292</int>
|
||||||
|
@ -166,6 +185,15 @@
|
||||||
</object>
|
</object>
|
||||||
<int key="connectionID">9</int>
|
<int key="connectionID">9</int>
|
||||||
</object>
|
</object>
|
||||||
|
<object class="IBConnectionRecord">
|
||||||
|
<object class="IBCocoaTouchEventConnection" key="connection">
|
||||||
|
<string key="label">showArchive:</string>
|
||||||
|
<reference key="source" ref="528239131"/>
|
||||||
|
<reference key="destination" ref="372490531"/>
|
||||||
|
<int key="IBEventType">7</int>
|
||||||
|
</object>
|
||||||
|
<int key="connectionID">14</int>
|
||||||
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<object class="IBMutableOrderedSet" key="objectRecords">
|
<object class="IBMutableOrderedSet" key="objectRecords">
|
||||||
<object class="NSArray" key="orderedObjects">
|
<object class="NSArray" key="orderedObjects">
|
||||||
|
@ -182,9 +210,10 @@
|
||||||
<object class="NSMutableArray" key="children">
|
<object class="NSMutableArray" key="children">
|
||||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
<reference ref="19193094"/>
|
<reference ref="19193094"/>
|
||||||
<reference ref="1000547791"/>
|
|
||||||
<reference ref="1005126370"/>
|
|
||||||
<reference ref="171320148"/>
|
<reference ref="171320148"/>
|
||||||
|
<reference ref="528239131"/>
|
||||||
|
<reference ref="1005126370"/>
|
||||||
|
<reference ref="1000547791"/>
|
||||||
</object>
|
</object>
|
||||||
<reference key="parent" ref="0"/>
|
<reference key="parent" ref="0"/>
|
||||||
</object>
|
</object>
|
||||||
|
@ -205,8 +234,13 @@
|
||||||
<reference key="parent" ref="191373211"/>
|
<reference key="parent" ref="191373211"/>
|
||||||
</object>
|
</object>
|
||||||
<object class="IBObjectRecord">
|
<object class="IBObjectRecord">
|
||||||
<int key="objectID">5</int>
|
<int key="objectID">8</int>
|
||||||
<reference key="object" ref="1000547791"/>
|
<reference key="object" ref="171320148"/>
|
||||||
|
<reference key="parent" ref="191373211"/>
|
||||||
|
</object>
|
||||||
|
<object class="IBObjectRecord">
|
||||||
|
<int key="objectID">10</int>
|
||||||
|
<reference key="object" ref="528239131"/>
|
||||||
<reference key="parent" ref="191373211"/>
|
<reference key="parent" ref="191373211"/>
|
||||||
</object>
|
</object>
|
||||||
<object class="IBObjectRecord">
|
<object class="IBObjectRecord">
|
||||||
|
@ -215,8 +249,8 @@
|
||||||
<reference key="parent" ref="191373211"/>
|
<reference key="parent" ref="191373211"/>
|
||||||
</object>
|
</object>
|
||||||
<object class="IBObjectRecord">
|
<object class="IBObjectRecord">
|
||||||
<int key="objectID">8</int>
|
<int key="objectID">5</int>
|
||||||
<reference key="object" ref="171320148"/>
|
<reference key="object" ref="1000547791"/>
|
||||||
<reference key="parent" ref="191373211"/>
|
<reference key="parent" ref="191373211"/>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
|
@ -229,6 +263,8 @@
|
||||||
<string>-2.CustomClassName</string>
|
<string>-2.CustomClassName</string>
|
||||||
<string>1.IBEditorWindowLastContentRect</string>
|
<string>1.IBEditorWindowLastContentRect</string>
|
||||||
<string>1.IBPluginDependency</string>
|
<string>1.IBPluginDependency</string>
|
||||||
|
<string>10.IBPluginDependency</string>
|
||||||
|
<string>10.IBViewBoundsToFrameTransform</string>
|
||||||
<string>4.IBPluginDependency</string>
|
<string>4.IBPluginDependency</string>
|
||||||
<string>4.IBViewBoundsToFrameTransform</string>
|
<string>4.IBViewBoundsToFrameTransform</string>
|
||||||
<string>5.IBPluginDependency</string>
|
<string>5.IBPluginDependency</string>
|
||||||
|
@ -242,19 +278,23 @@
|
||||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
<string>ZXMainViewController</string>
|
<string>ZXMainViewController</string>
|
||||||
<string>UIResponder</string>
|
<string>UIResponder</string>
|
||||||
<string>{{184, 249}, {320, 480}}</string>
|
<string>{{298, 248}, {320, 480}}</string>
|
||||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||||
|
<object class="NSAffineTransform">
|
||||||
|
<bytes key="NSTransformStruct">AULAAABDzgAAA</bytes>
|
||||||
|
</object>
|
||||||
|
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||||
<object class="NSAffineTransform">
|
<object class="NSAffineTransform">
|
||||||
<bytes key="NSTransformStruct">P4AAAL+AAABCoAAAwzYAAA</bytes>
|
<bytes key="NSTransformStruct">P4AAAL+AAABCoAAAwzYAAA</bytes>
|
||||||
</object>
|
</object>
|
||||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||||
<object class="NSAffineTransform">
|
<object class="NSAffineTransform">
|
||||||
<bytes key="NSTransformStruct">P4AAAL+AAABCzAAAwgAAAA</bytes>
|
<bytes key="NSTransformStruct">AUKIAABB8AAAA</bytes>
|
||||||
</object>
|
</object>
|
||||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||||
<object class="NSAffineTransform">
|
<object class="NSAffineTransform">
|
||||||
<bytes key="NSTransformStruct">P4AAAL+AAABC+AAAw5CAAA</bytes>
|
<bytes key="NSTransformStruct">AULAAABDcAAAA</bytes>
|
||||||
</object>
|
</object>
|
||||||
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
|
||||||
<object class="NSAffineTransform">
|
<object class="NSAffineTransform">
|
||||||
|
@ -278,7 +318,7 @@
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<nil key="sourceID"/>
|
<nil key="sourceID"/>
|
||||||
<int key="maxID">9</int>
|
<int key="maxID">14</int>
|
||||||
</object>
|
</object>
|
||||||
<object class="IBClassDescriber" key="IBDocument.Classes">
|
<object class="IBClassDescriber" key="IBDocument.Classes">
|
||||||
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
|
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
|
||||||
|
@ -292,11 +332,13 @@
|
||||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
<string>info:</string>
|
<string>info:</string>
|
||||||
<string>scan:</string>
|
<string>scan:</string>
|
||||||
|
<string>showArchive:</string>
|
||||||
</object>
|
</object>
|
||||||
<object class="NSMutableArray" key="dict.values">
|
<object class="NSMutableArray" key="dict.values">
|
||||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
<string>id</string>
|
<string>id</string>
|
||||||
<string>id</string>
|
<string>id</string>
|
||||||
|
<string>id</string>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<object class="NSMutableDictionary" key="actionInfosByName">
|
<object class="NSMutableDictionary" key="actionInfosByName">
|
||||||
|
@ -305,6 +347,7 @@
|
||||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
<string>info:</string>
|
<string>info:</string>
|
||||||
<string>scan:</string>
|
<string>scan:</string>
|
||||||
|
<string>showArchive:</string>
|
||||||
</object>
|
</object>
|
||||||
<object class="NSMutableArray" key="dict.values">
|
<object class="NSMutableArray" key="dict.values">
|
||||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||||
|
@ -316,6 +359,10 @@
|
||||||
<string key="name">scan:</string>
|
<string key="name">scan:</string>
|
||||||
<string key="candidateClassName">id</string>
|
<string key="candidateClassName">id</string>
|
||||||
</object>
|
</object>
|
||||||
|
<object class="IBActionInfo">
|
||||||
|
<string key="name">showArchive:</string>
|
||||||
|
<string key="candidateClassName">id</string>
|
||||||
|
</object>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||||
|
|
BIN
iphone/Barcodes/images/Default.png
Normal file
After Width: | Height: | Size: 37 KiB |
BIN
iphone/Barcodes/images/Default@2x.png
Normal file
After Width: | Height: | Size: 55 KiB |
BIN
iphone/Barcodes/images/business-card.png
Normal file
After Width: | Height: | Size: 334 B |
BIN
iphone/Barcodes/images/email.png
Normal file
After Width: | Height: | Size: 608 B |
BIN
iphone/Barcodes/images/filmroll-2.png
Normal file
After Width: | Height: | Size: 326 B |
BIN
iphone/Barcodes/images/link1.png
Normal file
After Width: | Height: | Size: 578 B |
BIN
iphone/Barcodes/images/link2.png
Normal file
After Width: | Height: | Size: 340 B |
BIN
iphone/Barcodes/images/map-pin.png
Normal file
After Width: | Height: | Size: 515 B |
BIN
iphone/Barcodes/images/phone.png
Normal file
After Width: | Height: | Size: 417 B |
BIN
iphone/Barcodes/images/photolib.png
Normal file
After Width: | Height: | Size: 204 B |
BIN
iphone/Barcodes/images/sms.png
Normal file
After Width: | Height: | Size: 657 B |
BIN
iphone/Barcodes/images/text.png
Normal file
After Width: | Height: | Size: 376 B |