VirtualBox

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


Ignore:
Timestamp:
Oct 30, 2012 1:03:49 PM (12 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
81712
Message:

FE/Qt: VM group UI: Group-item code cleanup (part 2).

Location:
trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItemGroup.cpp

    r43776 r43777  
    4040
    4141UIGChooserItemGroup::UIGChooserItemGroup(QGraphicsScene *pScene)
    42     : UIGChooserItem(0, false)
     42    : UIGChooserItem(0, false /* temporary? */)
    4343    , m_fClosed(false)
    44     , m_pToggleButton(0)
    45     , m_pEnterButton(0)
    46     , m_pExitButton(0)
    47     , m_pNameEditorWidget(0)
    48     , m_pNameEditor(0)
    49     , m_iAdditionalHeight(0)
    50     , m_iCornerRadius(10)
    5144    , m_fMainRoot(true)
    52     , m_iBlackoutDarkness(110)
    5345{
    5446    /* Prepare: */
     
    6658                                         UIGChooserItemGroup *pCopyFrom,
    6759                                         bool fMainRoot)
    68     : UIGChooserItem(0, true)
     60    : UIGChooserItem(0, true /* temporary? */)
    6961    , m_strName(pCopyFrom->name())
    7062    , m_fClosed(pCopyFrom->closed())
    71     , m_pToggleButton(0)
    72     , m_pEnterButton(0)
    73     , m_pExitButton(0)
    74     , m_pNameEditorWidget(0)
    75     , m_pNameEditor(0)
    76     , m_iAdditionalHeight(0)
    77     , m_iCornerRadius(10)
    7863    , m_fMainRoot(fMainRoot)
    79     , m_iBlackoutDarkness(110)
    8064{
    8165    /* Prepare: */
     
    10084    , m_strName(strName)
    10185    , m_fClosed(!fOpened)
    102     , m_pToggleButton(0)
    103     , m_pEnterButton(0)
    104     , m_pExitButton(0)
    105     , m_pNameEditorWidget(0)
    106     , m_pNameEditor(0)
    107     , m_iAdditionalHeight(0)
    108     , m_iCornerRadius(10)
    10986    , m_fMainRoot(false)
    110     , m_iBlackoutDarkness(110)
    11187{
    11288    /* Prepare: */
     
    130106    , m_strName(pCopyFrom->name())
    131107    , m_fClosed(pCopyFrom->closed())
    132     , m_pToggleButton(0)
    133     , m_pEnterButton(0)
    134     , m_pExitButton(0)
    135     , m_pNameEditorWidget(0)
    136     , m_pNameEditor(0)
    137     , m_iAdditionalHeight(0)
    138     , m_iCornerRadius(10)
    139108    , m_fMainRoot(false)
    140     , m_iBlackoutDarkness(110)
    141109{
    142110    /* Prepare: */
     
    168136        model()->setFocusItem(0);
    169137    }
    170     /* If that item is selected: */
     138    /* If that item is in selection list: */
    171139    if (model()->currentItems().contains(this))
    172140    {
     
    174142        model()->removeFromCurrentItems(this);
    175143    }
    176     /* Remove item from the navigation list: */
    177     model()->removeFromNavigationList(this);
     144    /* If that item is in navigation list: */
     145    if (model()->navigationList().contains(this))
     146    {
     147        /* Remove item from the navigation list: */
     148        model()->removeFromNavigationList(this);
     149    }
    178150
    179151    /* Remove item from the parent: */
     
    232204}
    233205
    234 bool UIGChooserItemGroup::contains(const QString &strId, bool fRecursively /* = false */) const
     206bool UIGChooserItemGroup::contains(const QString &strId) const
    235207{
    236208    /* Check machine items: */
     
    238210        if (pItem->toMachineItem()->id() == strId)
    239211            return true;
    240     /* If recursively => check group items: */
    241     if (fRecursively)
    242         foreach (UIGChooserItem *pItem, m_groupItems)
    243             if (pItem->toGroupItem()->contains(strId, fRecursively))
    244                 return true;
    245212    return false;
    246213}
     
    520487void UIGChooserItemGroup::prepare()
    521488{
     489    /* Buttons: */
     490    m_pToggleButton = 0;
     491    m_pEnterButton = 0;
     492    m_pExitButton = 0;
     493    /* Name editor: */
     494    m_pNameEditorWidget = 0;
     495    m_pNameEditor = 0;
     496    /* Painting stuff: */
     497    m_iAdditionalHeight = 0;
     498    m_iCornerRadius = 10;
     499    m_iBlackoutDarkness = 110;
     500
    522501    /* Non root item only: */
    523502    if (!isRoot())
  • trunk/src/VBox/Frontends/VirtualBox/src/selector/graphics/chooser/UIGChooserItemGroup.h

    r43776 r43777  
    5656    int type() const { return Type; }
    5757
    58     /* Constructor/destructor: */
     58    /* Constructor (main-root-item): */
    5959    UIGChooserItemGroup(QGraphicsScene *pScene);
    60     UIGChooserItemGroup(QGraphicsScene *pScene, UIGChooserItemGroup *pCopyFrom,
    61                         bool fMainRoot);
    62     UIGChooserItemGroup(UIGChooserItem *pParent, const QString &strName,
    63                         bool fOpened = false, int iPosition  = -1);
    64     UIGChooserItemGroup(UIGChooserItem *pParent, UIGChooserItemGroup *pCopyFrom,
    65                         int iPosition = -1);
     60    /* Constructor (temporary main-root-item/root-item copy): */
     61    UIGChooserItemGroup(QGraphicsScene *pScene, UIGChooserItemGroup *pCopyFrom, bool fMainRoot);
     62    /* Constructor (new non-root-item): */
     63    UIGChooserItemGroup(UIGChooserItem *pParent, const QString &strName, bool fOpened = false, int iPosition  = -1);
     64    /* Constructor (new non-root-item copy): */
     65    UIGChooserItemGroup(UIGChooserItem *pParent, UIGChooserItemGroup *pCopyFrom, int iPosition = -1);
     66    /* Destructor: */
    6667    ~UIGChooserItemGroup();
    6768
     
    7778
    7879    /* API: Children stuff: */
    79     bool contains(const QString &strId, bool fRecursively = false) const;
     80    bool contains(const QString &strId) const;
    8081    bool isContainsLockedMachine();
    8182
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