Changeset 45288 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Apr 2, 2013 1:27:59 PM (12 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp
r45285 r45288 76 76 } 77 77 78 void UIMessageCenter::setWarningShown(const QString &strWarningName, bool fWarningShown) 78 void UIMessageCenter::setWarningShown(const QString &strWarningName, bool fWarningShown) const 79 79 { 80 80 if (fWarningShown && !m_warnings.contains(strWarningName)) … … 285 285 286 286 #ifdef RT_OS_LINUX 287 void UIMessageCenter::warnAboutWrongUSBMounted() 287 void UIMessageCenter::warnAboutWrongUSBMounted() const 288 288 { 289 289 message(mainWindowShown(), MessageType_Warning, … … 295 295 #endif /* RT_OS_LINUX */ 296 296 297 void UIMessageCenter::cannotStartSelector() 297 void UIMessageCenter::cannotStartSelector() const 298 298 { 299 299 message(0, MessageType_Critical, … … 302 302 } 303 303 304 void UIMessageCenter::showBETAWarning() 304 void UIMessageCenter::showBETAWarning() const 305 305 { 306 306 message(0, MessageType_Warning, … … 309 309 } 310 310 311 void UIMessageCenter::showBEBWarning() 311 void UIMessageCenter::showBEBWarning() const 312 312 { 313 313 message(0, MessageType_Warning, … … 316 316 } 317 317 318 void UIMessageCenter::cannotInitUserHome(const QString &strUserHome) 318 void UIMessageCenter::cannotInitUserHome(const QString &strUserHome) const 319 319 { 320 320 message(0, MessageType_Critical, … … 322 322 "configuration directory <b><nobr>%1</nobr></b> is not accessible. " 323 323 "Please check the permissions of this directory and of its parent directory.</p>" 324 "<p>The application will now terminate.</p>").arg(strUserHome), 324 "<p>The application will now terminate.</p>") 325 .arg(strUserHome), 325 326 formatErrorInfo(COMErrorInfo())); 326 327 } 327 328 328 void UIMessageCenter::cannotInitCOM(HRESULT rc) 329 void UIMessageCenter::cannotInitCOM(HRESULT rc) const 329 330 { 330 331 message(0, MessageType_Critical, … … 335 336 } 336 337 337 void UIMessageCenter::cannotCreateVirtualBox(const CVirtualBox &vbox) 338 void UIMessageCenter::cannotCreateVirtualBox(const CVirtualBox &vbox) const 338 339 { 339 340 message(0, MessageType_Critical, … … 343 344 } 344 345 345 void UIMessageCenter::cannotFindLanguage(const QString &strLangId, const QString &strNlsPath) 346 void UIMessageCenter::cannotFindLanguage(const QString &strLangId, const QString &strNlsPath) const 346 347 { 347 348 message(0, MessageType_Error, … … 353 354 } 354 355 355 void UIMessageCenter::cannotLoadLanguage(const QString &strLangFile) 356 void UIMessageCenter::cannotLoadLanguage(const QString &strLangFile) const 356 357 { 357 358 message(0, MessageType_Error, … … 363 364 } 364 365 365 void UIMessageCenter::cannotLoadGlobalConfig(const CVirtualBox &vbox, const QString &strError) 366 void UIMessageCenter::cannotLoadGlobalConfig(const CVirtualBox &vbox, const QString &strError) const 366 367 { 367 368 /* Preserve error-info: */ … … 370 371 message(0, MessageType_Critical, 371 372 tr("<p>Failed to load the global GUI configuration from <b><nobr>%1</nobr></b>.</p>" 372 "<p>The application will now terminate.</p>") .arg(vbox.GetSettingsFilePath()),373 !res.isOk() ? formatErrorInfo(res)374 375 } 376 377 void UIMessageCenter::cannotSaveGlobalConfig(const CVirtualBox &vbox) 373 "<p>The application will now terminate.</p>") 374 .arg(vbox.GetSettingsFilePath()), 375 !res.isOk() ? formatErrorInfo(res) : QString("<!--EOM--><p>%1</p>").arg(vboxGlobal().emphasize(strError))); 376 } 377 378 void UIMessageCenter::cannotSaveGlobalConfig(const CVirtualBox &vbox) const 378 379 { 379 380 /* Preserve error-info: */ … … 382 383 message(0, MessageType_Critical, 383 384 tr("<p>Failed to save the global GUI configuration to <b><nobr>%1</nobr></b>.</p>" 384 "<p>The application will now terminate.</p>").arg(vbox.GetSettingsFilePath()), 385 "<p>The application will now terminate.</p>") 386 .arg(vbox.GetSettingsFilePath()), 385 387 formatErrorInfo(res)); 386 388 } 387 389 388 void UIMessageCenter::cannotFindMachineByName(const CVirtualBox &vbox, const QString &strName) 390 void UIMessageCenter::cannotFindMachineByName(const CVirtualBox &vbox, const QString &strName) const 389 391 { 390 392 message(0, MessageType_Error, 391 tr("There is no virtual machine named <b>%1</b>.").arg(strName), 393 tr("There is no virtual machine named <b>%1</b>.") 394 .arg(strName), 392 395 formatErrorInfo(vbox)); 393 396 } 394 397 395 void UIMessageCenter::cannotFindMachineById(const CVirtualBox &vbox, const QString &strId) 398 void UIMessageCenter::cannotFindMachineById(const CVirtualBox &vbox, const QString &strId) const 396 399 { 397 400 message(0, MessageType_Error, 398 tr("There is no virtual machine with id <b>%1</b>.").arg(strId), 401 tr("There is no virtual machine with id <b>%1</b>.") 402 .arg(strId), 399 403 formatErrorInfo(vbox)); 400 404 } 401 405 402 void UIMessageCenter::cannotOpenSession(const CSession &session) 403 { 404 Assert(session.isNull()); 406 void UIMessageCenter::cannotOpenSession(const CSession &session) const 407 { 405 408 /* Show the message: */ 406 409 message(mainWindowShown(), MessageType_Error, … … 409 412 } 410 413 411 void UIMessageCenter::cannotOpenSession(const CMachine &machine, 412 const CProgress &progress /* = CProgress() */) 414 void UIMessageCenter::cannotOpenSession(const CMachine &machine, const CProgress &progress /* = CProgress() */) const 413 415 { 414 416 /* Format error-info: */ … … 423 425 /* Show the message: */ 424 426 message(mainWindowShown(), MessageType_Error, 425 tr("Failed to open a session for the virtual machine <b>%1</b>.").arg(strName), 427 tr("Failed to open a session for the virtual machine <b>%1</b>.") 428 .arg(strName), 426 429 strErrorInfo); 427 430 } 428 431 429 void UIMessageCenter::cannotGetMediaAccessibility(const UIMedium &medium) 432 void UIMessageCenter::cannotGetMediaAccessibility(const UIMedium &medium) const 430 433 { 431 434 message(mainWindowShown(), MessageType_Error, … … 435 438 } 436 439 437 void UIMessageCenter::cannotOpenURL(const QString &strUrl) 440 void UIMessageCenter::cannotOpenURL(const QString &strUrl) const 438 441 { 439 442 message(mainWindowShown(), MessageType_Error, … … 443 446 } 444 447 445 void UIMessageCenter::cannotOpenMachine(const CVirtualBox &vbox, const QString &strMachinePath) 448 void UIMessageCenter::cannotOpenMachine(const CVirtualBox &vbox, const QString &strMachinePath) const 446 449 { 447 450 message(mainWindowShown(), MessageType_Error, 448 tr("Failed to open virtual machine located in %1.").arg(strMachinePath), 451 tr("Failed to open virtual machine located in %1.") 452 .arg(strMachinePath), 449 453 formatErrorInfo(vbox)); 450 454 } 451 455 452 void UIMessageCenter::cannotReregisterExistingMachine(const QString &strMachinePath, const QString &strMachineName) 456 void UIMessageCenter::cannotReregisterExistingMachine(const QString &strMachinePath, const QString &strMachineName) const 453 457 { 454 458 message(mainWindowShown(), MessageType_Error, … … 457 461 } 458 462 459 void UIMessageCenter::cannotResolveCollisionAutomatically(const QString &strName, const QString &strGroupName) 463 void UIMessageCenter::cannotResolveCollisionAutomatically(const QString &strName, const QString &strGroupName) const 460 464 { 461 465 message(mainWindowShown(), MessageType_Error, … … 466 470 } 467 471 468 bool UIMessageCenter::confirmAutomaticCollisionResolve(const QString &strName, const QString &strGroupName) 472 bool UIMessageCenter::confirmAutomaticCollisionResolve(const QString &strName, const QString &strGroupName) const 469 473 { 470 474 return messageOkCancel(mainWindowShown(), MessageType_Question, … … 473 477 "<p>Would you like to automatically rename it?</p>") 474 478 .arg(strName, strGroupName), 475 0 , /* auto-confirm id */479 0 /* auto-confirm id */, 476 480 tr("Rename")); 477 481 } 478 482 479 void UIMessageCenter::cannotSetGroups(const CMachine &machine) 483 void UIMessageCenter::cannotSetGroups(const CMachine &machine) const 480 484 { 481 485 /* Preserve error-info: */ … … 487 491 /* Show the message: */ 488 492 message(mainWindowShown(), MessageType_Error, 489 tr("Failed to set groups of the virtual machine <b>%1</b>.").arg(strName), 493 tr("Failed to set groups of the virtual machine <b>%1</b>.") 494 .arg(strName), 490 495 formatErrorInfo(res)); 491 496 } 492 497 493 bool UIMessageCenter::confirmMachineItemRemoval(const QStringList &names) 498 bool UIMessageCenter::confirmMachineItemRemoval(const QStringList &names) const 494 499 { 495 500 return messageOkCancel(mainWindowShown(), MessageType_Question, 496 tr("<p>You are about to remove following virtual " 497 "machine items from the machine list:</p>" 498 "<p><b>%1</b></p>" 499 "<p>Do you wish to proceed?</p>").arg(names.join(", ")), 500 0, /* auto-confirm id */ 501 tr("<p>You are about to remove following virtual machine items from the machine list:</p>" 502 "<p><b>%1</b></p><p>Do you wish to proceed?</p>") 503 .arg(names.join(", ")), 504 0 /* auto-confirm id */, 501 505 tr("Remove")); 502 506 } 503 507 504 int UIMessageCenter::confirmMachineRemoval(const QList<CMachine> &machines) 508 int UIMessageCenter::confirmMachineRemoval(const QList<CMachine> &machines) const 505 509 { 506 510 /* Enumerate the machines: */ … … 567 571 return cInacessibleMachineCount == machines.size() ? 568 572 message(mainWindowShown(), MessageType_Question, 569 strText, 0 , /* auto-confirm id */573 strText, 0 /* auto-confirm id */, 570 574 QIMessageBox::Ok | QIMessageBox::Default, 571 575 QIMessageBox::Cancel | QIMessageBox::Escape, … … 573 577 tr("Remove")) : 574 578 message(mainWindowShown(), MessageType_Question, 575 strText, 0 , /* auto-confirm id */579 strText, 0 /* auto-confirm id */, 576 580 QIMessageBox::Yes, 577 581 QIMessageBox::No | QIMessageBox::Default, … … 581 585 } 582 586 583 void UIMessageCenter::cannotRemoveMachine(const CMachine &machine) 587 void UIMessageCenter::cannotRemoveMachine(const CMachine &machine) const 584 588 { 585 589 /* Preserve error-info: */ … … 593 597 } 594 598 595 void UIMessageCenter::cannotRemoveMachine(const CMachine &machine, const CProgress &progress) 599 void UIMessageCenter::cannotRemoveMachine(const CMachine &machine, const CProgress &progress) const 596 600 { 597 601 message(mainWindowShown(), … … 602 606 } 603 607 604 bool UIMessageCenter::remindAboutInaccessibleMedia() 608 bool UIMessageCenter::remindAboutInaccessibleMedia() const 605 609 { 606 610 return messageOkCancel(mainWindowShown(), MessageType_Warning, … … 616 620 } 617 621 618 bool UIMessageCenter::confirmDiscardSavedState(const QString &strNames) 622 bool UIMessageCenter::confirmDiscardSavedState(const QString &strNames) const 619 623 { 620 624 return messageOkCancel(mainWindowShown(), MessageType_Question, … … 628 632 } 629 633 630 bool UIMessageCenter::confirmVMReset(const QString &strNames) 634 bool UIMessageCenter::confirmVMReset(const QString &strNames) const 631 635 { 632 636 return messageOkCancel(mainWindowShown(), MessageType_Question, … … 639 643 } 640 644 641 bool UIMessageCenter::confirmVMACPIShutdown(const QString &strNames) 645 bool UIMessageCenter::confirmVMACPIShutdown(const QString &strNames) const 642 646 { 643 647 return messageOkCancel(mainWindowShown(), MessageType_Question, … … 649 653 } 650 654 651 bool UIMessageCenter::confirmVMPowerOff(const QString &strNames) 655 bool UIMessageCenter::confirmVMPowerOff(const QString &strNames) const 652 656 { 653 657 return messageOkCancel(mainWindowShown(), MessageType_Question, … … 660 664 } 661 665 662 void UIMessageCenter::cannotDiscardSavedState(const CConsole &console) 666 void UIMessageCenter::cannotDiscardSavedState(const CConsole &console) const 663 667 { 664 668 /* Preserve error-info: */ … … 671 675 } 672 676 673 void UIMessageCenter::cannotStopMachine(const CConsole &console) 677 void UIMessageCenter::cannotStopMachine(const CConsole &console) const 674 678 { 675 679 /* Preserve error-info: */ … … 682 686 } 683 687 684 int UIMessageCenter::confirmSnapshotRestoring(const QString &strSnapshotName, bool fAlsoCreateNewSnapshot) 688 int UIMessageCenter::confirmSnapshotRestoring(const QString &strSnapshotName, bool fAlsoCreateNewSnapshot) const 685 689 { 686 690 return fAlsoCreateNewSnapshot ? … … 698 702 tr("Restore"), tr("Cancel"), QString() /* 3rd button text */) : 699 703 message(mainWindowShown(), MessageType_Question, 700 tr("<p>Are you sure you want to restore snapshot <nobr><b>%1</b></nobr>?</p>").arg(strSnapshotName), 704 tr("<p>Are you sure you want to restore snapshot <nobr><b>%1</b></nobr>?</p>") 705 .arg(strSnapshotName), 701 706 0 /* auto-confirm id */, 702 707 QIMessageBox::Ok | QIMessageBox::Default, … … 706 711 } 707 712 708 bool UIMessageCenter::confirmSnapshotRemoval(const QString &strSnapshotName) 713 bool UIMessageCenter::confirmSnapshotRemoval(const QString &strSnapshotName) const 709 714 { 710 715 return messageOkCancel(mainWindowShown(), MessageType_Question, 711 716 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>") 717 "several image files that VirtualBox has created together with the snapshot will be merged into one file. " 718 "This can be a lengthy process, and the information in the snapshot cannot be recovered.</p>" 719 "</p>Are you sure you want to delete the selected snapshot <b>%1</b>?</p>") 714 720 .arg(strSnapshotName), 715 721 0 /* auto-confirm id */, 716 tr("Delete") , tr("Cancel"));722 tr("Delete")); 717 723 } 718 724 … … 720 726 const QString &strTargetImageName, 721 727 const QString &strTargetImageMaxSize, 722 const QString &strTargetFileSystemFree) 728 const QString &strTargetFileSystemFree) const 723 729 { 724 730 return messageOkCancel(mainWindowShown(), MessageType_Question, … … 735 741 } 736 742 737 void UIMessageCenter::cannotRestoreSnapshot(const CConsole &console, const QString &strSnapshotName) 743 void UIMessageCenter::cannotRestoreSnapshot(const CConsole &console, const QString &strSnapshotName) const 738 744 { 739 745 message(mainWindowShown(), MessageType_Error, … … 743 749 } 744 750 745 void UIMessageCenter::cannotRestoreSnapshot(const CProgress &progress, const QString &strSnapshotName) 751 void UIMessageCenter::cannotRestoreSnapshot(const CProgress &progress, const QString &strSnapshotName) const 746 752 { 747 753 /* Get console: */ … … 756 762 } 757 763 758 void UIMessageCenter::cannotRemoveSnapshot(const CConsole &console, const QString &strSnapshotName) 764 void UIMessageCenter::cannotRemoveSnapshot(const CConsole &console, const QString &strSnapshotName) const 759 765 { 760 766 message(mainWindowShown(), MessageType_Error, … … 765 771 } 766 772 767 void UIMessageCenter::cannotRemoveSnapshot(const CProgress &progress, 768 const QString &strSnapshotName) 773 void UIMessageCenter::cannotRemoveSnapshot(const CProgress &progress, const QString &strSnapshotName) const 769 774 { 770 775 /* Get console: */ … … 774 779 /* Show the message: */ 775 780 message(mainWindowShown(), MessageType_Error, 776 tr("Failed to delete the snapshot <b>%1</b> of the virtual machine <b>%2</b>.") 777 .arg(strSnapshotName) 778 .arg(console.GetMachine().GetName()), 779 formatErrorInfo(progress.GetErrorInfo())); 780 } 781 782 void UIMessageCenter::cannotSetSystemProperties(const CSystemProperties &properties) 783 { 784 message(mainWindowShown(), MessageType_Critical, 785 tr("Failed to set global VirtualBox properties."), 786 formatErrorInfo(properties)); 787 } 788 789 void UIMessageCenter::cannotAccessUSB(const COMBaseWithEI &object) 781 tr("Failed to delete the snapshot <b>%1</b> of the virtual machine <b>%2</b>.") 782 .arg(strSnapshotName) 783 .arg(console.GetMachine().GetName()), 784 formatErrorInfo(progress.GetErrorInfo())); 785 } 786 787 void UIMessageCenter::cannotAccessUSB(const COMBaseWithEI &object) const 790 788 { 791 789 /* If IMachine::GetUSBController(), IHost::GetUSBDevices() etc. return … … 795 793 if (res.rc() == E_NOTIMPL) 796 794 return; 797 795 /* Show the message: */ 798 796 message(mainWindowShown(), res.isWarning() ? MessageType_Warning : MessageType_Error, 799 797 tr("Failed to access the USB subsystem."), … … 802 800 } 803 801 804 void UIMessageCenter::cannotLoadMachineSettings(const CMachine &machine, bool fStrict /*= true*/, QWidget *pParent /*= 0*/) 805 { 806 /* This function is NOT use currently. 807 * We are keeping it here just for convinience with Save analog. */ 808 809 /* Preserve error-info. 810 * If COM result code is E_NOTIMPL, it means the requested 811 * object or function is intentionally missing (as in the OSE version). 812 * Don't show the error message in this case. */ 813 COMResult res(machine); 814 if (!fStrict && res.rc() == E_NOTIMPL) 815 return; 816 817 /* Show the message: */ 818 message(pParent ? pParent : mainWindowShown(), MessageType_Error, 819 tr("Failed to load the settings of the virtual machine " 820 "<b>%1</b> from <b><nobr>%2</nobr></b>.") 821 .arg(machine.GetName(), machine.GetSettingsFilePath()), 822 formatErrorInfo(res)); 823 } 824 825 void UIMessageCenter::cannotSaveMachineSettings(const CMachine &machine, QWidget *pParent /*= 0*/) 802 void UIMessageCenter::cannotSetSystemProperties(const CSystemProperties &properties) const 803 { 804 message(mainWindowShown(), MessageType_Critical, 805 tr("Failed to set global VirtualBox properties."), 806 formatErrorInfo(properties)); 807 } 808 809 void UIMessageCenter::cannotSaveMachineSettings(const CMachine &machine, QWidget *pParent /*= 0*/) const 826 810 { 827 811 /* Preserve error-info: */ … … 829 813 /* Show the message: */ 830 814 message(pParent ? pParent : mainWindowShown(), MessageType_Error, 831 tr("Failed to save the settings of the virtual machine " 832 "<b>%1</b> to <b><nobr>%2</nobr></b>.") 815 tr("Failed to save the settings of the virtual machine <b>%1</b> to <b><nobr>%2</nobr></b>.") 833 816 .arg(machine.GetName(), machine.GetSettingsFilePath()), 834 817 formatErrorInfo(res)); 835 818 } 836 819 837 void UIMessageCenter::warnAboutStateChange(QWidget *pParent) 838 { 820 void UIMessageCenter::warnAboutStateChange(QWidget *pParent /*= 0*/) const 821 { 822 /* Do not show this async warning more than one at time: */ 839 823 if (warningShown("warnAboutStateChange")) 840 824 return; 841 825 setWarningShown("warnAboutStateChange", true); 842 826 /* Show the message: */ 843 827 message(pParent ? pParent : mainWindowShown(), MessageType_Warning, 844 828 tr("The virtual machine that you are changing has been started. " 845 829 "Only certain settings can be changed while a machine is running. " 846 830 "All other changes will be lost if you close this window now.")); 847 831 /* Allow to show this async warning: */ 848 832 setWarningShown("warnAboutStateChange", false); 849 833 } 850 834 851 bool UIMessageCenter::confirmSettingsReloading(QWidget *pParent) 852 { 853 int rc = message(pParent, MessageType_Question, 854 tr("<p>The machine settings were changed while you were editing them. " 855 "You currently have unsaved setting changes.</p>" 856 "<p>Would you like to reload the changed settings or to keep your own changes?</p>"), 0, 857 QIMessageBox::Yes, QIMessageBox::No | QIMessageBox::Default | QIMessageBox::Escape, 0, 858 tr("Reload settings"), tr("Keep changes"), 0); 859 return rc == QIMessageBox::Yes; 860 } 861 862 int UIMessageCenter::askAboutHardDiskAttachmentCreation(QWidget *pParent, 863 const QString &strControllerName) 864 { 865 return message(pParent, MessageType_Question, 835 bool UIMessageCenter::confirmSettingsReloading(QWidget *pParent /*= 0*/) const 836 { 837 return messageOkCancel(pParent ? pParent : mainWindowShown(), MessageType_Question, 838 tr("<p>The machine settings were changed while you were editing them. " 839 "You currently have unsaved setting changes.</p>" 840 "<p>Would you like to reload the changed settings or to keep your own changes?</p>"), 841 0 /* auto-confirm id */, 842 tr("Reload settings"), tr("Keep changes")); 843 } 844 845 bool UIMessageCenter::confirmDeletingHostInterface(const QString &strName, QWidget *pParent /*= 0*/) const 846 { 847 return messageOkCancel(pParent ? pParent : mainWindowShown(), MessageType_Question, 848 tr("<p>Deleting this host-only network will remove " 849 "the host-only interface this network is based on. Do you want to " 850 "remove the (host-only network) interface <nobr><b>%1</b>?</nobr></p>" 851 "<p><b>Note:</b> this interface may be in use by one or more " 852 "virtual network adapters belonging to one of your VMs. " 853 "After it is removed, these adapters will no longer be usable until " 854 "you correct their settings by either choosing a different interface " 855 "name or a different adapter attachment type.</p>") 856 .arg(strName), 857 0 /* auto-confirm id */, 858 tr("Remove")); 859 } 860 861 int UIMessageCenter::askAboutHardDiskAttachmentCreation(const QString &strControllerName, QWidget *pParent /*= 0*/) const 862 { 863 return message(pParent ? pParent : mainWindowShown(), MessageType_Question, 866 864 tr("<p>You are about to add a virtual hard disk to controller <b>%1</b>.</p>" 867 865 "<p>Would you like to create a new, empty file to hold the disk contents or select an existing one?</p>") 868 .arg(strControllerName),869 0 , /* auto-confirm id */866 .arg(strControllerName), 867 0 /* auto-confirm id */, 870 868 QIMessageBox::Yes, 871 869 QIMessageBox::No, … … 875 873 } 876 874 877 int UIMessageCenter::askAboutOpticalAttachmentCreation(QWidget *pParent, 878 const QString &strControllerName) 879 { 880 return message(pParent, MessageType_Question, 875 int UIMessageCenter::askAboutOpticalAttachmentCreation(const QString &strControllerName, QWidget *pParent /*= 0*/) const 876 { 877 return message(pParent ? pParent : mainWindowShown(), MessageType_Question, 881 878 tr("<p>You are about to add a new CD/DVD drive to controller <b>%1</b>.</p>" 882 879 "<p>Would you like to choose a virtual CD/DVD disk to put in the drive " 883 880 "or to leave it empty for now?</p>") 884 .arg(strControllerName),885 0 , /* auto-confirm id */881 .arg(strControllerName), 882 0 /* auto-confirm id */, 886 883 QIMessageBox::Yes, 887 884 QIMessageBox::No, … … 891 888 } 892 889 893 int UIMessageCenter::askAboutFloppyAttachmentCreation(QWidget *pParent, 894 const QString &strControllerName) 895 { 896 return message(pParent, MessageType_Question, 890 int UIMessageCenter::askAboutFloppyAttachmentCreation(const QString &strControllerName, QWidget *pParent /*= 0*/) const 891 { 892 return message(pParent ? pParent : mainWindowShown(), MessageType_Question, 897 893 tr("<p>You are about to add a new floppy drive to controller <b>%1</b>.</p>" 898 894 "<p>Would you like to choose a virtual floppy disk to put in the drive " 899 895 "or to leave it empty for now?</p>") 900 .arg(strControllerName),901 0 , /* auto-confirm id */896 .arg(strControllerName), 897 0 /* auto-confirm id */, 902 898 QIMessageBox::Yes, 903 899 QIMessageBox::No, … … 907 903 } 908 904 909 int UIMessageCenter::confirmRemovingOfLastDVDDevice() const 910 { 911 return messageOkCancel(QApplication::activeWindow(), MessageType_Info, 912 tr("<p>Are you sure you want to delete the CD/DVD-ROM device?</p>" 913 "<p>You will not be able to mount any CDs or ISO images " 914 "or install the Guest Additions without it!</p>"), 915 0, /* auto-confirm id */ 916 tr("&Remove", "medium")); 917 } 918 919 int UIMessageCenter::confirmDeletingHostInterface(const QString &strName, 920 QWidget *pParent) 921 { 922 return msgCenter().message(pParent, MessageType_Question, 923 tr("<p>Deleting this host-only network will remove " 924 "the host-only interface this network is based on. Do you want to " 925 "remove the (host-only network) interface <nobr><b>%1</b>?</nobr></p>" 926 "<p><b>Note:</b> this interface may be in use by one or more " 927 "virtual network adapters belonging to one of your VMs. " 928 "After it is removed, these adapters will no longer be usable until " 929 "you correct their settings by either choosing a different interface " 930 "name or a different adapter attachment type.</p>").arg(strName), 931 0, /* auto-confirm id */ 932 QIMessageBox::Ok | QIMessageBox::Default, 933 QIMessageBox::Cancel | QIMessageBox::Escape); 934 } 935 936 void UIMessageCenter::warnAboutIncorrectPort(QWidget *pParent) const 937 { 938 message(pParent, MessageType_Error, 905 int UIMessageCenter::confirmRemovingOfLastDVDDevice(QWidget *pParent /*= 0*/) const 906 { 907 return messageOkCancel(pParent ? pParent : mainWindowShown(), MessageType_Info, 908 tr("<p>Are you sure you want to delete the CD/DVD-ROM device?</p>" 909 "<p>You will not be able to mount any CDs or ISO images " 910 "or install the Guest Additions without it!</p>"), 911 0 /* auto-confirm id */, 912 tr("&Remove", "medium")); 913 } 914 915 void UIMessageCenter::warnAboutIncorrectPort(QWidget *pParent /*= 0*/) const 916 { 917 message(pParent ? pParent : mainWindowShown(), MessageType_Error, 939 918 tr("The current port forwarding rules are not valid. " 940 919 "None of the host or guest port values may be set to zero.")); 941 920 } 942 921 943 bool UIMessageCenter::confirmCancelingPortForwardingDialog(QWidget *pParent ) const944 { 945 return messageOkCancel(pParent , MessageType_Question,946 tr("<p>There are unsaved changes in the port forwarding configuration.</p>"947 "<p>If you proceed your changes will be discarded.</p>"));922 bool UIMessageCenter::confirmCancelingPortForwardingDialog(QWidget *pParent /*= 0*/) const 923 { 924 return messageOkCancel(pParent ? pParent : mainWindowShown(), MessageType_Question, 925 tr("<p>There are unsaved changes in the port forwarding configuration.</p>" 926 "<p>If you proceed your changes will be discarded.</p>")); 948 927 } 949 928 … … 1013 992 1014 993 return messageOkCancel(pParent, MessageType_Question, msg, 1015 "confirmRemoveMedium" , /* auto-confirm id */994 "confirmRemoveMedium" /* auto-confirm id */, 1016 995 tr("Remove", "medium")); 1017 996 } … … 1030 1009 "disk to the list later again.</p>") 1031 1010 .arg(strLocation), 1032 0 , /* auto-confirm id */1011 0 /* auto-confirm id */, 1033 1012 QIMessageBox::Yes, 1034 1013 QIMessageBox::No | QIMessageBox::Default, … … 1273 1252 "until you add one. In the mean time you will only be able to start the " 1274 1253 "machine using a virtual optical disk or from the network."), 1275 0 , /* auto-confirm id */1254 0 /* auto-confirm id */, 1276 1255 QIMessageBox::Ok, 1277 1256 QIMessageBox::Cancel | QIMessageBox::Default | QIMessageBox::Escape, … … 1354 1333 strMachineNames.size()).arg(VBoxGlobal::toHumanReadableList(strMachineNames)), 1355 1334 0 /* auto-confirm id */, 1356 tr("Continue") , tr("Cancel"));1335 tr("Continue")); 1357 1336 } 1358 1337 … … 1563 1542 .arg(strMachineName) 1564 1543 .arg(strIfNames), 1565 0 , /* auto-confirm id */1544 0 /* auto-confirm id */, 1566 1545 tr("Change Network Settings"), 1567 1546 tr("Close Virtual Machine")); … … 1861 1840 "or press <b>Cancel</b> to cancel the operation.</p>") 1862 1841 .arg(VBoxGlobal::formatSize(uMinVRAM)), 1863 0 , /* auto-confirm id */1842 0 /* auto-confirm id */, 1864 1843 QIMessageBox::Ignore | QIMessageBox::Default, 1865 1844 QIMessageBox::Cancel | QIMessageBox::Escape); … … 1886 1865 "or press <b>Cancel</b> to cancel the operation.</p>") 1887 1866 .arg(VBoxGlobal::formatSize(uMinVRAM)), 1888 0 , /* auto-confirm id */1867 0 /* auto-confirm id */, 1889 1868 QIMessageBox::Ignore | QIMessageBox::Default, 1890 1869 QIMessageBox::Cancel | QIMessageBox::Escape); … … 2035 2014 "it is recommended to press <b>OK</b> now.</p>") 2036 2015 .arg(strLogFolder), 2037 0 , /* auto-confirm id */2016 0 /* auto-confirm id */, 2038 2017 QIMessageBox::Ok | QIMessageBox::Default, 2039 2018 QIMessageBox::Ignore | QIMessageBox::Escape); … … 2078 2057 "<nobr><a href=\"%1\">%2</a></nobr> " 2079 2058 "(size %3 bytes)?</p>").arg(strUrl).arg(strUrl).arg(loc.toString(uSize)), 2080 0 , /* auto-confirm id */2059 0 /* auto-confirm id */, 2081 2060 tr("Download", "additions")); 2082 2061 } … … 2092 2071 "on the virtual CD/DVD drive?</p>") 2093 2072 .arg(strUrl).arg(strUrl).arg(strSrc), 2094 0 , /* auto-confirm id */2073 0 /* auto-confirm id */, 2095 2074 tr("Mount", "additions")); 2096 2075 } … … 2110 2089 "download this file from the Internet?</p>") 2111 2090 .arg(strMissedLocation), 2112 0 , /* Auto-confirm Id */2091 0 /* auto-confirm id */, 2113 2092 tr("Download", "additions")); 2114 2093 } … … 2122 2101 "<nobr><a href=\"%1\">%2</a></nobr> " 2123 2102 "(size %3 bytes)?</p>").arg(strURL).arg(strURL).arg(loc.toString(uSize)), 2124 0 , /* Auto-confirm Id */2103 0 /* auto-confirm id */, 2125 2104 tr("Download", "additions")); 2126 2105 } … … 2154 2133 "<p>Do you wish to download latest one from the Internet?</p>") 2155 2134 .arg(strExtPackVersion).arg(strExtPackName), 2156 0 , /* Auto-confirm Id */2135 0 /* auto-confirm id */, 2157 2136 tr("Download", "extension pack")); 2158 2137 } … … 2164 2143 "<p>You should download and install version %3 of this extension pack from Oracle!</p>") 2165 2144 .arg(strExtPackVersion).arg(strExtPackName).arg(strVBoxVersion), 2166 0 , /* Auto-confirm Id */2145 0 /* auto-confirm id */, 2167 2146 QIMessageBox::Ok | QIMessageBox::Default, 2168 2147 0, … … 2178 2157 "from <nobr><a href=\"%2\">%2</a></nobr> (size %3 bytes)?</p>") 2179 2158 .arg(strExtPackName, strURL, loc.toString(uSize)), 2180 0 , /* Auto-confirm Id */2159 0 /* auto-confirm id */, 2181 2160 tr("Download", "extension pack")); 2182 2161 } … … 2190 2169 "<p>Do you wish to install this extension pack?</p>") 2191 2170 .arg(strExtPackName, strFrom, strTo), 2192 0 , /* Auto-confirm Id */2171 0 /* auto-confirm id */, 2193 2172 tr ("Install", "extension pack")); 2194 2173 } -
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h
r45285 r45288 78 78 /* API: Warning registration stuff: */ 79 79 bool warningShown(const QString &strWarningName) const; 80 void setWarningShown(const QString &strWarningName, bool fWarningShown) ;80 void setWarningShown(const QString &strWarningName, bool fWarningShown) const; 81 81 82 82 /* API: Alert providing stuff: Main function: */ … … 186 186 /* API: Main (startup) warnings: */ 187 187 #ifdef RT_OS_LINUX 188 void warnAboutWrongUSBMounted() ;188 void warnAboutWrongUSBMounted() const; 189 189 #endif /* RT_OS_LINUX */ 190 void cannotStartSelector() ;191 void showBETAWarning() ;192 void showBEBWarning() ;190 void cannotStartSelector() const; 191 void showBETAWarning() const; 192 void showBEBWarning() const; 193 193 194 194 /* API: COM startup warnings: */ 195 void cannotInitUserHome(const QString &strUserHome) ;196 void cannotInitCOM(HRESULT rc) ;197 void cannotCreateVirtualBox(const CVirtualBox &vbox) ;195 void cannotInitUserHome(const QString &strUserHome) const; 196 void cannotInitCOM(HRESULT rc) const; 197 void cannotCreateVirtualBox(const CVirtualBox &vbox) const; 198 198 199 199 /* API: Global warnings: */ 200 void cannotFindLanguage(const QString &strLangId, const QString &strNlsPath) ;201 void cannotLoadLanguage(const QString &strLangFile) ;202 void cannotLoadGlobalConfig(const CVirtualBox &vbox, const QString &strError) ;203 void cannotSaveGlobalConfig(const CVirtualBox &vbox) ;204 void cannotFindMachineByName(const CVirtualBox &vbox, const QString &strName) ;205 void cannotFindMachineById(const CVirtualBox &vbox, const QString &strId) ;206 void cannotOpenSession(const CSession &session) ;207 void cannotOpenSession(const CMachine &machine, const CProgress &progress = CProgress()) ;208 void cannotGetMediaAccessibility(const UIMedium &medium) ;209 void cannotOpenURL(const QString &strUrl) ;200 void cannotFindLanguage(const QString &strLangId, const QString &strNlsPath) const; 201 void cannotLoadLanguage(const QString &strLangFile) const; 202 void cannotLoadGlobalConfig(const CVirtualBox &vbox, const QString &strError) const; 203 void cannotSaveGlobalConfig(const CVirtualBox &vbox) const; 204 void cannotFindMachineByName(const CVirtualBox &vbox, const QString &strName) const; 205 void cannotFindMachineById(const CVirtualBox &vbox, const QString &strId) const; 206 void cannotOpenSession(const CSession &session) const; 207 void cannotOpenSession(const CMachine &machine, const CProgress &progress = CProgress()) const; 208 void cannotGetMediaAccessibility(const UIMedium &medium) const; 209 void cannotOpenURL(const QString &strUrl) const; 210 210 211 211 /* API: Selector warnings: */ 212 void cannotOpenMachine(const CVirtualBox &vbox, const QString &strMachinePath) ;213 void cannotReregisterExistingMachine(const QString &strMachinePath, const QString &strMachineName) ;214 void cannotResolveCollisionAutomatically(const QString &strName, const QString &strGroupName) ;215 bool confirmAutomaticCollisionResolve(const QString &strName, const QString &strGroupName) ;216 void cannotSetGroups(const CMachine &machine) ;217 bool confirmMachineItemRemoval(const QStringList &names) ;218 int confirmMachineRemoval(const QList<CMachine> &machines) ;219 void cannotRemoveMachine(const CMachine &machine) ;220 void cannotRemoveMachine(const CMachine &machine, const CProgress &progress) ;221 bool remindAboutInaccessibleMedia() ;222 bool confirmDiscardSavedState(const QString &strNames) ;223 bool confirmVMReset(const QString &strNames) ;224 bool confirmVMACPIShutdown(const QString &strNames) ;225 bool confirmVMPowerOff(const QString &strNames) ;226 void cannotDiscardSavedState(const CConsole &console) ;227 void cannotStopMachine(const CConsole &console) ;212 void cannotOpenMachine(const CVirtualBox &vbox, const QString &strMachinePath) const; 213 void cannotReregisterExistingMachine(const QString &strMachinePath, const QString &strMachineName) const; 214 void cannotResolveCollisionAutomatically(const QString &strName, const QString &strGroupName) const; 215 bool confirmAutomaticCollisionResolve(const QString &strName, const QString &strGroupName) const; 216 void cannotSetGroups(const CMachine &machine) const; 217 bool confirmMachineItemRemoval(const QStringList &names) const; 218 int confirmMachineRemoval(const QList<CMachine> &machines) const; 219 void cannotRemoveMachine(const CMachine &machine) const; 220 void cannotRemoveMachine(const CMachine &machine, const CProgress &progress) const; 221 bool remindAboutInaccessibleMedia() const; 222 bool confirmDiscardSavedState(const QString &strNames) const; 223 bool confirmVMReset(const QString &strNames) const; 224 bool confirmVMACPIShutdown(const QString &strNames) const; 225 bool confirmVMPowerOff(const QString &strNames) const; 226 void cannotDiscardSavedState(const CConsole &console) const; 227 void cannotStopMachine(const CConsole &console) const; 228 228 229 229 /* API: Snapshot warnings: */ 230 int confirmSnapshotRestoring(const QString &strSnapshotName, bool fAlsoCreateNewSnapshot) ;231 bool confirmSnapshotRemoval(const QString &strSnapshotName) ;230 int confirmSnapshotRestoring(const QString &strSnapshotName, bool fAlsoCreateNewSnapshot) const; 231 bool confirmSnapshotRemoval(const QString &strSnapshotName) const; 232 232 bool warnAboutSnapshotRemovalFreeSpace(const QString &strSnapshotName, const QString &strTargetImageName, 233 const QString &strTargetImageMaxSize, const QString &strTargetFileSystemFree) ;234 void cannotRestoreSnapshot(const CConsole &console, const QString &strSnapshotName) ;235 void cannotRestoreSnapshot(const CProgress &progress, const QString &strSnapshotName) ;236 void cannotRemoveSnapshot(const CConsole &console, const QString &strSnapshotName) ;237 void cannotRemoveSnapshot(const CProgress &progress, const QString &strSnapshotName) ;233 const QString &strTargetImageMaxSize, const QString &strTargetFileSystemFree) const; 234 void cannotRestoreSnapshot(const CConsole &console, const QString &strSnapshotName) const; 235 void cannotRestoreSnapshot(const CProgress &progress, const QString &strSnapshotName) const; 236 void cannotRemoveSnapshot(const CConsole &console, const QString &strSnapshotName) const; 237 void cannotRemoveSnapshot(const CProgress &progress, const QString &strSnapshotName) const; 238 238 239 239 /* API: Settings warnings: */ 240 void cannotSetSystemProperties(const CSystemProperties &properties); 241 void cannotAccessUSB(const COMBaseWithEI &object); 242 void cannotLoadMachineSettings(const CMachine &machine, bool fStrict = true, QWidget *pParent = 0); 243 void cannotSaveMachineSettings(const CMachine &machine, QWidget *pParent = 0); 244 void warnAboutStateChange(QWidget *pParent); 245 bool confirmSettingsReloading(QWidget *pParent); 246 int askAboutHardDiskAttachmentCreation(QWidget *pParent, const QString &strControllerName); 247 int askAboutOpticalAttachmentCreation(QWidget *pParent, const QString &strControllerName); 248 int askAboutFloppyAttachmentCreation(QWidget *pParent, const QString &strControllerName); 249 int confirmRemovingOfLastDVDDevice() const; 250 int confirmDeletingHostInterface(const QString &strName, QWidget *pParent = 0); 251 void warnAboutIncorrectPort(QWidget *pParent) const; 252 bool confirmCancelingPortForwardingDialog(QWidget *pParent) const; 240 void cannotAccessUSB(const COMBaseWithEI &object) const; 241 void cannotSetSystemProperties(const CSystemProperties &properties) const; 242 void cannotSaveMachineSettings(const CMachine &machine, QWidget *pParent = 0) const; 243 void warnAboutStateChange(QWidget *pParent = 0) const; 244 bool confirmSettingsReloading(QWidget *pParent = 0) const; 245 bool confirmDeletingHostInterface(const QString &strName, QWidget *pParent = 0) const; 246 int askAboutHardDiskAttachmentCreation(const QString &strControllerName, QWidget *pParent = 0) const; 247 int askAboutOpticalAttachmentCreation(const QString &strControllerName, QWidget *pParent = 0) const; 248 int askAboutFloppyAttachmentCreation(const QString &strControllerName, QWidget *pParent = 0) const; 249 int confirmRemovingOfLastDVDDevice(QWidget *pParent = 0) const; 250 void warnAboutIncorrectPort(QWidget *pParent = 0) const; 251 bool confirmCancelingPortForwardingDialog(QWidget *pParent = 0) const; 253 252 254 253 /* API: Virtual Medium Manager warnings: */ … … 444 443 445 444 /* Variables: */ 446 QStringList m_warnings;445 mutable QStringList m_warnings; 447 446 }; 448 447 -
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserModel.cpp
r45281 r45288 2006 2006 * with common cleanup in case of failure. 2007 2007 * We have to simulate a try-catch block. */ 2008 bool fSuccess = false;2009 2008 CSession session; 2010 2009 CMachine machine; … … 2024 2023 machine.SetGroups(newGroupList.toVector()); 2025 2024 if (!machine.isOk()) 2025 { 2026 msgCenter().cannotSetGroups(machine); 2026 2027 break; 2028 } 2027 2029 2028 2030 /* 4. Save settings: */ 2029 2031 machine.SaveSettings(); 2030 2032 if (!machine.isOk()) 2033 { 2034 msgCenter().cannotSaveMachineSettings(machine); 2031 2035 break; 2032 2033 /* Transaction complete: */ 2034 fSuccess = true; 2036 } 2035 2037 } while (0); 2036 2038 2037 2039 /* Cleanup if necessary: */ 2038 if (!fSuccess) 2039 { 2040 if (!machine.isNull()) 2041 msgCenter().cannotSaveMachineSettings(machine); 2040 if (machine.isNull() || !machine.isOk()) 2042 2041 emit sigReload(strId); 2043 }2044 2042 if (!session.isNull()) 2045 2043 session.UnlockMachine(); -
trunk/src/VBox/Frontends/VirtualBox/src/settings/global/UIGlobalSettingsNetwork.cpp
r45219 r45288 453 453 QString strInterfaceName(pItem->name()); 454 454 /* Asking user about deleting selected network interface: */ 455 if ( msgCenter().confirmDeletingHostInterface(strInterfaceName, this) == QIMessageBox::Cancel)455 if (!msgCenter().confirmDeletingHostInterface(strInterfaceName, this)) 456 456 return; 457 457 -
trunk/src/VBox/Frontends/VirtualBox/src/settings/machine/UIMachineSettingsStorage.cpp
r44528 r45288 2403 2403 && deviceCount (KDeviceType_DVD) == 1) 2404 2404 { 2405 if ( msgCenter().confirmRemovingOfLastDVDDevice() != QIMessageBox::Ok)2405 if (!msgCenter().confirmRemovingOfLastDVDDevice(this)) 2406 2406 return; 2407 2407 } … … 3045 3045 case KDeviceType_HardDisk: 3046 3046 { 3047 int iAnswer = msgCenter().askAboutHardDiskAttachmentCreation( this, strControllerName);3047 int iAnswer = msgCenter().askAboutHardDiskAttachmentCreation(strControllerName, this); 3048 3048 if (iAnswer == QIMessageBox::Yes) 3049 3049 strMediumId = getWithNewHDWizard(); … … 3054 3054 case KDeviceType_DVD: 3055 3055 { 3056 int iAnswer = msgCenter().askAboutOpticalAttachmentCreation( this, strControllerName);3056 int iAnswer = msgCenter().askAboutOpticalAttachmentCreation(strControllerName, this); 3057 3057 if (iAnswer == QIMessageBox::Yes) 3058 3058 strMediumId = vboxGlobal().openMediumWithFileOpenDialog(UIMediumType_DVD, this, strMachineFolder); … … 3063 3063 case KDeviceType_Floppy: 3064 3064 { 3065 int iAnswer = msgCenter().askAboutFloppyAttachmentCreation( this, strControllerName);3065 int iAnswer = msgCenter().askAboutFloppyAttachmentCreation(strControllerName, this); 3066 3066 if (iAnswer == QIMessageBox::Yes) 3067 3067 strMediumId = vboxGlobal().openMediumWithFileOpenDialog(UIMediumType_Floppy, this, strMachineFolder);
Note:
See TracChangeset
for help on using the changeset viewer.