VirtualBox

Changeset 74880 in vbox


Ignore:
Timestamp:
Oct 17, 2018 2:28:35 PM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
125863
Message:

FE/Qt: bugref:9230: Separate tree-widget items for providers and profiles.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/cloud
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/cloud/UICloudProfileDetailsWidget.h

    r74853 r74880  
    2020
    2121/* Qt includes: */
     22#include <QUuid>
    2223#include <QWidget>
    2324
     
    3132class QIDialogButtonBox;
    3233
     34
     35/** Cloud Provider data structure. */
     36struct UIDataCloudProvider
     37{
     38    /** Constructs data. */
     39    UIDataCloudProvider()
     40        : m_strName(QString())
     41    {}
     42
     43    /** Returns whether the @a other passed data is equal to this one. */
     44    bool equal(const UIDataCloudProvider &other) const
     45    {
     46        return true
     47               && (m_uuid == other.m_uuid)
     48               && (m_strName == other.m_strName)
     49               ;
     50    }
     51
     52    /** Returns whether the @a other passed data is equal to this one. */
     53    bool operator==(const UIDataCloudProvider &other) const { return equal(other); }
     54    /** Returns whether the @a other passed data is different from this one. */
     55    bool operator!=(const UIDataCloudProvider &other) const { return !equal(other); }
     56
     57    /** Holds the provider ID. */
     58    QUuid    m_uuid;
     59    /** Holds the provider name. */
     60    QString  m_strName;
     61};
    3362
    3463/** Cloud Profile data structure. */
     
    5382    bool operator!=(const UIDataCloudProfile &other) const { return !equal(other); }
    5483
    55     /** Holds the snapshot name. */
     84    /** Holds the profile name. */
    5685    QString  m_strName;
    5786};
  • trunk/src/VBox/Frontends/VirtualBox/src/cloud/UICloudProfileManager.cpp

    r74871 r74880  
    4040/* COM includes: */
    4141#include "CCloudProfile.h"
     42#include "CCloudProvider.h"
    4243
    4344#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
     
    5354
    5455
    55 /** Cloud Profile Manager tree-widget item. */
    56 class UIItemCloudProfile : public QITreeWidgetItem, public UIDataCloudProfile
     56/** Cloud Profile Manager provider's tree-widget item. */
     57class UIItemCloudProvider : public QITreeWidgetItem, public UIDataCloudProvider
    5758{
    5859public:
    5960
    60     /** Updates item fields from data. */
     61    /** Updates item fields from base-class data. */
    6162    void updateFields();
    6263
     
    6566};
    6667
     68/** Cloud Profile Manager profile's tree-widget item. */
     69class UIItemCloudProfile : public QITreeWidgetItem, public UIDataCloudProfile
     70{
     71public:
     72
     73    /** Updates item fields from base-class data. */
     74    void updateFields();
     75
     76    /** Returns item name. */
     77    QString name() const { return m_strName; }
     78};
     79
     80
     81/*********************************************************************************************************************************
     82*   Class UIItemCloudProvider implementation.                                                                                    *
     83*********************************************************************************************************************************/
     84
     85void UIItemCloudProvider::updateFields()
     86{
     87    /* Update item fields: */
     88    setText(Column_Name, m_strName);
     89    /// @todo assign rest of field values!
     90
     91    /* Compose item tool-tip: */
     92    /// @todo assign tool-tips!
     93}
     94
    6795
    6896/*********************************************************************************************************************************
     
    72100void UIItemCloudProfile::updateFields()
    73101{
    74     /* Compose item fields: */
     102    /* Update item fields: */
    75103    setText(Column_Name, m_strName);
    76104    /// @todo assign rest of field values!
     
    176204void UICloudProfileManagerWidget::sltRefreshCloudProfiles()
    177205{
     206    /// @todo refresh cloud profiles!
     207
    178208    // Not implemented.
    179209    AssertMsgFailed(("Not implemented!"));
     
    254284    retranslateUi();
    255285
    256     /* Load cloud profiles: */
    257     loadCloudProfiles();
     286    /* Load cloud stuff: */
     287    loadCloudStuff();
    258288}
    259289
     
    384414}
    385415
    386 void UICloudProfileManagerWidget::loadCloudProfiles()
     416void UICloudProfileManagerWidget::loadCloudStuff()
    387417{
    388418    /* Clear tree first of all: */
     
    392422}
    393423
     424void UICloudProfileManagerWidget::loadCloudProvider(const CCloudProvider &comProvider, UIDataCloudProvider &data)
     425{
     426    Q_UNUSED(comProvider);
     427    Q_UNUSED(data);
     428
     429    /// @todo load cloud profile!
     430}
     431
    394432void UICloudProfileManagerWidget::loadCloudProfile(const CCloudProfile &comProfile, UIDataCloudProfile &data)
    395433{
     
    400438}
    401439
    402 void UICloudProfileManagerWidget::createItemForCloudProfile(const UIDataCloudProfile &data, bool fChooseItem)
    403 {
    404     /* Create new item: */
    405     UIItemCloudProfile *pItem = new UIItemCloudProfile;
     440void UICloudProfileManagerWidget::createItemForCloudProvider(const UIDataCloudProvider &data, bool fChooseItem)
     441{
     442    /* Create new provider item: */
     443    UIItemCloudProvider *pItem = new UIItemCloudProvider;
    406444    if (pItem)
    407445    {
    408446        /* Configure item: */
    409         pItem->UIDataCloudProfile::operator=(data);
     447        pItem->UIDataCloudProvider::operator=(data);
    410448        pItem->updateFields();
    411449        /* Add item to the tree: */
    412450        m_pTreeWidget->addTopLevelItem(pItem);
     451        /* And choose it as current if necessary: */
     452        if (fChooseItem)
     453            m_pTreeWidget->setCurrentItem(pItem);
     454    }
     455}
     456
     457void UICloudProfileManagerWidget::createItemForCloudProfile(QTreeWidgetItem *pParent, const UIDataCloudProfile &data, bool fChooseItem)
     458{
     459    /* Create new profile item: */
     460    UIItemCloudProfile *pItem = new UIItemCloudProfile;
     461    if (pItem)
     462    {
     463        /* Configure item: */
     464        pItem->setFlags(pItem->flags() | Qt::ItemIsEditable);
     465        pItem->UIDataCloudProfile::operator=(data);
     466        pItem->updateFields();
     467        /* Add item to the parent: */
     468        pParent->addChild(pItem);
    413469        /* And choose it as current if necessary: */
    414470        if (fChooseItem)
  • trunk/src/VBox/Frontends/VirtualBox/src/cloud/UICloudProfileManager.h

    r74853 r74880  
    3030class UICloudProfileDetailsWidget;
    3131class UIItemCloudProfile;
     32class UIItemCloudProvider;
    3233class UIToolBar;
    3334struct UIDataCloudProfile;
     35struct UIDataCloudProvider;
    3436class CCloudProfile;
     37class CCloudProvider;
    3538
    3639
     
    137140    /** @name Loading stuff.
    138141      * @{ */
    139         /** Loads cloud profiles. */
    140         void loadCloudProfiles();
    141         /** Loads host @a comInterface data to passed @a data container. */
    142         void loadCloudProfile(const CCloudProfile &comInterface, UIDataCloudProfile &data);
     142        /** Loads cloud stuff. */
     143        void loadCloudStuff();
     144        /** Loads cloud @a comProvider data to passed @a data container. */
     145        void loadCloudProvider(const CCloudProvider &comProvider, UIDataCloudProvider &data);
     146        /** Loads cloud @a comProfile data to passed @a data container. */
     147        void loadCloudProfile(const CCloudProfile &comProfile, UIDataCloudProfile &data);
    143148    /** @} */
    144149
     
    146151      * @{ */
    147152        /** Creates a new tree-widget item on the basis of passed @a data, @a fChooseItem if requested. */
    148         void createItemForCloudProfile(const UIDataCloudProfile &data, bool fChooseItem);
     153        void createItemForCloudProvider(const UIDataCloudProvider &data, bool fChooseItem);
     154
     155        /** Creates a new tree-widget item as a child of certain @a pParent, on the basis of passed @a data, @a fChooseItem if requested. */
     156        void createItemForCloudProfile(QTreeWidgetItem *pParent, const UIDataCloudProfile &data, bool fChooseItem);
    149157        /** Updates the passed tree-widget item on the basis of passed @a data, @a fChooseItem if requested. */
    150158        void updateItemForCloudProfile(const UIDataCloudProfile &data, bool fChooseItem, UIItemCloudProfile *pItem);
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