iSightを使ってBooklog,MediaMarkerインポート用CSVファイルを生成するアプリ
Revision | c2f53ce9fe19b1f890927cd845d302f3fb7e6856 (tree) |
---|---|
Time | 2011-04-10 10:02:14 |
Author | masakih <masakih@user...> |
Commiter | masakih |
[Mod] リストアをBEExporterAttributeで行うようにした。
@@ -7,6 +7,8 @@ | ||
7 | 7 | // |
8 | 8 | |
9 | 9 | #import "BEExporterAttribute.h" |
10 | +#import "BEPreference.h" | |
11 | + | |
10 | 12 | |
11 | 13 | @interface BEExporterAttribute() |
12 | 14 | @property ExporterType type; |
@@ -44,7 +46,24 @@ static NSArray *attributes = nil; | ||
44 | 46 | [array addObject:attr]; |
45 | 47 | } |
46 | 48 | |
47 | - attributes = [[NSArray alloc] initWithArray:array]; | |
49 | + | |
50 | + NSArray *stored = [BEPreference preference].attributes; | |
51 | + if(!stored) { | |
52 | + attributes = [[NSArray alloc] initWithArray:array]; | |
53 | + return attributes; | |
54 | + } | |
55 | + if([array isEqual:stored]) { | |
56 | + attributes = [stored retain]; | |
57 | + return attributes; | |
58 | + } | |
59 | + NSMutableArray *newAttr = [stored mutableCopy]; | |
60 | + for(id obj in array) { | |
61 | + if(![newAttr containsObject:obj]) { | |
62 | + [newAttr addObject:obj]; | |
63 | + } | |
64 | + } | |
65 | + | |
66 | + attributes = [[NSArray alloc] initWithArray:newAttr]; | |
48 | 67 | return attributes; |
49 | 68 | } |
50 | 69 |
@@ -55,6 +74,28 @@ static NSArray *attributes = nil; | ||
55 | 74 | } |
56 | 75 | return nil; |
57 | 76 | } |
77 | +- (void)restoreAttributes | |
78 | +{ | |
79 | + NSArray *stored = [BEPreference preference].attributes; | |
80 | + if(!stored) { | |
81 | + attributes = [[BEExporterAttribute attribtues] retain]; | |
82 | + return; | |
83 | + } | |
84 | + | |
85 | + NSArray *origin = [BEExporterAttribute attribtues]; | |
86 | + if([origin isEqual:stored]) { | |
87 | + attributes = [stored retain]; | |
88 | + return; | |
89 | + } | |
90 | + | |
91 | + NSMutableArray *newAttr = [stored mutableCopy]; | |
92 | + for(id obj in origin) { | |
93 | + if(![newAttr containsObject:obj]) { | |
94 | + [newAttr addObject:obj]; | |
95 | + } | |
96 | + } | |
97 | + attributes = [[NSArray alloc] initWithArray:newAttr]; | |
98 | +} | |
58 | 99 | |
59 | 100 | - (NSString *)name |
60 | 101 | { |
@@ -13,7 +13,6 @@ | ||
13 | 13 | |
14 | 14 | |
15 | 15 | @interface BEGeneralPreference (BEPrivate) |
16 | -- (void)restoreAttributes; | |
17 | 16 | - (void)setSelection:(id)newSelection; |
18 | 17 | @end |
19 | 18 |
@@ -25,7 +24,7 @@ | ||
25 | 24 | if(self) { |
26 | 25 | [self setTitle:NSLocalizedString(@"General", @"General")]; |
27 | 26 | sites = [[BERegisterSite sites] retain]; |
28 | - [self restoreAttributes]; | |
27 | + attributes = [[BEExporterAttribute attribtues] retain]; | |
29 | 28 | [self setSelection:[attributes objectAtIndex:0]]; |
30 | 29 | } |
31 | 30 | return self; |
@@ -38,30 +37,6 @@ | ||
38 | 37 | [super dealloc]; |
39 | 38 | } |
40 | 39 | |
41 | -- (void)restoreAttributes | |
42 | -{ | |
43 | - NSArray *stored = [BEPreference preference].attributes; | |
44 | - if(!stored) { | |
45 | - attributes = [[BEExporterAttribute attribtues] retain]; | |
46 | - return; | |
47 | - } | |
48 | - | |
49 | - NSArray *origin = [BEExporterAttribute attribtues]; | |
50 | - if([origin isEqual:stored]) { | |
51 | - attributes = [stored retain]; | |
52 | - return; | |
53 | - } | |
54 | - | |
55 | - NSMutableArray *array = [stored mutableCopy]; | |
56 | - for(id obj in origin) { | |
57 | - if(![array containsObject:obj]) { | |
58 | - [array addObject:obj]; | |
59 | - } | |
60 | - } | |
61 | - attributes = [[NSArray alloc] initWithArray:array]; | |
62 | -} | |
63 | - | |
64 | - | |
65 | 40 | - (void)setSelection:(id)newSelection |
66 | 41 | { |
67 | 42 | if(selection == newSelection) return; |
@@ -16,5 +16,5 @@ extern NSString *const BEOpenSite; // BERegisterSite. | ||
16 | 16 | |
17 | 17 | + (BEPreference *)preference; |
18 | 18 | |
19 | -@property (nonatomic, retain) NSArray *attributes; | |
19 | +@property (nonatomic, retain) NSArray *attributes; // Array of BEExporterAttribute. | |
20 | 20 | @end |