Changeset 89

Show
Ignore:
Timestamp:
06/06/07 19:07:36 (1 year ago)
Author:
mike
Message:

[new] new icons (Andi)
[fix] CpuView? adapted to new icons
[fix] new default icon set for qControl

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/changelog.txt

    r88 r89  
     1Q-0.9.0d89 
     2[new] new icons (Andi) 
     3[fix] CpuView adapted to new icons 
     4[fix] new default icon set for qControl 
     5 
    16Q-0.9.0d88 
    27[fix] changelog update 
  • trunk/host-cocoa/cocoaCpuView.m

    r62 r89  
    4141- (void) encodeWithCoder:(NSCoder *) coder 
    4242{ 
    43 //     NSLog(@"cocoaCpuView: encodeWithCoder"); 
    44  
    45        [super encodeWithCoder:coder]; 
    46        [coder encodeObject: [self image] forKey:@"regularImage"]; 
     43//  NSLog(@"cocoaCpuView: encodeWithCoder"); 
     44 
     45    [super encodeWithCoder:coder]; 
     46    [coder encodeObject: [self image] forKey:@"regularImage"]; 
    4747} 
    4848 
    4949- (id) initWithCoder:(NSCoder *) coder 
    5050{ 
    51 //     NSLog(@"cocoaCpuView: initWithCoder"); 
    52  
    53        if ((self = [super initWithCoder:coder])) { 
    54                regularImage = [[coder decodeObjectForKey:@"regularImage"] retain]; 
    55                smallImage = nil; 
    56                ctlSize = NSRegularControlSize; 
    57                  
    58                return self; 
    59        
    60        return nil; 
     51//  NSLog(@"cocoaCpuView: initWithCoder"); 
     52 
     53    if ((self = [super initWithCoder:coder])) { 
     54        regularImage = [[coder decodeObjectForKey:@"regularImage"] retain]; 
     55        smallImage = nil; 
     56        ctlSize = NSRegularControlSize; 
     57         
     58        return self; 
     59   
     60    return nil; 
    6161} 
    6262 
    6363- (id) initWithImage:(NSImage *) image 
    6464{ 
    65 //     NSLog(@"cocoaPopUpView: initWithImage"); 
    66  
    67        if( ( self = [super initWithFrame:NSMakeRect(0.,0.,[image size].width,[image size].height)] ) ) { 
    68                [self setImage:image]; 
    69                return self; 
    70        
    71          
    72        return nil; 
     65//  NSLog(@"cocoaPopUpView: initWithImage"); 
     66 
     67    if( ( self = [super initWithFrame:NSMakeRect(0.,0.,[image size].width,[image size].height)] ) ) { 
     68        [self setImage:image]; 
     69        return self; 
     70   
     71     
     72    return nil; 
    7373} 
    7474 
    7575- (void) dealloc 
    7676{ 
    77 //     NSLog(@"cocoaCpuView: dealloc"); 
    78  
    79        [regularImage release]; 
    80        [smallImage release]; 
    81  
    82        regularImage = nil; 
    83        smallImage = nil; 
    84  
    85        [super dealloc]; 
     77//  NSLog(@"cocoaCpuView: dealloc"); 
     78 
     79    [regularImage release]; 
     80    [smallImage release]; 
     81 
     82    regularImage = nil; 
     83    smallImage = nil; 
     84 
     85    [super dealloc]; 
    8686} 
    8787 
    8888- (void) drawRect:(NSRect) rect 
    8989{ 
    90 //      NSLog(@"cocoaCpuView: drawRect"); 
    91          
     90//  NSLog(@"cocoaCpuView: drawRect"); 
     91 
     92    /* CPU Activity */ 
    9293    NSBezierPath* path = [NSBezierPath bezierPath]; 
    93          
    94         /* HD Activity */ 
    95         BlockDriverState *bs; 
    96         bs = bdrv_find([@"hda" cString]); 
    97         if (bs) { 
    98         path = [NSBezierPath bezierPath]; 
    99         if( ctlSize == NSRegularControlSize ) { 
    100             [path setLineWidth:2.0]; 
    101             [path appendBezierPathWithOvalInRect:NSMakeRect(1,1,16,16)]; 
    102         } else { 
    103             [path appendBezierPathWithOvalInRect:NSMakeRect(1,1,12,12)]; 
    104         } 
    105         [[NSColor blackColor] setStroke]; 
    106         if (bs->activityLED) { 
    107             [[NSColor greenColor] setFill]; 
    108             bs->activityLED = 0; 
    109         } else { 
    110             [[NSColor yellowColor] setFill]; 
    111         } 
    112         [path fill]; 
    113         [path stroke]; 
    114         } 
    115          
    116         /* CD-ROM Activity */ 
    117 //      BlockDriverState *bs; 
    118         bs = bdrv_find([@"cdrom" cString]); 
    119         if (bs) { 
    120         path = [NSBezierPath bezierPath]; 
    121         if( ctlSize == NSRegularControlSize ) { 
    122             [path setLineWidth:2.0]; 
    123             [path appendBezierPathWithOvalInRect:NSMakeRect(39,1,16,16)]; 
    124         } else { 
    125             [path appendBezierPathWithOvalInRect:NSMakeRect(29,1,12,12)]; 
    126         } 
    127         [[NSColor blackColor] setStroke]; 
    128         if (bs->activityLED) { 
    129             [[NSColor greenColor] setFill]; 
    130             bs->activityLED = 0; 
    131         } else { 
    132             [[NSColor yellowColor] setFill]; 
    133         } 
    134         [path fill]; 
    135         [path stroke]; 
    136         path = [NSBezierPath bezierPath]; 
    137         if( ctlSize == NSRegularControlSize ) { 
    138             [path appendBezierPathWithOvalInRect:NSMakeRect(44,6,6,6)]; 
    139         } else { 
    140             [path appendBezierPathWithOvalInRect:NSMakeRect(33,5,4,4)]; 
    141         } 
    142         [[NSColor blackColor] setFill]; 
    143         [path fill]; 
    144         } 
    145           
    146     /* CPU Activity */ 
    14794    kern_return_t error;     
    14895    struct thread_basic_info tbi; 
     
    181128        if (error != KERN_SUCCESS) 
    182129            NSLog(@"Call to thread_info() failed"); 
    183 #endif  
     130#endif   
    184131        cpuUsage += tbi.cpu_usage; 
    185132    } 
    186133    cpuUsage = cpuUsage * 0.05; 
    187134 
    188         [[NSColor blackColor] set];  
    189         path = [NSBezierPath bezierPath]; 
    190  
    191         if( ctlSize == NSRegularControlSize ) { 
    192                 [regularImage compositeToPoint:NSMakePoint(12,0) operation:NSCompositeSourceOver]; 
    193                 [path moveToPoint:NSMakePoint(28, 0)]; 
    194                 [path lineToPoint:NSMakePoint(28. - cos(pi / 180. * (65. + cpuUsage)) * 28., sin(pi / 180. * (65. + cpuUsage)) * 28.)]; 
    195         } else { 
    196                 [smallImage compositeToPoint:NSMakePoint(9,0) operation:NSCompositeSourceOver]; 
    197                 [path moveToPoint:NSMakePoint(21, 0)]; 
    198                 [path lineToPoint:NSMakePoint(21. - cos(pi / 180. * (65. + cpuUsage)) * 20., sin(pi / 180. * (65. + cpuUsage)) * 20.)]; 
    199         } 
    200         [path stroke]; 
    201          
     135    [[NSColor blackColor] set];  
     136    path = [NSBezierPath bezierPath]; 
     137 
     138    if( ctlSize == NSRegularControlSize ) { 
     139        [regularImage compositeToPoint:NSMakePoint(0,0) operation:NSCompositeSourceOver]; //(12,0) 
     140        [path moveToPoint:NSMakePoint(16, 1)]; 
     141        [path lineToPoint:NSMakePoint(16. - cos(pi / 180. * (65. + cpuUsage)) * 16., sin(pi / 180. * (65. + cpuUsage)) * 29.)]; 
     142    } else { 
     143        [smallImage compositeToPoint:NSMakePoint(0,0) operation:NSCompositeSourceOver]; //(9,0) 
     144        [path moveToPoint:NSMakePoint(12, 2)]; 
     145        [path lineToPoint:NSMakePoint(12. - cos(pi / 180. * (65. + cpuUsage)) * 11., sin(pi / 180. * (65. + cpuUsage)) * 22.)]; 
     146    } 
     147    [path stroke]; 
     148 
     149 
     150    /* Drive Activity Indicator */ 
     151    BOOL DrivesAreActive = FALSE; 
     152    BlockDriverState *bs; 
     153 
     154    /* hda */ 
     155    bs = bdrv_find([@"hda" cString]); 
     156    if (bs) { 
     157        if (bs->activityLED) { 
     158            DrivesAreActive = YES; 
     159            bs->activityLED = 0; 
     160        } 
     161    } 
     162 
     163    /* CD-ROM */ 
     164    bs = bdrv_find([@"cdrom" cString]); 
     165    if (bs) { 
     166        if (bs->activityLED) { 
     167            DrivesAreActive = YES; 
     168            bs->activityLED = 0; 
     169        } 
     170    } 
     171 
     172    /* hdc */ 
     173    bs = bdrv_find([@"hdc" cString]); 
     174    if (bs) { 
     175        if (bs->activityLED) { 
     176            DrivesAreActive = YES; 
     177            bs->activityLED = 0; 
     178        } 
     179    } 
     180 
     181    /* hdd */ 
     182    bs = bdrv_find([@"hdd" cString]); 
     183    if (bs) { 
     184        if (bs->activityLED) { 
     185            DrivesAreActive = YES; 
     186            bs->activityLED = 0; 
     187        } 
     188    } 
     189 
     190    /* draw Indicator */ 
     191    if (DrivesAreActive) { 
     192//        [[NSColor yellowColor] setFill]; //E3BD00 //D9D401 
     193        [[NSColor colorWithDeviceRed:.89 green:.74 blue:.0 alpha:1.] setFill]; 
     194    } else { 
     195        [[NSColor blackColor] setFill]; 
     196    } 
     197    if( ctlSize == NSRegularControlSize ) { 
     198        NSRectFill(NSMakeRect(3,2,26,2)); 
     199    } else { 
     200        NSRectFill(NSMakeRect(2,2,20,2)); 
     201    } 
    202202} 
    203203 
    204204- (void) mouseDown:(NSEvent *) theEvent 
    205205{ 
    206 //     NSLog(@"cocoaCpuView: mouseDown"); 
     206//  NSLog(@"cocoaCpuView: mouseDown"); 
    207207 
    208208} 
     
    210210- (NSControlSize) controlSize 
    211211{ 
    212 //     NSLog(@"cocoaCpuView: controlSize"); 
    213  
    214        return ( ctlSize ? ctlSize : NSRegularControlSize ); 
     212//  NSLog(@"cocoaCpuView: controlSize"); 
     213 
     214    return ( ctlSize ? ctlSize : NSRegularControlSize ); 
    215215} 
    216216 
    217217- (void) setControlSize:(NSControlSize) controlSize { 
    218        if( controlSize == NSRegularControlSize ) { 
    219                [toolbarItem setMinSize:NSMakeSize( 56., 32. )]; 
    220                [toolbarItem setMaxSize:NSMakeSize( 56., 32. )]; 
    221        } else if( controlSize == NSSmallControlSize ) { 
    222                [toolbarItem setMinSize:NSMakeSize( 42., 24. )]; 
    223                [toolbarItem setMaxSize:NSMakeSize( 42., 24. )]; 
    224        
    225        ctlSize = controlSize; 
     218    if( controlSize == NSRegularControlSize ) { 
     219        [toolbarItem setMinSize:NSMakeSize( 32., 32. )]; 
     220        [toolbarItem setMaxSize:NSMakeSize( 32., 32. )]; 
     221    } else if( controlSize == NSSmallControlSize ) { 
     222        [toolbarItem setMinSize:NSMakeSize( 24., 24. )]; 
     223        [toolbarItem setMaxSize:NSMakeSize( 24., 24. )]; 
     224   
     225    ctlSize = controlSize; 
    226226} 
    227227- (NSImage *) image; 
    228228{ 
    229 //     NSLog(@"cocoaPopUpView: image"); 
    230  
    231        return regularImage; 
     229//  NSLog(@"cocoaPopUpView: image"); 
     230 
     231    return regularImage; 
    232232} 
    233233 
    234234- (void) setImage:(NSImage *) image 
    235235{ 
    236 //     NSLog(@"cocoaPopUpView: setImage"); 
    237  
    238        int i; 
    239        BOOL g = false; 
    240        BOOL s = false; 
    241  
    242        NSArray *reps = [image representations]; 
    243        for (i=0; i<[reps count]; i++) { 
    244                if ([[reps objectAtIndex:i] pixelsHigh] == 32) { 
    245                        [regularImage autorelease]; 
    246                        regularImage = [[NSImage alloc] initWithSize:NSMakeSize( 32., 32. )]; 
    247                        [regularImage addRepresentation:[reps objectAtIndex:i]]; 
    248                        g = true; 
    249                } else if ([[reps objectAtIndex:i] pixelsHigh] == 24) { 
    250                        [smallImage autorelease]; 
    251                        smallImage = [[NSImage alloc] initWithSize:NSMakeSize( 24., 24. )]; 
    252                        [smallImage addRepresentation:[reps objectAtIndex:i]]; 
    253                        s = true; 
    254                
    255        
    256          
    257        if (!g) { 
    258                [regularImage autorelease]; 
    259                regularImage = [image copy]; 
    260        
    261          
    262        if (!s) { 
    263                NSImageRep *sourceImageRep = [image bestRepresentationForDevice:nil]; 
    264                [smallImage autorelease]; 
    265                smallImage = [[NSImage alloc] initWithSize:NSMakeSize( 24., 24. )]; 
    266                [smallImage lockFocus]; 
    267                [[NSGraphicsContext currentContext] setImageInterpolation:NSImageInterpolationHigh]; 
    268                [sourceImageRep drawInRect:NSMakeRect( 0., 0., 24., 24. )]; 
    269                [smallImage unlockFocus]; 
    270        
     236//  NSLog(@"cocoaPopUpView: setImage"); 
     237 
     238    int i; 
     239    BOOL g = false; 
     240    BOOL s = false; 
     241 
     242    NSArray *reps = [image representations]; 
     243    for (i=0; i<[reps count]; i++) { 
     244        if ([[reps objectAtIndex:i] pixelsHigh] == 32) { 
     245            [regularImage autorelease]; 
     246            regularImage = [[NSImage alloc] initWithSize:NSMakeSize( 32., 32. )]; 
     247            [regularImage addRepresentation:[reps objectAtIndex:i]]; 
     248            g = true; 
     249        } else if ([[reps objectAtIndex:i] pixelsHigh] == 24) { 
     250            [smallImage autorelease]; 
     251            smallImage = [[NSImage alloc] initWithSize:NSMakeSize( 24., 24. )]; 
     252            [smallImage addRepresentation:[reps objectAtIndex:i]]; 
     253            s = true; 
     254       
     255   
     256     
     257    if (!g) { 
     258        [regularImage autorelease]; 
     259        regularImage = [image copy]; 
     260   
     261     
     262    if (!s) { 
     263        NSImageRep *sourceImageRep = [image bestRepresentationForDevice:nil]; 
     264        [smallImage autorelease]; 
     265        smallImage = [[NSImage alloc] initWithSize:NSMakeSize( 24., 24. )]; 
     266        [smallImage lockFocus]; 
     267        [[NSGraphicsContext currentContext] setImageInterpolation:NSImageInterpolationHigh]; 
     268        [sourceImageRep drawInRect:NSMakeRect( 0., 0., 24., 24. )]; 
     269        [smallImage unlockFocus]; 
     270   
    271271} 
    272272 
    273273- (NSToolbarItem *) toolbarItem 
    274274{ 
    275 //     NSLog(@"cocoaCpuView: toolbarItem"); 
    276  
    277        return [[toolbarItem retain] autorelease]; 
     275//  NSLog(@"cocoaCpuView: toolbarItem"); 
     276 
     277    return [[toolbarItem retain] autorelease]; 
    278278} 
    279279 
    280280- (void) setToolbarItem:(NSToolbarItem *) item { 
    281        toolbarItem = item; 
     281    toolbarItem = item; 
    282282} 
    283283 
    284284- (void) updateToolbarItem:(NSTimer*) timer 
    285285{ 
    286 //     NSLog(@"cocoaCpuView: updateToolbarItem"); 
    287  
    288        [self setNeedsDisplay:YES]; 
     286//  NSLog(@"cocoaCpuView: updateToolbarItem"); 
     287 
     288    [self setNeedsDisplay:YES]; 
    289289} 
    290290@end 
  • trunk/qcontrol/cocoaControlController.m

    r83 r89  
    590590    return [NSArray arrayWithObjects: 
    591591        @"newPCIdentifier", 
    592         @"editPCIdentifier", 
    593         @"startPCIdentifier", 
    594         NSToolbarFlexibleSpaceItemIdentifier, 
    595         //      NSToolbarCustomizeToolbarItemIdentifier, 
    596         @"removePCIdentifier", 
     592//        @"editPCIdentifier", 
     593//        @"startPCIdentifier", 
     594//        NSToolbarFlexibleSpaceItemIdentifier, 
     595//      NSToolbarCustomizeToolbarItemIdentifier, 
     596//        @"removePCIdentifier", 
    597597        nil]; 
    598598}