1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-25 09:13:06 +00:00

a bit more Mac rpc work

This commit is contained in:
Mitchell Livingston 2009-04-05 15:55:20 +00:00
parent 3ef8240b80
commit 555617a93c
2 changed files with 16 additions and 7 deletions

View file

@ -120,6 +120,7 @@
- (void) setAutoSpeedLimitDay: (id) sender; - (void) setAutoSpeedLimitDay: (id) sender;
- (void) updateAutoSpeedLimitDay; - (void) updateAutoSpeedLimitDay;
+ (NSInteger) dateToTimeSum: (NSDate *) date; + (NSInteger) dateToTimeSum: (NSDate *) date;
+ (NSDate *) timeSumToDate: (NSInteger) sum;
- (void) setAutoImport: (id) sender; - (void) setAutoImport: (id) sender;
- (void) importFolderSheetShow: (id) sender; - (void) importFolderSheetShow: (id) sender;

View file

@ -743,6 +743,15 @@ tr_session * fHandle;
return [components hour] * 60 + [components minute]; return [components hour] * 60 + [components minute];
} }
+ (NSDate *) timeSumToDate: (NSInteger) sum
{
NSDateComponents * comps = [[[NSDateComponents alloc] init] autorelease];
[comps setHour: sum / 60];
[comps setMinute: sum % 60];
return [[NSCalendar currentCalendar] dateFromComponents: comps];
}
- (BOOL) control: (NSControl *) control textShouldBeginEditing: (NSText *) fieldEditor - (BOOL) control: (NSControl *) control textShouldBeginEditing: (NSText *) fieldEditor
{ {
[fInitialString release]; [fInitialString release];
@ -1228,8 +1237,8 @@ tr_session * fHandle;
#warning fix #warning fix
//alt speed limit enabled //alt speed limit enabled
/*const BOOL useAltSpeed = tr_sessionUsesAltSpeed(fHandle); const BOOL useAltSpeed = tr_sessionUsesAltSpeed(fHandle);
[fDefaults setBool: useAltSpeed forKey: @"SpeedLimit"];*/ [fDefaults setBool: useAltSpeed forKey: @"SpeedLimit"];
//alt speed limit - down //alt speed limit - down
const int downLimitAlt = tr_sessionGetAltSpeed(fHandle, TR_DOWN); const int downLimitAlt = tr_sessionGetAltSpeed(fHandle, TR_DOWN);
@ -1243,17 +1252,14 @@ tr_session * fHandle;
const BOOL useAltSpeedSched = tr_sessionUsesAltSpeedTime(fHandle); const BOOL useAltSpeedSched = tr_sessionUsesAltSpeedTime(fHandle);
[fDefaults setBool: useAltSpeedSched forKey: @"SpeedLimitAuto"]; [fDefaults setBool: useAltSpeedSched forKey: @"SpeedLimitAuto"];
#warning refactor schedule date? NSDate * limitStartDate = [PrefsController timeSumToDate: tr_sessionGetAltSpeedBegin(fHandle)];
/*NSDate * limitStartDate = [PrefsController timeSumToDate: tr_sessionGetAltSpeedBegin(fHandle)];
[fDefaults setObject: limitStartDate forKey: @"SpeedLimitAutoOnDate"]; [fDefaults setObject: limitStartDate forKey: @"SpeedLimitAutoOnDate"];
NSDate * limitEndDate = [PrefsController timeSumToDate: tr_sessionGetAltSpeedEnd(fHandle)]; NSDate * limitEndDate = [PrefsController timeSumToDate: tr_sessionGetAltSpeedEnd(fHandle)];
[fDefaults setObject: limitEndDate forKey: @"SpeedLimitAutoOffDate"];*/ [fDefaults setObject: limitEndDate forKey: @"SpeedLimitAutoOffDate"];
#warning refactor how to work with schedule day #warning refactor how to work with schedule day
[[NSNotificationCenter defaultCenter] postNotificationName: @"SpeedLimitUpdate" object: nil];
//blocklist //blocklist
const BOOL blocklist = tr_blocklistIsEnabled(fHandle); const BOOL blocklist = tr_blocklistIsEnabled(fHandle);
[fDefaults setBool: blocklist forKey: @"Blocklist"]; [fDefaults setBool: blocklist forKey: @"Blocklist"];
@ -1302,6 +1308,8 @@ tr_session * fHandle;
//ratio limit enabled handled by bindings //ratio limit enabled handled by bindings
[fRatioStopField setFloatValue: ratioLimit]; [fRatioStopField setFloatValue: ratioLimit];
} }
[[NSNotificationCenter defaultCenter] postNotificationName: @"SpeedLimitUpdate" object: nil];
} }
@end @end