mirror of
https://github.com/transmission/transmission
synced 2025-03-10 06:02:57 +00:00
by popular demand, add option to sort by tracker
This commit is contained in:
parent
f0162d0bc4
commit
835d333067
5 changed files with 32 additions and 5 deletions
|
@ -67,9 +67,9 @@
|
|||
IBOutlet NSTextField * fTotalDLField, * fTotalULField, * fTotalTorrentsField;
|
||||
|
||||
IBOutlet NSMenuItem * fNameSortItem, * fStateSortItem, * fProgressSortItem,
|
||||
* fDateSortItem, * fOrderSortItem,
|
||||
* fTrackerSortItem, * fDateSortItem, * fOrderSortItem,
|
||||
* fNameSortActionItem, * fStateSortActionItem, * fProgressSortActionItem,
|
||||
* fDateSortActionItem, * fOrderSortActionItem;
|
||||
* fTrackerSortActionItem, * fDateSortActionItem, * fOrderSortActionItem;
|
||||
|
||||
IBOutlet FilterBarView * fFilterBar;
|
||||
IBOutlet FilterBarButton * fNoFilterButton, * fDownloadFilterButton,
|
||||
|
|
|
@ -54,6 +54,7 @@
|
|||
#define SORT_NAME @"Name"
|
||||
#define SORT_STATE @"State"
|
||||
#define SORT_PROGRESS @"Progress"
|
||||
#define SORT_TRACKER @"Tracker"
|
||||
#define SORT_ORDER @"Order"
|
||||
|
||||
#define FILTER_NONE @"None"
|
||||
|
@ -346,6 +347,11 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
|
|||
currentSortItem = fProgressSortItem;
|
||||
currentSortActionItem = fProgressSortActionItem;
|
||||
}
|
||||
else if ([sortType isEqualToString: SORT_TRACKER])
|
||||
{
|
||||
currentSortItem = fTrackerSortItem;
|
||||
currentSortActionItem = fTrackerSortActionItem;
|
||||
}
|
||||
else if ([sortType isEqualToString: SORT_ORDER])
|
||||
{
|
||||
currentSortItem = fOrderSortItem;
|
||||
|
@ -1407,7 +1413,8 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
|
|||
|
||||
//resort if necessary or just update the table
|
||||
NSString * sortType = [fDefaults stringForKey: @"Sort"];
|
||||
if ([sortType isEqualToString: @"Progress"] || [sortType isEqualToString: @"State"])
|
||||
if ([sortType isEqualToString: SORT_PROGRESS] || [sortType isEqualToString: SORT_STATE]
|
||||
|| [sortType isEqualToString: SORT_TRACKER])
|
||||
[self sortTorrents];
|
||||
else
|
||||
[fTableView reloadData];
|
||||
|
@ -1609,7 +1616,7 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
|
|||
BOOL asc = ![fDefaults boolForKey: @"SortReverse"];
|
||||
|
||||
NSSortDescriptor * nameDescriptor = [[[NSSortDescriptor alloc] initWithKey: @"name"
|
||||
ascending: asc selector: @selector(caseInsensitiveCompare:)] autorelease],
|
||||
ascending: asc selector: @selector(caseInsensitiveCompare:)] autorelease],
|
||||
* orderDescriptor = [[[NSSortDescriptor alloc] initWithKey: @"orderValue"
|
||||
ascending: asc] autorelease];
|
||||
|
||||
|
@ -1638,6 +1645,13 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
|
|||
descriptors = [[NSArray alloc] initWithObjects: progressDescriptor, ratioDescriptor,
|
||||
nameDescriptor, orderDescriptor, nil];
|
||||
}
|
||||
else if ([sortType isEqualToString: SORT_TRACKER])
|
||||
{
|
||||
NSSortDescriptor * trackerDescriptor = [[[NSSortDescriptor alloc] initWithKey: @"trackerAddress"
|
||||
ascending: asc selector: @selector(caseInsensitiveCompare:)] autorelease];
|
||||
|
||||
descriptors = [[NSArray alloc] initWithObjects: trackerDescriptor, nameDescriptor, orderDescriptor, nil];
|
||||
}
|
||||
else if ([sortType isEqualToString: SORT_ORDER])
|
||||
descriptors = [[NSArray alloc] initWithObjects: orderDescriptor, nil];
|
||||
else
|
||||
|
@ -1675,6 +1689,11 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
|
|||
prevSortItem = fProgressSortItem;
|
||||
prevSortActionItem = fProgressSortActionItem;
|
||||
}
|
||||
else if ([oldSortType isEqualToString: SORT_TRACKER])
|
||||
{
|
||||
prevSortItem = fTrackerSortItem;
|
||||
prevSortActionItem = fTrackerSortActionItem;
|
||||
}
|
||||
else if ([oldSortType isEqualToString: SORT_ORDER])
|
||||
{
|
||||
prevSortItem = fOrderSortItem;
|
||||
|
@ -1709,6 +1728,12 @@ static void sleepCallBack(void * controller, io_service_t y, natural_t messageTy
|
|||
currentSortActionItem = fProgressSortActionItem;
|
||||
sortType = SORT_PROGRESS;
|
||||
}
|
||||
else if (sender == fTrackerSortItem || sender == fTrackerSortActionItem)
|
||||
{
|
||||
currentSortItem = fTrackerSortItem;
|
||||
currentSortActionItem = fTrackerSortActionItem;
|
||||
sortType = SORT_TRACKER;
|
||||
}
|
||||
else if (sender == fOrderSortItem || sender == fOrderSortActionItem)
|
||||
{
|
||||
currentSortItem = fOrderSortItem;
|
||||
|
|
2
macosx/English.lproj/MainMenu.nib/classes.nib
generated
2
macosx/English.lproj/MainMenu.nib/classes.nib
generated
|
@ -85,6 +85,8 @@
|
|||
fTotalDLField = NSTextField;
|
||||
fTotalTorrentsField = NSTextField;
|
||||
fTotalULField = NSTextField;
|
||||
fTrackerSortActionItem = NSMenuItem;
|
||||
fTrackerSortItem = NSMenuItem;
|
||||
fURLSheetTextField = NSTextField;
|
||||
fURLSheetWindow = NSWindow;
|
||||
fUpdater = SUUpdater;
|
||||
|
|
2
macosx/English.lproj/MainMenu.nib/info.nib
generated
2
macosx/English.lproj/MainMenu.nib/info.nib
generated
|
@ -31,8 +31,8 @@
|
|||
<integer>3</integer>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>29</integer>
|
||||
<integer>21</integer>
|
||||
<integer>29</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>8R218</string>
|
||||
|
|
BIN
macosx/English.lproj/MainMenu.nib/keyedobjects.nib
generated
BIN
macosx/English.lproj/MainMenu.nib/keyedobjects.nib
generated
Binary file not shown.
Loading…
Add table
Reference in a new issue