Changeset 86922 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Nov 19, 2020 3:41:51 PM (4 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPoolManager.cpp
r86668 r86922 1080 1080 virtual void retranslateUi() /* override */ 1081 1081 { 1082 switch (state()) 1083 { 1084 case 0: 1085 { 1086 setIconText(QApplication::translate("UIActionPool", "Discard")); 1087 setName(QApplication::translate("UIActionPool", "D&iscard Saved State...")); 1088 setStatusTip(QApplication::translate("UIActionPool", "Discard saved state of selected virtual machines")); 1089 setToolTip(simplifyText(text()) + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString()))); 1090 break; 1091 } 1092 case 1: 1093 { 1094 setIconText(QApplication::translate("UIActionPool", "Terminate")); 1095 setName(QApplication::translate("UIActionPool", "&Terminate Cloud Instance...")); 1096 setStatusTip(QApplication::translate("UIActionPool", "Terminate cloud instance of selected virtual machines")); 1097 setToolTip(simplifyText(text()) + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString()))); 1098 break; 1099 } 1100 default: 1101 break; 1102 } 1082 setIconText(QApplication::translate("UIActionPool", "Discard")); 1083 setName(QApplication::translate("UIActionPool", "D&iscard Saved State...")); 1084 setStatusTip(QApplication::translate("UIActionPool", "Discard saved state of selected virtual machines")); 1085 setToolTip(simplifyText(text()) + (shortcut().isEmpty() ? QString() : QString(" (%1)").arg(shortcut().toString()))); 1103 1086 } 1104 1087 }; -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp
r86896 r86922 1566 1566 /* Prepare the list of the machines to be discarded/terminated: */ 1567 1567 QStringList machinesToDiscard; 1568 QStringList machinesToTerminate;1569 1568 QList<UIVirtualMachineItem*> itemsToDiscard; 1570 QList<UIVirtualMachineItem*> itemsToTerminate;1571 1569 foreach (UIVirtualMachineItem *pItem, items) 1572 1570 { 1573 1571 if (isActionEnabled(UIActionIndexMN_M_Group_S_Discard, QList<UIVirtualMachineItem*>() << pItem)) 1574 1572 { 1575 if (pItem->itemType() == UIVirtualMachineItemType_Local) 1576 { 1577 machinesToDiscard << pItem->name(); 1578 itemsToDiscard << pItem; 1579 } 1580 else if (pItem->itemType() == UIVirtualMachineItemType_CloudReal) 1581 { 1582 machinesToTerminate << pItem->name(); 1583 itemsToTerminate << pItem; 1584 } 1585 } 1586 } 1587 AssertMsg(!machinesToDiscard.isEmpty() || !machinesToTerminate.isEmpty(), ("This action should not be allowed!")); 1588 1589 /* Confirm discarding/terminating: */ 1590 if ( (machinesToDiscard.isEmpty() || !msgCenter().confirmDiscardSavedState(machinesToDiscard.join(", "))) 1591 && (machinesToTerminate.isEmpty() || !msgCenter().confirmTerminateCloudInstance(machinesToTerminate.join(", ")))) 1573 machinesToDiscard << pItem->name(); 1574 itemsToDiscard << pItem; 1575 } 1576 } 1577 AssertMsg(!machinesToDiscard.isEmpty(), ("This action should not be allowed!")); 1578 1579 /* Confirm discarding: */ 1580 if ( machinesToDiscard.isEmpty() 1581 || !msgCenter().confirmDiscardSavedState(machinesToDiscard.join(", "))) 1592 1582 return; 1593 1583 … … 1609 1599 /* Unlock machine finally: */ 1610 1600 comSession.UnlockMachine(); 1611 }1612 1613 /* For every confirmed item to terminate: */1614 foreach (UIVirtualMachineItem *pItem, itemsToTerminate)1615 {1616 /* Get cloud machine: */1617 AssertPtrReturnVoid(pItem);1618 UIVirtualMachineItemCloud *pCloudItem = pItem->toCloud();1619 AssertPtrReturnVoid(pCloudItem);1620 CCloudMachine comMachine = pCloudItem->machine();1621 1622 /* Acquire machine name: */1623 QString strName;1624 if (!cloudMachineName(comMachine, strName))1625 continue;1626 1627 /* Prepare terminate cloud instance progress: */1628 CProgress comProgress = comMachine.Terminate();1629 if (!comMachine.isOk())1630 {1631 msgCenter().cannotTerminateCloudInstance(comMachine);1632 continue;1633 }1634 1635 /* Show terminate cloud instance progress: */1636 msgCenter().showModalProgressDialog(comProgress, strName, ":/progress_media_delete_90px.png", 0, 0); /// @todo use proper icon1637 if (!comProgress.isOk() || comProgress.GetResultCode() != 0)1638 msgCenter().cannotTerminateCloudInstance(comProgress, strName);1639 1601 } 1640 1602 } … … 2827 2789 pMenu->addMenu(actionPool()->action(UIActionIndexMN_M_Group_M_Close)->menu()); 2828 2790 pMenu->addSeparator(); 2829 pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Group_S_Discard));2830 2791 pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Group_S_Refresh)); 2831 2792 pMenu->addSeparator(); … … 2885 2846 pMenu->addMenu(actionPool()->action(UIActionIndexMN_M_Machine_M_Close)->menu()); 2886 2847 pMenu->addSeparator(); 2887 pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Discard));2888 2848 pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Refresh)); 2889 2849 pMenu->addSeparator(); … … 3197 3157 UIVirtualMachineItem *pItem = currentItem(); 3198 3158 3199 /* Discard/Terminate action is deremined by 1st item: */3200 if ( pItem3201 && ( pItem->itemType() == UIVirtualMachineItemType_CloudFake3202 || pItem->itemType() == UIVirtualMachineItemType_CloudReal))3203 {3204 actionPool()->action(UIActionIndexMN_M_Group_S_Discard)->setState(1);3205 actionPool()->action(UIActionIndexMN_M_Machine_S_Discard)->setState(1);3206 }3207 else3208 {3209 actionPool()->action(UIActionIndexMN_M_Group_S_Discard)->setState(0);3210 actionPool()->action(UIActionIndexMN_M_Machine_S_Discard)->setState(0);3211 }3212 3213 3159 /* Start/Show action is deremined by 1st item: */ 3214 3160 if (pItem && pItem->accessible()) … … 3400 3346 { 3401 3347 return !isGroupSavingInProgress() && 3348 isItemsLocal(items) && 3402 3349 isAtLeastOneItemDiscardable(items) && 3403 3350 (m_pWidget->currentMachineTool() != UIToolType_Snapshots || … … 3465 3412 case UIActionIndexMN_M_Group_M_Close_S_Detach: 3466 3413 case UIActionIndexMN_M_Machine_M_Close_S_Detach: 3467 {3468 return isItemsLocal(items) &&3469 isActionEnabled(UIActionIndexMN_M_Machine_M_Close, items);3470 }3471 3414 case UIActionIndexMN_M_Group_M_Close_S_SaveState: 3472 3415 case UIActionIndexMN_M_Machine_M_Close_S_SaveState: 3473 3416 { 3474 return isItemsLocal(items) &&3475 isActionEnabled(UIActionIndexMN_M_Machine_M_Close,items);3417 return isActionEnabled(UIActionIndexMN_M_Machine_M_Close, items) 3418 && isItemsLocal(items); 3476 3419 } 3477 3420 case UIActionIndexMN_M_Group_M_Close_S_Shutdown: 3478 3421 case UIActionIndexMN_M_Machine_M_Close_S_Shutdown: 3479 3422 { 3480 return isActionEnabled(UIActionIndexMN_M_Machine_M_Close, items) &&3481 isAtLeastOneItemAbleToShutdown(items);3423 return isActionEnabled(UIActionIndexMN_M_Machine_M_Close, items) 3424 && isAtLeastOneItemAbleToShutdown(items); 3482 3425 } 3483 3426 case UIActionIndexMN_M_Group_M_Close_S_PowerOff: 3484 3427 case UIActionIndexMN_M_Machine_M_Close_S_PowerOff: 3485 3428 { 3486 return isActionEnabled(UIActionIndexMN_M_Machine_M_Close, items); 3429 return isActionEnabled(UIActionIndexMN_M_Machine_M_Close, items) 3430 && isAtLeastOneItemStarted(items); 3487 3431 } 3488 3432 default: … … 3641 3585 { 3642 3586 foreach (UIVirtualMachineItem *pItem, items) 3643 if ( ( pItem->isItemSaved() 3644 || pItem->itemType() == UIVirtualMachineItemType_CloudReal) 3587 if ( pItem->isItemSaved() 3645 3588 && pItem->isItemEditable()) 3646 3589 return true; -
trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualMachineItemCloud.cpp
r86792 r86922 289 289 { 290 290 return accessible() 291 && machineState() == KCloudMachineState_Stopped; 291 && itemType() == UIVirtualMachineItemType_CloudReal 292 && ( machineState() == KCloudMachineState_Stopped 293 || machineState() == KCloudMachineState_Running); 292 294 } 293 295 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.cpp
r86795 r86922 1473 1473 pMenuGroup->addMenu(actionPool()->action(UIActionIndexMN_M_Group_M_Close)->menu()); 1474 1474 pMenuGroup->addSeparator(); 1475 pMenuGroup->addAction(actionPool()->action(UIActionIndexMN_M_Group_S_Discard));1476 1475 pMenuGroup->addAction(actionPool()->action(UIActionIndexMN_M_Group_S_Refresh)); 1477 1476 pMenuGroup->addSeparator(); … … 1491 1490 pMenuMachine->addMenu(actionPool()->action(UIActionIndexMN_M_Machine_M_Close)->menu()); 1492 1491 pMenuMachine->addSeparator(); 1493 pMenuMachine->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Discard));1494 1492 pMenuMachine->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Refresh)); 1495 1493 pMenuMachine->addSeparator();
Note:
See TracChangeset
for help on using the changeset viewer.