Sort in the action menu.
This commit is contained in:
parent
2c44a4ef0a
commit
25e75ec312
|
@ -63,7 +63,9 @@
|
|||
|
||||
NSString * fSortType;
|
||||
IBOutlet NSMenuItem * fNameSortItem, * fStateSortItem, * fProgressSortItem,
|
||||
* fDateSortItem, * fOrderSortItem;
|
||||
* fDateSortItem, * fOrderSortItem,
|
||||
* fNameSortActionItem, * fStateSortActionItem, * fProgressSortActionItem,
|
||||
* fDateSortActionItem, * fOrderSortActionItem;
|
||||
|
||||
IBOutlet ImageBackgroundView * fFilterBar;
|
||||
BOOL fFilterBarVisible;
|
||||
|
|
|
@ -217,18 +217,34 @@ static void sleepCallBack(void * controller, io_service_t y,
|
|||
//set sort
|
||||
fSortType = [[fDefaults stringForKey: @"Sort"] retain];
|
||||
|
||||
NSMenuItem * currentSortItem;
|
||||
NSMenuItem * currentSortItem, * currentSortActionItem;
|
||||
if ([fSortType isEqualToString: @"Name"])
|
||||
{
|
||||
currentSortItem = fNameSortItem;
|
||||
currentSortActionItem = fNameSortActionItem;
|
||||
}
|
||||
else if ([fSortType isEqualToString: @"State"])
|
||||
{
|
||||
currentSortItem = fStateSortItem;
|
||||
currentSortActionItem = fStateSortActionItem;
|
||||
}
|
||||
else if ([fSortType isEqualToString: @"Progress"])
|
||||
{
|
||||
currentSortItem = fProgressSortItem;
|
||||
currentSortActionItem = fProgressSortActionItem;
|
||||
}
|
||||
else if ([fSortType isEqualToString: @"Date"])
|
||||
{
|
||||
currentSortItem = fDateSortItem;
|
||||
currentSortActionItem = fDateSortActionItem;
|
||||
}
|
||||
else
|
||||
{
|
||||
currentSortItem = fOrderSortItem;
|
||||
currentSortActionItem = fOrderSortActionItem;
|
||||
}
|
||||
[currentSortItem setState: NSOnState];
|
||||
[currentSortActionItem setState: NSOnState];
|
||||
|
||||
//set filter
|
||||
fFilterType = [[fDefaults stringForKey: @"Filter"] retain];
|
||||
|
@ -973,35 +989,76 @@ static void sleepCallBack(void * controller, io_service_t y,
|
|||
|
||||
- (void) setSort: (id) sender
|
||||
{
|
||||
NSMenuItem * prevSortItem;
|
||||
//get checked items
|
||||
NSMenuItem * prevSortItem, * prevSortActionItem;
|
||||
if ([fSortType isEqualToString: @"Name"])
|
||||
prevSortItem = fNameSortItem;
|
||||
else if ([fSortType isEqualToString: @"State"])
|
||||
prevSortItem = fStateSortItem;
|
||||
else if ([fSortType isEqualToString: @"Progress"])
|
||||
prevSortItem = fProgressSortItem;
|
||||
else if ([fSortType isEqualToString: @"Date"])
|
||||
prevSortItem = fDateSortItem;
|
||||
else
|
||||
prevSortItem = fOrderSortItem;
|
||||
|
||||
if (sender != prevSortItem)
|
||||
{
|
||||
[prevSortItem setState: NSOffState];
|
||||
[sender setState: NSOnState];
|
||||
|
||||
prevSortItem = fNameSortItem;
|
||||
prevSortActionItem = fNameSortActionItem;
|
||||
}
|
||||
else if ([fSortType isEqualToString: @"State"])
|
||||
{
|
||||
prevSortItem = fStateSortItem;
|
||||
prevSortActionItem = fStateSortActionItem;
|
||||
}
|
||||
else if ([fSortType isEqualToString: @"Progress"])
|
||||
{
|
||||
prevSortItem = fProgressSortItem;
|
||||
prevSortActionItem = fProgressSortActionItem;
|
||||
}
|
||||
else if ([fSortType isEqualToString: @"Date"])
|
||||
{
|
||||
prevSortItem = fDateSortItem;
|
||||
prevSortActionItem = fDateSortActionItem;
|
||||
}
|
||||
else
|
||||
{
|
||||
prevSortItem = fOrderSortItem;
|
||||
prevSortActionItem = fOrderSortActionItem;
|
||||
}
|
||||
|
||||
if (sender != prevSortItem && sender != prevSortActionItem)
|
||||
{
|
||||
[fSortType release];
|
||||
if (sender == fNameSortItem)
|
||||
|
||||
//get new items to check
|
||||
NSMenuItem * currentSortItem, * currentSortActionItem;
|
||||
if (sender == fNameSortItem || sender == fNameSortActionItem)
|
||||
{
|
||||
currentSortItem = fNameSortItem;
|
||||
currentSortActionItem = fNameSortActionItem;
|
||||
fSortType = [[NSString alloc] initWithString: @"Name"];
|
||||
else if (sender == fStateSortItem)
|
||||
}
|
||||
else if (sender == fStateSortItem || sender == fStateSortActionItem)
|
||||
{
|
||||
currentSortItem = fStateSortItem;
|
||||
currentSortActionItem = fStateSortActionItem;
|
||||
fSortType = [[NSString alloc] initWithString: @"State"];
|
||||
else if (sender == fProgressSortItem)
|
||||
}
|
||||
else if (sender == fProgressSortItem || sender == fProgressSortActionItem)
|
||||
{
|
||||
currentSortItem = fProgressSortItem;
|
||||
currentSortActionItem = fProgressSortActionItem;
|
||||
fSortType = [[NSString alloc] initWithString: @"Progress"];
|
||||
else if (sender == fDateSortItem)
|
||||
}
|
||||
else if (sender == fDateSortItem || sender == fDateSortActionItem)
|
||||
{
|
||||
currentSortItem = fDateSortItem;
|
||||
currentSortActionItem = fDateSortActionItem;
|
||||
fSortType = [[NSString alloc] initWithString: @"Date"];
|
||||
}
|
||||
else
|
||||
{
|
||||
currentSortItem = fOrderSortItem;
|
||||
currentSortActionItem = fOrderSortActionItem;
|
||||
fSortType = [[NSString alloc] initWithString: @"Order"];
|
||||
|
||||
}
|
||||
|
||||
[prevSortItem setState: NSOffState];
|
||||
[prevSortActionItem setState: NSOffState];
|
||||
[currentSortItem setState: NSOnState];
|
||||
[currentSortActionItem setState: NSOnState];
|
||||
|
||||
[fDefaults setObject: fSortType forKey: @"Sort"];
|
||||
}
|
||||
|
||||
|
@ -1667,7 +1724,7 @@ static void sleepCallBack(void * controller, io_service_t y,
|
|||
int state = ![fAdvancedBarItem state];
|
||||
[fAdvancedBarItem setState: state];
|
||||
[fDefaults setBool: state forKey: @"UseAdvancedBar"];
|
||||
|
||||
|
||||
[fTableView display];
|
||||
}
|
||||
|
||||
|
|
|
@ -39,18 +39,22 @@
|
|||
OUTLETS = {
|
||||
fActionButton = NSButton;
|
||||
fAdvancedBarItem = NSMenuItem;
|
||||
fDateSortActionItem = NSMenuItem;
|
||||
fDateSortItem = NSMenuItem;
|
||||
fDownloadFilterButton = BarButton;
|
||||
fDownloadLimitItem = NSMenuItem;
|
||||
fDownloadMenu = NSMenu;
|
||||
fDownloadNoLimitItem = NSMenuItem;
|
||||
fFilterBar = ImageBackgroundView;
|
||||
fNameSortActionItem = NSMenuItem;
|
||||
fNameSortItem = NSMenuItem;
|
||||
fNextInfoTabItem = NSMenuItem;
|
||||
fNoFilterButton = BarButton;
|
||||
fOrderSortActionItem = NSMenuItem;
|
||||
fOrderSortItem = NSMenuItem;
|
||||
fPauseFilterButton = BarButton;
|
||||
fPrevInfoTabItem = NSMenuItem;
|
||||
fProgressSortActionItem = NSMenuItem;
|
||||
fProgressSortItem = NSMenuItem;
|
||||
fRatioNotSetItem = NSMenuItem;
|
||||
fRatioSetItem = NSMenuItem;
|
||||
|
@ -61,6 +65,7 @@
|
|||
fSpeedLimitButton = NSButton;
|
||||
fSpeedLimitDockItem = NSMenuItem;
|
||||
fSpeedLimitItem = NSMenuItem;
|
||||
fStateSortActionItem = NSMenuItem;
|
||||
fStateSortItem = NSMenuItem;
|
||||
fStatusBar = ImageBackgroundView;
|
||||
fTableView = TorrentTableView;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<key>IBEditorPositions</key>
|
||||
<dict>
|
||||
<key>1041</key>
|
||||
<string>344 478 208 99 0 0 1152 842 </string>
|
||||
<string>344 478 208 130 0 0 1152 842 </string>
|
||||
<key>1480</key>
|
||||
<string>366 546 420 63 0 0 1152 842 </string>
|
||||
<key>1603</key>
|
||||
|
@ -31,9 +31,8 @@
|
|||
<integer>3</integer>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>21</integer>
|
||||
<integer>1480</integer>
|
||||
<integer>29</integer>
|
||||
<integer>1041</integer>
|
||||
<integer>1603</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue