Converted all operations to Queueing commands. Made some minor GUI changes to the Queueing Table

git-svn-id: https://svn.macports.org/repository/macports/branches/gsoc10-gui@68787 d073be05-634f-4543-b044-5fe20cf6d1d6
This commit is contained in:
Vasileios Georgitzikis
2010-06-13 17:04:01 +00:00
parent e016d557cc
commit 64e6a938dd
4 changed files with 274 additions and 102 deletions
File diff suppressed because it is too large Load Diff
+3
View File
@@ -20,6 +20,7 @@
IBOutlet NSToolbarItem *cancel;
IBOutlet NSButton *startQueueButton;
IBOutlet NSArrayController *queue;
IBOutlet PortsTableController *queueController;
}
- (IBAction)openPreferences:(id)sender;
@@ -31,6 +32,8 @@
- (IBAction)selfupdate:(id)sender;
- (IBAction)cancel:(id)sender;
- (void) queueOperation: (NSString*) operation andPort: (NSString*) port;
-(IBAction) startQueue:(id) sender;
@end
+57 -4
View File
@@ -23,8 +23,10 @@
NSLog(@"Staring Installation");
NSArray *selectedPorts = [ports selectedObjects];
for (id port in selectedPorts) {
[[MPActionLauncher sharedInstance]
performSelectorInBackground:@selector(installPort:) withObject:port];
[self queueOperation:@"install" andPort:[port name]];
NSLog(@"%@",[port name]);
//[[MPActionLauncher sharedInstance]
// performSelectorInBackground:@selector(installPort:) withObject:port];
}
NSLog(@"Installation Completed");
}
@@ -32,27 +34,41 @@
- (IBAction)uninstall:(id)sender {
NSArray *selectedPorts = [ports selectedObjects];
for (id port in selectedPorts) {
[[MPActionLauncher sharedInstance]
[self queueOperation:@"uninstall" andPort:[port name]];
NSLog(@"%@",[port name]);
/*
[[MPActionLauncher sharedInstance]
performSelectorInBackground:@selector(uninstallPort:) withObject:port];
*/
}
}
- (IBAction)upgrade:(id)sender {
NSArray *selectedPorts = [ports selectedObjects];
for (id port in selectedPorts) {
[self queueOperation:@"upgrade" andPort:[port name]];
NSLog(@"%@",[port name]);
/*
[[MPActionLauncher sharedInstance]
performSelectorInBackground:@selector(upgradePort:) withObject:port];
*/
}
}
- (IBAction)sync:(id)sender {
[self queueOperation:@"sync" andPort:@"sync"];
/*
[[MPActionLauncher sharedInstance]
performSelectorInBackground:@selector(sync) withObject:nil];
*/
}
- (IBAction)selfupdate:(id)sender {
[self queueOperation:@"selfupdate" andPort:@"selfupdate"];
/*
[[MPActionLauncher sharedInstance]
performSelectorInBackground:@selector(selfupdate) withObject:nil];
*/
}
- (IBAction)cancel:(id)sender {
@@ -97,7 +113,44 @@
-(void) startQueue:(id) sender
{
NSLog(@"Starting Queue Operations");
//[queue selectNext:nil];
NSLog(@"Starting Queue");
NSUInteger index;
index = [queue selectionIndex];
NSLog(@"Index before: %u", index);
NSUInteger i;
[queue setSelectionIndex: 0];
for(i=0; i<=index; i++)
{
//We select each object from the array
[queue setSelectionIndex:i];
//We sleep the process for debugging puproses
sleep(3);
//We take the array of selected objects
NSArray *wtf = [queue selectedObjects];
//We then take the dictionary
NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithDictionary:[wtf objectAtIndex:0]];
//And we print the operations
NSLog(@"Port %@ Operation %@",[dict objectForKey:@"port"], [dict objectForKey:@"operation"]);
}
[queue setSelectionIndex:index];
//[queue remove:nil];
//index = [queue selectionIndex];
//NSLog(@"Index after: %u", index);
//NSLog(@"Starting Queue Operations");
}
-(void) queueOperation:(NSString*)operation andPort:(NSString*)port
{
NSLog(@"Queueing our Operation");
//NSMutableDictionary *tempDict=[[NSMutableDictionary alloc] initWithObjectsAndKeys:@"wtf", @"operation", @"le_port", @"port", nil];
[queue addObject:[NSMutableDictionary dictionaryWithObjectsAndKeys:operation, @"operation", port, @"port",nil]];
//[queue addObject: tempDict];
//[queue retain];
}
@end
+2
View File
@@ -59,6 +59,8 @@
- (IBAction)hidePredicateEditor:(id)sender;
//Drawer methods
- (IBAction)open:(id)sender;
- (IBAction)close:(id)sender;
- (IBAction)toggle:(id)sender;