Просмотр исходного кода

Can change title length. Bumped Version Number to 1.1.0

Thomas Buck 11 лет назад
Родитель
Сommit
7da1504c75

+ 0
- 2
RedditBar.xcodeproj/project.pbxproj Просмотреть файл

@@ -495,7 +495,6 @@
495 495
 			buildSettings = {
496 496
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
497 497
 				CODE_SIGN_ENTITLEMENTS = RedditBar/RedditBar.entitlements;
498
-				CODE_SIGN_IDENTITY = "-";
499 498
 				COMBINE_HIDPI_IMAGES = YES;
500 499
 				GCC_PRECOMPILE_PREFIX_HEADER = YES;
501 500
 				GCC_PREFIX_HEADER = "RedditBar/RedditBar-Prefix.pch";
@@ -511,7 +510,6 @@
511 510
 			buildSettings = {
512 511
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
513 512
 				CODE_SIGN_ENTITLEMENTS = RedditBar/RedditBar.entitlements;
514
-				CODE_SIGN_IDENTITY = "-";
515 513
 				COMBINE_HIDPI_IMAGES = YES;
516 514
 				GCC_PRECOMPILE_PREFIX_HEADER = YES;
517 515
 				GCC_PREFIX_HEADER = "RedditBar/RedditBar-Prefix.pch";

+ 1
- 1
RedditBar/AppDelegate.h Просмотреть файл

@@ -59,6 +59,6 @@
59 59
 -(void)reloadListHasSubredditsCallback:(NSArray *)items;
60 60
 -(void)reloadListHasFrontpageCallback:(NSArray *)items;
61 61
 
62
--(void)prefReturnName:(NSString *)name Modhash:(NSString *)modhash subscriptions:(Boolean)subscriptions subreddits:(NSString *)subreddits length:(NSInteger)length printSubs:(Boolean)showSubreddits;
62
+-(void)prefReturnName:(NSString *)name Modhash:(NSString *)modhash subscriptions:(Boolean)subscriptions subreddits:(NSString *)subreddits length:(NSInteger)length printSubs:(Boolean)showSubreddits titleLength:(NSInteger)titleLength;
63 63
 
64 64
 @end

+ 3
- 2
RedditBar/AppDelegate.m Просмотреть файл

@@ -96,7 +96,7 @@
96 96
         return;
97 97
     }
98 98
     
99
-    api = [[Reddit alloc] initWithUsername:currentState.username Modhash:currentState.modhash Length:currentState.length];
99
+    api = [[Reddit alloc] initWithUsername:currentState.username Modhash:currentState.modhash Length:currentState.length TitleLength:currentState.titleLength];
100 100
     [NSThread detachNewThreadSelector:@selector(isAuthenticatedNewModhash:) toTarget:api withObject:self];
101 101
 }
102 102
 
@@ -200,13 +200,14 @@
200 200
     [application orderFrontStandardAboutPanel:self];
201 201
 }
202 202
 
