[69025] branches/gsoc10-gui/Pallet

tzikis at macports.org tzikis at macports.org
Sun Jun 20 17:45:24 PDT 2010


Revision: 69025
          http://trac.macports.org/changeset/69025
Author:   tzikis at macports.org
Date:     2010-06-20 17:45:23 -0700 (Sun, 20 Jun 2010)
Log Message:
-----------
Added the ability to alt-click on a toolbar button to clear the previous Queue and perform the operation right then-and-there

Modified Paths:
--------------
    branches/gsoc10-gui/Pallet/MPActionsController.h
    branches/gsoc10-gui/Pallet/MPActionsController.m
    branches/gsoc10-gui/Pallet/MPPortTableView.h
    branches/gsoc10-gui/Pallet/MPPortTableView.m

Modified: branches/gsoc10-gui/Pallet/MPActionsController.h
===================================================================
--- branches/gsoc10-gui/Pallet/MPActionsController.h	2010-06-21 00:34:47 UTC (rev 69024)
+++ branches/gsoc10-gui/Pallet/MPActionsController.h	2010-06-21 00:45:23 UTC (rev 69025)
@@ -13,6 +13,8 @@
 
 #import "GrowlNotifications.h"
 
+extern BOOL altWasPressed;
+
 @interface MPActionsController : NSObject {
     IBOutlet NSArrayController *ports;
     IBOutlet PortsTableController *tableController;
@@ -39,5 +41,6 @@
 
 -(IBAction) startQueue:(id) sender;
 -(IBAction) removeFromQueue:(id) sender;
+-(void) clearQueue;
 -(void) advanceQueue;
 @end

Modified: branches/gsoc10-gui/Pallet/MPActionsController.m
===================================================================
--- branches/gsoc10-gui/Pallet/MPActionsController.m	2010-06-21 00:34:47 UTC (rev 69024)
+++ branches/gsoc10-gui/Pallet/MPActionsController.m	2010-06-21 00:45:23 UTC (rev 69025)
@@ -16,6 +16,10 @@
 }
 
 - (IBAction)installWithVariants:(id)sender {
+	if (altWasPressed)
+	{
+		[self clearQueue];
+	}	 	
 	[tableController open:nil];
 	NSLog(@"Staring Installation");
     NSArray *selectedPorts = [ports selectedObjects];
@@ -23,11 +27,15 @@
 		[self queueOperation:@"install+" portName:[port name] portObject:port];
 		NSLog(@"%@",[port name]);
     }
-	
-	
+	if (altWasPressed)
+		[self startQueue:nil];
 }
 
 - (IBAction)install:(id)sender {
+	if (altWasPressed)
+	{
+		[self clearQueue];
+	}	 
 	[tableController open:nil];
 	NSLog(@"Staring Installation");
     NSArray *selectedPorts = [ports selectedObjects];
@@ -38,9 +46,16 @@
         //    performSelectorInBackground:@selector(installPort:) withObject:port];
     }
 	//NSLog(@"Installation Completed");
+	if (altWasPressed)
+		[self startQueue:nil];
 }
 
 - (IBAction)uninstall:(id)sender {
+	
+	if (altWasPressed)
+	{
+		[self clearQueue];
+	}	 
 	[tableController open:nil];
     NSArray *selectedPorts = [ports selectedObjects];
     for (id port in selectedPorts) {
@@ -51,9 +66,15 @@
             performSelectorInBackground:@selector(uninstallPort:) withObject:port];
 		 */
     }
+	if (altWasPressed)
+		[self startQueue:nil];
 }
 
 - (IBAction)upgrade:(id)sender {
+	if (altWasPressed)
+	{
+		[self clearQueue];
+	}	 
  	[tableController open:nil];
    NSArray *selectedPorts = [ports selectedObjects];
     for (id port in selectedPorts) {
@@ -64,24 +85,38 @@
             performSelectorInBackground:@selector(upgradePort:) withObject:port];
 		 */
     }
+	if (altWasPressed)
+		[self startQueue:nil];
 }
 
 - (IBAction)sync:(id)sender {
+	if (altWasPressed)
+	{
+		[self clearQueue];
+	}	 
 	[tableController open:nil];
 	[self queueOperation:@"sync" portName:@"-" portObject:@"-"];
 	/*
     [[MPActionLauncher sharedInstance]
         performSelectorInBackground:@selector(sync) withObject:nil];
 	 */
+	if (altWasPressed)
+		[self startQueue:nil];
 }
 
 - (IBAction)selfupdate:(id)sender {
+	if (altWasPressed)
+	{
+		[self clearQueue];
+	}	 
 	[tableController open:nil];
 	[self queueOperation:@"selfupdate" portName:@"-" portObject:@"-"];
 	/*
     [[MPActionLauncher sharedInstance]
         performSelectorInBackground:@selector(selfupdate) withObject:nil];
 	 */
+	if (altWasPressed)
+		[self startQueue:nil];
 }
 
 - (IBAction)cancel:(id)sender {
@@ -273,4 +308,13 @@
 	[queue setSelectionIndex: index];
 }
 
+
+-(void) clearQueue
+{
+	//NSLog(@"We have the alt key pressed");
+	NSIndexSet *tempIndex = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(0, [queueArray count])];
+	[queue removeObjectsAtArrangedObjectIndexes:tempIndex];
+	
+}
+
 @end

Modified: branches/gsoc10-gui/Pallet/MPPortTableView.h
===================================================================
--- branches/gsoc10-gui/Pallet/MPPortTableView.h	2010-06-21 00:34:47 UTC (rev 69024)
+++ branches/gsoc10-gui/Pallet/MPPortTableView.h	2010-06-21 00:45:23 UTC (rev 69025)
@@ -8,9 +8,11 @@
 
 #import <Cocoa/Cocoa.h>
 
+BOOL altWasPressed;
 
 @interface MPPortTableView : NSTableView {
     IBOutlet NSPanel *quickLookPanel;
+	
 }
 
 @end

Modified: branches/gsoc10-gui/Pallet/MPPortTableView.m
===================================================================
--- branches/gsoc10-gui/Pallet/MPPortTableView.m	2010-06-21 00:34:47 UTC (rev 69024)
+++ branches/gsoc10-gui/Pallet/MPPortTableView.m	2010-06-21 00:45:23 UTC (rev 69025)
@@ -31,4 +31,22 @@
     }
 }
 
+
+-(void)flagsChanged:(NSEvent *)theEvent
+{
+	if([theEvent modifierFlags]&NSAlternateKeyMask)
+	{
+		NSLog(@"Alt is pressed");
+		altWasPressed=YES;
+	}
+	else
+	{
+		if(altWasPressed)
+		{
+			NSLog(@"Alt is released");
+			altWasPressed=NO;
+		}
+		else [super flagsChanged:theEvent];
+	}
+}
 @end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20100620/75629d59/attachment.html>


More information about the macports-changes mailing list