Browse Source

Can change title length. Bumped Version Number to 1.1.0

Thomas Buck 11 years ago
parent
commit
7da1504c75

+ 0
- 2
RedditBar.xcodeproj/project.pbxproj View File

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

+ 1
- 1
RedditBar/AppDelegate.h View File

59
 -(void)reloadListHasSubredditsCallback:(NSArray *)items;
59
 -(void)reloadListHasSubredditsCallback:(NSArray *)items;
60
 -(void)reloadListHasFrontpageCallback:(NSArray *)items;
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
 @end
64
 @end

+ 3
- 2
RedditBar/AppDelegate.m View File

96
         return;
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
     [NSThread detachNewThreadSelector:@selector(isAuthenticatedNewModhash:) toTarget:api withObject:self];
100
     [NSThread detachNewThreadSelector:@selector(isAuthenticatedNewModhash:) toTarget:api withObject:self];
101
 }
101
 }
102
 
102
 
200
     [application orderFrontStandardAboutPanel:self];
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
     currentState.username = name;
204
     currentState.username = name;
205
     currentState.modhash = modhash;
205
     currentState.modhash = modhash;
206
     currentState.useSubscriptions = subscriptions;
206
     currentState.useSubscriptions = subscriptions;
207
     currentState.subreddits = [subreddits componentsSeparatedByString: @"\n"];
207
     currentState.subreddits = [subreddits componentsSeparatedByString: @"\n"];
208
     currentState.length = length;
208
     currentState.length = length;
209
     currentState.showSubreddit = showSubreddits;
209
     currentState.showSubreddit = showSubreddits;
210
+    currentState.titleLength = titleLength;
210
     [currentState savePreferences];
211
     [currentState savePreferences];
211
     lastFullName = nil; // reload from start
212
     lastFullName = nil; // reload from start
212
     [self reloadListWithOptions];
213
     [self reloadListWithOptions];

+ 6
- 0
RedditBar/Base.lproj/Prefs.strings View File

11
 /* Class = "NSTextFieldCell"; title = "Items:"; ObjectID = "FNJ-RL-DXT"; */
11
 /* Class = "NSTextFieldCell"; title = "Items:"; ObjectID = "FNJ-RL-DXT"; */
12
 "FNJ-RL-DXT.title" = "Items:";
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
 /* Class = "NSTextFieldCell"; title = "Username: "; ObjectID = "GTO-OP-MYS"; */
17
 /* Class = "NSTextFieldCell"; title = "Username: "; ObjectID = "GTO-OP-MYS"; */
15
 "GTO-OP-MYS.title" = "Username: ";
18
 "GTO-OP-MYS.title" = "Username: ";
16
 
19
 
29
 /* Class = "NSMenu"; title = "Edit"; ObjectID = "YpZ-Vi-h1u"; */
32
 /* Class = "NSMenu"; title = "Edit"; ObjectID = "YpZ-Vi-h1u"; */
30
 "YpZ-Vi-h1u.title" = "Edit";
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
 /* Class = "NSMenuItem"; title = "Edit"; ObjectID = "czz-51-wxr"; */
38
 /* Class = "NSMenuItem"; title = "Edit"; ObjectID = "czz-51-wxr"; */
33
 "czz-51-wxr.title" = "Edit";
39
 "czz-51-wxr.title" = "Edit";
34
 
40
 

+ 49
- 5
RedditBar/Base.lproj/Prefs.xib View File

8
         <customObject id="-2" userLabel="File's Owner" customClass="PrefController">
8
         <customObject id="-2" userLabel="File's Owner" customClass="PrefController">
9
             <connections>
9
             <connections>
10
                 <outlet property="lengthField" destination="MAv-jO-hIv" id="tbQ-UG-2ew"/>
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
                 <outlet property="lengthStepper" destination="jxz-fQ-M1L" id="NK5-G4-9UJ"/>
11
                 <outlet property="lengthStepper" destination="jxz-fQ-M1L" id="NK5-G4-9UJ"/>
13
                 <outlet property="password" destination="ARP-lb-J16" id="EDd-om-ciF"/>
12
                 <outlet property="password" destination="ARP-lb-J16" id="EDd-om-ciF"/>
14
                 <outlet property="progress" destination="vz0-tR-n1f" id="t06-dO-WKY"/>
13
                 <outlet property="progress" destination="vz0-tR-n1f" id="t06-dO-WKY"/>
15
                 <outlet property="showSubreddit" destination="fRR-M9-szp" id="bGR-ej-R9R"/>
14
                 <outlet property="showSubreddit" destination="fRR-M9-szp" id="bGR-ej-R9R"/>
16
                 <outlet property="subreddits" destination="EhP-FS-8dT" id="td1-kv-jQm"/>
