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

Dock menu item for Speed Limit, among smaller changed.

This commit is contained in:
Mitchell Livingston 2006-07-01 18:02:36 +00:00
parent 8055077c33
commit 1ccebca98a
6 changed files with 27 additions and 25 deletions

View file

@ -49,7 +49,7 @@
IBOutlet TorrentTableView * fTableView;
NSToolbar * fToolbar;
IBOutlet NSMenuItem * fAdvancedBarItem, * fSpeedLimitItem;
IBOutlet NSMenuItem * fAdvancedBarItem, * fSpeedLimitItem, * fSpeedLimitDockItem;
IBOutlet NSButton * fActionButton, * fSpeedLimitButton;
IBOutlet SmoothAquaView * fStatusBar;
@ -77,7 +77,6 @@
BOOL fUpdateInProgress;
}
- (void) advancedChanged: (id) sender;
- (void) openShowSheet: (id) sender;
- (void) openSheetClosed: (NSOpenPanel *) s returnCode: (int) code
contextInfo: (void *) info;
@ -148,6 +147,7 @@
- (void) toggleStatusBar: (id) sender;
- (void) showStatusBar: (BOOL) show animate: (BOOL) animate;
- (void) toggleAdvancedBar: (id) sender;
- (void) showMainWindow: (id) sender;
- (void) linkHomepage: (id) sender;

View file

