VirtualBox

Changeset 83760 in vbox for trunk/src


Ignore:
Timestamp:
Apr 17, 2020 3:01:00 PM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
137281
Message:

FE/Qt: bugref:9653: VirtualBox Manager: Implementing cloud machine power up stuff.

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.cpp

    r83198 r83760  
    9494#include "CAudioAdapter.h"
    9595#include "CBIOSSettings.h"
     96#include "CCloudMachine.h"
    9697#include "CConsole.h"
    9798#include "CExtPack.h"
     
    24522453}
    24532454
     2455bool UICommon::launchMachine(CCloudMachine &comMachine)
     2456{
     2457    /* Acquire machine name: */
     2458    const QString strName = comMachine.GetName();
     2459    if (!comMachine.isOk())
     2460    {
     2461        msgCenter().cannotAcquireMachineParameter(comMachine);
     2462        return false;
     2463    }
     2464
     2465    /* Prepare machine power up: */
     2466    CProgress comProgress = comMachine.PowerUp();
     2467    if (!comMachine.isOk())
     2468    {
     2469        msgCenter().cannotPowerUpMachine(comMachine);
     2470        return false;
     2471    }
     2472
     2473    /* Show machine power up progress: */
     2474    msgCenter().showModalProgressDialog(comProgress, strName, ":/progress_start_90px.png");
     2475    if (!comProgress.isOk() || comProgress.GetResultCode() != 0)
     2476    {
     2477        msgCenter().cannotPowerUpMachine(comProgress, strName);
     2478        return false;
     2479    }
     2480
     2481    /* Success by default: */
     2482    return true;
     2483}
     2484
    24542485CSession UICommon::openSession(const QUuid &uId, KLockType lockType /* = KLockType_Shared */)
    24552486{
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UICommon.h

    r83198 r83760  
    5555class QSpinBox;
    5656class QToolButton;
     57class CCloudMachine;
    5758class CHostVideoInputDevice;
    5859class CMachine;
     
    469470        /** Launches certain @a comMachine in specified @a enmLaunchMode. */
    470471        bool launchMachine(CMachine &comMachine, LaunchMode enmLaunchMode = LaunchMode_Default);
     472        /** Launches certain @a comMachine. */
     473        bool launchMachine(CCloudMachine &comMachine);
    471474
    472475        /** Opens session of certain @a enmLockType for VM with certain @a uId. */
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.cpp

    r83752 r83760  
    923923             .arg(CConsole(console).GetMachine().GetName()),
    924924          UIErrorString::formatErrorInfo(console));
     925}
     926
     927void UIMessageCenter::cannotPowerUpMachine(const CCloudMachine &comMachine) const
     928{
     929    error(0, MessageType_Error,
     930          tr("Failed to start the virtual machine <b>%1</b>.")
     931             .arg(CCloudMachine(comMachine).GetName()),
     932          UIErrorString::formatErrorInfo(comMachine));
     933}
     934
     935void UIMessageCenter::cannotPowerUpMachine(const CProgress &comProgress, const QString &strMachineName) const
     936{
     937    error(0, MessageType_Error,
     938          tr("Failed to start the virtual machine <b>%1</b>.")
     939             .arg(strMachineName),
     940          UIErrorString::formatErrorInfo(comProgress));
    925941}
    926942
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIMessageCenter.h

    r83752 r83760  
    294294    void cannotSaveMachineState(const CProgress &progress, const QString &strMachineName);
    295295    void cannotACPIShutdownMachine(const CConsole &console) const;
     296    void cannotPowerUpMachine(const CCloudMachine &comMachine) const;
     297    void cannotPowerUpMachine(const CProgress &comProgress, const QString &strMachineName) const;
    296298    void cannotPowerDownMachine(const CConsole &console) const;
    297299    void cannotPowerDownMachine(const CCloudMachine &comMachine) const;
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualBoxManager.cpp

    r83755 r83760  
    16681668                && fStartConfirmed))
    16691669        {
    1670             /* Make sure item is local one: */
     1670            /* For local machine: */
    16711671            if (pItem->itemType() == UIVirtualMachineItem::ItemType_Local)
    16721672            {
     
    16831683                CMachine machine = pItem->toLocal()->machine();
    16841684                uiCommon().launchMachine(machine, enmItemLaunchMode);
     1685            }
     1686            /* For real cloud machine: */
     1687            else if (pItem->itemType() == UIVirtualMachineItem::ItemType_CloudReal)
     1688            {
     1689                /* Acquire cloud machine: */
     1690                CCloudMachine comCloudMachine = pItem->toCloud()->machine();
     1691                /* Launch current VM: */
     1692                uiCommon().launchMachine(comCloudMachine);
     1693                /* Update info in any case: */
     1694                pItem->toCloud()->updateInfoAsync(false /* delayed? */);
    16851695            }
    16861696        }
     
    19741984        case UIActionIndexST_M_Group_M_StartOrShow:
    19751985        case UIActionIndexST_M_Group_M_StartOrShow_S_StartNormal:
     1986        case UIActionIndexST_M_Machine_M_StartOrShow:
     1987        case UIActionIndexST_M_Machine_M_StartOrShow_S_StartNormal:
     1988        {
     1989            return !isGroupSavingInProgress() &&
     1990                   isAtLeastOneItemCanBeStartedOrShown(items) &&
     1991                    (m_pWidget->currentMachineTool() != UIToolType_Snapshots ||
     1992                     m_pWidget->isCurrentStateItemSelected());
     1993        }
    19761994        case UIActionIndexST_M_Group_M_StartOrShow_S_StartHeadless:
    19771995        case UIActionIndexST_M_Group_M_StartOrShow_S_StartDetachable:
    1978         case UIActionIndexST_M_Machine_M_StartOrShow:
    1979         case UIActionIndexST_M_Machine_M_StartOrShow_S_StartNormal:
    19801996        case UIActionIndexST_M_Machine_M_StartOrShow_S_StartHeadless:
    19811997        case UIActionIndexST_M_Machine_M_StartOrShow_S_StartDetachable:
    19821998        {
    19831999            return !isGroupSavingInProgress() &&
     2000                   isItemsLocal(items) &&
    19842001                   isAtLeastOneItemCanBeStartedOrShown(items) &&
    19852002                    (m_pWidget->currentMachineTool() != UIToolType_Snapshots ||
     
    21812198    foreach (UIVirtualMachineItem *pItem, items)
    21822199    {
    2183         if (   pItem->toLocal()
    2184             && pItem->isItemStarted()
     2200        if (   pItem->isItemStarted()
    21852201            && pItem->isItemCanBeSwitchedTo())
    21862202            return true;
     
    21942210    foreach (UIVirtualMachineItem *pItem, items)
    21952211    {
    2196         if (   pItem->toLocal()
    2197             && (   (   pItem->isItemPoweredOff()
    2198                     && pItem->isItemEditable())
    2199                 || (   pItem->isItemStarted()
    2200                     && pItem->isItemCanBeSwitchedTo())))
     2212        if (   (   pItem->isItemPoweredOff()
     2213                && pItem->isItemEditable())
     2214            || (   pItem->isItemStarted()
     2215                && pItem->isItemCanBeSwitchedTo()))
    22012216            return true;
    22022217    }
Note: See TracChangeset for help on using the changeset viewer.

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