15
                 <outlet property="subreddits" destination="EhP-FS-8dT" id="td1-kv-jQm"/>
17
                 <outlet property="subscriptions" destination="vW5-Cp-Bm1" id="gja-K0-7Uh"/>
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
                 <outlet property="username" destination="0mi-88-o94" id="4bB-K2-q5m"/>
19
                 <outlet property="username" destination="0mi-88-o94" id="4bB-K2-q5m"/>
19
                 <outlet property="win" destination="1" id="g0G-6q-WjE"/>
20
                 <outlet property="win" destination="1" id="g0G-6q-WjE"/>
20
             </connections>
21
             </connections>
58
                         </textFieldCell>
59
                         </textFieldCell>
59
                     </textField>
60
                     </textField>
60
                     <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="qFP-pd-32c">
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
                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
63
                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
63
                         <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="Items:" id="FNJ-RL-DXT">
64
                         <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="Items:" id="FNJ-RL-DXT">
64
                             <font key="font" metaFont="system"/>
65
                             <font key="font" metaFont="system"/>
66
                             <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
67
                             <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
67
                         </textFieldCell>
68
                         </textFieldCell>
68
                     </textField>
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
                     <secureTextField verticalHuggingPriority="750" id="ARP-lb-J16">
79
                     <secureTextField verticalHuggingPriority="750" id="ARP-lb-J16">
70
                         <rect key="frame" x="120" y="251" width="200" height="22"/>
80
                         <rect key="frame" x="120" y="251" width="200" height="22"/>
71
                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
81
                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
144
                         </connections>
154
                         </connections>
145
                     </button>
155
                     </button>
146
                     <textField verticalHuggingPriority="750" id="MAv-jO-hIv">
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
                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
158
                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
149
                         <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">
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
                             <font key="font" metaFont="system"/>
160
                             <font key="font" metaFont="system"/>
156
                             <outlet property="formatter" destination="zpc-oG-upp" id="cw1-hM-34K"/>
166
                             <outlet property="formatter" destination="zpc-oG-upp" id="cw1-hM-34K"/>
157
                         </connections>
167
                         </connections>
158
                     </textField>
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
                     <stepper horizontalHuggingPriority="750" verticalHuggingPriority="750" id="jxz-fQ-M1L">
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
                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
184
                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
162
                         <stepperCell key="cell" continuous="YES" alignment="left" maxValue="100" id="Gba-jV-Ouh"/>
185
                         <stepperCell key="cell" continuous="YES" alignment="left" maxValue="100" id="Gba-jV-Ouh"/>
163
                         <connections>
186
                         <connections>
164
                             <action selector="lengthDidChange:" target="-2" id="CJm-58-seM"/>
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
                         </connections>
198
                         </connections>
166
                     </stepper>
199
                     </stepper>
167
                     <progressIndicator canDrawConcurrently="YES" horizontalHuggingPriority="750" verticalHuggingPriority="750" maxValue="100" displayedWhenStopped="NO" bezeled="NO" indeterminate="YES" controlSize="small" style="spinning" id="vz0-tR-n1f">
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
             <attributedString key="attributedStringForZero">
216
             <attributedString key="attributedStringForZero">
184
                 <fragment content="0"/>
217
                 <fragment content="0"/>
185
             </attributedString>
218
             </attributedString>
186
-            <real key="minimum" value="0.0"/>
219
+            <real key="minimum" value="1"/>
187
             <real key="maximum" value="100"/>
220
             <real key="maximum" value="100"/>
188
             <metadata>
221
             <metadata>
189
                 <bool key="localizesFormat" value="YES"/>
222
                 <bool key="localizesFormat" value="YES"/>
190
                 <real key="inspectorSampleValue" value="1"/>
223
                 <real key="inspectorSampleValue" value="1"/>
191
             </metadata>
224
             </metadata>
192
         </numberFormatter>
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
         <menu title="Main Menu" systemMenu="main" id="IWp-hb-gSM">
237
         <menu title="Main Menu" systemMenu="main" id="IWp-hb-gSM">
194
             <items>
238
             <items>
195
                 <menuItem title="Edit" id="czz-51-wxr">
239
                 <menuItem title="Edit" id="czz-51-wxr">

+ 4
- 1
RedditBar/PrefController.h View File

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

+ 11
- 2
RedditBar/PrefController.m View File

34
 NSString *modhashSetLiteral = @"__MODHASH__IS__SET__";
34
 NSString *modhashSetLiteral = @"__MODHASH__IS__SET__";
