mirror of
https://github.com/transmission/transmission
synced 2024-12-26 09:37:56 +00:00
in the groups popup in the add window, have an option to show the groups window
This commit is contained in:
parent
57bc23edc5
commit
fac74ffd7b
4 changed files with 576 additions and 459 deletions
|
@ -43,6 +43,7 @@
|
|||
NSString * fDestination;
|
||||
|
||||
BOOL fDeleteTorrent, fDeleteEnable;
|
||||
int fGroupValue;
|
||||
}
|
||||
|
||||
- (id) initWithTorrent: (Torrent *) torrent destination: (NSString *) path controller: (Controller *) controller
|
||||
|
@ -56,5 +57,6 @@
|
|||
- (void) cancelAdd: (id) sender;
|
||||
|
||||
- (void) updateGroupMenu: (NSNotification *) notification;
|
||||
- (void) showGroupsWindow: (id) sender;
|
||||
|
||||
@end
|
||||
|
|
|
@ -26,11 +26,14 @@
|
|||
#import "Controller.h"
|
||||
#import "GroupsWindowController.h"
|
||||
#import "NSStringAdditions.h"
|
||||
#import "NSMenuAdditions.h"
|
||||
#import "ExpandedPathToIconTransformer.h"
|
||||
|
||||
@interface AddWindowController (Private)
|
||||
|
||||
- (void) folderChoiceClosed: (NSOpenPanel *) openPanel returnCode: (int) code contextInfo: (void *) contextInfo;
|
||||
- (void) setGroupsMenu;
|
||||
- (void) changeGroupValue: (id) sender;
|
||||
|
||||
@end
|
||||
|
||||
|
@ -50,6 +53,8 @@
|
|||
fDeleteTorrent = deleteTorrent == TORRENT_FILE_DELETE || (deleteTorrent == TORRENT_FILE_DEFAULT
|
||||
&& [[NSUserDefaults standardUserDefaults] boolForKey: @"DeleteOriginalTorrent"]);
|
||||
fDeleteEnable = deleteTorrent == TORRENT_FILE_DEFAULT;
|
||||
|
||||
fGroupValue = -1;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
@ -85,7 +90,8 @@
|
|||
}
|
||||
[fStatusField setStringValue: statusString];
|
||||
|
||||
[fGroupPopUp setMenu: [[GroupsWindowController groups] groupMenuWithTarget: nil action: NULL isSmall: NO]];
|
||||
[self setGroupsMenu];
|
||||
[fGroupPopUp selectItemWithTag: -1];
|
||||
|
||||
[fStartCheck setState: [[NSUserDefaults standardUserDefaults] boolForKey: @"AutoStartDownload"] ? NSOnState : NSOffState];
|
||||
|
||||
|
@ -164,11 +170,18 @@
|
|||
|
||||
- (void) updateGroupMenu: (NSNotification *) notification
|
||||
{
|
||||
#warning add option to go to group window
|
||||
[self setGroupsMenu];
|
||||
if (![fGroupPopUp selectItemWithTag: fGroupValue])
|
||||
{
|
||||
fGroupValue = -1;
|
||||
[fGroupPopUp selectItemWithTag: fGroupValue];
|
||||
}
|
||||
}
|
||||
|
||||
int groupValue = [[fGroupPopUp selectedItem] tag];
|
||||
[fGroupPopUp setMenu: [[GroupsWindowController groups] groupMenuWithTarget: nil action: NULL isSmall: NO]];
|
||||
[fGroupPopUp selectItemWithTag: groupValue];
|
||||
- (void) showGroupsWindow: (id) sender
|
||||
{
|
||||
[fGroupPopUp selectItemWithTag: fGroupValue];
|
||||
[fController showGroups: sender];
|
||||
}
|
||||
|
||||
- (void) mouseMoved: (NSEvent *) event
|
||||
|
@ -205,4 +218,22 @@
|
|||
}
|
||||
}
|
||||
|
||||
- (void) setGroupsMenu
|
||||
{
|
||||
NSMenu * menu = [fGroupPopUp menu];
|
||||
|
||||
int i;
|
||||
for (i = [menu numberOfItems]-1 - 2; i >= 0; i--)
|
||||
[menu removeItemAtIndex: i];
|
||||
|
||||
NSMenu * groupMenu = [[GroupsWindowController groups] groupMenuWithTarget: self action: @selector(changeGroupValue:) isSmall: NO];
|
||||
[menu appendItemsFromMenu: groupMenu atIndexes: [NSIndexSet indexSetWithIndexesInRange:
|
||||
NSMakeRange(0, [groupMenu numberOfItems])] atBottom: NO];
|
||||
}
|
||||
|
||||
- (void) changeGroupValue: (id) sender
|
||||
{
|
||||
fGroupValue = [sender tag];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -798,8 +798,6 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
|
|||
|
||||
- (void) askOpenConfirmed: (AddWindowController *) addController add: (BOOL) add
|
||||
{
|
||||
[addController close];
|
||||
|
||||
Torrent * torrent = [addController torrent];
|
||||
if (add)
|
||||
{
|
||||
|
@ -2055,8 +2053,8 @@ void sleepCallBack(void * controller, io_service_t y, natural_t messageType, voi
|
|||
{
|
||||
if (menu == fGroupsSetMenu || menu == fGroupsSetContextMenu)
|
||||
{
|
||||
int i, keep = (menu == fGroupsSetMenu || menu == fGroupsSetContextMenu) ? 2 : 0;
|
||||
for (i = [menu numberOfItems]-1 - keep; i >= 0; i--)
|
||||
int i;
|
||||
for (i = [menu numberOfItems]-1 - 2; i >= 0; i--)
|
||||
[menu removeItemAtIndex: i];
|
||||
|
||||
NSMenu * groupMenu = [[GroupsWindowController groups] groupMenuWithTarget: self action: @selector(setGroup:) isSmall: NO];
|
||||
|
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue