Fixed playlist sorting by path/shuffle

CQTexperiment
vspader 2006-05-29 23:03:58 +00:00
parent e919340f6d
commit b596f19c81
9 changed files with 29 additions and 39 deletions

View File

@ -30,9 +30,6 @@
- (void)openPanelDidEnd:(NSOpenPanel *)panel returnCode:(int)returnCode contextInfo:(void *)contextInfo;
- (IBAction)sortByPath:(id)sender;
- (IBAction)shufflePlaylist:(id)sender;
- (IBAction)donate:(id)sender;
- (IBAction)toggleInfoDrawer:(id)sender;

View File

@ -166,16 +166,6 @@
[infoButton setState:NSOffState];
}
- (IBAction)sortByPath:(id)sender
{
[playlistController sortByPath];
}
- (IBAction)shufflePlaylist:(id)sender
{
[playlistController randomizeList];
}
- (IBAction)donate:(id)sender
{
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://sourceforge.net/project/project_donations.php?group_id=140003"]];

View File

@ -99,7 +99,6 @@
8E757B5709F326710080F1EE /* OggFLAC.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 8E75773809F31F1F0080F1EE /* OggFLAC.framework */; };
8E757C7C09F32F070080F1EE /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8E757C7A09F32F070080F1EE /* AudioToolbox.framework */; };
8E757C7D09F32F070080F1EE /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8E757C7B09F32F070080F1EE /* AudioUnit.framework */; };
8EEBC1B50A177D70006F6251 /* PlaylistEntry.xcdatamodel in Sources */ = {isa = PBXBuildFile; fileRef = 8EEBC1B40A177D70006F6251 /* PlaylistEntry.xcdatamodel */; };
/* End PBXBuildFile section */
/* Begin PBXBuildStyle section */
@ -278,7 +277,6 @@
8E75777809F320D50080F1EE /* SndFile.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SndFile.framework; path = Libraries/SndFile/build/Release/SndFile.framework; sourceTree = "<group>"; };
8E757C7A09F32F070080F1EE /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = /System/Library/Frameworks/AudioToolbox.framework; sourceTree = "<absolute>"; };
8E757C7B09F32F070080F1EE /* AudioUnit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioUnit.framework; path = /System/Library/Frameworks/AudioUnit.framework; sourceTree = "<absolute>"; };
8EEBC1B40A177D70006F6251 /* PlaylistEntry.xcdatamodel */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = wrapper.xcdatamodel; path = PlaylistEntry.xcdatamodel; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -348,7 +346,6 @@
29B97314FDCFA39411CA2CEA /* Cog */ = {
isa = PBXGroup;
children = (
8EEBC1AF0A177D14006F6251 /* Models */,
080E96DDFE201D6D7F000001 /* Classes */,
8E75751809F31D5A0080F1EE /* AppController.h */,
8E75751909F31D5A0080F1EE /* AppController.m */,
@ -576,14 +573,6 @@
name = "Codec Frameworks";
sourceTree = "<group>";
};
8EEBC1AF0A177D14006F6251 /* Models */ = {
isa = PBXGroup;
children = (
8EEBC1B40A177D70006F6251 /* PlaylistEntry.xcdatamodel */,
);
name = Models;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@ -713,7 +702,6 @@
8E4C7F090A0509FC003BE25F /* DragScrollView.m in Sources */,
8E6A8E2C0A0D8A68002ABE9C /* CoreAudioFile.m in Sources */,
8E6A8E380A0D8AD8002ABE9C /* CoreAudioUtils.m in Sources */,
8EEBC1B50A177D70006F6251 /* PlaylistEntry.xcdatamodel in Sources */,
8E1296DB0A2BA9CE00443124 /* PlaylistHeaderView.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;

View File

@ -95,10 +95,10 @@
},
{CLASS = PlaylistEntry; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
{
ACTIONS = {shufflePlaylist = id; sortByPath = id; };
CLASS = PlaylistView;
LANGUAGE = ObjC;
OUTLETS = {
appController = AppController;
playbackController = PlaybackController;
playlistController = PlaylistController;
};

View File

@ -7,13 +7,13 @@
<key>IBEditorPositions</key>
<dict>
<key>1063</key>
<string>0 312 189 49 0 0 1280 1002 </string>
<string>0 228 136 49 0 0 1024 746 </string>
<key>29</key>
<string>139 888 409 44 0 0 1280 1002 </string>
<string>98 651 409 44 0 0 1024 746 </string>
<key>463</key>
<string>486 586 308 187 0 0 1280 1002 </string>
<string>358 426 308 187 0 0 1024 746 </string>
<key>513</key>
<string>821 270 125 137 0 0 1280 1002 </string>
<string>639 190 125 137 0 0 1024 746 </string>
</dict>
<key>IBFramework Version</key>
<string>443.0</string>
@ -30,12 +30,12 @@
<integer>3</integer>
<key>IBOpenObjects</key>
<array>
<integer>1063</integer>
<integer>513</integer>
<integer>21</integer>
<integer>29</integer>
<integer>463</integer>
<integer>823</integer>
<integer>29</integer>
<integer>21</integer>
<integer>1063</integer>
<integer>513</integer>
</array>
<key>IBSystem Version</key>
<string>8I127</string>

Binary file not shown.

View File

@ -321,17 +321,16 @@
- (void)setSortDescriptors:(NSArray *)sortDescriptors
{
//Cheap hack so the index column isn't sorted
NSLog(@"KEY: %@", [[sortDescriptors objectAtIndex:0] key]);
if ([[[sortDescriptors objectAtIndex:0] key] caseInsensitiveCompare:@"displayIndex"] != NSOrderedSame)
if (([sortDescriptors count] != 0) && [[[sortDescriptors objectAtIndex:0] key] caseInsensitiveCompare:@"displayIndex"] == NSOrderedSame)
{
[super setSortDescriptors:sortDescriptors];
return;
}
[super setSortDescriptors:sortDescriptors];
}
- (void)sortByPath
{
[self setSortDescriptors:nil];
NSSortDescriptor *s = [[NSSortDescriptor alloc] initWithKey:@"filename" ascending:YES selector:@selector(compare:)];
// [self setSortDescriptors:[NSArray arrayWithObject:s]];
[self setContent:[[self content] sortedArrayUsingDescriptors:[NSArray arrayWithObject:s]]];

View File

@ -19,4 +19,8 @@
}
- (IBAction)sortByPath:(id)sender;
- (IBAction)shufflePlaylist:(id)sender;
@end

View File

@ -127,4 +127,16 @@
}
}
- (IBAction)sortByPath:(id)sender
{
[self setSortDescriptors:nil];
[playlistController sortByPath];
}
- (IBAction)shufflePlaylist:(id)sender
{
[self setSortDescriptors:nil];
[playlistController randomizeList];
}
@end