35
 NSString *subredditCharacters = @"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890-_\n";
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
 -(Boolean)isValidList:(NSString *)input {
39
 -(Boolean)isValidList:(NSString *)input {
40
     NSCharacterSet *invalidChars = [[NSCharacterSet characterSetWithCharactersInString:subredditCharacters] invertedSet];
40
     NSCharacterSet *invalidChars = [[NSCharacterSet characterSetWithCharactersInString:subredditCharacters] invertedSet];
62
     length = state.length;
62
     length = state.length;
63
     [lengthStepper setIntegerValue:length];
63
     [lengthStepper setIntegerValue:length];
64
     [lengthField setIntegerValue:length];
64
     [lengthField setIntegerValue:length];
65
+    titleLength = state.titleLength;
66
+    [titleStepper setIntegerValue:titleLength];
67
+    [titleField setIntegerValue:titleLength];
65
     [progress setUsesThreadedAnimation:YES];
68
     [progress setUsesThreadedAnimation:YES];
66
     [showSubreddit setState:[NSNumber numberWithBool:state.showSubreddit].integerValue];
69
     [showSubreddit setState:[NSNumber numberWithBool:state.showSubreddit].integerValue];
67
 }
70
 }
126
         print = FALSE;
129
         print = FALSE;
127
     
130
     
128
     AppDelegate *app = (AppDelegate *)parent;
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
     [win performClose:self];
133
     [win performClose:self];
131
 }
134
 }
132
 
135
 
146
     [lengthField setIntegerValue:length];
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
 @end
158
 @end

+ 2
- 1
RedditBar/Reddit.h View File

39
 @property (atomic, retain) NSString *author;
39
 @property (atomic, retain) NSString *author;
40
 @property (atomic) NSInteger length;
40
 @property (atomic) NSInteger length;
41
 @property (atomic, retain) NSArray *subreddits;
41
 @property (atomic, retain) NSArray *subreddits;
42
+@property (atomic) NSInteger titleLength;
42
 
43
 
43
 // Used by Pref Window, unthreaded
44
 // Used by Pref Window, unthreaded
44
 -(id)initWithUsername:(NSString *)name Password:(NSString *)pass;
45
 -(id)initWithUsername:(NSString *)name Password:(NSString *)pass;
45
 -(NSString *)queryModhash;
46
 -(NSString *)queryModhash;
46
 
47
 
47
 // Used by MainMenu
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
 // Use Threaded!
51
 // Use Threaded!
51
 -(void)isAuthenticatedNewModhash:(id)parent;
52
 -(void)isAuthenticatedNewModhash:(id)parent;

+ 8
- 7
RedditBar/Reddit.m View File

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

+ 2
- 2
RedditBar/RedditBar-Info.plist View File

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

+ 1
- 0
RedditBar/StateModel.h View File

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

+ 29
- 19
RedditBar/StateModel.m View File

30
 
30
 
31
 @implementation StateModel
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
 -(void)registerDefaultPreferences {
43
 -(void)registerDefaultPreferences {
36
     NSUserDefaults *store = [NSUserDefaults standardUserDefaults];
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
     [store registerDefaults:appDefaults];
51
     [store registerDefaults:appDefaults];
44
 }
52
 }
45
 
53
 
46
 -(void)savePreferences {
54
 -(void)savePreferences {
47
     NSUserDefaults *store = [NSUserDefaults standardUserDefaults];
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
     [store synchronize];
63
     [store synchronize];
55
 }
64
 }
56
 
65
 