203
--(void)prefReturnName:(NSString *)name Modhash:(NSString *)modhash subscriptions:(Boolean)subscriptions subreddits:(NSString *)subreddits length:(NSInteger)length printSubs:(Boolean)showSubreddits {
203
+-(void)prefReturnName:(NSString *)name Modhash:(NSString *)modhash subscriptions:(Boolean)subscriptions subreddits:(NSString *)subreddits length:(NSInteger)length printSubs:(Boolean)showSubreddits titleLength:(NSInteger)titleLength {
204 204
     currentState.username = name;
205 205
     currentState.modhash = modhash;
206 206
     currentState.useSubscriptions = subscriptions;
207 207
     currentState.subreddits = [subreddits componentsSeparatedByString: @"\n"];
208 208
     currentState.length = length;
209 209
     currentState.showSubreddit = showSubreddits;
210
+    currentState.titleLength = titleLength;
210 211
     [currentState savePreferences];
211 212
     lastFullName = nil; // reload from start
212 213
     [self reloadListWithOptions];

+ 6
- 0
RedditBar/Base.lproj/Prefs.strings Просмотреть файл

@@ -11,6 +11,9 @@
11 11
 /* Class = "NSTextFieldCell"; title = "Items:"; ObjectID = "FNJ-RL-DXT"; */
12 12
 "FNJ-RL-DXT.title" = "Items:";
13 13
 
14
+/* Class = "NSTextFieldCell"; title = "Title:"; ObjectID = "Frl-AE-ROJ"; */
15
+"Frl-AE-ROJ.title" = "Title:";
16
+
14 17
 /* Class = "NSTextFieldCell"; title = "Username: "; ObjectID = "GTO-OP-MYS"; */
15 18
 "GTO-OP-MYS.title" = "Username: ";
16 19
 
@@ -29,6 +32,9 @@
29 32
 /* Class = "NSMenu"; title = "Edit"; ObjectID = "YpZ-Vi-h1u"; */
30 33
 "YpZ-Vi-h1u.title" = "Edit";
31 34
 
35
+/* Class = "NSTextFieldCell"; title = "66"; ObjectID = "b76-4r-MEp"; */
36
+"b76-4r-MEp.title" = "66";
37
+
32 38
 /* Class = "NSMenuItem"; title = "Edit"; ObjectID = "czz-51-wxr"; */
33 39
 "czz-51-wxr.title" = "Edit";
34 40
 

+ 49
- 5
RedditBar/Base.lproj/Prefs.xib Просмотреть файл

@@ -8,13 +8,14 @@
8 8
         <customObject id="-2" userLabel="File's Owner" customClass="PrefController">
9 9
             <connections>
10 10
                 <outlet property="lengthField" destination="MAv-jO-hIv" id="tbQ-UG-2ew"/>
11
-                <outlet property="lengthFormat" destination="zpc-oG-upp" id="AKk-rK-pM3"/>
12 11
                 <outlet property="lengthStepper" destination="jxz-fQ-M1L" id="NK5-G4-9UJ"/>
13 12
                 <outlet property="password" destination="ARP-lb-J16" id="EDd-om-ciF"/>
14 13
                 <outlet property="progress" destination="vz0-tR-n1f" id="t06-dO-WKY"/>
15 14
                 <outlet property="showSubreddit" destination="fRR-M9-szp" id="bGR-ej-R9R"/>
16 15
                 <outlet property="subreddits" destination="EhP-FS-8dT" id="td1-kv-jQm"/>
17 16
                 <outlet property="subscriptions" destination="vW5-Cp-Bm1" id="gja-K0-7Uh"/>
17
+                <outlet property="titleField" destination="qju-1J-OOV" id="ujQ-C4-eeX"/>
18
+                <outlet property="titleStepper" destination="2aV-fo-xh7" id="zEg-dP-fRJ"/>
18 19
                 <outlet property="username" destination="0mi-88-o94" id="4bB-K2-q5m"/>
19 20
                 <outlet property="win" destination="1" id="g0G-6q-WjE"/>
20 21
             </connections>
@@ -58,7 +59,7 @@
58 59
                         </textFieldCell>
59 60
                     </textField>
60 61
                     <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="qFP-pd-32c">
61
-                        <rect key="frame" x="18" y="88" width="96" height="17"/>
62
+                        <rect key="frame" x="18" y="88" width="63" height="17"/>
62 63
                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
63 64
                         <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="Items:" id="FNJ-RL-DXT">
64 65
                             <font key="font" metaFont="system"/>
@@ -66,6 +67,15 @@
66 67
                             <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
67 68
                         </textFieldCell>
68 69
                     </textField>
70
+                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="O82-1u-lSr">
71
+                        <rect key="frame" x="152" y="88" width="63" height="17"/>
72
+                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
73
+                        <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="Title:" id="Frl-AE-ROJ">
74
+                            <font key="font" metaFont="system"/>
75
+                            <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
76
+                            <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
77
+                        </textFieldCell>
78
+                    </textField>
69 79
                     <secureTextField verticalHuggingPriority="750" id="ARP-lb-J16">
70 80
                         <rect key="frame" x="120" y="251" width="200" height="22"/>
71 81
                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
@@ -144,7 +154,7 @@ Gw
144 154
                         </connections>
145 155
                     </button>
146 156
                     <textField verticalHuggingPriority="750" id="MAv-jO-hIv">
147
-                        <rect key="frame" x="120" y="83" width="57" height="22"/>
157
+                        <rect key="frame" x="87" y="85" width="38" height="22"/>
148 158
                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
149 159
                         <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" alignment="right" title="10" drawsBackground="YES" id="0SD-Tf-uZS">
150 160
                             <font key="font" metaFont="system"/>
@@ -156,12 +166,35 @@ Gw
156 166
                             <outlet property="formatter" destination="zpc-oG-upp" id="cw1-hM-34K"/>
157 167
                         </connections>
158 168
                     </textField>
169
+                    <textField verticalHuggingPriority="750" id="qju-1J-OOV">
170
+                        <rect key="frame" x="221" y="85" width="38" height="22"/>
171
+                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
172
+                        <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" alignment="right" title="66" drawsBackground="YES" id="b76-4r-MEp">
173
+                            <font key="font" metaFont="system"/>
174
+                            <color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
175
+                            <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
176
+                        </textFieldCell>
177
+                        <connections>
178
+                            <action selector="titleDidChange:" target="-2" id="cOL-Pg-cXA"/>
179
+                            <outlet property="formatter" destination="hDb-Na-Vku" id="Sta-gL-Dug"/>
180
+                        </connections>
181
+                    </textField>
159 182
                     <stepper horizontalHuggingPriority="750" verticalHuggingPriority="750" id="jxz-fQ-M1L">
160
-                        <rect key="frame" x="182" y="80" width="19" height="27"/>
183
+                        <rect key="frame" x="130" y="82" width="19" height="27"/>
161 184
                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
162 185
                         <stepperCell key="cell" continuous="YES" alignment="left" maxValue="100" id="Gba-jV-Ouh"/>
163 186
                         <connections>
164 187
                             <action selector="lengthDidChange:" target="-2" id="CJm-58-seM"/>
188
+                            <outlet property="formatter" destination="zpc-oG-upp" id="nXg-hE-DQX"/>
189
+                        </connections>
190
+                    </stepper>
191
+                    <stepper horizontalHuggingPriority="750" verticalHuggingPriority="750" id="2aV-fo-xh7">
192
+                        <rect key="frame" x="264" y="82" width="19" height="27"/>
193
+                        <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
194
+                        <stepperCell key="cell" continuous="YES" alignment="left" maxValue="100" id="BWQ-gm-H9h"/>
195
+                        <connections>
196
+                            <action selector="titleDidChange:" target="-2" id="l0Y-Mg-1KD"/>
197
+                            <outlet property="formatter" destination="hDb-Na-Vku" id="EL4-2q-XKw"/>
165 198
                         </connections>
166 199
                     </stepper>
167 200
                     <progressIndicator canDrawConcurrently="YES" horizontalHuggingPriority="750" verticalHuggingPriority="750" maxValue="100" displayedWhenStopped="NO" bezeled="NO" indeterminate="YES" controlSize="small" style="spinning" id="vz0-tR-n1f">
@@ -183,13 +216,24 @@ Gw
183 216
             <attributedString key="attributedStringForZero">
184 217
                 <fragment content="0"/>
185 218
             </attributedString>
186
-            <real key="minimum" value="0.0"/>
219
+            <real key="minimum" value="1"/>
187 220
             <real key="maximum" value="100"/>
188 221
             <metadata>
189 222
                 <bool key="localizesFormat" value="YES"/>
190 223
                 <real key="inspectorSampleValue" value="1"/>
191 224
             </metadata>
192 225
         </numberFormatter>
226
+        <numberFormatter formatterBehavior="10_0" positiveFormat="0" negativeFormat="-0" hasThousandSeparators="NO" thousandSeparator="." id="hDb-Na-Vku">
227
+            <attributedString key="attributedStringForZero">
228
+                <fragment content="0"/>
229
+            </attributedString>
230
+            <real key="minimum" value="1"/>
231
+            <real key="maximum" value="140"/>
232
+            <metadata>
233
+                <bool key="localizesFormat" value="YES"/>
234
+                <real key="inspectorSampleValue" value="1"/>
235
+            </metadata>
236
+        </numberFormatter>
193 237
         <menu title="Main Menu" systemMenu="main" id="IWp-hb-gSM">
194 238
             <items>
195 239
                 <menuItem title="Edit" id="czz-51-wxr">

+ 4
- 1
RedditBar/PrefController.h Просмотреть файл

@@ -36,7 +36,6 @@
36 36
 @property (atomic, retain) IBOutlet NSButtonCell *subscriptions;
37 37
 @property (atomic, retain) IBOutlet NSTextView *subreddits;
38 38
 @property (atomic, retain) IBOutlet NSWindow *win;
39
-@property (atomic, retain) IBOutlet NSNumberFormatter *lengthFormat;
40 39
 @property (atomic, retain) IBOutlet NSTextField *lengthField;
41 40
 @property (atomic, retain) IBOutlet NSStepper *lengthStepper;
42 41
 @property (atomic, retain) IBOutlet NSProgressIndicator *progress;
@@ -44,9 +43,13 @@
44 43
 @property (atomic, retain) NSObject *parent;
45 44
 @property (atomic, retain) StateModel *state;
46 45
 @property (atomic) NSInteger length;
46
+@property (atomic, retain) IBOutlet NSTextField *titleField;
47
+@property (atomic, retain) IBOutlet NSStepper *titleStepper;
48
+@property (atomic) NSInteger titleLength;
47 49
 
48 50
 -(IBAction)buttonSave:(id)sender;
49 51
 -(IBAction)toggleSubs:(id)sender;
50 52
 -(IBAction)lengthDidChange:(id)sender;
53
+-(IBAction)titleDidChange:(id)sender;
51 54
 
52 55
 @end

+ 11
- 2
RedditBar/PrefController.m Просмотреть файл

@@ -34,7 +34,7 @@
34 34
 NSString *modhashSetLiteral = @"__MODHASH__IS__SET__";
35 35
 NSString *subredditCharacters = @"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890-_\n";
36 36
 
37
-@synthesize username, password, subscriptions, subreddits, win, parent, state, lengthFormat, lengthField, lengthStepper, length, progress, showSubreddit;
37
+@synthesize username, password, subscriptions, subreddits, win, parent, state, lengthField, lengthStepper, length, progress, showSubreddit, titleField, titleStepper, titleLength;
38 38
 
39 39
 -(Boolean)isValidList:(NSString *)input {
40 40
     NSCharacterSet *invalidChars = [[NSCharacterSet characterSetWithCharactersInString:subredditCharacters] invertedSet];
@@ -62,6 +62,9 @@ NSString *subredditCharacters = @"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRST
62 62
     length = state.length;
63 63
     [lengthStepper setIntegerValue:length];
64 64
     [lengthField setIntegerValue:length];
65
+    titleLength = state.titleLength;
66
+    [titleStepper setIntegerValue:titleLength];
67
+    [titleField setIntegerValue:titleLength];
65 68
     [progress setUsesThreadedAnimation:YES];
66 69
     [showSubreddit setState:[NSNumber numberWithBool:state.showSubreddit].integerValue];
67 70
 }
@@ -126,7 +129,7 @@ NSString *subredditCharacters = @"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRST
126 129
         print = FALSE;
127 130
     
128 131
     AppDelegate *app = (AppDelegate *)parent;
129
-    [app prefReturnName:username.stringValue Modhash:modhash subscriptions:subs subreddits:subreddits.textStorage.string length:length printSubs:print];
132
+    [app prefReturnName:username.stringValue Modhash:modhash subscriptions:subs subreddits:subreddits.textStorage.string length:[lengthField integerValue] printSubs:print titleLength:[titleField integerValue]];
130 133
     [win performClose:self];
131 134
 }
132 135
 
@@ -146,4 +149,10 @@ NSString *subredditCharacters = @"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRST
146 149
     [lengthField setIntegerValue:length];
147 150
 }