@ -127,9 +127,12 @@ static void sleepCallBack(void * controller, io_service_t y,
//set speed limit
BOOL speedLimit = [fDefaults boolForKey: @"SpeedLimit"];
[fSpeedLimitItem setState: speedLimit];
if (speedLimit)
{
[fSpeedLimitItem setState: speedLimit];
[fSpeedLimitDockItem setState: speedLimit];
[fSpeedLimitButton setState: NSOnState];
}
[fActionButton setToolTip: @"Shortcuts for changing global settings."];
[fSpeedLimitButton setToolTip: @"Speed Limit overrides the total bandwidth limits with its own limits."];
@ -429,14 +432,6 @@ static void sleepCallBack(void * controller, io_service_t y,
@"%d Transfer%s", count, count == 1 ? "" : "s"]];
}
- (void) advancedChanged: (id) sender
{
[fAdvancedBarItem setState: ![fAdvancedBarItem state]];
[fDefaults setBool: [fAdvancedBarItem state] forKey: @"UseAdvancedBar"];
[fTableView display];
}
//called on by applescript
- (void) open: (NSArray *) files
{
@ -925,6 +920,7 @@ static void sleepCallBack(void * controller, io_service_t y,
int state = [fSpeedLimitItem state] ? NSOffState : NSOnState;
[fSpeedLimitItem setState: state];
[fSpeedLimitDockItem setState: state];
[fSpeedLimitButton setState: state];
[fPrefsController enableSpeedLimit: state];
@ -1119,7 +1115,6 @@ static void sleepCallBack(void * controller, io_service_t y,
//will try to start, taking into consideration the start preference
- (void) attemptToStartAuto: (Torrent *) torrent
{
#warning expand upon
if ([torrent progress] >= 1.0)
[torrent startTransfer];
else
@ -1218,7 +1213,6 @@ static void sleepCallBack(void * controller, io_service_t y,
fStatusBarVisible = !fStatusBarVisible;
//reloads stats
[self updateUI: nil];
//set views to not autoresize
@ -1239,6 +1233,14 @@ static void sleepCallBack(void * controller, io_service_t y,
[fWindow setContentMinSize: minSize];
}
- (void) toggleAdvancedBar: (id) sender
{
[fAdvancedBarItem setState: ![fAdvancedBarItem state]];
[fDefaults setBool: [fAdvancedBarItem state] forKey: @"UseAdvancedBar"];
[fTableView display];
}
- (NSToolbarItem *) toolbar: (NSToolbar *) t itemForItemIdentifier:
(NSString *) ident willBeInsertedIntoToolbar: (BOOL) flag
{
@ -1321,8 +1323,7 @@ static void sleepCallBack(void * controller, io_service_t y,
return [NSArray arrayWithObjects:
TOOLBAR_OPEN, TOOLBAR_REMOVE,
TOOLBAR_PAUSE_SELECTED, TOOLBAR_RESUME_SELECTED,
TOOLBAR_PAUSE_ALL, TOOLBAR_RESUME_ALL,
TOOLBAR_INFO,
TOOLBAR_PAUSE_ALL, TOOLBAR_RESUME_ALL, TOOLBAR_INFO,
NSToolbarSeparatorItemIdentifier,
NSToolbarSpaceItemIdentifier,
NSToolbarFlexibleSpaceItemIdentifier,
@ -1402,8 +1403,7 @@ static void sleepCallBack(void * controller, io_service_t y,
SEL action = [menuItem action];
//only enable some items if it is in a context menu or the window is useable
BOOL canUseMenu = [[[menuItem menu] title] isEqualToString: @"Context"]
|| [fWindow isKeyWindow];
BOOL canUseMenu = [fWindow isKeyWindow] || [[[menuItem menu] title] isEqualToString: @"Context"];
//enable show info
if (action == @selector(showInfo:))
@ -1415,6 +1415,7 @@ static void sleepCallBack(void * controller, io_service_t y,
return YES;
}
//enable prev/next inspector tab
if (action == @selector(setInfoTab:))
return [[fInfoController window] isVisible];
@ -1450,10 +1451,9 @@ static void sleepCallBack(void * controller, io_service_t y,
return NO;
}
//enable reveal in finder
if (action == @selector(revealFile:))
{
return canUseMenu && [fTableView numberOfSelectedRows] > 0;
}
//enable remove items
if (action == @selector(removeNoDelete:) || action == @selector(removeDeleteData:)
@ -1537,8 +1537,8 @@ static void sleepCallBack(void * controller, io_service_t y,
return NO;
}
//enable resume item
if (action == @selector(setSort:) || (action == @selector(advancedChanged:)))
//enable sort and advanced bar items
if (action == @selector(setSort:) || (action == @selector(toggleAdvancedBar:)))
return canUseMenu;
//enable copy torrent file item

View file

@ -2,7 +2,6 @@
IBClasses = (
{
ACTIONS = {
advancedChanged = id;
checkUpdate = id;
copyTorrentFile = id;
linkForums = id;
@ -26,6 +25,7 @@
showPreferenceWindow = id;
stopAllTorrents = id;
stopTorrent = id;
toggleAdvancedBar = id;
toggleSpeedLimit = id;
toggleStatusBar = id;
};
@ -47,6 +47,7 @@
fRatioSetItem = NSMenuItem;
fScrollView = NSScrollView;
fSpeedLimitButton = NSButton;
fSpeedLimitDockItem = NSMenuItem;
fSpeedLimitItem = NSMenuItem;
fStateSortItem = NSMenuItem;
fStatusBar = SmoothAquaView;

View file

@ -15,7 +15,7 @@
<key>456</key>
<string>396 374 216 206 0 0 1152 842 </string>
<key>581</key>
<string>324 628 112 68 0 0 1152 842 </string>
<string>571 464 115 99 0 0 1152 842 </string>
<key>589</key>
<string>54 521 139 68 0 0 1152 842 </string>
</dict>
@ -29,8 +29,9 @@
<integer>3</integer>
<key>IBOpenObjects</key>
<array>
<integer>21</integer>
<integer>29</integer>
<integer>581</integer>
<integer>21</integer>
</array>
<key>IBSystem Version</key>
<string>8J135</string>

Binary file not shown.

View file

@ -78,7 +78,7 @@
if ([event modifierFlags] & NSAlternateKeyMask)
{
[fController advancedChanged: self];
[fController toggleAdvancedBar: self];
fClickPoint = NSZeroPoint;
}
else if (![self pointInPauseRect: fClickPoint] && ![self pointInRevealRect: fClickPoint])