[69790] branches/gsoc10-gui/Pallet
tzikis at macports.org
tzikis at macports.org
Fri Jul 16 10:02:35 PDT 2010
Revision: 69790
http://trac.macports.org/changeset/69790
Author: tzikis at macports.org
Date: 2010-07-16 10:02:32 -0700 (Fri, 16 Jul 2010)
Log Message:
-----------
Added the necessary changes in the GUI part for installing variants
Modified Paths:
--------------
branches/gsoc10-gui/Pallet/MPActionLauncher.h
branches/gsoc10-gui/Pallet/MPActionLauncher.m
branches/gsoc10-gui/Pallet/MPActionsController.h
branches/gsoc10-gui/Pallet/MPActionsController.m
Modified: branches/gsoc10-gui/Pallet/MPActionLauncher.h
===================================================================
--- branches/gsoc10-gui/Pallet/MPActionLauncher.h 2010-07-16 16:00:17 UTC (rev 69789)
+++ branches/gsoc10-gui/Pallet/MPActionLauncher.h 2010-07-16 17:02:32 UTC (rev 69790)
@@ -61,6 +61,13 @@
- (void)installPort:(MPPort *)port;
/*!
+ @brief Installs a single port with the selected variants in another thread
+ @param portAndVariands NSArray which includes the port to install and its variants
+ */
+
+- (void)installPortWithVariants:(NSArray *)portAndVariants;
+
+/*!
@brief Uninstalls a single port in another thread
@param port MPPort that represents the port to install
*/
Modified: branches/gsoc10-gui/Pallet/MPActionLauncher.m
===================================================================
--- branches/gsoc10-gui/Pallet/MPActionLauncher.m 2010-07-16 16:00:17 UTC (rev 69789)
+++ branches/gsoc10-gui/Pallet/MPActionLauncher.m 2010-07-16 17:02:32 UTC (rev 69790)
@@ -64,6 +64,24 @@
}
+- (void)installPortWithVariants:(NSArray *) portAndVariants {
+ errorReceived=NO;
+ NSError * error;
+ NSArray *empty = [NSArray arrayWithObject: @""];
+
+ MPPort* port = [portAndVariants objectAtIndex:0];
+ NSArray *variants = [portAndVariants objectAtIndex:1];
+ [port installWithOptions:empty variants:variants error:&error];
+ if(errorReceived)
+ [self sendGrowlNotification: GROWL_INSTALLFAILED];
+ else
+ {
+ [self sendGrowlNotification: GROWL_INSTALL];
+ [[NSNotificationCenter defaultCenter] postNotificationName:@"advanceQ" object:nil userInfo:nil];
+ }
+
+}
+
- (void)uninstallPort:(MPPort *)port {
errorReceived=NO;
NSError * error;
Modified: branches/gsoc10-gui/Pallet/MPActionsController.h
===================================================================
--- branches/gsoc10-gui/Pallet/MPActionsController.h 2010-07-16 16:00:17 UTC (rev 69789)
+++ branches/gsoc10-gui/Pallet/MPActionsController.h 2010-07-16 17:02:32 UTC (rev 69790)
@@ -54,7 +54,7 @@
- (IBAction)selfupdate:(id)sender;
- (IBAction)cancel:(id)sender;
-- (void) queueOperation: (NSString*) operation portName: (NSString*) name portObject: (id) port;
+- (void) queueOperation: (NSString*) operation portName: (NSString*) name portObject: (id) port variants: (NSMutableArray*) variants;
-(IBAction) startQueue:(id) sender;
-(IBAction) removeFromQueue:(id) sender;
Modified: branches/gsoc10-gui/Pallet/MPActionsController.m
===================================================================
--- branches/gsoc10-gui/Pallet/MPActionsController.m 2010-07-16 16:00:17 UTC (rev 69789)
+++ branches/gsoc10-gui/Pallet/MPActionsController.m 2010-07-16 17:02:32 UTC (rev 69790)
@@ -30,19 +30,28 @@
//NSLog(@"Port variants:");
NSMutableString *variantsString = [NSMutableString stringWithCapacity:50];
[variantsString appendString:[port name]];
+ NSMutableArray *variants=[NSMutableArray arrayWithCapacity:10];
for(UInt i=0; i<[[port valueForKey:@"variants"] count];i++)
{
//NSLog(@"%@",[[port valueForKey:@"variants"] objectAtIndex:i]);
if ([checkboxes[i] state] == NSOnState)
{
+ [variants addObject:[[port valueForKey:@"variants"] objectAtIndex:i]];
[variantsString appendString:@"+"];
[variantsString appendString:[[port valueForKey:@"variants"] objectAtIndex:i]];
}
}
//NSLog(@"End of Variants");
- [self queueOperation:@"install+" portName:variantsString portObject:port];
- //NSLog(@"%@",[port name]);
+ /*
+ for(UInt i=0; i<[variants count]; i++)
+ {
+ NSLog(@"variants array at #%i: %@", i, [variants objectAtIndex:i]);
+ }
+ */
+
+ [self queueOperation:@"install+" portName:variantsString portObject:port variants: variants];
+ NSLog(@"%@",[port name]);
if (altWasPressed)
[self startQueue:nil];
@@ -108,7 +117,7 @@
NSLog(@"Staring Installation");
NSArray *selectedPorts = [ports selectedObjects];
for (id port in selectedPorts) {
- [self queueOperation:@"install" portName:[port name] portObject:port];
+ [self queueOperation:@"install" portName:[port name] portObject:port variants:0];
NSLog(@"%@",[port name]);
//[[MPActionLauncher sharedInstance]
// performSelectorInBackground:@selector(installPort:) withObject:port];
@@ -127,7 +136,7 @@
[tableController open:nil];
NSArray *selectedPorts = [ports selectedObjects];
for (id port in selectedPorts) {
- [self queueOperation:@"uninstall" portName:[port name] portObject:port];
+ [self queueOperation:@"uninstall" portName:[port name] portObject:port variants:0];
NSLog(@"%@",[port name]);
/*
[[MPActionLauncher sharedInstance]
@@ -146,7 +155,7 @@
[tableController open:nil];
NSArray *selectedPorts = [ports selectedObjects];
for (id port in selectedPorts) {
- [self queueOperation:@"upgrade" portName:[port name] portObject:port];
+ [self queueOperation:@"upgrade" portName:[port name] portObject:port variants:0];
NSLog(@"%@",[port name]);
/*
[[MPActionLauncher sharedInstance]
@@ -163,7 +172,7 @@
[self clearQueue];
}
[tableController open:nil];
- [self queueOperation:@"sync" portName:@"-" portObject:@"-"];
+ [self queueOperation:@"sync" portName:@"-" portObject:@"-" variants:0];
/*
[[MPActionLauncher sharedInstance]
performSelectorInBackground:@selector(sync) withObject:nil];
@@ -178,7 +187,7 @@
[self clearQueue];
}
[tableController open:nil];
- [self queueOperation:@"selfupdate" portName:@"-" portObject:@"-"];
+ [self queueOperation:@"selfupdate" portName:@"-" portObject:@"-" variants:0];
/*
[[MPActionLauncher sharedInstance]
performSelectorInBackground:@selector(selfupdate) withObject:nil];
@@ -291,8 +300,10 @@
else if([[dict objectForKey:@"operation"] isEqualToString:@"install+"])
{
NSLog(@"We have installation with variants");
+ NSArray *variants = [dict objectForKey:@"variants"];
+ NSArray *portAndVariants = [NSArray arrayWithObjects:port, variants, nil];
[[MPActionLauncher sharedInstance]
- performSelectorInBackground:@selector(installPort:) withObject:port];
+ performSelectorInBackground:@selector(installPortWithVariants:) withObject:portAndVariants];
}
else if([[dict objectForKey:@"operation"] isEqualToString:@"uninstall"])
{
@@ -333,7 +344,7 @@
}
--(void) queueOperation:(NSString*)operation portName:(NSString*)name portObject: (id) port
+-(void) queueOperation:(NSString*)operation portName:(NSString*)name portObject: (id) port variants: (NSMutableArray*) variants
{
NSImage *image;
if ([operation isEqualToString:@"install"])
@@ -361,12 +372,20 @@
image = [NSImage imageNamed:@"TB_Selfupdate.icns"];
}
+
+ if(variants!=nil)
+ {
+ NSLog(@"yay");
+ for(UInt i=0; i<[variants count]; i++)
+ {
+ NSLog(@"variants array at #%i: %@", i, [variants objectAtIndex:i]);
+ }
+ }
+
NSLog(@"Queueing our Operation");
- //NSMutableDictionary *tempDict=[[NSMutableDictionary alloc] initWithObjectsAndKeys:@"wtf", @"operation", @"le_port", @"port", nil];
- [queue addObject:[NSMutableDictionary dictionaryWithObjectsAndKeys:operation, @"operation", name, @"port", port, @"object", image, @"image", nil]];
+ [queue addObject:[NSMutableDictionary dictionaryWithObjectsAndKeys:operation, @"operation", name, @"port", port, @"object", image, @"image", variants, @"variants", nil]];
//[queue addObject: tempDict];
//[queue retain];
-
}
-(void) removeFromQueue:(id)sender
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20100716/a246f177/attachment.html>
More information about the macports-changes
mailing list