148 151
 
152
+-(IBAction)titleDidChange:(id)sender {
153
+    titleLength = [sender integerValue];
154
+    [titleStepper setIntegerValue:titleLength];
155
+    [titleField setIntegerValue:titleLength];
156
+}
157
+
149 158
 @end

+ 2
- 1
RedditBar/Reddit.h Просмотреть файл

@@ -39,13 +39,14 @@
39 39
 @property (atomic, retain) NSString *author;
40 40
 @property (atomic) NSInteger length;
41 41
 @property (atomic, retain) NSArray *subreddits;
42
+@property (atomic) NSInteger titleLength;
42 43
 
43 44
 // Used by Pref Window, unthreaded
44 45
 -(id)initWithUsername:(NSString *)name Password:(NSString *)pass;
45 46
 -(NSString *)queryModhash;
46 47
 
47 48
 // Used by MainMenu
48
--(id)initWithUsername:(NSString *)name Modhash:(NSString *)hash Length:(NSInteger)leng;
49
+-(id)initWithUsername:(NSString *)name Modhash:(NSString *)hash Length:(NSInteger)leng TitleLength:(NSInteger)title;
49 50
 
50 51
 // Use Threaded!
51 52
 -(void)isAuthenticatedNewModhash:(id)parent;

+ 8
- 7
RedditBar/Reddit.m Просмотреть файл

