Changeset 123
- Timestamp:
- 02/29/08 19:59:08 (10 months ago)
- Files:
-
- trunk/English.lproj/QEditVM.nib/keyedobjects.nib (modified) (previous)
- trunk/QDocument/QDocumentEditVMController.m (modified) (9 diffs)
- trunk/changelog.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/QDocument/QDocumentEditVMController.m
r121 r123 76 76 { 77 77 Q_DEBUG(@"resetPanel"); 78 79 NSString *diskImageFile; 80 NSDirectoryEnumerator *directoryEnumerator; 81 NSArray *fileTypes; 82 83 fileTypes = [[[NSArray alloc] initWithArrayOfAllowedFileTypes] autorelease]; 78 84 79 85 // Tab 1 86 // -tablet 80 87 [grabless setState:NSOffState]; 88 89 // qdrivers 81 90 [qDrivers setState:NSOffState]; 91 92 // pause while inactive 82 93 [pauseWhileInactive setState:NSOffState]; 94 95 // -smb 96 while(![[smb itemAtIndex:2] isSeparatorItem]) 97 [smb removeItemAtIndex:2]; 83 98 [smb selectItemAtIndex:0]; 84 99 … … 95 110 [nicModel1 selectItemAtIndex:0]; 96 111 [nicModel2 selectItemAtIndex:0]; 112 113 // -fda 114 while(![[fda itemAtIndex:1] isSeparatorItem]) 115 [fda removeItemAtIndex:1]; 97 116 [fda selectItemAtIndex:0]; 117 118 // -cdrom 119 while(![[cdrom itemAtIndex:2] isSeparatorItem]) 120 [cdrom removeItemAtIndex:2]; 98 121 [cdrom selectItemAtIndex:0]; 122 123 124 // cleanup -hdb and add Harddisks located in Package to Menu 125 while(![[hda itemAtIndex:1] isSeparatorItem]) 126 [hda removeItemAtIndex:1]; 127 if ([hda numberOfItems] > 8) { 128 while(![[hda itemAtIndex:2] isSeparatorItem]) 129 [hda removeItemAtIndex:2]; 130 } else { 131 [[hda menu] insertItem:[NSMenuItem separatorItem] atIndex:2]; 132 } 133 directoryEnumerator = [[NSFileManager defaultManager] enumeratorAtPath:[[[VM objectForKey:@"Temporary"] objectForKey:@"URL"] path]]; 134 while ((diskImageFile = [directoryEnumerator nextObject])) { 135 if ([fileTypes containsObject:[diskImageFile pathExtension]]) 136 [hda insertItemWithTitle:[diskImageFile lastPathComponent] atIndex:2]; 137 } 138 if([[hda itemAtIndex:2] isSeparatorItem]) 139 [hda removeItemAtIndex:2]; 99 140 [hda selectItemAtIndex:0]; 141 142 // -boot 100 143 [boot selectItemAtIndex:2]; // c 144 145 101 146 102 147 // Tab 3 148 149 103 150 104 151 // Tab 4 152 // cleanup -hdb and add Harddisks located in Package to Menu 153 while(![[hdb itemAtIndex:1] isSeparatorItem]) 154 [hdb removeItemAtIndex:1]; 155 if ([hdb numberOfItems] > 8) { 156 while(![[hdb itemAtIndex:2] isSeparatorItem]) 157 [hdb removeItemAtIndex:2]; 158 } else { 159 [[hdb menu] insertItem:[NSMenuItem separatorItem] atIndex:2]; 160 } 161 directoryEnumerator = [[NSFileManager defaultManager] enumeratorAtPath:[[[VM objectForKey:@"Temporary"] objectForKey:@"URL"] path]]; 162 while ((diskImageFile = [directoryEnumerator nextObject])) { 163 if ([fileTypes containsObject:[diskImageFile pathExtension]]) 164 [hdb insertItemWithTitle:[diskImageFile lastPathComponent] atIndex:2]; 165 } 166 if([[hdb itemAtIndex:2] isSeparatorItem]) 167 [hdb removeItemAtIndex:2]; 105 168 [hdb selectItemAtIndex:0]; 169 170 // cleanup -hdc and add Harddisks located in Package to Menu 171 while(![[hdc itemAtIndex:1] isSeparatorItem]) 172 [hdc removeItemAtIndex:1]; 173 if ([hdc numberOfItems] > 8) { 174 while(![[hdc itemAtIndex:2] isSeparatorItem]) 175 [hdc removeItemAtIndex:2]; 176 } else { 177 [[hdc menu] insertItem:[NSMenuItem separatorItem] atIndex:2]; 178 } 179 directoryEnumerator = [[NSFileManager defaultManager] enumeratorAtPath:[[[VM objectForKey:@"Temporary"] objectForKey:@"URL"] path]]; 180 while ((diskImageFile = [directoryEnumerator nextObject])) { 181 if ([fileTypes containsObject:[diskImageFile pathExtension]]) 182 [hdc insertItemWithTitle:[diskImageFile lastPathComponent] atIndex:2]; 183 } 184 if([[hdc itemAtIndex:2] isSeparatorItem]) 185 [hdc removeItemAtIndex:2]; 106 186 [hdc selectItemAtIndex:0]; 187 188 // cleanup -hdd and add Harddisks located in Package to Menu 189 while(![[hdd itemAtIndex:1] isSeparatorItem]) 190 [hdd removeItemAtIndex:1]; 191 if ([hdd numberOfItems] > 8) { 192 while(![[hdd itemAtIndex:2] isSeparatorItem]) 193 [hdd removeItemAtIndex:2]; 194 } else { 195 [[hdd menu] insertItem:[NSMenuItem separatorItem] atIndex:2]; 196 } 197 directoryEnumerator = [[NSFileManager defaultManager] enumeratorAtPath:[[[VM objectForKey:@"Temporary"] objectForKey:@"URL"] path]]; 198 while ((diskImageFile = [directoryEnumerator nextObject])) { 199 if ([fileTypes containsObject:[diskImageFile pathExtension]]) 200 [hdd insertItemWithTitle:[diskImageFile lastPathComponent] atIndex:2]; 201 } 202 if([[hdd itemAtIndex:2] isSeparatorItem]) 203 [hdd removeItemAtIndex:2]; 107 204 [hdd selectItemAtIndex:0]; 205 206 // -localtime 108 207 [localtime setState:NSOffState]; 208 209 // -win2khack 109 210 [win2kHack setState:NSOffState]; 211 212 // kernel 213 while(![[kernel itemAtIndex:1] isSeparatorItem]) 214 [kernel removeItemAtIndex:1]; 110 215 [kernel selectItemAtIndex:0]; 216 111 217 [append setStringValue:@""]; 218 219 // initrd 220 while(![[initrd itemAtIndex:1] isSeparatorItem]) 221 [initrd removeItemAtIndex:1]; 112 222 [initrd selectItemAtIndex:0]; 223 113 224 [onlyOptional setState:NSOffState]; 114 225 [optional setStringValue:@""]; … … 123 234 { 124 235 Q_DEBUG(@"setOption:%@ withArgument:%@", key, argument); 125 236 126 237 // grabless (-usbdevice tablet) 127 238 if ([key isEqual:@"-usbdevice"] && [argument isEqual:@"tablet"]) { … … 144 255 } 145 256 return TRUE; 146 257 147 258 // TODO: add other machines 148 259 // select machine … … 177 288 [smp setStringValue:argument]; 178 289 return TRUE; 179 290 180 291 // m 181 292 } else if ([key isEqual:@"-m"]) { … … 190 301 [vga selectItemAtIndex:2]; 191 302 return true; 192 303 193 304 // soundcards 194 305 } else if ([key isEqual:@"-soundhw"]) { … … 202 313 [es1370 setState:NSOnState]; 203 314 return true; 204 315 205 316 // networkcards 206 } else if ([key isEqual:@"-n ic"]) {317 } else if ([key isEqual:@"-net"]) { 207 318 // we can only handle the first to nics with the gui 208 319 niccount++; … … 211 322 nicModel = nicModel1; 212 323 } else if (niccount == 2) { 213 nicModel = nicModel 1;324 nicModel = nicModel2; 214 325 } else { 215 326 return false; 216 327 } 217 if ([argument isEqual:@"i82551"]) {328 if ([argument rangeOfString:@"i82551"].location != NSNotFound) { 218 329 [nicModel selectItemAtIndex:1]; 219 } else if ([argument isEqual:@"i82557b"]) {330 } else if ([argument rangeOfString:@"i82557b"].location != NSNotFound) { 220 331 [nicModel selectItemAtIndex:2]; 221 } else if ([argument isEqual:@"i82559er"]) {332 } else if ([argument rangeOfString:@"i82559er"].location != NSNotFound) { 222 333 [nicModel selectItemAtIndex:3]; 223 } else if ([argument isEqual:@"ne2k_pci"]) {334 } else if ([argument rangeOfString:@"ne2k_pci"].location != NSNotFound) { 224 335 [nicModel selectItemAtIndex:4]; 225 } else if ([argument isEqual:@"ne2k_isa"]) {336 } else if ([argument rangeOfString:@"ne2k_isa"].location != NSNotFound) { 226 337 [nicModel selectItemAtIndex:5]; 227 } else if ([argument isEqual:@"rtl8139"]) {338 } else if ([argument rangeOfString:@"rtl8139"].location != NSNotFound) { 228 339 [nicModel selectItemAtIndex:6]; 229 } else if ([argument isEqual:@"smc91c111"]) {340 } else if ([argument rangeOfString:@"smc91c111"].location != NSNotFound) { 230 341 [nicModel selectItemAtIndex:7]; 231 } else if ([argument isEqual:@"lance"]) {342 } else if ([argument rangeOfString:@"lance"].location != NSNotFound) { 232 343 [nicModel selectItemAtIndex:8]; 233 } else if ([argument isEqual:@"mcf_fec"]) {344 } else if ([argument rangeOfString:@"mcf_fec"].location != NSNotFound) { 234 345 [nicModel selectItemAtIndex:9]; 235 } 346 } else if ([argument rangeOfString:@"nic"].location != NSNotFound) { // default is rtl8139 347 [nicModel selectItemAtIndex:6]; 348 } else if ([argument isEqual:@"user"]) { // user networking 349 //Todo: what should we do 350 } 236 351 return TRUE; 237 352 238 353 // fda 239 // TODO: 240 354 } else if ([key isEqual:@"-fda"]) { 355 [fda insertItemWithTitle:[NSString stringWithString:argument] atIndex:1]; 356 [fda selectItemAtIndex:1]; 357 return TRUE; 358 241 359 // cdrom 242 // TODO: 360 } else if ([key isEqual:@"-cdrom"]) { 361 if ([argument isEqual:@"/dev/cdrom"]) { 362 [cdrom selectItemAtIndex:1]; 363 } else { 364 [cdrom insertItemWithTitle:[NSString stringWithString:argument] atIndex:2]; 365 [cdrom selectItemAtIndex:2]; 366 } 367 return TRUE; 243 368 244 369 // hda 245 // TODO: 370 } else if ([key isEqual:@"-hda"]) { 371 if ([hda indexOfItemWithTitle:argument] > -1) { 372 [hda selectItemWithTitle:argument]; 373 } else { 374 /* TODO: new Image 375 int intResult; 376 NSString *stringValue; 377 NSScanner *scanner = [NSScanner scannerWithString: argument]; 378 379 if ([scanner scanString:@"createNew" intoString:&stringValue]) { 380 [scanner scanInt:&intResult]; 381 customImagePopUpButtonTemp = hda; 382 [self setCustomDIType:@"qcow" size:intResult]; 383 } else {*/ 384 [hda insertItemWithTitle:[NSString stringWithString:argument] atIndex:1]; 385 [hda selectItemAtIndex:1]; 386 // } 387 } 388 return TRUE; 246 389 247 390 // hdb 248 // TODO: 249 391 } else if ([key isEqual:@"-hdb"]) { 392 if ([hdb indexOfItemWithTitle:argument] > -1) { 393 [hdb selectItemWithTitle:argument]; 394 } else { 395 [hdb insertItemWithTitle:[NSString stringWithString:argument] atIndex:1]; 396 [hdb selectItemAtIndex:1]; 397 } 398 return TRUE; 399 250 400 // hdc 251 // TODO: 252 401 } else if ([key isEqual:@"-hdc"]) { 402 if ([hdc indexOfItemWithTitle:argument] > -1) { 403 [hdc selectItemWithTitle:argument]; 404 } else { 405 [hdc insertItemWithTitle:[NSString stringWithString:argument] atIndex:1]; 406 [hdc selectItemAtIndex:1]; 407 } 408 return TRUE; 409 253 410 // hdd 254 // TODO: 255 411 } else if ([key isEqual:@"-hdd"]) { 412 if ([hdd indexOfItemWithTitle:argument] > -1) { 413 [hdd selectItemWithTitle:argument]; 414 } else { 415 [hdd insertItemWithTitle:[NSString stringWithString:argument] atIndex:1]; 416 [hdd selectItemAtIndex:1]; 417 } 418 return TRUE; 419 256 420 // boot 257 421 } else if ([key isEqual:@"-boot"]) { … … 266 430 } 267 431 return TRUE; 268 432 269 433 // localtime 270 434 } else if ([key isEqual:@"-localtime"]) { 271 435 [localtime setState:NSOnState]; 272 436 return true; 273 437 274 438 // win2khack 275 439 } else if ([key isEqual:@"-win2khack"]) { 276 440 [win2kHack setState:NSOnState]; 277 441 return true; 278 442 279 443 // kernel 280 // TODO: 281 444 } else if ([key isEqual:@"-kernel"]) { 445 [kernel insertItemWithTitle:[NSString stringWithString:argument] atIndex:1]; 446 [kernel selectItemAtIndex:1]; 447 return TRUE; 448 282 449 // append 283 450 } else if ([key isEqual:@"-append"]) { 284 451 [append setStringValue:argument]; 285 452 return TRUE; 286 453 287 454 // initrd 288 // TODO: 455 } else if ([key isEqual:@"-initrd"]) { 456 [initrd insertItemWithTitle:[NSString stringWithString:argument] atIndex:1]; 457 [initrd selectItemAtIndex:1]; 458 return TRUE; 289 459 290 460 } trunk/changelog.txt
r122 r123 1 123 2 [new] QDocumentEditVMController populating panel 3 1 4 122 2 5 [fix] QControlTableView single click handled as double click