Changeset 87476 in vbox
- Timestamp:
- Jan 29, 2021 10:38:18 AM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 142498
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/manager
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp ¶
r87475 r87476 467 467 , m_fFirstMediumEnumerationHandled(false) 468 468 , m_pActionPool(0) 469 , m_pManagerExtensionPack(0)470 , m_pManagerVirtualMedia(0)471 , m_pManagerHostNetwork(0)472 , m_pManagerCloudProfile(0)473 , m_pManagerCloudConsole(0)474 469 { 475 470 s_pInstance = this; … … 699 694 void UIVirtualBoxManager::sltHandleToolTypeChange() 700 695 { 696 /* Update actions stuff: */ 701 697 updateActionsVisibility(); 702 698 updateActionsAppearance(); 703 699 704 /* Make sure separate dialog s are closed when corresponding tools areopened: */700 /* Make sure separate dialog closed when corresponding tool opened: */ 705 701 switch (m_pWidget->toolsType()) 706 702 { 707 case UIToolType_Extensions: sltCloseExtensionPackManagerWindow(); break; 708 case UIToolType_Media: sltCloseVirtualMediumManagerWindow(); break; 709 case UIToolType_Network: sltCloseNetworkManagerWindow(); break; 710 case UIToolType_Cloud: sltCloseCloudProfileManagerWindow(); break; 711 case UIToolType_CloudConsole: sltCloseCloudConsoleManagerWindow(); break; 712 case UIToolType_Logs: sltCloseLogViewerWindow(); break; 713 case UIToolType_Performance: sltClosePerformanceMonitorWindow(); break; 714 default: break; 703 case UIToolType_Extensions: 704 case UIToolType_Media: 705 case UIToolType_Network: 706 case UIToolType_Cloud: 707 case UIToolType_CloudConsole: 708 sltCloseManagerWindow(m_pWidget->toolsType()); 709 break; 710 case UIToolType_Logs: 711 sltCloseLogViewerWindow(); 712 break; 713 case UIToolType_Performance: 714 sltClosePerformanceMonitorWindow(); 715 break; 716 default: 717 break; 715 718 } 716 719 } … … 738 741 } 739 742 740 void UIVirtualBoxManager::sltOpenExtensionPackManagerWindow() 741 { 743 void UIVirtualBoxManager::sltOpenManagerWindow(UIToolType enmType /* = UIToolType_Invalid */) 744 { 745 /* Determine actual tool type if possible: */ 746 if (enmType == UIToolType_Invalid) 747 { 748 if ( sender() 749 && sender()->inherits("UIAction")) 750 { 751 UIAction *pAction = qobject_cast<UIAction*>(sender()); 752 AssertPtrReturnVoid(pAction); 753 enmType = pAction->property("toolType").value<UIToolType>(); 754 } 755 } 756 757 /* Make sure type is valid: */ 758 AssertReturnVoid(enmType != UIToolType_Invalid); 759 742 760 /* First check if instance of widget opened the embedded way: */ 743 if (m_pWidget->isGlobalToolOpened( UIToolType_Extensions))761 if (m_pWidget->isGlobalToolOpened(enmType)) 744 762 { 745 763 m_pWidget->setToolsType(UIToolType_Welcome); 746 m_pWidget->closeGlobalTool( UIToolType_Extensions);764 m_pWidget->closeGlobalTool(enmType); 747 765 } 748 766 749 767 /* Create instance if not yet created: */ 750 if (!m_pManagerExtensionPack) 751 { 752 UIExtensionPackManagerFactory(m_pActionPool).prepare(m_pManagerExtensionPack, this); 753 connect(m_pManagerExtensionPack, &QIManagerDialog::sigClose, 754 this, &UIVirtualBoxManager::sltCloseExtensionPackManagerWindow); 768 if (!m_managers.contains(enmType)) 769 { 770 switch (enmType) 771 { 772 case UIToolType_Extensions: UIExtensionPackManagerFactory(m_pActionPool).prepare(m_managers[enmType], this); break; 773 case UIToolType_Media: UIMediumManagerFactory(m_pActionPool).prepare(m_managers[enmType], this); break; 774 case UIToolType_Network: UINetworkManagerFactory(m_pActionPool).prepare(m_managers[enmType], this); break; 775 case UIToolType_Cloud: UICloudProfileManagerFactory(m_pActionPool).prepare(m_managers[enmType], this); break; 776 case UIToolType_CloudConsole: UICloudConsoleManagerFactory(m_pActionPool).prepare(m_managers[enmType], this); break; 777 default: break; 778 } 779 780 connect(m_managers[enmType], &QIManagerDialog::sigClose, 781 this, &UIVirtualBoxManager::sltCloseManagerWindowDefault); 755 782 } 756 783 757 784 /* Show instance: */ 758 m_pManagerExtensionPack->show(); 759 m_pManagerExtensionPack->setWindowState(m_pManagerExtensionPack->windowState() & ~Qt::WindowMinimized); 760 m_pManagerExtensionPack->activateWindow(); 761 } 762 763 void UIVirtualBoxManager::sltCloseExtensionPackManagerWindow() 764 { 785 m_managers.value(enmType)->show(); 786 m_managers.value(enmType)->setWindowState(m_managers.value(enmType)->windowState() & ~Qt::WindowMinimized); 787 m_managers.value(enmType)->activateWindow(); 788 } 789 790 void UIVirtualBoxManager::sltCloseManagerWindow(UIToolType enmType /* = UIToolType_Invalid */) 791 { 792 /* Determine actual tool type if possible: */ 793 if (enmType == UIToolType_Invalid) 794 { 795 if ( sender() 796 && sender()->inherits("QIManagerDialog")) 797 { 798 QIManagerDialog *pManager = qobject_cast<QIManagerDialog*>(sender()); 799 AssertPtrReturnVoid(pManager); 800 enmType = m_managers.key(pManager); 801 } 802 } 803 804 /* Make sure type is valid: */ 805 AssertReturnVoid(enmType != UIToolType_Invalid); 806 765 807 /* Destroy instance if still exists: */ 766 if (m_pManagerExtensionPack) 767 UIExtensionPackManagerFactory().cleanup(m_pManagerExtensionPack); 768 } 769 770 void UIVirtualBoxManager::sltOpenVirtualMediumManagerWindow() 771 { 772 /* First check if instance of widget opened the embedded way: */ 773 if (m_pWidget->isGlobalToolOpened(UIToolType_Media)) 774 { 775 m_pWidget->setToolsType(UIToolType_Welcome); 776 m_pWidget->closeGlobalTool(UIToolType_Media); 777 } 778 779 /* Create instance if not yet created: */ 780 if (!m_pManagerVirtualMedia) 781 { 782 UIMediumManagerFactory(m_pActionPool).prepare(m_pManagerVirtualMedia, this); 783 connect(m_pManagerVirtualMedia, &QIManagerDialog::sigClose, 784 this, &UIVirtualBoxManager::sltCloseVirtualMediumManagerWindow); 785 } 786 787 /* Show instance: */ 788 m_pManagerVirtualMedia->show(); 789 m_pManagerVirtualMedia->setWindowState(m_pManagerVirtualMedia->windowState() & ~Qt::WindowMinimized); 790 m_pManagerVirtualMedia->activateWindow(); 791 } 792 793 void UIVirtualBoxManager::sltCloseVirtualMediumManagerWindow() 794 { 795 /* Destroy instance if still exists: */ 796 if (m_pManagerVirtualMedia) 797 UIMediumManagerFactory().cleanup(m_pManagerVirtualMedia); 798 } 799 800 void UIVirtualBoxManager::sltOpenNetworkManagerWindow() 801 { 802 /* First check if instance of widget opened the embedded way: */ 803 if (m_pWidget->isGlobalToolOpened(UIToolType_Network)) 804 { 805 m_pWidget->setToolsType(UIToolType_Welcome); 806 m_pWidget->closeGlobalTool(UIToolType_Network); 807 } 808 809 /* Create instance if not yet created: */ 810 if (!m_pManagerHostNetwork) 811 { 812 UINetworkManagerFactory(m_pActionPool).prepare(m_pManagerHostNetwork, this); 813 connect(m_pManagerHostNetwork, &QIManagerDialog::sigClose, 814 this, &UIVirtualBoxManager::sltCloseNetworkManagerWindow); 815 } 816 817 /* Show instance: */ 818 m_pManagerHostNetwork->show(); 819 m_pManagerHostNetwork->setWindowState(m_pManagerHostNetwork->windowState() & ~Qt::WindowMinimized); 820 m_pManagerHostNetwork->activateWindow(); 821 } 822 823 void UIVirtualBoxManager::sltCloseNetworkManagerWindow() 824 { 825 /* Destroy instance if still exists: */ 826 if (m_pManagerHostNetwork) 827 UINetworkManagerFactory().cleanup(m_pManagerHostNetwork); 828 } 829 830 void UIVirtualBoxManager::sltOpenCloudProfileManagerWindow() 831 { 832 /* First check if instance of widget opened the embedded way: */ 833 if (m_pWidget->isGlobalToolOpened(UIToolType_Cloud)) 834 { 835 m_pWidget->setToolsType(UIToolType_Welcome); 836 m_pWidget->closeGlobalTool(UIToolType_Cloud); 837 } 838 839 /* Create instance if not yet created: */ 840 if (!m_pManagerCloudProfile) 841 { 842 UICloudProfileManagerFactory(m_pActionPool).prepare(m_pManagerCloudProfile, this); 843 connect(m_pManagerCloudProfile, &QIManagerDialog::sigClose, 844 this, &UIVirtualBoxManager::sltCloseCloudProfileManagerWindow); 845 } 846 847 /* Show instance: */ 848 m_pManagerCloudProfile->show(); 849 m_pManagerCloudProfile->setWindowState(m_pManagerCloudProfile->windowState() & ~Qt::WindowMinimized); 850 m_pManagerCloudProfile->activateWindow(); 851 } 852 853 void UIVirtualBoxManager::sltCloseCloudProfileManagerWindow() 854 { 855 /* Destroy instance if still exists: */ 856 if (m_pManagerCloudProfile) 857 UINetworkManagerFactory().cleanup(m_pManagerCloudProfile); 858 } 859 860 void UIVirtualBoxManager::sltOpenCloudConsoleManagerWindow() 861 { 862 /* First check if instance of widget opened the embedded way: */ 863 if (m_pWidget->isGlobalToolOpened(UIToolType_CloudConsole)) 864 { 865 m_pWidget->setToolsType(UIToolType_Welcome); 866 m_pWidget->closeGlobalTool(UIToolType_CloudConsole); 867 } 868 869 /* Create instance if not yet created: */ 870 if (!m_pManagerCloudConsole) 871 { 872 UICloudConsoleManagerFactory(m_pActionPool).prepare(m_pManagerCloudConsole, this); 873 connect(m_pManagerCloudConsole, &QIManagerDialog::sigClose, 874 this, &UIVirtualBoxManager::sltCloseCloudConsoleManagerWindow); 875 } 876 877 /* Show instance: */ 878 m_pManagerCloudConsole->show(); 879 m_pManagerCloudConsole->setWindowState(m_pManagerCloudConsole->windowState() & ~Qt::WindowMinimized); 880 m_pManagerCloudConsole->activateWindow(); 881 } 882 883 void UIVirtualBoxManager::sltCloseCloudConsoleManagerWindow() 884 { 885 /* Destroy instance if still exists: */ 886 if (m_pManagerCloudConsole) 887 UINetworkManagerFactory().cleanup(m_pManagerCloudConsole); 808 if (m_managers.contains(enmType)) 809 { 810 switch (enmType) 811 { 812 case UIToolType_Extensions: UIExtensionPackManagerFactory().cleanup(m_managers[enmType]); break; 813 case UIToolType_Media: UIMediumManagerFactory().cleanup(m_managers[enmType]); break; 814 case UIToolType_Network: UINetworkManagerFactory().cleanup(m_managers[enmType]); break; 815 case UIToolType_Cloud: UICloudProfileManagerFactory().cleanup(m_managers[enmType]); break; 816 case UIToolType_CloudConsole: UICloudConsoleManagerFactory().cleanup(m_managers[enmType]); break; 817 default: break; 818 } 819 820 m_managers.remove(enmType); 821 } 888 822 } 889 823 … … 2296 2230 /* Setup menu-bar policy: */ 2297 2231 menuBar()->setContextMenuPolicy(Qt::CustomContextMenu); 2232 2233 /* Assign actions with corresponding tool types: */ 2234 actionPool()->action(UIActionIndexMN_M_File_S_ShowExtensionPackManager)->setProperty("toolType", QVariant::fromValue(UIToolType_Extensions)); 2235 actionPool()->action(UIActionIndexMN_M_File_S_ShowVirtualMediumManager)->setProperty("toolType", QVariant::fromValue(UIToolType_Media)); 2236 actionPool()->action(UIActionIndexMN_M_File_S_ShowHostNetworkManager)->setProperty("toolType", QVariant::fromValue(UIToolType_Network)); 2237 actionPool()->action(UIActionIndexMN_M_File_S_ShowCloudProfileManager)->setProperty("toolType", QVariant::fromValue(UIToolType_Cloud)); 2238 actionPool()->action(UIActionIndexMN_M_Machine_M_Console_S_ConfigureApplications)->setProperty("toolType", QVariant::fromValue(UIToolType_CloudConsole)); 2239 actionPool()->action(UIActionIndexMN_M_Group_M_Console_S_ConfigureApplications)->setProperty("toolType", QVariant::fromValue(UIToolType_CloudConsole)); 2298 2240 } 2299 2241 … … 2355 2297 /* 'File' menu connections: */ 2356 2298 connect(actionPool()->action(UIActionIndexMN_M_File_S_ShowExtensionPackManager), &UIAction::triggered, 2357 this, &UIVirtualBoxManager::sltOpen ExtensionPackManagerWindow);2299 this, &UIVirtualBoxManager::sltOpenManagerWindowDefault); 2358 2300 connect(actionPool()->action(UIActionIndexMN_M_File_S_ShowVirtualMediumManager), &UIAction::triggered, 2359 this, &UIVirtualBoxManager::sltOpen VirtualMediumManagerWindow);2301 this, &UIVirtualBoxManager::sltOpenManagerWindowDefault); 2360 2302 connect(actionPool()->action(UIActionIndexMN_M_File_S_ShowHostNetworkManager), &UIAction::triggered, 2361 this, &UIVirtualBoxManager::sltOpen NetworkManagerWindow);2303 this, &UIVirtualBoxManager::sltOpenManagerWindowDefault); 2362 2304 connect(actionPool()->action(UIActionIndexMN_M_File_S_ShowCloudProfileManager), &UIAction::triggered, 2363 this, &UIVirtualBoxManager::sltOpen CloudProfileManagerWindow);2305 this, &UIVirtualBoxManager::sltOpenManagerWindowDefault); 2364 2306 connect(actionPool()->action(UIActionIndexMN_M_File_S_ImportAppliance), &UIAction::triggered, 2365 2307 this, &UIVirtualBoxManager::sltOpenImportApplianceWizardDefault); … … 2475 2417 this, &UIVirtualBoxManager::sltPerformDeleteConsoleConnectionForGroup); 2476 2418 connect(actionPool()->action(UIActionIndexMN_M_Group_M_Console_S_ConfigureApplications), &UIAction::triggered, 2477 this, &UIVirtualBoxManager::sltOpen CloudConsoleManagerWindow);2419 this, &UIVirtualBoxManager::sltOpenManagerWindowDefault); 2478 2420 2479 2421 /* 'Machine/Console' menu connections: */ … … 2491 2433 this, &UIVirtualBoxManager::sltPerformCopyCommandVNCWindows); 2492 2434 connect(actionPool()->action(UIActionIndexMN_M_Machine_M_Console_S_ConfigureApplications), &UIAction::triggered, 2493 this, &UIVirtualBoxManager::sltOpen CloudConsoleManagerWindow);2435 this, &UIVirtualBoxManager::sltOpenManagerWindowDefault); 2494 2436 2495 2437 /* 'Group/Close' menu connections: */ … … 2584 2526 { 2585 2527 /* Close the sub-dialogs first: */ 2586 sltClose ExtensionPackManagerWindow();2587 sltClose VirtualMediumManagerWindow();2588 sltClose NetworkManagerWindow();2589 sltClose CloudProfileManagerWindow();2590 sltClose CloudConsoleManagerWindow();2528 sltCloseManagerWindow(UIToolType_Extensions); 2529 sltCloseManagerWindow(UIToolType_Media); 2530 sltCloseManagerWindow(UIToolType_Network); 2531 sltCloseManagerWindow(UIToolType_Cloud); 2532 sltCloseManagerWindow(UIToolType_CloudConsole); 2591 2533 2592 2534 /* Save settings: */ -
TabularUnified trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.h ¶
r87354 r87476 30 30 #include "QIWithRetranslateUI.h" 31 31 #include "UICommon.h" 32 #include "UIExtraDataDefs.h" 32 33 33 34 /* Forward declarations: */ … … 71 72 72 73 /** Opens Cloud Profile Manager. */ 73 void openCloudProfileManager() { sltOpen CloudProfileManagerWindow(); }74 void openCloudProfileManager() { sltOpenManagerWindow(UIToolType_Cloud); } 74 75 75 76 protected: … … 155 156 /** @name File menu stuff. 156 157 * @{ */ 157 /** Handles call to open Extension Pack Manager window. */ 158 void sltOpenExtensionPackManagerWindow(); 159 /** Handles call to close Extension Pack Manager window. */ 160 void sltCloseExtensionPackManagerWindow(); 161 162 /** Handles call to open Virtual Medium Manager window. */ 163 void sltOpenVirtualMediumManagerWindow(); 164 /** Handles call to close Virtual Medium Manager window. */ 165 void sltCloseVirtualMediumManagerWindow(); 166 167 /** Handles call to open Network Manager window. */ 168 void sltOpenNetworkManagerWindow(); 169 /** Handles call to close Network Manager window. */ 170 void sltCloseNetworkManagerWindow(); 171 172 /** Handles call to open Cloud Profile Manager window. */ 173 void sltOpenCloudProfileManagerWindow(); 174 /** Handles call to close Cloud Profile Manager window. */ 175 void sltCloseCloudProfileManagerWindow(); 176 177 /** Handles call to open Cloud Console Manager window. */ 178 void sltOpenCloudConsoleManagerWindow(); 179 /** Handles call to close Cloud Console Manager window. */ 180 void sltCloseCloudConsoleManagerWindow(); 158 /** Handles call to open Manager window of certain @a enmType. */ 159 void sltOpenManagerWindow(UIToolType enmType = UIToolType_Invalid); 160 /** Handles call to open Manager window by default. */ 161 void sltOpenManagerWindowDefault() { sltOpenManagerWindow(); } 162 /** Handles call to close Manager window of certain @a enmType. */ 163 void sltCloseManagerWindow(UIToolType enmType = UIToolType_Invalid); 164 /** Handles call to close Manager window by default. */ 165 void sltCloseManagerWindowDefault() { sltCloseManagerWindow(); } 181 166 182 167 /** Handles call to open Import Appliance wizard. … … 469 454 QMap<int, MenuUpdateHandler> m_menuUpdateHandlers; 470 455 471 /** Holds the Extension Pack window instance. */ 472 QIManagerDialog *m_pManagerExtensionPack; 473 /** Holds the Virtual Media Manager window instance. */ 474 QIManagerDialog *m_pManagerVirtualMedia; 475 /** Holds the Network Manager window instance. */ 476 QIManagerDialog *m_pManagerHostNetwork; 477 /** Holds the Cloud Profile Manager window instance. */ 478 QIManagerDialog *m_pManagerCloudProfile; 479 /** Holds the Cloud Console Manager window instance. */ 480 QIManagerDialog *m_pManagerCloudConsole; 456 /** Holds the map of various global managers. */ 457 QMap<UIToolType, QIManagerDialog*> m_managers; 458 481 459 /** Holds a map of (machineUUID, UIVMLogViewerDialog). */ 482 460 VMLogViewerMap m_logViewers;
Note:
See TracChangeset
for help on using the changeset viewer.