@@ -31,14 +31,13 @@
31 31
 
32 32
 @implementation Reddit
33 33
 
34
-NSInteger maxTitleLength = 66;
35 34
 NSString *replaceTextForTitle = @"...";
36 35
 NSString *subredditFormat = @" [r/%@]";
37 36
 #define AUTHOR @"xythobuz"
38 37
 
39
-@synthesize username, modhash, password, version, appName, author, length, subreddits;
38
+@synthesize username, modhash, password, version, appName, author, length, subreddits, titleLength;
40 39
 
41
--(id)initWithUsername:(NSString *)name Modhash:(NSString *)hash Length:(NSInteger)leng {
40
+-(id)initWithUsername:(NSString *)name Modhash:(NSString *)hash Length:(NSInteger)leng TitleLength:(NSInteger)title {
42 41
     self = [super init];
43 42
     if (self) {
44 43
         username = name;
@@ -48,6 +47,7 @@ NSString *subredditFormat = @" [r/%@]";
48 47
         version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
49 48
         appName = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"];
50 49
         author = AUTHOR;
50
+        titleLength = title;
51 51
     }
52 52
     return self;
53 53
 }
@@ -62,6 +62,7 @@ NSString *subredditFormat = @" [r/%@]";
62 62
         version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];
63 63
         appName = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"];
