mirror of
https://github.com/transmission/transmission
synced 2025-03-09 21:54:09 +00:00
general cleanup
This commit is contained in:
parent
89564dc3c2
commit
7207e822fa
2 changed files with 41 additions and 35 deletions
|
@ -90,16 +90,16 @@
|
|||
//select proper level in popup button
|
||||
int level = tr_getMessageLevel();
|
||||
switch (level)
|
||||
{
|
||||
case TR_MSG_ERR:
|
||||
[fLevelButton selectItemAtIndex: LEVEL_ERROR];
|
||||
break;
|
||||
case TR_MSG_INF:
|
||||
[fLevelButton selectItemAtIndex: LEVEL_INFO];
|
||||
break;
|
||||
case TR_MSG_DBG:
|
||||
[fLevelButton selectItemAtIndex: LEVEL_DEBUG];
|
||||
}
|
||||
{
|
||||
case TR_MSG_ERR:
|
||||
[fLevelButton selectItemAtIndex: LEVEL_ERROR];
|
||||
break;
|
||||
case TR_MSG_INF:
|
||||
[fLevelButton selectItemAtIndex: LEVEL_INFO];
|
||||
break;
|
||||
case TR_MSG_DBG:
|
||||
[fLevelButton selectItemAtIndex: LEVEL_DEBUG];
|
||||
}
|
||||
|
||||
[self setDebugWarningHidden: level != TR_MSG_DBG];
|
||||
}
|
||||
|
|
|
@ -86,12 +86,6 @@
|
|||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) awakeFromNib
|
||||
{
|
||||
[fContextRow setTitle: @"Context"];
|
||||
[fContextNoRow setTitle: @"Context"];
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
|
@ -157,12 +151,11 @@
|
|||
{
|
||||
NSPoint point = [self convertPoint: [event locationInWindow] fromView: nil];
|
||||
int row = [self rowAtPoint: point], oldRow = [self rowAtPoint: fClickPoint];
|
||||
BOOL sameRow = row == oldRow;
|
||||
|
||||
if (sameRow && [self pointInPauseRect: point] && [self pointInPauseRect: fClickPoint])
|
||||
if (row == oldRow && [self pointInPauseRect: point] && [self pointInPauseRect: fClickPoint])
|
||||
{
|
||||
Torrent * torrent = [fTorrents objectAtIndex: row];
|
||||
|
||||
|
||||
if ([torrent isActive])
|
||||
[fController stopTorrents: [NSArray arrayWithObject: torrent]];
|
||||
else if ([torrent isPaused])
|
||||
|
@ -176,7 +169,7 @@
|
|||
}
|
||||
else;
|
||||
}
|
||||
else if (sameRow && [self pointInRevealRect: point] && [self pointInRevealRect: fClickPoint])
|
||||
else if (row == oldRow && [self pointInRevealRect: point] && [self pointInRevealRect: fClickPoint])
|
||||
[[fTorrents objectAtIndex: row] revealData];
|
||||
else if ([event clickCount] == 2 && !NSEqualPoints(fClickPoint, NSZeroPoint))
|
||||
{
|
||||
|
@ -237,7 +230,6 @@
|
|||
{
|
||||
if (![self isRowSelected: row])
|
||||
[self selectRowIndexes: [NSIndexSet indexSetWithIndex: row] byExtendingSelection: NO];
|
||||
|
||||
return fContextRow;
|
||||
}
|
||||
else
|
||||
|
@ -388,14 +380,21 @@
|
|||
|
||||
- (void) setQuickLimitMode: (id) sender
|
||||
{
|
||||
int tag = [sender tag];
|
||||
int mode;
|
||||
if (tag == ACTION_MENU_UNLIMITED_TAG)
|
||||
mode = TR_SPEEDLIMIT_UNLIMITED;
|
||||
else if (tag == ACTION_MENU_LIMIT_TAG)
|
||||
mode = TR_SPEEDLIMIT_SINGLE;
|
||||
else
|
||||
mode = TR_SPEEDLIMIT_GLOBAL;
|
||||
switch ([sender tag])
|
||||
{
|
||||
case ACTION_MENU_UNLIMITED_TAG:
|
||||
mode = TR_SPEEDLIMIT_UNLIMITED;
|
||||
break;
|
||||
case ACTION_MENU_LIMIT_TAG:
|
||||
mode = TR_SPEEDLIMIT_SINGLE;
|
||||
break;
|
||||
case ACTION_MENU_GLOBAL_TAG:
|
||||
mode = TR_SPEEDLIMIT_GLOBAL;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
[fMenuTorrent setSpeedMode: mode upload: [sender menu] == fUploadMenu];
|
||||
|
||||
|
@ -414,14 +413,21 @@
|
|||
- (void) setQuickRatioMode: (id) sender
|
||||
|
||||
{
|
||||
int tag = [sender tag];
|
||||
int mode;
|
||||
if (tag == ACTION_MENU_UNLIMITED_TAG)
|
||||
mode = NSOffState;
|
||||
else if (tag == ACTION_MENU_LIMIT_TAG)
|
||||
mode = NSOnState;
|
||||
else
|
||||
mode = NSMixedState;
|
||||
switch ([sender tag])
|
||||
{
|
||||
case ACTION_MENU_UNLIMITED_TAG:
|
||||
mode = NSOffState;
|
||||
break;
|
||||
case ACTION_MENU_LIMIT_TAG:
|
||||
mode = NSOnState;
|
||||
break;
|
||||
case ACTION_MENU_GLOBAL_TAG:
|
||||
mode = NSMixedState;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
[fMenuTorrent setRatioSetting: mode];
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue