Changeset 4225
- Timestamp:
- Dec 19, 2007, 8:46:00 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/NEWS
r4218 r4225 9 9 - OS X: 10 10 + Redesigned Leopard-like look 11 + Group label s11 + Group labeling, filtering, and sorting 12 12 + Statistics window 13 13 + Pieces Bar (return of Advanced Bar) -
trunk/macosx/Controller.h
r4187 r4225 81 81 * fDownloadLimitItem, * fDownloadNoLimitItem; 82 82 83 IBOutlet NSMenu * fGroupsSetMenu, * fGroupsSetContextMenu; 83 IBOutlet NSMenu * fGroupsSetMenu, * fGroupsSetContextMenu, * fGroupFilterMenu; 84 IBOutlet NSPopUpButton * fGroupsButton; 84 85 85 86 IBOutlet NSWindow * fURLSheetWindow; … … 194 195 - (void) showGroups: (id) sender; 195 196 - (void) setGroup: (id) sender; 197 - (void) setGroupFilter: (id) sender; 198 - (void) updateGroupFilterButton; 196 199 197 200 - (void) toggleSpeedLimit: (id) sender; -
trunk/macosx/Controller.m
r4219 r4225 96 96 #define FILTER_TYPE_TAG_TRACKER 402 97 97 98 #define GROUP_FILTER_ALL_TAG -2 99 98 100 #define STATUS_RATIO_TOTAL @"RatioTotal" 99 101 #define STATUS_RATIO_SESSION @"RatioSession" … … 289 291 [fPauseFilterButton setFrame: pauseRect]; 290 292 } 293 294 [self updateGroupFilterButton]; 291 295 292 296 //set up filter bar … … 1859 1863 [fPauseFilterButton setCount: paused]; 1860 1864 1865 //remove for groups 1866 int groupFilter = [fDefaults integerForKey: @"FilterGroup"]; 1867 if (groupFilter != GROUP_FILTER_ALL_TAG) 1868 { 1869 filtering = YES; 1870 1871 int i; 1872 for (i = [tempTorrents count]-1; i >= 0; i--) 1873 if ([[tempTorrents objectAtIndex: i] groupValue] != groupFilter) 1874 [tempTorrents removeObjectAtIndex: i]; 1875 } 1876 1877 //remove from text field 1861 1878 NSString * searchString = [fSearchFilterField stringValue]; 1862 if ([ searchString length] > 0)1879 if ([tempTorrents count] > 0 && [searchString length] > 0) 1863 1880 { 1864 1881 filtering = YES; … … 2055 2072 [menu removeItemAtIndex: i]; 2056 2073 2057 NSMenu * groupMenu = [[GroupsWindowController groupsController] groupMenuWithTarget: self action: @selector(setGroup:)]; 2074 NSMenu * groupMenu = [[GroupsWindowController groupsController] groupMenuWithTarget: self action: @selector(setGroup:) 2075 isSmall: NO]; 2058 2076 [menu appendItemsFromMenu: groupMenu atIndexes: [NSIndexSet indexSetWithIndexesInRange: 2059 2077 NSMakeRange(0, [groupMenu numberOfItems])] atBottom: NO]; 2060 2078 } 2079 else if (menu == fGroupFilterMenu) 2080 { 2081 int i; 2082 for (i = [menu numberOfItems]-1; i >= 3; i--) 2083 [menu removeItemAtIndex: i]; 2084 2085 NSMenu * groupMenu = [[GroupsWindowController groupsController] groupMenuWithTarget: self action: @selector(setGroupFilter:) 2086 isSmall: YES]; 2087 [menu appendItemsFromMenu: groupMenu atIndexes: [NSIndexSet indexSetWithIndexesInRange: 2088 NSMakeRange(0, [groupMenu numberOfItems])] atBottom: YES]; 2089 } 2090 else; 2061 2091 } 2062 2092 … … 2071 2101 [self applyFilter: nil]; 2072 2102 [self updateTorrentHistory]; 2103 } 2104 2105 - (void) setGroupFilter: (id) sender 2106 { 2107 [fDefaults setInteger: [sender tag] forKey: @"FilterGroup"]; 2108 [self updateGroupFilterButton]; 2109 [self applyFilter: nil]; 2110 } 2111 2112 - (void) updateGroupFilterButton 2113 { 2114 int index = [fDefaults integerForKey: @"FilterGroup"]; 2115 2116 NSImage * icon; 2117 if (index >= 0) 2118 icon = [[GroupsWindowController groupsController] imageForIndex: index isSmall: YES]; 2119 else 2120 icon = [NSImage imageNamed: NSImageNameRemoveTemplate]; 2121 [[fGroupFilterMenu itemAtIndex: 0] setImage: icon]; 2122 2123 NSString * toolTip; 2124 switch (index) 2125 { 2126 case GROUP_FILTER_ALL_TAG: 2127 toolTip = NSLocalizedString(@"All Groups", "Groups -> Button"); 2128 break; 2129 case -1: 2130 toolTip = NSLocalizedString(@"Group: No Label", "Groups -> Button"); 2131 break; 2132 default: 2133 toolTip = [NSLocalizedString(@"Group: ", "Groups -> Button") stringByAppendingString: 2134 [[GroupsWindowController groupsController] nameForIndex: index]]; 2135 } 2136 [fGroupsButton setToolTip: toolTip]; 2073 2137 } 2074 2138 … … 2665 2729 [fSearchFilterField setStringValue: @""]; 2666 2730 [self setFilter: fNoFilterButton]; 2731 [self setGroupFilter: [fGroupFilterMenu itemWithTag: GROUP_FILTER_ALL_TAG]]; 2667 2732 } 2668 2733 … … 3112 3177 } 3113 3178 3179 if (action == @selector(setGroupFilter:)) 3180 { 3181 [menuItem setState: [menuItem tag] == [fDefaults integerForKey: @"FilterGroup"] ? NSOnState : NSOffState]; 3182 return YES; 3183 } 3184 3114 3185 if (action == @selector(toggleSmallView:)) 3115 3186 { -
trunk/macosx/Defaults.plist
r4187 r4225 59 59 <key>FilterBar</key> 60 60 <false/> 61 <key>FilterGroup</key> 62 <integer>-2</integer> 61 63 <key>FilterSearchType</key> 62 64 <string>Name</string> -
trunk/macosx/English.lproj/MainMenu.nib/classes.nib
r4187 r4225 112 112 <string>id</string> 113 113 <key>setGroup</key> 114 <string>id</string> 115 <key>setGroupFilter</key> 114 116 <string>id</string> 115 117 <key>setInfoTab</key> … … 186 188 <key>fFilterBar</key> 187 189 <string>StatusBarView</string> 190 <key>fGroupFilterMenu</key> 191 <string>NSMenu</string> 192 <key>fGroupsButton</key> 193 <string>NSPopUpButton</string> 188 194 <key>fGroupsSetContextMenu</key> 189 195 <string>NSMenu</string> … … 260 266 </dict> 261 267 <dict> 268 <key>CLASS</key> 269 <string>FilterButton</string> 270 <key>LANGUAGE</key> 271 <string>ObjC</string> 272 <key>SUPERCLASS</key> 273 <string>NSButton</string> 274 </dict> 275 <dict> 262 276 <key>ACTIONS</key> 263 277 <dict> … … 296 310 <key>SUPERCLASS</key> 297 311 <string>NSTableView</string> 298 </dict>299 <dict>300 <key>CLASS</key>301 <string>FilterButton</string>302 <key>LANGUAGE</key>303 <string>ObjC</string>304 <key>SUPERCLASS</key>305 <string>NSButton</string>306 312 </dict> 307 313 <dict> -
trunk/macosx/English.lproj/MainMenu.nib/info.nib
r4211 r4225 10 10 <integer>5</integer> 11 11 <key>IBOpenObjects</key> 12 <array> 13 <integer>2279</integer> 14 </array> 12 <array/> 15 13 <key>IBSystem Version</key> 16 14 <string>9B18</string> -
trunk/macosx/GroupsWindowController.h
r4201 r4225 39 39 + (GroupsWindowController *) groupsController; 40 40 41 - (int) orderValueForIndex: (int) index; 41 42 - (CTGradient *) gradientForIndex: (int) index; 42 43 - ( int) orderValueForIndex: (int) index;43 - (NSString *) nameForIndex: (int) index; 44 - (NSImage *) imageForIndex: (int) index isSmall: (BOOL) small; 44 45 45 46 - (void) addRemoveGroup: (id) sender; 46 47 47 - (NSMenu *) groupMenuWithTarget: (id) target action: (SEL) action ;48 - (NSMenu *) groupMenuWithTarget: (id) target action: (SEL) action isSmall: (BOOL) small; 48 49 49 50 @end -
trunk/macosx/GroupsWindowController.m
r4219 r4225 29 29 #import "NSApplicationAdditions.h" 30 30 31 #define ICON_WIDTH 16.0 32 #define ICON_WIDTH_SMALL 12.0 33 31 34 #define GROUP_TABLE_VIEW_DATA_TYPE @"GroupTableViewDataType" 32 35 … … 134 137 } 135 138 136 - (CTGradient *) gradientForIndex: (int) index137 {138 if (index < 0)139 return nil;140 141 NSEnumerator * enumerator = [fGroups objectEnumerator];142 NSDictionary * dict;143 while ((dict = [enumerator nextObject]))144 if ([[dict objectForKey: @"Index"] intValue] == index)145 return [self gradientForColor: [dict objectForKey: @"Color"]];146 147 return nil;148 }149 150 139 - (int) orderValueForIndex: (int) index 151 140 { … … 158 147 } 159 148 return -1; 149 } 150 151 - (CTGradient *) gradientForIndex: (int) index 152 { 153 int orderIndex = [self orderValueForIndex: index]; 154 return orderIndex != -1 ? [self gradientForColor: [[fGroups objectAtIndex: orderIndex] objectForKey: @"Color"]] : nil; 155 } 156 157 - (NSString *) nameForIndex: (int) index 158 { 159 int orderIndex = [self orderValueForIndex: index]; 160 return orderIndex != -1 ? [[fGroups objectAtIndex: orderIndex] objectForKey: @"Name"] : nil; 161 } 162 163 - (NSImage *) imageForIndex: (int) index isSmall: (BOOL) small 164 { 165 CTGradient * gradient; 166 if (!(gradient = [self gradientForIndex: index])) 167 return nil; 168 169 float width = small ? ICON_WIDTH_SMALL : ICON_WIDTH; 170 NSBezierPath * bp = [NSBezierPath bezierPathWithRoundedRect: NSMakeRect(0.0, 0.0, width, width) radius: 4.0]; 171 NSImage * icon = [[NSImage alloc] initWithSize: [bp bounds].size]; 172 173 [icon lockFocus]; 174 [gradient fillBezierPath: bp angle: 270.0]; 175 [icon unlockFocus]; 176 177 return [icon autorelease]; 160 178 } 161 179 … … 330 348 } 331 349 332 - (NSMenu *) groupMenuWithTarget: (id) target action: (SEL) action 350 - (NSMenu *) groupMenuWithTarget: (id) target action: (SEL) action isSmall: (BOOL) small 333 351 { 334 352 NSMenu * menu = [[NSMenu alloc] initWithTitle: @"Groups"]; … … 341 359 [item release]; 342 360 343 NSBezierPath * bp = [NSBezierPath bezierPathWithRoundedRect: NSMakeRect(0.0, 0.0, 16.0, 16.0) radius: 4.0];344 345 361 NSEnumerator * enumerator = [fGroups objectEnumerator]; 346 362 NSDictionary * dict; … … 350 366 [item setTarget: target]; 351 367 352 NSImage * icon = [[NSImage alloc] initWithSize: [bp bounds].size]; 353 354 [icon lockFocus]; 355 [[self gradientForColor: [dict objectForKey: @"Color"]] fillBezierPath: bp angle: 270.0]; 356 [icon unlockFocus]; 357 358 [item setImage: icon]; 359 [icon release]; 360 361 [item setTag: [[dict objectForKey: @"Index"] intValue]]; 368 int index = [[dict objectForKey: @"Index"] intValue]; 369 370 #warning use dict 371 [item setImage: [self imageForIndex: index isSmall: small]]; 372 [item setTag: index]; 362 373 363 374 [menu addItem: item]; … … 365 376 } 366 377 378 367 379 return [menu autorelease]; 368 380 } -
trunk/macosx/PortChecker.m
r4207 r4225 26 26 #import "NSApplicationAdditions.h" 27 27 28 #define CHECKER_URL @"http://transmission.m0k.org/PortCheck.php?port=%d" 29 28 30 @implementation PortChecker 29 31 … … 35 37 36 38 NSURLRequest * portProbeRequest = [NSURLRequest requestWithURL: [NSURL URLWithString: 37 [NSString stringWithFormat: @"http://transmission.m0k.org/PortCheck.php?port=%d", portNumber]] cachePolicy:39 [NSString stringWithFormat: CHECKER_URL, portNumber]] cachePolicy: 38 40 [NSApp isOnLeopardOrBetter] ? NSURLRequestReloadIgnoringLocalCacheData : NSURLRequestReloadIgnoringCacheData 39 41 timeoutInterval: 15.0];
Note: See TracChangeset
for help on using the changeset viewer.