VirtualBox

Changeset 74044 in vbox


Ignore:
Timestamp:
Sep 3, 2018 1:32:53 PM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
124798
Message:

FE/Qt: VirtualBox Manager UI: Large cleanup for UIDetailsSet, doxygen + style fixes.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/manager/details
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsGroup.h

    r74042 r74044  
    4949    UIDetailsGroup(QGraphicsScene *pScene);
    5050    /** Destructs group item. */
    51     ~UIDetailsGroup();
     51    virtual ~UIDetailsGroup() /* override */;
    5252
    5353    /** @name Item stuff.
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsSet.cpp

    r73424 r74044  
    55
    66/*
    7  * Copyright (C) 2012-2017 Oracle Corporation
     7 * Copyright (C) 2012-2018 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    2424
    2525/* GUI includes: */
     26# include "UIDetailsElements.h"
     27# include "UIDetailsModel.h"
    2628# include "UIDetailsSet.h"
    27 # include "UIDetailsModel.h"
    28 # include "UIDetailsElements.h"
     29# include "UIVirtualBoxEventHandler.h"
    2930# include "UIVirtualMachineItem.h"
    30 # include "UIVirtualBoxEventHandler.h"
    3131# include "VBoxGlobal.h"
    3232
     
    4141    : UIDetailsItem(pParent)
    4242    , m_pMachineItem(0)
     43    , m_fFullSet(true)
    4344    , m_fHasDetails(false)
    4445    , m_configurationAccessLevel(ConfigurationAccessLevel_Null)
    45     , m_fFullSet(true)
    4646    , m_pBuildStep(0)
    4747    , m_iLastStepNumber(-1)
     
    127127    {
    128128        /* Load details settings: */
    129         DetailsElementType elementType = (DetailsElementType)iStepNumber;
     129        DetailsElementType enmElementType = (DetailsElementType)iStepNumber;
    130130        /* Should the element be visible? */
    131         bool fVisible = m_settings.contains(elementType);
     131        bool fVisible = m_settings.contains(enmElementType);
    132132        /* Should the element be opened? */
    133         bool fOpen = fVisible && m_settings[elementType];
     133        bool fOpen = fVisible && m_settings[enmElementType];
    134134
    135135        /* Check if element is present already: */
    136         UIDetailsElement *pElement = element(elementType);
     136        UIDetailsElement *pElement = element(enmElementType);
    137137        if (pElement && fOpen)
    138138            pElement->open(false);
     
    142142        {
    143143            fJustCreated = true;
    144             pElement = createElement(elementType, fOpen);
     144            pElement = createElement(enmElementType, fOpen);
    145145        }
    146146
     
    198198}
    199199
    200 void UIDetailsSet::sltMachineStateChange(QString strId)
    201 {
    202     /* Is this our VM changed? */
    203     if (m_machine.GetId() != strId)
    204         return;
    205 
    206     /* Update appearance: */
    207     rebuildSet();
    208 }
    209 
    210 void UIDetailsSet::sltMachineAttributesChange(QString strId)
    211 {
    212     /* Is this our VM changed? */
    213     if (m_machine.GetId() != strId)
    214         return;
    215 
    216     /* Update appearance: */
    217     rebuildSet();
    218 }
    219 
    220 void UIDetailsSet::sltUpdateAppearance()
    221 {
    222     /* Update appearance: */
    223     rebuildSet();
    224 }
    225 
    226200QString UIDetailsSet::description() const
    227201{
    228202    return tr("Contains the details of virtual machine '%1'").arg(m_pMachineItem->name());
    229 }
    230 
    231 QVariant UIDetailsSet::data(int iKey) const
    232 {
    233     /* Provide other members with required data: */
    234     switch (iKey)
    235     {
    236         /* Layout hints: */
    237         case SetData_Margin: return 0;
    238         case SetData_Spacing: return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 5;
    239         /* Default: */
    240         default: break;
    241     }
    242     return QVariant();
    243203}
    244204
     
    283243}
    284244
    285 QList<UIDetailsItem*> UIDetailsSet::items(UIDetailsItemType type /* = UIDetailsItemType_Element */) const
    286 {
    287     switch (type)
     245QList<UIDetailsItem*> UIDetailsSet::items(UIDetailsItemType enmType /* = UIDetailsItemType_Element */) const
     246{
     247    switch (enmType)
    288248    {
    289249        case UIDetailsItemType_Element: return m_elements.values();
     
    294254}
    295255
    296 bool UIDetailsSet::hasItems(UIDetailsItemType type /* = UIDetailsItemType_Element */) const
    297 {
    298     switch (type)
     256bool UIDetailsSet::hasItems(UIDetailsItemType enmType /* = UIDetailsItemType_Element */) const
     257{
     258    switch (enmType)
    299259    {
    300260        case UIDetailsItemType_Element: return !m_elements.isEmpty();
     
    305265}
    306266
    307 void UIDetailsSet::clearItems(UIDetailsItemType type /* = UIDetailsItemType_Element */)
    308 {
    309     switch (type)
     267void UIDetailsSet::clearItems(UIDetailsItemType enmType /* = UIDetailsItemType_Element */)
     268{
     269    switch (enmType)
    310270    {
    311271        case UIDetailsItemType_Element:
     
    329289}
    330290
    331 UIDetailsElement* UIDetailsSet::element(DetailsElementType elementType) const
    332 {
    333     UIDetailsItem *pItem = m_elements.value(elementType, 0);
     291UIDetailsElement *UIDetailsSet::element(DetailsElementType enmElementType) const
     292{
     293    UIDetailsItem *pItem = m_elements.value(enmElementType, 0);
    334294    if (pItem)
    335295        return pItem->toElement();
    336296    return 0;
    337 }
    338 
    339 void UIDetailsSet::prepareSet()
    340 {
    341     /* Setup size-policy: */
    342     setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
    343 }
    344 
    345 void UIDetailsSet::prepareConnections()
    346 {
    347     /* Global-events connections: */
    348     connect(gVBoxEvents, SIGNAL(sigMachineStateChange(QString, KMachineState)), this, SLOT(sltMachineStateChange(QString)));
    349     connect(gVBoxEvents, SIGNAL(sigMachineDataChange(QString)), this, SLOT(sltMachineAttributesChange(QString)));
    350     connect(gVBoxEvents, SIGNAL(sigSessionStateChange(QString, KSessionState)), this, SLOT(sltMachineAttributesChange(QString)));
    351     connect(gVBoxEvents, SIGNAL(sigSnapshotTake(QString, QString)), this, SLOT(sltMachineAttributesChange(QString)));
    352     connect(gVBoxEvents, SIGNAL(sigSnapshotDelete(QString, QString)), this, SLOT(sltMachineAttributesChange(QString)));
    353     connect(gVBoxEvents, SIGNAL(sigSnapshotChange(QString, QString)), this, SLOT(sltMachineAttributesChange(QString)));
    354     connect(gVBoxEvents, SIGNAL(sigSnapshotRestore(QString, QString)), this, SLOT(sltMachineAttributesChange(QString)));
    355 
    356     /* Meidum-enumeration connections: */
    357     connect(&vboxGlobal(), SIGNAL(sigMediumEnumerationStarted()), this, SLOT(sltUpdateAppearance()));
    358     connect(&vboxGlobal(), SIGNAL(sigMediumEnumerationFinished()), this, SLOT(sltUpdateAppearance()));
    359 }
    360 
    361 int UIDetailsSet::minimumWidthHint() const
    362 {
    363     /* Zero if has no details: */
    364     if (!hasDetails())
    365         return 0;
    366 
    367     /* Prepare variables: */
    368     int iMargin = data(SetData_Margin).toInt();
    369     int iSpacing = data(SetData_Spacing).toInt();
    370     int iMinimumWidthHint = 0;
    371 
    372     /* Take into account all the elements: */
    373     foreach (UIDetailsItem *pItem, items())
    374     {
    375         /* Skip hidden: */
    376         if (!pItem->isVisible())
    377             continue;
    378 
    379         /* For each particular element: */
    380         UIDetailsElement *pElement = pItem->toElement();
    381         switch (pElement->elementType())
    382         {
    383             case DetailsElementType_General:
    384             case DetailsElementType_System:
    385             case DetailsElementType_Display:
    386             case DetailsElementType_Storage:
    387             case DetailsElementType_Audio:
    388             case DetailsElementType_Network:
    389             case DetailsElementType_Serial:
    390             case DetailsElementType_USB:
    391             case DetailsElementType_SF:
    392             case DetailsElementType_UI:
    393             case DetailsElementType_Description:
    394             {
    395                 iMinimumWidthHint = qMax(iMinimumWidthHint, pItem->minimumWidthHint());
    396                 break;
    397             }
    398             case DetailsElementType_Preview:
    399             {
    400                 UIDetailsItem *pGeneralItem = element(DetailsElementType_General);
    401                 UIDetailsItem *pSystemItem = element(DetailsElementType_System);
    402                 int iGeneralElementWidth = pGeneralItem ? pGeneralItem->minimumWidthHint() : 0;
    403                 int iSystemElementWidth = pSystemItem ? pSystemItem->minimumWidthHint() : 0;
    404                 int iFirstColumnWidth = qMax(iGeneralElementWidth, iSystemElementWidth);
    405                 iMinimumWidthHint = qMax(iMinimumWidthHint, iFirstColumnWidth + iSpacing + pItem->minimumWidthHint());
    406                 break;
    407             }
    408             case DetailsElementType_Invalid: AssertFailed(); break; /* Shut up, MSC! */
    409         }
    410     }
    411 
    412     /* And two margins finally: */
    413     iMinimumWidthHint += 2 * iMargin;
    414 
    415     /* Return result: */
    416     return iMinimumWidthHint;
    417 }
    418 
    419 int UIDetailsSet::minimumHeightHint() const
    420 {
    421     /* Zero if has no details: */
    422     if (!hasDetails())
    423         return 0;
    424 
    425     /* Prepare variables: */
    426     int iMargin = data(SetData_Margin).toInt();
    427     int iSpacing = data(SetData_Spacing).toInt();
    428     int iMinimumHeightHint = 0;
    429 
    430     /* Take into account all the elements: */
    431     foreach (UIDetailsItem *pItem, items())
    432     {
    433         /* Skip hidden: */
    434         if (!pItem->isVisible())
    435             continue;
    436 
    437         /* For each particular element: */
    438         UIDetailsElement *pElement = pItem->toElement();
    439         switch (pElement->elementType())
    440         {
    441             case DetailsElementType_General:
    442             case DetailsElementType_System:
    443             case DetailsElementType_Display:
    444             case DetailsElementType_Storage:
    445             case DetailsElementType_Audio:
    446             case DetailsElementType_Network:
    447             case DetailsElementType_Serial:
    448             case DetailsElementType_USB:
    449             case DetailsElementType_SF:
    450             case DetailsElementType_UI:
    451             case DetailsElementType_Description:
    452             {
    453                 iMinimumHeightHint += (pItem->minimumHeightHint() + iSpacing);
    454                 break;
    455             }
    456             case DetailsElementType_Preview:
    457             {
    458                 iMinimumHeightHint = qMax(iMinimumHeightHint, pItem->minimumHeightHint() + iSpacing);
    459                 break;
    460             }
    461             case DetailsElementType_Invalid: AssertFailed(); break; /* Shut up, MSC! */
    462         }
    463     }
    464 
    465     /* Minus last spacing: */
    466     iMinimumHeightHint -= iSpacing;
    467 
    468     /* And two margins finally: */
    469     iMinimumHeightHint += 2 * iMargin;
    470 
    471     /* Return result: */
    472     return iMinimumHeightHint;
    473297}
    474298
     
    553377}
    554378
     379int UIDetailsSet::minimumWidthHint() const
     380{
     381    /* Zero if has no details: */
     382    if (!hasDetails())
     383        return 0;
     384
     385    /* Prepare variables: */
     386    int iMargin = data(SetData_Margin).toInt();
     387    int iSpacing = data(SetData_Spacing).toInt();
     388    int iMinimumWidthHint = 0;
     389
     390    /* Take into account all the elements: */
     391    foreach (UIDetailsItem *pItem, items())
     392    {
     393        /* Skip hidden: */
     394        if (!pItem->isVisible())
     395            continue;
     396
     397        /* For each particular element: */
     398        UIDetailsElement *pElement = pItem->toElement();
     399        switch (pElement->elementType())
     400        {
     401            case DetailsElementType_General:
     402            case DetailsElementType_System:
     403            case DetailsElementType_Display:
     404            case DetailsElementType_Storage:
     405            case DetailsElementType_Audio:
     406            case DetailsElementType_Network:
     407            case DetailsElementType_Serial:
     408            case DetailsElementType_USB:
     409            case DetailsElementType_SF:
     410            case DetailsElementType_UI:
     411            case DetailsElementType_Description:
     412            {
     413                iMinimumWidthHint = qMax(iMinimumWidthHint, pItem->minimumWidthHint());
     414                break;
     415            }
     416            case DetailsElementType_Preview:
     417            {
     418                UIDetailsItem *pGeneralItem = element(DetailsElementType_General);
     419                UIDetailsItem *pSystemItem = element(DetailsElementType_System);
     420                int iGeneralElementWidth = pGeneralItem ? pGeneralItem->minimumWidthHint() : 0;
     421                int iSystemElementWidth = pSystemItem ? pSystemItem->minimumWidthHint() : 0;
     422                int iFirstColumnWidth = qMax(iGeneralElementWidth, iSystemElementWidth);
     423                iMinimumWidthHint = qMax(iMinimumWidthHint, iFirstColumnWidth + iSpacing + pItem->minimumWidthHint());
     424                break;
     425            }
     426            case DetailsElementType_Invalid: AssertFailed(); break; /* Shut up, MSC! */
     427        }
     428    }
     429
     430    /* And two margins finally: */
     431    iMinimumWidthHint += 2 * iMargin;
     432
     433    /* Return result: */
     434    return iMinimumWidthHint;
     435}
     436
     437int UIDetailsSet::minimumHeightHint() const
     438{
     439    /* Zero if has no details: */
     440    if (!hasDetails())
     441        return 0;
     442
     443    /* Prepare variables: */
     444    int iMargin = data(SetData_Margin).toInt();
     445    int iSpacing = data(SetData_Spacing).toInt();
     446    int iMinimumHeightHint = 0;
     447
     448    /* Take into account all the elements: */
     449    foreach (UIDetailsItem *pItem, items())
     450    {
     451        /* Skip hidden: */
     452        if (!pItem->isVisible())
     453            continue;
     454
     455        /* For each particular element: */
     456        UIDetailsElement *pElement = pItem->toElement();
     457        switch (pElement->elementType())
     458        {
     459            case DetailsElementType_General:
     460            case DetailsElementType_System:
     461            case DetailsElementType_Display:
     462            case DetailsElementType_Storage:
     463            case DetailsElementType_Audio:
     464            case DetailsElementType_Network:
     465            case DetailsElementType_Serial:
     466            case DetailsElementType_USB:
     467            case DetailsElementType_SF:
     468            case DetailsElementType_UI:
     469            case DetailsElementType_Description:
     470            {
     471                iMinimumHeightHint += (pItem->minimumHeightHint() + iSpacing);
     472                break;
     473            }
     474            case DetailsElementType_Preview:
     475            {
     476                iMinimumHeightHint = qMax(iMinimumHeightHint, pItem->minimumHeightHint() + iSpacing);
     477                break;
     478            }
     479            case DetailsElementType_Invalid: AssertFailed(); break; /* Shut up, MSC! */
     480        }
     481    }
     482
     483    /* Minus last spacing: */
     484    iMinimumHeightHint -= iSpacing;
     485
     486    /* And two margins finally: */
     487    iMinimumHeightHint += 2 * iMargin;
     488
     489    /* Return result: */
     490    return iMinimumHeightHint;
     491}
     492
     493void UIDetailsSet::sltMachineStateChange(QString strId)
     494{
     495    /* Is this our VM changed? */
     496    if (m_machine.GetId() != strId)
     497        return;
     498
     499    /* Update appearance: */
     500    rebuildSet();
     501}
     502
     503void UIDetailsSet::sltMachineAttributesChange(QString strId)
     504{
     505    /* Is this our VM changed? */
     506    if (m_machine.GetId() != strId)
     507        return;
     508
     509    /* Update appearance: */
     510    rebuildSet();
     511}
     512
     513void UIDetailsSet::sltUpdateAppearance()
     514{
     515    /* Update appearance: */
     516    rebuildSet();
     517}
     518
     519void UIDetailsSet::prepareSet()
     520{
     521    /* Setup size-policy: */
     522    setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
     523}
     524
     525void UIDetailsSet::prepareConnections()
     526{
     527    /* Global-events connections: */
     528    connect(gVBoxEvents, SIGNAL(sigMachineStateChange(QString, KMachineState)), this, SLOT(sltMachineStateChange(QString)));
     529    connect(gVBoxEvents, SIGNAL(sigMachineDataChange(QString)), this, SLOT(sltMachineAttributesChange(QString)));
     530    connect(gVBoxEvents, SIGNAL(sigSessionStateChange(QString, KSessionState)), this, SLOT(sltMachineAttributesChange(QString)));
     531    connect(gVBoxEvents, SIGNAL(sigSnapshotTake(QString, QString)), this, SLOT(sltMachineAttributesChange(QString)));
     532    connect(gVBoxEvents, SIGNAL(sigSnapshotDelete(QString, QString)), this, SLOT(sltMachineAttributesChange(QString)));
     533    connect(gVBoxEvents, SIGNAL(sigSnapshotChange(QString, QString)), this, SLOT(sltMachineAttributesChange(QString)));
     534    connect(gVBoxEvents, SIGNAL(sigSnapshotRestore(QString, QString)), this, SLOT(sltMachineAttributesChange(QString)));
     535
     536    /* Meidum-enumeration connections: */
     537    connect(&vboxGlobal(), SIGNAL(sigMediumEnumerationStarted()), this, SLOT(sltUpdateAppearance()));
     538    connect(&vboxGlobal(), SIGNAL(sigMediumEnumerationFinished()), this, SLOT(sltUpdateAppearance()));
     539}
     540
     541QVariant UIDetailsSet::data(int iKey) const
     542{
     543    /* Provide other members with required data: */
     544    switch (iKey)
     545    {
     546        /* Layout hints: */
     547        case SetData_Margin: return 0;
     548        case SetData_Spacing: return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 5;
     549        /* Default: */
     550        default: break;
     551    }
     552    return QVariant();
     553}
     554
    555555void UIDetailsSet::rebuildSet()
    556556{
     
    573573}
    574574
    575 UIDetailsElement* UIDetailsSet::createElement(DetailsElementType elementType, bool fOpen)
     575UIDetailsElement *UIDetailsSet::createElement(DetailsElementType enmElementType, bool fOpen)
    576576{
    577577    /* Element factory: */
    578     switch (elementType)
     578    switch (enmElementType)
    579579    {
    580580        case DetailsElementType_General:     return new UIDetailsElementGeneral(this, fOpen);
     
    594594    return 0;
    595595}
    596 
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/details/UIDetailsSet.h

    r73424 r74044  
    55
    66/*
    7  * Copyright (C) 2012-2017 Oracle Corporation
     7 * Copyright (C) 2012-2018 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    1616 */
    1717
    18 #ifndef __UIDetailsSet_h__
    19 #define __UIDetailsSet_h__
     18#ifndef ___UIDetailsSet_h___
     19#define ___UIDetailsSet_h___
    2020
    2121/* GUI includes: */
     
    3434using namespace UISettingsDefs;
    3535
    36 /* Details set
    37  * for graphics details model/view architecture: */
     36/** UIDetailsItem extension implementing group item. */
    3837class UIDetailsSet : public UIDetailsItem
    3938{
     
    4241public:
    4342
    44     /* Graphics-item type: */
     43    /** RTTI item type. */
    4544    enum { Type = UIDetailsItemType_Set };
    46     int type() const { return Type; }
    4745
    48     /* Constructor/destructor: */
     46    /** Constructs set item, passing pParent to the base-class. */
    4947    UIDetailsSet(UIDetailsItem *pParent);
    50     ~UIDetailsSet();
     48    /** Destructs set item. */
     49    virtual ~UIDetailsSet() /* override */;
    5150
    52     /* API: Build stuff: */
    53     void buildSet(UIVirtualMachineItem *pMachineItem, bool fFullSet, const QMap<DetailsElementType, bool> &settings);
     51    /** @name Item stuff.
     52      * @{ */
     53        /** Builds set based on passed @a pMachineItem.
     54          * @param  fFullSet  Brigns whether full set should be built.
     55          * @param  settings  Brings details related settings. */
     56        void buildSet(UIVirtualMachineItem *pMachineItem, bool fFullSet, const QMap<DetailsElementType, bool> &settings);
    5457
    55     /* API: Machine stuff: */
    56     const CMachine& machine() const { return m_machine; }
    57     bool hasDetails() const { return m_fHasDetails; }
     58        /** Returns cached machine. */
     59        const CMachine &machine() const { return m_machine; }
     60        /** Returns whether set has cached details. */
     61        bool hasDetails() const { return m_fHasDetails; }
     62        /** Returns configuration access level. */
     63        ConfigurationAccessLevel configurationAccessLevel() const { return m_configurationAccessLevel; }
     64    /** @} */
    5865
    59     /** Returns configuration access level. */
    60     ConfigurationAccessLevel configurationAccessLevel() const { return m_configurationAccessLevel; }
     66protected slots:
     67
     68    /** @name Item stuff.
     69      * @{ */
     70        /** Handles request about starting step build.
     71          * @param  strStepId    Brings the step ID.
     72          * @param  iStepNumber  Brings the step number. */
     73    /** @} */
     74    virtual void sltBuildStep(QString strStepId, int iStepNumber) /* override */;
     75
     76protected:
     77
     78    /** @name Item stuff.
     79      * @{ */
     80        /** Returns RTTI item type. */
     81        virtual int type() const /* override */ { return Type; }
     82
     83        /** Returns the description of the item. */
     84        virtual QString description() const /* override */;
     85    /** @} */
     86
     87    /** @name Children stuff.
     88      * @{ */
     89        /** Adds child @a pItem. */
     90        void addItem(UIDetailsItem *pItem);
     91        /** Removes child @a pItem. */
     92        void removeItem(UIDetailsItem *pItem);
     93
     94        /** Returns children items of certain @a enmType. */
     95        QList<UIDetailsItem*> items(UIDetailsItemType type = UIDetailsItemType_Element) const;
     96        /** Returns whether there are children items of certain @a enmType. */
     97        bool hasItems(UIDetailsItemType type = UIDetailsItemType_Element) const;
     98        /** Clears children items of certain @a enmType. */
     99        void clearItems(UIDetailsItemType type = UIDetailsItemType_Element);
     100
     101        /** Returns details element of certain @a enmElementType. */
     102        UIDetailsElement *element(DetailsElementType enmElementType) const;
     103    /** @} */
     104
     105    /** @name Layout stuff.
     106      * @{ */
     107        /** Updates layout. */
     108        void updateLayout();
     109
     110        /** Returns minimum width-hint. */
     111        int minimumWidthHint() const;
     112        /** Returns minimum height-hint. */
     113        int minimumHeightHint() const;
     114    /** @} */
    61115
    62116private slots:
    63117
    64     /* Handler: Build stuff: */
    65     void sltBuildStep(QString strStepId, int iStepNumber);
     118    /** @name Event-handling stuff.
     119      * @{ */
     120        /** Handles machine-state change for item with @a strId. */
     121        void sltMachineStateChange(QString strId);
     122        /** Handles machine-attribute change for item with @a strId. */
     123        void sltMachineAttributesChange(QString strId);
     124    /** @} */
    66125
    67     /* Handlers: Global event stuff: */
    68     void sltMachineStateChange(QString strId);
    69     void sltMachineAttributesChange(QString strId);
    70 
    71     /* Handler: Update stuff: */
    72     void sltUpdateAppearance();
     126    /** @name Item stuff.
     127      * @{ */
     128        /** Updates item appearance. */
     129        void sltUpdateAppearance();
     130    /** @} */
    73131
    74132private:
    75133
    76     /* Data enumerator: */
     134    /** Data field types. */
    77135    enum SetItemData
    78136    {
     
    82140    };
    83141
    84     /** Returns the description of the item. */
    85     virtual QString description() const /* override */;
     142    /** @name Prepare/cleanup cascade.
     143      * @{ */
     144        /** Prepares set. */
     145        void prepareSet();
     146        /** Prepares connections. */
     147        void prepareConnections();
     148    /** @} */
    86149
    87     /* Data provider: */
    88     QVariant data(int iKey) const;
     150    /** @name Item stuff.
     151      * @{ */
     152        /** Returns abstractly stored data value for certain @a iKey. */
     153        QVariant data(int iKey) const;
    89154
    90     /* Hidden API: Children stuff: */
    91     void addItem(UIDetailsItem *pItem);
    92     void removeItem(UIDetailsItem *pItem);
    93     QList<UIDetailsItem*> items(UIDetailsItemType type = UIDetailsItemType_Element) const;
    94     bool hasItems(UIDetailsItemType type = UIDetailsItemType_Element) const;
    95     void clearItems(UIDetailsItemType type = UIDetailsItemType_Element);
    96     UIDetailsElement* element(DetailsElementType elementType) const;
     155        /** Rebuilds set based on cached machine item. */
     156        void rebuildSet();
    97157
    98     /* Helpers: Prepare stuff: */
    99     void prepareSet();
    100     void prepareConnections();
     158        /** Creates element of specified @a enmElementType in @a fOpen state. */
     159        UIDetailsElement *createElement(DetailsElementType enmElementType, bool fOpen);
     160    /** @} */
    101161
    102     /* Helpers: Layout stuff: */
    103     int minimumWidthHint() const;
    104     int minimumHeightHint() const;
    105     void updateLayout();
     162    /** @name Item stuff.
     163      * @{ */
     164        /** Holds the machine-item this set is built for. */
     165        UIVirtualMachineItem           *m_pMachineItem;
     166        /** Holds whether whether full set should be built. */
     167        bool                            m_fFullSet;
     168        /** Holds the details related settings. */
     169        QMap<DetailsElementType, bool>  m_settings;
    106170
    107     /* Helpers: Build stuff: */
    108     void rebuildSet();
    109     UIDetailsElement* createElement(DetailsElementType elementType, bool fOpen);
     171        /** Holds the machine reference. */
     172        CMachine                  m_machine;
     173        /** Holds whether set has details. */
     174        bool                      m_fHasDetails;
     175        /** Holds configuration access level. */
     176        ConfigurationAccessLevel  m_configurationAccessLevel;
    110177
    111     /** Machine-item this set built for. */
    112     UIVirtualMachineItem *m_pMachineItem;
     178        /** Holds the build step instance. */
     179        UIPrepareStep *m_pBuildStep;
     180        /** Holds the last step number. */
     181        int            m_iLastStepNumber;
     182        /** Holds the generated set ID. */
     183        QString        m_strSetId;
     184    /** @} */
    113185
    114     /* Main variables: */
    115     CMachine m_machine;
    116     QMap<int, UIDetailsItem*> m_elements;
    117     bool m_fHasDetails;
    118 
    119     /** Holds configuration access level. */
    120     ConfigurationAccessLevel m_configurationAccessLevel;
    121 
    122     /* Prepare variables: */
    123     bool m_fFullSet;
    124     UIPrepareStep *m_pBuildStep;
    125     int m_iLastStepNumber;
    126     QString m_strSetId;
    127     QMap<DetailsElementType, bool> m_settings;
     186    /** @name Children stuff.
     187      * @{ */
     188        /** Holds the map of generated detail elements. */
     189        QMap<int, UIDetailsItem*>  m_elements;
     190    /** @} */
    128191};
    129192
    130 #endif /* __UIDetailsSet_h__ */
    131 
     193#endif /* !___UIDetailsSet_h___ */
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