Changeset 45233 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Mar 28, 2013 1:40:49 PM (12 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp
r45225 r45233 84 84 } 85 85 86 /**87 * Shows a message box of the given type with the given text and with buttons88 * according to arguments b1, b2 and b3 (in the same way as QMessageBox does89 * it), and returns the user's choice.90 *91 * When all button arguments are zero, a single 'Ok' button is shown.92 *93 * If pcszAutoConfirmId is not null, then the message box will contain a94 * checkbox "Don't show this message again" below the message text and its95 * state will be saved in the global config. When the checkbox is in the96 * checked state, this method doesn't actually show the message box but97 * returns immediately. The return value in this case is the same as if the98 * user has pressed the Enter key or the default button, but with99 * AutoConfirmed bit set (AutoConfirmed alone is returned when no default100 * button is defined in button arguments).101 *102 * @param pParent103 * Parent widget or 0 to use the desktop as the pParent. Also,104 * #mainWindowShown can be used to determine the currently shown VBox105 * main window (Selector or Console).106 * @param type107 * One of values of the Type enum, that defines the message box108 * title and icon.109 * @param strMessage110 * Message text to display (can contain simple Qt-html tags).111 * @param strDetails112 * Detailed message description displayed under the main message text using113 * QTextEdit (that provides rich text support and scrollbars when necessary).114 * If equals to QString::null, no details text box is shown.115 * @param pcszAutoConfirmId116 * ID used to save the auto confirmation state across calls. If null,117 * the auto confirmation feature is turned off (and no checkbox is shown)118 * @param button1119 * First button code or 0, see QIMessageBox for a list of codes.120 * @param button2121 * Second button code or 0, see QIMessageBox for a list of codes.122 * @param button3123 * Third button code or 0, see QIMessageBox for a list of codes.124 * @param strText1125 * Optional custom text for the first button.126 * @param strText2127 * Optional custom text for the second button.128 * @param strText3129 * Optional custom text for the third button.130 *131 * @return132 * code of the button pressed by the user133 */134 86 int UIMessageCenter::message(QWidget *pParent, Type type, const QString &strMessage, 135 87 const QString &strDetails /* = QString::null */, … … 250 202 } 251 203 252 /** @fn message(QWidget *, Type, const QString &, const char *, int, int,253 * int, const QString &, const QString &, const QString &)254 *255 * A shortcut to #message() that doesn't require to specify the details256 * text(QString::null is assumed).257 */258 259 /** @fn messageYesNo(QWidget *, Type, const QString &, const QString &, const char *)260 *261 * A shortcut to #message() that shows 'Yes' and 'No' buttons ('Yes' is the262 * default) and returns true when the user selects Yes.263 */264 265 /** @fn messageYesNo(QWidget *, Type, const QString &, const char *)266 *267 * A shortcut to #messageYesNo() that doesn't require to specify the details268 * text(QString::null is assumed).269 */270 271 204 int UIMessageCenter::messageWithOption(QWidget *pParent, 272 205 Type type, … … 362 295 } 363 296 364 /**365 * Shows a modal progress dialog using a CProgress object passed as an366 * argument to track the progress.367 *368 * @param progress progress object to track369 * @param aTitle title prefix370 * @param pParent pParent widget371 * @param aMinDuration time (ms) that must pass before the dialog appears372 */373 297 bool UIMessageCenter::showModalProgressDialog(CProgress &progress, 374 298 const QString &strTitle, … … 404 328 } 405 329 406 /**407 * Returns what main window (VM selector or main VM window) is now shown, or408 * zero if none of them. Main VM window takes precedence.409 */410 330 QWidget* UIMessageCenter::mainWindowShown() const 411 331 { … … 430 350 } 431 351 432 /**433 * Returns main machine window is now shown, or zero if none of them.434 */435 352 QWidget* UIMessageCenter::mainMachineWindowShown() const 436 353 { … … 447 364 } 448 365 449 /**450 * Returns network access manager window if visible451 * and window returned by mainWindowShown() otherwise.452 */453 366 QWidget* UIMessageCenter::networkManagerOrMainWindowShown() const 454 367 { … … 456 369 } 457 370 458 /**459 * Returns network access manager window if visible460 * and window returned by mainMachineWindowShown() otherwise.461 */462 371 QWidget* UIMessageCenter::networkManagerOrMainMachineWindowShown() const 463 372 { … … 508 417 } 509 418 419 void UIMessageCenter::showBETAWarning() 420 { 421 message 422 (0, Warning, 423 tr("You are running a prerelease version of VirtualBox. " 424 "This version is not suitable for production use.")); 425 } 426 427 void UIMessageCenter::showBEBWarning() 428 { 429 message 430 (0, Warning, 431 tr("You are running an EXPERIMENTAL build of VirtualBox. " 432 "This version is not suitable for production use.")); 433 } 434 435 void UIMessageCenter::cannotRunInSelectorMode() 436 { 437 message(mainWindowShown(), Critical, 438 tr("<p>Cannot run VirtualBox in <i>VM Selector</i> " 439 "mode due to local restrictions.</p>" 440 "<p>The application will now terminate.</p>")); 441 } 442 443 #ifdef RT_OS_LINUX 510 444 void UIMessageCenter::checkForMountedWrongUSB() 511 445 { 512 #ifdef RT_OS_LINUX513 446 QFile file("/proc/mounts"); 514 447 if (file.exists() && file.open(QIODevice::ReadOnly | QIODevice::Text)) … … 531 464 "checkForMountedWrongUSB"); 532 465 } 533 #endif 534 } 535 536 void UIMessageCenter::showBETAWarning() 537 { 538 message 539 (0, Warning, 540 tr("You are running a prerelease version of VirtualBox. " 541 "This version is not suitable for production use.")); 542 } 543 544 void UIMessageCenter::showBEBWarning() 545 { 546 message 547 (0, Warning, 548 tr("You are running an EXPERIMENTAL build of VirtualBox. " 549 "This version is not suitable for production use.")); 466 } 467 #endif /* RT_OS_LINUX */ 468 469 void UIMessageCenter::cannotInitCOM(HRESULT rc) 470 { 471 message(0, Critical, 472 tr("<p>Failed to initialize COM or to find the VirtualBox COM server. " 473 "Most likely, the VirtualBox server is not running " 474 "or failed to start.</p>" 475 "<p>The application will now terminate.</p>"), 476 formatErrorInfo(COMErrorInfo(), rc)); 477 } 478 479 void UIMessageCenter::cannotInitUserHome(const QString &strUserHome) 480 { 481 message(0, Critical, 482 tr("<p>Failed to initialize COM because the VirtualBox global " 483 "configuration directory <b><nobr>%1</nobr></b> is not accessible. " 484 "Please check the permissions of this directory and of its parent " 485 "directory.</p>" 486 "<p>The application will now terminate.</p>").arg(strUserHome), 487 formatErrorInfo(COMErrorInfo())); 488 } 489 490 void UIMessageCenter::cannotCreateVirtualBox(const CVirtualBox &vbox) 491 { 492 message(0, Critical, 493 tr("<p>Failed to create the VirtualBox COM object.</p>" 494 "<p>The application will now terminate.</p>"), 495 formatErrorInfo(vbox)); 550 496 } 551 497 … … 559 505 .arg(strPath)); 560 506 } 561 #endif 507 #endif /* Q_WS_X11 */ 562 508 563 509 void UIMessageCenter::cannotOpenLicenseFile(QWidget *pParent, const QString &strPath) … … 568 514 "Check file permissions.") 569 515 .arg(strPath)); 570 }571 572 void UIMessageCenter::cannotOpenURL(const QString &strUrl)573 {574 message575 (mainWindowShown(), UIMessageCenter::Error,576 tr("Failed to open <tt>%1</tt>. Make sure your desktop environment "577 "can properly handle URLs of this type.")578 .arg(strUrl));579 516 } 580 517 … … 604 541 } 605 542 606 void UIMessageCenter::cannotInitCOM(HRESULT rc)607 {608 message(0, Critical,609 tr("<p>Failed to initialize COM or to find the VirtualBox COM server. "610 "Most likely, the VirtualBox server is not running "611 "or failed to start.</p>"612 "<p>The application will now terminate.</p>"),613 formatErrorInfo(COMErrorInfo(), rc));614 }615 616 void UIMessageCenter::cannotInitUserHome(const QString &strUserHome)617 {618 message(0, Critical,619 tr("<p>Failed to initialize COM because the VirtualBox global "620 "configuration directory <b><nobr>%1</nobr></b> is not accessible. "621 "Please check the permissions of this directory and of its parent "622 "directory.</p>"623 "<p>The application will now terminate.</p>").arg(strUserHome),624 formatErrorInfo(COMErrorInfo()));625 }626 627 void UIMessageCenter::cannotCreateVirtualBox(const CVirtualBox &vbox)628 {629 message(0, Critical,630 tr("<p>Failed to create the VirtualBox COM object.</p>"631 "<p>The application will now terminate.</p>"),632 formatErrorInfo(vbox));633 }634 635 543 void UIMessageCenter::cannotLoadGlobalConfig(const CVirtualBox &vbox, const QString &strError) 636 544 { … … 667 575 } 668 576 669 void UIMessageCenter::cannotAccessUSB(const COMBaseWithEI &object)670 {671 /* If IMachine::GetUSBController(), IHost::GetUSBDevices() etc. return672 * E_NOTIMPL, it means the USB support is intentionally missing673 * (as in the OSE version). Don't show the error message in this case. */674 COMResult res(object);675 if (res.rc() == E_NOTIMPL)676 return;677 678 message(mainWindowShown(), res.isWarning() ? Warning : Error,679 tr("Failed to access the USB subsystem."),680 formatErrorInfo(res),681 "cannotAccessUSB");682 }683 684 void UIMessageCenter::cannotCreateMachine(const CVirtualBox &vbox, QWidget *pParent /* = 0 */)685 {686 message(687 pParent ? pParent : mainWindowShown(),688 Error,689 tr("Failed to create a new virtual machine."),690 formatErrorInfo(vbox)691 );692 }693 694 void UIMessageCenter::cannotCreateMachine(const CVirtualBox &vbox,695 const CMachine &machine,696 QWidget *pParent /* = 0 */)697 {698 message(699 pParent ? pParent : mainWindowShown(),700 Error,701 tr("Failed to create a new virtual machine <b>%1</b>.")702 .arg(machine.GetName()),703 formatErrorInfo(vbox)704 );705 }706 707 void UIMessageCenter::cannotOpenMachine(QWidget *pParent, const QString &strMachinePath, const CVirtualBox &vbox)708 {709 message(pParent ? pParent : mainWindowShown(),710 Error,711 tr("Failed to open virtual machine located in %1.")712 .arg(strMachinePath),713 formatErrorInfo(vbox));714 }715 716 void UIMessageCenter::cannotRegisterMachine(const CVirtualBox &vbox,717 const CMachine &machine,718 QWidget *pParent)719 {720 message(pParent ? pParent : mainWindowShown(),721 Error,722 tr("Failed to register the virtual machine <b>%1</b>.")723 .arg(machine.GetName()),724 formatErrorInfo(vbox));725 }726 727 void UIMessageCenter::cannotReregisterMachine(QWidget *pParent, const QString &strMachinePath, const QString &strMachineName)728 {729 message(pParent ? pParent : mainWindowShown(),730 Error,731 tr("Failed to add virtual machine <b>%1</b> located in <i>%2</i> because its already present.")732 .arg(strMachineName).arg(strMachinePath));733 }734 735 void UIMessageCenter::cannotApplyMachineSettings(const CMachine &machine, const COMResult &res)736 {737 message(738 mainWindowShown(),739 Error,740 tr("Failed to apply the settings to the virtual machine <b>%1</b>.")741 .arg(machine.GetName()),742 formatErrorInfo(res)743 );744 }745 746 void UIMessageCenter::cannotSaveMachineSettings(const CMachine &machine, QWidget *pParent /* = 0 */)747 {748 /* preserve the current error info before calling the object again */749 COMResult res(machine);750 751 message(pParent ? pParent : mainWindowShown(), Error,752 tr("Failed to save the settings of the virtual machine "753 "<b>%1</b> to <b><nobr>%2</nobr></b>.")754 .arg(machine.GetName(), machine.GetSettingsFilePath()),755 formatErrorInfo(res));756 }757 758 /**759 * @param fStrict If |false|, this method will silently return if the COM760 * result code is E_NOTIMPL.761 */762 void UIMessageCenter::cannotLoadMachineSettings(const CMachine &machine,763 bool fStrict /* = true */,764 QWidget *pParent /* = 0 */)765 {766 /* If COM result code is E_NOTIMPL, it means the requested object or767 * function is intentionally missing (as in the OSE version). Don't show768 * the error message in this case. */769 COMResult res(machine);770 if (!fStrict && res.rc() == E_NOTIMPL)771 return;772 773 message(pParent ? pParent : mainWindowShown(), Error,774 tr("Failed to load the settings of the virtual machine "775 "<b>%1</b> from <b><nobr>%2</nobr></b>.")776 .arg(machine.GetName(), machine.GetSettingsFilePath()),777 formatErrorInfo(res));778 }779 780 bool UIMessageCenter::confirmedSettingsReloading(QWidget *pParent)781 {782 int rc = message(pParent, Question,783 tr("<p>The machine settings were changed while you were editing them. "784 "You currently have unsaved setting changes.</p>"785 "<p>Would you like to reload the changed settings or to keep your own changes?</p>"), 0,786 QIMessageBox::Yes, QIMessageBox::No | QIMessageBox::Default | QIMessageBox::Escape, 0,787 tr("Reload settings"), tr("Keep changes"), 0);788 return rc == QIMessageBox::Yes;789 }790 791 void UIMessageCenter::warnAboutStateChange(QWidget *pParent)792 {793 if (warningShown("warnAboutStateChange"))794 return;795 setWarningShown("warnAboutStateChange", true);796 797 message(pParent ? pParent : mainWindowShown(), Warning,798 tr("The virtual machine that you are changing has been started. "799 "Only certain settings can be changed while a machine is running. "800 "All other changes will be lost if you close this window now."));801 802 setWarningShown("warnAboutStateChange", false);803 }804 805 void UIMessageCenter::cannotStartMachine(const CConsole &console)806 {807 /* preserve the current error info before calling the object again */808 COMResult res(console);809 810 message(mainWindowShown(), Error,811 tr("Failed to start the virtual machine <b>%1</b>.")812 .arg(console.GetMachine().GetName()),813 formatErrorInfo(res));814 }815 816 void UIMessageCenter::cannotStartMachine(const CProgress &progress)817 {818 AssertWrapperOk(progress);819 CConsole console(CProgress(progress).GetInitiator());820 AssertWrapperOk(console);821 822 message(823 mainWindowShown(),824 Error,825 tr("Failed to start the virtual machine <b>%1</b>.")826 .arg(console.GetMachine().GetName()),827 formatErrorInfo(progress.GetErrorInfo())828 );829 }830 831 void UIMessageCenter::cannotPauseMachine(const CConsole &console)832 {833 /* preserve the current error info before calling the object again */834 COMResult res(console);835 836 message(mainWindowShown(), Error,837 tr("Failed to pause the execution of the virtual machine <b>%1</b>.")838 .arg(console.GetMachine().GetName()),839 formatErrorInfo(res));840 }841 842 void UIMessageCenter::cannotResumeMachine(const CConsole &console)843 {844 /* preserve the current error info before calling the object again */845 COMResult res(console);846 847 message(mainWindowShown(), Error,848 tr("Failed to resume the execution of the virtual machine <b>%1</b>.")849 .arg(console.GetMachine().GetName()),850 formatErrorInfo(res));851 }852 853 void UIMessageCenter::cannotACPIShutdownMachine(const CConsole &console)854 {855 /* preserve the current error info before calling the object again */856 COMResult res(console);857 858 message(mainWindowShown(), Error,859 tr("Failed to send the ACPI Power Button press event to the "860 "virtual machine <b>%1</b>.")861 .arg(console.GetMachine().GetName()),862 formatErrorInfo(res));863 }864 865 void UIMessageCenter::cannotSaveMachineState(const CConsole &console)866 {867 /* preserve the current error info before calling the object again */868 COMResult res(console);869 870 message(mainWindowShown(), Error,871 tr("Failed to save the state of the virtual machine <b>%1</b>.")872 .arg(console.GetMachine().GetName()),873 formatErrorInfo(res));874 }875 876 void UIMessageCenter::cannotSaveMachineState(const CProgress &progress)877 {878 AssertWrapperOk(progress);879 CConsole console(CProgress(progress).GetInitiator());880 AssertWrapperOk(console);881 882 message(883 mainWindowShown(),884 Error,885 tr("Failed to save the state of the virtual machine <b>%1</b>.")886 .arg(console.GetMachine().GetName()),887 formatErrorInfo(progress.GetErrorInfo())888 );889 }890 891 void UIMessageCenter::cannotCreateClone(const CMachine &machine,892 QWidget *pParent /* = 0 */)893 {894 message(895 pParent ? pParent : mainWindowShown(),896 Error,897 tr("Failed to clone the virtual machine <b>%1</b>.")898 .arg(machine.GetName()),899 formatErrorInfo(machine)900 );901 }902 903 void UIMessageCenter::cannotCreateClone(const CMachine &machine,904 const CProgress &progress,905 QWidget *pParent /* = 0 */)906 {907 AssertWrapperOk(progress);908 909 message(pParent ? pParent : mainWindowShown(),910 Error,911 tr("Failed to clone the virtual machine <b>%1</b>.")912 .arg(machine.GetName()),913 formatErrorInfo(progress.GetErrorInfo())914 );915 }916 917 void UIMessageCenter::cannotTakeSnapshot(const CConsole &console)918 {919 /* preserve the current error info before calling the object again */920 COMResult res(console);921 922 message(mainWindowShown(), Error,923 tr("Failed to create a snapshot of the virtual machine <b>%1</b>.")924 .arg(console.GetMachine().GetName()),925 formatErrorInfo(res));926 }927 928 void UIMessageCenter::cannotTakeSnapshot(const CProgress &progress)929 {930 AssertWrapperOk(progress);931 CConsole console(CProgress(progress).GetInitiator());932 AssertWrapperOk(console);933 934 message(935 mainWindowShown(),936 Error,937 tr("Failed to create a snapshot of the virtual machine <b>%1</b>.")938 .arg(console.GetMachine().GetName()),939 formatErrorInfo(progress.GetErrorInfo())940 );941 }942 943 void UIMessageCenter::cannotStopMachine(const CConsole &console)944 {945 /* preserve the current error info before calling the object again */946 COMResult res(console);947 948 message(mainWindowShown(), Error,949 tr("Failed to stop the virtual machine <b>%1</b>.")950 .arg(console.GetMachine().GetName()),951 formatErrorInfo(res));952 }953 954 void UIMessageCenter::cannotStopMachine(const CProgress &progress)955 {956 AssertWrapperOk(progress);957 CConsole console(CProgress(progress).GetInitiator());958 AssertWrapperOk(console);959 960 message(mainWindowShown(), Error,961 tr("Failed to stop the virtual machine <b>%1</b>.")962 .arg(console.GetMachine().GetName()),963 formatErrorInfo(progress.GetErrorInfo()));964 }965 966 void UIMessageCenter::cannotDeleteMachine(const CMachine &machine)967 {968 /* preserve the current error info before calling the object again */969 COMResult res(machine);970 971 message(mainWindowShown(),972 Error,973 tr("Failed to remove the virtual machine <b>%1</b>.").arg(machine.GetName()),974 !machine.isOk() ? formatErrorInfo(machine) : formatErrorInfo(res));975 }976 977 void UIMessageCenter::cannotDeleteMachine(const CMachine &machine, const CProgress &progress)978 {979 message(mainWindowShown(),980 Error,981 tr("Failed to remove the virtual machine <b>%1</b>.").arg(machine.GetName()),982 formatErrorInfo(progress.GetErrorInfo()));983 }984 985 void UIMessageCenter::cannotDiscardSavedState(const CConsole &console)986 {987 /* preserve the current error info before calling the object again */988 COMResult res(console);989 990 message(mainWindowShown(), Error,991 tr("Failed to discard the saved state of the virtual machine <b>%1</b>.")992 .arg(console.GetMachine().GetName()),993 formatErrorInfo(res));994 }995 996 void UIMessageCenter::cannotSendACPIToMachine()997 {998 message(mainWindowShown(), Warning,999 tr("You are trying to shut down the guest with the ACPI power "1000 "button. This is currently not possible because the guest "1001 "does not support software shutdown."));1002 }1003 1004 bool UIMessageCenter::warnAboutVirtNotEnabled64BitsGuest(bool fHWVirtExSupported)1005 {1006 if (fHWVirtExSupported)1007 return messageOkCancel(mainWindowShown(), Error,1008 tr("<p>VT-x/AMD-V hardware acceleration has been enabled, but is "1009 "not operational. Your 64-bit guest will fail to detect a "1010 "64-bit CPU and will not be able to boot.</p><p>Please ensure "1011 "that you have enabled VT-x/AMD-V properly in the BIOS of your "1012 "host computer.</p>"),1013 0 /* pcszAutoConfirmId */,1014 tr("Close VM"), tr("Continue"));1015 else1016 return messageOkCancel(mainWindowShown(), Error,1017 tr("<p>VT-x/AMD-V hardware acceleration is not available on your system. "1018 "Your 64-bit guest will fail to detect a 64-bit CPU and will "1019 "not be able to boot."),1020 0 /* pcszAutoConfirmId */,1021 tr("Close VM"), tr("Continue"));1022 }1023 1024 bool UIMessageCenter::warnAboutVirtNotEnabledGuestRequired(bool fHWVirtExSupported)1025 {1026 if (fHWVirtExSupported)1027 return messageOkCancel(mainWindowShown(), Error,1028 tr("<p>VT-x/AMD-V hardware acceleration has been enabled, but is "1029 "not operational. Certain guests (e.g. OS/2 and QNX) require "1030 "this feature.</p><p>Please ensure "1031 "that you have enabled VT-x/AMD-V properly in the BIOS of your "1032 "host computer.</p>"),1033 0 /* pcszAutoConfirmId */,1034 tr("Close VM"), tr("Continue"));1035 else1036 return messageOkCancel(mainWindowShown(), Error,1037 tr("<p>VT-x/AMD-V hardware acceleration is not available on your system. "1038 "Certain guests (e.g. OS/2 and QNX) require this feature and will "1039 "fail to boot without it.</p>"),1040 0 /* pcszAutoConfirmId */,1041 tr("Close VM"), tr("Continue"));1042 }1043 1044 int UIMessageCenter::askAboutSnapshotRestoring(const QString &strSnapshotName, bool fAlsoCreateNewSnapshot)1045 {1046 return fAlsoCreateNewSnapshot ?1047 messageWithOption(mainWindowShown(), Question,1048 tr("<p>You are about to restore snapshot <nobr><b>%1</b></nobr>.</p>"1049 "<p>You can create a snapshot of the current state of the virtual machine first by checking the box below; "1050 "if you do not do this the current state will be permanently lost. Do you wish to proceed?</p>")1051 .arg(strSnapshotName),1052 tr("Create a snapshot of the current machine state"),1053 !vboxGlobal().virtualBox().GetExtraDataStringList(GUI_InvertMessageOption).contains("askAboutSnapshotRestoring"),1054 QString::null /* details */,1055 QIMessageBox::Ok | QIMessageBox::Default,1056 QIMessageBox::Cancel | QIMessageBox::Escape,1057 0 /* 3rd button */,1058 tr("Restore"), tr("Cancel"), QString::null /* 3rd button text */) :1059 message(mainWindowShown(), Question,1060 tr("<p>Are you sure you want to restore snapshot <nobr><b>%1</b></nobr>?</p>").arg(strSnapshotName),1061 0 /* auto-confirmation token */,1062 QIMessageBox::Ok | QIMessageBox::Default,1063 QIMessageBox::Cancel | QIMessageBox::Escape,1064 0 /* 3rd button */,1065 tr("Restore"), tr("Cancel"), QString::null /* 3rd button text */);1066 }1067 1068 bool UIMessageCenter::askAboutSnapshotDeleting(const QString &strSnapshotName)1069 {1070 return messageOkCancel(mainWindowShown(), Question,1071 tr("<p>Deleting the snapshot will cause the state information saved in it to be lost, and disk data spread over "1072 "several image files that VirtualBox has created together with the snapshot will be merged into one file. This can be a lengthy process, and the information "1073 "in the snapshot cannot be recovered.</p></p>Are you sure you want to delete the selected snapshot <b>%1</b>?</p>")1074 .arg(strSnapshotName),1075 /* Do NOT allow this message to be disabled! */1076 NULL /* pcszAutoConfirmId */,1077 tr("Delete"), tr("Cancel"));1078 }1079 1080 bool UIMessageCenter::askAboutSnapshotDeletingFreeSpace(const QString &strSnapshotName,1081 const QString &strTargetImageName,1082 const QString &strTargetImageMaxSize,1083 const QString &strTargetFileSystemFree)1084 {1085 return messageOkCancel(mainWindowShown(), Question,1086 tr("<p>Deleting the snapshot %1 will temporarily need more disk space. In the worst case the size of image %2 will grow by %3, "1087 "however on this filesystem there is only %4 free.</p><p>Running out of disk space during the merge operation can result in "1088 "corruption of the image and the VM configuration, i.e. loss of the VM and its data.</p><p>You may continue with deleting "1089 "the snapshot at your own risk.</p>")1090 .arg(strSnapshotName)1091 .arg(strTargetImageName)1092 .arg(strTargetImageMaxSize)1093 .arg(strTargetFileSystemFree),1094 /* Do NOT allow this message to be disabled! */1095 NULL /* pcszAutoConfirmId */,1096 tr("Delete"), tr("Cancel"));1097 }1098 1099 void UIMessageCenter::cannotRestoreSnapshot(const CConsole &console,1100 const QString &strSnapshotName)1101 {1102 message(mainWindowShown(), Error,1103 tr("Failed to restore the snapshot <b>%1</b> of the virtual machine <b>%2</b>.")1104 .arg(strSnapshotName)1105 .arg(CConsole(console).GetMachine().GetName()),1106 formatErrorInfo(console));1107 }1108 1109 void UIMessageCenter::cannotRestoreSnapshot(const CProgress &progress,1110 const QString &strSnapshotName)1111 {1112 CConsole console(CProgress(progress).GetInitiator());1113 1114 message(mainWindowShown(), Error,1115 tr("Failed to restore the snapshot <b>%1</b> of the virtual machine <b>%2</b>.")1116 .arg(strSnapshotName)1117 .arg(console.GetMachine().GetName()),1118 formatErrorInfo(progress.GetErrorInfo()));1119 }1120 1121 void UIMessageCenter::cannotDeleteSnapshot(const CConsole &console,1122 const QString &strSnapshotName)1123 {1124 message(mainWindowShown(), Error,1125 tr("Failed to delete the snapshot <b>%1</b> of the virtual machine <b>%2</b>.")1126 .arg(strSnapshotName)1127 .arg(CConsole(console).GetMachine().GetName()),1128 formatErrorInfo(console));1129 }1130 1131 void UIMessageCenter::cannotDeleteSnapshot(const CProgress &progress,1132 const QString &strSnapshotName)1133 {1134 CConsole console(CProgress(progress).GetInitiator());1135 1136 message(mainWindowShown(), Error,1137 tr("Failed to delete the snapshot <b>%1</b> of the virtual machine <b>%2</b>.")1138 .arg(strSnapshotName)1139 .arg(console.GetMachine().GetName()),1140 formatErrorInfo(progress.GetErrorInfo()));1141 }1142 1143 void UIMessageCenter::cannotFindSnapshotByName(QWidget *pParent,1144 const CMachine &machine,1145 const QString &strName) const1146 {1147 message(pParent ? pParent : mainWindowShown(), Error,1148 tr("Can't find snapshot named <b>%1</b>.")1149 .arg(strName),1150 formatErrorInfo(machine)1151 );1152 }1153 1154 577 void UIMessageCenter::cannotFindMachineByName(const CVirtualBox &vbox, 1155 578 const QString &name) … … 1164 587 } 1165 588 1166 void UIMessageCenter::cannotEnterSeamlessMode(ULONG /* uWidth */, 1167 ULONG /* uHeight */, 1168 ULONG /* uBpp */, 1169 ULONG64 uMinVRAM) 1170 { 1171 message(mainMachineWindowShown(), Error, 1172 tr("<p>Could not enter seamless mode due to insufficient guest " 1173 "video memory.</p>" 1174 "<p>You should configure the virtual machine to have at " 1175 "least <b>%1</b> of video memory.</p>") 1176 .arg(VBoxGlobal::formatSize(uMinVRAM))); 1177 } 1178 1179 int UIMessageCenter::cannotEnterFullscreenMode(ULONG /* uWidth */, 1180 ULONG /* uHeight */, 1181 ULONG /* uBpp */, 1182 ULONG64 uMinVRAM) 1183 { 1184 return message(mainMachineWindowShown(), Warning, 1185 tr("<p>Could not switch the guest display to fullscreen mode due " 1186 "to insufficient guest video memory.</p>" 1187 "<p>You should configure the virtual machine to have at " 1188 "least <b>%1</b> of video memory.</p>" 1189 "<p>Press <b>Ignore</b> to switch to fullscreen mode anyway " 1190 "or press <b>Cancel</b> to cancel the operation.</p>") 1191 .arg(VBoxGlobal::formatSize(uMinVRAM)), 1192 0, /* pcszAutoConfirmId */ 1193 QIMessageBox::Ignore | QIMessageBox::Default, 1194 QIMessageBox::Cancel | QIMessageBox::Escape); 1195 } 1196 1197 bool UIMessageCenter::cannotStartWithoutNetworkIf(const QString &strMachineName, 1198 const QString &strIfNames) 1199 { 1200 return messageOkCancel(mainMachineWindowShown(), Error, 1201 tr("<p>Could not start the machine <b>%1</b> because the " 1202 "following physical network interfaces were not found:</p>" 1203 "<p><b>%2</b></p>" 1204 "<p>You can either change the machine's network " 1205 "settings or stop the machine.</p>") 1206 .arg(strMachineName) 1207 .arg(strIfNames), 1208 0, /* pcszAutoConfirmId */ 1209 tr("Change Network Settings"), 1210 tr("Close Virtual Machine")); 1211 } 1212 1213 void UIMessageCenter::cannotSwitchScreenInSeamless(quint64 uMinVRAM) 1214 { 1215 message(mainMachineWindowShown(), Error, 1216 tr("<p>Could not change the guest screen to this host screen " 1217 "due to insufficient guest video memory.</p>" 1218 "<p>You should configure the virtual machine to have at " 1219 "least <b>%1</b> of video memory.</p>") 1220 .arg(VBoxGlobal::formatSize(uMinVRAM))); 1221 } 1222 1223 int UIMessageCenter::cannotSwitchScreenInFullscreen(quint64 uMinVRAM) 1224 { 1225 return message(mainMachineWindowShown(), Warning, 1226 tr("<p>Could not change the guest screen to this host screen " 1227 "due to insufficient guest video memory.</p>" 1228 "<p>You should configure the virtual machine to have at " 1229 "least <b>%1</b> of video memory.</p>" 1230 "<p>Press <b>Ignore</b> to switch the screen anyway " 1231 "or press <b>Cancel</b> to cancel the operation.</p>") 1232 .arg(VBoxGlobal::formatSize(uMinVRAM)), 1233 0, /* pcszAutoConfirmId */ 1234 QIMessageBox::Ignore | QIMessageBox::Default, 1235 QIMessageBox::Cancel | QIMessageBox::Escape); 1236 } 1237 1238 int UIMessageCenter::cannotEnterFullscreenMode() 1239 { 1240 return message(mainMachineWindowShown(), Error, 1241 tr("<p>Can not switch the guest display to fullscreen mode. You " 1242 "have more virtual screens configured than physical screens are " 1243 "attached to your host.</p><p>Please either lower the virtual " 1244 "screens in your VM configuration or attach additional screens " 1245 "to your host.</p>"), 1246 0, /* pcszAutoConfirmId */ 1247 QIMessageBox::Ok | QIMessageBox::Default); 1248 } 1249 1250 int UIMessageCenter::cannotEnterSeamlessMode() 1251 { 1252 return message(mainMachineWindowShown(), Error, 1253 tr("<p>Can not switch the guest display to seamless mode. You " 1254 "have more virtual screens configured than physical screens are " 1255 "attached to your host.</p><p>Please either lower the virtual " 1256 "screens in your VM configuration or attach additional screens " 1257 "to your host.</p>"), 1258 0, /* pcszAutoConfirmId */ 1259 QIMessageBox::Ok | QIMessageBox::Default); 589 void UIMessageCenter::cannotOpenSession(const CSession &session) 590 { 591 Assert(session.isNull()); 592 593 message( 594 mainWindowShown(), 595 Error, 596 tr("Failed to create a new session."), 597 formatErrorInfo(session) 598 ); 599 } 600 601 void UIMessageCenter::cannotOpenSession(const CVirtualBox &vbox, 602 const CMachine &machine, 603 const CProgress &progress) 604 { 605 Assert(!vbox.isOk() || progress.isOk()); 606 607 QString name = machine.GetName(); 608 if (name.isEmpty()) 609 name = QFileInfo(machine.GetSettingsFilePath()).baseName(); 610 611 message( 612 mainWindowShown(), 613 Error, 614 tr("Failed to open a session for the virtual machine <b>%1</b>.") 615 .arg(name), 616 !vbox.isOk() ? formatErrorInfo(vbox) : 617 formatErrorInfo(progress.GetErrorInfo()) 618 ); 619 } 620 621 void UIMessageCenter::cannotOpenSession(const CMachine &machine) 622 { 623 COMResult res(machine); 624 QString name = machine.GetName(); 625 if (name.isEmpty()) 626 name = QFileInfo(machine.GetSettingsFilePath()).baseName(); 627 628 message(mainWindowShown(), Error, 629 tr("Failed to open a session for the virtual machine <b>%1</b>.").arg(name), 630 formatErrorInfo(res)); 631 } 632 633 void UIMessageCenter::cannotGetMediaAccessibility(const UIMedium &aMedium) 634 { 635 message(qApp->activeWindow(), Error, 636 tr("Failed to determine the accessibility state of the medium " 637 "<nobr><b>%1</b></nobr>.") 638 .arg(aMedium.location()), 639 formatErrorInfo(aMedium.result())); 640 } 641 642 void UIMessageCenter::cannotOpenURL(const QString &strUrl) 643 { 644 message 645 (mainWindowShown(), UIMessageCenter::Error, 646 tr("Failed to open <tt>%1</tt>. Make sure your desktop environment " 647 "can properly handle URLs of this type.") 648 .arg(strUrl)); 649 } 650 651 void UIMessageCenter::cannotOpenMachine(QWidget *pParent, const QString &strMachinePath, const CVirtualBox &vbox) 652 { 653 message(pParent ? pParent : mainWindowShown(), 654 Error, 655 tr("Failed to open virtual machine located in %1.") 656 .arg(strMachinePath), 657 formatErrorInfo(vbox)); 658 } 659 660 void UIMessageCenter::cannotReregisterMachine(QWidget *pParent, const QString &strMachinePath, const QString &strMachineName) 661 { 662 message(pParent ? pParent : mainWindowShown(), 663 Error, 664 tr("Failed to add virtual machine <b>%1</b> located in <i>%2</i> because its already present.") 665 .arg(strMachineName).arg(strMachinePath)); 666 } 667 668 void UIMessageCenter::cannotDeleteMachine(const CMachine &machine) 669 { 670 /* preserve the current error info before calling the object again */ 671 COMResult res(machine); 672 673 message(mainWindowShown(), 674 Error, 675 tr("Failed to remove the virtual machine <b>%1</b>.").arg(machine.GetName()), 676 !machine.isOk() ? formatErrorInfo(machine) : formatErrorInfo(res)); 677 } 678 679 void UIMessageCenter::cannotDeleteMachine(const CMachine &machine, const CProgress &progress) 680 { 681 message(mainWindowShown(), 682 Error, 683 tr("Failed to remove the virtual machine <b>%1</b>.").arg(machine.GetName()), 684 formatErrorInfo(progress.GetErrorInfo())); 685 } 686 687 void UIMessageCenter::cannotDiscardSavedState(const CConsole &console) 688 { 689 /* preserve the current error info before calling the object again */ 690 COMResult res(console); 691 692 message(mainWindowShown(), Error, 693 tr("Failed to discard the saved state of the virtual machine <b>%1</b>.") 694 .arg(console.GetMachine().GetName()), 695 formatErrorInfo(res)); 1260 696 } 1261 697 … … 1414 850 } 1415 851 852 bool UIMessageCenter::remindAboutInaccessibleMedia() 853 { 854 int rc = message(&vboxGlobal().selectorWnd(), Warning, 855 tr("<p>One or more virtual hard disks, CD/DVD or " 856 "floppy media are not currently accessible. As a result, you will " 857 "not be able to operate virtual machines that use these media until " 858 "they become accessible later.</p>" 859 "<p>Press <b>Check</b> to open the Virtual Media Manager window and " 860 "see what media are inaccessible, or press <b>Ignore</b> to " 861 "ignore this message.</p>"), 862 "remindAboutInaccessibleMedia", 863 QIMessageBox::Ok | QIMessageBox::Default, 864 QIMessageBox::Ignore | QIMessageBox::Escape, 865 0, 866 tr("Check", "inaccessible media message box")); 867 868 return rc == QIMessageBox::Ok; /* implies !AutoConfirmed */ 869 } 870 871 bool UIMessageCenter::confirmVMReset(const QString &strNames) 872 { 873 return messageOkCancel(mainMachineWindowShown(), Question, 874 tr("<p>Do you really want to reset the following virtual machines?</p>" 875 "<p><b>%1</b></p><p>This will cause any unsaved data " 876 "in applications running inside it to be lost.</p>") 877 .arg(strNames), 878 "confirmVMReset" /* pcszAutoConfirmId */, 879 tr("Reset", "machine")); 880 } 881 882 bool UIMessageCenter::confirmVMACPIShutdown(const QString &strNames) 883 { 884 return messageOkCancel(mainMachineWindowShown(), Question, 885 tr("<p>Do you really want to send an ACPI shutdown signal " 886 "to the following virtual machines?</p><p><b>%1</b></p>") 887 .arg(strNames), 888 "confirmVMACPIShutdown" /* pcszAutoConfirmId */, 889 tr("ACPI Shutdown", "machine")); 890 } 891 892 bool UIMessageCenter::confirmVMPowerOff(const QString &strNames) 893 { 894 return messageOkCancel(mainMachineWindowShown(), Question, 895 tr("<p>Do you really want to power off the following virtual machines?</p>" 896 "<p><b>%1</b></p><p>This will cause any unsaved data in applications " 897 "running inside it to be lost.</p>") 898 .arg(strNames), 899 "confirmVMPowerOff" /* pcszAutoConfirmId */, 900 tr("Power Off", "machine")); 901 } 902 903 int UIMessageCenter::askAboutSnapshotRestoring(const QString &strSnapshotName, bool fAlsoCreateNewSnapshot) 904 { 905 return fAlsoCreateNewSnapshot ? 906 messageWithOption(mainWindowShown(), Question, 907 tr("<p>You are about to restore snapshot <nobr><b>%1</b></nobr>.</p>" 908 "<p>You can create a snapshot of the current state of the virtual machine first by checking the box below; " 909 "if you do not do this the current state will be permanently lost. Do you wish to proceed?</p>") 910 .arg(strSnapshotName), 911 tr("Create a snapshot of the current machine state"), 912 !vboxGlobal().virtualBox().GetExtraDataStringList(GUI_InvertMessageOption).contains("askAboutSnapshotRestoring"), 913 QString::null /* details */, 914 QIMessageBox::Ok | QIMessageBox::Default, 915 QIMessageBox::Cancel | QIMessageBox::Escape, 916 0 /* 3rd button */, 917 tr("Restore"), tr("Cancel"), QString::null /* 3rd button text */) : 918 message(mainWindowShown(), Question, 919 tr("<p>Are you sure you want to restore snapshot <nobr><b>%1</b></nobr>?</p>").arg(strSnapshotName), 920 0 /* auto-confirmation token */, 921 QIMessageBox::Ok | QIMessageBox::Default, 922 QIMessageBox::Cancel | QIMessageBox::Escape, 923 0 /* 3rd button */, 924 tr("Restore"), tr("Cancel"), QString::null /* 3rd button text */); 925 } 926 927 bool UIMessageCenter::askAboutSnapshotDeleting(const QString &strSnapshotName) 928 { 929 return messageOkCancel(mainWindowShown(), Question, 930 tr("<p>Deleting the snapshot will cause the state information saved in it to be lost, and disk data spread over " 931 "several image files that VirtualBox has created together with the snapshot will be merged into one file. This can be a lengthy process, and the information " 932 "in the snapshot cannot be recovered.</p></p>Are you sure you want to delete the selected snapshot <b>%1</b>?</p>") 933 .arg(strSnapshotName), 934 /* Do NOT allow this message to be disabled! */ 935 NULL /* pcszAutoConfirmId */, 936 tr("Delete"), tr("Cancel")); 937 } 938 939 bool UIMessageCenter::askAboutSnapshotDeletingFreeSpace(const QString &strSnapshotName, 940 const QString &strTargetImageName, 941 const QString &strTargetImageMaxSize, 942 const QString &strTargetFileSystemFree) 943 { 944 return messageOkCancel(mainWindowShown(), Question, 945 tr("<p>Deleting the snapshot %1 will temporarily need more disk space. In the worst case the size of image %2 will grow by %3, " 946 "however on this filesystem there is only %4 free.</p><p>Running out of disk space during the merge operation can result in " 947 "corruption of the image and the VM configuration, i.e. loss of the VM and its data.</p><p>You may continue with deleting " 948 "the snapshot at your own risk.</p>") 949 .arg(strSnapshotName) 950 .arg(strTargetImageName) 951 .arg(strTargetImageMaxSize) 952 .arg(strTargetFileSystemFree), 953 /* Do NOT allow this message to be disabled! */ 954 NULL /* pcszAutoConfirmId */, 955 tr("Delete"), tr("Cancel")); 956 } 957 958 void UIMessageCenter::cannotRestoreSnapshot(const CConsole &console, 959 const QString &strSnapshotName) 960 { 961 message(mainWindowShown(), Error, 962 tr("Failed to restore the snapshot <b>%1</b> of the virtual machine <b>%2</b>.") 963 .arg(strSnapshotName) 964 .arg(CConsole(console).GetMachine().GetName()), 965 formatErrorInfo(console)); 966 } 967 968 void UIMessageCenter::cannotRestoreSnapshot(const CProgress &progress, 969 const QString &strSnapshotName) 970 { 971 CConsole console(CProgress(progress).GetInitiator()); 972 973 message(mainWindowShown(), Error, 974 tr("Failed to restore the snapshot <b>%1</b> of the virtual machine <b>%2</b>.") 975 .arg(strSnapshotName) 976 .arg(console.GetMachine().GetName()), 977 formatErrorInfo(progress.GetErrorInfo())); 978 } 979 980 void UIMessageCenter::cannotDeleteSnapshot(const CConsole &console, 981 const QString &strSnapshotName) 982 { 983 message(mainWindowShown(), Error, 984 tr("Failed to delete the snapshot <b>%1</b> of the virtual machine <b>%2</b>.") 985 .arg(strSnapshotName) 986 .arg(CConsole(console).GetMachine().GetName()), 987 formatErrorInfo(console)); 988 } 989 990 void UIMessageCenter::cannotDeleteSnapshot(const CProgress &progress, 991 const QString &strSnapshotName) 992 { 993 CConsole console(CProgress(progress).GetInitiator()); 994 995 message(mainWindowShown(), Error, 996 tr("Failed to delete the snapshot <b>%1</b> of the virtual machine <b>%2</b>.") 997 .arg(strSnapshotName) 998 .arg(console.GetMachine().GetName()), 999 formatErrorInfo(progress.GetErrorInfo())); 1000 } 1001 1002 void UIMessageCenter::cannotFindSnapshotByName(QWidget *pParent, 1003 const CMachine &machine, 1004 const QString &strName) const 1005 { 1006 message(pParent ? pParent : mainWindowShown(), Error, 1007 tr("Can't find snapshot named <b>%1</b>.") 1008 .arg(strName), 1009 formatErrorInfo(machine) 1010 ); 1011 } 1012 1013 void UIMessageCenter::cannotAccessUSB(const COMBaseWithEI &object) 1014 { 1015 /* If IMachine::GetUSBController(), IHost::GetUSBDevices() etc. return 1016 * E_NOTIMPL, it means the USB support is intentionally missing 1017 * (as in the OSE version). Don't show the error message in this case. */ 1018 COMResult res(object); 1019 if (res.rc() == E_NOTIMPL) 1020 return; 1021 1022 message(mainWindowShown(), res.isWarning() ? Warning : Error, 1023 tr("Failed to access the USB subsystem."), 1024 formatErrorInfo(res), 1025 "cannotAccessUSB"); 1026 } 1027 1028 void UIMessageCenter::cannotLoadMachineSettings(const CMachine &machine, 1029 bool fStrict /* = true */, 1030 QWidget *pParent /* = 0 */) 1031 { 1032 /* If COM result code is E_NOTIMPL, it means the requested object or 1033 * function is intentionally missing (as in the OSE version). Don't show 1034 * the error message in this case. */ 1035 COMResult res(machine); 1036 if (!fStrict && res.rc() == E_NOTIMPL) 1037 return; 1038 1039 message(pParent ? pParent : mainWindowShown(), Error, 1040 tr("Failed to load the settings of the virtual machine " 1041 "<b>%1</b> from <b><nobr>%2</nobr></b>.") 1042 .arg(machine.GetName(), machine.GetSettingsFilePath()), 1043 formatErrorInfo(res)); 1044 } 1045 1046 void UIMessageCenter::cannotSaveMachineSettings(const CMachine &machine, QWidget *pParent /* = 0 */) 1047 { 1048 /* preserve the current error info before calling the object again */ 1049 COMResult res(machine); 1050 1051 message(pParent ? pParent : mainWindowShown(), Error, 1052 tr("Failed to save the settings of the virtual machine " 1053 "<b>%1</b> to <b><nobr>%2</nobr></b>.") 1054 .arg(machine.GetName(), machine.GetSettingsFilePath()), 1055 formatErrorInfo(res)); 1056 } 1057 1058 void UIMessageCenter::warnAboutStateChange(QWidget *pParent) 1059 { 1060 if (warningShown("warnAboutStateChange")) 1061 return; 1062 setWarningShown("warnAboutStateChange", true); 1063 1064 message(pParent ? pParent : mainWindowShown(), Warning, 1065 tr("The virtual machine that you are changing has been started. " 1066 "Only certain settings can be changed while a machine is running. " 1067 "All other changes will be lost if you close this window now.")); 1068 1069 setWarningShown("warnAboutStateChange", false); 1070 } 1071 1072 bool UIMessageCenter::confirmSettingsReloading(QWidget *pParent) 1073 { 1074 int rc = message(pParent, Question, 1075 tr("<p>The machine settings were changed while you were editing them. " 1076 "You currently have unsaved setting changes.</p>" 1077 "<p>Would you like to reload the changed settings or to keep your own changes?</p>"), 0, 1078 QIMessageBox::Yes, QIMessageBox::No | QIMessageBox::Default | QIMessageBox::Escape, 0, 1079 tr("Reload settings"), tr("Keep changes"), 0); 1080 return rc == QIMessageBox::Yes; 1081 } 1082 1083 int UIMessageCenter::askAboutHardDiskAttachmentCreation(QWidget *pParent, 1084 const QString &strControllerName) 1085 { 1086 return message(pParent, Question, 1087 tr("<p>You are about to add a virtual hard disk to controller <b>%1</b>.</p>" 1088 "<p>Would you like to create a new, empty file to hold the disk contents or select an existing one?</p>") 1089 .arg(strControllerName), 1090 0, /* pcszAutoConfirmId */ 1091 QIMessageBox::Yes, 1092 QIMessageBox::No, 1093 QIMessageBox::Cancel | QIMessageBox::Default | QIMessageBox::Escape, 1094 tr("Create &new disk", "add attachment routine"), 1095 tr("&Choose existing disk", "add attachment routine")); 1096 } 1097 1098 int UIMessageCenter::askAboutOpticalAttachmentCreation(QWidget *pParent, 1099 const QString &strControllerName) 1100 { 1101 return message(pParent, Question, 1102 tr("<p>You are about to add a new CD/DVD drive to controller <b>%1</b>.</p>" 1103 "<p>Would you like to choose a virtual CD/DVD disk to put in the drive " 1104 "or to leave it empty for now?</p>") 1105 .arg(strControllerName), 1106 0, /* pcszAutoConfirmId */ 1107 QIMessageBox::Yes, 1108 QIMessageBox::No, 1109 QIMessageBox::Cancel | QIMessageBox::Default | QIMessageBox::Escape, 1110 tr("&Choose disk", "add attachment routine"), 1111 tr("Leave &empty", "add attachment routine")); 1112 } 1113 1114 int UIMessageCenter::askAboutFloppyAttachmentCreation(QWidget *pParent, 1115 const QString &strControllerName) 1116 { 1117 return message(pParent, Question, 1118 tr("<p>You are about to add a new floppy drive to controller <b>%1</b>.</p>" 1119 "<p>Would you like to choose a virtual floppy disk to put in the drive " 1120 "or to leave it empty for now?</p>") 1121 .arg(strControllerName), 1122 0, /* pcszAutoConfirmId */ 1123 QIMessageBox::Yes, 1124 QIMessageBox::No, 1125 QIMessageBox::Cancel | QIMessageBox::Default | QIMessageBox::Escape, 1126 tr("&Choose disk", "add attachment routine"), 1127 tr("Leave &empty", "add attachment routine")); 1128 } 1129 1130 int UIMessageCenter::confirmRemovingOfLastDVDDevice() const 1131 { 1132 return messageOkCancel(QApplication::activeWindow(), Info, 1133 tr("<p>Are you sure you want to delete the CD/DVD-ROM device?</p>" 1134 "<p>You will not be able to mount any CDs or ISO images " 1135 "or install the Guest Additions without it!</p>"), 1136 0, /* pcszAutoConfirmId */ 1137 tr("&Remove", "medium")); 1138 } 1139 1140 int UIMessageCenter::confirmDeletingHostInterface(const QString &strName, 1141 QWidget *pParent) 1142 { 1143 return msgCenter().message(pParent, UIMessageCenter::Question, 1144 tr("<p>Deleting this host-only network will remove " 1145 "the host-only interface this network is based on. Do you want to " 1146 "remove the (host-only network) interface <nobr><b>%1</b>?</nobr></p>" 1147 "<p><b>Note:</b> this interface may be in use by one or more " 1148 "virtual network adapters belonging to one of your VMs. " 1149 "After it is removed, these adapters will no longer be usable until " 1150 "you correct their settings by either choosing a different interface " 1151 "name or a different adapter attachment type.</p>").arg(strName), 1152 0, /* pcszAutoConfirmId */ 1153 QIMessageBox::Ok | QIMessageBox::Default, 1154 QIMessageBox::Cancel | QIMessageBox::Escape); 1155 } 1156 1157 void UIMessageCenter::warnAboutIncorrectPort(QWidget *pParent) const 1158 { 1159 message(pParent, Error, 1160 tr("The current port forwarding rules are not valid. " 1161 "None of the host or guest port values may be set to zero.")); 1162 } 1163 1164 bool UIMessageCenter::confirmCancelingPortForwardingDialog(QWidget *pParent) const 1165 { 1166 return messageOkCancel(pParent, Question, 1167 tr("<p>There are unsaved changes in the port forwarding configuration.</p>" 1168 "<p>If you proceed your changes will be discarded.</p>")); 1169 } 1170 1416 1171 void UIMessageCenter::cannotChangeMediumType(QWidget *pParent, 1417 1172 const CMedium &medium, … … 1481 1236 "confirmRemoveMedium", /* pcszAutoConfirmId */ 1482 1237 tr("Remove", "medium")); 1483 }1484 1485 void UIMessageCenter::sayCannotOverwriteHardDiskStorage(QWidget *pParent,1486 const QString &strLocation)1487 {1488 message(pParent, Info,1489 tr("<p>The hard disk storage unit at location <b>%1</b> already "1490 "exists. You cannot create a new virtual hard disk that uses this "1491 "location because it can be already used by another virtual hard "1492 "disk.</p>"1493 "<p>Please specify a different location.</p>")1494 .arg(strLocation));1495 1238 } 1496 1239 … … 1526 1269 tr("Failed to delete the storage unit of the hard disk <b>%1</b>.") 1527 1270 .arg(CMedium(medium).GetLocation()), 1528 !medium.isOk() ? formatErrorInfo(medium) :1529 !progress.isOk() ? formatErrorInfo(progress) :1530 formatErrorInfo(progress.GetErrorInfo()));1531 }1532 1533 int UIMessageCenter::askAboutHardDiskAttachmentCreation(QWidget *pParent,1534 const QString &strControllerName)1535 {1536 return message(pParent, Question,1537 tr("<p>You are about to add a virtual hard disk to controller <b>%1</b>.</p>"1538 "<p>Would you like to create a new, empty file to hold the disk contents or select an existing one?</p>")1539 .arg(strControllerName),1540 0, /* pcszAutoConfirmId */1541 QIMessageBox::Yes,1542 QIMessageBox::No,1543 QIMessageBox::Cancel | QIMessageBox::Default | QIMessageBox::Escape,1544 tr("Create &new disk", "add attachment routine"),1545 tr("&Choose existing disk", "add attachment routine"));1546 }1547 1548 int UIMessageCenter::askAboutOpticalAttachmentCreation(QWidget *pParent,1549 const QString &strControllerName)1550 {1551 return message(pParent, Question,1552 tr("<p>You are about to add a new CD/DVD drive to controller <b>%1</b>.</p>"1553 "<p>Would you like to choose a virtual CD/DVD disk to put in the drive "1554 "or to leave it empty for now?</p>")1555 .arg(strControllerName),1556 0, /* pcszAutoConfirmId */1557 QIMessageBox::Yes,1558 QIMessageBox::No,1559 QIMessageBox::Cancel | QIMessageBox::Default | QIMessageBox::Escape,1560 tr("&Choose disk", "add attachment routine"),1561 tr("Leave &empty", "add attachment routine"));1562 }1563 1564 int UIMessageCenter::askAboutFloppyAttachmentCreation(QWidget *pParent,1565 const QString &strControllerName)1566 {1567 return message(pParent, Question,1568 tr("<p>You are about to add a new floppy drive to controller <b>%1</b>.</p>"1569 "<p>Would you like to choose a virtual floppy disk to put in the drive "1570 "or to leave it empty for now?</p>")1571 .arg(strControllerName),1572 0, /* pcszAutoConfirmId */1573 QIMessageBox::Yes,1574 QIMessageBox::No,1575 QIMessageBox::Cancel | QIMessageBox::Default | QIMessageBox::Escape,1576 tr("&Choose disk", "add attachment routine"),1577 tr("Leave &empty", "add attachment routine"));1578 }1579 1580 int UIMessageCenter::confirmRemovingOfLastDVDDevice() const1581 {1582 return messageOkCancel(QApplication::activeWindow(), Info,1583 tr("<p>Are you sure you want to delete the CD/DVD-ROM device?</p>"1584 "<p>You will not be able to mount any CDs or ISO images "1585 "or install the Guest Additions without it!</p>"),1586 0, /* pcszAutoConfirmId */1587 tr("&Remove", "medium"));1588 }1589 1590 void UIMessageCenter::cannotCreateHardDiskStorage(QWidget *pParent,1591 const CVirtualBox &vbox,1592 const QString &strLocation,1593 const CMedium &medium,1594 const CProgress &progress)1595 {1596 message(pParent, Error,1597 tr("Failed to create the hard disk storage <nobr><b>%1</b>.</nobr>")1598 .arg(strLocation),1599 !vbox.isOk() ? formatErrorInfo(vbox) :1600 1271 !medium.isOk() ? formatErrorInfo(medium) : 1601 1272 !progress.isOk() ? formatErrorInfo(progress) : … … 1702 1373 } 1703 1374 1704 void UIMessageCenter::cannotOpenSession(const CSession &session) 1705 { 1706 Assert(session.isNull()); 1375 void UIMessageCenter::cannotCreateMachine(const CVirtualBox &vbox, QWidget *pParent /* = 0 */) 1376 { 1377 message( 1378 pParent ? pParent : mainWindowShown(), 1379 Error, 1380 tr("Failed to create a new virtual machine."), 1381 formatErrorInfo(vbox) 1382 ); 1383 } 1384 1385 void UIMessageCenter::cannotCreateMachine(const CVirtualBox &vbox, 1386 const CMachine &machine, 1387 QWidget *pParent /* = 0 */) 1388 { 1389 message( 1390 pParent ? pParent : mainWindowShown(), 1391 Error, 1392 tr("Failed to create a new virtual machine <b>%1</b>.") 1393 .arg(machine.GetName()), 1394 formatErrorInfo(vbox) 1395 ); 1396 } 1397 1398 void UIMessageCenter::cannotRegisterMachine(const CVirtualBox &vbox, 1399 const CMachine &machine, 1400 QWidget *pParent) 1401 { 1402 message(pParent ? pParent : mainWindowShown(), 1403 Error, 1404 tr("Failed to register the virtual machine <b>%1</b>.") 1405 .arg(machine.GetName()), 1406 formatErrorInfo(vbox)); 1407 } 1408 1409 void UIMessageCenter::cannotCreateClone(const CMachine &machine, 1410 QWidget *pParent /* = 0 */) 1411 { 1412 message( 1413 pParent ? pParent : mainWindowShown(), 1414 Error, 1415 tr("Failed to clone the virtual machine <b>%1</b>.") 1416 .arg(machine.GetName()), 1417 formatErrorInfo(machine) 1418 ); 1419 } 1420 1421 void UIMessageCenter::cannotCreateClone(const CMachine &machine, 1422 const CProgress &progress, 1423 QWidget *pParent /* = 0 */) 1424 { 1425 AssertWrapperOk(progress); 1426 1427 message(pParent ? pParent : mainWindowShown(), 1428 Error, 1429 tr("Failed to clone the virtual machine <b>%1</b>.") 1430 .arg(machine.GetName()), 1431 formatErrorInfo(progress.GetErrorInfo()) 1432 ); 1433 } 1434 1435 void UIMessageCenter::cannotOverwriteHardDiskStorage(QWidget *pParent, 1436 const QString &strLocation) 1437 { 1438 message(pParent, Info, 1439 tr("<p>The hard disk storage unit at location <b>%1</b> already " 1440 "exists. You cannot create a new virtual hard disk that uses this " 1441 "location because it can be already used by another virtual hard " 1442 "disk.</p>" 1443 "<p>Please specify a different location.</p>") 1444 .arg(strLocation)); 1445 } 1446 1447 void UIMessageCenter::cannotCreateHardDiskStorage(QWidget *pParent, 1448 const CVirtualBox &vbox, 1449 const QString &strLocation, 1450 const CMedium &medium, 1451 const CProgress &progress) 1452 { 1453 message(pParent, Error, 1454 tr("Failed to create the hard disk storage <nobr><b>%1</b>.</nobr>") 1455 .arg(strLocation), 1456 !vbox.isOk() ? formatErrorInfo(vbox) : 1457 !medium.isOk() ? formatErrorInfo(medium) : 1458 !progress.isOk() ? formatErrorInfo(progress) : 1459 formatErrorInfo(progress.GetErrorInfo())); 1460 } 1461 1462 void UIMessageCenter::warnAboutCannotRemoveMachineFolder(QWidget *pParent, const QString &strFolderName) 1463 { 1464 QFileInfo fi(strFolderName); 1465 message(pParent ? pParent : mainWindowShown(), Critical, 1466 tr("<p>Cannot remove the machine folder <nobr><b>%1</b>.</nobr></p>" 1467 "<p>Please check that this folder really exists and that you have permissions to remove it.</p>") 1468 .arg(fi.fileName())); 1469 } 1470 1471 void UIMessageCenter::warnAboutCannotRewriteMachineFolder(QWidget *pParent, const QString &strFolderName) 1472 { 1473 QFileInfo fi(strFolderName); 1474 message(pParent ? pParent : mainWindowShown(), Critical, 1475 tr("<p>Cannot create the machine folder <b>%1</b> in the parent folder <nobr><b>%2</b>.</nobr></p>" 1476 "<p>This folder already exists and possibly belongs to another machine.</p>") 1477 .arg(fi.fileName()).arg(fi.absolutePath())); 1478 } 1479 1480 void UIMessageCenter::warnAboutCannotCreateMachineFolder(QWidget *pParent, const QString &strFolderName) 1481 { 1482 QFileInfo fi(strFolderName); 1483 message(pParent ? pParent : mainWindowShown(), Critical, 1484 tr("<p>Cannot create the machine folder <b>%1</b> in the parent folder <nobr><b>%2</b>.</nobr></p>" 1485 "<p>Please check that the parent really exists and that you have permissions to create the machine folder.</p>") 1486 .arg(fi.fileName()).arg(fi.absolutePath())); 1487 } 1488 1489 bool UIMessageCenter::confirmHardDisklessMachine(QWidget *pParent) 1490 { 1491 return message(pParent, Warning, 1492 tr("You are about to create a new virtual machine without a hard drive. " 1493 "You will not be able to install an operating system on the machine " 1494 "until you add one. In the mean time you will only be able to start the " 1495 "machine using a virtual optical disk or from the network."), 1496 0, /* pcszAutoConfirmId */ 1497 QIMessageBox::Ok, 1498 QIMessageBox::Cancel | QIMessageBox::Default | QIMessageBox::Escape, 1499 0, 1500 tr("Continue", "no hard disk attached"), 1501 tr("Go Back", "no hard disk attached")) == QIMessageBox::Ok; 1502 } 1503 1504 void UIMessageCenter::cannotImportAppliance(CAppliance *pAppliance, 1505 QWidget *pParent /* = NULL */) const 1506 { 1507 if (pAppliance->isNull()) 1508 { 1509 message(pParent ? pParent : mainWindowShown(), 1510 Error, 1511 tr("Failed to open appliance.")); 1512 } 1513 else 1514 { 1515 /* Preserve the current error info before calling the object again */ 1516 COMResult res(*pAppliance); 1517 1518 /* Add the warnings in the case of an early error */ 1519 QVector<QString> w = pAppliance->GetWarnings(); 1520 QString wstr; 1521 foreach(const QString &str, w) 1522 wstr += QString("<br />Warning: %1").arg(str); 1523 if (!wstr.isEmpty()) 1524 wstr = "<br />" + wstr; 1525 1526 message(pParent ? pParent : mainWindowShown(), 1527 Error, 1528 tr("Failed to open/interpret appliance <b>%1</b>.").arg(pAppliance->GetPath()), 1529 wstr + 1530 formatErrorInfo(res)); 1531 } 1532 } 1533 1534 void UIMessageCenter::cannotImportAppliance(const CProgress &progress, 1535 CAppliance* pAppliance, 1536 QWidget *pParent /* = NULL */) const 1537 { 1538 AssertWrapperOk(progress); 1539 1540 message(pParent ? pParent : mainWindowShown(), 1541 Error, 1542 tr("Failed to import appliance <b>%1</b>.").arg(pAppliance->GetPath()), 1543 formatErrorInfo(progress.GetErrorInfo())); 1544 } 1545 1546 void UIMessageCenter::cannotCheckFiles(const CProgress &progress, 1547 QWidget *pParent /* = NULL */) const 1548 { 1549 AssertWrapperOk(progress); 1550 1551 message(pParent ? pParent : mainWindowShown(), 1552 Error, 1553 tr("Failed to check files."), 1554 formatErrorInfo(progress.GetErrorInfo())); 1555 } 1556 1557 void UIMessageCenter::cannotRemoveFiles(const CProgress &progress, 1558 QWidget *pParent /* = NULL */) const 1559 { 1560 AssertWrapperOk(progress); 1561 1562 message(pParent ? pParent : mainWindowShown(), 1563 Error, 1564 tr("Failed to remove file."), 1565 formatErrorInfo(progress.GetErrorInfo())); 1566 } 1567 1568 bool UIMessageCenter::confirmExportMachinesInSaveState(const QStringList &strMachineNames, 1569 QWidget *pParent /* = NULL */) const 1570 { 1571 return messageOkCancel(pParent ? pParent : mainWindowShown(), Warning, 1572 tr("<p>The %n following virtual machine(s) are currently in a saved state: <b>%1</b></p>" 1573 "<p>If you continue the runtime state of the exported machine(s) " 1574 "will be discarded. The other machine(s) will not be changed.</p>", "This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many machines are in the list and doesn't need to be told).", 1575 strMachineNames.size()).arg(VBoxGlobal::toHumanReadableList(strMachineNames)), 1576 0 /* pcszAutoConfirmId */, 1577 tr("Continue"), tr("Cancel")); 1578 } 1579 1580 void UIMessageCenter::cannotExportAppliance(CAppliance *pAppliance, 1581 QWidget *pParent /* = NULL */) const 1582 { 1583 if (pAppliance->isNull()) 1584 { 1585 message(pParent ? pParent : mainWindowShown(), 1586 Error, 1587 tr("Failed to create appliance.")); 1588 } 1589 else 1590 { 1591 /* Preserve the current error info before calling the object again */ 1592 COMResult res(*pAppliance); 1593 1594 message(pParent ? pParent : mainWindowShown(), 1595 Error, 1596 tr("Failed to prepare the export of the appliance <b>%1</b>.").arg(pAppliance->GetPath()), 1597 formatErrorInfo(res)); 1598 } 1599 } 1600 1601 void UIMessageCenter::cannotExportAppliance(const CMachine &machine, 1602 CAppliance *pAppliance, 1603 QWidget *pParent /* = NULL */) const 1604 { 1605 if (pAppliance->isNull() || 1606 machine.isNull()) 1607 { 1608 message(pParent ? pParent : mainWindowShown(), 1609 Error, 1610 tr("Failed to create an appliance.")); 1611 } 1612 else 1613 { 1614 message(pParent ? pParent : mainWindowShown(), 1615 Error, 1616 tr("Failed to prepare the export of the appliance <b>%1</b>.").arg(pAppliance->GetPath()), 1617 formatErrorInfo(machine)); 1618 } 1619 } 1620 1621 void UIMessageCenter::cannotExportAppliance(const CProgress &progress, 1622 CAppliance* pAppliance, 1623 QWidget *pParent /* = NULL */) const 1624 { 1625 AssertWrapperOk(progress); 1626 1627 message(pParent ? pParent : mainWindowShown(), 1628 Error, 1629 tr("Failed to export appliance <b>%1</b>.").arg(pAppliance->GetPath()), 1630 formatErrorInfo(progress.GetErrorInfo())); 1631 } 1632 1633 void UIMessageCenter::showRuntimeError(const CConsole &console, bool fFatal, 1634 const QString &strErrorId, 1635 const QString &strErrorMsg) const 1636 { 1637 QByteArray autoConfimId = "showRuntimeError."; 1638 1639 CConsole console1 = console; 1640 KMachineState state = console1.GetState(); 1641 Type type; 1642 QString severity; 1643 1644 if (fFatal) 1645 { 1646 /* the machine must be paused on fFatal errors */ 1647 Assert(state == KMachineState_Paused); 1648 if (state != KMachineState_Paused) 1649 console1.Pause(); 1650 type = Critical; 1651 severity = tr("<nobr>Fatal Error</nobr>", "runtime error info"); 1652 autoConfimId += "fatal."; 1653 } 1654 else if (state == KMachineState_Paused) 1655 { 1656 type = Error; 1657 severity = tr("<nobr>Non-Fatal Error</nobr>", "runtime error info"); 1658 autoConfimId += "error."; 1659 } 1660 else 1661 { 1662 type = Warning; 1663 severity = tr("<nobr>Warning</nobr>", "runtime error info"); 1664 autoConfimId += "warning."; 1665 } 1666 1667 autoConfimId += strErrorId.toUtf8(); 1668 1669 QString formatted("<!--EOM-->"); 1670 1671 if (!strErrorMsg.isEmpty()) 1672 formatted.prepend(QString("<p>%1.</p>").arg(vboxGlobal().emphasize(strErrorMsg))); 1673 1674 if (!strErrorId.isEmpty()) 1675 formatted += QString("<table bgcolor=#EEEEEE border=0 cellspacing=0 " 1676 "cellpadding=0 width=100%>" 1677 "<tr><td>%1</td><td>%2</td></tr>" 1678 "<tr><td>%3</td><td>%4</td></tr>" 1679 "</table>") 1680 .arg(tr("<nobr>Error ID: </nobr>", "runtime error info"), 1681 strErrorId) 1682 .arg(tr("Severity: ", "runtime error info"), 1683 severity); 1684 1685 if (!formatted.isEmpty()) 1686 formatted = "<qt>" + formatted + "</qt>"; 1687 1688 int rc = 0; 1689 1690 if (type == Critical) 1691 { 1692 rc = message(mainMachineWindowShown(), type, 1693 tr("<p>A fatal error has occurred during virtual machine execution! " 1694 "The virtual machine will be powered off. Please copy the " 1695 "following error message using the clipboard to help diagnose " 1696 "the problem:</p>"), 1697 formatted, autoConfimId.data()); 1698 1699 /* always power down after a fFatal error */ 1700 console1.PowerDown(); 1701 } 1702 else if (type == Error) 1703 { 1704 rc = message(mainMachineWindowShown(), type, 1705 tr("<p>An error has occurred during virtual machine execution! " 1706 "The error details are shown below. You may try to correct " 1707 "the error and resume the virtual machine " 1708 "execution.</p>"), 1709 formatted, autoConfimId.data()); 1710 } 1711 else 1712 { 1713 rc = message(mainMachineWindowShown(), type, 1714 tr("<p>The virtual machine execution may run into an error " 1715 "condition as described below. " 1716 "We suggest that you take " 1717 "an appropriate action to avert the error." 1718 "</p>"), 1719 formatted, autoConfimId.data()); 1720 } 1721 1722 NOREF(rc); 1723 } 1724 1725 bool UIMessageCenter::warnAboutVirtNotEnabled64BitsGuest(bool fHWVirtExSupported) 1726 { 1727 if (fHWVirtExSupported) 1728 return messageOkCancel(mainWindowShown(), Error, 1729 tr("<p>VT-x/AMD-V hardware acceleration has been enabled, but is " 1730 "not operational. Your 64-bit guest will fail to detect a " 1731 "64-bit CPU and will not be able to boot.</p><p>Please ensure " 1732 "that you have enabled VT-x/AMD-V properly in the BIOS of your " 1733 "host computer.</p>"), 1734 0 /* pcszAutoConfirmId */, 1735 tr("Close VM"), tr("Continue")); 1736 else 1737 return messageOkCancel(mainWindowShown(), Error, 1738 tr("<p>VT-x/AMD-V hardware acceleration is not available on your system. " 1739 "Your 64-bit guest will fail to detect a 64-bit CPU and will " 1740 "not be able to boot."), 1741 0 /* pcszAutoConfirmId */, 1742 tr("Close VM"), tr("Continue")); 1743 } 1744 1745 bool UIMessageCenter::warnAboutVirtNotEnabledGuestRequired(bool fHWVirtExSupported) 1746 { 1747 if (fHWVirtExSupported) 1748 return messageOkCancel(mainWindowShown(), Error, 1749 tr("<p>VT-x/AMD-V hardware acceleration has been enabled, but is " 1750 "not operational. Certain guests (e.g. OS/2 and QNX) require " 1751 "this feature.</p><p>Please ensure " 1752 "that you have enabled VT-x/AMD-V properly in the BIOS of your " 1753 "host computer.</p>"), 1754 0 /* pcszAutoConfirmId */, 1755 tr("Close VM"), tr("Continue")); 1756 else 1757 return messageOkCancel(mainWindowShown(), Error, 1758 tr("<p>VT-x/AMD-V hardware acceleration is not available on your system. " 1759 "Certain guests (e.g. OS/2 and QNX) require this feature and will " 1760 "fail to boot without it.</p>"), 1761 0 /* pcszAutoConfirmId */, 1762 tr("Close VM"), tr("Continue")); 1763 } 1764 1765 bool UIMessageCenter::cannotStartWithoutNetworkIf(const QString &strMachineName, 1766 const QString &strIfNames) 1767 { 1768 return messageOkCancel(mainMachineWindowShown(), Error, 1769 tr("<p>Could not start the machine <b>%1</b> because the " 1770 "following physical network interfaces were not found:</p>" 1771 "<p><b>%2</b></p>" 1772 "<p>You can either change the machine's network " 1773 "settings or stop the machine.</p>") 1774 .arg(strMachineName) 1775 .arg(strIfNames), 1776 0, /* pcszAutoConfirmId */ 1777 tr("Change Network Settings"), 1778 tr("Close Virtual Machine")); 1779 } 1780 1781 void UIMessageCenter::cannotStartMachine(const CConsole &console) 1782 { 1783 /* preserve the current error info before calling the object again */ 1784 COMResult res(console); 1785 1786 message(mainWindowShown(), Error, 1787 tr("Failed to start the virtual machine <b>%1</b>.") 1788 .arg(console.GetMachine().GetName()), 1789 formatErrorInfo(res)); 1790 } 1791 1792 void UIMessageCenter::cannotStartMachine(const CProgress &progress) 1793 { 1794 AssertWrapperOk(progress); 1795 CConsole console(CProgress(progress).GetInitiator()); 1796 AssertWrapperOk(console); 1707 1797 1708 1798 message( 1709 1799 mainWindowShown(), 1710 1800 Error, 1711 tr("Failed to create a new session."), 1712 formatErrorInfo(session) 1801 tr("Failed to start the virtual machine <b>%1</b>.") 1802 .arg(console.GetMachine().GetName()), 1803 formatErrorInfo(progress.GetErrorInfo()) 1713 1804 ); 1714 1805 } 1715 1806 1716 void UIMessageCenter::cannotOpenSession(const CVirtualBox &vbox, 1717 const CMachine &machine, 1718 const CProgress &progress) 1719 { 1720 Assert(!vbox.isOk() || progress.isOk()); 1721 1722 QString name = machine.GetName(); 1723 if (name.isEmpty()) 1724 name = QFileInfo(machine.GetSettingsFilePath()).baseName(); 1807 void UIMessageCenter::cannotPauseMachine(const CConsole &console) 1808 { 1809 /* preserve the current error info before calling the object again */ 1810 COMResult res(console); 1811 1812 message(mainWindowShown(), Error, 1813 tr("Failed to pause the execution of the virtual machine <b>%1</b>.") 1814 .arg(console.GetMachine().GetName()), 1815 formatErrorInfo(res)); 1816 } 1817 1818 void UIMessageCenter::cannotResumeMachine(const CConsole &console) 1819 { 1820 /* preserve the current error info before calling the object again */ 1821 COMResult res(console); 1822 1823 message(mainWindowShown(), Error, 1824 tr("Failed to resume the execution of the virtual machine <b>%1</b>.") 1825 .arg(console.GetMachine().GetName()), 1826 formatErrorInfo(res)); 1827 } 1828 1829 void UIMessageCenter::cannotACPIShutdownMachine(const CConsole &console) 1830 { 1831 /* preserve the current error info before calling the object again */ 1832 COMResult res(console); 1833 1834 message(mainWindowShown(), Error, 1835 tr("Failed to send the ACPI Power Button press event to the " 1836 "virtual machine <b>%1</b>.") 1837 .arg(console.GetMachine().GetName()), 1838 formatErrorInfo(res)); 1839 } 1840 1841 void UIMessageCenter::cannotSaveMachineState(const CConsole &console) 1842 { 1843 /* preserve the current error info before calling the object again */ 1844 COMResult res(console); 1845 1846 message(mainWindowShown(), Error, 1847 tr("Failed to save the state of the virtual machine <b>%1</b>.") 1848 .arg(console.GetMachine().GetName()), 1849 formatErrorInfo(res)); 1850 } 1851 1852 void UIMessageCenter::cannotSaveMachineState(const CProgress &progress) 1853 { 1854 AssertWrapperOk(progress); 1855 CConsole console(CProgress(progress).GetInitiator()); 1856 AssertWrapperOk(console); 1725 1857 1726 1858 message( 1727 1859 mainWindowShown(), 1728 1860 Error, 1729 tr("Failed to open a session for the virtual machine <b>%1</b>.") 1730 .arg(name), 1731 !vbox.isOk() ? formatErrorInfo(vbox) : 1732 formatErrorInfo(progress.GetErrorInfo()) 1861 tr("Failed to save the state of the virtual machine <b>%1</b>.") 1862 .arg(console.GetMachine().GetName()), 1863 formatErrorInfo(progress.GetErrorInfo()) 1733 1864 ); 1734 1865 } 1735 1866 1736 void UIMessageCenter::cannotOpenSession(const CMachine &machine) 1737 { 1738 COMResult res(machine); 1739 QString name = machine.GetName(); 1740 if (name.isEmpty()) 1741 name = QFileInfo(machine.GetSettingsFilePath()).baseName(); 1742 1743 message(mainWindowShown(), Error, 1744 tr("Failed to open a session for the virtual machine <b>%1</b>.").arg(name), 1745 formatErrorInfo(res)); 1746 } 1747 1748 void UIMessageCenter::cannotGetMediaAccessibility(const UIMedium &aMedium) 1749 { 1750 message(qApp->activeWindow(), Error, 1751 tr("Failed to determine the accessibility state of the medium " 1752 "<nobr><b>%1</b></nobr>.") 1753 .arg(aMedium.location()), 1754 formatErrorInfo(aMedium.result())); 1755 } 1756 1757 int UIMessageCenter::confirmDeletingHostInterface(const QString &strName, 1758 QWidget *pParent) 1759 { 1760 return msgCenter().message(pParent, UIMessageCenter::Question, 1761 tr("<p>Deleting this host-only network will remove " 1762 "the host-only interface this network is based on. Do you want to " 1763 "remove the (host-only network) interface <nobr><b>%1</b>?</nobr></p>" 1764 "<p><b>Note:</b> this interface may be in use by one or more " 1765 "virtual network adapters belonging to one of your VMs. " 1766 "After it is removed, these adapters will no longer be usable until " 1767 "you correct their settings by either choosing a different interface " 1768 "name or a different adapter attachment type.</p>").arg(strName), 1769 0, /* pcszAutoConfirmId */ 1770 QIMessageBox::Ok | QIMessageBox::Default, 1771 QIMessageBox::Cancel | QIMessageBox::Escape); 1772 } 1773 1774 void UIMessageCenter::cannotAttachUSBDevice(const CConsole &console, 1775 const QString &device) 1867 void UIMessageCenter::cannotTakeSnapshot(const CConsole &console) 1776 1868 { 1777 1869 /* preserve the current error info before calling the object again */ 1778 1870 COMResult res(console); 1779 1871 1780 message(mainMachineWindowShown(), Error, 1781 tr("Failed to attach the USB device <b>%1</b> " 1782 "to the virtual machine <b>%2</b>.") 1783 .arg(device) 1872 message(mainWindowShown(), Error, 1873 tr("Failed to create a snapshot of the virtual machine <b>%1</b>.") 1784 1874 .arg(console.GetMachine().GetName()), 1785 1875 formatErrorInfo(res)); 1786 1876 } 1787 1877 1788 void UIMessageCenter::cannotAttachUSBDevice(const CConsole &console, 1789 const QString &device, 1790 const CVirtualBoxErrorInfo &error) 1791 { 1792 message(mainMachineWindowShown(), Error, 1793 tr("Failed to attach the USB device <b>%1</b> " 1794 "to the virtual machine <b>%2</b>.") 1795 .arg(device) 1878 void UIMessageCenter::cannotTakeSnapshot(const CProgress &progress) 1879 { 1880 AssertWrapperOk(progress); 1881 CConsole console(CProgress(progress).GetInitiator()); 1882 AssertWrapperOk(console); 1883 1884 message( 1885 mainWindowShown(), 1886 Error, 1887 tr("Failed to create a snapshot of the virtual machine <b>%1</b>.") 1796 1888 .arg(console.GetMachine().GetName()), 1797 formatErrorInfo( error));1798 } 1799 1800 void UIMessageCenter::cannotDetachUSBDevice(const CConsole &console, 1801 const QString &device)1889 formatErrorInfo(progress.GetErrorInfo()) 1890 ); 1891 } 1892 1893 void UIMessageCenter::cannotStopMachine(const CConsole &console) 1802 1894 { 1803 1895 /* preserve the current error info before calling the object again */ 1804 1896 COMResult res(console); 1805 1897 1806 message(mainMachineWindowShown(), Error, 1807 tr("Failed to detach the USB device <b>%1</b> " 1808 "from the virtual machine <b>%2</b>.") 1809 .arg(device) 1898 message(mainWindowShown(), Error, 1899 tr("Failed to stop the virtual machine <b>%1</b>.") 1810 1900 .arg(console.GetMachine().GetName()), 1811 1901 formatErrorInfo(res)); 1812 1902 } 1813 1903 1814 void UIMessageCenter::cannot DetachUSBDevice(const CConsole &console,1815 const QString &device, 1816 const CVirtualBoxErrorInfo &error)1817 { 1818 message(mainMachineWindowShown(), Error,1819 tr("Failed to detach the USB device <b>%1</b> " 1820 "from the virtual machine <b>%2</b>.")1821 .arg(device)1904 void UIMessageCenter::cannotStopMachine(const CProgress &progress) 1905 { 1906 AssertWrapperOk(progress); 1907 CConsole console(CProgress(progress).GetInitiator()); 1908 AssertWrapperOk(console); 1909 1910 message(mainWindowShown(), Error, 1911 tr("Failed to stop the virtual machine <b>%1</b>.") 1822 1912 .arg(console.GetMachine().GetName()), 1823 formatErrorInfo(error)); 1824 } 1825 1826 void UIMessageCenter::remindAboutGuestAdditionsAreNotActive(QWidget *pParent) 1827 { 1828 message(pParent, Warning, 1829 tr("<p>The VirtualBox Guest Additions do not appear to be " 1830 "available on this virtual machine, and shared folders " 1831 "cannot be used without them. To use shared folders inside " 1832 "the virtual machine, please install the Guest Additions " 1833 "if they are not installed, or re-install them if they are " 1834 "not working correctly, by selecting <b>Install Guest Additions</b> " 1835 "from the <b>Devices</b> menu. " 1836 "If they are installed but the machine is not yet fully started " 1837 "then shared folders will be available once it is.</p>"), 1838 "remindAboutGuestAdditionsAreNotActive"); 1839 } 1840 1841 bool UIMessageCenter::cannotFindGuestAdditions() 1842 { 1843 return messageYesNo(mainMachineWindowShown(), Question, 1844 tr("<p>Could not find the VirtualBox Guest Additions " 1845 "CD image file.</nobr></p><p>Do you wish to " 1846 "download this CD image from the Internet?</p>")); 1847 } 1848 1849 void UIMessageCenter::cannotMountGuestAdditions(const QString &strMachineName) 1850 { 1851 message(mainMachineWindowShown(), Error, 1852 tr("<p>Could not insert the VirtualBox Guest Additions " 1853 "installer CD image into the virtual machine <b>%1</b>, as the machine " 1854 "has no CD/DVD-ROM drives. Please add a drive using the " 1855 "storage page of the virtual machine settings dialog.</p>") 1856 .arg(strMachineName)); 1857 } 1858 1859 bool UIMessageCenter::confirmDownloadAdditions(const QString &strUrl, qulonglong uSize) 1860 { 1861 QLocale loc(VBoxGlobal::languageId()); 1862 return messageOkCancel(networkManagerOrMainMachineWindowShown(), Question, 1863 tr("<p>Are you sure you want to download the VirtualBox " 1864 "Guest Additions CD image from " 1865 "<nobr><a href=\"%1\">%2</a></nobr> " 1866 "(size %3 bytes)?</p>").arg(strUrl).arg(strUrl).arg(loc.toString(uSize)), 1867 0, /* pcszAutoConfirmId */ 1868 tr("Download", "additions")); 1869 } 1870 1871 bool UIMessageCenter::confirmMountAdditions(const QString &strUrl, const QString &strSrc) 1872 { 1873 return messageOkCancel(networkManagerOrMainMachineWindowShown(), Question, 1874 tr("<p>The VirtualBox Guest Additions CD image has been " 1875 "successfully downloaded from " 1876 "<nobr><a href=\"%1\">%2</a></nobr> " 1877 "and saved locally as <nobr><b>%3</b>.</nobr></p>" 1878 "<p>Do you wish to register this CD image and mount it " 1879 "on the virtual CD/DVD drive?</p>") 1880 .arg(strUrl).arg(strUrl).arg(strSrc), 1881 0, /* pcszAutoConfirmId */ 1882 tr("Mount", "additions")); 1883 } 1884 1885 void UIMessageCenter::warnAboutAdditionsCantBeSaved(const QString &strTarget) 1886 { 1887 message(networkManagerOrMainMachineWindowShown(), Error, 1888 tr("<p>Failed to save the downloaded file as <nobr><b>%1</b>.</nobr></p>") 1889 .arg(QDir::toNativeSeparators(strTarget))); 1890 } 1891 1892 bool UIMessageCenter::askAboutUserManualDownload(const QString &strMissedLocation) 1893 { 1894 return messageOkCancel(mainWindowShown(), Question, 1895 tr("<p>Could not find the VirtualBox User Manual " 1896 "<nobr><b>%1</b>.</nobr></p><p>Do you wish to " 1897 "download this file from the Internet?</p>") 1898 .arg(strMissedLocation), 1899 0, /* Auto-confirm Id */ 1900 tr("Download", "additions")); 1901 } 1902 1903 bool UIMessageCenter::confirmUserManualDownload(const QString &strURL, qulonglong uSize) 1904 { 1905 QLocale loc(VBoxGlobal::languageId()); 1906 return messageOkCancel(networkManagerOrMainWindowShown(), Question, 1907 tr("<p>Are you sure you want to download the VirtualBox " 1908 "User Manual from " 1909 "<nobr><a href=\"%1\">%2</a></nobr> " 1910 "(size %3 bytes)?</p>").arg(strURL).arg(strURL).arg(loc.toString(uSize)), 1911 0, /* Auto-confirm Id */ 1912 tr("Download", "additions")); 1913 } 1914 1915 void UIMessageCenter::warnAboutUserManualDownloaded(const QString &strURL, const QString &strTarget) 1916 { 1917 message(networkManagerOrMainWindowShown(), Warning, 1918 tr("<p>The VirtualBox User Manual has been " 1919 "successfully downloaded from " 1920 "<nobr><a href=\"%1\">%2</a></nobr> " 1921 "and saved locally as <nobr><b>%3</b>.</nobr></p>") 1922 .arg(strURL).arg(strURL).arg(strTarget)); 1923 } 1924 1925 void UIMessageCenter::warnAboutUserManualCantBeSaved(const QString &strURL, const QString &strTarget) 1926 { 1927 message(networkManagerOrMainWindowShown(), Error, 1928 tr("<p>The VirtualBox User Manual has been " 1929 "successfully downloaded from " 1930 "<nobr><a href=\"%1\">%2</a></nobr> " 1931 "but can't be saved locally as <nobr><b>%3</b>.</nobr></p>" 1932 "<p>Please choose another location for that file.</p>") 1933 .arg(strURL).arg(strURL).arg(strTarget)); 1934 } 1935 1936 bool UIMessageCenter::proposeDownloadExtensionPack(const QString &strExtPackName, const QString &strExtPackVersion) 1937 { 1938 return messageOkCancel(mainWindowShown(), 1939 Question, 1940 tr("<p>You have an old version (%1) of the <b><nobr>%2</nobr></b> installed.</p>" 1941 "<p>Do you wish to download latest one from the Internet?</p>") 1942 .arg(strExtPackVersion).arg(strExtPackName), 1943 0, /* Auto-confirm Id */ 1944 tr("Download", "extension pack")); 1945 } 1946 1947 bool UIMessageCenter::requestUserDownloadExtensionPack(const QString &strExtPackName, const QString &strExtPackVersion, const QString &strVBoxVersion) 1948 { 1949 return message(mainWindowShown(), Info, 1950 tr("<p>You have version %1 of the <b><nobr>%2</nobr></b> installed.</p>" 1951 "<p>You should download and install version %3 of this extension pack from Oracle!</p>") 1952 .arg(strExtPackVersion).arg(strExtPackName).arg(strVBoxVersion), 1953 0, /* Auto-confirm Id */ 1954 QIMessageBox::Ok | QIMessageBox::Default, 1955 0, 1956 0, 1957 tr("Ok", "extension pack")); 1958 } 1959 1960 bool UIMessageCenter::confirmDownloadExtensionPack(const QString &strExtPackName, const QString &strURL, qulonglong uSize) 1961 { 1962 QLocale loc(VBoxGlobal::languageId()); 1963 return messageOkCancel(networkManagerOrMainWindowShown(), Question, 1964 tr("<p>Are you sure you want to download the <b><nobr>%1</nobr></b> " 1965 "from <nobr><a href=\"%2\">%2</a></nobr> (size %3 bytes)?</p>") 1966 .arg(strExtPackName, strURL, loc.toString(uSize)), 1967 0, /* Auto-confirm Id */ 1968 tr("Download", "extension pack")); 1969 } 1970 1971 bool UIMessageCenter::proposeInstallExtentionPack(const QString &strExtPackName, const QString &strFrom, const QString &strTo) 1972 { 1973 return messageOkCancel(networkManagerOrMainWindowShown(), Question, 1974 tr("<p>The <b><nobr>%1</nobr></b> has been " 1975 "successfully downloaded from <nobr><a href=\"%2\">%2</a></nobr> " 1976 "and saved locally as <nobr><b>%3</b>.</nobr></p>" 1977 "<p>Do you wish to install this extension pack?</p>") 1978 .arg(strExtPackName, strFrom, strTo), 1979 0, /* Auto-confirm Id */ 1980 tr ("Install", "extension pack")); 1981 } 1982 1983 void UIMessageCenter::warnAboutExtentionPackCantBeSaved(const QString &strExtPackName, const QString &strFrom, const QString &strTo) 1984 { 1985 message(networkManagerOrMainWindowShown(), Error, 1986 tr("<p>The <b><nobr>%1</nobr></b> has been " 1987 "successfully downloaded from <nobr><a href=\"%2\">%2</a></nobr> " 1988 "but can't be saved locally as <nobr><b>%3</b>.</nobr></p>" 1989 "<p>Please choose another location for that file.</p>") 1990 .arg(strExtPackName, strFrom, strTo)); 1991 } 1992 1993 void UIMessageCenter::showUpdateSuccess(const QString &strVersion, const QString &strLink) 1994 { 1995 message(networkManagerOrMainWindowShown(), Info, 1996 tr("<p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href=\"http://www.virtualbox.org/\">virtualbox.org</a>.</p>" 1997 "<p>You can download this version using the link:</p>" 1998 "<p><a href=%2>%3</a></p>") 1999 .arg(strVersion, strLink, strLink)); 2000 } 2001 2002 void UIMessageCenter::showUpdateNotFound() 2003 { 2004 message(networkManagerOrMainWindowShown(), Info, 2005 tr("You are already running the most recent version of VirtualBox.")); 2006 } 2007 2008 bool UIMessageCenter::askAboutCancelAllNetworkRequest(QWidget *pParent) 2009 { 2010 return messageOkCancel(pParent, Question, tr("Do you wish to cancel all current network operations?")); 2011 } 2012 2013 /** 2014 * @return @c true if the user has confirmed input capture (this is always 2015 * the case if the dialog was autoconfirmed). @a pfAutoConfirmed, when not 2016 * NULL, will receive @c true if the dialog wasn't actually shown. 2017 */ 1913 formatErrorInfo(progress.GetErrorInfo())); 1914 } 1915 1916 void UIMessageCenter::cannotSendACPIToMachine() 1917 { 1918 message(mainWindowShown(), Warning, 1919 tr("You are trying to shut down the guest with the ACPI power " 1920 "button. This is currently not possible because the guest " 1921 "does not support software shutdown.")); 1922 } 1923 2018 1924 bool UIMessageCenter::confirmInputCapture(bool *pfAutoConfirmed /* = NULL */) 2019 1925 { … … 2133 2039 } 2134 2040 2135 /**2136 * @return @c false if the dialog wasn't actually shown (i.e. it was2137 * autoconfirmed).2138 */2139 2041 bool UIMessageCenter::remindAboutPausedVMInput() 2140 2042 { … … 2151 2053 } 2152 2054 2153 /** @return true if the user has chosen to show the Disk Manager Window */ 2154 bool UIMessageCenter::remindAboutInaccessibleMedia() 2155 { 2156 int rc = message(&vboxGlobal().selectorWnd(), Warning, 2157 tr("<p>One or more virtual hard disks, CD/DVD or " 2158 "floppy media are not currently accessible. As a result, you will " 2159 "not be able to operate virtual machines that use these media until " 2160 "they become accessible later.</p>" 2161 "<p>Press <b>Check</b> to open the Virtual Media Manager window and " 2162 "see what media are inaccessible, or press <b>Ignore</b> to " 2163 "ignore this message.</p>"), 2164 "remindAboutInaccessibleMedia", 2165 QIMessageBox::Ok | QIMessageBox::Default, 2166 QIMessageBox::Ignore | QIMessageBox::Escape, 2167 0, 2168 tr("Check", "inaccessible media message box")); 2169 2170 return rc == QIMessageBox::Ok; /* implies !AutoConfirmed */ 2171 } 2172 2173 /** 2174 * Shows user a proposal to either convert configuration files or 2175 * Exit the application leaving all as already is. 2176 * 2177 * @param strFileList List of files for auto-conversion (may use Qt HTML). 2178 * @param fAfterRefresh @true when called after the VM refresh. 2179 * 2180 * @return QIMessageBox::Ok (Save + Backup), QIMessageBox::Cancel (Exit) 2181 */ 2182 int UIMessageCenter::warnAboutSettingsAutoConversion(const QString &strFileList, 2183 bool fAfterRefresh) 2184 { 2185 if (!fAfterRefresh) 2186 { 2187 /* Common variant for all VMs */ 2188 return message(mainWindowShown(), Info, 2189 tr("<p>Your existing VirtualBox settings files will be automatically " 2190 "converted from the old format to a new format required by the " 2191 "new version of VirtualBox.</p>" 2192 "<p>Press <b>OK</b> to start VirtualBox now or press <b>Exit</b> if " 2193 "you want to terminate the VirtualBox " 2194 "application without any further actions.</p>"), 2195 NULL /* pcszAutoConfirmId */, 2196 QIMessageBox::Ok | QIMessageBox::Default, 2197 QIMessageBox::Cancel | QIMessageBox::Escape, 2198 0, 2199 0, 2200 tr("E&xit", "warnAboutSettingsAutoConversion message box")); 2201 } 2202 else 2203 { 2204 /* Particular VM variant */ 2205 return message(mainWindowShown(), Info, 2206 tr("<p>The following VirtualBox settings files will be automatically " 2207 "converted from the old format to a new format required by the " 2208 "new version of VirtualBox.</p>" 2209 "<p>Press <b>OK</b> to start VirtualBox now or press <b>Exit</b> if " 2210 "you want to terminate the VirtualBox " 2211 "application without any further actions.</p>"), 2212 QString("<!--EOM-->%1").arg(strFileList), 2213 NULL /* pcszAutoConfirmId */, 2214 QIMessageBox::Ok | QIMessageBox::Default, 2215 QIMessageBox::Cancel | QIMessageBox::Escape, 2216 0, 2217 0, 2218 tr("E&xit", "warnAboutSettingsAutoConversion message box")); 2219 } 2220 } 2221 2222 /** 2223 * @param strHotKey Fullscreen hot key as defined in the menu. 2224 * 2225 * @return @c true if the user has chosen to go fullscreen (this is always 2226 * the case if the dialog was autoconfirmed). 2227 */ 2055 void UIMessageCenter::cannotEnterSeamlessMode(ULONG /* uWidth */, 2056 ULONG /* uHeight */, 2057 ULONG /* uBpp */, 2058 ULONG64 uMinVRAM) 2059 { 2060 message(mainMachineWindowShown(), Error, 2061 tr("<p>Could not enter seamless mode due to insufficient guest " 2062 "video memory.</p>" 2063 "<p>You should configure the virtual machine to have at " 2064 "least <b>%1</b> of video memory.</p>") 2065 .arg(VBoxGlobal::formatSize(uMinVRAM))); 2066 } 2067 2068 int UIMessageCenter::cannotEnterFullscreenMode(ULONG /* uWidth */, 2069 ULONG /* uHeight */, 2070 ULONG /* uBpp */, 2071 ULONG64 uMinVRAM) 2072 { 2073 return message(mainMachineWindowShown(), Warning, 2074 tr("<p>Could not switch the guest display to fullscreen mode due " 2075 "to insufficient guest video memory.</p>" 2076 "<p>You should configure the virtual machine to have at " 2077 "least <b>%1</b> of video memory.</p>" 2078 "<p>Press <b>Ignore</b> to switch to fullscreen mode anyway " 2079 "or press <b>Cancel</b> to cancel the operation.</p>") 2080 .arg(VBoxGlobal::formatSize(uMinVRAM)), 2081 0, /* pcszAutoConfirmId */ 2082 QIMessageBox::Ignore | QIMessageBox::Default, 2083 QIMessageBox::Cancel | QIMessageBox::Escape); 2084 } 2085 2086 void UIMessageCenter::cannotSwitchScreenInSeamless(quint64 uMinVRAM) 2087 { 2088 message(mainMachineWindowShown(), Error, 2089 tr("<p>Could not change the guest screen to this host screen " 2090 "due to insufficient guest video memory.</p>" 2091 "<p>You should configure the virtual machine to have at " 2092 "least <b>%1</b> of video memory.</p>") 2093 .arg(VBoxGlobal::formatSize(uMinVRAM))); 2094 } 2095 2096 int UIMessageCenter::cannotSwitchScreenInFullscreen(quint64 uMinVRAM) 2097 { 2098 return message(mainMachineWindowShown(), Warning, 2099 tr("<p>Could not change the guest screen to this host screen " 2100 "due to insufficient guest video memory.</p>" 2101 "<p>You should configure the virtual machine to have at " 2102 "least <b>%1</b> of video memory.</p>" 2103 "<p>Press <b>Ignore</b> to switch the screen anyway " 2104 "or press <b>Cancel</b> to cancel the operation.</p>") 2105 .arg(VBoxGlobal::formatSize(uMinVRAM)), 2106 0, /* pcszAutoConfirmId */ 2107 QIMessageBox::Ignore | QIMessageBox::Default, 2108 QIMessageBox::Cancel | QIMessageBox::Escape); 2109 } 2110 2228 2111 bool UIMessageCenter::confirmGoingFullscreen(const QString &strHotKey) 2229 2112 { … … 2240 2123 } 2241 2124 2242 /**2243 * @param strHotKey Seamless hot key as defined in the menu.2244 *2245 * @return @c true if the user has chosen to go seamless (this is always2246 * the case if the dialog was autoconfirmed).2247 */2248 2125 bool UIMessageCenter::confirmGoingSeamless(const QString &strHotKey) 2249 2126 { … … 2260 2137 } 2261 2138 2262 /**2263 * @param strHotKey Scale hot key as defined in the menu.2264 *2265 * @return @c true if the user has chosen to go scale (this is always2266 * the case if the dialog was autoconfirmed).2267 */2268 2139 bool UIMessageCenter::confirmGoingScale(const QString &strHotKey) 2269 2140 { … … 2280 2151 } 2281 2152 2282 /** 2283 * Returns @c true if the user has selected to power off the machine. 2284 */ 2285 bool UIMessageCenter::remindAboutGuruMeditation(const CConsole &console, 2286 const QString &strLogFolder) 2153 void UIMessageCenter::cannotAttachUSBDevice(const CConsole &console, 2154 const QString &device) 2155 { 2156 /* preserve the current error info before calling the object again */ 2157 COMResult res(console); 2158 2159 message(mainMachineWindowShown(), Error, 2160 tr("Failed to attach the USB device <b>%1</b> " 2161 "to the virtual machine <b>%2</b>.") 2162 .arg(device) 2163 .arg(console.GetMachine().GetName()), 2164 formatErrorInfo(res)); 2165 } 2166 2167 void UIMessageCenter::cannotAttachUSBDevice(const CConsole &console, 2168 const QString &device, 2169 const CVirtualBoxErrorInfo &error) 2170 { 2171 message(mainMachineWindowShown(), Error, 2172 tr("Failed to attach the USB device <b>%1</b> " 2173 "to the virtual machine <b>%2</b>.") 2174 .arg(device) 2175 .arg(console.GetMachine().GetName()), 2176 formatErrorInfo(error)); 2177 } 2178 2179 void UIMessageCenter::cannotDetachUSBDevice(const CConsole &console, 2180 const QString &device) 2181 { 2182 /* preserve the current error info before calling the object again */ 2183 COMResult res(console); 2184 2185 message(mainMachineWindowShown(), Error, 2186 tr("Failed to detach the USB device <b>%1</b> " 2187 "from the virtual machine <b>%2</b>.") 2188 .arg(device) 2189 .arg(console.GetMachine().GetName()), 2190 formatErrorInfo(res)); 2191 } 2192 2193 void UIMessageCenter::cannotDetachUSBDevice(const CConsole &console, 2194 const QString &device, 2195 const CVirtualBoxErrorInfo &error) 2196 { 2197 message(mainMachineWindowShown(), Error, 2198 tr("Failed to detach the USB device <b>%1</b> " 2199 "from the virtual machine <b>%2</b>.") 2200 .arg(device) 2201 .arg(console.GetMachine().GetName()), 2202 formatErrorInfo(error)); 2203 } 2204 2205 void UIMessageCenter::remindAboutGuestAdditionsAreNotActive(QWidget *pParent) 2206 { 2207 message(pParent, Warning, 2208 tr("<p>The VirtualBox Guest Additions do not appear to be " 2209 "available on this virtual machine, and shared folders " 2210 "cannot be used without them. To use shared folders inside " 2211 "the virtual machine, please install the Guest Additions " 2212 "if they are not installed, or re-install them if they are " 2213 "not working correctly, by selecting <b>Install Guest Additions</b> " 2214 "from the <b>Devices</b> menu. " 2215 "If they are installed but the machine is not yet fully started " 2216 "then shared folders will be available once it is.</p>"), 2217 "remindAboutGuestAdditionsAreNotActive"); 2218 } 2219 2220 void UIMessageCenter::cannotMountGuestAdditions(const QString &strMachineName) 2221 { 2222 message(mainMachineWindowShown(), Error, 2223 tr("<p>Could not insert the VirtualBox Guest Additions " 2224 "installer CD image into the virtual machine <b>%1</b>, as the machine " 2225 "has no CD/DVD-ROM drives. Please add a drive using the " 2226 "storage page of the virtual machine settings dialog.</p>") 2227 .arg(strMachineName)); 2228 } 2229 2230 bool UIMessageCenter::remindAboutGuruMeditation(const CConsole &console, const QString &strLogFolder) 2287 2231 { 2288 2232 Q_UNUSED(console); … … 2316 2260 } 2317 2261 2318 /** 2319 * @return @c true if the user has selected to reset the machine. 2320 */ 2321 bool UIMessageCenter::confirmVMReset(const QString &strNames) 2322 { 2323 return messageOkCancel(mainMachineWindowShown(), Question, 2324 tr("<p>Do you really want to reset the following virtual machines?</p>" 2325 "<p><b>%1</b></p><p>This will cause any unsaved data " 2326 "in applications running inside it to be lost.</p>") 2327 .arg(strNames), 2328 "confirmVMReset" /* pcszAutoConfirmId */, 2329 tr("Reset", "machine")); 2330 } 2331 2332 bool UIMessageCenter::confirmVMACPIShutdown(const QString &strNames) 2333 { 2334 return messageOkCancel(mainMachineWindowShown(), Question, 2335 tr("<p>Do you really want to send an ACPI shutdown signal " 2336 "to the following virtual machines?</p><p><b>%1</b></p>") 2337 .arg(strNames), 2338 "confirmVMACPIShutdown" /* pcszAutoConfirmId */, 2339 tr("ACPI Shutdown", "machine")); 2340 } 2341 2342 bool UIMessageCenter::confirmVMPowerOff(const QString &strNames) 2343 { 2344 return messageOkCancel(mainMachineWindowShown(), Question, 2345 tr("<p>Do you really want to power off the following virtual machines?</p>" 2346 "<p><b>%1</b></p><p>This will cause any unsaved data in applications " 2347 "running inside it to be lost.</p>") 2348 .arg(strNames), 2349 "confirmVMPowerOff" /* pcszAutoConfirmId */, 2350 tr("Power Off", "machine")); 2351 } 2352 2353 void UIMessageCenter::warnAboutCannotRemoveMachineFolder(QWidget *pParent, const QString &strFolderName) 2354 { 2355 QFileInfo fi(strFolderName); 2356 message(pParent ? pParent : mainWindowShown(), Critical, 2357 tr("<p>Cannot remove the machine folder <nobr><b>%1</b>.</nobr></p>" 2358 "<p>Please check that this folder really exists and that you have permissions to remove it.</p>") 2359 .arg(fi.fileName())); 2360 } 2361 2362 void UIMessageCenter::warnAboutCannotRewriteMachineFolder(QWidget *pParent, const QString &strFolderName) 2363 { 2364 QFileInfo fi(strFolderName); 2365 message(pParent ? pParent : mainWindowShown(), Critical, 2366 tr("<p>Cannot create the machine folder <b>%1</b> in the parent folder <nobr><b>%2</b>.</nobr></p>" 2367 "<p>This folder already exists and possibly belongs to another machine.</p>") 2368 .arg(fi.fileName()).arg(fi.absolutePath())); 2369 } 2370 2371 void UIMessageCenter::warnAboutCannotCreateMachineFolder(QWidget *pParent, const QString &strFolderName) 2372 { 2373 QFileInfo fi(strFolderName); 2374 message(pParent ? pParent : mainWindowShown(), Critical, 2375 tr("<p>Cannot create the machine folder <b>%1</b> in the parent folder <nobr><b>%2</b>.</nobr></p>" 2376 "<p>Please check that the parent really exists and that you have permissions to create the machine folder.</p>") 2377 .arg(fi.fileName()).arg(fi.absolutePath())); 2378 } 2379 2380 /** 2381 * @return @c true if the user has selected to continue without attaching a 2382 * hard disk. 2383 */ 2384 bool UIMessageCenter::confirmHardDisklessMachine(QWidget *pParent) 2385 { 2386 return message(pParent, Warning, 2387 tr("You are about to create a new virtual machine without a hard drive. " 2388 "You will not be able to install an operating system on the machine " 2389 "until you add one. In the mean time you will only be able to start the " 2390 "machine using a virtual optical disk or from the network."), 2391 0, /* pcszAutoConfirmId */ 2392 QIMessageBox::Ok, 2393 QIMessageBox::Cancel | QIMessageBox::Default | QIMessageBox::Escape, 2394 0, 2395 tr("Continue", "no hard disk attached"), 2396 tr("Go Back", "no hard disk attached")) == QIMessageBox::Ok; 2397 } 2398 2399 void UIMessageCenter::cannotRunInSelectorMode() 2400 { 2401 message(mainWindowShown(), Critical, 2402 tr("<p>Cannot run VirtualBox in <i>VM Selector</i> " 2403 "mode due to local restrictions.</p>" 2404 "<p>The application will now terminate.</p>")); 2405 } 2406 2407 void UIMessageCenter::cannotImportAppliance(CAppliance *pAppliance, 2408 QWidget *pParent /* = NULL */) const 2409 { 2410 if (pAppliance->isNull()) 2411 { 2412 message(pParent ? pParent : mainWindowShown(), 2413 Error, 2414 tr("Failed to open appliance.")); 2415 } 2416 else 2417 { 2418 /* Preserve the current error info before calling the object again */ 2419 COMResult res(*pAppliance); 2420 2421 /* Add the warnings in the case of an early error */ 2422 QVector<QString> w = pAppliance->GetWarnings(); 2423 QString wstr; 2424 foreach(const QString &str, w) 2425 wstr += QString("<br />Warning: %1").arg(str); 2426 if (!wstr.isEmpty()) 2427 wstr = "<br />" + wstr; 2428 2429 message(pParent ? pParent : mainWindowShown(), 2430 Error, 2431 tr("Failed to open/interpret appliance <b>%1</b>.").arg(pAppliance->GetPath()), 2432 wstr + 2433 formatErrorInfo(res)); 2434 } 2435 } 2436 2437 void UIMessageCenter::cannotImportAppliance(const CProgress &progress, 2438 CAppliance* pAppliance, 2439 QWidget *pParent /* = NULL */) const 2440 { 2441 AssertWrapperOk(progress); 2442 2443 message(pParent ? pParent : mainWindowShown(), 2444 Error, 2445 tr("Failed to import appliance <b>%1</b>.").arg(pAppliance->GetPath()), 2446 formatErrorInfo(progress.GetErrorInfo())); 2447 } 2448 2449 void UIMessageCenter::cannotCheckFiles(const CProgress &progress, 2450 QWidget *pParent /* = NULL */) const 2451 { 2452 AssertWrapperOk(progress); 2453 2454 message(pParent ? pParent : mainWindowShown(), 2455 Error, 2456 tr("Failed to check files."), 2457 formatErrorInfo(progress.GetErrorInfo())); 2458 } 2459 2460 void UIMessageCenter::cannotRemoveFiles(const CProgress &progress, 2461 QWidget *pParent /* = NULL */) const 2462 { 2463 AssertWrapperOk(progress); 2464 2465 message(pParent ? pParent : mainWindowShown(), 2466 Error, 2467 tr("Failed to remove file."), 2468 formatErrorInfo(progress.GetErrorInfo())); 2469 } 2470 2471 bool UIMessageCenter::confirmExportMachinesInSaveState(const QStringList &strMachineNames, 2472 QWidget *pParent /* = NULL */) const 2473 { 2474 return messageOkCancel(pParent ? pParent : mainWindowShown(), Warning, 2475 tr("<p>The %n following virtual machine(s) are currently in a saved state: <b>%1</b></p>" 2476 "<p>If you continue the runtime state of the exported machine(s) " 2477 "will be discarded. The other machine(s) will not be changed.</p>", "This text is never used with n == 0. Feel free to drop the %n where possible, we only included it because of problems with Qt Linguist (but the user can see how many machines are in the list and doesn't need to be told).", 2478 strMachineNames.size()).arg(VBoxGlobal::toHumanReadableList(strMachineNames)), 2479 0 /* pcszAutoConfirmId */, 2480 tr("Continue"), tr("Cancel")); 2481 } 2482 2483 void UIMessageCenter::cannotExportAppliance(CAppliance *pAppliance, 2484 QWidget *pParent /* = NULL */) const 2485 { 2486 if (pAppliance->isNull()) 2487 { 2488 message(pParent ? pParent : mainWindowShown(), 2489 Error, 2490 tr("Failed to create appliance.")); 2491 } 2492 else 2493 { 2494 /* Preserve the current error info before calling the object again */ 2495 COMResult res(*pAppliance); 2496 2497 message(pParent ? pParent : mainWindowShown(), 2498 Error, 2499 tr("Failed to prepare the export of the appliance <b>%1</b>.").arg(pAppliance->GetPath()), 2500 formatErrorInfo(res)); 2501 } 2502 } 2503 2504 void UIMessageCenter::cannotExportAppliance(const CMachine &machine, 2505 CAppliance *pAppliance, 2506 QWidget *pParent /* = NULL */) const 2507 { 2508 if (pAppliance->isNull() || 2509 machine.isNull()) 2510 { 2511 message(pParent ? pParent : mainWindowShown(), 2512 Error, 2513 tr("Failed to create an appliance.")); 2514 } 2515 else 2516 { 2517 message(pParent ? pParent : mainWindowShown(), 2518 Error, 2519 tr("Failed to prepare the export of the appliance <b>%1</b>.").arg(pAppliance->GetPath()), 2520 formatErrorInfo(machine)); 2521 } 2522 } 2523 2524 void UIMessageCenter::cannotExportAppliance(const CProgress &progress, 2525 CAppliance* pAppliance, 2526 QWidget *pParent /* = NULL */) const 2527 { 2528 AssertWrapperOk(progress); 2529 2530 message(pParent ? pParent : mainWindowShown(), 2531 Error, 2532 tr("Failed to export appliance <b>%1</b>.").arg(pAppliance->GetPath()), 2533 formatErrorInfo(progress.GetErrorInfo())); 2262 bool UIMessageCenter::askAboutCancelAllNetworkRequest(QWidget *pParent) 2263 { 2264 return messageOkCancel(pParent, Question, tr("Do you wish to cancel all current network operations?")); 2265 } 2266 2267 void UIMessageCenter::showUpdateSuccess(const QString &strVersion, const QString &strLink) 2268 { 2269 message(networkManagerOrMainWindowShown(), Info, 2270 tr("<p>A new version of VirtualBox has been released! Version <b>%1</b> is available at <a href=\"http://www.virtualbox.org/\">virtualbox.org</a>.</p>" 2271 "<p>You can download this version using the link:</p>" 2272 "<p><a href=%2>%3</a></p>") 2273 .arg(strVersion, strLink, strLink)); 2274 } 2275 2276 void UIMessageCenter::showUpdateNotFound() 2277 { 2278 message(networkManagerOrMainWindowShown(), Info, 2279 tr("You are already running the most recent version of VirtualBox.")); 2280 } 2281 2282 bool UIMessageCenter::cannotFindGuestAdditions() 2283 { 2284 return messageYesNo(mainMachineWindowShown(), Question, 2285 tr("<p>Could not find the VirtualBox Guest Additions " 2286 "CD image file.</nobr></p><p>Do you wish to " 2287 "download this CD image from the Internet?</p>")); 2288 } 2289 2290 bool UIMessageCenter::confirmDownloadAdditions(const QString &strUrl, qulonglong uSize) 2291 { 2292 QLocale loc(VBoxGlobal::languageId()); 2293 return messageOkCancel(networkManagerOrMainMachineWindowShown(), Question, 2294 tr("<p>Are you sure you want to download the VirtualBox " 2295 "Guest Additions CD image from " 2296 "<nobr><a href=\"%1\">%2</a></nobr> " 2297 "(size %3 bytes)?</p>").arg(strUrl).arg(strUrl).arg(loc.toString(uSize)), 2298 0, /* pcszAutoConfirmId */ 2299 tr("Download", "additions")); 2300 } 2301 2302 bool UIMessageCenter::confirmMountAdditions(const QString &strUrl, const QString &strSrc) 2303 { 2304 return messageOkCancel(networkManagerOrMainMachineWindowShown(), Question, 2305 tr("<p>The VirtualBox Guest Additions CD image has been " 2306 "successfully downloaded from " 2307 "<nobr><a href=\"%1\">%2</a></nobr> " 2308 "and saved locally as <nobr><b>%3</b>.</nobr></p>" 2309 "<p>Do you wish to register this CD image and mount it " 2310 "on the virtual CD/DVD drive?</p>") 2311 .arg(strUrl).arg(strUrl).arg(strSrc), 2312 0, /* pcszAutoConfirmId */ 2313 tr("Mount", "additions")); 2314 } 2315 2316 void UIMessageCenter::warnAboutAdditionsCantBeSaved(const QString &strTarget) 2317 { 2318 message(networkManagerOrMainMachineWindowShown(), Error, 2319 tr("<p>Failed to save the downloaded file as <nobr><b>%1</b>.</nobr></p>") 2320 .arg(QDir::toNativeSeparators(strTarget))); 2321 } 2322 2323 bool UIMessageCenter::askAboutUserManualDownload(const QString &strMissedLocation) 2324 { 2325 return messageOkCancel(mainWindowShown(), Question, 2326 tr("<p>Could not find the VirtualBox User Manual " 2327 "<nobr><b>%1</b>.</nobr></p><p>Do you wish to " 2328 "download this file from the Internet?</p>") 2329 .arg(strMissedLocation), 2330 0, /* Auto-confirm Id */ 2331 tr("Download", "additions")); 2332 } 2333 2334 bool UIMessageCenter::confirmUserManualDownload(const QString &strURL, qulonglong uSize) 2335 { 2336 QLocale loc(VBoxGlobal::languageId()); 2337 return messageOkCancel(networkManagerOrMainWindowShown(), Question, 2338 tr("<p>Are you sure you want to download the VirtualBox " 2339 "User Manual from " 2340 "<nobr><a href=\"%1\">%2</a></nobr> " 2341 "(size %3 bytes)?</p>").arg(strURL).arg(strURL).arg(loc.toString(uSize)), 2342 0, /* Auto-confirm Id */ 2343 tr("Download", "additions")); 2344 } 2345 2346 void UIMessageCenter::warnAboutUserManualDownloaded(const QString &strURL, const QString &strTarget) 2347 { 2348 message(networkManagerOrMainWindowShown(), Warning, 2349 tr("<p>The VirtualBox User Manual has been " 2350 "successfully downloaded from " 2351 "<nobr><a href=\"%1\">%2</a></nobr> " 2352 "and saved locally as <nobr><b>%3</b>.</nobr></p>") 2353 .arg(strURL).arg(strURL).arg(strTarget)); 2354 } 2355 2356 void UIMessageCenter::warnAboutUserManualCantBeSaved(const QString &strURL, const QString &strTarget) 2357 { 2358 message(networkManagerOrMainWindowShown(), Error, 2359 tr("<p>The VirtualBox User Manual has been " 2360 "successfully downloaded from " 2361 "<nobr><a href=\"%1\">%2</a></nobr> " 2362 "but can't be saved locally as <nobr><b>%3</b>.</nobr></p>" 2363 "<p>Please choose another location for that file.</p>") 2364 .arg(strURL).arg(strURL).arg(strTarget)); 2365 } 2366 2367 bool UIMessageCenter::proposeDownloadExtensionPack(const QString &strExtPackName, const QString &strExtPackVersion) 2368 { 2369 return messageOkCancel(mainWindowShown(), 2370 Question, 2371 tr("<p>You have an old version (%1) of the <b><nobr>%2</nobr></b> installed.</p>" 2372 "<p>Do you wish to download latest one from the Internet?</p>") 2373 .arg(strExtPackVersion).arg(strExtPackName), 2374 0, /* Auto-confirm Id */ 2375 tr("Download", "extension pack")); 2376 } 2377 2378 bool UIMessageCenter::requestUserDownloadExtensionPack(const QString &strExtPackName, const QString &strExtPackVersion, const QString &strVBoxVersion) 2379 { 2380 return message(mainWindowShown(), Info, 2381 tr("<p>You have version %1 of the <b><nobr>%2</nobr></b> installed.</p>" 2382 "<p>You should download and install version %3 of this extension pack from Oracle!</p>") 2383 .arg(strExtPackVersion).arg(strExtPackName).arg(strVBoxVersion), 2384 0, /* Auto-confirm Id */ 2385 QIMessageBox::Ok | QIMessageBox::Default, 2386 0, 2387 0, 2388 tr("Ok", "extension pack")); 2389 } 2390 2391 bool UIMessageCenter::confirmDownloadExtensionPack(const QString &strExtPackName, const QString &strURL, qulonglong uSize) 2392 { 2393 QLocale loc(VBoxGlobal::languageId()); 2394 return messageOkCancel(networkManagerOrMainWindowShown(), Question, 2395 tr("<p>Are you sure you want to download the <b><nobr>%1</nobr></b> " 2396 "from <nobr><a href=\"%2\">%2</a></nobr> (size %3 bytes)?</p>") 2397 .arg(strExtPackName, strURL, loc.toString(uSize)), 2398 0, /* Auto-confirm Id */ 2399 tr("Download", "extension pack")); 2400 } 2401 2402 bool UIMessageCenter::proposeInstallExtentionPack(const QString &strExtPackName, const QString &strFrom, const QString &strTo) 2403 { 2404 return messageOkCancel(networkManagerOrMainWindowShown(), Question, 2405 tr("<p>The <b><nobr>%1</nobr></b> has been " 2406 "successfully downloaded from <nobr><a href=\"%2\">%2</a></nobr> " 2407 "and saved locally as <nobr><b>%3</b>.</nobr></p>" 2408 "<p>Do you wish to install this extension pack?</p>") 2409 .arg(strExtPackName, strFrom, strTo), 2410 0, /* Auto-confirm Id */ 2411 tr ("Install", "extension pack")); 2412 } 2413 2414 void UIMessageCenter::warnAboutExtentionPackCantBeSaved(const QString &strExtPackName, const QString &strFrom, const QString &strTo) 2415 { 2416 message(networkManagerOrMainWindowShown(), Error, 2417 tr("<p>The <b><nobr>%1</nobr></b> has been " 2418 "successfully downloaded from <nobr><a href=\"%2\">%2</a></nobr> " 2419 "but can't be saved locally as <nobr><b>%3</b>.</nobr></p>" 2420 "<p>Please choose another location for that file.</p>") 2421 .arg(strExtPackName, strFrom, strTo)); 2534 2422 } 2535 2423 … … 2690 2578 } 2691 2579 2692 void UIMessageCenter::warnAboutIncorrectPort(QWidget *pParent) const2693 {2694 message(pParent, Error,2695 tr("The current port forwarding rules are not valid. "2696 "None of the host or guest port values may be set to zero."));2697 }2698 2699 bool UIMessageCenter::confirmCancelingPortForwardingDialog(QWidget *pParent) const2700 {2701 return messageOkCancel(pParent, Question,2702 tr("<p>There are unsaved changes in the port forwarding configuration.</p>"2703 "<p>If you proceed your changes will be discarded.</p>"));2704 }2705 2706 void UIMessageCenter::showRuntimeError(const CConsole &console, bool fFatal,2707 const QString &strErrorId,2708 const QString &strErrorMsg) const2709 {2710 /// @todo (r=dmik) it's just a preliminary box. We need to:2711 // - for fFatal errors and non-fFatal with-retry errors, listen for a2712 // VM state signal to automatically close the message if the VM2713 // (externally) leaves the Paused state while it is shown.2714 // - make warning messages modeless2715 // - add common buttons like Retry/Save/PowerOff/whatever2716 2717 QByteArray autoConfimId = "showRuntimeError.";2718 2719 CConsole console1 = console;2720 KMachineState state = console1.GetState();2721 Type type;2722 QString severity;2723 2724 if (fFatal)2725 {2726 /* the machine must be paused on fFatal errors */2727 Assert(state == KMachineState_Paused);2728 if (state != KMachineState_Paused)2729 console1.Pause();2730 type = Critical;2731 severity = tr("<nobr>Fatal Error</nobr>", "runtime error info");2732 autoConfimId += "fatal.";2733 }2734 else if (state == KMachineState_Paused)2735 {2736 type = Error;2737 severity = tr("<nobr>Non-Fatal Error</nobr>", "runtime error info");2738 autoConfimId += "error.";2739 }2740 else2741 {2742 type = Warning;2743 severity = tr("<nobr>Warning</nobr>", "runtime error info");2744 autoConfimId += "warning.";2745 }2746 2747 autoConfimId += strErrorId.toUtf8();2748 2749 QString formatted("<!--EOM-->");2750 2751 if (!strErrorMsg.isEmpty())2752 formatted.prepend(QString("<p>%1.</p>").arg(vboxGlobal().emphasize(strErrorMsg)));2753 2754 if (!strErrorId.isEmpty())2755 formatted += QString("<table bgcolor=#EEEEEE border=0 cellspacing=0 "2756 "cellpadding=0 width=100%>"2757 "<tr><td>%1</td><td>%2</td></tr>"2758 "<tr><td>%3</td><td>%4</td></tr>"2759 "</table>")2760 .arg(tr("<nobr>Error ID: </nobr>", "runtime error info"),2761 strErrorId)2762 .arg(tr("Severity: ", "runtime error info"),2763 severity);2764 2765 if (!formatted.isEmpty())2766 formatted = "<qt>" + formatted + "</qt>";2767 2768 int rc = 0;2769 2770 if (type == Critical)2771 {2772 rc = message(mainMachineWindowShown(), type,2773 tr("<p>A fatal error has occurred during virtual machine execution! "2774 "The virtual machine will be powered off. Please copy the "2775 "following error message using the clipboard to help diagnose "2776 "the problem:</p>"),2777 formatted, autoConfimId.data());2778 2779 /* always power down after a fFatal error */2780 console1.PowerDown();2781 }2782 else if (type == Error)2783 {2784 rc = message(mainMachineWindowShown(), type,2785 tr("<p>An error has occurred during virtual machine execution! "2786 "The error details are shown below. You may try to correct "2787 "the error and resume the virtual machine "2788 "execution.</p>"),2789 formatted, autoConfimId.data());2790 }2791 else2792 {2793 rc = message(mainMachineWindowShown(), type,2794 tr("<p>The virtual machine execution may run into an error "2795 "condition as described below. "2796 "We suggest that you take "2797 "an appropriate action to avert the error."2798 "</p>"),2799 formatted, autoConfimId.data());2800 }2801 2802 NOREF(rc);2803 }2804 2805 2580 /* static */ 2806 2581 QString UIMessageCenter::mediumToAccusative(UIMediumType type, bool fIsHostDrive /* = false */) … … 2823 2598 } 2824 2599 2825 /**2826 * Formats the given COM result code as a human-readable string.2827 *2828 * If a mnemonic name for the given result code is found, a string in format2829 * "MNEMONIC_NAME (0x12345678)" is returned where the hex number is the result2830 * code as is. If no mnemonic name is found, then the raw hex number only is2831 * returned (w/o pParenthesis).2832 *2833 * @param rc COM result code to format.2834 */2835 2600 /* static */ 2836 2601 QString UIMessageCenter::formatRC(HRESULT rc) … … 2874 2639 2875 2640 /* static */ 2876 QString UIMessageCenter::formatErrorInfo(const COMErrorInfo &info, 2877 HRESULT wrapperRC /* = S_OK */) 2641 QString UIMessageCenter::formatErrorInfo(const COMErrorInfo &info, HRESULT wrapperRC /* = S_OK */) 2878 2642 { 2879 2643 QString formatted = errorInfoToString(info, wrapperRC); 2880 2644 return QString("<qt>%1</qt>").arg(formatted); 2645 } 2646 2647 /* static */ 2648 QString UIMessageCenter::formatErrorInfo(const CVirtualBoxErrorInfo &info) 2649 { 2650 return formatErrorInfo(COMErrorInfo(info)); 2651 } 2652 2653 /* static */ 2654 QString UIMessageCenter::formatErrorInfo(const COMBaseWithEI &wrapper) 2655 { 2656 Assert(wrapper.lastRC() != S_OK); 2657 return formatErrorInfo(wrapper.errorInfo(), wrapper.lastRC()); 2658 } 2659 2660 /* static */ 2661 QString UIMessageCenter::formatErrorInfo(const COMResult &rc) 2662 { 2663 Assert(rc.rc() != S_OK); 2664 return formatErrorInfo(rc.errorInfo(), rc.rc()); 2881 2665 } 2882 2666 … … 2987 2771 emit sigRemindAboutWrongColorDepth(uRealBPP, uWantedBPP); 2988 2772 } 2989 2990 void UIMessageCenter::showGenericError(COMBaseWithEI *object, QWidget *pParent /* = 0 */)2991 {2992 if ( !object2993 || object->lastRC() == S_OK)2994 return;2995 2996 message(pParent ? pParent : mainWindowShown(),2997 Error,2998 tr("Sorry, some generic error happens."),2999 formatErrorInfo(*object));3000 }3001 3002 // Public slots3003 /////////////////////////////////////////////////////////////////////////////3004 2773 3005 2774 void UIMessageCenter::remindAboutUnsupportedUSB2(const QString &strExtPackName, QWidget *pParent) -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h
r45225 r45233 57 57 Q_OBJECT; 58 58 59 signals: 60 61 void sigToCloseAllWarnings(); 62 63 /* Stuff supporting interthreading: */ 64 void sigCannotCreateHostInterface(const CHost &host, QWidget *pParent); 65 void sigCannotCreateHostInterface(const CProgress &progress, QWidget *pParent); 66 void sigCannotRemoveHostInterface(const CHost &host, const CHostNetworkInterface &iface, QWidget *pParent); 67 void sigCannotRemoveHostInterface(const CProgress &progress, const CHostNetworkInterface &iface, QWidget *pParent); 68 void sigCannotAttachDevice(const CMachine &machine, UIMediumType type, 69 const QString &strLocation, const StorageSlot &storageSlot, QWidget *pParent); 70 void sigCannotCreateSharedFolder(const CMachine &machine, const QString &strName, 71 const QString &strPath, QWidget *pParent); 72 void sigCannotRemoveSharedFolder(const CMachine &machine, const QString &strName, 73 const QString &strPath, QWidget *pParent); 74 void sigCannotCreateSharedFolder(const CConsole &console, const QString &strName, 75 const QString &strPath, QWidget *pParent); 76 void sigCannotRemoveSharedFolder(const CConsole &console, const QString &strName, 77 const QString &strPath, QWidget *pParent); 78 void sigRemindAboutWrongColorDepth(ulong uRealBPP, ulong uWantedBPP); 79 void sigRemindAboutUnsupportedUSB2(const QString &strExtPackName, QWidget *pParent); 80 59 81 public: 60 82 … … 78 100 void setWarningShown(const QString &strWarningName, bool fWarningShown); 79 101 102 /* API: Message posting stuff: Main function: */ 80 103 int message(QWidget *pParent, Type type, const QString &strMessage, 81 104 const QString &strDetails = QString::null, … … 86 109 const QString &strText3 = QString::null) const; 87 110 111 /* API: Message posting stuff: Wrapper to above function: */ 88 112 int message(QWidget *pParent, Type type, const QString &strMessage, 89 113 const char *pcszAutoConfirmId, … … 97 121 } 98 122 123 /* API: Message posting stuff: Wrapper to above function: */ 99 124 bool messageYesNo(QWidget *pParent, Type type, const QString &strMessage, 100 125 const QString &strDetails = QString::null, … … 111 136 } 112 137 138 /* API: Message posting stuff: Wrapper to above function: */ 113 139 bool messageYesNo(QWidget *pParent, Type type, const QString &strMessage, 114 140 const char *pcszAutoConfirmId, … … 120 146 } 121 147 148 /* API: Message posting stuff: Wrapper to above function: */ 122 149 bool messageOkCancel(QWidget *pParent, Type type, const QString &strMessage, 123 150 const QString &strDetails = QString::null, … … 134 161 } 135 162 163 /* API: Message posting stuff: Wrapper to above function: */ 136 164 bool messageOkCancel(QWidget *pParent, Type type, const QString &strMessage, 137 165 const char *pcszAutoConfirmId, … … 143 171 } 144 172 173 /* API: Message posting stuff: One more main function: */ 145 174 int messageWithOption(QWidget *pParent, 146 175 Type type, … … 156 185 const QString &strButtonName3 = QString::null) const; 157 186 187 /* API: Progress-dialog stuff: */ 158 188 bool showModalProgressDialog(CProgress &progress, const QString &strTitle, 159 189 const QString &strImage = "", QWidget *pParent = 0, 160 190 int cMinDuration = 2000); 161 191 192 /* API: Main window stuff: */ 162 193 QWidget* mainWindowShown() const; 163 194 QWidget* mainMachineWindowShown() const; … … 165 196 QWidget* networkManagerOrMainMachineWindowShown() const; 166 197 198 /* API: File read/write overriding stuff: */ 167 199 bool askForOverridingFile(const QString& strPath, QWidget *pParent = NULL); 168 200 bool askForOverridingFiles(const QVector<QString>& strPaths, QWidget *pParent = NULL); … … 170 202 bool askForOverridingFilesIfExists(const QVector<QString>& strPaths, QWidget *pParent = NULL); 171 203 172 void checkForMountedWrongUSB(); 173 204 /* API: Beta warnings: */ 174 205 void showBETAWarning(); 175 206 void showBEBWarning(); 176 207 177 #ifdef Q_WS_X11 178 void cannotFindLicenseFiles(const QString &strPath); 179 #endif 180 void cannotOpenLicenseFile(QWidget *pParent, const QString &strPath); 181 182 void cannotOpenURL(const QString &strUrl); 183 184 void cannotFindLanguage(const QString &strLangId, const QString &strNlsPath); 185 void cannotLoadLanguage(const QString &strLangFile); 186 208 /* API: Common startup warnings: */ 209 void cannotRunInSelectorMode(); 210 #ifdef RT_OS_LINUX 211 void checkForMountedWrongUSB(); 212 #endif /* RT_OS_LINUX */ 213 214 /* API: COM startup warnings: */ 187 215 void cannotInitCOM(HRESULT rc); 188 216 void cannotInitUserHome(const QString &strUserHome); 189 217 void cannotCreateVirtualBox(const CVirtualBox &vbox); 190 218 219 /* API: Lincensing warnings: */ 220 #ifdef Q_WS_X11 221 void cannotFindLicenseFiles(const QString &strPath); 222 #endif /* Q_WS_X11 */ 223 void cannotOpenLicenseFile(QWidget *pParent, const QString &strPath); 224 225 /* API: Global warnings: */ 226 void cannotFindLanguage(const QString &strLangId, const QString &strNlsPath); 227 void cannotLoadLanguage(const QString &strLangFile); 191 228 void cannotLoadGlobalConfig(const CVirtualBox &vbox, const QString &strError); 192 229 void cannotSaveGlobalConfig(const CVirtualBox &vbox); 193 230 void cannotSetSystemProperties(const CSystemProperties &props); 194 195 void cannotAccessUSB(const COMBaseWithEI &object); 196 197 void cannotCreateMachine(const CVirtualBox &vbox, QWidget *pParent = 0); 198 void cannotCreateMachine(const CVirtualBox &vbox, const CMachine &machine, QWidget *pParent = 0); 199 231 void cannotFindMachineByName(const CVirtualBox &vbox, const QString &name); 232 void cannotOpenSession(const CSession &session); 233 void cannotOpenSession(const CVirtualBox &vbox, const CMachine &machine, const CProgress &progress = CProgress()); 234 void cannotOpenSession(const CMachine &machine); 235 void cannotGetMediaAccessibility(const UIMedium &aMedium); 236 void cannotOpenURL(const QString &strUrl); 237 238 /* API: Selector warnings: */ 200 239 void cannotOpenMachine(QWidget *pParent, const QString &strMachinePath, const CVirtualBox &vbox); 201 void cannotRegisterMachine(const CVirtualBox &vbox, const CMachine &machine, QWidget *pParent);202 240 void cannotReregisterMachine(QWidget *pParent, const QString &strMachinePath, const QString &strMachineName); 203 void cannotApplyMachineSettings(const CMachine &machine, const COMResult &res);204 void cannotSaveMachineSettings(const CMachine &machine, QWidget *pParent = 0);205 void cannotLoadMachineSettings(const CMachine &machine, bool fStrict = true, QWidget *pParent = 0);206 207 bool confirmedSettingsReloading(QWidget *pParent);208 void warnAboutStateChange(QWidget *pParent);209 210 void cannotStartMachine(const CConsole &console);211 void cannotStartMachine(const CProgress &progress);212 void cannotPauseMachine(const CConsole &console);213 void cannotResumeMachine(const CConsole &console);214 void cannotACPIShutdownMachine(const CConsole &console);215 void cannotSaveMachineState(const CConsole &console);216 void cannotSaveMachineState(const CProgress &progress);217 void cannotCreateClone(const CMachine &machine, QWidget *pParent = 0);218 void cannotCreateClone(const CMachine &machine, const CProgress &progress, QWidget *pParent = 0);219 void cannotTakeSnapshot(const CConsole &console);220 void cannotTakeSnapshot(const CProgress &progress);221 void cannotStopMachine(const CConsole &console);222 void cannotStopMachine(const CProgress &progress);223 241 void cannotDeleteMachine(const CMachine &machine); 224 242 void cannotDeleteMachine(const CMachine &machine, const CProgress &progress); 225 243 void cannotDiscardSavedState(const CConsole &console); 226 227 void cannotSendACPIToMachine(); 228 229 bool warnAboutVirtNotEnabled64BitsGuest(bool fHWVirtExSupported); 230 bool warnAboutVirtNotEnabledGuestRequired(bool fHWVirtExSupported); 231 244 void notifyAboutCollisionOnGroupRemovingCantBeResolved(const QString &strName, const QString &strGroupName); 245 int askAboutCollisionOnGroupRemoving(const QString &strName, const QString &strGroupName); 246 int confirmMachineItemRemoval(const QStringList &names); 247 int confirmMachineDeletion(const QList<CMachine> &machines); 248 bool confirmDiscardSavedState(const QString &strNames); 249 void cannotSetGroups(const CMachine &machine); 250 bool remindAboutInaccessibleMedia(); 251 bool confirmVMReset(const QString &strNames); 252 bool confirmVMACPIShutdown(const QString &strNames); 253 bool confirmVMPowerOff(const QString &strNames); 254 255 /* API: Snapshot warnings: */ 232 256 int askAboutSnapshotRestoring(const QString &strSnapshotName, bool fAlsoCreateNewSnapshot); 233 257 bool askAboutSnapshotDeleting(const QString &strSnapshotName); … … 242 266 void cannotFindSnapshotByName(QWidget *pParent, const CMachine &machine, const QString &strMachine) const; 243 267 244 void cannotFindMachineByName(const CVirtualBox &vbox, const QString &name); 245 246 void cannotEnterSeamlessMode(ULONG uWidth, ULONG uHeight, 247 ULONG uBpp, ULONG64 uMinVRAM); 248 int cannotEnterFullscreenMode(ULONG uWidth, ULONG uHeight, 249 ULONG uBpp, ULONG64 uMinVRAM); 250 bool cannotStartWithoutNetworkIf(const QString &strMachineName, const QString &strIfNames); 251 void cannotSwitchScreenInSeamless(quint64 uMinVRAM); 252 int cannotSwitchScreenInFullscreen(quint64 uMinVRAM); 253 int cannotEnterFullscreenMode(); 254 int cannotEnterSeamlessMode(); 255 256 void notifyAboutCollisionOnGroupRemovingCantBeResolved(const QString &strName, const QString &strGroupName); 257 int askAboutCollisionOnGroupRemoving(const QString &strName, const QString &strGroupName); 258 int confirmMachineItemRemoval(const QStringList &names); 259 int confirmMachineDeletion(const QList<CMachine> &machines); 260 bool confirmDiscardSavedState(const QString &strNames); 261 262 void cannotSetGroups(const CMachine &machine); 263 268 /* API: Settings warnings: */ 269 void cannotAccessUSB(const COMBaseWithEI &object); 270 void cannotLoadMachineSettings(const CMachine &machine, bool fStrict = true, QWidget *pParent = 0); 271 void cannotSaveMachineSettings(const CMachine &machine, QWidget *pParent = 0); 272 void warnAboutStateChange(QWidget *pParent); 273 bool confirmSettingsReloading(QWidget *pParent); 274 int askAboutHardDiskAttachmentCreation(QWidget *pParent, const QString &strControllerName); 275 int askAboutOpticalAttachmentCreation(QWidget *pParent, const QString &strControllerName); 276 int askAboutFloppyAttachmentCreation(QWidget *pParent, const QString &strControllerName); 277 int confirmRemovingOfLastDVDDevice() const; 278 int confirmDeletingHostInterface(const QString &strName, QWidget *pParent = 0); 279 void warnAboutIncorrectPort(QWidget *pParent) const; 280 bool confirmCancelingPortForwardingDialog(QWidget *pParent) const; 281 282 /* API: Virtual Medium Manager warnings: */ 264 283 void cannotChangeMediumType(QWidget *pParent, const CMedium &medium, KMediumType oldMediumType, KMediumType newMediumType); 265 266 284 bool confirmReleaseMedium(QWidget *pParent, const UIMedium &aMedium, 267 285 const QString &strUsage); 268 269 286 bool confirmRemoveMedium(QWidget *pParent, const UIMedium &aMedium); 270 271 void sayCannotOverwriteHardDiskStorage(QWidget *pParent,272 const QString &strLocation);273 287 int confirmDeleteHardDiskStorage(QWidget *pParent, 274 288 const QString &strLocation); 275 289 void cannotDeleteHardDiskStorage(QWidget *pParent, const CMedium &medium, 276 290 const CProgress &progress); 277 278 int askAboutHardDiskAttachmentCreation(QWidget *pParent, const QString &strControllerName);279 int askAboutOpticalAttachmentCreation(QWidget *pParent, const QString &strControllerName);280 int askAboutFloppyAttachmentCreation(QWidget *pParent, const QString &strControllerName);281 282 int confirmRemovingOfLastDVDDevice() const;283 284 void cannotCreateHardDiskStorage(QWidget *pParent, const CVirtualBox &vbox,285 const QString &strLocation,286 const CMedium &medium,287 const CProgress &progress);288 291 void cannotDetachDevice(QWidget *pParent, const CMachine &machine, 289 292 UIMediumType type, const QString &strLocation, const StorageSlot &storageSlot); 290 291 293 int cannotRemountMedium(QWidget *pParent, const CMachine &machine, const UIMedium &aMedium, bool fMount, bool fRetry); 292 294 void cannotOpenMedium(QWidget *pParent, const CVirtualBox &vbox, … … 295 297 const COMResult &rc); 296 298 297 void cannotOpenSession(const CSession &session); 298 void cannotOpenSession(const CVirtualBox &vbox, const CMachine &machine, 299 const CProgress &progress = CProgress()); 300 void cannotOpenSession(const CMachine &machine); 301 302 void cannotGetMediaAccessibility(const UIMedium &aMedium); 303 304 int confirmDeletingHostInterface(const QString &strName, QWidget *pParent = 0); 305 299 /* API: Wizards warnings: */ 300 void cannotCreateMachine(const CVirtualBox &vbox, QWidget *pParent = 0); 301 void cannotCreateMachine(const CVirtualBox &vbox, const CMachine &machine, QWidget *pParent = 0); 302 void cannotRegisterMachine(const CVirtualBox &vbox, const CMachine &machine, QWidget *pParent); 303 void cannotCreateClone(const CMachine &machine, QWidget *pParent = 0); 304 void cannotCreateClone(const CMachine &machine, const CProgress &progress, QWidget *pParent = 0); 305 void cannotOverwriteHardDiskStorage(QWidget *pParent, const QString &strLocation); 306 void cannotCreateHardDiskStorage(QWidget *pParent, const CVirtualBox &vbox, const QString &strLocation, 307 const CMedium &medium, const CProgress &progress); 308 void warnAboutCannotRemoveMachineFolder(QWidget *pParent, const QString &strFolderName); 309 void warnAboutCannotRewriteMachineFolder(QWidget *pParent, const QString &strFolderName); 310 void warnAboutCannotCreateMachineFolder(QWidget *pParent, const QString &strFolderName); 311 bool confirmHardDisklessMachine(QWidget *pParent); 312 void cannotImportAppliance(CAppliance *pAppliance, QWidget *pParent = NULL) const; 313 void cannotImportAppliance(const CProgress &progress, CAppliance *pAppliance, QWidget *pParent = NULL) const; 314 void cannotCheckFiles(const CProgress &progress, QWidget *pParent = NULL) const; 315 void cannotRemoveFiles(const CProgress &progress, QWidget *pParent = NULL) const; 316 bool confirmExportMachinesInSaveState(const QStringList &strMachineNames, QWidget *pParent = NULL) const; 317 void cannotExportAppliance(CAppliance *pAppliance, QWidget *pParent = NULL) const; 318 void cannotExportAppliance(const CMachine &machine, CAppliance *pAppliance, QWidget *pParent = NULL) const; 319 void cannotExportAppliance(const CProgress &progress, CAppliance *pAppliance, QWidget *pParent = NULL) const; 320 321 /* API: Runtime UI warnings: */ 322 void showRuntimeError(const CConsole &console, bool fFatal, 323 const QString &strErrorId, 324 const QString &strErrorMsg) const; 325 bool warnAboutVirtNotEnabled64BitsGuest(bool fHWVirtExSupported); 326 bool warnAboutVirtNotEnabledGuestRequired(bool fHWVirtExSupported); 327 bool cannotStartWithoutNetworkIf(const QString &strMachineName, const QString &strIfNames); 328 void cannotStartMachine(const CConsole &console); 329 void cannotStartMachine(const CProgress &progress); 330 void cannotPauseMachine(const CConsole &console); 331 void cannotResumeMachine(const CConsole &console); 332 void cannotACPIShutdownMachine(const CConsole &console); 333 void cannotSaveMachineState(const CConsole &console); 334 void cannotSaveMachineState(const CProgress &progress); 335 void cannotTakeSnapshot(const CConsole &console); 336 void cannotTakeSnapshot(const CProgress &progress); 337 void cannotStopMachine(const CConsole &console); 338 void cannotStopMachine(const CProgress &progress); 339 void cannotSendACPIToMachine(); 340 bool confirmInputCapture(bool *pfAutoConfirmed = NULL); 341 void remindAboutAutoCapture(); 342 void remindAboutMouseIntegration(bool fSupportsAbsolute); 343 bool remindAboutPausedVMInput(); 344 void cannotEnterSeamlessMode(ULONG uWidth, ULONG uHeight, 345 ULONG uBpp, ULONG64 uMinVRAM); 346 int cannotEnterFullscreenMode(ULONG uWidth, ULONG uHeight, 347 ULONG uBpp, ULONG64 uMinVRAM); 348 void cannotSwitchScreenInSeamless(quint64 uMinVRAM); 349 int cannotSwitchScreenInFullscreen(quint64 uMinVRAM); 350 bool confirmGoingFullscreen(const QString &strHotKey); 351 bool confirmGoingSeamless(const QString &strHotKey); 352 bool confirmGoingScale(const QString &strHotKey); 306 353 void cannotAttachUSBDevice(const CConsole &console, const QString &device); 307 354 void cannotAttachUSBDevice(const CConsole &console, const QString &device, … … 310 357 void cannotDetachUSBDevice(const CConsole &console, const QString &device, 311 358 const CVirtualBoxErrorInfo &error); 312 313 359 void remindAboutGuestAdditionsAreNotActive(QWidget *pParent); 360 void cannotMountGuestAdditions(const QString &strMachineName); 361 bool remindAboutGuruMeditation(const CConsole &console, const QString &strLogFolder); 362 363 /* API: Network management warnings: */ 364 bool askAboutCancelAllNetworkRequest(QWidget *pParent); 365 void showUpdateSuccess(const QString &strVersion, const QString &strLink); 366 void showUpdateNotFound(); 367 368 /* API: Downloading warnings: */ 314 369 bool cannotFindGuestAdditions(); 315 void cannotMountGuestAdditions(const QString &strMachineName);316 370 bool confirmDownloadAdditions(const QString &strUrl, qulonglong uSize); 317 371 bool confirmMountAdditions(const QString &strUrl, const QString &strSrc); 318 372 void warnAboutAdditionsCantBeSaved(const QString &strTarget); 319 320 373 bool askAboutUserManualDownload(const QString &strMissedLocation); 321 374 bool confirmUserManualDownload(const QString &strURL, qulonglong uSize); 322 375 void warnAboutUserManualDownloaded(const QString &strURL, const QString &strTarget); 323 376 void warnAboutUserManualCantBeSaved(const QString &strURL, const QString &strTarget); 324 325 377 bool proposeDownloadExtensionPack(const QString &strExtPackName, const QString &strExtPackVersion); 326 378 bool requestUserDownloadExtensionPack(const QString &strExtPackName, const QString &strExtPackVersion, const QString &strVBoxVersion); … … 328 380 bool proposeInstallExtentionPack(const QString &strExtPackName, const QString &strFrom, const QString &strTo); 329 381 void warnAboutExtentionPackCantBeSaved(const QString &strExtPackName, const QString &strFrom, const QString &strTo); 330 331 void showUpdateSuccess(const QString &strVersion, const QString &strLink);332 void showUpdateNotFound();333 334 bool askAboutCancelAllNetworkRequest(QWidget *pParent);335 336 bool confirmInputCapture(bool *pfAutoConfirmed = NULL);337 void remindAboutAutoCapture();338 void remindAboutMouseIntegration(bool fSupportsAbsolute);339 bool remindAboutPausedVMInput();340 341 int warnAboutSettingsAutoConversion(const QString &strFileList, bool fAfterRefresh);342 343 bool remindAboutInaccessibleMedia();344 345 bool confirmGoingFullscreen(const QString &strHotKey);346 bool confirmGoingSeamless(const QString &strHotKey);347 bool confirmGoingScale(const QString &strHotKey);348 349 bool remindAboutGuruMeditation(const CConsole &console,350 const QString &strLogFolder);351 352 bool confirmVMReset(const QString &strNames);353 bool confirmVMACPIShutdown(const QString &strNames);354 bool confirmVMPowerOff(const QString &strNames);355 356 void warnAboutCannotRemoveMachineFolder(QWidget *pParent, const QString &strFolderName);357 void warnAboutCannotRewriteMachineFolder(QWidget *pParent, const QString &strFolderName);358 void warnAboutCannotCreateMachineFolder(QWidget *pParent, const QString &strFolderName);359 bool confirmHardDisklessMachine(QWidget *pParent);360 361 void cannotRunInSelectorMode();362 363 void cannotImportAppliance(CAppliance *pAppliance, QWidget *pParent = NULL) const;364 void cannotImportAppliance(const CProgress &progress, CAppliance *pAppliance, QWidget *pParent = NULL) const;365 366 void cannotCheckFiles(const CProgress &progress, QWidget *pParent = NULL) const;367 void cannotRemoveFiles(const CProgress &progress, QWidget *pParent = NULL) const;368 369 bool confirmExportMachinesInSaveState(const QStringList &strMachineNames, QWidget *pParent = NULL) const;370 void cannotExportAppliance(CAppliance *pAppliance, QWidget *pParent = NULL) const;371 void cannotExportAppliance(const CMachine &machine, CAppliance *pAppliance, QWidget *pParent = NULL) const;372 void cannotExportAppliance(const CProgress &progress, CAppliance *pAppliance, QWidget *pParent = NULL) const;373 374 382 void cannotUpdateGuestAdditions(const CProgress &progress, QWidget *pParent /* = NULL */) const; 375 376 383 void cannotOpenExtPack(const QString &strFilename, const CExtPackManager &extPackManager, QWidget *pParent); 377 384 void badExtPackFile(const QString &strFilename, const CExtPackFile &extPackFile, QWidget *pParent); … … 384 391 void notifyAboutExtPackInstalled(const QString &strPackName, QWidget *pParent); 385 392 386 void warnAboutIncorrectPort(QWidget *pParent) const; 387 bool confirmCancelingPortForwardingDialog(QWidget *pParent) const; 388 389 void showRuntimeError(const CConsole &console, bool fFatal, 390 const QString &strErrorId, 391 const QString &strErrorMsg) const; 392 393 /* Helpers: */ 393 394 static QString mediumToAccusative(UIMediumType type, bool fIsHostDrive = false); 394 395 395 396 static QString formatRC(HRESULT rc); 396 397 static QString formatErrorInfo(const COMErrorInfo &info, 398 HRESULT wrapperRC = S_OK); 399 400 static QString formatErrorInfo(const CVirtualBoxErrorInfo &info) 401 { 402 return formatErrorInfo(COMErrorInfo(info)); 403 } 404 405 static QString formatErrorInfo(const COMBaseWithEI &wrapper) 406 { 407 Assert(wrapper.lastRC() != S_OK); 408 return formatErrorInfo(wrapper.errorInfo(), wrapper.lastRC()); 409 } 410 411 static QString formatErrorInfo(const COMResult &rc) 412 { 413 Assert(rc.rc() != S_OK); 414 return formatErrorInfo(rc.errorInfo(), rc.rc()); 415 } 416 417 void showGenericError(COMBaseWithEI *object, QWidget *pParent = 0); 397 static QString formatErrorInfo(const COMErrorInfo &info, HRESULT wrapperRC = S_OK); 398 static QString formatErrorInfo(const CVirtualBoxErrorInfo &info); 399 static QString formatErrorInfo(const COMBaseWithEI &wrapper); 400 static QString formatErrorInfo(const COMResult &rc); 418 401 419 402 /* Stuff supporting interthreading: */ … … 439 422 void remindAboutUnsupportedUSB2(const QString &strExtPackName, QWidget *pParent = 0); 440 423 441 signals:442 443 void sigToCloseAllWarnings();444 445 /* Stuff supporting interthreading: */446 void sigCannotCreateHostInterface(const CHost &host, QWidget *pParent);447 void sigCannotCreateHostInterface(const CProgress &progress, QWidget *pParent);448 void sigCannotRemoveHostInterface(const CHost &host, const CHostNetworkInterface &iface, QWidget *pParent);449 void sigCannotRemoveHostInterface(const CProgress &progress, const CHostNetworkInterface &iface, QWidget *pParent);450 void sigCannotAttachDevice(const CMachine &machine, UIMediumType type,451 const QString &strLocation, const StorageSlot &storageSlot, QWidget *pParent);452 void sigCannotCreateSharedFolder(const CMachine &machine, const QString &strName,453 const QString &strPath, QWidget *pParent);454 void sigCannotRemoveSharedFolder(const CMachine &machine, const QString &strName,455 const QString &strPath, QWidget *pParent);456 void sigCannotCreateSharedFolder(const CConsole &console, const QString &strName,457 const QString &strPath, QWidget *pParent);458 void sigCannotRemoveSharedFolder(const CConsole &console, const QString &strName,459 const QString &strPath, QWidget *pParent);460 void sigRemindAboutWrongColorDepth(ulong uRealBPP, ulong uWantedBPP);461 void sigRemindAboutUnsupportedUSB2(const QString &strExtPackName, QWidget *pParent);462 463 424 public slots: 464 425 … … 491 452 private: 492 453 454 /* Constructor: */ 493 455 UIMessageCenter(); 494 456 457 /* Instance stuff: */ 495 458 static UIMessageCenter &instance(); 496 497 459 friend UIMessageCenter &msgCenter(); 498 460 499 static QString errorInfoToString(const COMErrorInfo &info,500 461 /* Helper: */ 462 static QString errorInfoToString(const COMErrorInfo &info, HRESULT wrapperRC = S_OK); 501 463 502 464 /* Variables: */ -
trunk/src/VBox/Frontends/VirtualBox/src/main.cpp
r45183 r45233 472 472 return 0; 473 473 474 #ifdef RT_OS_LINUX 474 475 msgCenter().checkForMountedWrongUSB(); 476 #endif /* RT_OS_LINUX */ 475 477 476 478 VBoxGlobalSettings settings = vboxGlobal().settings(); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.cpp
r44982 r45233 52 52 /* Temporary get a machine object: */ 53 53 const CMachine &machine = uisession()->session().GetMachine(); 54 55 #if 056 /* Check that there are enough physical screens are connected: */57 int cHostScreens = m_pScreenLayout->hostScreenCount();58 int cGuestScreens = m_pScreenLayout->guestScreenCount();59 if (cHostScreens < cGuestScreens)60 {61 msgCenter().cannotEnterFullscreenMode();62 return false;63 }64 #endif65 54 66 55 /* Check if there is enough physical memory to enter fullscreen: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineLogicSeamless.cpp
r44982 r45233 50 50 /* Temporary get a machine object: */ 51 51 const CMachine &machine = uisession()->session().GetMachine(); 52 53 #if 054 /* Check that there are enough physical screens are connected: */55 int cHostScreens = m_pScreenLayout->hostScreenCount();56 int cGuestScreens = m_pScreenLayout->guestScreenCount();57 if (cHostScreens < cGuestScreens)58 {59 msgCenter().cannotEnterSeamlessMode();60 return false;61 }62 #endif63 52 64 53 /* Check if there is enough physical memory to enter seamless: */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.cpp
r45198 r45233 1057 1057 1058 1058 /* Check if user had changed something and warn him about he will loose settings on reloading: */ 1059 if (isSettingsChanged() && !msgCenter().confirm edSettingsReloading(this))1059 if (isSettingsChanged() && !msgCenter().confirmSettingsReloading(this)) 1060 1060 return; 1061 1061 -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageBasic4.cpp
r41587 r45233 234 234 fResult = !QFileInfo(strMediumPath).exists(); 235 235 if (!fResult) 236 msgCenter(). sayCannotOverwriteHardDiskStorage(this, strMediumPath);236 msgCenter().cannotOverwriteHardDiskStorage(this, strMediumPath); 237 237 238 238 if (fResult) -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/clonevd/UIWizardCloneVDPageExpert.cpp
r45080 r45233 263 263 fResult = !QFileInfo(strMediumPath).exists(); 264 264 if (!fResult) 265 msgCenter(). sayCannotOverwriteHardDiskStorage(this, strMediumPath);265 msgCenter().cannotOverwriteHardDiskStorage(this, strMediumPath); 266 266 267 267 /* Try to copy virtual-disk: */ -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageBasic3.cpp
r41833 r45233 398 398 fResult = !QFileInfo(strMediumPath).exists(); 399 399 if (!fResult) 400 msgCenter(). sayCannotOverwriteHardDiskStorage(this, strMediumPath);400 msgCenter().cannotOverwriteHardDiskStorage(this, strMediumPath); 401 401 402 402 if (fResult) -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/newvd/UIWizardNewVDPageExpert.cpp
r45080 r45233 277 277 fResult = !QFileInfo(strMediumPath).exists(); 278 278 if (!fResult) 279 msgCenter(). sayCannotOverwriteHardDiskStorage(this, strMediumPath);279 msgCenter().cannotOverwriteHardDiskStorage(this, strMediumPath); 280 280 281 281 /* Try to create virtual-disk: */
Note:
See TracChangeset
for help on using the changeset viewer.