Changeset 33492 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Oct 27, 2010 11:05:14 AM (14 years ago)
- svn:sync-xref-src-repo-rev:
- 67084
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxProblemReporter.cpp
r32334 r33492 2381 2381 } 2382 2382 2383 void VBoxProblemReporter::warnAboutIncorrectPort(QWidget *pParent) const 2383 void VBoxProblemReporter::cannotUpdateGuestAdditions (const CProgress &aProgress, QWidget *aParent /* = NULL */) const 2384 { 2385 AssertWrapperOk (aProgress); 2386 2387 message (aParent ? aParent : mainWindowShown(), 2388 Error, 2389 tr ("Failed to update Guest Additions."), 2390 formatErrorInfo (aProgress.GetErrorInfo())); 2391 } 2392 2393 void VBoxProblemReporter::warnAboutIncorrectPort (QWidget *pParent) const 2384 2394 { 2385 2395 message(pParent, Error, … … 2388 2398 } 2389 2399 2390 bool VBoxProblemReporter::confirmCancelingPortForwardingDialog (QWidget *pParent) const2400 bool VBoxProblemReporter::confirmCancelingPortForwardingDialog (QWidget *pParent) const 2391 2401 { 2392 2402 return messageOkCancel(pParent, Question, -
trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxProblemReporter.h
r32296 r33492 372 372 void cannotExportAppliance (const CProgress &aProgress, CAppliance *aAppliance, QWidget *aParent = NULL) const; 373 373 374 void cannotUpdateGuestAdditions (const CProgress &aProgress, QWidget *aParent /* = NULL */) const; 375 374 376 void warnAboutIncorrectPort(QWidget *pParent) const; 375 377 bool confirmCancelingPortForwardingDialog(QWidget *pParent) const; -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp
r33386 r33492 355 355 CMachine machine = session().GetMachine(); 356 356 CVirtualBox vbox = vboxGlobal().virtualBox(); 357 QString strUuid; 358 359 CMedium image = vbox.FindMedium(strSource, KDeviceType_DVD); 360 if (image.isNull()) 361 { 362 image = vbox.OpenMedium(strSource, KDeviceType_DVD, KAccessMode_ReadWrite); 363 if (vbox.isOk()) 357 358 #ifdef DEBUG_andy 359 /* 360 * If the already installed Guest Additions indicate a 361 * high enough run level (at the moment this is level "Desktop", 362 * which means that a user has to be logged in to acknowledge 363 * WHQL popups), try an automatic Guest Additions update. 364 */ 365 CGuest guest = session().GetConsole().GetGuest(); 366 QString osType = guest.GetOSTypeId(); 367 ULONG ulGuestAdditionsRunLevel = guest.GetAdditionsRunLevel(); 368 if ( ulGuestAdditionsRunLevel >= AdditionsRunLevelType_System // Desktop 369 #if 1 /* Only Windows is supported at the moment! */ 370 && ( osType.contains("Microsoft", Qt::CaseInsensitive) 371 || osType.contains("Windows", Qt::CaseInsensitive) 372 ) 373 #endif 374 ) 375 { 376 #ifdef DEBUG_andy 377 CProgress progressInstall = guest.UpdateGuestAdditions("c:\\Downloads\\VBoxGuestAdditions_3.2.8.iso"); 378 #else 379 CProgress progressInstall = guest.UpdateGuestAdditions(strSource); 380 #endif 381 #if 0 382 bool fResult = guest.isOk(); 383 if (fResult) 384 { 385 vboxProblem().showModalProgressDialog(progressInstall, tr("Updating Guest Additions ..."), mainMachineWindow()); 386 if (progressInstall.GetCanceled()) 387 return; 388 if (!progressInstall.isOk() || progressInstall.GetResultCode() != 0) 389 { 390 vboxProblem().cannotUpdateGuestAdditions(progressInstall, mainMachineWindow()); 391 return; 392 } 393 } 394 #endif 395 } 396 else /* Fallback to only mounting the .ISO file. */ 397 { 398 #endif /* DEBUG_andy */ 399 QString strUuid; 400 CMedium image = vbox.FindMedium(strSource, KDeviceType_DVD); 401 if (image.isNull()) 402 { 403 image = vbox.OpenMedium(strSource, KDeviceType_DVD, KAccessMode_ReadWrite); 404 if (vbox.isOk()) 405 strUuid = image.GetId(); 406 } 407 else 364 408 strUuid = image.GetId(); 365 } 366 else 367 strUuid = image.GetId(); 368 369 if (!vbox.isOk()) 370 { 371 vboxProblem().cannotOpenMedium(0, vbox, VBoxDefs::MediumType_DVD, strSource); 372 return; 373 } 374 375 AssertMsg(!strUuid.isNull(), ("Guest Additions image UUID should be valid!\n")); 376 377 QString strCntName; 378 LONG iCntPort = -1, iCntDevice = -1; 379 /* Searching for the first suitable slot */ 380 { 381 CStorageControllerVector controllers = machine.GetStorageControllers(); 382 int i = 0; 383 while (i < controllers.size() && strCntName.isNull()) 384 { 385 CStorageController controller = controllers[i]; 386 CMediumAttachmentVector attachments = machine.GetMediumAttachmentsOfController(controller.GetName()); 387 int j = 0; 388 while (j < attachments.size() && strCntName.isNull()) 409 410 if (!vbox.isOk()) 411 { 412 vboxProblem().cannotOpenMedium(0, vbox, VBoxDefs::MediumType_DVD, strSource); 413 return; 414 } 415 416 AssertMsg(!strUuid.isNull(), ("Guest Additions image UUID should be valid!\n")); 417 418 QString strCntName; 419 LONG iCntPort = -1, iCntDevice = -1; 420 /* Searching for the first suitable slot */ 421 { 422 CStorageControllerVector controllers = machine.GetStorageControllers(); 423 int i = 0; 424 while (i < controllers.size() && strCntName.isNull()) 389 425 { 390 CMediumAttachment attachment = attachments[j]; 391 if (attachment.GetType() == KDeviceType_DVD) 426 CStorageController controller = controllers[i]; 427 CMediumAttachmentVector attachments = machine.GetMediumAttachmentsOfController(controller.GetName()); 428 int j = 0; 429 while (j < attachments.size() && strCntName.isNull()) 392 430 { 393 strCntName = controller.GetName(); 394 iCntPort = attachment.GetPort(); 395 iCntDevice = attachment.GetDevice(); 431 CMediumAttachment attachment = attachments[j]; 432 if (attachment.GetType() == KDeviceType_DVD) 433 { 434 strCntName = controller.GetName(); 435 iCntPort = attachment.GetPort(); 436 iCntDevice = attachment.GetDevice(); 437 } 438 ++ j; 396 439 } 397 ++ j;440 ++ i; 398 441 } 399 ++ i; 400 } 401 } 402 403 if (!strCntName.isNull()) 404 { 405 bool fIsMounted = false; 406 407 VBoxMedium vmedium = vboxGlobal().findMedium(strUuid); 408 CMedium medium = vmedium.medium(); // @todo r=dj can this be cached somewhere? 409 410 /* Mount medium to the predefined port/device */ 411 machine.MountMedium(strCntName, iCntPort, iCntDevice, medium, false /* force */); 412 if (machine.isOk()) 413 fIsMounted = true; 442 } 443 444 if (!strCntName.isNull()) 445 { 446 bool fIsMounted = false; 447 448 VBoxMedium vmedium = vboxGlobal().findMedium(strUuid); 449 CMedium medium = vmedium.medium(); // @todo r=dj can this be cached somewhere? 450 451 /* Mount medium to the predefined port/device */ 452 machine.MountMedium(strCntName, iCntPort, iCntDevice, medium, false /* force */); 453 if (machine.isOk()) 454 fIsMounted = true; 455 else 456 { 457 /* Ask for force mounting */ 458 if (vboxProblem().cannotRemountMedium(0, machine, VBoxMedium(image, VBoxDefs::MediumType_DVD), 459 true /* mount? */, true /* retry? */) == QIMessageBox::Ok) 460 { 461 /* Force mount medium to the predefined port/device */ 462 machine.MountMedium(strCntName, iCntPort, iCntDevice, medium, true /* force */); 463 if (machine.isOk()) 464 fIsMounted = true; 465 else 466 vboxProblem().cannotRemountMedium(0, machine, VBoxMedium(image, VBoxDefs::MediumType_DVD), 467 true /* mount? */, false /* retry? */); 468 } 469 } 470 } 414 471 else 415 { 416 /* Ask for force mounting */ 417 if (vboxProblem().cannotRemountMedium(0, machine, VBoxMedium(image, VBoxDefs::MediumType_DVD), 418 true /* mount? */, true /* retry? */) == QIMessageBox::Ok) 419 { 420 /* Force mount medium to the predefined port/device */ 421 machine.MountMedium(strCntName, iCntPort, iCntDevice, medium, true /* force */); 422 if (machine.isOk()) 423 fIsMounted = true; 424 else 425 vboxProblem().cannotRemountMedium(0, machine, VBoxMedium(image, VBoxDefs::MediumType_DVD), 426 true /* mount? */, false /* retry? */); 427 } 428 } 429 } 430 else 431 vboxProblem().cannotMountGuestAdditions(machine.GetName()); 472 vboxProblem().cannotMountGuestAdditions(machine.GetName()); 473 #ifdef DEBUG_andy 474 } 475 #endif /* DEBUG_andy */ 432 476 } 433 477
Note:
See TracChangeset
for help on using the changeset viewer.