VirtualBox

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


Ignore:
Timestamp:
Feb 11, 2020 3:41:55 PM (5 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9653: VirtualBox Manager: Chooser pane: Advancing r136015 to cache cloud VM item data more widely via separate UICloudMachine class based on explicit memory sharing implementation.

Location:
trunk/src/VBox/Frontends/VirtualBox
Files:
2 added
8 edited

Legend:

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

    r83033 r83050  
    615615        src/hostnetwork/UIHostNetworkDetailsWidget.h \
    616616        src/hostnetwork/UIHostNetworkManager.h \
     617        src/manager/UICloudMachine.h \
    617618        src/manager/UIErrorPane.h \
    618619        src/manager/UIToolPaneGlobal.h \
     
    10611062        src/hostnetwork/UIHostNetworkManager.cpp \
    10621063        src/hostnetwork/UIHostNetworkUtils.cpp \
     1064        src/manager/UICloudMachine.cpp \
    10631065        src/manager/UIErrorPane.cpp \
    10641066        src/manager/UIToolPaneGlobal.cpp \
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualMachineItemCloud.cpp

    r83015 r83050  
    1717
    1818/* GUI includes: */
     19#include "UICloudMachine.h"
    1920#include "UICommon.h"
    2021#include "UIConverter.h"
     
    2526UIVirtualMachineItemCloud::UIVirtualMachineItemCloud()
    2627    : UIVirtualMachineItem(ItemType_CloudFake)
     28    , m_pCloudMachine(0)
    2729    , m_enmFakeCloudItemState(FakeCloudItemState_Loading)
    2830{
     
    3032}
    3133
    32 UIVirtualMachineItemCloud::UIVirtualMachineItemCloud(const QString &strName)
     34UIVirtualMachineItemCloud::UIVirtualMachineItemCloud(const UICloudMachine &guiCloudMachine)
    3335    : UIVirtualMachineItem(ItemType_CloudReal)
     36    , m_pCloudMachine(new UICloudMachine(guiCloudMachine))
    3437    , m_enmFakeCloudItemState(FakeCloudItemState_NotApplicable)
    3538{
    36     m_strName = strName;
    3739    recache();
    3840}
     
    4042UIVirtualMachineItemCloud::~UIVirtualMachineItemCloud()
    4143{
     44    delete m_pCloudMachine;
    4245}
    4346
     
    4548{
    4649    /* Determine attributes which are always available: */
    47     /// @todo is there something?
     50    if (itemType() == ItemType_CloudReal)
     51    {
     52        AssertPtrReturnVoid(m_pCloudMachine);
     53        m_strId = m_pCloudMachine->id();
     54        m_strName = m_pCloudMachine->name();
     55    }
    4856
    4957    /* Now determine whether VM is accessible: */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/UIVirtualMachineItemCloud.h

    r83012 r83050  
    2525#include "UIVirtualMachineItem.h"
    2626
     27/* Forward declarations: */
     28class UICloudMachine;
     29
    2730/** UIVirtualMachineItem sub-class used as cloud Virtual Machine item interface. */
    2831class UIVirtualMachineItemCloud : public UIVirtualMachineItem
     
    4245    /** Constructs fake cloud VM item. */
    4346    UIVirtualMachineItemCloud();
    44     /** Constructs real cloud VM item. */
    45     UIVirtualMachineItemCloud(const QString &strName);
     47    /** Constructs real cloud VM item on the basis of taken @a guiCloudMachine. */
     48    UIVirtualMachineItemCloud(const UICloudMachine &guiCloudMachine);
    4649    /** Destructs cloud VM item. */
    4750    virtual ~UIVirtualMachineItemCloud();
     
    9194    /** @} */
    9295
     96private:
     97
     98    /** @name Arguments.
     99      * @{ */
     100        /** Holds cached cloud machine object reference. */
     101        UICloudMachine *m_pCloudMachine;
     102    /** @} */
     103
    93104    /** @name State attributes.
    94105      * @{ */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserAbstractModel.cpp

    r83041 r83050  
    2929#include "UIVirtualMachineItem.h"
    3030#ifdef VBOX_GUI_WITH_CLOUD_VMS
     31# include "UICloudMachine.h"
    3132# include "UITaskCloudAcquireInstances.h"
    3233# include "UIThreadPool.h"
     
    300301    /* Add real cloud VM items: */
    301302    int iPosition = 1; /* we've got item with index 0 already, the "Empty" one .. */
    302     foreach (const QString &strInstanceName, pAcquiringTask->instanceNames())
    303     {
     303    foreach (const UICloudMachine &guiCloudMachine, pAcquiringTask->instances())
    304304        new UIChooserNodeMachine(pParentNode,
    305305                                 false /* favorite */,
    306306                                 iPosition++ /* position */,
    307                                  strInstanceName);
    308     }
     307                                 guiCloudMachine);
    309308}
    310309#endif /* VBOX_GUI_WITH_CLOUD_VMS */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserNodeMachine.cpp

    r83046 r83050  
    3737                                           bool fFavorite,
    3838                                           int iPosition,
    39                                            const QString &strName)
     39                                           const UICloudMachine &guiCloudMachine)
    4040    : UIChooserNode(pParent, fFavorite)
    41     , m_pCache(new UIVirtualMachineItemCloud(strName))
     41    , m_pCache(new UIVirtualMachineItemCloud(guiCloudMachine))
    4242{
    4343    if (parentNode())
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserNodeMachine.h

    r83040 r83050  
    2626
    2727/* Forward declarations: */
     28class UICloudMachine;
    2829class UIVirtualMachineItem;
    2930class CMachine;
     
    3940    /** Constructs chooser node for local VM passing @a pParent to the base-class.
    4041      * @param  fFavorite   Brings whether the node is favorite.
    41       * @param  iPosition   Brings the initial node position.
     42      * @param  iPosition   Brings initial node position.
    4243      * @param  comMachine  Brings COM machine object. */
    4344    UIChooserNodeMachine(UIChooserNode *pParent,
     
    4647                         const CMachine &comMachine);
    4748    /** Constructs chooser node for real 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       * @param  strName    Brings the cloud VM name. */
     49      * @param  fFavorite        Brings whether the node is favorite.
     50      * @param  iPosition        Brings initial node position.
     51      * @param  guiCloudMachine  Brings cloud VM object. */
    5152    UIChooserNodeMachine(UIChooserNode *pParent,
    5253                         bool fFavorite,
    5354                         int iPosition,
    54                          const QString &strName);
     55                         const UICloudMachine &guiCloudMachine);
    5556    /** Constructs chooser node for fake cloud VM passing @a pParent to the base-class.
    5657      * @param  fFavorite  Brings whether the node is favorite.
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UITaskCloudAcquireInstances.cpp

    r83008 r83050  
    3131}
    3232
    33 QStringList UITaskCloudAcquireInstances::instanceNames() const
     33QList<UICloudMachine> UITaskCloudAcquireInstances::instances() const
    3434{
    3535    m_mutex.lock();
    36     const QStringList instanceNames = m_instanceNames;
     36    const QList<UICloudMachine> instances = m_instances;
    3737    m_mutex.unlock();
    38     return instanceNames;
    39 }
    40 
    41 QStringList UITaskCloudAcquireInstances::instanceIds() const
    42 {
    43     m_mutex.lock();
    44     const QStringList instanceIds = m_instanceIds;
    45     m_mutex.unlock();
    46     return instanceIds;
     38    return instances;
    4739}
    4840
     
    8577        }
    8678
    87         /* Fetch acquired names/ids to lists: */
    88         m_instanceNames = comNames.GetValues().toList();
    89         m_instanceIds = comIDs.GetValues().toList();
     79        /* Fetch acquired objects to lists: */
     80        const QVector<QString> instanceIds = comIDs.GetValues();
     81        const QVector<QString> instanceNames = comNames.GetValues();
     82        for (int i = 0; i < instanceIds.size(); ++i)
     83            m_instances << UICloudMachine(m_comCloudClient, instanceIds.at(i), instanceNames.at(i));
    9084    }
    9185    while (0);
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UITaskCloudAcquireInstances.h

    r83008 r83050  
    2626
    2727/* GUI includes: */
     28#include "UICloudMachine.h"
    2829#include "UITask.h"
    2930
     
    5455    CVirtualBoxErrorInfo errorInfo();
    5556
    56     /** Returns the instance name list. */
    57     QStringList instanceNames() const;
    58     /** Returns the instance ID list. */
    59     QStringList instanceIds() const;
     57    /** Returns the instance object list. */
     58    QList<UICloudMachine> instances() const;
    6059
    6160protected:
     
    7776    CVirtualBoxErrorInfo  m_comErrorInfo;
    7877
    79     /** Holds the instance name list. */
    80     QStringList  m_instanceNames;
    81     /** Holds the instance ID list. */
    82     QStringList  m_instanceIds;
     78    /** Holds the instance object list. */
     79    QList<UICloudMachine>  m_instances;
    8380};
    8481
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