Changeset 83854 in vbox
- Timestamp:
- Apr 20, 2020 1:01:12 PM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 137383
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/manager
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp
r83768 r83854 33 33 #include "UIMessageCenter.h" 34 34 #include "UIModalWindowManager.h" 35 #include "UIQObjectStuff.h" 36 #include "UISettingsDialogSpecific.h" 35 37 #include "UIVirtualBoxManager.h" 36 38 #include "UIVirtualBoxManagerWidget.h" 37 #include "UISettingsDialogSpecific.h"38 #include "UIVMLogViewerDialog.h"39 39 #include "UIVirtualMachineItemCloud.h" 40 40 #include "UIVirtualMachineItemLocal.h" 41 #ifdef VBOX_GUI_WITH_NETWORK_MANAGER 42 # include "UIUpdateManager.h" 43 #endif 41 #include "UIVMLogViewerDialog.h" 44 42 #include "UIVirtualBoxEventHandler.h" 45 43 #include "UIWizardCloneVM.h" … … 47 45 #include "UIWizardImportApp.h" 48 46 #include "UIWizardNewCloudVM.h" 47 #ifdef VBOX_GUI_WITH_NETWORK_MANAGER 48 # include "UIUpdateManager.h" 49 #endif 49 50 #ifdef VBOX_WS_MAC 50 51 # include "UIImageTools.h" 51 52 # include "UIWindowMenuManager.h" 52 53 # include "VBoxUtils.h" 54 #else 55 # include "UIMenuBar.h" 53 56 #endif 54 57 #ifdef VBOX_WS_X11 55 58 # include "UIDesktopWidgetWatchdog.h" 56 #endif57 #ifndef VBOX_WS_MAC58 # include "UIMenuBar.h"59 59 #endif 60 60 … … 463 463 464 464 /* Lock the action preventing cascade calls: */ 465 actionPool()->action(UIActionIndexST_M_File_S_ImportAppliance)->setProperty("opened", true); 465 UIQObjectPropertySetter guardBlock(actionPool()->action(UIActionIndexST_M_File_S_ImportAppliance), "opened", true); 466 connect(&guardBlock, &UIQObjectPropertySetter::sigAboutToBeDestroyed, 467 this, &UIVirtualBoxManager::sltHandleUpdateActionAppearanceRequest); 466 468 updateActionsAppearance(); 467 469 … … 474 476 pWizard->exec(); 475 477 delete pWizard; 476 477 /* Unlock the action allowing further calls: */478 if (actionPool())479 {480 actionPool()->action(UIActionIndexST_M_File_S_ImportAppliance)->setProperty("opened", QVariant());481 updateActionsAppearance();482 }483 478 } 484 479 … … 493 488 names << items.at(i)->name(); 494 489 495 /* Lock the action preventing cascade calls: */ 496 actionPool()->action(UIActionIndexST_M_File_S_ExportAppliance)->setProperty("opened", true); 497 actionPool()->action(UIActionIndexST_M_Machine_S_ExportToOCI)->setProperty("opened", true); 490 /* Lock the actions preventing cascade calls: */ 491 UIQObjectPropertySetter guardBlock(QList<QObject*>() << actionPool()->action(UIActionIndexST_M_File_S_ExportAppliance) 492 << actionPool()->action(UIActionIndexST_M_Machine_S_ExportToOCI), 493 "opened", true); 494 connect(&guardBlock, &UIQObjectPropertySetter::sigAboutToBeDestroyed, 495 this, &UIVirtualBoxManager::sltHandleUpdateActionAppearanceRequest); 498 496 updateActionsAppearance(); 499 497 … … 510 508 pWizard->exec(); 511 509 delete pWizard; 512 513 /* Unlock the action allowing further calls: */514 if (actionPool())515 {516 actionPool()->action(UIActionIndexST_M_File_S_ExportAppliance)->setProperty("opened", QVariant());517 actionPool()->action(UIActionIndexST_M_Machine_S_ExportToOCI)->setProperty("opened", QVariant());518 updateActionsAppearance();519 }520 510 } 521 511 … … 523 513 { 524 514 /* Lock the action preventing cascade calls: */ 525 actionPool()->action(UIActionIndexST_M_File_S_NewCloudVM)->setProperty("opened", true); 515 UIQObjectPropertySetter guardBlock(actionPool()->action(UIActionIndexST_M_File_S_NewCloudVM), "opened", true); 516 connect(&guardBlock, &UIQObjectPropertySetter::sigAboutToBeDestroyed, 517 this, &UIVirtualBoxManager::sltHandleUpdateActionAppearanceRequest); 526 518 updateActionsAppearance(); 527 519 … … 533 525 pWizard->exec(); 534 526 delete pWizard; 535 536 /* Unlock the action allowing further calls: */537 if (actionPool())538 {539 actionPool()->action(UIActionIndexST_M_File_S_NewCloudVM)->setProperty("opened", QVariant());540 updateActionsAppearance();541 }542 527 } 543 528 … … 556 541 557 542 /* Lock the action preventing cascade calls: */ 558 actionPool()->action(UIActionIndex_M_Application_S_Preferences)->setProperty("opened", true); 543 UIQObjectPropertySetter guardBlock(actionPool()->action(UIActionIndex_M_Application_S_Preferences), "opened", true); 544 connect(&guardBlock, &UIQObjectPropertySetter::sigAboutToBeDestroyed, 545 this, &UIVirtualBoxManager::sltHandleUpdateActionAppearanceRequest); 559 546 updateActionsAppearance(); 560 547 … … 563 550 pDlg->execute(); 564 551 delete pDlg; 565 566 /* Unlock the action allowing further calls: */567 if (actionPool())568 {569 actionPool()->action(UIActionIndex_M_Application_S_Preferences)->setProperty("opened", QVariant());570 updateActionsAppearance();571 }572 552 } 573 553 … … 587 567 CVirtualBox comVBox = uiCommon().virtualBox(); 588 568 589 /* Lock the action preventing cascade calls: */ 590 actionPool()->action(UIActionIndexST_M_Welcome_S_Add)->setProperty("opened", true); 569 /* Lock the actions preventing cascade calls: */ 570 UIQObjectPropertySetter guardBlock(QList<QObject*>() << actionPool()->action(UIActionIndexST_M_Welcome_S_Add) 571 << actionPool()->action(UIActionIndexST_M_Machine_S_Add) 572 << actionPool()->action(UIActionIndexST_M_Group_S_Add), 573 "opened", true); 574 connect(&guardBlock, &UIQObjectPropertySetter::sigAboutToBeDestroyed, 575 this, &UIVirtualBoxManager::sltHandleUpdateActionAppearanceRequest); 591 576 updateActionsAppearance(); 592 577 … … 606 591 } 607 592 608 /* Unlock the action allowing further calls: */609 if (actionPool())610 {611 actionPool()->action(UIActionIndexST_M_Welcome_S_Add)->setProperty("opened", QVariant());612 updateActionsAppearance();613 }614 615 593 /* Nothing was chosen? */ 616 594 if (strTmpFile.isEmpty()) … … 646 624 647 625 /* Lock the action preventing cascade calls: */ 648 actionPool()->action(UIActionIndexST_M_Machine_S_Settings)->setProperty("opened", true); 626 UIQObjectPropertySetter guardBlock(actionPool()->action(UIActionIndexST_M_Machine_S_Settings), "opened", true); 627 connect(&guardBlock, &UIQObjectPropertySetter::sigAboutToBeDestroyed, 628 this, &UIVirtualBoxManager::sltHandleUpdateActionAppearanceRequest); 649 629 updateActionsAppearance(); 650 630 … … 677 657 pDlg->execute(); 678 658 delete pDlg; 679 }680 681 /* Unlock the action allowing further calls: */682 if (actionPool())683 {684 actionPool()->action(UIActionIndexST_M_Machine_S_Settings)->setProperty("opened", QVariant());685 updateActionsAppearance();686 659 } 687 660 } … … 1918 1891 bool UIVirtualBoxManager::isActionEnabled(int iActionIndex, const QList<UIVirtualMachineItem*> &items) 1919 1892 { 1893 /* Make sure action pool exists: */ 1894 AssertPtrReturn(actionPool(), false); 1895 1896 /* Any "opened" action is by definition disabled: */ 1897 if ( actionPool()->action(iActionIndex) 1898 && actionPool()->action(iActionIndex)->property("opened").toBool()) 1899 return false; 1900 1920 1901 /* For known *global* action types: */ 1921 1902 switch (iActionIndex) … … 1926 1907 case UIActionIndexST_M_File_S_NewCloudVM: 1927 1908 case UIActionIndexST_M_Welcome_S_Add: 1928 { 1929 return !actionPool()->action(iActionIndex)->property("opened").toBool(); 1930 } 1909 return true; 1931 1910 default: 1932 1911 break; … … 1971 1950 case UIActionIndexST_M_Machine_S_Settings: 1972 1951 { 1973 return !actionPool()->action(iActionIndex)->property("opened").toBool() && 1974 !isGroupSavingInProgress() && 1952 return !isGroupSavingInProgress() && 1975 1953 items.size() == 1 && 1976 1954 pItem->toLocal() && … … 1989 1967 case UIActionIndexST_M_Machine_S_ExportToOCI: 1990 1968 { 1991 return !actionPool()->action(iActionIndex)->property("opened").toBool() && 1992 items.size() == 1 && 1969 return items.size() == 1 && 1993 1970 pItem->toLocal(); 1994 1971 } -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.h
r83674 r83854 113 113 void sltHandleHostScreenAvailableAreaChange(); 114 114 #endif /* VBOX_WS_X11 */ 115 116 /** Handles request to update actions. */ 117 void sltHandleUpdateActionAppearanceRequest() { updateActionsAppearance(); } 115 118 116 119 /** Handles signal about medium-enumeration finished. */
Note:
See TracChangeset
for help on using the changeset viewer.