64 64
         author = AUTHOR;
65
+        titleLength = 66;
65 66
     }
66 67
     return self;
67 68
 }
@@ -123,8 +124,8 @@ NSString *subredditFormat = @" [r/%@]";
123 124
             comments = [NSString stringWithFormat:@"http://www.reddit.com%@", [current valueForKey:@"permalink"]];
124 125
         }
125 126
         NSString *subreddit = [NSString stringWithFormat:subredditFormat, [current valueForKey:@"subreddit"]];
126
-        NSInteger maxLen = maxTitleLength;
127
-        if ([subreddit length] >= maxTitleLength)
127
+        NSInteger maxLen = titleLength;
128
+        if ([subreddit length] >= titleLength)
128 129
             showSubs = FALSE;
129 130
         if (showSubs)
130 131
             maxLen -= [subreddit length];
@@ -200,13 +201,13 @@ NSString *subredditFormat = @" [r/%@]";
200 201
         NSDictionary *json = [NSJSONSerialization JSONObjectWithData:dat options:0 error:&error];
201 202
         NSDictionary *data = [json valueForKey:@"data"];
202 203
         if (data == nil) {
203
-            NSLog(@"Not logged in!");
204
+            NSLog(@"Error loading me.json: not logged in!\n");
204 205
             [parent performSelectorOnMainThread:@selector(reloadListNotAuthenticatedCallback) withObject:nil waitUntilDone:false];
205 206
             return;
206 207
         }
