VirtualBox

Changeset 82960 in vbox


Ignore:
Timestamp:
Feb 3, 2020 3:50:24 PM (5 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9653: VirtualBox Manager: Adding new UIVirtualMachineItemCloud interface as a pair to UIVirtualMachineItemLocal we had since r135945.

Location:
trunk/src/VBox/Frontends/VirtualBox
Files:
7 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/Makefile.kmk

    r82944 r82960  
    612612        src/manager/UIVirtualBoxManagerWidget.h \
    613613        src/manager/UIVirtualMachineItem.h \
     614        src/manager/UIVirtualMachineItemCloud.h \
    614615        src/manager/UIVirtualMachineItemLocal.h \
    615616        src/manager/UIWelcomePane.h \
     
    10551056        src/manager/UIVirtualBoxManagerWidget.cpp \
    10561057        src/manager/UIVirtualMachineItem.cpp \
     1058        src/manager/UIVirtualMachineItemCloud.cpp \
    10571059        src/manager/UIVirtualMachineItemLocal.cpp \
    10581060        src/manager/UIWelcomePane.cpp \
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIIconPool.cpp

    r82438 r82960  
    366366    m_guestOSTypeIconNames.insert("JRockitVE",       ":/os_jrockitve.png");
    367367    m_guestOSTypeIconNames.insert("VBoxBS_64",       ":/os_other_64.png");
     368    m_guestOSTypeIconNames.insert("Cloud",           ":/os_cloud.png");
    368369}
    369370
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualMachineItem.cpp

    r82944 r82960  
    1717
    1818/* GUI includes: */
     19#include "UIVirtualMachineItemCloud.h"
    1920#include "UIVirtualMachineItemLocal.h"
    2021
     
    4142    return   itemType() == ItemType_Local
    4243           ? static_cast<UIVirtualMachineItemLocal*>(this)
     44           : 0;
     45}
     46
     47UIVirtualMachineItemCloud *UIVirtualMachineItem::toCloud()
     48{
     49    return   itemType() == ItemType_CloudFake
     50           ? static_cast<UIVirtualMachineItemCloud*>(this)
    4351           : 0;
    4452}
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualMachineItem.h

    r82944 r82960  
    3636
    3737/* Forward declarations: */
     38class UIVirtualMachineItemCloud;
    3839class UIVirtualMachineItemLocal;
    3940
     
    4950
    5051    /** Item types. */
    51     enum ItemType { ItemType_Local };
     52    enum ItemType { ItemType_Local, ItemType_CloudFake };
    5253
    5354    /** Constructs VM item on the basis of taken @a enmType. */
     
    6263        /** Returns item casted to local type. */
    6364        UIVirtualMachineItemLocal *toLocal();
     65        /** Returns item casted to cloud type. */
     66        UIVirtualMachineItemCloud *toCloud();
    6467    /** @} */
    6568
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualMachineItemCloud.cpp

    r82944 r82960  
    11/* $Id$ */
    22/** @file
    3  * VBox Qt GUI - UIVirtualMachineItem class implementation.
     3 * VBox Qt GUI - UIVirtualMachineItemCloud class implementation.
    44 */
    55
     
    1616 */
    1717
    18 /* Qt includes: */
    19 #include <QFileInfo>
    20 #include <QIcon>
    21 
    2218/* GUI includes: */
    23 #include "UIVirtualMachineItemLocal.h"
    2419#include "UICommon.h"
    2520#include "UIConverter.h"
    26 #include "UIExtraDataManager.h"
    27 #ifdef VBOX_WS_MAC
    28 # include <ApplicationServices/ApplicationServices.h>
    29 #endif /* VBOX_WS_MAC */
    30 
    31 /* COM includes: */
    32 #include "CSnapshot.h"
     21#include "UIIconPool.h"
     22#include "UIVirtualMachineItemCloud.h"
    3323
    3424
    35 /*********************************************************************************************************************************
    36 *   Class UIVirtualMachineItemLocal implementation.                                                                              *
    37 *********************************************************************************************************************************/
    38 
    39 UIVirtualMachineItemLocal::UIVirtualMachineItemLocal(const CMachine &comMachine)
    40     : UIVirtualMachineItem(ItemType_Local)
    41     , m_comMachine(comMachine)
    42     , m_cSnaphot(0)
    43     , m_enmSessionState(KSessionState_Null)
     25UIVirtualMachineItemCloud::UIVirtualMachineItemCloud()
     26    : UIVirtualMachineItem(ItemType_CloudFake)
     27    , m_enmFakeCloudItemState(FakeCloudItemState_Loading)
    4428{
    4529    recache();
    4630}
    4731
    48 UIVirtualMachineItemLocal::~UIVirtualMachineItemLocal()
     32UIVirtualMachineItemCloud::~UIVirtualMachineItemCloud()
    4933{
    5034}
    5135
    52 void UIVirtualMachineItemLocal::recache()
     36void UIVirtualMachineItemCloud::recache()
    5337{
    5438    /* Determine attributes which are always available: */
    55     m_strId = m_comMachine.GetId().toString();
    56     m_strSettingsFile = m_comMachine.GetSettingsFilePath();
     39    /// @todo is there something?
    5740
    5841    /* Now determine whether VM is accessible: */
    59     m_fAccessible = m_comMachine.GetAccessible();
     42    m_fAccessible = true;
    6043    if (m_fAccessible)
    6144    {
     
    6447
    6548        /* Determine own VM attributes: */
    66         m_strName = m_comMachine.GetName();
    67         m_strOSTypeId = m_comMachine.GetOSTypeId();
    68         m_groups = m_comMachine.GetGroups().toList();
    69 
    70         /* Determine snapshot attributes: */
    71         CSnapshot comSnapshot = m_comMachine.GetCurrentSnapshot();
    72         m_strSnapshotName = comSnapshot.isNull() ? QString() : comSnapshot.GetName();
    73         m_lastStateChange.setTime_t(m_comMachine.GetLastStateChange() / 1000);
    74         m_cSnaphot = m_comMachine.GetSnapshotCount();
     49        m_strOSTypeId = "Other";
    7550
    7651        /* Determine VM states: */
    77         m_enmMachineState = m_comMachine.GetState();
     52        m_enmMachineState = KMachineState_PoweredOff;
    7853        m_strMachineStateName = gpConverter->toString(m_enmMachineState);
    79         m_machineStateIcon = gpConverter->toIcon(m_enmMachineState);
    80         m_enmSessionState = m_comMachine.GetSessionState();
    81         m_strSessionStateName = gpConverter->toString(m_enmSessionState);
     54        if (   itemType() == ItemType_CloudFake
     55            && fakeCloudItemState() == FakeCloudItemState_Loading)
     56            m_machineStateIcon = UIIconPool::iconSet(":/state_loading_16px.png");
     57        else
     58            m_machineStateIcon = gpConverter->toIcon(m_enmMachineState);
    8259
    8360        /* Determine configuration access level: */
    84         m_enmConfigurationAccessLevel = ::configurationAccessLevel(m_enmSessionState, m_enmMachineState);
    85         /* Also take restrictions into account: */
    86         if (   m_enmConfigurationAccessLevel != ConfigurationAccessLevel_Null
    87             && !gEDataManager->machineReconfigurationEnabled(m_strId))
    88             m_enmConfigurationAccessLevel = ConfigurationAccessLevel_Null;
    89 
    90         /* Determine PID finally: */
    91         if (   m_enmMachineState == KMachineState_PoweredOff
    92             || m_enmMachineState == KMachineState_Saved
    93             || m_enmMachineState == KMachineState_Teleported
    94             || m_enmMachineState == KMachineState_Aborted
    95            )
    96         {
    97             m_pid = (ULONG) ~0;
    98         }
    99         else
    100         {
    101             m_pid = m_comMachine.GetSessionPID();
    102         }
     61        m_enmConfigurationAccessLevel = ConfigurationAccessLevel_Null;
    10362
    10463        /* Determine whether we should show this VM details: */
    105         m_fHasDetails = gEDataManager->showMachineInVirtualBoxManagerDetails(m_strId);
     64        m_fHasDetails = false;
    10665    }
    10766    else
    10867    {
    109         /* Update last access error information: */
    110         m_comAccessError = m_comMachine.GetAccessError();
    111 
    112         /* Determine machine name on the basis of settings file only: */
    113         QFileInfo fi(m_strSettingsFile);
    114         m_strName = UICommon::hasAllowedExtension(fi.completeSuffix(), VBoxFileExts)
    115                   ? fi.completeBaseName()
    116                   : fi.fileName();
    117         /* Reset other VM attributes: */
    118         m_strOSTypeId = QString();
    119         m_groups.clear();
    120 
    121         /* Reset snapshot attributes: */
    122         m_strSnapshotName = QString();
    123         m_lastStateChange = QDateTime::currentDateTime();
    124         m_cSnaphot = 0;
    125 
    126         /* Reset VM states: */
    127         m_enmMachineState = KMachineState_Null;
    128         m_machineStateIcon = gpConverter->toIcon(KMachineState_Aborted);
    129         m_enmSessionState = KSessionState_Null;
    130 
    131         /* Reset configuration access level: */
    132         m_enmConfigurationAccessLevel = ConfigurationAccessLevel_Null;
    133 
    134         /* Reset PID finally: */
    135         m_pid = (ULONG) ~0;
    136 
    137         /* Reset whether we should show this VM details: */
    138         m_fHasDetails = true;
     68        /// @todo handle inaccessible cloud VM
    13969    }
    14070
     
    14676}
    14777
    148 void UIVirtualMachineItemLocal::recachePixmap()
     78void UIVirtualMachineItemCloud::recachePixmap()
    14979{
    15080    /* If machine is accessible: */
    15181    if (m_fAccessible)
    15282    {
    153         /* First, we are trying to acquire personal machine guest OS type icon: */
    154         m_pixmap = uiCommon().vmUserPixmapDefault(m_comMachine, &m_logicalPixmapSize);
    155         /* If there is nothing, we are using icon corresponding to cached guest OS type: */
    156         if (m_pixmap.isNull())
     83        /* We are using icon corresponding to cached guest OS type: */
     84        if (   itemType() == ItemType_CloudFake
     85            && fakeCloudItemState() == FakeCloudItemState_Loading)
     86            m_pixmap = uiCommon().vmGuestOSTypePixmapDefault("Cloud", &m_logicalPixmapSize);
     87        else
    15788            m_pixmap = uiCommon().vmGuestOSTypePixmapDefault(m_strOSTypeId, &m_logicalPixmapSize);
    15889    }
     
    16091    else
    16192    {
    162         /* We are using "Other" guest OS type icon: */
    163         m_pixmap = uiCommon().vmGuestOSTypePixmapDefault("Other", &m_logicalPixmapSize);
     93        /// @todo handle inaccessible cloud VM
    16494    }
    16595}
    16696
    167 bool UIVirtualMachineItemLocal::canSwitchTo() const
     97bool UIVirtualMachineItemCloud::isItemEditable() const
    16898{
    169     return const_cast <CMachine&>(m_comMachine).CanShowConsoleWindow();
     99    return accessible();
    170100}
    171101
    172 bool UIVirtualMachineItemLocal::switchTo()
    173 {
    174 #ifdef VBOX_WS_MAC
    175     ULONG64 id = m_comMachine.ShowConsoleWindow();
    176 #else
    177     WId id = (WId) m_comMachine.ShowConsoleWindow();
    178 #endif
    179     AssertWrapperOk(m_comMachine);
    180     if (!m_comMachine.isOk())
    181         return false;
    182 
    183     /* winId = 0 it means the console window has already done everything
    184      * necessary to implement the "show window" semantics. */
    185     if (id == 0)
    186         return true;
    187 
    188 #if defined (VBOX_WS_WIN) || defined (VBOX_WS_X11)
    189 
    190     return uiCommon().activateWindow(id, true);
    191 
    192 #elif defined (VBOX_WS_MAC)
    193 
    194     // WORKAROUND:
    195     // This is just for the case were the other process cannot steal
    196     // the focus from us. It will send us a PSN so we can try.
    197     ProcessSerialNumber psn;
    198     psn.highLongOfPSN = id >> 32;
    199     psn.lowLongOfPSN = (UInt32)id;
    200     OSErr rc = ::SetFrontProcess(&psn);
    201     if (!rc)
    202         Log(("GUI: %#RX64 couldn't do SetFrontProcess on itself, the selector (we) had to do it...\n", id));
    203     else
    204         Log(("GUI: Failed to bring %#RX64 to front. rc=%#x\n", id, rc));
    205     return !rc;
    206 
    207 #else
    208 
    209     return false;
    210 
    211 #endif
    212 }
    213 
    214 bool UIVirtualMachineItemLocal::isItemEditable() const
    215 {
    216     return    accessible()
    217            && sessionState() == KSessionState_Unlocked;
    218 }
    219 
    220 bool UIVirtualMachineItemLocal::isItemSaved() const
     102bool UIVirtualMachineItemCloud::isItemSaved() const
    221103{
    222104    return    accessible()
     
    224106}
    225107
    226 bool UIVirtualMachineItemLocal::isItemPoweredOff() const
     108bool UIVirtualMachineItemCloud::isItemPoweredOff() const
    227109{
    228110    return    accessible()
     
    233115}
    234116
    235 bool UIVirtualMachineItemLocal::isItemStarted() const
     117bool UIVirtualMachineItemCloud::isItemStarted() const
    236118{
    237119    return    isItemRunning()
     
    239121}
    240122
    241 bool UIVirtualMachineItemLocal::isItemRunning() const
     123bool UIVirtualMachineItemCloud::isItemRunning() const
    242124{
    243125    return    accessible()
     
    247129}
    248130
    249 bool UIVirtualMachineItemLocal::isItemRunningHeadless() const
     131bool UIVirtualMachineItemCloud::isItemRunningHeadless() const
    250132{
    251     if (isItemRunning())
    252     {
    253         /* Open session to determine which frontend VM is started with: */
    254         CSession comSession = uiCommon().openExistingSession(id());
    255         if (!comSession.isNull())
    256         {
    257             /* Acquire the session name: */
    258             const QString strSessionName = comSession.GetMachine().GetSessionName();
    259             /* Close the session early: */
    260             comSession.UnlockMachine();
    261             /* Check whether we are in 'headless' session: */
    262             return strSessionName == "headless";
    263         }
    264     }
    265     return false;
     133    return isItemRunning();
    266134}
    267135
    268 bool UIVirtualMachineItemLocal::isItemPaused() const
     136bool UIVirtualMachineItemCloud::isItemPaused() const
    269137{
    270138    return    accessible()
     
    273141}
    274142
    275 bool UIVirtualMachineItemLocal::isItemStuck() const
     143bool UIVirtualMachineItemCloud::isItemStuck() const
    276144{
    277145    return    accessible()
     
    279147}
    280148
    281 void UIVirtualMachineItemLocal::retranslateUi()
     149void UIVirtualMachineItemCloud::retranslateUi()
    282150{
    283     /* This is used in tool-tip generation: */
    284     const QString strDateTime = (m_lastStateChange.date() == QDate::currentDate())
    285                               ? m_lastStateChange.time().toString(Qt::LocalDate)
    286                               : m_lastStateChange.toString(Qt::LocalDate);
    287 
    288151    /* If machine is accessible: */
    289152    if (m_fAccessible)
    290153    {
     154        /* Update name: */
     155        if (itemType() == UIVirtualMachineItem::ItemType_CloudFake)
     156            m_strName = tr("Empty");
     157
     158        /* Update machine state: */
     159        if (itemType() == UIVirtualMachineItem::ItemType_CloudFake)
     160        {
     161            switch (m_enmFakeCloudItemState)
     162            {
     163                case UIVirtualMachineItemCloud::FakeCloudItemState_Loading:
     164                    m_strMachineStateName = tr("Loading ...");
     165                    break;
     166                case UIVirtualMachineItemCloud::FakeCloudItemState_Done:
     167                    m_strMachineStateName = tr("Done");
     168                    break;
     169                default:
     170                    break;
     171            }
     172        }
     173
    291174        /* Update tool-tip: */
    292         m_strToolTipText = QString("<b>%1</b>").arg(m_strName);
    293         if (!m_strSnapshotName.isNull())
    294             m_strToolTipText += QString(" (%1)").arg(m_strSnapshotName);
    295         m_strToolTipText = tr("<nobr>%1<br></nobr>"
    296                               "<nobr>%2 since %3</nobr><br>"
    297                               "<nobr>Session %4</nobr>",
    298                               "VM tooltip (name, last state change, session state)")
    299                               .arg(m_strToolTipText)
    300                               .arg(gpConverter->toString(m_enmMachineState))
    301                               .arg(strDateTime)
    302                               .arg(gpConverter->toString(m_enmSessionState).toLower());
     175        m_strToolTipText = tr("<nobr><b>%1</b></nobr><br>"
     176                              "<nobr>%2</nobr>",
     177                              "VM tooltip (name, state)")
     178                              .arg(m_strName)
     179                              .arg(gpConverter->toString(m_enmMachineState));
    303180    }
    304181    /* Otherwise: */
     
    306183    {
    307184        /* Update tool-tip: */
    308         m_strToolTipText = tr("<nobr><b>%1</b><br></nobr>"
    309                               "<nobr>Inaccessible since %2</nobr>",
    310                               "Inaccessible VM tooltip (name, last state change)")
    311                               .arg(m_strSettingsFile)
    312                               .arg(strDateTime);
     185        m_strToolTipText = tr("<nobr><b>%1</b></nobr><br>"
     186                              "<nobr>Inaccessible</nobr>",
     187                              "Inaccessible VM tooltip (name)")
     188                              .arg(m_strName);
    313189
    314190        /* We have our own translation for Null states: */
    315191        m_strMachineStateName = tr("Inaccessible");
    316         m_strSessionStateName = tr("Inaccessible");
    317192    }
    318193}
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualMachineItemCloud.h

    r82944 r82960  
    11/* $Id$ */
    22/** @file
    3  * VBox Qt GUI - UIVirtualMachineItemLocal class declarations.
     3 * VBox Qt GUI - UIVirtualMachineItemCloud class declarations.
    44 */
    55
     
    1616 */
    1717
    18 #ifndef FEQT_INCLUDED_SRC_manager_UIVirtualMachineItemLocal_h
    19 #define FEQT_INCLUDED_SRC_manager_UIVirtualMachineItemLocal_h
     18#ifndef FEQT_INCLUDED_SRC_manager_UIVirtualMachineItemCloud_h
     19#define FEQT_INCLUDED_SRC_manager_UIVirtualMachineItemCloud_h
    2020#ifndef RT_WITHOUT_PRAGMA_ONCE
    2121# pragma once
    2222#endif
    2323
    24 /* Qt includes: */
    25 #include <QDateTime>
    26 
    2724/* GUI includes: */
    2825#include "UIVirtualMachineItem.h"
    2926
    30 /* COM includes: */
    31 #include "CMachine.h"
    32 
    33 /** UIVirtualMachineItem sub-class used as local Virtual Machine item interface. */
    34 class UIVirtualMachineItemLocal : public UIVirtualMachineItem
     27/** UIVirtualMachineItem sub-class used as cloud Virtual Machine item interface. */
     28class UIVirtualMachineItemCloud : public UIVirtualMachineItem
    3529{
    3630    Q_OBJECT;
     
    3832public:
    3933
    40     /** Constructs local VM item on the basis of taken @a comMachine. */
    41     UIVirtualMachineItemLocal(const CMachine &comMachine);
    42     /** Destructs local VM item. */
    43     virtual ~UIVirtualMachineItemLocal();
     34    /** Fake cloud item states. */
     35    enum FakeCloudItemState
     36    {
     37        FakeCloudItemState_NotApplicable,
     38        FakeCloudItemState_Loading,
     39        FakeCloudItemState_Done
     40    };
    4441
    45     /** @name Arguments.
    46       * @{ */
    47         /** Returns cached virtual machine object. */
    48         CMachine machine() const { return m_comMachine; }
    49     /** @} */
    50 
    51     /** @name Basic attributes.
    52       * @{ */
    53         /** Returns cached machine settings file name. */
    54         QString settingsFile() const { return m_strSettingsFile; }
    55         /** Returns cached machine group list. */
    56         const QStringList &groups() { return m_groups; }
    57     /** @} */
    58 
    59     /** @name Snapshot attributes.
    60       * @{ */
    61         /** Returns cached snapshot name. */
    62         QString snapshotName() const { return m_strSnapshotName; }
    63         /** Returns cached snapshot children count. */
    64         ULONG snapshotCount() const { return m_cSnaphot; }
    65     /** @} */
     42    /** Constructs fake cloud VM item. */
     43    UIVirtualMachineItemCloud();
     44    /** Destructs cloud VM item. */
     45    virtual ~UIVirtualMachineItemCloud();
    6646
    6747    /** @name State attributes.
    6848      * @{ */
    69         /** Returns cached session state. */
    70         KSessionState sessionState() const { return m_enmSessionState; }
    71         /** Returns cached session state name. */
    72         QString sessionStateName() const { return m_strSessionStateName; }
    73     /** @} */
    74 
    75     /** @name Console attributes.
    76       * @{ */
    77         /** Returns whether we can switch to main window of VM process. */
    78         bool canSwitchTo() const;
    79         /** Tries to switch to the main window of the VM process.
    80           * @return true if switched successfully. */
    81         bool switchTo();
     49        /** Returns fake cloud item state. */
     50        FakeCloudItemState fakeCloudItemState() const { return m_enmFakeCloudItemState; }
    8251    /** @} */
    8352
     
    11887    /** @} */
    11988
    120 private:
    121 
    122     /** @name Arguments.
    123       * @{ */
    124         /** Holds cached machine object reference. */
    125         CMachine  m_comMachine;
    126     /** @} */
    127 
    128     /** @name Basic attributes.
    129       * @{ */
    130         /** Holds cached machine settings file name. */
    131         QString      m_strSettingsFile;
    132         /** Holds cached machine group list. */
    133         QStringList  m_groups;
    134     /** @} */
    135 
    136     /** @name Snapshot attributes.
    137       * @{ */
    138         /** Holds cached snapshot name. */
    139         QString    m_strSnapshotName;
    140         /** Holds cached last state change date/time. */
    141         QDateTime  m_lastStateChange;
    142         /** Holds cached snapshot children count. */
    143         ULONG      m_cSnaphot;
    144     /** @} */
    145 
    14689    /** @name State attributes.
    14790      * @{ */
    148         /** Holds cached session state. */
    149         KSessionState  m_enmSessionState;
    150         /** Holds cached session state name. */
    151         QString        m_strSessionStateName;
    152     /** @} */
    153 
    154     /** @name Console attributes.
    155       * @{ */
    156         /** Holds machine PID. */
    157         ULONG  m_pid;
     91        /** Holds fake cloud item state. */
     92        FakeCloudItemState  m_enmFakeCloudItemState;
    15893    /** @} */
    15994};
    16095
    161 #endif /* !FEQT_INCLUDED_SRC_manager_UIVirtualMachineItemLocal_h */
     96#endif /* !FEQT_INCLUDED_SRC_manager_UIVirtualMachineItemCloud_h */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualMachineItemLocal.cpp

    r82944 r82960  
    2121
    2222/* GUI includes: */
    23 #include "UIVirtualMachineItemLocal.h"
    2423#include "UICommon.h"
    2524#include "UIConverter.h"
    2625#include "UIExtraDataManager.h"
     26#include "UIVirtualMachineItemLocal.h"
    2727#ifdef VBOX_WS_MAC
    2828# include <ApplicationServices/ApplicationServices.h>
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserNodeMachine.cpp

    r82944 r82960  
    1818/* GUI includes: */
    1919#include "UIChooserNodeMachine.h"
     20#include "UIVirtualMachineItemCloud.h"
    2021#include "UIVirtualMachineItemLocal.h"
    2122
     
    3435
    3536UIChooserNodeMachine::UIChooserNodeMachine(UIChooserNode *pParent,
     37                                           bool fFavorite,
     38                                           int  iPosition)
     39    : UIChooserNode(pParent, fFavorite)
     40    , m_pCache(new UIVirtualMachineItemCloud)
     41{
     42    if (parentNode())
     43        parentNode()->addNode(this, iPosition);
     44    retranslateUi();
     45}
     46
     47UIChooserNodeMachine::UIChooserNodeMachine(UIChooserNode *pParent,
    3648                                           UIChooserNodeMachine *pCopyFrom,
    3749                                           int iPosition)
    3850    : UIChooserNode(pParent, pCopyFrom->isFavorite())
    39     , m_pCache(new UIVirtualMachineItemLocal(pCopyFrom->cache()->toLocal()->machine()))
    4051{
     52    switch (pCopyFrom->cache()->itemType())
     53    {
     54        case UIVirtualMachineItem::ItemType_Local:
     55            m_pCache = new UIVirtualMachineItemLocal(pCopyFrom->cache()->toLocal()->machine());
     56            break;
     57        case UIVirtualMachineItem::ItemType_CloudFake:
     58            m_pCache = new UIVirtualMachineItemCloud;
     59            break;
     60        default:
     61            break;
     62    }
     63
    4164    if (parentNode())
    4265        parentNode()->addNode(this, iPosition);
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserNodeMachine.h

    r82944 r82960  
    3737public:
    3838
    39     /** Constructs chooser node passing @a pParent to the base-class.
     39    /** Constructs chooser node for local VM passing @a pParent to the base-class.
    4040      * @param  fFavorite   Brings whether the node is favorite.
    4141      * @param  iPosition   Brings the initial node position.
     
    4545                         int iPosition,
    4646                         const CMachine &comMachine);
     47    /** Constructs chooser node for cloud VM passing @a pParent to the base-class.
     48      * @param  fFavorite  Brings whether the node is favorite.
     49      * @param  iPosition  Brings the initial node position. */
     50    UIChooserNodeMachine(UIChooserNode *pParent,
     51                         bool fFavorite,
     52                         int iPosition);
    4753    /** Constructs chooser node passing @a pParent to the base-class.
    4854      * @param  pCopyFrom  Brings the node to copy data from.
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