• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

iSightを使ってBooklog,MediaMarkerインポート用CSVファイルを生成するアプリ


Commit MetaInfo

Revisionc2f53ce9fe19b1f890927cd845d302f3fb7e6856 (tree)
Time2011-04-10 10:02:14
Authormasakih <masakih@user...>
Commitermasakih

Log Message

[Mod] リストアをBEExporterAttributeで行うようにした。

Change Summary

Incremental Difference

--- a/BEExporterAttribute.m
+++ b/BEExporterAttribute.m
@@ -7,6 +7,8 @@
77 //
88
99 #import "BEExporterAttribute.h"
10+#import "BEPreference.h"
11+
1012
1113 @interface BEExporterAttribute()
1214 @property ExporterType type;
@@ -44,7 +46,24 @@ static NSArray *attributes = nil;
4446 [array addObject:attr];
4547 }
4648
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];
4867 return attributes;
4968 }
5069
@@ -55,6 +74,28 @@ static NSArray *attributes = nil;
5574 }
5675 return nil;
5776 }
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+}
5899
59100 - (NSString *)name
60101 {
--- a/BEGeneralPreference.m
+++ b/BEGeneralPreference.m
@@ -13,7 +13,6 @@
1313
1414
1515 @interface BEGeneralPreference (BEPrivate)
16-- (void)restoreAttributes;
1716 - (void)setSelection:(id)newSelection;
1817 @end
1918
@@ -25,7 +24,7 @@
2524 if(self) {
2625 [self setTitle:NSLocalizedString(@"General", @"General")];
2726 sites = [[BERegisterSite sites] retain];
28- [self restoreAttributes];
27+ attributes = [[BEExporterAttribute attribtues] retain];
2928 [self setSelection:[attributes objectAtIndex:0]];
3029 }
3130 return self;
@@ -38,30 +37,6 @@
3837 [super dealloc];
3938 }
4039
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-
6540 - (void)setSelection:(id)newSelection
6641 {
6742 if(selection == newSelection) return;
--- a/BEPreference.h
+++ b/BEPreference.h
@@ -16,5 +16,5 @@ extern NSString *const BEOpenSite; // BERegisterSite.
1616
1717 + (BEPreference *)preference;
1818
19-@property (nonatomic, retain) NSArray *attributes;
19+@property (nonatomic, retain) NSArray *attributes; // Array of BEExporterAttribute.
2020 @end