207 208
         NSString *newHash = [data valueForKey:@"modhash"];
208 209
         if ((newHash == nil) || ([newHash isEqualToString:@""])) {
209
-            NSLog(@"Did not receive modhash!");
210
+            NSLog(@"Error interpreting me.json: did not receive modhash!\n");
210 211
             [parent performSelectorOnMainThread:@selector(reloadListNotAuthenticatedCallback) withObject:nil waitUntilDone:false];
211 212
             return;
212 213
         }

+ 2
- 2
RedditBar/RedditBar-Info.plist Просмотреть файл

@@ -17,11 +17,11 @@
17 17
 	<key>CFBundlePackageType</key>
18 18
 	<string>APPL</string>
19 19
 	<key>CFBundleShortVersionString</key>
20
-	<string>1.0.0</string>
20
+	<string>1.1.0</string>
21 21
 	<key>CFBundleSignature</key>
22 22
 	<string>????</string>
23 23
 	<key>CFBundleVersion</key>
24
-	<string>218</string>
24
+	<string>233</string>
25 25
 	<key>LSApplicationCategoryType</key>
26 26
 	<string>public.app-category.utilities</string>
27 27
 	<key>LSMinimumSystemVersion</key>

+ 1
- 0
RedditBar/StateModel.h Просмотреть файл

@@ -36,6 +36,7 @@
36 36
 @property (atomic, retain) NSArray *subreddits;
37 37
 @property (atomic) NSInteger length;
38 38
 @property (atomic) Boolean showSubreddit;
39
+@property (atomic) NSInteger titleLength;
39 40
 
40 41
 -(void)registerDefaultPreferences;
41 42
 -(void)savePreferences;

+ 29
- 19
RedditBar/StateModel.m Просмотреть файл

@@ -30,39 +30,49 @@
30 30
 
31 31
 @implementation StateModel
32 32
 
33
-@synthesize username, modhash, useSubscriptions, subreddits, length, showSubreddit;
33
+@synthesize username, modhash, useSubscriptions, subreddits, length, showSubreddit, titleLength;
34
+
35
+NSString *s_username = @"username";
36
+NSString *s_modhash = @"modhash";
37
+NSString *s_useSubs = @"subscriptions";
38
+NSString *s_subreddits = @"subreddits";
39
+NSString *s_length = @"length";
40
+NSString *s_subs = @"showSubs";
41
+NSString *s_title = @"titleLength";
34 42
 
35 43
 -(void)registerDefaultPreferences {
36 44
     NSUserDefaults *store = [NSUserDefaults standardUserDefaults];
37
-    NSMutableDictionary *appDefaults = [NSMutableDictionary dictionaryWithObject:@"" forKey:@"username"];
38
-    [appDefaults setValue:@"" forKey:@"modhash"];
39
-    [appDefaults setValue:[NSNumber numberWithBool:YES] forKey:@"subscriptions"];
40
-    [appDefaults setValue:[NSNumber numberWithInt:10] forKey:@"length"];
41
-    [appDefaults setValue:[NSNumber numberWithBool:YES] forKey:@"showSubs"];
42
-    [appDefaults setValue:@"" forKey:@"session"];
45
+    NSMutableDictionary *appDefaults = [NSMutableDictionary dictionaryWithObject:@"" forKey:s_username];
46
+    [appDefaults setValue:@"" forKey:s_modhash];
47
+    [appDefaults setValue:[NSNumber numberWithBool:YES] forKey:s_useSubs];
48
+    [appDefaults setValue:[NSNumber numberWithInt:10] forKey:s_length];
49
+    [appDefaults setValue:[NSNumber numberWithBool:YES] forKey:s_subs];
50
+    [appDefaults setValue:[NSNumber numberWithInt:66] forKey:s_title];
43 51
     [store registerDefaults:appDefaults];
44 52
 }
