VirtualBox

Changeset 86922 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Nov 19, 2020 3:41:51 PM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9866: VirtualBox Manager: Removing Discard functionality for cloud VMs, it will be replaced with Terminate stuff.

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  
    10801080    virtual void retranslateUi() /* override */
    10811081    {
    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())));
    11031086    }
    11041087};
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp

    r86896 r86922  
    15661566    /* Prepare the list of the machines to be discarded/terminated: */
    15671567    QStringList machinesToDiscard;
    1568     QStringList machinesToTerminate;
    15691568    QList<UIVirtualMachineItem*> itemsToDiscard;
    1570     QList<UIVirtualMachineItem*> itemsToTerminate;
    15711569    foreach (UIVirtualMachineItem *pItem, items)
    15721570    {
    15731571        if (isActionEnabled(UIActionIndexMN_M_Group_S_Discard, QList<UIVirtualMachineItem*>() << pItem))
    15741572        {
    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(", ")))
    15921582        return;
    15931583
     
    16091599        /* Unlock machine finally: */
    16101600        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 icon
    1637         if (!comProgress.isOk() || comProgress.GetResultCode() != 0)
    1638             msgCenter().cannotTerminateCloudInstance(comProgress, strName);
    16391601    }
    16401602}
     
    28272789        pMenu->addMenu(actionPool()->action(UIActionIndexMN_M_Group_M_Close)->menu());
    28282790        pMenu->addSeparator();
    2829         pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Group_S_Discard));
    28302791        pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Group_S_Refresh));
    28312792        pMenu->addSeparator();
     
    28852846        pMenu->addMenu(actionPool()->action(UIActionIndexMN_M_Machine_M_Close)->menu());
    28862847        pMenu->addSeparator();
    2887         pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Discard));
    28882848        pMenu->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Refresh));
    28892849        pMenu->addSeparator();
     
    31973157    UIVirtualMachineItem *pItem = currentItem();
    31983158
    3199     /* Discard/Terminate action is deremined by 1st item: */
    3200     if (   pItem
    3201         && (   pItem->itemType() == UIVirtualMachineItemType_CloudFake
    3202             || 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     else
    3208     {
    3209         actionPool()->action(UIActionIndexMN_M_Group_S_Discard)->setState(0);
    3210         actionPool()->action(UIActionIndexMN_M_Machine_S_Discard)->setState(0);
    3211     }
    3212 
    32133159    /* Start/Show action is deremined by 1st item: */
    32143160    if (pItem && pItem->accessible())
     
    34003346        {
    34013347            return !isGroupSavingInProgress() &&
     3348                   isItemsLocal(items) &&
    34023349                   isAtLeastOneItemDiscardable(items) &&
    34033350                    (m_pWidget->currentMachineTool() != UIToolType_Snapshots ||
     
    34653412        case UIActionIndexMN_M_Group_M_Close_S_Detach:
    34663413        case UIActionIndexMN_M_Machine_M_Close_S_Detach:
    3467         {
    3468             return isItemsLocal(items) &&
    3469                    isActionEnabled(UIActionIndexMN_M_Machine_M_Close, items);
    3470         }
    34713414        case UIActionIndexMN_M_Group_M_Close_S_SaveState:
    34723415        case UIActionIndexMN_M_Machine_M_Close_S_SaveState:
    34733416        {
    3474             return isItemsLocal(items) &&
    3475                    isActionEnabled(UIActionIndexMN_M_Machine_M_Close, items);
     3417            return    isActionEnabled(UIActionIndexMN_M_Machine_M_Close, items)
     3418                   && isItemsLocal(items);
    34763419        }
    34773420        case UIActionIndexMN_M_Group_M_Close_S_Shutdown:
    34783421        case UIActionIndexMN_M_Machine_M_Close_S_Shutdown:
    34793422        {
    3480             return isActionEnabled(UIActionIndexMN_M_Machine_M_Close, items) &&
    3481                    isAtLeastOneItemAbleToShutdown(items);
     3423            return    isActionEnabled(UIActionIndexMN_M_Machine_M_Close, items)
     3424                   && isAtLeastOneItemAbleToShutdown(items);
    34823425        }
    34833426        case UIActionIndexMN_M_Group_M_Close_S_PowerOff:
    34843427        case UIActionIndexMN_M_Machine_M_Close_S_PowerOff:
    34853428        {
    3486             return isActionEnabled(UIActionIndexMN_M_Machine_M_Close, items);
     3429            return    isActionEnabled(UIActionIndexMN_M_Machine_M_Close, items)
     3430                   && isAtLeastOneItemStarted(items);
    34873431        }
    34883432        default:
     
    36413585{
    36423586    foreach (UIVirtualMachineItem *pItem, items)
    3643         if (   (   pItem->isItemSaved()
    3644                 || pItem->itemType() == UIVirtualMachineItemType_CloudReal)
     3587        if (   pItem->isItemSaved()
    36453588            && pItem->isItemEditable())
    36463589            return true;
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualMachineItemCloud.cpp

    r86792 r86922  
    289289{
    290290    return    accessible()
    291            && machineState() == KCloudMachineState_Stopped;
     291           && itemType() == UIVirtualMachineItemType_CloudReal
     292           && (   machineState() == KCloudMachineState_Stopped
     293               || machineState() == KCloudMachineState_Running);
    292294}
    293295
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.cpp

    r86795 r86922  
    14731473        pMenuGroup->addMenu(actionPool()->action(UIActionIndexMN_M_Group_M_Close)->menu());
    14741474        pMenuGroup->addSeparator();
    1475         pMenuGroup->addAction(actionPool()->action(UIActionIndexMN_M_Group_S_Discard));
    14761475        pMenuGroup->addAction(actionPool()->action(UIActionIndexMN_M_Group_S_Refresh));
    14771476        pMenuGroup->addSeparator();
     
    14911490        pMenuMachine->addMenu(actionPool()->action(UIActionIndexMN_M_Machine_M_Close)->menu());
    14921491        pMenuMachine->addSeparator();
    1493         pMenuMachine->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Discard));
    14941492        pMenuMachine->addAction(actionPool()->action(UIActionIndexMN_M_Machine_S_Refresh));
    14951493        pMenuMachine->addSeparator();
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette