Changeset 86217 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Sep 22, 2020 12:02:49 PM (4 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/manager/details
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsElement.cpp
r85817 r86217 522 522 case AnchorRole_OSType: 523 523 { 524 /* Prepare popup: */ 525 QPointer<QIDialogContainer> pPopup = new QIDialogContainer(0, Qt::Tool); 526 if (pPopup) 527 { 528 /* Prepare editor: */ 529 UINameAndSystemEditor *pEditor = 530 new UINameAndSystemEditor(pPopup, 531 enmRole == AnchorRole_MachineName /* choose name? */, 532 enmRole == AnchorRole_MachineLocation /* choose path? */, 533 enmRole == AnchorRole_OSType /* choose type? */); 534 if (pEditor) 535 { 536 switch (enmRole) 537 { 538 case AnchorRole_MachineName: pEditor->setName(strData.section(',', 0, 0)); break; 539 case AnchorRole_MachineLocation: pEditor->setPath(strData.section(',', 0, 0)); break; 540 case AnchorRole_OSType: pEditor->setTypeId(strData.section(',', 0, 0)); break; 541 default: break; 542 } 543 544 /* Add to popup: */ 545 pPopup->setWidget(pEditor); 546 } 547 548 /* Adjust popup geometry: */ 549 pPopup->move(QCursor::pos()); 550 pPopup->adjustSize(); 551 552 // WORKAROUND: 553 // On Windows, Tool dialogs aren't activated by default by some reason. 554 // So we have created sltActivateWindow wrapping actual activateWindow 555 // to fix that annoying issue. 556 QMetaObject::invokeMethod(pPopup, "sltActivateWindow", Qt::QueuedConnection); 557 /* Execute popup, change machine name if confirmed: */ 558 if (pPopup->exec() == QDialog::Accepted) 559 { 560 switch (enmRole) 561 { 562 case AnchorRole_MachineName: setMachineAttribute(machine(), MachineAttribute_Name, QVariant::fromValue(pEditor->name())); break; 563 case AnchorRole_MachineLocation: setMachineAttribute(machine(), MachineAttribute_Location, QVariant::fromValue(pEditor->path())); break; 564 case AnchorRole_OSType: setMachineAttribute(machine(), MachineAttribute_OSType, QVariant::fromValue(pEditor->typeId())); break; 565 default: break; 566 } 567 } 568 569 /* Delete popup: */ 570 delete pPopup; 571 } 524 popupNameAndSystemEditor(enmRole == AnchorRole_MachineName /* choose name? */, 525 enmRole == AnchorRole_MachineLocation /* choose path? */, 526 enmRole == AnchorRole_OSType /* choose type? */, 527 strData.section(',', 0, 0) /* value */); 572 528 break; 573 529 } 574 530 case AnchorRole_BaseMemory: 575 531 { 576 /* Prepare popup: */ 577 QPointer<QIDialogContainer> pPopup = new QIDialogContainer(0, Qt::Tool); 578 if (pPopup) 579 { 580 /* Prepare editor: */ 581 UIBaseMemoryEditor *pEditor = new UIBaseMemoryEditor(pPopup, true /* with label */); 582 if (pEditor) 583 { 584 pEditor->setValue(strData.section(',', 0, 0).toInt()); 585 connect(pEditor, &UIBaseMemoryEditor::sigValidChanged, 586 pPopup.data(), &QIDialogContainer::setOkButtonEnabled); 587 pPopup->setWidget(pEditor); 588 } 589 590 /* Adjust popup geometry: */ 591 pPopup->move(QCursor::pos()); 592 pPopup->adjustSize(); 593 594 // WORKAROUND: 595 // On Windows, Tool dialogs aren't activated by default by some reason. 596 // So we have created sltActivateWindow wrapping actual activateWindow 597 // to fix that annoying issue. 598 QMetaObject::invokeMethod(pPopup, "sltActivateWindow", Qt::QueuedConnection); 599 /* Execute popup, change machine name if confirmed: */ 600 if (pPopup->exec() == QDialog::Accepted) 601 setMachineAttribute(machine(), MachineAttribute_BaseMemory, QVariant::fromValue(pEditor->value())); 602 603 /* Delete popup: */ 604 delete pPopup; 605 } 532 popupBaseMemoryEditor(strData.section(',', 0, 0) /* value */); 606 533 break; 607 534 } 608 535 case AnchorRole_BootOrder: 609 536 { 610 /* Prepare popup: */ 611 QPointer<QIDialogContainer> pPopup = new QIDialogContainer(0, Qt::Tool); 612 if (pPopup) 613 { 614 /* Prepare editor: */ 615 UIBootOrderEditor *pEditor = new UIBootOrderEditor(pPopup, true /* with label */); 616 if (pEditor) 617 { 618 pEditor->setValue(bootItemsFromSerializedString(strData.section(',', 0, 0))); 619 pPopup->setWidget(pEditor); 620 } 621 622 /* Adjust popup geometry: */ 623 pPopup->move(QCursor::pos()); 624 pPopup->adjustSize(); 625 626 // WORKAROUND: 627 // On Windows, Tool dialogs aren't activated by default by some reason. 628 // So we have created sltActivateWindow wrapping actual activateWindow 629 // to fix that annoying issue. 630 QMetaObject::invokeMethod(pPopup, "sltActivateWindow", Qt::QueuedConnection); 631 /* Execute popup, change machine name if confirmed: */ 632 if (pPopup->exec() == QDialog::Accepted) 633 setMachineAttribute(machine(), MachineAttribute_BootOrder, QVariant::fromValue(pEditor->value())); 634 635 /* Delete popup: */ 636 delete pPopup; 637 } 537 popupBootOrderEditor(strData.section(',', 0, 0) /* value */); 638 538 break; 639 539 } 640 540 case AnchorRole_VideoMemory: 641 541 { 642 /* Prepare popup: */ 643 QPointer<QIDialogContainer> pPopup = new QIDialogContainer(0, Qt::Tool); 644 if (pPopup) 645 { 646 /* Prepare editor: */ 647 UIVideoMemoryEditor *pEditor = new UIVideoMemoryEditor(pPopup, true /* with label */); 648 if (pEditor) 649 { 650 pEditor->setValue(strData.section(',', 0, 0).toInt()); 651 connect(pEditor, &UIVideoMemoryEditor::sigValidChanged, 652 pPopup.data(), &QIDialogContainer::setOkButtonEnabled); 653 pPopup->setWidget(pEditor); 654 } 655 656 /* Adjust popup geometry: */ 657 pPopup->move(QCursor::pos()); 658 pPopup->adjustSize(); 659 660 // WORKAROUND: 661 // On Windows, Tool dialogs aren't activated by default by some reason. 662 // So we have created sltActivateWindow wrapping actual activateWindow 663 // to fix that annoying issue. 664 QMetaObject::invokeMethod(pPopup, "sltActivateWindow", Qt::QueuedConnection); 665 /* Execute popup, change machine name if confirmed: */ 666 if (pPopup->exec() == QDialog::Accepted) 667 setMachineAttribute(machine(), MachineAttribute_VideoMemory, QVariant::fromValue(pEditor->value())); 668 669 /* Delete popup: */ 670 delete pPopup; 671 } 542 popupVideoMemoryEditor(strData.section(',', 0, 0) /* value */); 672 543 break; 673 544 } 674 545 case AnchorRole_GraphicsControllerType: 675 546 { 676 /* Prepare popup: */ 677 QPointer<QIDialogContainer> pPopup = new QIDialogContainer(0, Qt::Tool); 678 if (pPopup) 679 { 680 /* Prepare editor: */ 681 UIGraphicsControllerEditor *pEditor = new UIGraphicsControllerEditor(pPopup, true /* with label */); 682 if (pEditor) 683 { 684 pEditor->setValue(static_cast<KGraphicsControllerType>(strData.section(',', 0, 0).toInt())); 685 pPopup->setWidget(pEditor); 686 } 687 688 /* Adjust popup geometry: */ 689 pPopup->move(QCursor::pos()); 690 pPopup->adjustSize(); 691 692 // WORKAROUND: 693 // On Windows, Tool dialogs aren't activated by default by some reason. 694 // So we have created sltActivateWindow wrapping actual activateWindow 695 // to fix that annoying issue. 696 QMetaObject::invokeMethod(pPopup, "sltActivateWindow", Qt::QueuedConnection); 697 /* Execute popup, change machine name if confirmed: */ 698 if (pPopup->exec() == QDialog::Accepted) 699 setMachineAttribute(machine(), MachineAttribute_GraphicsControllerType, QVariant::fromValue(pEditor->value())); 700 701 /* Delete popup: */ 702 delete pPopup; 703 } 547 popupGraphicsControllerTypeEditor(strData.section(',', 0, 0) /* value */); 704 548 break; 705 549 } 706 550 case AnchorRole_Storage: 707 551 { 708 /* Prepare storage-menu: */ 709 UIMenu menu; 710 menu.setShowToolTip(true); 711 712 /* Storage-controller name: */ 713 QString strControllerName = strData.section(',', 0, 0); 714 /* Storage-slot: */ 715 StorageSlot storageSlot = gpConverter->fromString<StorageSlot>(strData.section(',', 1)); 716 717 /* Fill storage-menu: */ 718 uiCommon().prepareStorageMenu(menu, this, SLOT(sltMountStorageMedium()), 719 machine(), strControllerName, storageSlot); 720 721 /* Exec menu: */ 722 menu.exec(QCursor::pos()); 552 popupStorageEditor(strData /* complex value */); 723 553 break; 724 554 } 725 555 case AnchorRole_AudioHostDriverType: 726 556 { 727 /* Prepare popup: */ 728 QPointer<QIDialogContainer> pPopup = new QIDialogContainer(0, Qt::Tool); 729 if (pPopup) 730 { 731 /* Prepare editor: */ 732 UIAudioHostDriverEditor *pEditor = new UIAudioHostDriverEditor(pPopup, true /* with label */); 733 if (pEditor) 734 { 735 pEditor->setValue(static_cast<KAudioDriverType>(strData.section(',', 0, 0).toInt())); 736 pPopup->setWidget(pEditor); 737 } 738 739 /* Adjust popup geometry: */ 740 pPopup->move(QCursor::pos()); 741 pPopup->adjustSize(); 742 743 // WORKAROUND: 744 // On Windows, Tool dialogs aren't activated by default by some reason. 745 // So we have created sltActivateWindow wrapping actual activateWindow 746 // to fix that annoying issue. 747 QMetaObject::invokeMethod(pPopup, "sltActivateWindow", Qt::QueuedConnection); 748 /* Execute popup, change machine name if confirmed: */ 749 if (pPopup->exec() == QDialog::Accepted) 750 setMachineAttribute(machine(), MachineAttribute_AudioHostDriverType, QVariant::fromValue(pEditor->value())); 751 752 /* Delete popup: */ 753 delete pPopup; 754 } 557 popupAudioHostDriverTypeEditor(strData.section(',', 0, 0) /* value */); 755 558 break; 756 559 } 757 560 case AnchorRole_AudioControllerType: 758 561 { 759 /* Prepare popup: */ 760 QPointer<QIDialogContainer> pPopup = new QIDialogContainer(0, Qt::Tool); 761 if (pPopup) 762 { 763 /* Prepare editor: */ 764 UIAudioControllerEditor *pEditor = new UIAudioControllerEditor(pPopup, true /* with label */); 765 if (pEditor) 766 { 767 pEditor->setValue(static_cast<KAudioControllerType>(strData.section(',', 0, 0).toInt())); 768 pPopup->setWidget(pEditor); 769 } 770 771 /* Adjust popup geometry: */ 772 pPopup->move(QCursor::pos()); 773 pPopup->adjustSize(); 774 775 // WORKAROUND: 776 // On Windows, Tool dialogs aren't activated by default by some reason. 777 // So we have created sltActivateWindow wrapping actual activateWindow 778 // to fix that annoying issue. 779 QMetaObject::invokeMethod(pPopup, "sltActivateWindow", Qt::QueuedConnection); 780 /* Execute popup, change machine name if confirmed: */ 781 if (pPopup->exec() == QDialog::Accepted) 782 setMachineAttribute(machine(), MachineAttribute_AudioControllerType, QVariant::fromValue(pEditor->value())); 783 784 /* Delete popup: */ 785 delete pPopup; 786 } 562 popupAudioControllerTypeEditor(strData.section(',', 0, 0) /* value */); 787 563 break; 788 564 } 789 565 case AnchorRole_NetworkAttachmentType: 790 566 { 791 /* Prepare popup: */ 792 QPointer<QIDialogContainer> pPopup = new QIDialogContainer(0, Qt::Tool); 793 if (pPopup) 794 { 795 /* Prepare editor: */ 796 UINetworkAttachmentEditor *pEditor = new UINetworkAttachmentEditor(pPopup, true /* with label */); 797 if (pEditor) 798 { 799 pEditor->setValueNames(KNetworkAttachmentType_Bridged, UINetworkAttachmentEditor::bridgedAdapters()); 800 pEditor->setValueNames(KNetworkAttachmentType_Internal, UINetworkAttachmentEditor::internalNetworks()); 801 pEditor->setValueNames(KNetworkAttachmentType_HostOnly, UINetworkAttachmentEditor::hostInterfaces()); 802 pEditor->setValueNames(KNetworkAttachmentType_Generic, UINetworkAttachmentEditor::genericDrivers()); 803 pEditor->setValueNames(KNetworkAttachmentType_NATNetwork, UINetworkAttachmentEditor::natNetworks()); 804 pEditor->setValueType(static_cast<KNetworkAttachmentType>(strData.section(',', 0, 0).section(';', 1, 1).toInt())); 805 pEditor->setValueName(pEditor->valueType(), strData.section(',', 0, 0).section(';', 2, 2)); 806 connect(pEditor, &UINetworkAttachmentEditor::sigValidChanged, 807 pPopup.data(), &QIDialogContainer::setOkButtonEnabled); 808 pPopup->setWidget(pEditor); 809 } 810 811 /* Adjust popup geometry: */ 812 pPopup->move(QCursor::pos()); 813 pPopup->adjustSize(); 814 815 // WORKAROUND: 816 // On Windows, Tool dialogs aren't activated by default by some reason. 817 // So we have created sltActivateWindow wrapping actual activateWindow 818 // to fix that annoying issue. 819 QMetaObject::invokeMethod(pPopup, "sltActivateWindow", Qt::QueuedConnection); 820 /* Execute popup, change machine name if confirmed: */ 821 if (pPopup->exec() == QDialog::Accepted) 822 { 823 UINetworkAdapterDescriptor nad(strData.section(',', 0, 0).section(';', 0, 0).toInt(), 824 pEditor->valueType(), pEditor->valueName(pEditor->valueType())); 825 setMachineAttribute(machine(), MachineAttribute_NetworkAttachmentType, QVariant::fromValue(nad)); 826 } 827 828 /* Delete popup: */ 829 delete pPopup; 830 } 567 popupNetworkAttachmentTypeEditor(strData.section(',', 0, 0) /* value */); 831 568 break; 832 569 } 833 570 case AnchorRole_USBControllerType: 834 571 { 835 /* Parse controller type list: */ 836 UIUSBControllerTypeSet controllerSet; 837 const QStringList controllerInternals = strData.section(',', 0, 0).split(';'); 838 foreach (const QString &strControllerType, controllerInternals) 839 { 840 /* Parse each internal controller description: */ 841 bool fParsed = false; 842 KUSBControllerType enmType = static_cast<KUSBControllerType>(strControllerType.toInt(&fParsed)); 843 if (!fParsed) 844 enmType = KUSBControllerType_Null; 845 controllerSet << enmType; 846 } 847 848 /* Prepare existing controller sets: */ 849 QMap<int, UIUSBControllerTypeSet> controllerSets; 850 controllerSets[0] = UIUSBControllerTypeSet(); 851 controllerSets[1] = UIUSBControllerTypeSet() << KUSBControllerType_OHCI; 852 controllerSets[2] = UIUSBControllerTypeSet() << KUSBControllerType_OHCI << KUSBControllerType_EHCI; 853 controllerSets[3] = UIUSBControllerTypeSet() << KUSBControllerType_XHCI; 854 855 /* Fill menu with actions: */ 856 UIMenu menu; 857 QActionGroup group(&menu); 858 QMap<int, QAction*> actions; 859 actions[0] = menu.addAction(QApplication::translate("UIDetails", "Disabled", "details (usb)")); 860 group.addAction(actions.value(0)); 861 actions.value(0)->setCheckable(true); 862 actions[1] = menu.addAction(QApplication::translate("UIDetails", "USB 1.1 (OHCI) Controller", "details (usb)")); 863 group.addAction(actions.value(1)); 864 actions.value(1)->setCheckable(true); 865 actions[2] = menu.addAction(QApplication::translate("UIDetails", "USB 2.0 (OHCI + EHCI) Controller", "details (usb)")); 866 group.addAction(actions.value(2)); 867 actions.value(2)->setCheckable(true); 868 actions[3] = menu.addAction(QApplication::translate("UIDetails", "USB 3.0 (xHCI) Controller", "details (usb)")); 869 group.addAction(actions.value(3)); 870 actions.value(3)->setCheckable(true); 871 872 /* Mark current one: */ 873 for (int i = 0; i <= 3; ++i) 874 actions.value(i)->setChecked(controllerSets.key(controllerSet) == i); 875 876 /* Execute menu, look for result: */ 877 QAction *pTriggeredAction = menu.exec(QCursor::pos()); 878 if (pTriggeredAction) 879 { 880 const int iTriggeredIndex = actions.key(pTriggeredAction); 881 if (controllerSets.key(controllerSet) != iTriggeredIndex) 882 setMachineAttribute(machine(), MachineAttribute_USBControllerType, QVariant::fromValue(controllerSets.value(iTriggeredIndex))); 883 } 572 popupUSBControllerTypeEditor(strData.section(',', 0, 0) /* value */); 884 573 break; 885 574 } 886 575 case AnchorRole_VisualStateType: 887 576 { 888 /* Prepare popup: */ 889 QPointer<QIDialogContainer> pPopup = new QIDialogContainer(0, Qt::Tool); 890 if (pPopup) 891 { 892 /* Prepare editor: */ 893 UIVisualStateEditor *pEditor = new UIVisualStateEditor(pPopup, true /* with label */); 894 if (pEditor) 895 { 896 pEditor->setMachineId(machine().GetId()); 897 pEditor->setValue(static_cast<UIVisualStateType>(strData.section(',', 0, 0).toInt())); 898 pPopup->setWidget(pEditor); 899 } 900 901 /* Adjust popup geometry: */ 902 pPopup->move(QCursor::pos()); 903 pPopup->adjustSize(); 904 905 // WORKAROUND: 906 // On Windows, Tool dialogs aren't activated by default by some reason. 907 // So we have created sltActivateWindow wrapping actual activateWindow 908 // to fix that annoying issue. 909 QMetaObject::invokeMethod(pPopup, "sltActivateWindow", Qt::QueuedConnection); 910 /* Execute popup, change machine name if confirmed: */ 911 if (pPopup->exec() == QDialog::Accepted) 912 gEDataManager->setRequestedVisualState(pEditor->value(), machine().GetId()); 913 914 /* Delete popup: */ 915 delete pPopup; 916 } 577 popupVisualStateTypeEditor(strData.section(',', 0, 0) /* value */); 917 578 break; 918 579 } 919 580 #ifndef VBOX_WS_MAC 920 581 case AnchorRole_MenuBar: 582 { 583 popupMenuBarEditor(strData.section(',', 0, 0) /* value */); 584 break; 585 } 921 586 #endif 922 587 case AnchorRole_StatusBar: 923 588 { 924 /* Parse whether we have it enabled, true if unable to parse: */ 925 bool fParsed = false; 926 bool fEnabled = strData.section(',', 0, 0).toInt(&fParsed); 927 if (!fParsed) 928 fEnabled = true; 929 930 /* Fill menu with actions, use menu-bar NLS for both cases for simplicity: */ 931 UIMenu menu; 932 QActionGroup group(&menu); 933 QAction *pActionDisable = menu.addAction(QApplication::translate("UIDetails", "Disabled", "details (user interface/menu-bar)")); 934 group.addAction(pActionDisable); 935 pActionDisable->setCheckable(true); 936 pActionDisable->setChecked(!fEnabled); 937 QAction *pActionEnable = menu.addAction(QApplication::translate("UIDetails", "Enabled", "details (user interface/menu-bar)")); 938 group.addAction(pActionEnable); 939 pActionEnable->setCheckable(true); 940 pActionEnable->setChecked(fEnabled); 941 942 /* Execute menu, look for result: */ 943 QAction *pTriggeredAction = menu.exec(QCursor::pos()); 944 if ( pTriggeredAction 945 && ( (fEnabled && pTriggeredAction == pActionDisable) 946 || (!fEnabled && pTriggeredAction == pActionEnable))) 947 { 948 switch (enmRole) 949 { 950 #ifndef VBOX_WS_MAC 951 case AnchorRole_MenuBar: gEDataManager->setMenuBarEnabled(!fEnabled, machine().GetId()); break; 952 #endif 953 case AnchorRole_StatusBar: gEDataManager->setStatusBarEnabled(!fEnabled, machine().GetId()); break; 954 default: break; 955 } 956 } 589 popupStatusBarEditor(strData.section(',', 0, 0) /* value */); 957 590 break; 958 591 } … … 960 593 case AnchorRole_MiniToolbar: 961 594 { 962 /* Parse whether we have it enabled: */ 963 bool fParsed = false; 964 MiniToolbarAlignment enmAlignment = static_cast<MiniToolbarAlignment>(strData.section(',', 0, 0).toInt(&fParsed)); 965 if (!fParsed) 966 enmAlignment = MiniToolbarAlignment_Disabled; 967 968 /* Fill menu with actions: */ 969 UIMenu menu; 970 QActionGroup group(&menu); 971 QAction *pActionDisabled = menu.addAction(QApplication::translate("UIDetails", "Disabled", "details (user interface/mini-toolbar)")); 972 group.addAction(pActionDisabled); 973 pActionDisabled->setCheckable(true); 974 pActionDisabled->setChecked(enmAlignment == MiniToolbarAlignment_Disabled); 975 QAction *pActionTop = menu.addAction(QApplication::translate("UIDetails", "Top", "details (user interface/mini-toolbar position)")); 976 group.addAction(pActionTop); 977 pActionTop->setCheckable(true); 978 pActionTop->setChecked(enmAlignment == MiniToolbarAlignment_Top); 979 QAction *pActionBottom = menu.addAction(QApplication::translate("UIDetails", "Bottom", "details (user interface/mini-toolbar position)")); 980 group.addAction(pActionBottom); 981 pActionBottom->setCheckable(true); 982 pActionBottom->setChecked(enmAlignment == MiniToolbarAlignment_Bottom); 983 984 /* Execute menu, look for result: */ 985 QAction *pTriggeredAction = menu.exec(QCursor::pos()); 986 if (pTriggeredAction) 987 { 988 const QUuid uMachineId = machine().GetId(); 989 if (pTriggeredAction == pActionDisabled) 990 gEDataManager->setMiniToolbarEnabled(false, uMachineId); 991 else if (pTriggeredAction == pActionTop) 992 { 993 gEDataManager->setMiniToolbarEnabled(true, uMachineId); 994 gEDataManager->setMiniToolbarAlignment(Qt::AlignTop, uMachineId); 995 } 996 else if (pTriggeredAction == pActionBottom) 997 { 998 gEDataManager->setMiniToolbarEnabled(true, uMachineId); 999 gEDataManager->setMiniToolbarAlignment(Qt::AlignBottom, uMachineId); 1000 } 1001 } 595 popupMiniToolbarEditor(strData.section(',', 0, 0) /* value */); 1002 596 break; 1003 597 } … … 1005 599 case AnchorRole_Cloud: 1006 600 { 1007 /* Prepare popup: */ 1008 QPointer<QIDialogContainer> pPopup = new QIDialogContainer(0, Qt::Tool); 1009 if (pPopup) 1010 { 1011 /* Acquire cloud machine: */ 1012 CCloudMachine comCloudMachine = cloudMachine(); 1013 1014 /* Prepare editor: */ 1015 UISafePointerCloudMachineSettingsDialogPage pEditor = new UICloudMachineSettingsDialogPage(pPopup, 1016 false /* full-scale? */); 1017 if (pEditor) 1018 { 1019 /* Configure editor: */ 1020 connect(pEditor.data(), &UICloudMachineSettingsDialogPage::sigValidChanged, 1021 pPopup.data(), &QIDialogContainer::setProgressBarHidden); 1022 connect(pEditor.data(), &UICloudMachineSettingsDialogPage::sigValidChanged, 1023 pPopup.data(), &QIDialogContainer::setOkButtonEnabled); 1024 pEditor->setFilter(strData); 1025 /* Create get settings form task: */ 1026 UITaskCloudGetSettingsForm *pTask = new UITaskCloudGetSettingsForm(comCloudMachine); 1027 /* Create get settings form receiver: */ 1028 UIReceiverCloudGetSettingsForm *pReceiver = new UIReceiverCloudGetSettingsForm(pEditor); 1029 if (pReceiver) 1030 { 1031 connect(pReceiver, &UIReceiverCloudGetSettingsForm::sigTaskComplete, 1032 pEditor.data(), &UICloudMachineSettingsDialogPage::setForm); 1033 connect(pReceiver, &UIReceiverCloudGetSettingsForm::sigTaskFailed, 1034 pPopup.data(), &QIDialogContainer::close); 1035 } 1036 /* Start task: */ 1037 if (pTask && pReceiver) 1038 uiCommon().threadPoolCloud()->enqueueTask(pTask); 1039 /* Embed editor: */ 1040 pPopup->setWidget(pEditor); 1041 } 1042 1043 /* Adjust popup geometry: */ 1044 pPopup->move(QCursor::pos()); 1045 pPopup->resize(pPopup->minimumSizeHint()); 1046 1047 // WORKAROUND: 1048 // On Windows, Tool dialogs aren't activated by default by some reason. 1049 // So we have created sltActivateWindow wrapping actual activateWindow 1050 // to fix that annoying issue. 1051 QMetaObject::invokeMethod(pPopup, "sltActivateWindow", Qt::QueuedConnection); 1052 /* Execute popup, change machine name if confirmed: */ 1053 if (pPopup->exec() == QDialog::Accepted) 1054 { 1055 /* Makes sure page data committed: */ 1056 if (pEditor) 1057 pEditor->makeSureDataCommitted(); 1058 1059 /* Apply form: */ 1060 CForm comForm = pEditor->form(); 1061 applyCloudMachineSettingsForm(comCloudMachine, comForm); 1062 } 1063 1064 /* Delete popup: */ 1065 delete pPopup; 1066 } 601 popupCloudEditor(strData /* complex value */); 1067 602 break; 1068 603 } … … 1265 800 else if (!m_fHovered && m_pButton->isVisible()) 1266 801 m_pButton->hide(); 802 } 803 804 void UIDetailsElement::popupNameAndSystemEditor(bool fChooseName, bool fChoosePath, bool fChooseType, const QString &strValue) 805 { 806 /* Prepare popup: */ 807 QPointer<QIDialogContainer> pPopup = new QIDialogContainer(0, Qt::Tool); 808 if (pPopup) 809 { 810 /* Prepare editor: */ 811 UINameAndSystemEditor *pEditor = new UINameAndSystemEditor(pPopup, fChooseName, fChoosePath, fChooseType); 812 if (pEditor) 813 { 814 if (fChooseName) 815 pEditor->setName(strValue); 816 else if (fChoosePath) 817 pEditor->setPath(strValue); 818 else if (fChooseType) 819 pEditor->setTypeId(strValue); 820 821 /* Add to popup: */ 822 pPopup->setWidget(pEditor); 823 } 824 825 /* Adjust popup geometry: */ 826 pPopup->move(QCursor::pos()); 827 pPopup->adjustSize(); 828 829 // WORKAROUND: 830 // On Windows, Tool dialogs aren't activated by default by some reason. 831 // So we have created sltActivateWindow wrapping actual activateWindow 832 // to fix that annoying issue. 833 QMetaObject::invokeMethod(pPopup, "sltActivateWindow", Qt::QueuedConnection); 834 /* Execute popup, change machine name if confirmed: */ 835 if (pPopup->exec() == QDialog::Accepted) 836 { 837 if (fChooseName) 838 setMachineAttribute(machine(), MachineAttribute_Name, QVariant::fromValue(pEditor->name())); 839 else if (fChoosePath) 840 setMachineAttribute(machine(), MachineAttribute_Location, QVariant::fromValue(pEditor->path())); 841 else if (fChooseType) 842 setMachineAttribute(machine(), MachineAttribute_OSType, QVariant::fromValue(pEditor->typeId())); 843 } 844 845 /* Delete popup: */ 846 delete pPopup; 847 } 848 } 849 850 void UIDetailsElement::popupBaseMemoryEditor(const QString &strValue) 851 { 852 /* Prepare popup: */ 853 QPointer<QIDialogContainer> pPopup = new QIDialogContainer(0, Qt::Tool); 854 if (pPopup) 855 { 856 /* Prepare editor: */ 857 UIBaseMemoryEditor *pEditor = new UIBaseMemoryEditor(pPopup, true /* with label */); 858 if (pEditor) 859 { 860 pEditor->setValue(strValue.toInt()); 861 connect(pEditor, &UIBaseMemoryEditor::sigValidChanged, 862 pPopup.data(), &QIDialogContainer::setOkButtonEnabled); 863 pPopup->setWidget(pEditor); 864 } 865 866 /* Adjust popup geometry: */ 867 pPopup->move(QCursor::pos()); 868 pPopup->adjustSize(); 869 870 // WORKAROUND: 871 // On Windows, Tool dialogs aren't activated by default by some reason. 872 // So we have created sltActivateWindow wrapping actual activateWindow 873 // to fix that annoying issue. 874 QMetaObject::invokeMethod(pPopup, "sltActivateWindow", Qt::QueuedConnection); 875 /* Execute popup, change machine name if confirmed: */ 876 if (pPopup->exec() == QDialog::Accepted) 877 setMachineAttribute(machine(), MachineAttribute_BaseMemory, QVariant::fromValue(pEditor->value())); 878 879 /* Delete popup: */ 880 delete pPopup; 881 } 882 } 883 884 void UIDetailsElement::popupBootOrderEditor(const QString &strValue) 885 { 886 /* Prepare popup: */ 887 QPointer<QIDialogContainer> pPopup = new QIDialogContainer(0, Qt::Tool); 888 if (pPopup) 889 { 890 /* Prepare editor: */ 891 UIBootOrderEditor *pEditor = new UIBootOrderEditor(pPopup, true /* with label */); 892 if (pEditor) 893 { 894 pEditor->setValue(bootItemsFromSerializedString(strValue)); 895 pPopup->setWidget(pEditor); 896 } 897 898 /* Adjust popup geometry: */ 899 pPopup->move(QCursor::pos()); 900 pPopup->adjustSize(); 901 902 // WORKAROUND: 903 // On Windows, Tool dialogs aren't activated by default by some reason. 904 // So we have created sltActivateWindow wrapping actual activateWindow 905 // to fix that annoying issue. 906 QMetaObject::invokeMethod(pPopup, "sltActivateWindow", Qt::QueuedConnection); 907 /* Execute popup, change machine name if confirmed: */ 908 if (pPopup->exec() == QDialog::Accepted) 909 setMachineAttribute(machine(), MachineAttribute_BootOrder, QVariant::fromValue(pEditor->value())); 910 911 /* Delete popup: */ 912 delete pPopup; 913 } 914 } 915 916 void UIDetailsElement::popupVideoMemoryEditor(const QString &strValue) 917 { 918 /* Prepare popup: */ 919 QPointer<QIDialogContainer> pPopup = new QIDialogContainer(0, Qt::Tool); 920 if (pPopup) 921 { 922 /* Prepare editor: */ 923 UIVideoMemoryEditor *pEditor = new UIVideoMemoryEditor(pPopup, true /* with label */); 924 if (pEditor) 925 { 926 pEditor->setValue(strValue.toInt()); 927 connect(pEditor, &UIVideoMemoryEditor::sigValidChanged, 928 pPopup.data(), &QIDialogContainer::setOkButtonEnabled); 929 pPopup->setWidget(pEditor); 930 } 931 932 /* Adjust popup geometry: */ 933 pPopup->move(QCursor::pos()); 934 pPopup->adjustSize(); 935 936 // WORKAROUND: 937 // On Windows, Tool dialogs aren't activated by default by some reason. 938 // So we have created sltActivateWindow wrapping actual activateWindow 939 // to fix that annoying issue. 940 QMetaObject::invokeMethod(pPopup, "sltActivateWindow", Qt::QueuedConnection); 941 /* Execute popup, change machine name if confirmed: */ 942 if (pPopup->exec() == QDialog::Accepted) 943 setMachineAttribute(machine(), MachineAttribute_VideoMemory, QVariant::fromValue(pEditor->value())); 944 945 /* Delete popup: */ 946 delete pPopup; 947 } 948 } 949 950 void UIDetailsElement::popupGraphicsControllerTypeEditor(const QString &strValue) 951 { 952 /* Prepare popup: */ 953 QPointer<QIDialogContainer> pPopup = new QIDialogContainer(0, Qt::Tool); 954 if (pPopup) 955 { 956 /* Prepare editor: */ 957 UIGraphicsControllerEditor *pEditor = new UIGraphicsControllerEditor(pPopup, true /* with label */); 958 if (pEditor) 959 { 960 pEditor->setValue(static_cast<KGraphicsControllerType>(strValue.toInt())); 961 pPopup->setWidget(pEditor); 962 } 963 964 /* Adjust popup geometry: */ 965 pPopup->move(QCursor::pos()); 966 pPopup->adjustSize(); 967 968 // WORKAROUND: 969 // On Windows, Tool dialogs aren't activated by default by some reason. 970 // So we have created sltActivateWindow wrapping actual activateWindow 971 // to fix that annoying issue. 972 QMetaObject::invokeMethod(pPopup, "sltActivateWindow", Qt::QueuedConnection); 973 /* Execute popup, change machine name if confirmed: */ 974 if (pPopup->exec() == QDialog::Accepted) 975 setMachineAttribute(machine(), MachineAttribute_GraphicsControllerType, QVariant::fromValue(pEditor->value())); 976 977 /* Delete popup: */ 978 delete pPopup; 979 } 980 } 981 982 void UIDetailsElement::popupStorageEditor(const QString &strValue) 983 { 984 /* Prepare storage-menu: */ 985 UIMenu menu; 986 menu.setShowToolTip(true); 987 988 /* Storage-controller name: */ 989 QString strControllerName = strValue.section(',', 0, 0); 990 /* Storage-slot: */ 991 StorageSlot storageSlot = gpConverter->fromString<StorageSlot>(strValue.section(',', 1)); 992 993 /* Fill storage-menu: */ 994 uiCommon().prepareStorageMenu(menu, this, SLOT(sltMountStorageMedium()), 995 machine(), strControllerName, storageSlot); 996 997 /* Exec menu: */ 998 menu.exec(QCursor::pos()); 999 } 1000 1001 void UIDetailsElement::popupAudioHostDriverTypeEditor(const QString &strValue) 1002 { 1003 /* Prepare popup: */ 1004 QPointer<QIDialogContainer> pPopup = new QIDialogContainer(0, Qt::Tool); 1005 if (pPopup) 1006 { 1007 /* Prepare editor: */ 1008 UIAudioHostDriverEditor *pEditor = new UIAudioHostDriverEditor(pPopup, true /* with label */); 1009 if (pEditor) 1010 { 1011 pEditor->setValue(static_cast<KAudioDriverType>(strValue.toInt())); 1012 pPopup->setWidget(pEditor); 1013 } 1014 1015 /* Adjust popup geometry: */ 1016 pPopup->move(QCursor::pos()); 1017 pPopup->adjustSize(); 1018 1019 // WORKAROUND: 1020 // On Windows, Tool dialogs aren't activated by default by some reason. 1021 // So we have created sltActivateWindow wrapping actual activateWindow 1022 // to fix that annoying issue. 1023 QMetaObject::invokeMethod(pPopup, "sltActivateWindow", Qt::QueuedConnection); 1024 /* Execute popup, change machine name if confirmed: */ 1025 if (pPopup->exec() == QDialog::Accepted) 1026 setMachineAttribute(machine(), MachineAttribute_AudioHostDriverType, QVariant::fromValue(pEditor->value())); 1027 1028 /* Delete popup: */ 1029 delete pPopup; 1030 } 1031 } 1032 1033 void UIDetailsElement::popupAudioControllerTypeEditor(const QString &strValue) 1034 { 1035 /* Prepare popup: */ 1036 QPointer<QIDialogContainer> pPopup = new QIDialogContainer(0, Qt::Tool); 1037 if (pPopup) 1038 { 1039 /* Prepare editor: */ 1040 UIAudioControllerEditor *pEditor = new UIAudioControllerEditor(pPopup, true /* with label */); 1041 if (pEditor) 1042 { 1043 pEditor->setValue(static_cast<KAudioControllerType>(strValue.toInt())); 1044 pPopup->setWidget(pEditor); 1045 } 1046 1047 /* Adjust popup geometry: */ 1048 pPopup->move(QCursor::pos()); 1049 pPopup->adjustSize(); 1050 1051 // WORKAROUND: 1052 // On Windows, Tool dialogs aren't activated by default by some reason. 1053 // So we have created sltActivateWindow wrapping actual activateWindow 1054 // to fix that annoying issue. 1055 QMetaObject::invokeMethod(pPopup, "sltActivateWindow", Qt::QueuedConnection); 1056 /* Execute popup, change machine name if confirmed: */ 1057 if (pPopup->exec() == QDialog::Accepted) 1058 setMachineAttribute(machine(), MachineAttribute_AudioControllerType, QVariant::fromValue(pEditor->value())); 1059 1060 /* Delete popup: */ 1061 delete pPopup; 1062 } 1063 } 1064 1065 void UIDetailsElement::popupNetworkAttachmentTypeEditor(const QString &strValue) 1066 { 1067 /* Prepare popup: */ 1068 QPointer<QIDialogContainer> pPopup = new QIDialogContainer(0, Qt::Tool); 1069 if (pPopup) 1070 { 1071 /* Prepare editor: */ 1072 UINetworkAttachmentEditor *pEditor = new UINetworkAttachmentEditor(pPopup, true /* with label */); 1073 if (pEditor) 1074 { 1075 pEditor->setValueNames(KNetworkAttachmentType_Bridged, UINetworkAttachmentEditor::bridgedAdapters()); 1076 pEditor->setValueNames(KNetworkAttachmentType_Internal, UINetworkAttachmentEditor::internalNetworks()); 1077 pEditor->setValueNames(KNetworkAttachmentType_HostOnly, UINetworkAttachmentEditor::hostInterfaces()); 1078 pEditor->setValueNames(KNetworkAttachmentType_Generic, UINetworkAttachmentEditor::genericDrivers()); 1079 pEditor->setValueNames(KNetworkAttachmentType_NATNetwork, UINetworkAttachmentEditor::natNetworks()); 1080 pEditor->setValueType(static_cast<KNetworkAttachmentType>(strValue.section(';', 1, 1).toInt())); 1081 pEditor->setValueName(pEditor->valueType(), strValue.section(';', 2, 2)); 1082 connect(pEditor, &UINetworkAttachmentEditor::sigValidChanged, 1083 pPopup.data(), &QIDialogContainer::setOkButtonEnabled); 1084 pPopup->setWidget(pEditor); 1085 } 1086 1087 /* Adjust popup geometry: */ 1088 pPopup->move(QCursor::pos()); 1089 pPopup->adjustSize(); 1090 1091 // WORKAROUND: 1092 // On Windows, Tool dialogs aren't activated by default by some reason. 1093 // So we have created sltActivateWindow wrapping actual activateWindow 1094 // to fix that annoying issue. 1095 QMetaObject::invokeMethod(pPopup, "sltActivateWindow", Qt::QueuedConnection); 1096 /* Execute popup, change machine name if confirmed: */ 1097 if (pPopup->exec() == QDialog::Accepted) 1098 { 1099 UINetworkAdapterDescriptor nad(strValue.section(';', 0, 0).toInt(), 1100 pEditor->valueType(), pEditor->valueName(pEditor->valueType())); 1101 setMachineAttribute(machine(), MachineAttribute_NetworkAttachmentType, QVariant::fromValue(nad)); 1102 } 1103 1104 /* Delete popup: */ 1105 delete pPopup; 1106 } 1107 } 1108 1109 void UIDetailsElement::popupUSBControllerTypeEditor(const QString &strValue) 1110 { 1111 /* Parse controller type list: */ 1112 UIUSBControllerTypeSet controllerSet; 1113 const QStringList controllerInternals = strValue.split(';'); 1114 foreach (const QString &strControllerType, controllerInternals) 1115 { 1116 /* Parse each internal controller description: */ 1117 bool fParsed = false; 1118 KUSBControllerType enmType = static_cast<KUSBControllerType>(strControllerType.toInt(&fParsed)); 1119 if (!fParsed) 1120 enmType = KUSBControllerType_Null; 1121 controllerSet << enmType; 1122 } 1123 1124 /* Prepare existing controller sets: */ 1125 QMap<int, UIUSBControllerTypeSet> controllerSets; 1126 controllerSets[0] = UIUSBControllerTypeSet(); 1127 controllerSets[1] = UIUSBControllerTypeSet() << KUSBControllerType_OHCI; 1128 controllerSets[2] = UIUSBControllerTypeSet() << KUSBControllerType_OHCI << KUSBControllerType_EHCI; 1129 controllerSets[3] = UIUSBControllerTypeSet() << KUSBControllerType_XHCI; 1130 1131 /* Fill menu with actions: */ 1132 UIMenu menu; 1133 QActionGroup group(&menu); 1134 QMap<int, QAction*> actions; 1135 actions[0] = menu.addAction(QApplication::translate("UIDetails", "Disabled", "details (usb)")); 1136 group.addAction(actions.value(0)); 1137 actions.value(0)->setCheckable(true); 1138 actions[1] = menu.addAction(QApplication::translate("UIDetails", "USB 1.1 (OHCI) Controller", "details (usb)")); 1139 group.addAction(actions.value(1)); 1140 actions.value(1)->setCheckable(true); 1141 actions[2] = menu.addAction(QApplication::translate("UIDetails", "USB 2.0 (OHCI + EHCI) Controller", "details (usb)")); 1142 group.addAction(actions.value(2)); 1143 actions.value(2)->setCheckable(true); 1144 actions[3] = menu.addAction(QApplication::translate("UIDetails", "USB 3.0 (xHCI) Controller", "details (usb)")); 1145 group.addAction(actions.value(3)); 1146 actions.value(3)->setCheckable(true); 1147 1148 /* Mark current one: */ 1149 for (int i = 0; i <= 3; ++i) 1150 actions.value(i)->setChecked(controllerSets.key(controllerSet) == i); 1151 1152 /* Execute menu, look for result: */ 1153 QAction *pTriggeredAction = menu.exec(QCursor::pos()); 1154 if (pTriggeredAction) 1155 { 1156 const int iTriggeredIndex = actions.key(pTriggeredAction); 1157 if (controllerSets.key(controllerSet) != iTriggeredIndex) 1158 setMachineAttribute(machine(), MachineAttribute_USBControllerType, QVariant::fromValue(controllerSets.value(iTriggeredIndex))); 1159 } 1160 } 1161 1162 void UIDetailsElement::popupVisualStateTypeEditor(const QString &strValue) 1163 { 1164 /* Prepare popup: */ 1165 QPointer<QIDialogContainer> pPopup = new QIDialogContainer(0, Qt::Tool); 1166 if (pPopup) 1167 { 1168 /* Prepare editor: */ 1169 UIVisualStateEditor *pEditor = new UIVisualStateEditor(pPopup, true /* with label */); 1170 if (pEditor) 1171 { 1172 pEditor->setMachineId(machine().GetId()); 1173 pEditor->setValue(static_cast<UIVisualStateType>(strValue.toInt())); 1174 pPopup->setWidget(pEditor); 1175 } 1176 1177 /* Adjust popup geometry: */ 1178 pPopup->move(QCursor::pos()); 1179 pPopup->adjustSize(); 1180 1181 // WORKAROUND: 1182 // On Windows, Tool dialogs aren't activated by default by some reason. 1183 // So we have created sltActivateWindow wrapping actual activateWindow 1184 // to fix that annoying issue. 1185 QMetaObject::invokeMethod(pPopup, "sltActivateWindow", Qt::QueuedConnection); 1186 /* Execute popup, change machine name if confirmed: */ 1187 if (pPopup->exec() == QDialog::Accepted) 1188 gEDataManager->setRequestedVisualState(pEditor->value(), machine().GetId()); 1189 1190 /* Delete popup: */ 1191 delete pPopup; 1192 } 1193 } 1194 1195 void UIDetailsElement::popupMenuBarEditor(const QString &strValue) 1196 { 1197 /* Parse whether we have it enabled, true if unable to parse: */ 1198 bool fParsed = false; 1199 bool fEnabled = strValue.toInt(&fParsed); 1200 if (!fParsed) 1201 fEnabled = true; 1202 1203 /* Fill menu with actions: */ 1204 UIMenu menu; 1205 QActionGroup group(&menu); 1206 QAction *pActionDisable = menu.addAction(QApplication::translate("UIDetails", "Disabled", "details (user interface/menu-bar)")); 1207 group.addAction(pActionDisable); 1208 pActionDisable->setCheckable(true); 1209 pActionDisable->setChecked(!fEnabled); 1210 QAction *pActionEnable = menu.addAction(QApplication::translate("UIDetails", "Enabled", "details (user interface/menu-bar)")); 1211 group.addAction(pActionEnable); 1212 pActionEnable->setCheckable(true); 1213 pActionEnable->setChecked(fEnabled); 1214 1215 /* Execute menu, look for result: */ 1216 QAction *pTriggeredAction = menu.exec(QCursor::pos()); 1217 if ( pTriggeredAction 1218 && ( (fEnabled && pTriggeredAction == pActionDisable) 1219 || (!fEnabled && pTriggeredAction == pActionEnable))) 1220 { 1221 #ifndef VBOX_WS_MAC 1222 gEDataManager->setMenuBarEnabled(!fEnabled, machine().GetId()); 1223 #endif 1224 } 1225 } 1226 1227 void UIDetailsElement::popupStatusBarEditor(const QString &strValue) 1228 { 1229 /* Parse whether we have it enabled, true if unable to parse: */ 1230 bool fParsed = false; 1231 bool fEnabled = strValue.toInt(&fParsed); 1232 if (!fParsed) 1233 fEnabled = true; 1234 1235 /* Fill menu with actions: */ 1236 UIMenu menu; 1237 QActionGroup group(&menu); 1238 QAction *pActionDisable = menu.addAction(QApplication::translate("UIDetails", "Disabled", "details (user interface/status-bar)")); 1239 group.addAction(pActionDisable); 1240 pActionDisable->setCheckable(true); 1241 pActionDisable->setChecked(!fEnabled); 1242 QAction *pActionEnable = menu.addAction(QApplication::translate("UIDetails", "Enabled", "details (user interface/status-bar)")); 1243 group.addAction(pActionEnable); 1244 pActionEnable->setCheckable(true); 1245 pActionEnable->setChecked(fEnabled); 1246 1247 /* Execute menu, look for result: */ 1248 QAction *pTriggeredAction = menu.exec(QCursor::pos()); 1249 if ( pTriggeredAction 1250 && ( (fEnabled && pTriggeredAction == pActionDisable) 1251 || (!fEnabled && pTriggeredAction == pActionEnable))) 1252 { 1253 gEDataManager->setStatusBarEnabled(!fEnabled, machine().GetId()); 1254 } 1255 } 1256 1257 void UIDetailsElement::popupMiniToolbarEditor(const QString &strValue) 1258 { 1259 /* Parse whether we have it enabled: */ 1260 bool fParsed = false; 1261 MiniToolbarAlignment enmAlignment = static_cast<MiniToolbarAlignment>(strValue.toInt(&fParsed)); 1262 if (!fParsed) 1263 enmAlignment = MiniToolbarAlignment_Disabled; 1264 1265 /* Fill menu with actions: */ 1266 UIMenu menu; 1267 QActionGroup group(&menu); 1268 QAction *pActionDisabled = menu.addAction(QApplication::translate("UIDetails", "Disabled", "details (user interface/mini-toolbar)")); 1269 group.addAction(pActionDisabled); 1270 pActionDisabled->setCheckable(true); 1271 pActionDisabled->setChecked(enmAlignment == MiniToolbarAlignment_Disabled); 1272 QAction *pActionTop = menu.addAction(QApplication::translate("UIDetails", "Top", "details (user interface/mini-toolbar position)")); 1273 group.addAction(pActionTop); 1274 pActionTop->setCheckable(true); 1275 pActionTop->setChecked(enmAlignment == MiniToolbarAlignment_Top); 1276 QAction *pActionBottom = menu.addAction(QApplication::translate("UIDetails", "Bottom", "details (user interface/mini-toolbar position)")); 1277 group.addAction(pActionBottom); 1278 pActionBottom->setCheckable(true); 1279 pActionBottom->setChecked(enmAlignment == MiniToolbarAlignment_Bottom); 1280 1281 /* Execute menu, look for result: */ 1282 QAction *pTriggeredAction = menu.exec(QCursor::pos()); 1283 if (pTriggeredAction) 1284 { 1285 const QUuid uMachineId = machine().GetId(); 1286 if (pTriggeredAction == pActionDisabled) 1287 gEDataManager->setMiniToolbarEnabled(false, uMachineId); 1288 else if (pTriggeredAction == pActionTop) 1289 { 1290 gEDataManager->setMiniToolbarEnabled(true, uMachineId); 1291 gEDataManager->setMiniToolbarAlignment(Qt::AlignTop, uMachineId); 1292 } 1293 else if (pTriggeredAction == pActionBottom) 1294 { 1295 gEDataManager->setMiniToolbarEnabled(true, uMachineId); 1296 gEDataManager->setMiniToolbarAlignment(Qt::AlignBottom, uMachineId); 1297 } 1298 } 1299 } 1300 1301 void UIDetailsElement::popupCloudEditor(const QString &strValue) 1302 { 1303 /* Prepare popup: */ 1304 QPointer<QIDialogContainer> pPopup = new QIDialogContainer(0, Qt::Tool); 1305 if (pPopup) 1306 { 1307 /* Acquire cloud machine: */ 1308 CCloudMachine comCloudMachine = cloudMachine(); 1309 1310 /* Prepare editor: */ 1311 UISafePointerCloudMachineSettingsDialogPage pEditor = new UICloudMachineSettingsDialogPage(pPopup, 1312 false /* full-scale? */); 1313 if (pEditor) 1314 { 1315 /* Configure editor: */ 1316 connect(pEditor.data(), &UICloudMachineSettingsDialogPage::sigValidChanged, 1317 pPopup.data(), &QIDialogContainer::setProgressBarHidden); 1318 connect(pEditor.data(), &UICloudMachineSettingsDialogPage::sigValidChanged, 1319 pPopup.data(), &QIDialogContainer::setOkButtonEnabled); 1320 pEditor->setFilter(strValue); 1321 /* Create get settings form task: */ 1322 UITaskCloudGetSettingsForm *pTask = new UITaskCloudGetSettingsForm(comCloudMachine); 1323 /* Create get settings form receiver: */ 1324 UIReceiverCloudGetSettingsForm *pReceiver = new UIReceiverCloudGetSettingsForm(pEditor); 1325 if (pReceiver) 1326 { 1327 connect(pReceiver, &UIReceiverCloudGetSettingsForm::sigTaskComplete, 1328 pEditor.data(), &UICloudMachineSettingsDialogPage::setForm); 1329 connect(pReceiver, &UIReceiverCloudGetSettingsForm::sigTaskFailed, 1330 pPopup.data(), &QIDialogContainer::close); 1331 } 1332 /* Start task: */ 1333 if (pTask && pReceiver) 1334 uiCommon().threadPoolCloud()->enqueueTask(pTask); 1335 /* Embed editor: */ 1336 pPopup->setWidget(pEditor); 1337 } 1338 1339 /* Adjust popup geometry: */ 1340 pPopup->move(QCursor::pos()); 1341 pPopup->resize(pPopup->minimumSizeHint()); 1342 1343 // WORKAROUND: 1344 // On Windows, Tool dialogs aren't activated by default by some reason. 1345 // So we have created sltActivateWindow wrapping actual activateWindow 1346 // to fix that annoying issue. 1347 QMetaObject::invokeMethod(pPopup, "sltActivateWindow", Qt::QueuedConnection); 1348 /* Execute popup, change machine name if confirmed: */ 1349 if (pPopup->exec() == QDialog::Accepted) 1350 { 1351 /* Makes sure page data committed: */ 1352 if (pEditor) 1353 pEditor->makeSureDataCommitted(); 1354 1355 /* Apply form: */ 1356 CForm comForm = pEditor->form(); 1357 applyCloudMachineSettingsForm(comCloudMachine, comForm); 1358 } 1359 1360 /* Delete popup: */ 1361 delete pPopup; 1362 } 1267 1363 } 1268 1364 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsElement.h
r83719 r86217 270 270 /** Updates toggle button visibility. */ 271 271 void updateButtonVisibility(); 272 273 /** Popups name & system editor. */ 274 void popupNameAndSystemEditor(bool fChooseName, bool fChoosePath, bool fChooseType, const QString &strValue); 275 /** Popups base-memory editor. */ 276 void popupBaseMemoryEditor(const QString &strValue); 277 /** Popups boot-order editor. */ 278 void popupBootOrderEditor(const QString &strValue); 279 /** Popups video-memory editor. */ 280 void popupVideoMemoryEditor(const QString &strValue); 281 /** Popups graphics controller type editor. */ 282 void popupGraphicsControllerTypeEditor(const QString &strValue); 283 /** Popups storage editor. */ 284 void popupStorageEditor(const QString &strValue); 285 /** Popups audio host-driver type editor. */ 286 void popupAudioHostDriverTypeEditor(const QString &strValue); 287 /** Popups audio controller type editor. */ 288 void popupAudioControllerTypeEditor(const QString &strValue); 289 /** Popups network attachment type editor. */ 290 void popupNetworkAttachmentTypeEditor(const QString &strValue); 291 /** Popups USB controller type editor. */ 292 void popupUSBControllerTypeEditor(const QString &strValue); 293 /** Popups visual-state type editor. */ 294 void popupVisualStateTypeEditor(const QString &strValue); 295 /** Popups menu-bar editor. */ 296 void popupMenuBarEditor(const QString &strValue); 297 /** Popups status-bar editor. */ 298 void popupStatusBarEditor(const QString &strValue); 299 /** Popups mini-toolbar editor. */ 300 void popupMiniToolbarEditor(const QString &strValue); 301 /** Popups cloud editor. */ 302 void popupCloudEditor(const QString &strValue); 272 303 /** @} */ 273 304
Note:
See TracChangeset
for help on using the changeset viewer.