Changeset 45358 in vbox for trunk/src/VBox
- Timestamp:
- Apr 5, 2013 8:56:49 AM (12 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/VBoxLicenseViewer.cpp
r44528 r45358 80 80 else 81 81 { 82 msgCenter().cannotOpenLicenseFile( this, strLicenseFileName);82 msgCenter().cannotOpenLicenseFile(strLicenseFileName, this); 83 83 return QDialog::Rejected; 84 84 } -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp
r45346 r45358 87 87 const QString &strMessage, 88 88 const QString &strDetails /* = QString() */, 89 const char *pcszAutoConfirmId /* = 0*/,90 int iButton1 /* = 0*/,91 int iButton2 /* = 0*/,92 int iButton3 /* = 0*/,89 const char *pcszAutoConfirmId /*= 0*/, 90 int iButton1 /*= 0*/, 91 int iButton2 /*= 0*/, 92 int iButton3 /*= 0*/, 93 93 const QString &strButtonText1 /* = QString() */, 94 94 const QString &strButtonText2 /* = QString() */, … … 121 121 bool fDefaultOptionValue /* = true */, 122 122 const QString &strDetails /* = QString() */, 123 int iButton1 /* = 0*/,124 int iButton2 /* = 0*/,125 int iButton3 /* = 0*/,123 int iButton1 /*= 0*/, 124 int iButton2 /*= 0*/, 125 int iButton3 /*= 0*/, 126 126 const QString &strButtonName1 /* = QString() */, 127 127 const QString &strButtonName2 /* = QString() */, … … 208 208 const QString &strTitle, 209 209 const QString &strImage /* = "" */, 210 QWidget *pParent /* = 0*/,210 QWidget *pParent /*= 0*/, 211 211 int cMinDuration /* = 2000 */) 212 212 { … … 607 607 } 608 608 609 bool UIMessageCenter:: remindAboutInaccessibleMedia() const609 bool UIMessageCenter::warnAboutInaccessibleMedia() const 610 610 { 611 611 return messageOkCancel(mainWindowShown(), MessageType_Warning, … … 617 617 "see what media are inaccessible, or press <b>Ignore</b> to " 618 618 "ignore this message.</p>"), 619 " remindAboutInaccessibleMedia",619 "warnAboutInaccessibleMedia", 620 620 tr("Check", "inaccessible media message box"), tr("Cancel"), false); 621 621 } … … 851 851 } 852 852 853 void UIMessageCenter::cannotAccessUSB(const COMBaseWithEI &object) const 854 { 855 /* If IMachine::GetUSBController(), IHost::GetUSBDevices() etc. return 856 * E_NOTIMPL, it means the USB support is intentionally missing 857 * (as in the OSE version). Don't show the error message in this case. */ 858 COMResult res(object); 859 if (res.rc() == E_NOTIMPL) 860 return; 861 /* Show the message: */ 862 message(mainWindowShown(), res.isWarning() ? MessageType_Warning : MessageType_Error, 863 tr("Failed to access the USB subsystem."), 864 formatErrorInfo(res), 865 "cannotAccessUSB"); 866 } 867 868 void UIMessageCenter::cannotSetSystemProperties(const CSystemProperties &properties) const 869 { 870 message(mainWindowShown(), MessageType_Critical, 871 tr("Failed to set global VirtualBox properties."), 872 formatErrorInfo(properties)); 873 } 874 875 void UIMessageCenter::cannotSaveMachineSettings(const CMachine &machine, QWidget *pParent /*= 0*/) const 876 { 877 /* Preserve error-info: */ 878 COMResult res(machine); 879 /* Show the message: */ 880 message(pParent ? pParent : mainWindowShown(), MessageType_Error, 881 tr("Failed to save the settings of the virtual machine <b>%1</b> to <b><nobr>%2</nobr></b>.") 882 .arg(machine.GetName(), machine.GetSettingsFilePath()), 883 formatErrorInfo(res)); 884 } 885 886 void UIMessageCenter::warnAboutStateChange(QWidget *pParent /*= 0*/) const 887 { 888 /* Do not show this async warning more than one at time: */ 889 if (warningShown("warnAboutStateChange")) 890 return; 891 setWarningShown("warnAboutStateChange", true); 892 /* Show the message: */ 893 message(pParent ? pParent : mainWindowShown(), MessageType_Warning, 894 tr("The virtual machine that you are changing has been started. " 895 "Only certain settings can be changed while a machine is running. " 896 "All other changes will be lost if you close this window now.")); 897 /* Allow to show this async warning: */ 898 setWarningShown("warnAboutStateChange", false); 899 } 900 901 bool UIMessageCenter::confirmSettingsReloading(QWidget *pParent /*= 0*/) const 902 { 903 return messageOkCancel(pParent ? pParent : mainWindowShown(), MessageType_Question, 904 tr("<p>The machine settings were changed while you were editing them. " 905 "You currently have unsaved setting changes.</p>" 906 "<p>Would you like to reload the changed settings or to keep your own changes?</p>"), 907 0 /* auto-confirm id */, 908 tr("Reload settings"), tr("Keep changes")); 909 } 910 911 bool UIMessageCenter::confirmDeletingHostInterface(const QString &strName, QWidget *pParent /*= 0*/) const 853 bool UIMessageCenter::confirmHostInterfaceRemoval(const QString &strName, QWidget *pParent /*= 0*/) const 912 854 { 913 855 return messageOkCancel(pParent ? pParent : mainWindowShown(), MessageType_Question, … … 925 867 } 926 868 927 int UIMessageCenter::askAboutHardDiskAttachmentCreation(const QString &strControllerName, QWidget *pParent /*= 0*/) const 869 void UIMessageCenter::cannotCreateHostInterface(const CHost &host, QWidget *pParent /*= 0*/) 870 { 871 message(pParent ? pParent : mainWindowShown(), MessageType_Error, 872 tr("Failed to create the host network interface."), 873 formatErrorInfo(host)); 874 } 875 876 void UIMessageCenter::cannotCreateHostInterface(const CProgress &progress, QWidget *pParent /*= 0*/) 877 { 878 message(pParent ? pParent : mainWindowShown(), MessageType_Error, 879 tr("Failed to create the host network interface."), 880 !progress.isOk() ? formatErrorInfo(progress) : formatErrorInfo(progress.GetErrorInfo())); 881 } 882 883 void UIMessageCenter::cannotRemoveHostInterface(const CHost &host, const QString &strName, QWidget *pParent /*= 0*/) 884 { 885 message(pParent ? pParent : mainWindowShown(), MessageType_Error, 886 tr("Failed to remove the host network interface <b>%1</b>.") 887 .arg(strName), 888 formatErrorInfo(host)); 889 } 890 891 void UIMessageCenter::cannotRemoveHostInterface(const CProgress &progress, const QString &strName, QWidget *pParent /*= 0*/) 892 { 893 message(pParent ? pParent : mainWindowShown(), MessageType_Error, 894 tr("Failed to remove the host network interface <b>%1</b>.") 895 .arg(strName), 896 !progress.isOk() ? formatErrorInfo(progress) : formatErrorInfo(progress.GetErrorInfo())); 897 } 898 899 void UIMessageCenter::cannotSetSystemProperties(const CSystemProperties &properties, QWidget *pParent /*= 0*/) const 900 { 901 message(pParent ? pParent : mainWindowShown(), MessageType_Critical, 902 tr("Failed to set global VirtualBox properties."), 903 formatErrorInfo(properties)); 904 } 905 906 void UIMessageCenter::warnAboutUnaccessibleUSB(const COMBaseWithEI &object, QWidget *pParent /*= 0*/) const 907 { 908 /* If IMachine::GetUSBController(), IHost::GetUSBDevices() etc. return 909 * E_NOTIMPL, it means the USB support is intentionally missing 910 * (as in the OSE version). Don't show the error message in this case. */ 911 COMResult res(object); 912 if (res.rc() == E_NOTIMPL) 913 return; 914 /* Show the message: */ 915 message(pParent ? pParent : mainWindowShown(), res.isWarning() ? MessageType_Warning : MessageType_Error, 916 tr("Failed to access the USB subsystem."), 917 formatErrorInfo(res), 918 "warnAboutUnaccessibleUSB"); 919 } 920 921 void UIMessageCenter::warnAboutUnsupportedUSB2(const QString &strExtPackName, QWidget *pParent) 922 { 923 if (warningShown("warnAboutUnsupportedUSB2")) 924 return; 925 setWarningShown("warnAboutUnsupportedUSB2", true); 926 927 message(pParent ? pParent : mainMachineWindowShown(), MessageType_Warning, 928 tr("<p>USB 2.0 is currently enabled for this virtual machine. " 929 "However, this requires the <b><nobr>%1</nobr></b> to be installed.</p>" 930 "<p>Please install the Extension Pack from the VirtualBox download site. " 931 "After this you will be able to re-enable USB 2.0. " 932 "It will be disabled in the meantime unless you cancel the current settings changes.</p>") 933 .arg(strExtPackName)); 934 935 setWarningShown("warnAboutUnsupportedUSB2", false); 936 } 937 938 void UIMessageCenter::warnAboutStateChange(QWidget *pParent /*= 0*/) const 939 { 940 /* Do not show this async warning more than one at time: */ 941 if (warningShown("warnAboutStateChange")) 942 return; 943 setWarningShown("warnAboutStateChange", true); 944 /* Show the message: */ 945 message(pParent ? pParent : mainWindowShown(), MessageType_Warning, 946 tr("The virtual machine that you are changing has been started. " 947 "Only certain settings can be changed while a machine is running. " 948 "All other changes will be lost if you close this window now.")); 949 /* Allow to show this async warning: */ 950 setWarningShown("warnAboutStateChange", false); 951 } 952 953 bool UIMessageCenter::confirmSettingsReloading(QWidget *pParent /*= 0*/) const 954 { 955 return messageOkCancel(pParent ? pParent : mainWindowShown(), MessageType_Question, 956 tr("<p>The machine settings were changed while you were editing them. " 957 "You currently have unsaved setting changes.</p>" 958 "<p>Would you like to reload the changed settings or to keep your own changes?</p>"), 959 0 /* auto-confirm id */, 960 tr("Reload settings"), tr("Keep changes")); 961 } 962 963 int UIMessageCenter::confirmHardDiskAttachmentCreation(const QString &strControllerName, QWidget *pParent /*= 0*/) const 928 964 { 929 965 return message(pParent ? pParent : mainWindowShown(), MessageType_Question, … … 939 975 } 940 976 941 int UIMessageCenter:: askAboutOpticalAttachmentCreation(const QString &strControllerName, QWidget *pParent /*= 0*/) const977 int UIMessageCenter::confirmOpticalAttachmentCreation(const QString &strControllerName, QWidget *pParent /*= 0*/) const 942 978 { 943 979 return message(pParent ? pParent : mainWindowShown(), MessageType_Question, … … 954 990 } 955 991 956 int UIMessageCenter:: askAboutFloppyAttachmentCreation(const QString &strControllerName, QWidget *pParent /*= 0*/) const992 int UIMessageCenter::confirmFloppyAttachmentCreation(const QString &strControllerName, QWidget *pParent /*= 0*/) const 957 993 { 958 994 return message(pParent ? pParent : mainWindowShown(), MessageType_Question, … … 979 1015 } 980 1016 1017 void UIMessageCenter::cannotAttachDevice(const CMachine &machine, UIMediumType type, 1018 const QString &strLocation, const StorageSlot &storageSlot, 1019 QWidget *pParent /*= 0*/) 1020 { 1021 QString strMessage; 1022 switch (type) 1023 { 1024 case UIMediumType_HardDisk: 1025 { 1026 strMessage = tr("Failed to attach the hard disk (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.") 1027 .arg(strLocation).arg(gpConverter->toString(storageSlot)).arg(CMachine(machine).GetName()); 1028 break; 1029 } 1030 case UIMediumType_DVD: 1031 { 1032 strMessage = tr("Failed to attach the CD/DVD device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.") 1033 .arg(strLocation).arg(gpConverter->toString(storageSlot)).arg(CMachine(machine).GetName()); 1034 break; 1035 } 1036 case UIMediumType_Floppy: 1037 { 1038 strMessage = tr("Failed to attach the floppy device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.") 1039 .arg(strLocation).arg(gpConverter->toString(storageSlot)).arg(CMachine(machine).GetName()); 1040 break; 1041 } 1042 default: 1043 break; 1044 } 1045 message(pParent ? pParent : mainWindowShown(), MessageType_Error, strMessage, formatErrorInfo(machine)); 1046 } 1047 981 1048 void UIMessageCenter::warnAboutIncorrectPort(QWidget *pParent /*= 0*/) const 982 1049 { … … 991 1058 tr("<p>There are unsaved changes in the port forwarding configuration.</p>" 992 1059 "<p>If you proceed your changes will be discarded.</p>")); 1060 } 1061 1062 void UIMessageCenter::cannotCreateSharedFolder(const CMachine &machine, const QString &strMachineName, 1063 const QString &strName, const QString &strPath, 1064 QWidget *pParent /*= 0*/) 1065 { 1066 message(pParent ? pParent : mainMachineWindowShown(), MessageType_Error, 1067 tr("Failed to create the shared folder <b>%1</b> (pointing to " 1068 "<nobr><b>%2</b></nobr>) for the virtual machine <b>%3</b>.") 1069 .arg(strName, strPath, strMachineName), 1070 formatErrorInfo(machine)); 1071 } 1072 1073 void UIMessageCenter::cannotCreateSharedFolder(const CConsole &console, const QString &strMachineName, 1074 const QString &strName, const QString &strPath, 1075 QWidget *pParent /*= 0*/) 1076 { 1077 message(pParent ? pParent : mainMachineWindowShown(), MessageType_Error, 1078 tr("Failed to create the shared folder <b>%1</b> (pointing to " 1079 "<nobr><b>%2</b></nobr>) for the virtual machine <b>%3</b>.") 1080 .arg(strName, strPath, strMachineName), 1081 formatErrorInfo(console)); 1082 } 1083 1084 void UIMessageCenter::cannotRemoveSharedFolder(const CMachine &machine, const QString &strMachineName, 1085 const QString &strName, const QString &strPath, 1086 QWidget *pParent /*= 0*/) 1087 { 1088 message(pParent ? pParent : mainMachineWindowShown(), MessageType_Error, 1089 tr("<p>Failed to remove the shared folder <b>%1</b> (pointing to " 1090 "<nobr><b>%2</b></nobr>) from the virtual machine <b>%3</b>.</p>" 1091 "<p>Please close all programs in the guest OS that " 1092 "may be using this shared folder and try again.</p>") 1093 .arg(strName, strPath, strMachineName), 1094 formatErrorInfo(machine)); 1095 } 1096 1097 void UIMessageCenter::cannotRemoveSharedFolder(const CConsole &console, const QString &strMachineName, 1098 const QString &strName, const QString &strPath, 1099 QWidget *pParent /*= 0*/) 1100 { 1101 message(pParent ? pParent : mainMachineWindowShown(), MessageType_Error, 1102 tr("<p>Failed to remove the shared folder <b>%1</b> (pointing to " 1103 "<nobr><b>%2</b></nobr>) from the virtual machine <b>%3</b>.</p>" 1104 "<p>Please close all programs in the guest OS that " 1105 "may be using this shared folder and try again.</p>") 1106 .arg(strName, strPath, strMachineName), 1107 formatErrorInfo(console)); 1108 } 1109 1110 void UIMessageCenter::cannotSaveMachineSettings(const CMachine &machine, QWidget *pParent /*= 0*/) const 1111 { 1112 /* Preserve error-info: */ 1113 COMResult res(machine); 1114 /* Show the message: */ 1115 message(pParent ? pParent : mainWindowShown(), MessageType_Error, 1116 tr("Failed to save the settings of the virtual machine <b>%1</b> to <b><nobr>%2</nobr></b>.") 1117 .arg(machine.GetName(), machine.GetSettingsFilePath()), 1118 formatErrorInfo(res)); 993 1119 } 994 1120 … … 2208 2334 } 2209 2335 2210 void UIMessageCenter::cannotOpenLicenseFile(QWidget *pParent, const QString &strPath) 2211 { 2212 message(pParent, MessageType_Error, 2213 tr("Failed to open the license file <nobr><b>%1</b></nobr>. " 2214 "Check file permissions.").arg(strPath)); 2215 } 2216 2217 bool UIMessageCenter::askForOverridingFile(const QString &strPath, QWidget *pParent /* = 0 */) 2336 #ifdef VBOX_WITH_DRAG_AND_DROP 2337 void UIMessageCenter::cannotDropData(const CGuest &guest, QWidget *pParent /*= 0*/) const 2338 { 2339 message(pParent ? pParent : mainWindowShown(), MessageType_Error, 2340 tr("Failed to drop data."), 2341 formatErrorInfo(guest)); 2342 } 2343 2344 void UIMessageCenter::cannotDropData(const CProgress &progress, QWidget *pParent /*= 0*/) const 2345 { 2346 message(pParent ? pParent : mainWindowShown(), MessageType_Error, 2347 tr("Failed to drop data."), 2348 !progress.isOk() ? formatErrorInfo(progress) : formatErrorInfo(progress.GetErrorInfo())); 2349 } 2350 #endif /* VBOX_WITH_DRAG_AND_DROP */ 2351 2352 void UIMessageCenter::cannotOpenLicenseFile(const QString &strPath, QWidget *pParent /*= 0*/) 2353 { 2354 message(pParent ? pParent : mainWindowShown(), MessageType_Error, 2355 tr("Failed to open the license file <nobr><b>%1</b></nobr>. Check file permissions.") 2356 .arg(strPath)); 2357 } 2358 2359 bool UIMessageCenter::confirmOverridingFile(const QString &strPath, QWidget *pParent /*= 0*/) 2218 2360 { 2219 2361 return messageYesNo(pParent, MessageType_Question, … … 2223 2365 } 2224 2366 2225 bool UIMessageCenter:: askForOverridingFiles(const QVector<QString> &strPaths, QWidget *pParent /* = 0*/)2367 bool UIMessageCenter::confirmOverridingFiles(const QVector<QString> &strPaths, QWidget *pParent /*= 0*/) 2226 2368 { 2227 2369 /* If it is only one file use the single question versions above: */ 2228 2370 if (strPaths.size() == 1) 2229 return askForOverridingFile(strPaths.at(0), pParent);2371 return confirmOverridingFile(strPaths.at(0), pParent); 2230 2372 else if (strPaths.size() > 1) 2231 2373 return messageYesNo(pParent, MessageType_Question, … … 2238 2380 } 2239 2381 2240 bool UIMessageCenter:: askForOverridingFileIfExists(const QString &strPath, QWidget *pParent /* = 0*/)2382 bool UIMessageCenter::confirmOverridingFileIfExists(const QString &strPath, QWidget *pParent /*= 0*/) 2241 2383 { 2242 2384 QFileInfo fi(strPath); 2243 2385 if (fi.exists()) 2244 return askForOverridingFile(strPath, pParent);2386 return confirmOverridingFile(strPath, pParent); 2245 2387 else 2246 2388 return true; 2247 2389 } 2248 2390 2249 bool UIMessageCenter:: askForOverridingFilesIfExists(const QVector<QString> &strPaths, QWidget *pParent /* = 0*/)2391 bool UIMessageCenter::confirmOverridingFilesIfExists(const QVector<QString> &strPaths, QWidget *pParent /*= 0*/) 2250 2392 { 2251 2393 QVector<QString> existingFiles; … … 2258 2400 /* If it is only one file use the single question versions above: */ 2259 2401 if (existingFiles.size() == 1) 2260 return askForOverridingFileIfExists(existingFiles.at(0), pParent);2402 return confirmOverridingFileIfExists(existingFiles.at(0), pParent); 2261 2403 else if (existingFiles.size() > 1) 2262 return askForOverridingFiles(existingFiles, pParent);2404 return confirmOverridingFiles(existingFiles, pParent); 2263 2405 else 2264 2406 return true; … … 2332 2474 } 2333 2475 2334 void UIMessageCenter::cannotCreateHostInterface(const CHost &host, QWidget *pParent /* = 0 */)2335 {2336 message(pParent ? pParent : mainWindowShown(), MessageType_Error,2337 tr("Failed to create the host-only network interface."),2338 formatErrorInfo(host));2339 }2340 2341 void UIMessageCenter::cannotCreateHostInterface(const CProgress &progress, QWidget *pParent /* = 0 */)2342 {2343 message(pParent ? pParent : mainWindowShown(), MessageType_Error,2344 tr("Failed to create the host-only network interface."),2345 formatErrorInfo(progress.GetErrorInfo()));2346 }2347 2348 void UIMessageCenter::cannotRemoveHostInterface(const CHost &host, const CHostNetworkInterface &iface, QWidget *pParent /* = 0 */)2349 {2350 message(pParent ? pParent : mainWindowShown(), MessageType_Error,2351 tr("Failed to remove the host network interface <b>%1</b>.")2352 .arg(iface.GetName()),2353 formatErrorInfo(host));2354 }2355 2356 void UIMessageCenter::cannotRemoveHostInterface(const CProgress &progress, const CHostNetworkInterface &iface, QWidget *pParent /* = 0 */)2357 {2358 message(pParent ? pParent : mainWindowShown(), MessageType_Error,2359 tr("Failed to remove the host network interface <b>%1</b>.")2360 .arg(iface.GetName()),2361 formatErrorInfo(progress.GetErrorInfo()));2362 }2363 2364 void UIMessageCenter::cannotAttachDevice(const CMachine &machine, UIMediumType type,2365 const QString &strLocation, const StorageSlot &storageSlot,2366 QWidget *pParent /* = 0 */)2367 {2368 QString strMessage;2369 switch (type)2370 {2371 case UIMediumType_HardDisk:2372 {2373 strMessage = tr("Failed to attach the hard disk (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.")2374 .arg(strLocation).arg(gpConverter->toString(storageSlot)).arg(CMachine(machine).GetName());2375 break;2376 }2377 case UIMediumType_DVD:2378 {2379 strMessage = tr("Failed to attach the CD/DVD device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.")2380 .arg(strLocation).arg(gpConverter->toString(storageSlot)).arg(CMachine(machine).GetName());2381 break;2382 }2383 case UIMediumType_Floppy:2384 {2385 strMessage = tr("Failed to attach the floppy device (<nobr><b>%1</b></nobr>) to the slot <i>%2</i> of the machine <b>%3</b>.")2386 .arg(strLocation).arg(gpConverter->toString(storageSlot)).arg(CMachine(machine).GetName());2387 break;2388 }2389 default:2390 break;2391 }2392 message(pParent ? pParent : mainWindowShown(), MessageType_Error, strMessage, formatErrorInfo(machine));2393 }2394 2395 void UIMessageCenter::cannotCreateSharedFolder(const CMachine &machine, const QString &strName,2396 const QString &strPath, QWidget *pParent /* = 0 */)2397 {2398 message(pParent ? pParent : mainMachineWindowShown(), MessageType_Error,2399 tr("Failed to create the shared folder <b>%1</b> "2400 "(pointing to <nobr><b>%2</b></nobr>) "2401 "for the virtual machine <b>%3</b>.")2402 .arg(strName)2403 .arg(strPath)2404 .arg(CMachine(machine).GetName()),2405 formatErrorInfo(machine));2406 }2407 2408 void UIMessageCenter::cannotRemoveSharedFolder(const CMachine &machine, const QString &strName,2409 const QString &strPath, QWidget *pParent /* = 0 */)2410 {2411 message(pParent ? pParent : mainMachineWindowShown(), MessageType_Error,2412 tr("Failed to remove the shared folder <b>%1</b> "2413 "(pointing to <nobr><b>%2</b></nobr>) "2414 "from the virtual machine <b>%3</b>.")2415 .arg(strName)2416 .arg(strPath)2417 .arg(CMachine(machine).GetName()),2418 formatErrorInfo(machine));2419 }2420 2421 void UIMessageCenter::cannotCreateSharedFolder(const CConsole &console, const QString &strName,2422 const QString &strPath, QWidget *pParent /* = 0 */)2423 {2424 message(pParent ? pParent : mainMachineWindowShown(), MessageType_Error,2425 tr("Failed to create the shared folder <b>%1</b> "2426 "(pointing to <nobr><b>%2</b></nobr>) "2427 "for the virtual machine <b>%3</b>.")2428 .arg(strName)2429 .arg(strPath)2430 .arg(CConsole(console).GetMachine().GetName()),2431 formatErrorInfo(console));2432 }2433 2434 void UIMessageCenter::cannotRemoveSharedFolder(const CConsole &console, const QString &strName,2435 const QString &strPath, QWidget *pParent /* = 0 */)2436 {2437 message(pParent ? pParent : mainMachineWindowShown(), MessageType_Error,2438 tr("<p>Failed to remove the shared folder <b>%1</b> "2439 "(pointing to <nobr><b>%2</b></nobr>) "2440 "from the virtual machine <b>%3</b>.</p>"2441 "<p>Please close all programs in the guest OS that "2442 "may be using this shared folder and try again.</p>")2443 .arg(strName)2444 .arg(strPath)2445 .arg(CConsole(console).GetMachine().GetName()),2446 formatErrorInfo(console));2447 }2448 2449 #ifdef VBOX_WITH_DRAG_AND_DROP2450 void UIMessageCenter::cannotDropData(const CGuest &guest,2451 QWidget *pParent /* = 0 */) const2452 {2453 message(pParent ? pParent : mainWindowShown(),2454 MessageType_Error,2455 tr("Failed to drop data."),2456 formatErrorInfo(guest));2457 }2458 2459 void UIMessageCenter::cannotDropData(const CProgress &progress,2460 QWidget *pParent /* = 0 */) const2461 {2462 AssertWrapperOk(progress);2463 2464 message(pParent ? pParent : mainWindowShown(),2465 MessageType_Error,2466 tr("Failed to drop data."),2467 formatErrorInfo(progress.GetErrorInfo()));2468 }2469 #endif /* VBOX_WITH_DRAG_AND_DROP */2470 2471 2476 void UIMessageCenter::remindAboutWrongColorDepth(ulong uRealBPP, ulong uWantedBPP) 2472 2477 { 2473 2478 emit sigRemindAboutWrongColorDepth(uRealBPP, uWantedBPP); 2474 }2475 2476 void UIMessageCenter::remindAboutUnsupportedUSB2(const QString &strExtPackName, QWidget *pParent)2477 {2478 if (warningShown("remindAboutUnsupportedUSB2"))2479 return;2480 setWarningShown("remindAboutUnsupportedUSB2", true);2481 2482 message(pParent ? pParent : mainMachineWindowShown(), MessageType_Warning,2483 tr("<p>USB 2.0 is currently enabled for this virtual machine. "2484 "However, this requires the <b><nobr>%1</nobr></b> to be installed.</p>"2485 "<p>Please install the Extension Pack from the VirtualBox download site. "2486 "After this you will be able to re-enable USB 2.0. "2487 "It will be disabled in the meantime unless you cancel the current settings changes.</p>")2488 .arg(strExtPackName));2489 2490 setWarningShown("remindAboutUnsupportedUSB2", false);2491 2479 } 2492 2480 -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h
r45346 r45358 222 222 void cannotRemoveMachine(const CMachine &machine) const; 223 223 void cannotRemoveMachine(const CMachine &machine, const CProgress &progress) const; 224 bool remindAboutInaccessibleMedia() const;224 bool warnAboutInaccessibleMedia() const; 225 225 bool confirmDiscardSavedState(const QString &strNames) const; 226 226 bool confirmResetMachine(const QString &strNames) const; … … 248 248 void cannotRemoveSnapshot(const CProgress &progress, const QString &strSnapshotName, const QString &strMachineName) const; 249 249 250 /* API: Settings warnings: */ 251 void cannotAccessUSB(const COMBaseWithEI &object) const; 252 void cannotSetSystemProperties(const CSystemProperties &properties) const; 253 void cannotSaveMachineSettings(const CMachine &machine, QWidget *pParent = 0) const; 250 /* API: Global settings warnings: */ 251 bool confirmHostInterfaceRemoval(const QString &strName, QWidget *pParent = 0) const; 252 void cannotCreateHostInterface(const CHost &host, QWidget *pParent = 0); 253 void cannotCreateHostInterface(const CProgress &progress, QWidget *pParent = 0); 254 void cannotRemoveHostInterface(const CHost &host, const QString &strName, QWidget *pParent = 0); 255 void cannotRemoveHostInterface(const CProgress &progress, const QString &strName, QWidget *pParent = 0); 256 void cannotSetSystemProperties(const CSystemProperties &properties, QWidget *pParent = 0) const; 257 258 /* API: Machine settings warnings: */ 259 void warnAboutUnaccessibleUSB(const COMBaseWithEI &object, QWidget *pParent = 0) const; 260 void warnAboutUnsupportedUSB2(const QString &strExtPackName, QWidget *pParent = 0); 254 261 void warnAboutStateChange(QWidget *pParent = 0) const; 255 262 bool confirmSettingsReloading(QWidget *pParent = 0) const; 256 bool confirmDeletingHostInterface(const QString &strName, QWidget *pParent = 0) const; 257 int askAboutHardDiskAttachmentCreation(const QString &strControllerName, QWidget *pParent = 0) const; 258 int askAboutOpticalAttachmentCreation(const QString &strControllerName, QWidget *pParent = 0) const; 259 int askAboutFloppyAttachmentCreation(const QString &strControllerName, QWidget *pParent = 0) const; 263 int confirmHardDiskAttachmentCreation(const QString &strControllerName, QWidget *pParent = 0) const; 264 int confirmOpticalAttachmentCreation(const QString &strControllerName, QWidget *pParent = 0) const; 265 int confirmFloppyAttachmentCreation(const QString &strControllerName, QWidget *pParent = 0) const; 260 266 int confirmRemovingOfLastDVDDevice(QWidget *pParent = 0) const; 267 void cannotAttachDevice(const CMachine &machine, UIMediumType type, const QString &strLocation, const StorageSlot &storageSlot, QWidget *pParent = 0); 261 268 void warnAboutIncorrectPort(QWidget *pParent = 0) const; 262 269 bool confirmCancelingPortForwardingDialog(QWidget *pParent = 0) const; 270 void cannotCreateSharedFolder(const CMachine &machine, const QString &strMachineName, const QString &strName, const QString &strPath, QWidget *pParent = 0); 271 void cannotCreateSharedFolder(const CConsole &console, const QString &strMachineName, const QString &strName, const QString &strPath, QWidget *pParent = 0); 272 void cannotRemoveSharedFolder(const CMachine &machine, const QString &strMachineName, const QString &strName, const QString &strPath, QWidget *pParent = 0); 273 void cannotRemoveSharedFolder(const CConsole &console, const QString &strMachineName, const QString &strName, const QString &strPath, QWidget *pParent = 0); 274 void cannotSaveMachineSettings(const CMachine &machine, QWidget *pParent = 0) const; 263 275 264 276 /* API: Virtual Medium Manager warnings: */ … … 356 368 void warnAboutExtPackInstalled(const QString &strPackName, QWidget *pParent = 0) const; 357 369 370 #ifdef VBOX_WITH_DRAG_AND_DROP 371 /* API: Drag&drop warnings: */ 372 void cannotDropData(const CGuest &guest, QWidget *pParent = 0) const; 373 void cannotDropData(const CProgress &progress, QWidget *pParent = 0) const; 374 #endif /* VBOX_WITH_DRAG_AND_DROP */ 375 358 376 /* API: License-viewer warnings: */ 359 void cannotOpenLicenseFile( QWidget *pParent, const QString &strPath);377 void cannotOpenLicenseFile(const QString &strPath, QWidget *pParent = 0); 360 378 361 379 /* API: File-dialog warnings: */ 362 bool askForOverridingFile(const QString &strPath, QWidget *pParent = 0); 363 bool askForOverridingFiles(const QVector<QString> &strPaths, QWidget *pParent = 0); 364 bool askForOverridingFileIfExists(const QString &strPath, QWidget *pParent = 0); 365 bool askForOverridingFilesIfExists(const QVector<QString> &strPaths, QWidget *pParent = 0); 366 380 bool confirmOverridingFile(const QString &strPath, QWidget *pParent = 0); 381 bool confirmOverridingFiles(const QVector<QString> &strPaths, QWidget *pParent = 0); 382 bool confirmOverridingFileIfExists(const QString &strPath, QWidget *pParent = 0); 383 bool confirmOverridingFilesIfExists(const QVector<QString> &strPaths, QWidget *pParent = 0); 384 385 /* API: Static helpers: */ 367 386 static QString formatRC(HRESULT rc); 368 387 static QString formatErrorInfo(const COMErrorInfo &info, HRESULT wrapperRC = S_OK); … … 371 390 static QString formatErrorInfo(const COMResult &rc); 372 391 373 /* Stuff supporting interthreading: */ 374 void cannotCreateHostInterface(const CHost &host, QWidget *pParent = 0); 375 void cannotCreateHostInterface(const CProgress &progress, QWidget *pParent = 0); 376 void cannotRemoveHostInterface(const CHost &host, const CHostNetworkInterface &iface, QWidget *pParent = 0); 377 void cannotRemoveHostInterface(const CProgress &progress, const CHostNetworkInterface &iface, QWidget *pParent = 0); 378 void cannotAttachDevice(const CMachine &machine, UIMediumType type, 379 const QString &strLocation, const StorageSlot &storageSlot, QWidget *pParent = 0); 380 void cannotCreateSharedFolder(const CMachine &machine, const QString &strName, 381 const QString &strPath, QWidget *pParent = 0); 382 void cannotRemoveSharedFolder(const CMachine &machine, const QString &strName, 383 const QString &strPath, QWidget *pParent = 0); 384 void cannotCreateSharedFolder(const CConsole &console, const QString &strName, 385 const QString &strPath, QWidget *pParent = 0); 386 void cannotRemoveSharedFolder(const CConsole &console, const QString &strName, 387 const QString &strPath, QWidget *pParent = 0); 388 #ifdef VBOX_WITH_DRAG_AND_DROP 389 void cannotDropData(const CGuest &guest, QWidget *pParent = 0) const; 390 void cannotDropData(const CProgress &progress, QWidget *pParent = 0) const; 391 #endif /* VBOX_WITH_DRAG_AND_DROP */ 392 /* API: Async stuff: */ 392 393 void remindAboutWrongColorDepth(ulong uRealBPP, ulong uWantedBPP); 393 void remindAboutUnsupportedUSB2(const QString &strExtPackName, QWidget *pParent = 0);394 394 395 395 public slots: 396 396 397 /* Handlers: Help menu stuff: */ 397 398 void sltShowHelpWebDialog(); 398 399 void sltShowHelpAboutDialog(); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIDnDHandler.cpp
r45193 r45358 94 94 95 95 CProgress progress = guest.DragHGPutData(screenId, format, dv); 96 if ( guest.isOk() 97 && !progress.isNull()) 96 if (guest.isOk()) 98 97 { 99 98 msgCenter().showModalProgressDialog(progress, tr("Dropping data ..."), ":/progress_dnd_hg_90px.png", pParent); 100 if (!progress.GetCanceled() && progress.isOk() && progress.GetResultCode() != 0)99 if (!progress.GetCanceled() && (!progress.isOk() || progress.GetResultCode() != 0)) 101 100 { 102 101 msgCenter().cannotDropData(progress, pParent); … … 185 184 * want the data in the specified mime-type. */ 186 185 CProgress progress = guest.DragGHDropped(mimeType, UIDnDHandler::toVBoxDnDAction(m_defAction)); 187 if ( guest.isOk() 188 && !progress.isNull()) 186 if (guest.isOk()) 189 187 { 190 188 msgCenter().showModalProgressDialog(progress, tr("Dropping data ..."), ":/progress_dnd_gh_90px.png", m_pParent); 191 if (!progress.GetCanceled() && progress.isOk() && progress.GetResultCode() != 0) 192 msgCenter().cannotDropData(progress, m_pParent); 193 else if (!progress.GetCanceled()) 189 if (!progress.GetCanceled()) 194 190 { 195 /* After the data is successfully arrived from the guest, we 196 * query it from Main. */ 197 QVector<uint8_t> data = guest.DragGHGetData(); 198 if (!data.isEmpty()) 191 if (progress.isOk() && progress.GetResultCode() == 0) 199 192 { 200 // printf("qt data (%d, %d, '%s'): %s\n", data.size(), type, qPrintable(mimeType), data.data()); 201 /* Todo: not sure what to add here more: needs more testing. */202 switch (type)193 /* After the data is successfully arrived from the guest, we query it from Main. */ 194 QVector<uint8_t> data = guest.DragGHGetData(); 195 if (!data.isEmpty()) 203 196 { 204 case QVariant::String: m_data = QVariant(QString(reinterpret_cast<const char*>(data.data()))); break;205 case QVariant::ByteArray:197 /* Todo: not sure what to add here more: needs more testing. */ 198 switch (type) 206 199 { 207 QByteArray ba(reinterpret_cast<const char*>(data.constData()), data.size()); 208 m_data = QVariant(ba); 209 break; 200 case QVariant::String: 201 { 202 m_data = QVariant(QString(reinterpret_cast<const char*>(data.data()))); 203 break; 204 } 205 case QVariant::ByteArray: 206 { 207 QByteArray ba(reinterpret_cast<const char*>(data.constData()), data.size()); 208 m_data = QVariant(ba); 209 break; 210 } 211 default: break; 210 212 } 211 default: break;212 213 } 214 m_fState = Finished; 213 215 } 214 m_fState = Finished; 216 else 217 msgCenter().cannotDropData(progress, m_pParent); 215 218 } 216 if (progress.GetCanceled())219 else 217 220 m_fState = Canceled; 218 221 } -
trunk/src/VBox/Frontends/VirtualBox/src/selector/UISelectorWindow.cpp
r45329 r45358 192 192 193 193 /* Warn the user about inaccessible medium: */ 194 if (it != list.end() && msgCenter(). remindAboutInaccessibleMedia())194 if (it != list.end() && msgCenter().warnAboutInaccessibleMedia()) 195 195 { 196 196 /* Open the MM window (without refresh): */ -
trunk/src/VBox/Frontends/VirtualBox/src/settings/UISettingsDialogSpecific.cpp
r45274 r45358 466 466 /* If properties are not OK => show the error: */ 467 467 if (!newProperties.isOk()) 468 msgCenter().cannotSetSystemProperties(newProperties );468 msgCenter().cannotSetSystemProperties(newProperties, this); 469 469 /* Else save the new settings if they were changed: */ 470 470 else if (!(newSettings == settings)) … … 530 530 /* Show the host error message if any: */ 531 531 if (!host.isReallyOk()) 532 msgCenter(). cannotAccessUSB(host);532 msgCenter().warnAboutUnaccessibleUSB(host, this); 533 533 /* Check if USB is implemented: */ 534 534 CHostUSBDeviceFilterVector filters = host.GetUSBDeviceFilters(); … … 1116 1116 /* Show the machine error message if any: */ 1117 1117 if (!m_machine.isReallyOk() && !controller.isNull() && controller.GetEnabled()) 1118 msgCenter(). cannotAccessUSB(m_machine);1118 msgCenter().warnAboutUnaccessibleUSB(m_machine, this); 1119 1119 /* Check if USB is implemented: */ 1120 1120 if (controller.isNull() || !controller.GetProxyAvailable()) -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsExtension.cpp
r45342 r45358 205 205 { 206 206 /* Show installation progress: */ 207 msgCenter().showModalProgressDialog(progress, tr("Extensions"), " ", pParent);207 msgCenter().showModalProgressDialog(progress, tr("Extensions"), ":/progress_install_guest_additions_90px.png", pParent); 208 208 if (!progress.GetCanceled()) 209 209 { … … 422 422 { 423 423 /* Show uninstallation progress: */ 424 msgCenter().showModalProgressDialog(progress, tr("Extensions"), " ", this);424 msgCenter().showModalProgressDialog(progress, tr("Extensions"), ":/progress_install_guest_additions_90px.png", this); 425 425 if (progress.isOk() && progress.GetResultCode() == 0) 426 426 { -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetwork.cpp
r45288 r45358 419 419 if (host.isOk()) 420 420 { 421 msgCenter().showModalProgressDialog(progress, tr("Networking"), 422 ":/nw_32px.png", window(), 0); 423 if (progress.GetResultCode() == 0) 421 msgCenter().showModalProgressDialog(progress, tr("Networking"), ":/nw_32px.png", this, 0); 422 if (progress.isOk() && progress.GetResultCode() == 0) 424 423 { 425 424 /* Create DHCP server: */ … … 431 430 } 432 431 AssertMsg(!dhcp.isNull(), ("DHCP server creation failed!\n")); 433 434 432 /* Append cache with new item: */ 435 433 appendCacheItem(iface); … … 453 451 QString strInterfaceName(pItem->name()); 454 452 /* Asking user about deleting selected network interface: */ 455 if (!msgCenter().confirm DeletingHostInterface(strInterfaceName, this))453 if (!msgCenter().confirmHostInterfaceRemoval(strInterfaceName, this)) 456 454 return; 457 455 … … 472 470 if (host.isOk()) 473 471 { 474 msgCenter().showModalProgressDialog(progress, tr("Networking"), 475 ":/nw_32px.png", window(), 0); 476 if (progress.GetResultCode() == 0) 472 msgCenter().showModalProgressDialog(progress, tr("Networking"), ":/nw_32px.png", this, 0); 473 if (progress.isOk() && progress.GetResultCode() == 0) 477 474 { 478 475 /* Remove list item: */ … … 482 479 } 483 480 else 484 msgCenter().cannotRemoveHostInterface(progress, iface, this);481 msgCenter().cannotRemoveHostInterface(progress, strInterfaceName, this); 485 482 } 486 483 else 487 msgCenter().cannotRemoveHostInterface(host, iface, this);484 msgCenter().cannotRemoveHostInterface(host, strInterfaceName, this); 488 485 } 489 486 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsSF.cpp
r45196 r45358 750 750 if (!sharedFolder.isNull()) 751 751 { 752 /* Get machine-name: */ 753 QString strMachineName(m_machine.GetName()); 752 754 /* Remove existing shared folder: */ 753 755 switch(sharedFoldersType) … … 761 763 setFailed(true); 762 764 /* Show error message: */ 763 msgCenter().cannotRemoveSharedFolder(m_machine, str Name, strPath);765 msgCenter().cannotRemoveSharedFolder(m_machine, strMachineName, strName, strPath, this); 764 766 /* Finish early: */ 765 767 return false; … … 775 777 setFailed(true); 776 778 /* Show error message: */ 777 msgCenter().cannotRemoveSharedFolder(m_console, str Name, strPath);779 msgCenter().cannotRemoveSharedFolder(m_console, strMachineName, strName, strPath, this); 778 780 /* Finish early: */ 779 781 return false; … … 807 809 if (sharedFolder.isNull()) 808 810 { 811 /* Get machine-name: */ 812 QString strMachineName(m_machine.GetName()); 809 813 /* Create new shared folder: */ 810 814 switch(sharedFoldersType) … … 818 822 setFailed(true); 819 823 /* Show error message: */ 820 msgCenter().cannotCreateSharedFolder(m_machine, str Name, strPath);824 msgCenter().cannotCreateSharedFolder(m_machine, strMachineName, strName, strPath, this); 821 825 /* Finish early: */ 822 826 return false; … … 833 837 setFailed(true); 834 838 /* Show error message: */ 835 msgCenter().cannotCreateSharedFolder(m_console, str Name, strPath);839 msgCenter().cannotCreateSharedFolder(m_console, strMachineName, strName, strPath, this); 836 840 /* Finish early: */ 837 841 return false; -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp
r45296 r45358 3045 3045 case KDeviceType_HardDisk: 3046 3046 { 3047 int iAnswer = msgCenter(). askAboutHardDiskAttachmentCreation(strControllerName, this);3047 int iAnswer = msgCenter().confirmHardDiskAttachmentCreation(strControllerName, this); 3048 3048 if (iAnswer == AlertButton_Yes) 3049 3049 strMediumId = getWithNewHDWizard(); … … 3054 3054 case KDeviceType_DVD: 3055 3055 { 3056 int iAnswer = msgCenter(). askAboutOpticalAttachmentCreation(strControllerName, this);3056 int iAnswer = msgCenter().confirmOpticalAttachmentCreation(strControllerName, this); 3057 3057 if (iAnswer == AlertButton_Yes) 3058 3058 strMediumId = vboxGlobal().openMediumWithFileOpenDialog(UIMediumType_DVD, this, strMachineFolder); … … 3063 3063 case KDeviceType_Floppy: 3064 3064 { 3065 int iAnswer = msgCenter(). askAboutFloppyAttachmentCreation(strControllerName, this);3065 int iAnswer = msgCenter().confirmFloppyAttachmentCreation(strControllerName, this); 3066 3066 if (iAnswer == AlertButton_Yes) 3067 3067 strMediumId = vboxGlobal().openMediumWithFileOpenDialog(UIMediumType_Floppy, this, strMachineFolder); … … 3513 3513 /* Show error message: */ 3514 3514 msgCenter().cannotAttachDevice(m_machine, mediumTypeToLocal(attachmentDeviceType), 3515 3516 3515 vboxMedium.location(), 3516 StorageSlot(controllerBus, iAttachmentPort, iAttachmentDevice), this); 3517 3517 } 3518 3518 } -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsUSB.cpp
r45346 r45358 573 573 "It will be disabled in the meantime unless you cancel the current settings changes.") 574 574 .arg(GUI_ExtPackName); 575 msgCenter(). remindAboutUnsupportedUSB2(GUI_ExtPackName, this);575 msgCenter().warnAboutUnsupportedUSB2(GUI_ExtPackName, this); 576 576 mCbUSB2->setChecked(false); 577 577 return true; -
trunk/src/VBox/Frontends/VirtualBox/src/wizards/exportappliance/UIWizardExportApp.cpp
r45325 r45358 97 97 QVector<QString> exists = explorer.Exists(files); 98 98 /* Check if the file exists already, if yes get confirmation for overwriting from the user. */ 99 if (!msgCenter(). askForOverridingFiles(exists, this))99 if (!msgCenter().confirmOverridingFiles(exists, this)) 100 100 return false; 101 101 /* Ok all is confirmed so delete all the files which exists: */
Note:
See TracChangeset
for help on using the changeset viewer.