Changeset 93
- Timestamp:
- 09/15/07 01:06:09 (1 year ago)
- Files:
-
- trunk/build_i386.sh (modified) (2 diffs)
- trunk/build_ppc.sh (modified) (1 diff)
- trunk/changelog.txt (modified) (1 diff)
- trunk/host-cocoa/Resources/q_icon.icns (modified) (previous)
- trunk/host-cocoa/cocoaQemu.m (modified) (20 diffs)
- trunk/host-cocoa/cocoaQemuOpenGLView.h (modified) (3 diffs)
- trunk/host-cocoa/cocoaQemuOpenGLView.m (modified) (4 diffs)
- trunk/host-cocoa/cocoaQemuQuartzView.h (modified) (3 diffs)
- trunk/host-cocoa/cocoaQemuQuartzView.m (modified) (6 diffs)
- trunk/host-cocoa/cocoaQemuWindow.m (modified) (8 diffs)
- trunk/patches/q_vga.c_02.diff (deleted)
- trunk/patches/qemu-0.9.0-big_endian_display4.diff (added)
- trunk/qcontrol/QControlTableView.m (modified) (5 diffs)
- trunk/qcontrol/Resources/q_icon.icns (modified) (previous)
- trunk/qcontrol/cocoaControlController.m (modified) (10 diffs)
- trunk/qcontrol/cocoaControlDOServer.h (modified) (5 diffs)
- trunk/qcontrol/cocoaControlDOServer.m (modified) (8 diffs)
- trunk/qcontrol/cocoaControlEditPC.m (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/build_i386.sh
r86 r93 35 35 patch -p0 -u < ../../q/patches/q_host-cocoa_02.diff 36 36 37 #qemu hotfixfor qcow237 #qemu cvs backport for qcow2 38 38 patch -p0 -u < ../../q/patches/qemu-0.9.0-qcow2.diff 39 40 #qemu cvs backport rgb support for bigendian 41 patch -p1 -u < ../../q/patches/qemu-0.9.0-big_endian_display4.diff 39 42 40 43 #qemu gcc4 patches … … 50 53 51 54 patch -p1 -u < ../../q/patches/qemu-0.8.0-osx-bugfix.patch 52 53 #qemu rgb support for intel54 cd hw55 patch -p0 -u < ../../../q/patches/q_vga.c_02.diff56 cd ..57 55 58 56 #qemu add 2nd Bootdevice trunk/build_ppc.sh
r86 r93 37 37 patch -p0 -u < ../../q/patches/q_host-cocoa_02.diff 38 38 39 #qemu hotfixfor qcow239 #qemu cvs backport for qcow2 40 40 patch -p0 -u < ../../q/patches/qemu-0.9.0-qcow2.diff 41 41 42 #qemu rgb support for intel 43 cd hw 44 #patch -p0 -u < ../../../q/patches/q_vga.c_02.diff 45 cd .. 42 #qemu cvs backport rgb support for bigendian 43 patch -p1 -u < ../../q/patches/qemu-0.9.0-big_endian_display4.diff 46 44 47 45 #qemu add 2nd Bootdevice trunk/changelog.txt
r90 r93 1 Q-0.9.0d90 1 Q-0.9.0d93 2 [fix] remove crashed/stray guests from doServer (#15) 3 [fix] Q Control: StopPC Icon is a forcequit if task is not responding or doServer is not responding (#15) 4 [fix] Fullscreen: alt-tabing back to Q brings you back to FS Guest (#32) 5 [fix] Fullscreen: switching animation always vertical 6 [fix] Fullscreen: honor aspect ratio, only factors of 1/1.25/1.5/1.75/2.0/3.0/4.0... (#18) 7 [fix] doServer: added missing dealloc 8 [fix] quartz: panther compiling 9 [fix] quartz: small drawspeed improvements 10 [fix] backport bgr support for bigendians (andreasf) (#14) 11 [new] Q Control: EditPC can be used (read only) when guest is running (#23) 12 [new] Q Control: commandline as tooltips of guests (#23) 13 [new] Q icon 14 15 Q-0.9.0d92 2 16 [fix] ARM emulation on Q GUI breaks (Chocobo) (#17) 3 17 [fix] Editing a PC inserts incorrect spaces into argument (andreasf) (#13) 4 18 [fix] Starting guest can display screenshot of previous session (andreasf) (#28) 5 19 [fix] Edit PC window title inconsistent (andreasf) (#26) 20 21 Q-0.9.0d91 22 branch Q-0.9.0a89 6 23 7 24 Q-0.9.0d89 trunk/host-cocoa/cocoaQemu.m
r90 r93 3 3 * 4 4 * Copyright (c) 2005 - 2007 Pierre d'Herbemont 5 * Mike Kronenberg6 * many code/inspiration from SDL 1.2 code (LGPL)5 * Mike Kronenberg 6 * many code/inspiration from SDL 1.2 code (LGPL) 7 7 * 8 8 * Permission is hereby granted, free of charge, to any person obtaining a copy … … 49 49 /* 50 50 ------------------------------------------------------ 51 Headers52 51 Headers 52 53 53 ------------------------------------------------------ 54 54 */ 55 55 /* 56 56 ------------------------------------------------------ 57 QemuCocoa Video Driver57 QemuCocoa Video Driver 58 58 ------------------------------------------------------ 59 59 */ … … 66 66 /* 67 67 ------------------------------------------------------ 68 QemuCocoa CD-ROM Driver68 QemuCocoa CD-ROM Driver 69 69 ------------------------------------------------------ 70 70 */ … … 76 76 /* 77 77 ------------------------------------------------------ 78 Implementations79 78 Implementations 79 80 80 ------------------------------------------------------ 81 81 */ 82 82 /* 83 83 ------------------------------------------------------ 84 cocoaQemu84 cocoaQemu 85 85 ------------------------------------------------------ 86 86 */ … … 89 89 -(id) init 90 90 { 91 // NSLog(@"cocoaQemu: init");92 93 if ((self = [super init])) {94 /* set allowed filetypes */95 fileTypes = [[NSArray arrayWithObjects:@"qcow2", @"qcow", @"raw", @"cow", @"vmdk", @"cloop", @"img", @"iso", @"dsk", @"dmg", @"cdr", @"toast", @"flp", @"fs", nil] retain];96 97 /* pc */98 pcName = [@"" retain];99 pcWindowName = [[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"] retain];100 pcPath = [[@"~/Documents/QEMU/temp.qvm" stringByExpandingTildeInPath] retain];101 pcTimer = [NSTimer scheduledTimerWithTimeInterval:10 target:self selector:@selector( liveThumbnail ) userInfo:nil repeats:YES];102 [self liveThumbnail];103 pcDialogs = YES;104 pc = self;105 106 /* set openGL as default */107 pcOpenGLView = true;108 109 /* setup progressWindow */110 progressWindow = [[cocoaQemuProgressWindow alloc] init];111 112 /* setup Q distributed object Client */113 qdoserver = [[NSConnection rootProxyForConnectionWithRegisteredName:@"qdoserver" host:nil] retain];114 [qdoserver setProtocolForProxy:@protocol(cocoaControlDOServerProto)];115 116 /* Pasteboard *//*117 bios_dir = [[NSString stringWithFormat:@"%@/qemu", [[NSBundle mainBundle] resourcePath]] cString];118 kbd_layout = init_keyboard_layout("de-ch");119 */ 120 return self;121 }122 return nil;91 // NSLog(@"cocoaQemu: init"); 92 93 if ((self = [super init])) { 94 /* set allowed filetypes */ 95 fileTypes = [[NSArray arrayWithObjects:@"qcow2", @"qcow", @"raw", @"cow", @"vmdk", @"cloop", @"img", @"iso", @"dsk", @"dmg", @"cdr", @"toast", @"flp", @"fs", nil] retain]; 96 97 /* pc */ 98 pcName = [@"" retain]; 99 pcWindowName = [[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"] retain]; 100 pcPath = [[@"~/Documents/QEMU/temp.qvm" stringByExpandingTildeInPath] retain]; 101 pcTimer = [NSTimer scheduledTimerWithTimeInterval:10 target:self selector:@selector( liveThumbnail ) userInfo:nil repeats:YES]; 102 [self liveThumbnail]; 103 pcDialogs = YES; 104 pc = self; 105 106 /* set openGL as default */ 107 pcOpenGLView = true; 108 109 /* setup progressWindow */ 110 progressWindow = [[cocoaQemuProgressWindow alloc] init]; 111 112 /* setup Q distributed object Client */ 113 qdoserver = [[NSConnection rootProxyForConnectionWithRegisteredName:@"qdoserver" host:nil] retain]; 114 [qdoserver setProtocolForProxy:@protocol(cocoaControlDOServerProto)]; 115 116 /* Pasteboard *//* 117 bios_dir = [[NSString stringWithFormat:@"%@/qemu", [[NSBundle mainBundle] resourcePath]] cString]; 118 kbd_layout = init_keyboard_layout("de-ch"); 119 */ 120 return self; 121 } 122 return nil; 123 123 } 124 124 125 125 - (void) dealloc 126 126 { 127 // NSLog(@"cocoaQemu: dealloc");128 129 [super dealloc];127 // NSLog(@"cocoaQemu: dealloc"); 128 129 [super dealloc]; 130 130 } 131 131 … … 133 133 - (BOOL) guestOrderFrontRegardless 134 134 { 135 // NSLog(@"cocoaQemu: guestOrderFrontRegardless");136 137 [pcWindow orderFrontRegardless];138 return true;135 // NSLog(@"cocoaQemu: guestOrderFrontRegardless"); 136 137 [pcWindow orderFrontRegardless]; 138 return true; 139 139 } 140 140 141 141 - (int) guestWindowLevel 142 142 { 143 // NSLog(@"cocoaQemu: guestWindowLevel");144 145 return [pcWindow level];143 // NSLog(@"cocoaQemu: guestWindowLevel"); 144 145 return [pcWindow level]; 146 146 } 147 147 148 148 - (int) guestWindowNumber 149 149 { 150 // NSLog(@"cocoaQemu: guestWindowNumber");151 152 return [pcWindow windowNumber];150 // NSLog(@"cocoaQemu: guestWindowNumber"); 151 152 return [pcWindow windowNumber]; 153 153 } 154 154 155 155 - (BOOL) guestOrderWindow:(NSWindowOrderingMode)place relativeTo:(int)otherWindowNumber 156 156 { 157 // NSLog(@"cocoaQemu: guestOrderWindow");158 159 [pcWindow orderWindow:place relativeTo:otherWindowNumber];160 return true;157 // NSLog(@"cocoaQemu: guestOrderWindow"); 158 159 [pcWindow orderWindow:place relativeTo:otherWindowNumber]; 160 return true; 161 161 } 162 162 163 163 - (BOOL) guestHide; 164 164 { 165 // NSLog(@"cocoaQemu: guestHide");166 167 [NSApp hide:self];168 return true;165 // NSLog(@"cocoaQemu: guestHide"); 166 167 [NSApp hide:self]; 168 return true; 169 169 } 170 170 171 171 - (BOOL) guestUnhide; 172 172 { 173 // NSLog(@"cocoaQemu: guestUnhide");174 175 [NSApp unhide:self];176 return true;173 // NSLog(@"cocoaQemu: guestUnhide"); 174 175 [NSApp unhide:self]; 176 return true; 177 177 } 178 178 179 179 - (BOOL) guestPause; 180 180 { 181 // NSLog(@"cocoaQemu: guestPause");182 183 [self pausePlay:self];184 return true;181 // NSLog(@"cocoaQemu: guestPause"); 182 183 [self pausePlay:self]; 184 return true; 185 185 } 186 186 187 187 - (BOOL) guestStop; 188 188 { 189 // NSLog(@"cocoaQemu: guestStop");190 191 [self shutdownPC];192 return true;189 // NSLog(@"cocoaQemu: guestStop"); 190 191 [self shutdownPC]; 192 return true; 193 193 } 194 194 … … 196 196 - (NSString *) pcName 197 197 { 198 // NSLog(@"cocoaQemu: pcName");199 200 return pcName;198 // NSLog(@"cocoaQemu: pcName"); 199 200 return pcName; 201 201 } 202 202 203 203 - (NSString *) pcWindowName 204 204 { 205 // NSLog(@"cocoaQemu: pcWindowName");206 207 return pcWindowName;205 // NSLog(@"cocoaQemu: pcWindowName"); 206 207 return pcWindowName; 208 208 } 209 209 210 210 -(NSString *) smbPath 211 211 { 212 // NSLog(@"cocoaQemu: smbPath");213 214 return smbPath;212 // NSLog(@"cocoaQemu: smbPath"); 213 214 return smbPath; 215 215 } 216 216 217 217 - (id) qdoserver 218 218 { 219 // NSLog(@"cocoaQemu: qdoserver");219 // NSLog(@"cocoaQemu: qdoserver"); 220 220 221 221 return qdoserver; … … 224 224 - (BOOL) fullscreen 225 225 { 226 // NSLog(@"cocoaQemu: fullscreen");227 228 return fullscreen;226 // NSLog(@"cocoaQemu: fullscreen"); 227 228 return fullscreen; 229 229 } 230 230 231 231 - (void) setFullscreen:(BOOL)val 232 232 { 233 // NSLog(@"cocoaQemu: setFullscreen");234 235 fullscreen = val;233 // NSLog(@"cocoaQemu: setFullscreen"); 234 235 fullscreen = val; 236 236 } 237 237 … … 259 259 - (BOOL) grab 260 260 { 261 // NSLog(@"cocoaQemu: grab");262 263 return grab;261 // NSLog(@"cocoaQemu: grab"); 262 263 return grab; 264 264 } 265 265 266 266 - (BOOL) absolute_enabled 267 267 { 268 // NSLog(@"cocoaQemu: absolute_enabled");269 270 return absolute_enabled;268 // NSLog(@"cocoaQemu: absolute_enabled"); 269 270 return absolute_enabled; 271 271 } 272 272 273 273 - (BOOL) tablet_enabled 274 274 { 275 // NSLog(@"cocoaQemu: tablet_enabled");276 277 return tablet_enabled;275 // NSLog(@"cocoaQemu: tablet_enabled"); 276 277 return tablet_enabled; 278 278 } 279 279 280 280 - (BOOL) wMStopWhenInactive 281 281 { 282 // NSLog(@"cocoaQemu: wMStopWhenInactive");283 284 return WMStopWhenInactive;282 // NSLog(@"cocoaQemu: wMStopWhenInactive"); 283 284 return WMStopWhenInactive; 285 285 } 286 286 287 287 - (BOOL) wMPaused 288 288 { 289 // NSLog(@"cocoaQemu: wMPaused");290 291 return vm_running;289 // NSLog(@"cocoaQemu: wMPaused"); 290 291 return vm_running; 292 292 } 293 293 294 294 - (BOOL) wMPausedByUser 295 295 { 296 // NSLog(@"cocoaQemu: wMPausedByUser");297 298 return wMPausedByUser;296 // NSLog(@"cocoaQemu: wMPausedByUser"); 297 298 return wMPausedByUser; 299 299 } 300 300 301 301 - (void) setGrab:(BOOL)val 302 302 { 303 // NSLog(@"cocoaQemu: setGrab");304 305 grab = val;303 // NSLog(@"cocoaQemu: setGrab"); 304 305 grab = val; 306 306 } 307 307 308 308 - (void) setAbsolute_enabled:(BOOL)val 309 309 { 310 // NSLog(@"cocoaQemu: setAbsolute_enabled");311 312 absolute_enabled = val;310 // NSLog(@"cocoaQemu: setAbsolute_enabled"); 311 312 absolute_enabled = val; 313 313 } 314 314 315 315 - (void) setTablet_enabled:(BOOL)val 316 316 { 317 // NSLog(@"cocoaQemu: setTablet_enabled");318 319 tablet_enabled = val;317 // NSLog(@"cocoaQemu: setTablet_enabled"); 318 319 tablet_enabled = val; 320 320 } 321 321 322 322 - (void) grabMouse 323 323 { 324 // NSLog(@"cocoaQemu: grabMouse");325 326 if (!grab) {327 grab = YES;328 [pcWindow setTitle: [NSString stringWithFormat: NSLocalizedStringFromTable(@"grabMouse:title", @"Localizable", @"cocoaQemu"), pcWindowName, pcName]];329 [NSCursor hide];330 CGAssociateMouseAndMouseCursorPosition ( FALSE );331 }324 // NSLog(@"cocoaQemu: grabMouse"); 325 326 if (!grab) { 327 grab = YES; 328 [pcWindow setTitle: [NSString stringWithFormat: NSLocalizedStringFromTable(@"grabMouse:title", @"Localizable", @"cocoaQemu"), pcWindowName, pcName]]; 329 [NSCursor hide]; 330 CGAssociateMouseAndMouseCursorPosition ( FALSE ); 331 } 332 332 } 333 333 334 334 - (void) ungrabMouse 335 335 { 336 // NSLog(@"cocoaQemu: ungrabMouse");337 338 if (grab) {339 grab = NO;340 [pcWindow setTitle: [NSString stringWithFormat:@"%@ - %@", pcWindowName, pcName]];341 [NSCursor unhide];342 CGAssociateMouseAndMouseCursorPosition ( TRUE );343 }336 // NSLog(@"cocoaQemu: ungrabMouse"); 337 338 if (grab) { 339 grab = NO; 340 [pcWindow setTitle: [NSString stringWithFormat:@"%@ - %@", pcWindowName, pcName]]; 341 [NSCursor unhide]; 342 CGAssociateMouseAndMouseCursorPosition ( TRUE ); 343 } 344 344 } 345 345 346 346 - (int) modifierAtIndex:(int)index 347 347 { 348 // NSLog(@"cocoaQemu: modifierAtIndex");349 350 return modifiers_state[index];348 // NSLog(@"cocoaQemu: modifierAtIndex"); 349 350 return modifiers_state[index]; 351 351 } 352 352 353 353 - (void) setModifierAtIndex:(int)index to:(int)value 354 354 { 355 // NSLog(@"cocoaQemu: setModifierAtIndex");356 357 modifiers_state[index] = value;355 // NSLog(@"cocoaQemu: setModifierAtIndex"); 356 357 modifiers_state[index] = value; 358 358 } 359 359 360 360 - (void) resetModifiers 361 361 { 362 // NSLog(@"cocoaQemu: resetModifiers");363 364 int i;365 for(i = 0; i < 256; i++) {366 if (modifiers_state[i]) {367 if (i & 0x80)368 kbd_put_keycode(0xe0);369 kbd_put_keycode(i | 0x80);370 modifiers_state[i] = 0;371 }372 }362 // NSLog(@"cocoaQemu: resetModifiers"); 363 364 int i; 365 for(i = 0; i < 256; i++) { 366 if (modifiers_state[i]) { 367 if (i & 0x80) 368 kbd_put_keycode(0xe0); 369 kbd_put_keycode(i | 0x80); 370 modifiers_state[i] = 0; 371 } 372 } 373 373 } 374 374 375 375 - (id) pcWindow 376 376 { 377 // NSLog(@"cocoaQemu: pcWindow");378 379 return pcWindow;377 // NSLog(@"cocoaQemu: pcWindow"); 378 379 return pcWindow; 380 380 } 381 381 382 382 - (id) contentView 383 383 { 384 // NSLog(@"cocoaQemu: contentView");385 386 return contentView;384 // NSLog(@"cocoaQemu: contentView"); 385 386 return contentView; 387 387 } 388 388 389 389 - (void) liveThumbnail 390 390 { 391 // NSLog(@"cocoaQemu: liveThumbnail <%@>", pcPath);392 393 if (![pcName isEqual:@""]) {394 /* create liveThumbnail */395 NSBitmapImageRep *bitmapImageRep = [NSBitmapImageRep imageRepWithData: [[contentView screenshot:NSMakeSize(100,75)] TIFFRepresentation]];396 NSData *data = [bitmapImageRep representationUsingType: NSPNGFileType properties: nil];397 [data writeToFile: [NSString stringWithFormat: @"%@/thumbnail.png", pcPath] atomically: YES];398 }391 // NSLog(@"cocoaQemu: liveThumbnail <%@>", pcPath); 392 393 if (![pcName isEqual:@""]) { 394 /* create liveThumbnail */ 395 NSBitmapImageRep *bitmapImageRep = [NSBitmapImageRep imageRepWithData: [[contentView screenshot:NSMakeSize(100,75)] TIFFRepresentation]]; 396 NSData *data = [bitmapImageRep representationUsingType: NSPNGFileType properties: nil]; 397 [data writeToFile: [NSString stringWithFormat: @"%@/thumbnail.png", pcPath] atomically: YES]; 398 } 399 399 } 400 400 401 401 - (void) stopVM 402 402 { 403 // NSLog(@"cocoaQemu: stopVM");404 405 if (vm_running)406 vm_stop(0);407 [pcWindow display];403 // NSLog(@"cocoaQemu: stopVM"); 404 405 if (vm_running) 406 vm_stop(0); 407 [pcWindow display]; 408 408 } 409 409 410 410 - (void) startVM 411 411 { 412 // NSLog(@"cocoaQemu: startVM");413 414 if (!vm_running)415 vm_start();416 [pcWindow display];412 // NSLog(@"cocoaQemu: startVM"); 413 414 if (!vm_running) 415 vm_start(); 416 [pcWindow display]; 417 417 } 418 418 419 419 - (void) saveVM 420 420 { 421 // NSLog(@"cocoaQemu: saveVM"); 422 423 /* show progressWindow */ 424 [progressWindow showProgressWindow:pcWindow text: NSLocalizedStringFromTable(@"saveVM:text", @"Localizable", @"cocoaQemu") name:pcName]; 425 426 /* stop VM */ 427 vm_stop(0); 428 429 /* generate Preview */ 430 NSBitmapImageRep *bitmapImageRep = [NSBitmapImageRep imageRepWithData: [[contentView screenshot:NSMakeSize(100,75)] TIFFRepresentation]]; 431 NSData *data = [bitmapImageRep representationUsingType: NSPNGFileType properties: nil]; 432 [data writeToFile: [NSString stringWithFormat: @"%@/thumbnail.png", pcPath] atomically: YES]; 433 434 /* save VM */ 435 // qemu_savevm( [[NSString stringWithFormat: @"%@/saved.vm", pcPath] cString]); 436 do_savevm([@"kju" cString]); 437 438 /* hide progressWindow */ 439 [progressWindow hideProgressWindow]; 421 // NSLog(@"cocoaQemu: saveVM"); 422 423 /* show progressWindow */ 424 [progressWindow showProgressWindow:pcWindow text: NSLocalizedStringFromTable(@"saveVM:text", @"Localizable", @"cocoaQemu") name:pcName]; 425 426 /* stop VM */ 427 vm_stop(0); 428 429 /* generate Preview */ 430 NSBitmapImageRep *bitmapImageRep = [NSBitmapImageRep imageRepWithData: [[contentView screenshot:NSMakeSize(100,75)] TIFFRepresentation]]; 431 NSData *data = [bitmapImageRep representationUsingType: NSPNGFileType properties: nil]; 432 [data writeToFile: [NSString stringWithFormat: @"%@/thumbnail.png", pcPath] atomically: YES]; 433 434 /* save VM */ 435 do_savevm([@"kju" cString]); 436 437 /* hide progressWindow */ 438 [progressWindow hideProgressWindow]; 440 439 } 441 440 442 441 - (void) closeProgressWindow 443 442 { 444 // NSLog(@"cocoaQemu: closeProgressWindow");445 446 if (vm_running) {447 [progressWindowTimer invalidate];448 [progressWindow hideProgressWindow];449 450 }443 // NSLog(@"cocoaQemu: closeProgressWindow"); 444 445 if (vm_running) { 446 [progressWindowTimer invalidate]; 447 [progressWindow hideProgressWindow]; 448 449 } 451 450 } 452 451 … … 454 453 - (void) startPCWithArgs:(id)arguments 455 454 { 456 // NSLog(@"cocoaQemu: startPCWithArgs"); 457 458 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 459 460 /* overrun defaults for bios_dir, so we can run qemu everywhere */ 461 bios_dir = [[NSString stringWithFormat:@"%@/qemu", [[NSBundle mainBundle] resourcePath]] cString]; 462 463 /* setup QEMU Window */ 464 pcWindow = [[cocoaQemuWindow alloc] initWithSender:self]; 465 if ([arguments containsObject:@"-cocoaquickdraw"]) { 466 contentView = [[[cocoaQemuQuickDrawView alloc] initWithFrame:NSMakeRect(0,0,640,400) sender:self] autorelease]; 467 } else if ([arguments containsObject:@"-cocoaquartz"]) { 468 contentView = [[[cocoaQemuQuartzView alloc] initWithFrame:NSMakeRect(0,0,640,400) sender:self] autorelease]; 469 } else { 470 contentView = [[[cocoaQemuOpenGLView alloc] initWithFrame:NSMakeRect(0,0,640,400) sender:self] autorelease]; 471 } 472 473 [contentView setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable]; 474 475 /* scrollview */ 476 /* NSScrollView * scrollView = [[NSScrollView alloc] init]; 477 [scrollView setHasVerticalScroller:TRUE]; 478 [scrollView setHasHorizontalScroller:TRUE]; 479 [scrollView setAutohidesScrollers:FALSE]; 480 [scrollView setScrollsDynamically:TRUE]; // 481 [scrollView setBorderType:NSLineBorder]; 482 [scrollView setDocumentView:contentView]; 483 [pcWindow setContentView:scrollView];*/ 484 485 486 [pcWindow setContentView:contentView]; 487 [pcWindow setMyContentView:contentView]; 488 489 /* filter cocoa arguments */ 490 int i; 491 int i2 = 0; 492 char **argv2 = (char**)malloc( sizeof(char*)*[arguments count] ); 493 494 for (i = 0; i < [arguments count]; i++) { 495 // NSLog(@"Arguments: %@", [arguments objectAtIndex:i]); 496 497 if ( [[arguments objectAtIndex:i] isEqual:@"-cocoaquickdraw"] ) { 498 pcOpenGLView = false; 499 } else if ( [[arguments objectAtIndex:i] isEqual:@"-cocoaquartz"] ) { 500 pcOpenGLView = false; 501 } else if ( [[arguments objectAtIndex:i] isEqual:@"-cocoaname"] ) { 502 i++; 503 pcName = [arguments objectAtIndex:i]; 504 } else if ( [[arguments objectAtIndex:i] isEqual:@"-cocoawindowname"] ) { 505 i++; 506 pcWindowName = [arguments objectAtIndex:i]; 507 } else if ( [[arguments objectAtIndex:i] isEqual:@"-cocoapath"] ) { 508 i++; 509 pcPath = [arguments objectAtIndex:i]; 510 } else if ( [[arguments objectAtIndex:i] isEqual:@"-cocoalivethumbnail"] ) { 511 } else if ( [[arguments objectAtIndex:i] isEqual:@"-cocoanodialogs"] ) { 512 pcDialogs = NO; 513 NSLog(@"pcDialogs: %d\n", pcDialogs); 514 } else if ( [[arguments objectAtIndex:i] isEqual:@"-wmstopwheninactive"] ) { 515 WMStopWhenInactive = true; 516 } else if ( [[arguments objectAtIndex:i] isEqual:@"-full-screen"] ) { 517 fullscreen = [contentView toggleFullScreen]; 518 } else if ( [[arguments objectAtIndex:i] isEqual:@"-cdrom"] ) { 519 if ( [[arguments objectAtIndex:i+1] isEqual:@"/dev/cdrom"] ) { 520 kern_return_t kernResult; 521 io_iterator_t mediaIterator; 522 char bsdPath[MAXPATHLEN]; 523 524 kernResult = FindEjectableCDMedia( &mediaIterator ); 525 kernResult = GetBSDPath( mediaIterator, bsdPath, sizeof( bsdPath ) ); 526 527 if ( bsdPath[0] == '\0' ) { 528 i++; 529 } else { 530 asprintf(&argv2[i2], "%s", [[arguments objectAtIndex:i] cString]); 531 i2++; 532 i++; 533 asprintf(&argv2[i2], "%s", [[arguments objectAtIndex:i] cString]); 534 i2++; 535 } 536 537 if ( mediaIterator ) 538 IOObjectRelease( mediaIterator ); 539 } else { 540 asprintf(&argv2[i2], "%s", [[arguments objectAtIndex:i] cString]); 541 i2++; 542 i++; 543 asprintf(&argv2[i2], "%s", [[arguments objectAtIndex:i] cString]); 544 i2++; 545 } 546 } else { 547 if ([[arguments objectAtIndex:i] isEqual:@"-smb"]) 548 smbPath = [[NSString alloc] initWithString:[arguments objectAtIndex:i + 1]]; 549 550 if ([[arguments objectAtIndex:i] isEqual:@"-hda"]) 455 // NSLog(@"cocoaQemu: startPCWithArgs"); 456 457 NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 458 459 /* overrun defaults for bios_dir, so we can run qemu everywhere */ 460 bios_dir = [[NSString stringWithFormat:@"%@/qemu", [[NSBundle mainBundle] resourcePath]] cString]; 461 462 /* setup QEMU Window */ 463 pcWindow = [[cocoaQemuWindow alloc] initWithSender:self]; 464 if ([arguments containsObject:@"-cocoaquickdraw"]) { 465 contentView = [[[cocoaQemuQuickDrawView alloc] initWithFrame:NSMakeRect(0,0,640,400) sender:self] autorelease]; 466 } else if ([arguments containsObject:@"-cocoaquartz"]) { 467 contentView = [[[cocoaQemuQuartzView alloc] initWithFrame:NSMakeRect(0,0,640,400) sender:self] autorelease]; 468 } else { 469 contentView = [[[cocoaQemuOpenGLView alloc] initWithFrame:NSMakeRect(0,0,640,400) sender:self] autorelease]; 470 } 471 [contentView setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable]; 472 473 /* scrollview */ 474 /* NSScrollView * scrollView = [[NSScrollView alloc] init]; 475 [scrollView setHasVerticalScroller:TRUE]; 476 [scrollView setHasHorizontalScroller:TRUE]; 477 [scrollView setAutohidesScrollers:FALSE]; 478 [scrollView setScrollsDynamically:TRUE]; // 479 [scrollView setBorderType:NSLineBorder]; 480 [scrollView setDocumentView:contentView]; 481 [pcWindow setContentView:scrollView];*/ 482 483 484 [pcWindow setContentView:contentView]; 485 [pcWindow setMyContentView:contentView]; 486 487 /* filter cocoa arguments */ 488 int i; 489 int i2 = 0; 490 char **argv2 = (char**)malloc( sizeof(char*)*[arguments count] ); 491 492 for (i = 0; i < [arguments count]; i++) { 493 // NSLog(@"Arguments: %@", [arguments objectAtIndex:i]); 494 495 if ( [[arguments objectAtIndex:i] isEqual:@"-cocoaquickdraw"] ) { 496 pcOpenGLView = false; 497 } else if ( [[arguments objectAtIndex:i] isEqual:@"-cocoaquartz"] ) { 498 pcOpenGLView = false; 499 } else if ( [[arguments objectAtIndex:i] isEqual:@"-cocoaname"] ) { 500 i++; 501 pcName = [arguments objectAtIndex:i]; 502 } else if ( [[arguments objectAtIndex:i] isEqual:@"-cocoawindowname"] ) { 503 i++; 504 pcWindowName = [arguments objectAtIndex:i]; 505 } else if ( [[arguments objectAtIndex:i] isEqual:@"-cocoapath"] ) { 506 i++; 507 pcPath = [arguments objectAtIndex:i]; 508 } else if ( [[arguments objectAtIndex:i] isEqual:@"-cocoalivethumbnail"] ) { 509 } else if ( [[arguments objectAtIndex:i] isEqual:@"-cocoanodialogs"] ) { 510 pcDialogs = NO; 511 NSLog(@"pcDialogs: %d\n", pcDialogs); 512 } else if ( [[arguments objectAtIndex:i] isEqual:@"-wmstopwheninactive"] ) { 513 WMStopWhenInactive = true; 514 } else if ( [[arguments objectAtIndex:i] isEqual:@"-full-screen"] ) { 515 fullscreen = [contentView toggleFullScreen]; 516 } else if ( [[arguments objectAtIndex:i] isEqual:@"-cdrom"] ) { 517 if ( [[arguments objectAtIndex:i+1] isEqual:@"/dev/cdrom"] ) { 518 kern_return_t kernResult; 519 io_iterator_t mediaIterator; 520 char bsdPath[MAXPATHLEN]; 521 522 kernResult = FindEjectableCDMedia( &mediaIterator ); 523 kernResult = GetBSDPath( mediaIterator, bsdPath, sizeof( bsdPath ) ); 524 525 if ( bsdPath[0] == '\0' ) { 526 i++; 527 } else { 528 asprintf(&argv2[i2], "%s", [[arguments objectAtIndex:i] cString]); 529 i2++; 530 i++; 531 asprintf(&argv2[i2], "%s", [[arguments objectAtIndex:i] cString]); 532 i2++; 533 } 534 535 if ( mediaIterator ) 536 IOObjectRelease( mediaIterator ); 537 } else { 538 asprintf(&argv2[i2], "%s", [[arguments objectAtIndex:i] cString]); 539 i2++; 540 i++; 541 asprintf(&argv2[i2], "%s", [[arguments objectAtIndex:i] cString]); 542 i2++; 543 } 544 } else { 545 if ([[arguments objectAtIndex:i] isEqual:@"-smb"]) 546 smbPath = [[NSString alloc] initWithString:[arguments objectAtIndex:i + 1]]; 547 548 if ([[arguments objectAtIndex:i] isEqual:@"-hda"]) 551 549 if ([[arguments objectAtIndex:i+1] rangeOfString:@"qcow2"].length > 0) 552 550 WMSupportsSnapshots = TRUE; 553 asprintf(&argv2[i2], "%s", [[arguments objectAtIndex:i] cString]);554 i2++;555 }556 }557 558 // for (i = 0; i < i2; i++)559 // NSLog(@"Argv :%s\n", argv2[i]);560 561 /* set window- and frameAutosaveName */562 [pcWindow setFrameAutosaveName: [NSString stringWithFormat:@"%@ - %@",pcWindowName, pcName]];563 [pcWindow setTitle: [NSString stringWithFormat:@"%@ - %@",pcWindowName, pcName]];564 565 /* show progressWindow */566 [progressWindow showProgressWindow:pcWindow text: NSLocalizedStringFromTable(@"startPCWithArgs:text", @"Localizable", @"cocoaQemu") name:pcName];567 568 /* register with Q distributed objects server */569 if (![qdoserver guestRegister: self withName:pcName]) {570 [qdoserver release];571 qdoserver = nil;572 NSLog(@"KO");573 }574 575 /* update status */576 pcStatus = @"running";577 578 /* hide progressWindow */579 progressWindowTimer = [NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector( closeProgressWindow ) userInfo:nil repeats:YES];580 581 /* launch VM, QEMU is up and running here */582 qemu_main(i2, argv2);583 584 /* remove pcWindow */585 [pcWindow close];586 587 [pool release];588 589 /* unregister with Q distributed objects server */590 if (![qdoserver guestUnregisterWithName:pcName]) {591 NSLog(@"KO");592 }593 [qdoserver release];594 qdoserver = nil;595 596 /* saved: return 2, so qemu-control knows */597 if ([pcStatus isEqual:@"saved"]) {598 exit(2);599 } else {600 [NSApp terminate:self];601 }551 asprintf(&argv2[i2], "%s", [[arguments objectAtIndex:i] cString]); 552 i2++; 553 } 554 } 555 556 // for (i = 0; i < i2; i++) 557 // NSLog(@"Argv :%s\n", argv2[i]); 558 559 /* set window- and frameAutosaveName */ 560 [pcWindow setFrameAutosaveName: [NSString stringWithFormat:@"%@ - %@",pcWindowName, pcName]]; 561 [pcWindow setTitle: [NSString stringWithFormat:@"%@ - %@",pcWindowName, pcName]]; 562 563 /* show progressWindow */ 564 [progressWindow showProgressWindow:pcWindow text: NSLocalizedStringFromTable(@"startPCWithArgs:text", @"Localizable", @"cocoaQemu") name:pcName]; 565 566 /* register with Q distributed objects server */ 567 if (![qdoserver guestRegister: self withName:pcName]) { 568 [qdoserver release]; 569 qdoserver = nil; 570 NSLog(@"KO"); 571 } 572 573 /* update status */ 574 pcStatus = @"running"; 575 576 /* hide progressWindow */ 577 progressWindowTimer = [NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector( closeProgressWindow ) userInfo:nil repeats:YES]; 578 579 /* launch VM, QEMU is up and running here */ 580 qemu_main(i2, argv2); 581 582 /* remove pcWindow */ 583 [pcWindow close]; 584 585 [pool release]; 586 587 /* unregister with Q distributed objects server */ 588 if (![qdoserver guestUnregisterWithName:pcName]) { 589 NSLog(@"KO"); 590 } 591 [qdoserver release]; 592 qdoserver = nil; 593 594 /* saved: return 2, so qemu-control knows */ 595 if ([pcStatus isEqual:@"saved"]) { 596 exit(2); 597 } else { 598 [NSApp terminate:self]; 599 } 602 600 } 603 601 604 602 - (void) changeFda:(id)sender 605 603 { 606 // NSLog(@"cocoaQemu: changeFda");607 608 NSOpenPanel *op = [[NSOpenPanel alloc] init];609 [op setPrompt: NSLocalizedStringFromTable(@"changeFda:prompt", @"Localizable", @"cocoaQemu")];610 [op setMessage: NSLocalizedStringFromTable(@"changeFda:message", @"Localizable", @"cocoaQemu")];611 [op beginSheetForDirectory:nil612 file:nil613 types:fileTypes614 modalForWindow:pcWindow615 modalDelegate:self616 didEndSelector:@selector(changeDeviceSheetDidEnd:returnCode:contextInfo:)617 contextInfo:@"fda"];604 // NSLog(@"cocoaQemu: changeFda"); 605 606 NSOpenPanel *op = [[NSOpenPanel alloc] init]; 607 [op setPrompt: NSLocalizedStringFromTable(@"changeFda:prompt", @"Localizable", @"cocoaQemu")]; 608 [op setMessage: NSLocalizedStringFromTable(@"changeFda:message", @"Localizable", @"cocoaQemu")]; 609 [op beginSheetForDirectory:nil 610 file:nil 611 types:fileTypes 612 modalForWindow:pcWindow 613 modalDelegate:self 614 didEndSelector:@selector(changeDeviceSheetDidEnd:returnCode:contextInfo:) 615 contextInfo:@"fda"]; 618 616 } 619 617 620 <