45 53
 
46 54
 -(void)savePreferences {
47 55
     NSUserDefaults *store = [NSUserDefaults standardUserDefaults];
48
-    [store setObject:username forKey:@"username"];
49
-    [store setObject:modhash forKey:@"modhash"];
50
-    [store setBool:useSubscriptions forKey:@"subscriptions"];
51
-    [store setObject:subreddits forKey:@"subreddits"];
52
-    [store setInteger:length forKey:@"length"];
53
-    [store setBool:showSubreddit forKey:@"showSubs"];
56
+    [store setObject:username forKey:s_username];
57
+    [store setObject:modhash forKey:s_modhash];
58
+    [store setBool:useSubscriptions forKey:s_useSubs];
59
+    [store setObject:subreddits forKey:s_subreddits];
60
+    [store setInteger:length forKey:s_length];
61
+    [store setBool:showSubreddit forKey:s_subs];
62
+    [store setInteger:titleLength forKey:s_title];
54 63
     [store synchronize];
55 64
 }
56 65
 
57 66
 -(void)loadPreferences {
58 67
     NSUserDefaults *store = [NSUserDefaults standardUserDefaults];
59 68
     [store synchronize];
60
-    username = [store stringForKey:@"username"];
61
-    modhash = [store stringForKey:@"modhash"];
62
-    useSubscriptions = [store boolForKey:@"subscriptions"];
63
-    subreddits = [store arrayForKey:@"subreddits"];
64
-    length = [store integerForKey:@"length"];
65
-    showSubreddit = [store boolForKey:@"showSubs"];
69
+    username = [store stringForKey:s_username];
70
+    modhash = [store stringForKey:s_modhash];
71
+    useSubscriptions = [store boolForKey:s_useSubs];
72
+    subreddits = [store arrayForKey:s_subreddits];
73
+    length = [store integerForKey:s_length];
74
+    showSubreddit = [store boolForKey:s_subs];
75
+    titleLength = [store integerForKey:s_title];
66 76
 }
67 77
 
68 78
 @end

+ 6
- 0
RedditBar/de.lproj/Prefs.strings Просмотреть файл

@@ -10,6 +10,9 @@
10 10
 /* Class = "NSTextFieldCell"; title = "Items:"; ObjectID = "FNJ-RL-DXT"; */
11 11
 "FNJ-RL-DXT.title" = "Links:";
12 12
 
13
+/* Class = "NSTextFieldCell"; title = "Title:"; ObjectID = "Frl-AE-ROJ"; */
14
+"Frl-AE-ROJ.title" = "Titel:";
15
+
13 16
 /* Class = "NSTextFieldCell"; title = "Username: "; ObjectID = "GTO-OP-MYS"; */
14 17
 "GTO-OP-MYS.title" = "Benutzername: ";
15 18
 
@@ -28,6 +31,9 @@
28 31
 /* Class = "NSMenu"; title = "Edit"; ObjectID = "YpZ-Vi-h1u"; */
29 32
 "YpZ-Vi-h1u.title" = "Bearbeiten";
30 33
 
34
+/* Class = "NSTextFieldCell"; title = "66"; ObjectID = "b76-4r-MEp"; */
35
+"b76-4r-MEp.title" = "66";
36
+
31 37
 /* Class = "NSMenuItem"; title = "Edit"; ObjectID = "czz-51-wxr"; */
32 38
 "czz-51-wxr.title" = "Bearbeiten";
33 39
 

+ 6
- 0
RedditBar/en.lproj/Prefs.strings Просмотреть файл

@@ -10,6 +10,9 @@
10 10
 /* Class = "NSTextFieldCell"; title = "Items:"; ObjectID = "FNJ-RL-DXT"; */