57
 -(void)loadPreferences {
66
 -(void)loadPreferences {
58
     NSUserDefaults *store = [NSUserDefaults standardUserDefaults];
67
     NSUserDefaults *store = [NSUserDefaults standardUserDefaults];
59
     [store synchronize];
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
 @end
78
 @end

+ 6
- 0
RedditBar/de.lproj/Prefs.strings View File

10
 /* Class = "NSTextFieldCell"; title = "Items:"; ObjectID = "FNJ-RL-DXT"; */
10
 /* Class = "NSTextFieldCell"; title = "Items:"; ObjectID = "FNJ-RL-DXT"; */
11
 "FNJ-RL-DXT.title" = "Links:";
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
 /* Class = "NSTextFieldCell"; title = "Username: "; ObjectID = "GTO-OP-MYS"; */
16
 /* Class = "NSTextFieldCell"; title = "Username: "; ObjectID = "GTO-OP-MYS"; */
14
 "GTO-OP-MYS.title" = "Benutzername: ";
17
 "GTO-OP-MYS.title" = "Benutzername: ";
15
 
18
 
28
 /* Class = "NSMenu"; title = "Edit"; ObjectID = "YpZ-Vi-h1u"; */
31
 /* Class = "NSMenu"; title = "Edit"; ObjectID = "YpZ-Vi-h1u"; */
29
 "YpZ-Vi-h1u.title" = "Bearbeiten";
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
 /* Class = "NSMenuItem"; title = "Edit"; ObjectID = "czz-51-wxr"; */
37
 /* Class = "NSMenuItem"; title = "Edit"; ObjectID = "czz-51-wxr"; */
32
 "czz-51-wxr.title" = "Bearbeiten";
38
 "czz-51-wxr.title" = "Bearbeiten";
33
 
39
 

+ 6
- 0
RedditBar/en.lproj/Prefs.strings View File

10
 /* Class = "NSTextFieldCell"; title = "Items:"; ObjectID = "FNJ-RL-DXT"; */
10
 /* Class = "NSTextFieldCell"; title = "Items:"; ObjectID = "FNJ-RL-DXT"; */
11
 "FNJ-RL-DXT.title" = "Items:";
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
 /* Class = "NSTextFieldCell"; title = "Username: "; ObjectID = "GTO-OP-MYS"; */
16
 /* Class = "NSTextFieldCell"; title = "Username: "; ObjectID = "GTO-OP-MYS"; */
14
 "GTO-OP-MYS.title" = "Username: ";
17
 "GTO-OP-MYS.title" = "Username: ";
15
 
18
 
28
 /* Class = "NSMenu"; title = "Edit"; ObjectID = "YpZ-Vi-h1u"; */
31
 /* Class = "NSMenu"; title = "Edit"; ObjectID = "YpZ-Vi-h1u"; */
29
 "YpZ-Vi-h1u.title" = "Edit";
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
 /* Class = "NSMenuItem"; title = "Edit"; ObjectID = "czz-51-wxr"; */
37
 /* Class = "NSMenuItem"; title = "Edit"; ObjectID = "czz-51-wxr"; */
32
 "czz-51-wxr.title" = "Edit";
38
 "czz-51-wxr.title" = "Edit";
33
 
39
 

+ 6
- 0
RedditBarTests/de.lproj/Prefs.strings View File

10
 /* Class = "NSTextFieldCell"; title = "Items:"; ObjectID = "FNJ-RL-DXT"; */
10
 /* Class = "NSTextFieldCell"; title = "Items:"; ObjectID = "FNJ-RL-DXT"; */
11
 "FNJ-RL-DXT.title" = "Items:";
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
 /* Class = "NSTextFieldCell"; title = "Username: "; ObjectID = "GTO-OP-MYS"; */
16
 /* Class = "NSTextFieldCell"; title = "Username: "; ObjectID = "GTO-OP-MYS"; */
14
 "GTO-OP-MYS.title" = "Username: ";
17
 "GTO-OP-MYS.title" = "Username: ";
15
 
18
 
28
 /* Class = "NSMenu"; title = "Edit"; ObjectID = "YpZ-Vi-h1u"; */
31
 /* Class = "NSMenu"; title = "Edit"; ObjectID = "YpZ-Vi-h1u"; */
29
 "YpZ-Vi-h1u.title" = "Edit";
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
 /* Class = "NSMenuItem"; title = "Edit"; ObjectID = "czz-51-wxr"; */
37
 /* Class = "NSMenuItem"; title = "Edit"; ObjectID = "czz-51-wxr"; */
32
 "czz-51-wxr.title" = "Edit";
38
 "czz-51-wxr.title" = "Edit";
33
 
39
 

+ 6
- 0
RedditBarTests/en.lproj/Prefs.strings View File

10
 /* Class = "NSTextFieldCell"; title = "Items:"; ObjectID = "FNJ-RL-DXT"; */
10
 /* Class = "NSTextFieldCell"; title = "Items:"; ObjectID = "FNJ-RL-DXT"; */
11
 "FNJ-RL-DXT.title" = "Items:";
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
 /* Class = "NSTextFieldCell"; title = "Username: "; ObjectID = "GTO-OP-MYS"; */
16
 /* Class = "NSTextFieldCell"; title = "Username: "; ObjectID = "GTO-OP-MYS"; */
14
 "GTO-OP-MYS.title" = "Username: ";
17
 "GTO-OP-MYS.title" = "Username: ";
15
 
18
 
28
 /* Class = "NSMenu"; title = "Edit"; ObjectID = "YpZ-Vi-h1u"; */
31
 /* Class = "NSMenu"; title = "Edit"; ObjectID = "YpZ-Vi-h1u"; */
29
 "YpZ-Vi-h1u.title" = "Edit";
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
 /* Class = "NSMenuItem"; title = "Edit"; ObjectID = "czz-51-wxr"; */
37
 /* Class = "NSMenuItem"; title = "Edit"; ObjectID = "czz-51-wxr"; */
32
 "czz-51-wxr.title" = "Edit";
38
 "czz-51-wxr.title" = "Edit";
33
 
39
 

Loading…
Cancel
Save