Changeset 5960
- Timestamp:
- May 28, 2008, 11:57:25 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Transmission.xcodeproj/project.pbxproj
r5920 r5960 455 455 4DE5CCB80981D27700BE280E /* ResumeAll.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = ResumeAll.png; path = macosx/Images/ResumeAll.png; sourceTree = "<group>"; }; 456 456 4DE5CCB90981D27700BE280E /* PauseAll.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = PauseAll.png; path = macosx/Images/PauseAll.png; sourceTree = "<group>"; }; 457 4DE5CCCA0981D9BE00BE280E /* Defaults.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text. xml; name = Defaults.plist; path = macosx/Defaults.plist; sourceTree = "<group>"; };457 4DE5CCCA0981D9BE00BE280E /* Defaults.plist */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.plist.xml; name = Defaults.plist; path = macosx/Defaults.plist; sourceTree = "<group>"; }; 458 458 4DF0C5A90899190500DD8943 /* Controller.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = Controller.m; path = macosx/Controller.m; sourceTree = "<group>"; }; 459 459 4DF0C5AA0899190500DD8943 /* Controller.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = Controller.h; path = macosx/Controller.h; sourceTree = "<group>"; }; -
trunk/macosx/Controller.m
r5950 r5960 1207 1207 while ((torrent = [enumerator nextObject])) 1208 1208 { 1209 #warning redo, since now can be removed through rpc 1209 1210 //expand the group, since either the whole group is being removed, it is already expanded, or not showing groups 1210 1211 [fTableView removeCollapsedGroup: [torrent groupValue]]; -
trunk/macosx/CreatorWindowController.h
r5710 r5960 32 32 IBOutlet NSTextField * fNameField, * fStatusField, * fPiecesField, * fTrackerField, * fLocationField; 33 33 IBOutlet NSTextView * fCommentView; 34 IBOutlet NSButton * fCreateButton, *fPrivateCheck, * fOpenCheck;34 IBOutlet NSButton * fPrivateCheck, * fOpenCheck; 35 35 36 36 IBOutlet NSView * fProgressView; … … 38 38 39 39 tr_metainfo_builder * fInfo; 40 NSString * fPath, * fLocation ;40 NSString * fPath, * fLocation, * fTracker; 41 41 BOOL fOpenTorrent; 42 42 … … 52 52 - (id) initWithHandle: (tr_handle *) handle path: (NSString *) path; 53 53 54 - (void) toggleOpenCheck: (id) sender; 55 54 56 - (void) setLocation: (id) sender; 55 57 - (void) create: (id) sender; -
trunk/macosx/CreatorWindowController.m
r5718 r5960 30 30 31 31 + (NSString *) chooseFile; 32 - (void) updateEnable CreateButtonForTrackerField;32 - (void) updateEnableOpenCheckForTrackerField; 33 33 - (void) locationSheetClosed: (NSSavePanel *) openPanel returnCode: (int) code contextInfo: (void *) info; 34 35 - (void) createReal; 34 36 - (void) checkProgress; 35 37 - (void) failureSheetClosed: (NSAlert *) alert returnCode: (int) code contextInfo: (void *) info; … … 151 153 if ((tracker = [fDefaults stringForKey: @"CreatorTracker"])) 152 154 [fTrackerField setStringValue: tracker]; 153 [self updateEnableCreateButtonForTrackerField];154 155 155 156 if ([fDefaults objectForKey: @"CreatorPrivate"]) 156 157 [fPrivateCheck setState: [fDefaults boolForKey: @"CreatorPrivate"] ? NSOnState : NSOffState]; 157 158 158 if ([fDefaults objectForKey: @"CreatorOpen"])159 [fOpenCheck setState: [fDefaults boolForKey: @"CreatorOpen"] ? NSOnState : NSOffState];159 fOpenTorrent = [fDefaults boolForKey: @"CreatorOpen"]; 160 [self updateEnableOpenCheckForTrackerField]; 160 161 } 161 162 … … 165 166 [fLocation release]; 166 167 168 [fTracker release]; 169 167 170 if (fInfo) 168 171 tr_metaInfoBuilderFree(fInfo); … … 172 175 173 176 [super dealloc]; 177 } 178 179 - (void) toggleOpenCheck: (id) sender 180 { 181 fOpenTorrent = [fOpenCheck state] == NSOnState; 182 } 183 184 - (void) controlTextDidChange: (NSNotification *) notification 185 { 186 if ([notification object] == fTrackerField) 187 [self updateEnableOpenCheckForTrackerField]; 174 188 } 175 189 … … 190 204 } 191 205 192 - (void) controlTextDidChange: (NSNotification *) notification193 {194 if ([notification object] == fTrackerField)195 [self updateEnableCreateButtonForTrackerField];196 }197 198 206 - (void) create: (id) sender 199 207 { 200 NSString * trackerString = [fTrackerField stringValue]; 201 if ([trackerString rangeOfString: @"://"].location == NSNotFound) 202 trackerString = [@"http://" stringByAppendingString: trackerString]; 203 204 //parse tracker string 205 if (!tr_httpIsValidURL([trackerString UTF8String])) 206 { 207 NSAlert * alert = [[[NSAlert alloc] init] autorelease]; 208 [alert addButtonWithTitle: NSLocalizedString(@"OK", "Create torrent -> warning -> button")]; 209 [alert setInformativeText: NSLocalizedString(@"Change the tracker address to create the torrent file.", 210 "Create torrent -> warning -> info")]; 211 [alert setAlertStyle: NSWarningAlertStyle]; 212 213 //check common reasons for failure 214 NSString * prefix = [trackerString substringToIndex: [trackerString rangeOfString: @"://"].location]; 215 if ([prefix caseInsensitiveCompare: @"http"] != NSOrderedSame && [prefix caseInsensitiveCompare: @"https"] != NSOrderedSame) 216 [alert setMessageText: NSLocalizedString(@"The tracker address must begin with \"http://\" or \"https://\".", 217 "Create torrent -> warning -> message")]; 218 else 219 [alert setMessageText: NSLocalizedString(@"The tracker address is invalid.", "Create torrent -> warning -> message")]; 220 221 [alert beginSheetModalForWindow: [self window] modalDelegate: self didEndSelector: nil contextInfo: nil]; 222 return; 208 /*if ([[fTrackerField stringValue] isEqualToString: @""] && [fDefaults boolForKey: @"WarningCreatorBlankAddress"]) 209 { 210 } 211 else*/ 212 [self createReal]; 213 } 214 215 - (void) cancelCreateWindow: (id) sender 216 { 217 [[self window] close]; 218 } 219 220 - (void) windowWillClose: (NSNotification *) notification 221 { 222 [self release]; 223 } 224 225 - (void) cancelCreateProgress: (id) sender 226 { 227 fInfo->abortFlag = 1; 228 [fTimer fire]; 229 } 230 231 @end 232 233 @implementation CreatorWindowController (Private) 234 235 + (NSString *) chooseFile 236 { 237 NSOpenPanel * panel = [NSOpenPanel openPanel]; 238 239 [panel setTitle: NSLocalizedString(@"Create Torrent File", "Create torrent -> select file")]; 240 [panel setPrompt: NSLocalizedString(@"Select", "Create torrent -> select file")]; 241 [panel setAllowsMultipleSelection: NO]; 242 [panel setCanChooseFiles: YES]; 243 [panel setCanChooseDirectories: YES]; 244 [panel setCanCreateDirectories: NO]; 245 246 [panel setMessage: NSLocalizedString(@"Select a file or folder for the torrent file.", "Create torrent -> select file")]; 247 248 BOOL success = [panel runModal] == NSOKButton; 249 return success ? [[panel filenames] objectAtIndex: 0] : nil; 250 } 251 252 - (void) updateEnableOpenCheckForTrackerField 253 { 254 BOOL hasTracker = ![[fTrackerField stringValue] isEqualToString: @""]; 255 [fOpenCheck setEnabled: hasTracker]; 256 [fOpenCheck setState: (fOpenTorrent && hasTracker) ? NSOnState : NSOffState]; 257 } 258 259 - (void) locationSheetClosed: (NSSavePanel *) panel returnCode: (int) code contextInfo: (void *) info 260 { 261 if (code == NSOKButton) 262 { 263 [fLocation release]; 264 fLocation = [[panel filename] retain]; 265 266 [fLocationField setStringValue: [fLocation stringByAbbreviatingWithTildeInPath]]; 267 [fLocationField setToolTip: fLocation]; 268 } 269 } 270 271 - (void) createReal 272 { 273 [fTracker release]; //incase a previous create was aborted 274 fTracker = [[fTrackerField stringValue] retain]; 275 276 //parse non-empty tracker strings 277 if (![fTracker isEqualToString: @""]) 278 { 279 if ([fTracker rangeOfString: @"://"].location == NSNotFound) 280 { 281 NSString * fullTracker = [@"http://" stringByAppendingString: fTracker]; 282 [fTracker release]; 283 fTracker = [fullTracker retain]; 284 } 285 286 if (!tr_httpIsValidURL([fTracker UTF8String])) 287 { 288 NSAlert * alert = [[[NSAlert alloc] init] autorelease]; 289 [alert addButtonWithTitle: NSLocalizedString(@"OK", "Create torrent -> warning -> button")]; 290 [alert setInformativeText: NSLocalizedString(@"Change the tracker address to create the torrent file.", 291 "Create torrent -> warning -> info")]; 292 [alert setAlertStyle: NSWarningAlertStyle]; 293 294 //check common reasons for failure 295 NSString * prefix = [fTracker substringToIndex: [fTracker rangeOfString: @"://"].location]; 296 if ([prefix caseInsensitiveCompare: @"http"] != NSOrderedSame && [prefix caseInsensitiveCompare: @"https"] != NSOrderedSame) 297 [alert setMessageText: NSLocalizedString(@"The tracker address must begin with \"http://\" or \"https://\".", 298 "Create torrent -> warning -> message")]; 299 else 300 [alert setMessageText: NSLocalizedString(@"The tracker address is invalid.", "Create torrent -> warning -> message")]; 301 302 [alert beginSheetModalForWindow: [self window] modalDelegate: self didEndSelector: nil contextInfo: nil]; 303 return; 304 } 223 305 } 224 306 … … 244 326 } 245 327 246 fOpenTorrent = [fOpenCheck state] == NSOnState;247 248 328 //store values 249 [fDefaults setObject: trackerStringforKey: @"CreatorTracker"];329 [fDefaults setObject: fTracker forKey: @"CreatorTracker"]; 250 330 [fDefaults setBool: [fPrivateCheck state] == NSOnState forKey: @"CreatorPrivate"]; 251 331 [fDefaults setBool: fOpenTorrent forKey: @"CreatorOpen"]; … … 253 333 254 334 [[NSNotificationCenter defaultCenter] postNotificationName: @"BeginCreateTorrentFile" object: fLocation userInfo: nil]; 255 tr_makeMetaInfo(fInfo, [fLocation UTF8String], [ trackerStringUTF8String], [[fCommentView string] UTF8String],335 tr_makeMetaInfo(fInfo, [fLocation UTF8String], [fTracker UTF8String], [[fCommentView string] UTF8String], 256 336 [fPrivateCheck state] == NSOnState); 257 337 258 338 fTimer = [NSTimer scheduledTimerWithTimeInterval: 0.1 target: self selector: @selector(checkProgress) 259 userInfo: nil repeats: YES]; 260 } 261 262 - (void) cancelCreateWindow: (id) sender 263 { 264 [[self window] close]; 265 } 266 267 - (void) windowWillClose: (NSNotification *) notification 268 { 269 [self release]; 270 } 271 272 - (void) cancelCreateProgress: (id) sender 273 { 274 fInfo->abortFlag = 1; 275 [fTimer fire]; 276 } 277 278 @end 279 280 @implementation CreatorWindowController (Private) 281 282 + (NSString *) chooseFile 283 { 284 NSOpenPanel * panel = [NSOpenPanel openPanel]; 285 286 [panel setTitle: NSLocalizedString(@"Create Torrent File", "Create torrent -> select file")]; 287 [panel setPrompt: NSLocalizedString(@"Select", "Create torrent -> select file")]; 288 [panel setAllowsMultipleSelection: NO]; 289 [panel setCanChooseFiles: YES]; 290 [panel setCanChooseDirectories: YES]; 291 [panel setCanCreateDirectories: NO]; 292 293 [panel setMessage: NSLocalizedString(@"Select a file or folder for the torrent file.", "Create torrent -> select file")]; 294 295 BOOL success = [panel runModal] == NSOKButton; 296 return success ? [[panel filenames] objectAtIndex: 0] : nil; 297 } 298 299 - (void) updateEnableCreateButtonForTrackerField 300 { 301 NSString * string = [fTrackerField stringValue]; 302 BOOL enable = YES; 303 if ([string isEqualToString: @""]) 304 enable = NO; 305 else 306 { 307 NSRange prefixRange = [string rangeOfString: @"://"]; 308 if (prefixRange.location != NSNotFound && [string length] == NSMaxRange(prefixRange)) 309 enable = NO; 310 } 311 312 [fCreateButton setEnabled: enable]; 313 } 314 315 - (void) locationSheetClosed: (NSSavePanel *) panel returnCode: (int) code contextInfo: (void *) info 316 { 317 if (code == NSOKButton) 318 { 319 [fLocation release]; 320 fLocation = [[panel filename] retain]; 321 322 [fLocationField setStringValue: [fLocation stringByAbbreviatingWithTildeInPath]]; 323 [fLocationField setToolTip: fLocation]; 324 } 339 userInfo: nil repeats: YES]; 325 340 } 326 341 … … 336 351 { 337 352 case TR_MAKEMETA_OK: 338 if (fOpenTorrent )353 if (fOpenTorrent && ![fTracker isEqualToString: @""]) 339 354 { 340 355 NSDictionary * dict = [[NSDictionary alloc] initWithObjectsAndKeys: fLocation, @"File", -
trunk/macosx/Defaults.plist
r5935 r5960 153 153 <key>WarningDuplicate</key> 154 154 <true/> 155 <key>WarningCreatorBlankAddress</key> 156 <true/> 155 157 <key>WarningFolderDataSameName</key> 156 158 <true/> -
trunk/macosx/English.lproj/Creator.xib
r5710 r5960 3 3 <data> 4 4 <int key="IBDocument.SystemTarget">1050</int> 5 <string key="IBDocument.SystemVersion">9 C7010</string>6 <string key="IBDocument.InterfaceBuilderVersion">6 52</string>7 <string key="IBDocument.AppKitVersion">949. 26</string>5 <string key="IBDocument.SystemVersion">9D34</string> 6 <string key="IBDocument.InterfaceBuilderVersion">667</string> 7 <string key="IBDocument.AppKitVersion">949.33</string> 8 8 <string key="IBDocument.HIToolboxVersion">352.00</string> 9 9 <object class="NSMutableArray" key="IBDocument.EditedObjectIDs"> … … 493 493 <bool key="NSEnabled">YES</bool> 494 494 <object class="NSButtonCell" key="NSCell" id="671503663"> 495 <int key="NSCellFlags">6 04110336</int>495 <int key="NSCellFlags">67239424</int> 496 496 <int key="NSCellFlags2">134217728</int> 497 497 <string key="NSContents">Create</string> … … 783 783 </object> 784 784 <object class="IBConnectionRecord"> 785 <object class="IB OutletConnection" key="connection">786 <string key="label"> fCreateButton</string>787 <reference key="source" ref="578092914"/> 788 <reference key="destination" ref="6 97506694"/>789 </object> 790 <int key="connectionID">8 7</int>785 <object class="IBActionConnection" key="connection"> 786 <string key="label">toggleOpenCheck:</string> 787 <reference key="source" ref="578092914"/> 788 <reference key="destination" ref="631380462"/> 789 </object> 790 <int key="connectionID">88</int> 791 791 </object> 792 792 </object> … … 1309 1309 </object> 1310 1310 <nil key="sourceID"/> 1311 <int key="maxID">8 7</int>1311 <int key="maxID">88</int> 1312 1312 </object> 1313 1313 <object class="IBClassDescriber" key="IBDocument.Classes"> … … 1325 1325 <string>create:</string> 1326 1326 <string>setLocation:</string> 1327 <string>toggleOpenCheck:</string> 1327 1328 </object> 1328 1329 <object class="NSMutableArray" key="dict.values"> … … 1332 1333 <string>id</string> 1333 1334 <string>id</string> 1335 <string>id</string> 1334 1336 </object> 1335 1337 </object> … … 1339 1341 <bool key="EncodedWithXMLCoder">YES</bool> 1340 1342 <string>fCommentView</string> 1341 <string>fCreateButton</string>1342 1343 <string>fIconView</string> 1343 1344 <string>fLocationField</string> … … 1354 1355 <bool key="EncodedWithXMLCoder">YES</bool> 1355 1356 <string>NSTextView</string> 1356 <string>NSButton</string>1357 1357 <string>NSImageView</string> 1358 1358 <string>NSTextField</string> … … 1382 1382 <object class="IBPartialClassDescription"> 1383 1383 <string key="className">FirstResponder</string> 1384 <string key="superclassName">NSObject</string> 1384 1385 <object class="IBClassDescriptionSource" key="sourceIdentifier"> 1385 1386 <string key="majorKey">IBUserSource</string> … … 1399 1400 <string key="majorKey">IBProjectSource</string> 1400 1401 <string key="minorKey">macosx/NSMenuAdditions.h</string> 1401 </object>1402 </object>1403 <object class="IBPartialClassDescription">1404 <string key="className">NSObject</string>1405 <object class="IBClassDescriptionSource" key="sourceIdentifier">1406 <string key="majorKey">IBProjectSource</string>1407 <string key="minorKey">macosx/IPCController.h</string>1408 1402 </object> 1409 1403 </object> -
trunk/macosx/PrefsController.m
r5913 r5960 507 507 [fDefaults setBool: YES forKey: @"WarningFolderDataSameName"]; 508 508 [fDefaults setBool: YES forKey: @"WarningResetStats"]; 509 [fDefaults setBool: YES forKey: @"WarningCreatorBlankAddress"]; 509 510 } 510 511
Note: See TracChangeset
for help on using the changeset viewer.