Changeset 45285 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Apr 2, 2013 11:57:35 AM (12 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp
r45282 r45285 624 624 "the machine without doing a proper shutdown of the guest OS.</p>") 625 625 .arg(strNames), 626 0 /* pcszAutoConfirmId */,626 0 /* auto-confirm id */, 627 627 tr("Discard", "saved state")); 628 628 } … … 635 635 "in applications running inside it to be lost.</p>") 636 636 .arg(strNames), 637 "confirmVMReset" /* pcszAutoConfirmId */,637 "confirmVMReset" /* auto-confirm id */, 638 638 tr("Reset", "machine")); 639 639 } … … 645 645 "to the following virtual machines?</p><p><b>%1</b></p>") 646 646 .arg(strNames), 647 "confirmVMACPIShutdown" /* pcszAutoConfirmId */,647 "confirmVMACPIShutdown" /* auto-confirm id */, 648 648 tr("ACPI Shutdown", "machine")); 649 649 } … … 656 656 "running inside it to be lost.</p>") 657 657 .arg(strNames), 658 "confirmVMPowerOff" /* pcszAutoConfirmId */,658 "confirmVMPowerOff" /* auto-confirm id */, 659 659 tr("Power Off", "machine")); 660 660 } … … 682 682 } 683 683 684 int UIMessageCenter:: askAboutSnapshotRestoring(const QString &strSnapshotName, bool fAlsoCreateNewSnapshot)684 int UIMessageCenter::confirmSnapshotRestoring(const QString &strSnapshotName, bool fAlsoCreateNewSnapshot) 685 685 { 686 686 return fAlsoCreateNewSnapshot ? … … 691 691 .arg(strSnapshotName), 692 692 tr("Create a snapshot of the current machine state"), 693 !vboxGlobal().virtualBox().GetExtraDataStringList(GUI_InvertMessageOption).contains(" askAboutSnapshotRestoring"),693 !vboxGlobal().virtualBox().GetExtraDataStringList(GUI_InvertMessageOption).contains("confirmSnapshotRestoring"), 694 694 QString() /* details */, 695 695 QIMessageBox::Ok | QIMessageBox::Default, … … 699 699 message(mainWindowShown(), MessageType_Question, 700 700 tr("<p>Are you sure you want to restore snapshot <nobr><b>%1</b></nobr>?</p>").arg(strSnapshotName), 701 0 /* auto-confirm ation token*/,701 0 /* auto-confirm id */, 702 702 QIMessageBox::Ok | QIMessageBox::Default, 703 703 QIMessageBox::Cancel | QIMessageBox::Escape, … … 706 706 } 707 707 708 bool UIMessageCenter:: askAboutSnapshotDeleting(const QString &strSnapshotName)708 bool UIMessageCenter::confirmSnapshotRemoval(const QString &strSnapshotName) 709 709 { 710 710 return messageOkCancel(mainWindowShown(), MessageType_Question, 711 tr("<p>Deleting the snapshot will cause the state information saved in it to be lost, and disk data spread over " 712 "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 " 713 "in the snapshot cannot be recovered.</p></p>Are you sure you want to delete the selected snapshot <b>%1</b>?</p>") 714 .arg(strSnapshotName), 715 /* Do NOT allow this message to be disabled! */ 716 NULL /* pcszAutoConfirmId */, 717 tr("Delete"), tr("Cancel")); 718 } 719 720 bool UIMessageCenter::askAboutSnapshotDeletingFreeSpace(const QString &strSnapshotName, 711 tr("<p>Deleting the snapshot will cause the state information saved in it to be lost, and disk data spread over " 712 "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 " 713 "in the snapshot cannot be recovered.</p></p>Are you sure you want to delete the selected snapshot <b>%1</b>?</p>") 714 .arg(strSnapshotName), 715 0 /* auto-confirm id */, 716 tr("Delete"), tr("Cancel")); 717 } 718 719 bool UIMessageCenter::warnAboutSnapshotRemovalFreeSpace(const QString &strSnapshotName, 721 720 const QString &strTargetImageName, 722 721 const QString &strTargetImageMaxSize, … … 724 723 { 725 724 return messageOkCancel(mainWindowShown(), MessageType_Question, 726 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, " 727 "however on this filesystem there is only %4 free.</p><p>Running out of disk space during the merge operation can result in " 728 "corruption of the image and the VM configuration, i.e. loss of the VM and its data.</p><p>You may continue with deleting " 729 "the snapshot at your own risk.</p>") 730 .arg(strSnapshotName) 731 .arg(strTargetImageName) 732 .arg(strTargetImageMaxSize) 733 .arg(strTargetFileSystemFree), 734 /* Do NOT allow this message to be disabled! */ 735 NULL /* pcszAutoConfirmId */, 736 tr("Delete"), tr("Cancel")); 737 } 738 739 void UIMessageCenter::cannotRestoreSnapshot(const CConsole &console, 740 const QString &strSnapshotName) 725 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, " 726 "however on this filesystem there is only %4 free.</p><p>Running out of disk space during the merge operation can result in " 727 "corruption of the image and the VM configuration, i.e. loss of the VM and its data.</p><p>You may continue with deleting " 728 "the snapshot at your own risk.</p>") 729 .arg(strSnapshotName) 730 .arg(strTargetImageName) 731 .arg(strTargetImageMaxSize) 732 .arg(strTargetFileSystemFree), 733 0 /* auto-confirm id */, 734 tr("Delete")); 735 } 736 737 void UIMessageCenter::cannotRestoreSnapshot(const CConsole &console, const QString &strSnapshotName) 741 738 { 742 739 message(mainWindowShown(), MessageType_Error, 743 tr("Failed to restore the snapshot <b>%1</b> of the virtual machine <b>%2</b>.")744 .arg(strSnapshotName)745 .arg(CConsole(console).GetMachine().GetName()),746 formatErrorInfo(console)); 747 } 748 749 void UIMessageCenter::cannotRestoreSnapshot(const CProgress &progress, 750 const QString &strSnapshotName)751 { 740 tr("Failed to restore the snapshot <b>%1</b> of the virtual machine <b>%2</b>.") 741 .arg(strSnapshotName).arg(CConsole(console).GetMachine().GetName()), 742 formatErrorInfo(console)); 743 } 744 745 void UIMessageCenter::cannotRestoreSnapshot(const CProgress &progress, const QString &strSnapshotName) 746 { 747 /* Get console: */ 748 AssertWrapperOk(progress); 752 749 CConsole console(CProgress(progress).GetInitiator()); 753 750 AssertWrapperOk(console); 751 /* Show the message: */ 754 752 message(mainWindowShown(), MessageType_Error, 755 tr("Failed to restore the snapshot <b>%1</b> of the virtual machine <b>%2</b>.") 756 .arg(strSnapshotName) 757 .arg(console.GetMachine().GetName()), 758 formatErrorInfo(progress.GetErrorInfo())); 759 } 760 761 void UIMessageCenter::cannotDeleteSnapshot(const CConsole &console, 753 tr("Failed to restore the snapshot <b>%1</b> of the virtual machine <b>%2</b>.") 754 .arg(strSnapshotName).arg(console.GetMachine().GetName()), 755 formatErrorInfo(progress.GetErrorInfo())); 756 } 757 758 void UIMessageCenter::cannotRemoveSnapshot(const CConsole &console, const QString &strSnapshotName) 759 { 760 message(mainWindowShown(), MessageType_Error, 761 tr("Failed to delete the snapshot <b>%1</b> of the virtual machine <b>%2</b>.") 762 .arg(strSnapshotName) 763 .arg(CConsole(console).GetMachine().GetName()), 764 formatErrorInfo(console)); 765 } 766 767 void UIMessageCenter::cannotRemoveSnapshot(const CProgress &progress, 762 768 const QString &strSnapshotName) 763 769 { 764 message(mainWindowShown(), MessageType_Error, 765 tr("Failed to delete the snapshot <b>%1</b> of the virtual machine <b>%2</b>.") 766 .arg(strSnapshotName) 767 .arg(CConsole(console).GetMachine().GetName()), 768 formatErrorInfo(console)); 769 } 770 771 void UIMessageCenter::cannotDeleteSnapshot(const CProgress &progress, 772 const QString &strSnapshotName) 773 { 770 /* Get console: */ 771 AssertWrapperOk(progress); 774 772 CConsole console(CProgress(progress).GetInitiator()); 775 773 AssertWrapperOk(console); 774 /* Show the message: */ 776 775 message(mainWindowShown(), MessageType_Error, 777 776 tr("Failed to delete the snapshot <b>%1</b> of the virtual machine <b>%2</b>.") … … 779 778 .arg(console.GetMachine().GetName()), 780 779 formatErrorInfo(progress.GetErrorInfo())); 781 }782 783 void UIMessageCenter::cannotFindSnapshotByName(QWidget *pParent,784 const CMachine &machine,785 const QString &strName) const786 {787 message(pParent ? pParent : mainWindowShown(), MessageType_Error,788 tr("Can't find snapshot named <b>%1</b>.")789 .arg(strName),790 formatErrorInfo(machine)791 );792 780 } 793 781 … … 879 867 "<p>Would you like to create a new, empty file to hold the disk contents or select an existing one?</p>") 880 868 .arg(strControllerName), 881 0, /* pcszAutoConfirmId */869 0, /* auto-confirm id */ 882 870 QIMessageBox::Yes, 883 871 QIMessageBox::No, … … 895 883 "or to leave it empty for now?</p>") 896 884 .arg(strControllerName), 897 0, /* pcszAutoConfirmId */885 0, /* auto-confirm id */ 898 886 QIMessageBox::Yes, 899 887 QIMessageBox::No, … … 911 899 "or to leave it empty for now?</p>") 912 900 .arg(strControllerName), 913 0, /* pcszAutoConfirmId */901 0, /* auto-confirm id */ 914 902 QIMessageBox::Yes, 915 903 QIMessageBox::No, … … 925 913 "<p>You will not be able to mount any CDs or ISO images " 926 914 "or install the Guest Additions without it!</p>"), 927 0, /* pcszAutoConfirmId */915 0, /* auto-confirm id */ 928 916 tr("&Remove", "medium")); 929 917 } … … 941 929 "you correct their settings by either choosing a different interface " 942 930 "name or a different adapter attachment type.</p>").arg(strName), 943 0, /* pcszAutoConfirmId */931 0, /* auto-confirm id */ 944 932 QIMessageBox::Ok | QIMessageBox::Default, 945 933 QIMessageBox::Cancel | QIMessageBox::Escape); … … 985 973 .arg(aMedium.location()) 986 974 .arg(strUsage), 987 0 /* pcszAutoConfirmId */,975 0 /* auto-confirm id */, 988 976 tr("Release", "detach medium")); 989 977 } … … 1025 1013 1026 1014 return messageOkCancel(pParent, MessageType_Question, msg, 1027 "confirmRemoveMedium", /* pcszAutoConfirmId */1015 "confirmRemoveMedium", /* auto-confirm id */ 1028 1016 tr("Remove", "medium")); 1029 1017 } … … 1042 1030 "disk to the list later again.</p>") 1043 1031 .arg(strLocation), 1044 0, /* pcszAutoConfirmId */1032 0, /* auto-confirm id */ 1045 1033 QIMessageBox::Yes, 1046 1034 QIMessageBox::No | QIMessageBox::Default, … … 1285 1273 "until you add one. In the mean time you will only be able to start the " 1286 1274 "machine using a virtual optical disk or from the network."), 1287 0, /* pcszAutoConfirmId */1275 0, /* auto-confirm id */ 1288 1276 QIMessageBox::Ok, 1289 1277 QIMessageBox::Cancel | QIMessageBox::Default | QIMessageBox::Escape, … … 1365 1353 "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).", 1366 1354 strMachineNames.size()).arg(VBoxGlobal::toHumanReadableList(strMachineNames)), 1367 0 /* pcszAutoConfirmId */,1355 0 /* auto-confirm id */, 1368 1356 tr("Continue"), tr("Cancel")); 1369 1357 } … … 1420 1408 tr("Failed to export appliance <b>%1</b>.").arg(pAppliance->GetPath()), 1421 1409 formatErrorInfo(progress.GetErrorInfo())); 1410 } 1411 1412 void UIMessageCenter::cannotFindSnapshotByName(QWidget *pParent, 1413 const CMachine &machine, 1414 const QString &strName) const 1415 { 1416 message(pParent ? pParent : mainWindowShown(), MessageType_Error, 1417 tr("Can't find snapshot named <b>%1</b>.") 1418 .arg(strName), 1419 formatErrorInfo(machine)); 1422 1420 } 1423 1421 … … 1523 1521 "that you have enabled VT-x/AMD-V properly in the BIOS of your " 1524 1522 "host computer.</p>"), 1525 0 /* pcszAutoConfirmId */,1523 0 /* auto-confirm id */, 1526 1524 tr("Close VM"), tr("Continue")); 1527 1525 else … … 1530 1528 "Your 64-bit guest will fail to detect a 64-bit CPU and will " 1531 1529 "not be able to boot."), 1532 0 /* pcszAutoConfirmId */,1530 0 /* auto-confirm id */, 1533 1531 tr("Close VM"), tr("Continue")); 1534 1532 } … … 1543 1541 "that you have enabled VT-x/AMD-V properly in the BIOS of your " 1544 1542 "host computer.</p>"), 1545 0 /* pcszAutoConfirmId */,1543 0 /* auto-confirm id */, 1546 1544 tr("Close VM"), tr("Continue")); 1547 1545 else … … 1550 1548 "Certain guests (e.g. OS/2 and QNX) require this feature and will " 1551 1549 "fail to boot without it.</p>"), 1552 0 /* pcszAutoConfirmId */,1550 0 /* auto-confirm id */, 1553 1551 tr("Close VM"), tr("Continue")); 1554 1552 } … … 1565 1563 .arg(strMachineName) 1566 1564 .arg(strIfNames), 1567 0, /* pcszAutoConfirmId */1565 0, /* auto-confirm id */ 1568 1566 tr("Change Network Settings"), 1569 1567 tr("Close Virtual Machine")); … … 1583 1581 void UIMessageCenter::cannotStartMachine(const CProgress &progress) 1584 1582 { 1583 /* Get console: */ 1585 1584 AssertWrapperOk(progress); 1586 1585 CConsole console(CProgress(progress).GetInitiator()); 1587 1586 AssertWrapperOk(console); 1588 1587 /* Show the message: */ 1589 1588 message( 1590 1589 mainWindowShown(), … … 1643 1642 void UIMessageCenter::cannotSaveMachineState(const CProgress &progress) 1644 1643 { 1644 /* Get console: */ 1645 1645 AssertWrapperOk(progress); 1646 1646 CConsole console(CProgress(progress).GetInitiator()); 1647 1647 AssertWrapperOk(console); 1648 1648 /* Show the message: */ 1649 1649 message( 1650 1650 mainWindowShown(), … … 1669 1669 void UIMessageCenter::cannotTakeSnapshot(const CProgress &progress) 1670 1670 { 1671 /* Get console: */ 1671 1672 AssertWrapperOk(progress); 1672 1673 CConsole console(CProgress(progress).GetInitiator()); 1673 1674 AssertWrapperOk(console); 1674 1675 /* Show the message: */ 1675 1676 message( 1676 1677 mainWindowShown(), … … 1684 1685 void UIMessageCenter::cannotStopMachine(const CProgress &progress) 1685 1686 { 1687 /* Get console: */ 1686 1688 AssertWrapperOk(progress); 1687 1689 CConsole console(CProgress(progress).GetInitiator()); 1688 1690 AssertWrapperOk(console); 1689 1691 /* Show the message: */ 1690 1692 message(mainWindowShown(), MessageType_Error, 1691 1693 tr("Failed to stop the virtual machine <b>%1</b>.") … … 1803 1805 "corresponding action from the menu bar." 1804 1806 "</p>"), 1805 kNames [1] /* pcszAutoConfirmId */);1807 kNames [1] /* auto-confirm id */); 1806 1808 } 1807 1809 else … … 1813 1815 "display or pressing the host key) in order to use the " 1814 1816 "mouse inside the guest OS.</p>"), 1815 kNames [0] /* pcszAutoConfirmId */);1817 kNames [0] /* auto-confirm id */); 1816 1818 } 1817 1819 … … 1859 1861 "or press <b>Cancel</b> to cancel the operation.</p>") 1860 1862 .arg(VBoxGlobal::formatSize(uMinVRAM)), 1861 0, /* pcszAutoConfirmId */1863 0, /* auto-confirm id */ 1862 1864 QIMessageBox::Ignore | QIMessageBox::Default, 1863 1865 QIMessageBox::Cancel | QIMessageBox::Escape); … … 1884 1886 "or press <b>Cancel</b> to cancel the operation.</p>") 1885 1887 .arg(VBoxGlobal::formatSize(uMinVRAM)), 1886 0, /* pcszAutoConfirmId */1888 0, /* auto-confirm id */ 1887 1889 QIMessageBox::Ignore | QIMessageBox::Default, 1888 1890 QIMessageBox::Cancel | QIMessageBox::Escape); … … 2033 2035 "it is recommended to press <b>OK</b> now.</p>") 2034 2036 .arg(strLogFolder), 2035 0, /* pcszAutoConfirmId */2037 0, /* auto-confirm id */ 2036 2038 QIMessageBox::Ok | QIMessageBox::Default, 2037 2039 QIMessageBox::Ignore | QIMessageBox::Escape); … … 2076 2078 "<nobr><a href=\"%1\">%2</a></nobr> " 2077 2079 "(size %3 bytes)?</p>").arg(strUrl).arg(strUrl).arg(loc.toString(uSize)), 2078 0, /* pcszAutoConfirmId */2080 0, /* auto-confirm id */ 2079 2081 tr("Download", "additions")); 2080 2082 } … … 2090 2092 "on the virtual CD/DVD drive?</p>") 2091 2093 .arg(strUrl).arg(strUrl).arg(strSrc), 2092 0, /* pcszAutoConfirmId */2094 0, /* auto-confirm id */ 2093 2095 tr("Mount", "additions")); 2094 2096 } -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h
r45282 r45285 228 228 229 229 /* API: Snapshot warnings: */ 230 int askAboutSnapshotRestoring(const QString &strSnapshotName, bool fAlsoCreateNewSnapshot); 231 bool askAboutSnapshotDeleting(const QString &strSnapshotName); 232 bool askAboutSnapshotDeletingFreeSpace(const QString &strSnapshotName, 233 const QString &strTargetImageName, 234 const QString &strTargetImageMaxSize, 235 const QString &strTargetFileSystemFree); 230 int confirmSnapshotRestoring(const QString &strSnapshotName, bool fAlsoCreateNewSnapshot); 231 bool confirmSnapshotRemoval(const QString &strSnapshotName); 232 bool warnAboutSnapshotRemovalFreeSpace(const QString &strSnapshotName, const QString &strTargetImageName, 233 const QString &strTargetImageMaxSize, const QString &strTargetFileSystemFree); 236 234 void cannotRestoreSnapshot(const CConsole &console, const QString &strSnapshotName); 237 235 void cannotRestoreSnapshot(const CProgress &progress, const QString &strSnapshotName); 238 void cannotDeleteSnapshot(const CConsole &console, const QString &strSnapshotName); 239 void cannotDeleteSnapshot(const CProgress &progress, const QString &strSnapshotName); 240 void cannotFindSnapshotByName(QWidget *pParent, const CMachine &machine, const QString &strMachine) const; 236 void cannotRemoveSnapshot(const CConsole &console, const QString &strSnapshotName); 237 void cannotRemoveSnapshot(const CProgress &progress, const QString &strSnapshotName); 241 238 242 239 /* API: Settings warnings: */ … … 293 290 void cannotExportAppliance(const CMachine &machine, CAppliance *pAppliance, QWidget *pParent = NULL) const; 294 291 void cannotExportAppliance(const CProgress &progress, CAppliance *pAppliance, QWidget *pParent = NULL) const; 292 void cannotFindSnapshotByName(QWidget *pParent, const CMachine &machine, const QString &strMachine) const; 295 293 296 294 /* API: Runtime UI warnings: */ -
trunk/src/VBox/Frontends/VirtualBox/src/selector/VBoxSnapshotsWgt.cpp
r45192 r45285 584 584 585 585 /* Ask the user if he really wants to restore the snapshot: */ 586 int iResultCode = msgCenter(). askAboutSnapshotRestoring(snapshot.GetName(), mMachine.GetCurrentStateModified());586 int iResultCode = msgCenter().confirmSnapshotRestoring(snapshot.GetName(), mMachine.GetCurrentStateModified()); 587 587 if (iResultCode & QIMessageBox::Cancel) 588 588 return; … … 613 613 } 614 614 else 615 msgCenter().cannotRestoreSnapshot( progress, snapshot.GetName());615 msgCenter().cannotRestoreSnapshot(console, snapshot.GetName()); 616 616 617 617 /* Unlock machine finally: */ … … 629 629 CSnapshot snapshot = mMachine.FindSnapshot(snapId); 630 630 631 if (!msgCenter(). askAboutSnapshotDeleting(snapshot.GetName()))631 if (!msgCenter().confirmSnapshotRemoval(snapshot.GetName())) 632 632 return; 633 633 634 634 /** @todo check available space on the target filesystem etc etc. */ 635 635 #if 0 636 if (!msgCenter(). askAboutSnapshotDeletingFreeSpace(snapshot.GetName(),637 638 639 636 if (!msgCenter().warnAboutSnapshotRemovalFreeSpace(snapshot.GetName(), 637 "/home/juser/.VirtualBox/Machines/SampleVM/Snapshots/{01020304-0102-0102-0102-010203040506}.vdi", 638 "59 GiB", 639 "15 GiB")) 640 640 return; 641 641 #endif 642 643 642 644 643 /* Open a direct session (this call will handle all errors) */ … … 661 660 662 661 if (progress.GetResultCode() != 0) 663 msgCenter().cannot DeleteSnapshot (progress, snapshot.GetName());662 msgCenter().cannotRemoveSnapshot (progress, snapshot.GetName()); 664 663 } 665 664 else 666 msgCenter().cannot DeleteSnapshot (console, snapshot.GetName());665 msgCenter().cannotRemoveSnapshot (console, snapshot.GetName()); 667 666 668 667 session.UnlockMachine();
Note:
See TracChangeset
for help on using the changeset viewer.