| |
Changeset 116
- Timestamp:
- 02/07/08 03:44:15
(1 year ago)
- Author:
- mike
- Message:
[new] smaller antialiased thumbnails
[new] VM name is taken from filename
[fix] Q Browser resizable
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r106 |
r116 |
|
| 11 | 11 | <key>IBOpenObjects</key> |
|---|
| 12 | 12 | <array> |
|---|
| 13 | | <integer>216</integer> |
|---|
| | 13 | <integer>221</integer> |
|---|
| 14 | 14 | </array> |
|---|
| 15 | 15 | <key>IBSystem Version</key> |
|---|
| r106 |
r116 |
|
| 11 | 11 | <key>IBOpenObjects</key> |
|---|
| 12 | 12 | <array> |
|---|
| 13 | | <integer>10</integer> |
|---|
| | 13 | <integer>12</integer> |
|---|
| 14 | 14 | </array> |
|---|
| 15 | 15 | <key>IBSystem Version</key> |
|---|
| r112 |
r116 |
|
| 256 | 256 | if (create) { |
|---|
| 257 | 257 | while ( (object = [enumerator nextObject]) ) { |
|---|
| 258 | | if ([[[object objectForKey:@"PC Data"] objectForKey:@"name"] isEqual: name] ) |
|---|
| | 258 | if ([[[object objectForKey:@"Temporary"] objectForKey:@"name"] isEqual: name] ) |
|---|
| 259 | 259 | return 0; |
|---|
| 260 | 260 | } |
|---|
| 261 | 261 | } else { |
|---|
| 262 | 262 | while ( (object = [enumerator nextObject]) ) { |
|---|
| 263 | | if ([[[object objectForKey:@"PC Data"] objectForKey:@"name"] isEqual: name]) { |
|---|
| 264 | | if ( ![[[thisPC objectForKey:@"PC Data"] objectForKey:@"name"] isEqual:name]) |
|---|
| | 263 | if ([[[object objectForKey:@"Temporary"] objectForKey:@"name"] isEqual: name]) { |
|---|
| | 264 | if ( ![[[thisPC objectForKey:@"Temporary"] objectForKey:@"name"] isEqual:name]) |
|---|
| 265 | 265 | return 0; |
|---|
| 266 | 266 | } |
|---|
| … | … | |
| 293 | 293 | // do not allow deleting a running VM |
|---|
| 294 | 294 | if ([[[VM objectForKey:@"PC Data"] objectForKey:@"state"] isEqual:@"running"]) { |
|---|
| 295 | | [self standardAlert: [NSString stringWithFormat: NSLocalizedStringFromTable(@"deleteVM:standardAlert", @"Localizable", @"QControlController"),[[VM objectForKey:@"PC Data"] objectForKey:@"name"]] |
|---|
| 296 | | informativeText: [NSString stringWithFormat: NSLocalizedStringFromTable(@"deleteVM:informativeText", @"Localizable", @"QControlController"), [[VM objectForKey:@"PC Data"] objectForKey:@"name"]]]; |
|---|
| | 295 | [self standardAlert: [NSString stringWithFormat: NSLocalizedStringFromTable(@"deleteVM:standardAlert", @"Localizable", @"QControlController"),[[VM objectForKey:@"Temporary"] objectForKey:@"name"]] |
|---|
| | 296 | informativeText: [NSString stringWithFormat: NSLocalizedStringFromTable(@"deleteVM:informativeText", @"Localizable", @"QControlController"), [[VM objectForKey:@"Temporary"] objectForKey:@"name"]]]; |
|---|
| 297 | 297 | return; |
|---|
| 298 | 298 | } |
|---|
| … | … | |
| 303 | 303 | alternateButton: NSLocalizedStringFromTable(@"deleteVM:alternateButton", @"Localizable", @"QControlController") |
|---|
| 304 | 304 | otherButton:nil |
|---|
| 305 | | informativeTextWithFormat:[NSString stringWithFormat: NSLocalizedStringFromTable(@"deleteVM:informativeTextWithFormat", @"Localizable", @"QControlController"),[[VM objectForKey:@"PC Data"] objectForKey:@"name"]]]; |
|---|
| | 305 | informativeTextWithFormat:[NSString stringWithFormat: NSLocalizedStringFromTable(@"deleteVM:informativeTextWithFormat", @"Localizable", @"QControlController"),[[VM objectForKey:@"Temporary"] objectForKey:@"name"]]]; |
|---|
| 306 | 306 | |
|---|
| 307 | 307 | // display alert |
|---|
| r113 |
r116 |
|
| 145 | 145 | } |
|---|
| 146 | 146 | |
|---|
| 147 | | NSMutableAttributedString *attrString = [[[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat: @"%@\n", [[VM objectForKey:@"Temporary"] objectForKey:@"name"]] attributes:[NSDictionary dictionaryWithObject: [NSFont boldSystemFontOfSize:[NSFont systemFontSize]] forKey:NSFontAttributeName]] autorelease]; |
|---|
| | 147 | NSMutableAttributedString *attrString = [[[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat: @"%@\n", [[[[VM objectForKey:@"Temporary"] objectForKey:@"URL"] path] lastPathComponent]] attributes:[NSDictionary dictionaryWithObject: [NSFont boldSystemFontOfSize:[NSFont smallSystemFontSize]] forKey:NSFontAttributeName]] autorelease]; |
|---|
| 148 | 148 | [attrString appendAttributedString: [[[NSAttributedString alloc] initWithString:state attributes:[NSDictionary dictionaryWithObject:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]] forKey:NSFontAttributeName]] autorelease]]; |
|---|
| 149 | 149 | |
|---|
| … | … | |
| 254 | 254 | savedImage = [[[NSImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/QuickLook/Thumbnail.png", [[[VM objectForKey:@"Temporary"] objectForKey:@"URL"] path]]] autorelease]; |
|---|
| 255 | 255 | if (savedImage) { // try screen.png |
|---|
| 256 | | thumbnail = [[[NSImage alloc] initWithSize:NSMakeSize(100.0, 75.0)] autorelease]; |
|---|
| | 256 | thumbnail = [[[NSImage alloc] initWithSize:NSMakeSize(80.0, 60.0)] autorelease]; |
|---|
| 257 | 257 | [thumbnail lockFocus]; |
|---|
| 258 | | [savedImage drawInRect:NSMakeRect(0.0, 0.0, 100.0, 75.0) fromRect:NSMakeRect(0.0, 0.0, [savedImage size].width, [savedImage size].height) operation:NSCompositeSourceOver fraction:1.0]; |
|---|
| | 258 | [savedImage drawInRect:NSMakeRect(0.0, 0.0, 80.0, 60.0) fromRect:NSMakeRect(0.0, 0.0, [savedImage size].width, [savedImage size].height) operation:NSCompositeSourceOver fraction:1.0]; |
|---|
| 259 | 259 | [thumbnail unlockFocus]; |
|---|
| 260 | 260 | return thumbnail; |
|---|
| … | … | |
| 293 | 293 | case QDocumentRunning: |
|---|
| 294 | 294 | case QDocumentSaving: |
|---|
| 295 | | thumbnail = [(QDocumentOpenGLView *)[qDocument screenView] screenshot:NSMakeSize(100.0, 75.0)]; |
|---|
| | 295 | thumbnail = [(QDocumentOpenGLView *)[qDocument screenView] screenshot:NSMakeSize(80.0, 60.0)]; |
|---|
| 296 | 296 | [VMsImages replaceObjectAtIndex:i withObject:thumbnail]; |
|---|
| 297 | 297 | break; |
|---|
| r115 |
r116 |
|
| 240 | 240 | - (IBAction) newDocument:(id)sender |
|---|
| 241 | 241 | { |
|---|
| | 242 | Q_DEBUG(@"saveDocument"); |
|---|
| | 243 | |
|---|
| | 244 | // Todo: |
|---|
| | 245 | // either create a "new document" (immediately create the files) or show a assistent |
|---|
| | 246 | // the -name argument is created by the document name |
|---|
| | 247 | |
|---|
| 242 | 248 | NSLog(@"We should create a now Document now"); |
|---|
| 243 | 249 | } |
|---|
| … | … | |
| 246 | 252 | { |
|---|
| 247 | 253 | Q_DEBUG(@"saveDocument"); |
|---|
| | 254 | |
|---|
| | 255 | // Todo: |
|---|
| | 256 | // implement saving as following: |
|---|
| | 257 | // if VM is shutdown/saved: |
|---|
| | 258 | // - save the .qvm package with the save name |
|---|
| | 259 | // - save configuration.plist |
|---|
| | 260 | // if the VM is running |
|---|
| | 261 | // - save a snapshot |
|---|
| 248 | 262 | |
|---|
| 249 | 263 | [distributedObject setCommand:'W' arg1:0 arg2:0 arg3:0 arg4:0]; |
|---|
| … | … | |
| 253 | 267 | { |
|---|
| 254 | 268 | Q_DEBUG(@"revertDocumentToSaved"); |
|---|
| | 269 | |
|---|
| | 270 | // Todo |
|---|
| | 271 | // only revert running machines |
|---|
| 255 | 272 | |
|---|
| 256 | 273 | [distributedObject setCommand:'X' arg1:0 arg2:0 arg3:0 arg4:0]; |
|---|
| r106 |
r116 |
|
| 38 | 38 | |
|---|
| 39 | 39 | // Tab 1 |
|---|
| 40 | | IBOutlet NSTextField *vMName; |
|---|
| 41 | 40 | IBOutlet NSButton *grabless; |
|---|
| 42 | 41 | IBOutlet NSButton *qDrivers; |
|---|
| r106 |
r116 |
|
| 78 | 78 | |
|---|
| 79 | 79 | // Tab 1 |
|---|
| 80 | | [vMName setStringValue:@""]; |
|---|
| 81 | 80 | [grabless setState:NSOffState]; |
|---|
| 82 | 81 | [qDrivers setState:NSOffState]; |
|---|
| … | … | |
| 120 | 119 | Q_DEBUG(@"setOption:%@ withArgument:%@", key, argument); |
|---|
| 121 | 120 | |
|---|
| 122 | | // -name TODO: convert -name from 0.2.0.Q profile |
|---|
| 123 | | if ([key isEqual:@"-name"]) { |
|---|
| 124 | | [vMName setStringValue:argument]; |
|---|
| 125 | | return TRUE; |
|---|
| 126 | | |
|---|
| 127 | 121 | // grabless (-usbdevice tablet) |
|---|
| 128 | | } else if ([key isEqual:@"-usbdevice"] && [argument isEqual:@"tablet"]) { |
|---|
| | 122 | if ([key isEqual:@"-usbdevice"] && [argument isEqual:@"tablet"]) { |
|---|
| 129 | 123 | [grabless setState:NSOffState]; |
|---|
| 130 | 124 | return TRUE; |
|---|
| r114 |
r116 |
|
| 574 | 574 | // setup CG |
|---|
| 575 | 575 | CGContextRef viewContextRef = [[NSGraphicsContext currentContext] graphicsPort]; |
|---|
| 576 | | CGContextSetInterpolationQuality (viewContextRef, kCGInterpolationNone); |
|---|
| 577 | | CGContextSetShouldAntialias (viewContextRef, NO); |
|---|
| | 576 | CGContextSetInterpolationQuality (viewContextRef, kCGInterpolationLow); |
|---|
| | 577 | CGContextSetShouldAntialias (viewContextRef, YES); |
|---|
| 578 | 578 | |
|---|
| 579 | 579 | // draw screen bitmap directly to Core Graphics context |
|---|
| r106 |
r116 |
|
| 66 | 66 | Q_DEBUG(@"saveVMConfiguration %@", VM); |
|---|
| 67 | 67 | |
|---|
| 68 | | //NSURL *URL; |
|---|
| 69 | | //URL = [[[VM objectForKey:@"Temporary"] objectForKey:@"URL"] copy]; |
|---|
| 70 | | //[[VM objectForKey:@"Temporary"] removeObjectForKey:@"URL"]; // can't be stored in Propertylist |
|---|
| 71 | | |
|---|
| 72 | 68 | NSMutableDictionary *temporary; |
|---|
| 73 | 69 | |
|---|
| 74 | 70 | temporary = [[VM objectForKey:@"Temporary"] copy]; |
|---|
| | 71 | [temporary autorelease]; |
|---|
| 75 | 72 | [VM removeObjectForKey:@"Temporary"]; // don't store temporary items (URL can't be stored in Propertylist anyways) |
|---|
| 76 | | |
|---|
| 77 | 73 | |
|---|
| 78 | 74 | NSData *data = [NSPropertyListSerialization |
|---|
| … | … | |
| 188 | 184 | // exploded arguments |
|---|
| 189 | 185 | [[tempVM objectForKey:@"Temporary"] setObject:[[QQvmManager sharedQvmManager] explodeVMArguments:[tempVM objectForKey:@"Arguments"]] forKey:@"explodedArguments"]; |
|---|
| 190 | | |
|---|
| 191 | | // name |
|---|
| 192 | | nameIndex = [[[tempVM objectForKey:@"Temporary"] objectForKey:@"explodedArguments"] indexOfObject:@"-name"]; |
|---|
| 193 | | if (nameIndex == NSNotFound) { |
|---|
| 194 | | name = @"Unknown"; |
|---|
| 195 | | NSLog(@"name: %@", name); |
|---|
| 196 | | } else { |
|---|
| 197 | | name = [[[tempVM objectForKey:@"Temporary"] objectForKey:@"explodedArguments"] objectAtIndex:(nameIndex + 1)]; |
|---|
| 198 | | } |
|---|
| 199 | | [[tempVM objectForKey:@"Temporary"] setObject:name forKey:@"name"]; |
|---|
| 200 | | |
|---|
| | 186 | |
|---|
| 201 | 187 | // url |
|---|
| 202 | 188 | [[tempVM objectForKey:@"Temporary"] setObject:[NSURL fileURLWithPath:filename] forKey:@"URL"]; |
|---|
Download in other formats:
| |