11 11
 "FNJ-RL-DXT.title" = "Items:";
12 12
 
13
+/* Class = "NSTextFieldCell"; title = "Title:"; ObjectID = "Frl-AE-ROJ"; */
14
+"Frl-AE-ROJ.title" = "Title:";
15
+
13 16
 /* Class = "NSTextFieldCell"; title = "Username: "; ObjectID = "GTO-OP-MYS"; */
14 17
 "GTO-OP-MYS.title" = "Username: ";
15 18
 
@@ -28,6 +31,9 @@
28 31
 /* Class = "NSMenu"; title = "Edit"; ObjectID = "YpZ-Vi-h1u"; */
29 32
 "YpZ-Vi-h1u.title" = "Edit";
30 33
 
34
+/* Class = "NSTextFieldCell"; title = "66"; ObjectID = "b76-4r-MEp"; */
35
+"b76-4r-MEp.title" = "66";
36
+
31 37
 /* Class = "NSMenuItem"; title = "Edit"; ObjectID = "czz-51-wxr"; */
32 38
 "czz-51-wxr.title" = "Edit";
33 39
 

+ 6
- 0
RedditBarTests/de.lproj/Prefs.strings Просмотреть файл

@@ -10,6 +10,9 @@
10 10
 /* Class = "NSTextFieldCell"; title = "Items:"; ObjectID = "FNJ-RL-DXT"; */
11 11
 "FNJ-RL-DXT.title" = "Items:";
12 12
 
13
+/* Class = "NSTextFieldCell"; title = "Title:"; ObjectID = "Frl-AE-ROJ"; */
14
+"Frl-AE-ROJ.title" = "Title:";
15
+
13 16
 /* Class = "NSTextFieldCell"; title = "Username: "; ObjectID = "GTO-OP-MYS"; */
14 17
 "GTO-OP-MYS.title" = "Username: ";
15 18
 
@@ -28,6 +31,9 @@
28 31
 /* Class = "NSMenu"; title = "Edit"; ObjectID = "YpZ-Vi-h1u"; */
29 32
 "YpZ-Vi-h1u.title" = "Edit";
30 33
 
34
+/* Class = "NSTextFieldCell"; title = "66"; ObjectID = "b76-4r-MEp"; */
35
+"b76-4r-MEp.title" = "66";
36
+
31 37
 /* Class = "NSMenuItem"; title = "Edit"; ObjectID = "czz-51-wxr"; */
32 38
 "czz-51-wxr.title" = "Edit";
33 39
 

+ 6
- 0
RedditBarTests/en.lproj/Prefs.strings Просмотреть файл

@@ -10,6 +10,9 @@
10 10
 /* Class = "NSTextFieldCell"; title = "Items:"; ObjectID = "FNJ-RL-DXT"; */
11 11
 "FNJ-RL-DXT.title" = "Items:";
12 12
 
13
+/* Class = "NSTextFieldCell"; title = "Title:"; ObjectID = "Frl-AE-ROJ"; */
14
+"Frl-AE-ROJ.title" = "Title:";
15
+
13 16
 /* Class = "NSTextFieldCell"; title = "Username: "; ObjectID = "GTO-OP-MYS"; */
14 17
 "GTO-OP-MYS.title" = "Username: ";
15 18
 
@@ -28,6 +31,9 @@
28 31
 /* Class = "NSMenu"; title = "Edit"; ObjectID = "YpZ-Vi-h1u"; */
29 32
 "YpZ-Vi-h1u.title" = "Edit";
30 33
 
34
+/* Class = "NSTextFieldCell"; title = "66"; ObjectID = "b76-4r-MEp"; */
35
+"b76-4r-MEp.title" = "66";
36
+
31 37
 /* Class = "NSMenuItem"; title = "Edit"; ObjectID = "czz-51-wxr"; */
32 38
 "czz-51-wxr.title" = "Edit";
33 39
 

Загрузка…
Отмена
Сохранить