VirtualBox

Changeset 77596 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Mar 7, 2019 1:24:43 PM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9241: VirtualBox Manager UI: Refactoring for Chooser pane (code reordering).

Location:
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItem.cpp

    r77567 r77596  
    289289}
    290290
     291UIChooserItemGroup *UIChooserItem::toGroupItem()
     292{
     293    UIChooserItemGroup *pItem = qgraphicsitem_cast<UIChooserItemGroup*>(this);
     294    AssertMsg(pItem, ("Trying to cast invalid item type to UIChooserItemGroup!"));
     295    return pItem;
     296}
     297
     298UIChooserItemGlobal *UIChooserItem::toGlobalItem()
     299{
     300    UIChooserItemGlobal *pItem = qgraphicsitem_cast<UIChooserItemGlobal*>(this);
     301    AssertMsg(pItem, ("Trying to cast invalid item type to UIChooserItemGlobal!"));
     302    return pItem;
     303}
     304
     305UIChooserItemMachine *UIChooserItem::toMachineItem()
     306{
     307    UIChooserItemMachine *pItem = qgraphicsitem_cast<UIChooserItemMachine*>(this);
     308    AssertMsg(pItem, ("Trying to cast invalid item type to UIChooserItemMachine!"));
     309    return pItem;
     310}
     311
     312UIChooserModel *UIChooserItem::model() const
     313{
     314    UIChooserModel *pModel = qobject_cast<UIChooserModel*>(QIGraphicsWidget::scene()->parent());
     315    AssertMsg(pModel, ("Incorrect graphics scene parent set!"));
     316    return pModel;
     317}
     318
     319UIActionPool *UIChooserItem::actionPool() const
     320{
     321    return model()->actionPool();
     322}
     323
    291324void UIChooserItem::setFavorite(bool fFavorite)
    292325{
     
    294327    if (m_pParent)
    295328        m_pParent->toGroupItem()->updateFavorites();
    296 }
    297 
    298 UIChooserItemGroup *UIChooserItem::toGroupItem()
    299 {
    300     UIChooserItemGroup *pItem = qgraphicsitem_cast<UIChooserItemGroup*>(this);
    301     AssertMsg(pItem, ("Trying to cast invalid item type to UIChooserItemGroup!"));
    302     return pItem;
    303 }
    304 
    305 UIChooserItemGlobal *UIChooserItem::toGlobalItem()
    306 {
    307     UIChooserItemGlobal *pItem = qgraphicsitem_cast<UIChooserItemGlobal*>(this);
    308     AssertMsg(pItem, ("Trying to cast invalid item type to UIChooserItemGlobal!"));
    309     return pItem;
    310 }
    311 
    312 UIChooserItemMachine *UIChooserItem::toMachineItem()
    313 {
    314     UIChooserItemMachine *pItem = qgraphicsitem_cast<UIChooserItemMachine*>(this);
    315     AssertMsg(pItem, ("Trying to cast invalid item type to UIChooserItemMachine!"));
    316     return pItem;
    317 }
    318 
    319 UIChooserModel *UIChooserItem::model() const
    320 {
    321     UIChooserModel *pModel = qobject_cast<UIChooserModel*>(QIGraphicsWidget::scene()->parent());
    322     AssertMsg(pModel, ("Incorrect graphics scene parent set!"));
    323     return pModel;
    324 }
    325 
    326 UIActionPool *UIChooserItem::actionPool() const
    327 {
    328     return model()->actionPool();
    329329}
    330330
     
    349349{
    350350    m_iLevel = iLevel;
     351}
     352
     353bool UIChooserItem::isHovered() const
     354{
     355    return m_fHovered;
    351356}
    352357
     
    360365}
    361366
    362 bool UIChooserItem::isHovered() const
    363 {
    364     return m_fHovered;
    365 }
    366 
    367367void UIChooserItem::updateGeometry()
    368368{
     
    405405}
    406406
     407UIChooserItemDragToken UIChooserItem::dragTokenPlace() const
     408{
     409    return m_enmDragTokenPlace;
     410}
     411
    407412void UIChooserItem::setDragTokenPlace(UIChooserItemDragToken enmPlace)
    408413{
     
    413418        update();
    414419    }
    415 }
    416 
    417 UIChooserItemDragToken UIChooserItem::dragTokenPlace() const
    418 {
    419     return m_enmDragTokenPlace;
    420420}
    421421
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItem.h

    r77567 r77596  
    8383    /** @name Item stuff.
    8484      * @{ */
    85         /** Returns parent  reference. */
     85        /** Returns parent reference. */
    8686        UIChooserItem *parentItem() const {  return m_pParent; }
    87         /** Returns whether item is favorite. */
    88         bool isFavorite() const { return m_fFavorite; }
    89 
    90         /** Defines whether item is @a fFavorite. */
    91         virtual void setFavorite(bool fFavorite);
    92 
    93         /** Returns whether item is root. */
    94         bool isRoot() const { return !m_pParent; }
    9587
    9688        /** Casts item to group one. */
     
    10698        UIActionPool *actionPool() const;
    10799
     100        /** Returns whether item is root. */
     101        bool isRoot() const { return !m_pParent; }
     102
     103        /** Returns item name. */
     104        virtual QString name() const = 0;
     105        /** Returns item full-name. */
     106        virtual QString fullName() const = 0;
     107        /** Returns item description. */
     108        virtual QString description() const = 0;
     109        /** Returns item definition. */
     110        virtual QString definition() const = 0;
     111
     112        /** Returns whether item is favorite. */
     113        bool isFavorite() const { return m_fFavorite; }
     114        /** Defines whether item is @a fFavorite. */
     115        virtual void setFavorite(bool fFavorite);
     116
    108117        /** Returns a level of item. */
    109118        int level() const;
     
    111120        void setLevel(int iLevel);
    112121
     122        /** Returns whether item is hovered. */
     123        bool isHovered() const;
     124        /** Defines whether item is @a fHovered. */
     125        void setHovered(bool fHovered);
     126
    113127        /** Starts item editing. */
    114128        virtual void startEditing() = 0;
     
    116130        /** Updates item tool-tip. */
    117131        virtual void updateToolTip() = 0;
    118 
    119         /** Returns item name. */
    120         virtual QString name() const = 0;
    121         /** Returns item description. */
    122         virtual QString description() const = 0;
    123         /** Returns item full-name. */
    124         virtual QString fullName() const = 0;
    125         /** Returns item definition. */
    126         virtual QString definition() const = 0;
    127 
    128         /** Defines whether item is @a fHovered. */
    129         void setHovered(bool fHovered);
    130         /** Returns whether item is hovered. */
    131         bool isHovered() const;
    132132
    133133        /** Installs event-filter for @a pSource object.
     
    138138    /** @name Children stuff.
    139139      * @{ */
     140        /** Returns whether there are children items of certain @a enmType. */
     141        virtual bool hasItems(UIChooserItemType enmType = UIChooserItemType_Any) const = 0;
     142        /** Returns children items of certain @a enmType. */
     143        virtual QList<UIChooserItem*> items(UIChooserItemType enmType = UIChooserItemType_Any) const = 0;
     144
     145        /** Replaces children @a items of certain @a enmType. */
     146        virtual void setItems(const QList<UIChooserItem*> &items, UIChooserItemType enmType) = 0;
     147        /** Clears children items of certain @a enmType. */
     148        virtual void clearItems(UIChooserItemType enmType = UIChooserItemType_Any) = 0;
     149
    140150        /** Adds possible @a fFavorite child @a pItem to certain @a iPosition. */
    141151        virtual void addItem(UIChooserItem *pItem, bool fFavorite, int iPosition) = 0;
    142152        /** Removes child @a pItem. */
    143153        virtual void removeItem(UIChooserItem *pItem) = 0;
    144 
    145         /** Replaces children @a items of certain @a enmType. */
    146         virtual void setItems(const QList<UIChooserItem*> &items, UIChooserItemType enmType) = 0;
    147         /** Returns children items of certain @a enmType. */
    148         virtual QList<UIChooserItem*> items(UIChooserItemType enmType = UIChooserItemType_Any) const = 0;
    149         /** Returns whether there are children items of certain @a enmType. */
    150         virtual bool hasItems(UIChooserItemType enmType = UIChooserItemType_Any) const = 0;
    151         /** Clears children items of certain @a enmType. */
    152         virtual void clearItems(UIChooserItemType enmType = UIChooserItemType_Any) = 0;
    153154
    154155        /** Updates all children items with specified @a uId. */
     
    203204        virtual void resetDragToken() = 0;
    204205
     206        /** Returns drag token place. */
     207        UIChooserItemDragToken dragTokenPlace() const;
    205208        /** Defines drag token @a enmPlace. */
    206209        void setDragTokenPlace(UIChooserItemDragToken enmPlace);
    207         /** Returns drag token place. */
    208         UIChooserItemDragToken dragTokenPlace() const;
    209210    /** @} */
    210211
     
    233234    /** @name Item stuff.
    234235      * @{ */
     236        /** Returns item's default animation value. */
     237        int defaultValue() const { return m_iDefaultValue; }
    235238        /** Defines item's default animation @a iValue. */
    236239        void setDefaultValue(int iValue) { m_iDefaultValue = iValue; update(); }
    237         /** Returns item's default animation value. */
    238         int defaultValue() const { return m_iDefaultValue; }
    239 
     240
     241        /** Returns item's hovered animation value. */
     242        int hoveredValue() const { return m_iHoveredValue; }
    240243        /** Defines item's hovered animation @a iValue. */
    241244        void setHoveredValue(int iValue) { m_iHoveredValue = iValue; update(); }
    242         /** Returns item's hovered animation value. */
    243         int hoveredValue() const { return m_iHoveredValue; }
    244 
     245
     246        /** Returns item's animated value. */
     247        int animatedValue() const { return m_iAnimatedValue; }
    245248        /** Defines item's animated @a iValue. */
    246249        void setAnimatedValue(int iValue) { m_iAnimatedValue = iValue; update(); }
    247         /** Returns item's animated value. */
    248         int animatedValue() const { return m_iAnimatedValue; }
    249250    /** @} */
    250251
    251252    /** @name Layout stuff.
    252253      * @{ */
     254        /** Returns previous geometry. */
     255        const QRectF &previousGeometry() const { return m_previousGeometry; }
    253256        /** Defines previous @a geometry. */
    254257        void setPreviousGeometry(const QRectF &geometry) { m_previousGeometry = geometry; }
    255         /** Returns previous geometry. */
    256         const QRectF &previousGeometry() const { return m_previousGeometry; }
    257258
    258259        /** Returns @a strText size calculated on the basis of certain @a font and @a pPaintDevice. */
     
    303304
    304305        /** Holds the item level according to root. */
    305         int   m_iLevel;
     306        int  m_iLevel;
    306307
    307308        /** Holds whether item is hovered. */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGlobal.cpp

    r77567 r77596  
    7474{
    7575    cleanup();
    76 }
    77 
    78 void UIChooserItemGlobal::setFavorite(bool fFavorite)
    79 {
    80     /* Call to base-class: */
    81     UIChooserItem::setFavorite(fFavorite);
    82 
    83     /* Update pin-pixmap: */
    84     updatePinPixmap();
    8576}
    8677
     
    124115}
    125116
     117int UIChooserItemGlobal::heightHint() const
     118{
     119    return m_iHeightHint;
     120}
     121
    126122void UIChooserItemGlobal::setHeightHint(int iHint)
    127123{
     
    132128    updateGeometry();
    133129    model()->updateLayout();
    134 }
    135 
    136 int UIChooserItemGlobal::heightHint() const
    137 {
    138     return m_iHeightHint;
    139130}
    140131
     
    199190}
    200191
     192QString UIChooserItemGlobal::name() const
     193{
     194    return m_strName;
     195}
     196
     197QString UIChooserItemGlobal::fullName() const
     198{
     199    return m_strName;
     200}
     201
     202QString UIChooserItemGlobal::description() const
     203{
     204    return m_strDescription;
     205}
     206
     207QString UIChooserItemGlobal::definition() const
     208{
     209    return QString("n=%1").arg("GLOBAL");
     210}
     211
     212void UIChooserItemGlobal::setFavorite(bool fFavorite)
     213{
     214    /* Call to base-class: */
     215    UIChooserItem::setFavorite(fFavorite);
     216
     217    /* Update pin-pixmap: */
     218    updatePinPixmap();
     219}
     220
    201221void UIChooserItemGlobal::startEditing()
    202222{
     
    209229}
    210230
    211 QString UIChooserItemGlobal::name() const
    212 {
    213     return m_strName;
    214 }
    215 
    216 QString UIChooserItemGlobal::description() const
    217 {
    218     return m_strDescription;
    219 }
    220 
    221 QString UIChooserItemGlobal::fullName() const
    222 {
    223     return m_strName;
    224 }
    225 
    226 QString UIChooserItemGlobal::definition() const
    227 {
    228     return QString("n=%1").arg("GLOBAL");
     231bool UIChooserItemGlobal::hasItems(UIChooserItemType) const
     232{
     233    AssertMsgFailedReturn(("Global graphics item do NOT support children!"), false);
     234}
     235
     236QList<UIChooserItem*> UIChooserItemGlobal::items(UIChooserItemType) const
     237{
     238    AssertMsgFailedReturn(("Global graphics item do NOT support children!"), QList<UIChooserItem*>());
     239}
     240
     241void UIChooserItemGlobal::setItems(const QList<UIChooserItem*> &, UIChooserItemType)
     242{
     243    AssertMsgFailed(("Global graphics item do NOT support children!"));
     244}
     245
     246void UIChooserItemGlobal::clearItems(UIChooserItemType)
     247{
     248    AssertMsgFailed(("Global graphics item do NOT support children!"));
    229249}
    230250
     
    235255
    236256void UIChooserItemGlobal::removeItem(UIChooserItem *)
    237 {
    238     AssertMsgFailed(("Global graphics item do NOT support children!"));
    239 }
    240 
    241 void UIChooserItemGlobal::setItems(const QList<UIChooserItem*> &, UIChooserItemType)
    242 {
    243     AssertMsgFailed(("Global graphics item do NOT support children!"));
    244 }
    245 
    246 QList<UIChooserItem*> UIChooserItemGlobal::items(UIChooserItemType) const
    247 {
    248     AssertMsgFailedReturn(("Global graphics item do NOT support children!"), QList<UIChooserItem*>());
    249 }
    250 
    251 bool UIChooserItemGlobal::hasItems(UIChooserItemType) const
    252 {
    253     AssertMsgFailedReturn(("Global graphics item do NOT support children!"), false);
    254 }
    255 
    256 void UIChooserItemGlobal::clearItems(UIChooserItemType)
    257257{
    258258    AssertMsgFailed(("Global graphics item do NOT support children!"));
     
    298298{
    299299    // Just do nothing ..
    300 }
    301 
    302 QSizeF UIChooserItemGlobal::sizeHint(Qt::SizeHint which, const QSizeF &constraint /* = QSizeF() */) const
    303 {
    304     /* If Qt::MinimumSize requested: */
    305     if (which == Qt::MinimumSize)
    306         return QSizeF(minimumWidthHint(), minimumHeightHint());
    307     /* Else call to base-class: */
    308     return UIChooserItem::sizeHint(which, constraint);
    309300}
    310301
     
    363354    /* Return result: */
    364355    return iProposedHeight;
     356}
     357
     358QSizeF UIChooserItemGlobal::sizeHint(Qt::SizeHint which, const QSizeF &constraint /* = QSizeF() */) const
     359{
     360    /* If Qt::MinimumSize requested: */
     361    if (which == Qt::MinimumSize)
     362        return QSizeF(minimumWidthHint(), minimumHeightHint());
     363    /* Else call to base-class: */
     364    return UIChooserItem::sizeHint(which, constraint);
    365365}
    366366
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGlobal.h

    r77567 r77596  
    3232class UIGraphicsZoomButton;
    3333
     34
    3435/** UIChooserItem extension implementing global item. */
    3536class UIChooserItemGlobal : public UIChooserItem
     
    3940public:
    4041
    41     /** RTTI item type. */
     42    /** RTTI required for qgraphicsitem_cast. */
    4243    enum { Type = UIChooserItemType_Global };
    4344
     
    5152    /** @name Item stuff.
    5253      * @{ */
    53         /** Defines whether item is @a fFavorite. */
    54         virtual void setFavorite(bool fFavorite) /* override */;
    55 
    5654        /** Returns whether passed @a position belongs to tool button area. */
    5755        bool isToolButtonArea(const QPoint &position, int iMarginMultiplier = 1) const;
     
    6260    /** @name Layout stuff.
    6361      * @{ */
     62        /** Returns height hint. */
     63        int heightHint() const;
    6464        /** Defines height @a iHint. */
    6565        void setHeightHint(int iHint);
    66         /** Returns height hint. */
    67         int heightHint() const;
    6866    /** @} */
    6967
     
    9391        virtual int type() const /* override */ { return Type; }
    9492
     93        /** Returns item name. */
     94        virtual QString name() const /* override */;
     95        /** Returns item full-name. */
     96        virtual QString fullName() const /* override */;
     97        /** Returns item description. */
     98        virtual QString description() const /* override */;
     99        /** Returns item definition. */
     100        virtual QString definition() const /* override */;
     101
     102        /** Defines whether item is @a fFavorite. */
     103        virtual void setFavorite(bool fFavorite) /* override */;
     104
    95105        /** Starts item editing. */
    96106        virtual void startEditing() /* override */;
     
    98108        /** Updates item tool-tip. */
    99109        virtual void updateToolTip() /* override */;
    100 
    101         /** Returns item name. */
    102         virtual QString name() const /* override */;
    103         /** Returns item description. */
    104         virtual QString description() const /* override */;
    105         /** Returns item full-name. */
    106         virtual QString fullName() const /* override */;
    107         /** Returns item definition. */
    108         virtual QString definition() const /* override */;
    109110    /** @} */
    110111
    111112    /** @name Children stuff.
    112113      * @{ */
     114        /** Returns whether there are children items of certain @a enmType. */
     115        virtual bool hasItems(UIChooserItemType enmType = UIChooserItemType_Any) const /* override */;
     116        /** Returns children items of certain @a enmType. */
     117        virtual QList<UIChooserItem*> items(UIChooserItemType enmType = UIChooserItemType_Any) const /* override */;
     118
     119        /** Replaces children @a items of certain @a enmType. */
     120        virtual void setItems(const QList<UIChooserItem*> &items, UIChooserItemType enmType) /* override */;
     121        /** Clears children items of certain @a enmType. */
     122        virtual void clearItems(UIChooserItemType enmType = UIChooserItemType_Any) /* override */;
     123
    113124        /** Adds possible @a fFavorite child @a pItem to certain @a iPosition. */
    114125        virtual void addItem(UIChooserItem *pItem, bool fFavorite, int iPosition) /* override */;
    115126        /** Removes child @a pItem. */
    116127        virtual void removeItem(UIChooserItem *pItem) /* override */;
    117 
    118         /** Replaces children @a items of certain @a enmType. */
    119         virtual void setItems(const QList<UIChooserItem*> &items, UIChooserItemType enmType) /* override */;
    120         /** Returns children items of certain @a enmType. */
    121         virtual QList<UIChooserItem*> items(UIChooserItemType enmType = UIChooserItemType_Any) const /* override */;
    122         /** Returns whether there are children items of certain @a enmType. */
    123         virtual bool hasItems(UIChooserItemType enmType = UIChooserItemType_Any) const /* override */;
    124         /** Clears children items of certain @a enmType. */
    125         virtual void clearItems(UIChooserItemType enmType = UIChooserItemType_Any) /* override */;
    126128
    127129        /** Updates all children items with specified @a uId. */
     
    295297};
    296298
     299
    297300#endif /* !FEQT_INCLUDED_SRC_manager_chooser_UIChooserItemGlobal_h */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGroup.cpp

    r77567 r77596  
    221221}
    222222
     223bool UIChooserItemGroup::isClosed() const
     224{
     225    return m_fClosed && !isRoot();
     226}
     227
    223228void UIChooserItemGroup::close(bool fAnimated /* = true */)
    224229{
     
    227232}
    228233
    229 bool UIChooserItemGroup::isClosed() const
    230 {
    231     return m_fClosed && !isRoot();
     234bool UIChooserItemGroup::isOpened() const
     235{
     236    return !m_fClosed || isRoot();
    232237}
    233238
     
    236241    AssertMsg(!isRoot(), ("Can't open root-item!"));
    237242    m_pToggleButton->setToggled(true, fAnimated);
    238 }
    239 
    240 bool UIChooserItemGroup::isOpened() const
    241 {
    242     return !m_fClosed || isRoot();
    243 }
    244 
    245 void UIChooserItemGroup::installEventFilterHelper(QObject *pSource)
    246 {
    247     /* The only object which need's that filter for now is scroll-area: */
    248     pSource->installEventFilter(m_pScrollArea);
    249 }
    250 
    251 /* static */
    252 QString UIChooserItemGroup::className()
    253 {
    254     return "UIChooserItemGroup";
    255 }
    256 
    257 void UIChooserItemGroup::makeSureItemIsVisible(UIChooserItem *pItem)
    258 {
    259     /* Make sure item exists: */
    260     AssertPtrReturnVoid(pItem);
    261 
    262     /* Convert child rectangle to local coordinates for this group. This also
    263      * works for a child at any sub-level, doesn't necessary of this group. */
    264     const QPointF positionInScene = pItem->mapToScene(QPointF(0, 0));
    265     const QPointF positionInGroup = mapFromScene(positionInScene);
    266     const QRectF itemRectInGroup = QRectF(positionInGroup, pItem->size());
    267     m_pScrollArea->makeSureRectIsVisible(itemRectInGroup);
    268243}
    269244
     
    291266    /* Relayout model: */
    292267    model()->updateLayout();
     268}
     269
     270/* static */
     271QString UIChooserItemGroup::className()
     272{
     273    return "UIChooserItemGroup";
    293274}
    294275
     
    388369    /* Paint header: */
    389370    paintHeader(pPainter, rectangle);
     371}
     372
     373QString UIChooserItemGroup::name() const
     374{
     375    return m_strName;
     376}
     377
     378QString UIChooserItemGroup::fullName() const
     379{
     380    /* Return "/" for root item: */
     381    if (isRoot())
     382        return "/";
     383
     384    /* Get full parent name, append with '/' if not yet appended: */
     385    AssertMsg(parentItem(), ("Incorrect parent set!"));
     386    QString strFullParentName = parentItem()->fullName();
     387    if (!strFullParentName.endsWith('/'))
     388        strFullParentName.append('/');
     389    /* Return full item name based on parent prefix: */
     390    return strFullParentName + name();
     391}
     392
     393QString UIChooserItemGroup::description() const
     394{
     395    return m_strDescription;
     396}
     397
     398QString UIChooserItemGroup::definition() const
     399{
     400    return QString("g=%1").arg(name());
    390401}
    391402
     
    475486}
    476487
    477 QString UIChooserItemGroup::name() const
    478 {
    479     return m_strName;
    480 }
    481 
    482 QString UIChooserItemGroup::description() const
    483 {
    484     return m_strDescription;
    485 }
    486 
    487 QString UIChooserItemGroup::fullName() const
    488 {
    489     /* Return "/" for root item: */
    490     if (isRoot())
    491         return "/";
    492 
    493     /* Get full parent name, append with '/' if not yet appended: */
    494     AssertMsg(parentItem(), ("Incorrect parent set!"));
    495     QString strFullParentName = parentItem()->fullName();
    496     if (!strFullParentName.endsWith('/'))
    497         strFullParentName.append('/');
    498     /* Return full item name based on parent prefix: */
    499     return strFullParentName + name();
    500 }
    501 
    502 QString UIChooserItemGroup::definition() const
    503 {
    504     return QString("g=%1").arg(name());
     488void UIChooserItemGroup::installEventFilterHelper(QObject *pSource)
     489{
     490    /* The only object which need's that filter for now is scroll-area: */
     491    pSource->installEventFilter(m_pScrollArea);
     492}
     493
     494bool UIChooserItemGroup::hasItems(UIChooserItemType type /* = UIChooserItemType_Any */) const
     495{
     496    switch (type)
     497    {
     498        case UIChooserItemType_Any:
     499            return hasItems(UIChooserItemType_Global) || hasItems(UIChooserItemType_Group) || hasItems(UIChooserItemType_Machine);
     500        case UIChooserItemType_Global:
     501            return !m_globalItems.isEmpty();
     502        case UIChooserItemType_Group:
     503            return !m_groupItems.isEmpty();
     504        case UIChooserItemType_Machine:
     505            return !m_machineItems.isEmpty();
     506    }
     507    return false;
     508}
     509
     510QList<UIChooserItem*> UIChooserItemGroup::items(UIChooserItemType type /* = UIChooserItemType_Any */) const
     511{
     512    switch (type)
     513    {
     514        case UIChooserItemType_Any: return items(UIChooserItemType_Global) + items(UIChooserItemType_Group) + items(UIChooserItemType_Machine);
     515        case UIChooserItemType_Global: return m_globalItems;
     516        case UIChooserItemType_Group: return m_groupItems;
     517        case UIChooserItemType_Machine: return m_machineItems;
     518        default: break;
     519    }
     520    return QList<UIChooserItem*>();
     521}
     522
     523void UIChooserItemGroup::setItems(const QList<UIChooserItem*> &items, UIChooserItemType type)
     524{
     525    /* Check item type: */
     526    switch (type)
     527    {
     528        case UIChooserItemType_Global: m_globalItems = items; break;
     529        case UIChooserItemType_Group: m_groupItems = items; break;
     530        case UIChooserItemType_Machine: m_machineItems = items; break;
     531        default: AssertMsgFailed(("Invalid item type!")); break;
     532    }
     533
     534    /* Update linked values: */
     535    updateLayoutSpacings();
     536    updateItemCountInfo();
     537    updateToolTip();
     538    updateGeometry();
     539}
     540
     541void UIChooserItemGroup::clearItems(UIChooserItemType type /* = UIChooserItemType_Any */)
     542{
     543    switch (type)
     544    {
     545        case UIChooserItemType_Any:
     546        {
     547            clearItems(UIChooserItemType_Global);
     548            clearItems(UIChooserItemType_Group);
     549            clearItems(UIChooserItemType_Machine);
     550            break;
     551        }
     552        case UIChooserItemType_Global:
     553        {
     554            while (!m_globalItems.isEmpty()) { delete m_globalItems.last(); }
     555            AssertMsg(m_globalItems.isEmpty(), ("Global items cleanup failed!"));
     556            break;
     557        }
     558        case UIChooserItemType_Group:
     559        {
     560            while (!m_groupItems.isEmpty()) { delete m_groupItems.last(); }
     561            AssertMsg(m_groupItems.isEmpty(), ("Group items cleanup failed!"));
     562            break;
     563        }
     564        case UIChooserItemType_Machine:
     565        {
     566            while (!m_machineItems.isEmpty()) { delete m_machineItems.last(); }
     567            AssertMsg(m_machineItems.isEmpty(), ("Machine items cleanup failed!"));
     568            break;
     569        }
     570    }
     571
     572    /* Update linked values: */
     573    updateLayoutSpacings();
     574    updateItemCountInfo();
     575    updateToolTip();
     576    updateGeometry();
    505577}
    506578
     
    612684}
    613685
    614 void UIChooserItemGroup::setItems(const QList<UIChooserItem*> &items, UIChooserItemType type)
    615 {
    616     /* Check item type: */
    617     switch (type)
    618     {
    619         case UIChooserItemType_Global: m_globalItems = items; break;
    620         case UIChooserItemType_Group: m_groupItems = items; break;
    621         case UIChooserItemType_Machine: m_machineItems = items; break;
    622         default: AssertMsgFailed(("Invalid item type!")); break;
    623     }
    624 
    625     /* Update linked values: */
    626     updateLayoutSpacings();
    627     updateItemCountInfo();
    628     updateToolTip();
    629     updateGeometry();
    630 }
    631 
    632 QList<UIChooserItem*> UIChooserItemGroup::items(UIChooserItemType type /* = UIChooserItemType_Any */) const
    633 {
    634     switch (type)
    635     {
    636         case UIChooserItemType_Any: return items(UIChooserItemType_Global) + items(UIChooserItemType_Group) + items(UIChooserItemType_Machine);
    637         case UIChooserItemType_Global: return m_globalItems;
    638         case UIChooserItemType_Group: return m_groupItems;
    639         case UIChooserItemType_Machine: return m_machineItems;
    640         default: break;
    641     }
    642     return QList<UIChooserItem*>();
    643 }
    644 
    645 bool UIChooserItemGroup::hasItems(UIChooserItemType type /* = UIChooserItemType_Any */) const
    646 {
    647     switch (type)
    648     {
    649         case UIChooserItemType_Any:
    650             return hasItems(UIChooserItemType_Global) || hasItems(UIChooserItemType_Group) || hasItems(UIChooserItemType_Machine);
    651         case UIChooserItemType_Global:
    652             return !m_globalItems.isEmpty();
    653         case UIChooserItemType_Group:
    654             return !m_groupItems.isEmpty();
    655         case UIChooserItemType_Machine:
    656             return !m_machineItems.isEmpty();
    657     }
    658     return false;
    659 }
    660 
    661 void UIChooserItemGroup::clearItems(UIChooserItemType type /* = UIChooserItemType_Any */)
    662 {
    663     switch (type)
    664     {
    665         case UIChooserItemType_Any:
    666         {
    667             clearItems(UIChooserItemType_Global);
    668             clearItems(UIChooserItemType_Group);
    669             clearItems(UIChooserItemType_Machine);
    670             break;
    671         }
    672         case UIChooserItemType_Global:
    673         {
    674             while (!m_globalItems.isEmpty()) { delete m_globalItems.last(); }
    675             AssertMsg(m_globalItems.isEmpty(), ("Global items cleanup failed!"));
    676             break;
    677         }
    678         case UIChooserItemType_Group:
    679         {
    680             while (!m_groupItems.isEmpty()) { delete m_groupItems.last(); }
    681             AssertMsg(m_groupItems.isEmpty(), ("Group items cleanup failed!"));
    682             break;
    683         }
    684         case UIChooserItemType_Machine:
    685         {
    686             while (!m_machineItems.isEmpty()) { delete m_machineItems.last(); }
    687             AssertMsg(m_machineItems.isEmpty(), ("Machine items cleanup failed!"));
    688             break;
    689         }
    690     }
    691 
    692     /* Update linked values: */
    693     updateLayoutSpacings();
    694     updateItemCountInfo();
    695     updateToolTip();
    696     updateGeometry();
    697 }
    698 
    699686void UIChooserItemGroup::updateAllItems(const QUuid &uId)
    700687{
     
    928915    /* Else call to base-class: */
    929916    return UIChooserItem::sizeHint(enmWhich, constraint);
     917}
     918
     919void UIChooserItemGroup::makeSureItemIsVisible(UIChooserItem *pItem)
     920{
     921    /* Make sure item exists: */
     922    AssertPtrReturnVoid(pItem);
     923
     924    /* Convert child rectangle to local coordinates for this group. This also
     925     * works for a child at any sub-level, doesn't necessary of this group. */
     926    const QPointF positionInScene = pItem->mapToScene(QPointF(0, 0));
     927    const QPointF positionInGroup = mapFromScene(positionInScene);
     928    const QRectF itemRectInGroup = QRectF(positionInGroup, pItem->size());
     929    m_pScrollArea->makeSureRectIsVisible(itemRectInGroup);
    930930}
    931931
     
    13501350}
    13511351
     1352QVariant UIChooserItemGroup::data(int iKey) const
     1353{
     1354    /* Provide other members with required data: */
     1355    switch (iKey)
     1356    {
     1357        /* Layout hints: */
     1358        case GroupItemData_HorizonalMargin: return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 4;
     1359        case GroupItemData_VerticalMargin:  return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 2;
     1360        case GroupItemData_HeaderSpacing:   return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 2;
     1361        case GroupItemData_ChildrenSpacing: return 1;
     1362        case GroupItemData_ParentIndent:    return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 3;
     1363
     1364        /* Default: */
     1365        default: break;
     1366    }
     1367    return QVariant();
     1368}
     1369
     1370int UIChooserItemGroup::additionalHeight() const
     1371{
     1372    return m_iAdditionalHeight;
     1373}
     1374
     1375void UIChooserItemGroup::setAdditionalHeight(int iAdditionalHeight)
     1376{
     1377    m_iAdditionalHeight = iAdditionalHeight;
     1378    updateGeometry();
     1379    model()->updateLayout();
     1380}
     1381
     1382void UIChooserItemGroup::updateAnimationParameters()
     1383{
     1384    /* Only for item with button: */
     1385    if (!m_pToggleButton)
     1386        return;
     1387
     1388    /* Recalculate animation parameters: */
     1389    QSizeF openedSize = minimumSizeHintForGroup(true);
     1390    QSizeF closedSize = minimumSizeHintForGroup(false);
     1391    int iAdditionalHeight = (int)(openedSize.height() - closedSize.height());
     1392    m_pToggleButton->setAnimationRange(0, iAdditionalHeight);
     1393}
     1394
     1395void UIChooserItemGroup::updateToggleButtonToolTip()
     1396{
     1397    /* Only for item with button: */
     1398    if (!m_pToggleButton)
     1399        return;
     1400
     1401    /* Update toggle-button tool-tip: */
     1402    m_pToggleButton->setToolTip(isOpened() ? tr("Collapse group") : tr("Expand group"));
     1403}
     1404
    13521405/* static */
    13531406void UIChooserItemGroup::copyContent(UIChooserItemGroup *pFrom, UIChooserItemGroup *pTo)
     
    13621415    foreach (UIChooserItem *pMachineItem, pFrom->items(UIChooserItemType_Machine))
    13631416        new UIChooserItemMachine(pTo, pMachineItem->toMachineItem());
    1364 }
    1365 
    1366 QVariant UIChooserItemGroup::data(int iKey) const
    1367 {
    1368     /* Provide other members with required data: */
    1369     switch (iKey)
    1370     {
    1371         /* Layout hints: */
    1372         case GroupItemData_HorizonalMargin: return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 4;
    1373         case GroupItemData_VerticalMargin:  return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 2;
    1374         case GroupItemData_HeaderSpacing:   return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 2;
    1375         case GroupItemData_ChildrenSpacing: return 1;
    1376         case GroupItemData_ParentIndent:    return QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize) / 3;
    1377 
    1378         /* Default: */
    1379         default: break;
    1380     }
    1381     return QVariant();
    1382 }
    1383 
    1384 void UIChooserItemGroup::setAdditionalHeight(int iAdditionalHeight)
    1385 {
    1386     m_iAdditionalHeight = iAdditionalHeight;
    1387     updateGeometry();
    1388     model()->updateLayout();
    1389 }
    1390 
    1391 int UIChooserItemGroup::additionalHeight() const
    1392 {
    1393     return m_iAdditionalHeight;
    1394 }
    1395 
    1396 void UIChooserItemGroup::updateAnimationParameters()
    1397 {
    1398     /* Only for item with button: */
    1399     if (!m_pToggleButton)
    1400         return;
    1401 
    1402     /* Recalculate animation parameters: */
    1403     QSizeF openedSize = minimumSizeHintForGroup(true);
    1404     QSizeF closedSize = minimumSizeHintForGroup(false);
    1405     int iAdditionalHeight = (int)(openedSize.height() - closedSize.height());
    1406     m_pToggleButton->setAnimationRange(0, iAdditionalHeight);
    1407 }
    1408 
    1409 void UIChooserItemGroup::updateToggleButtonToolTip()
    1410 {
    1411     /* Only for item with button: */
    1412     if (!m_pToggleButton)
    1413         return;
    1414 
    1415     /* Update toggle-button tool-tip: */
    1416     m_pToggleButton->setToolTip(isOpened() ? tr("Collapse group") : tr("Expand group"));
    14171417}
    14181418
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGroup.h

    r77567 r77596  
    6262public:
    6363
    64     /** RTTI item type. */
     64    /** RTTI required for qgraphicsitem_cast. */
    6565    enum { Type = UIChooserItemType_Group };
    6666
     
    7979        void setName(const QString &strName);
    8080
     81        /** Returns whether group is closed. */
     82        bool isClosed() const;
    8183        /** Closes group in @a fAnimated way if requested. */
    8284        void close(bool fAnimated = true);
    83         /** Returns whether group is closed. */
    84         bool isClosed() const;
    85 
     85
     86        /** Returns whether group is opened. */
     87        bool isOpened() const;
    8688        /** Opens group in @a fAnimated way if requested. */
    8789        void open(bool fAnimated = true);
    88         /** Returns whether group is opened. */
    89         bool isOpened() const;
    90 
    91         /** Installs event-filter for @a pSource object. */
    92         virtual void installEventFilterHelper(QObject *pSource) /* override */;
     90    /** @} */
     91
     92    /** @name Children stuff.
     93      * @{ */
     94        /** Updates positions of favorite items. */
     95        void updateFavorites();
    9396    /** @} */
    9497
     
    97100        /** Class-name used for drag&drop mime-data format. */
    98101        static QString className();
    99 
    100         /** Makes sure passed child @a pItem is visible. */
    101         virtual void makeSureItemIsVisible(UIChooserItem *pItem) /* override */;
    102     /** @} */
    103 
    104     /** @name Children stuff.
    105       * @{ */
    106         /** Updates positions of favorite items. */
    107         void updateFavorites();
    108102    /** @} */
    109103
     
    135129        virtual int type() const /* override */ { return Type; }
    136130
     131        /** Returns item name. */
     132        virtual QString name() const /* override */;
     133        /** Returns item full-name. */
     134        virtual QString fullName() const /* override */;
     135        /** Returns item description. */
     136        virtual QString description() const /* override */;
     137        /** Returns item definition. */
     138        virtual QString definition() const /* override */;
     139
    137140        /** Starts item editing. */
    138141        virtual void startEditing() /* override */;
     
    141144        virtual void updateToolTip() /* override */;
    142145
    143         /** Returns item name. */
    144         virtual QString name() const /* override */;
    145         /** Returns item description. */
    146         virtual QString description() const /* override */;
    147         /** Returns item full-name. */
    148         virtual QString fullName() const /* override */;
    149         /** Returns item definition. */
    150         virtual QString definition() const /* override */;
     146        /** Installs event-filter for @a pSource object. */
     147        virtual void installEventFilterHelper(QObject *pSource) /* override */;
    151148    /** @} */
    152149
    153150    /** @name Children stuff.
    154151      * @{ */
     152        /** Returns whether there are children items of certain @a enmType. */
     153        virtual bool hasItems(UIChooserItemType enmType = UIChooserItemType_Any) const /* override */;
     154        /** Returns children items of certain @a enmType. */
     155        virtual QList<UIChooserItem*> items(UIChooserItemType enmType = UIChooserItemType_Any) const /* override */;
     156
     157        /** Replaces children @a items of certain @a enmType. */
     158        virtual void setItems(const QList<UIChooserItem*> &items, UIChooserItemType enmType) /* override */;
     159        /** Clears children items of certain @a enmType. */
     160        virtual void clearItems(UIChooserItemType enmType = UIChooserItemType_Any) /* override */;
     161
    155162        /** Adds possible @a fFavorite child @a pItem to certain @a iPosition. */
    156163        virtual void addItem(UIChooserItem *pItem, bool fFavorite, int iPosition) /* override */;
     
    158165        virtual void removeItem(UIChooserItem *pItem) /* override */;
    159166
    160         /** Replaces children @a items of certain @a enmType. */
    161         virtual void setItems(const QList<UIChooserItem*> &items, UIChooserItemType enmType) /* override */;
    162         /** Returns children items of certain @a enmType. */
    163         virtual QList<UIChooserItem*> items(UIChooserItemType enmType = UIChooserItemType_Any) const /* override */;
    164         /** Returns whether there are children items of certain @a enmType. */
    165         virtual bool hasItems(UIChooserItemType enmType = UIChooserItemType_Any) const /* override */;
    166         /** Clears children items of certain @a enmType. */
    167         virtual void clearItems(UIChooserItemType enmType = UIChooserItemType_Any) /* override */;
    168 
    169167        /** Updates all children items with specified @a uId. */
    170168        virtual void updateAllItems(const QUuid &uId) /* override */;
     
    203201    /** @name Navigation stuff.
    204202      * @{ */
     203        /** Makes sure passed child @a pItem is visible. */
     204        virtual void makeSureItemIsVisible(UIChooserItem *pItem) /* override */;
     205
    205206        /** Returns pixmap item representation. */
    206207        virtual QPixmap toPixmap() /* override */;
     
    260261        /** Prepares all. */
    261262        void prepare();
    262 
    263         /** Copies group contents @a pFrom one item @a pTo another. */
    264         static void copyContent(UIChooserItemGroup *pFrom, UIChooserItemGroup *pTo);
    265263    /** @} */
    266264
     
    273271        int headerDarkness() const { return m_iHeaderDarkness; }
    274272
     273        /** Returns additional height. */
     274        int additionalHeight() const;
    275275        /** Defines @a iAdditionalHeight. */
    276276        void setAdditionalHeight(int iAdditionalHeight);
    277         /** Returns additional height. */
    278         int additionalHeight() const;
    279277
    280278        /** Updates animation parameters. */
     
    286284    /** @name Children stuff.
    287285      * @{ */
     286        /** Copies group contents @a pFrom one item @a pTo another. */
     287        static void copyContent(UIChooserItemGroup *pFrom, UIChooserItemGroup *pTo);
     288
    288289        /** Returns whether group contains machine with @a uId. */
    289290        bool isContainsMachine(const QUuid &uId) const;
     
    326327    /** @name Item stuff.
    327328      * @{ */
     329        /** Holds the cached name. */
     330        QString  m_strName;
     331        /** Holds the cached description. */
     332        QString  m_strDescription;
     333        /** Holds the cached visible name. */
     334        QString  m_strVisibleName;
     335        /** Holds the cached group children info. */
     336        QString  m_strInfoGroups;
     337        /** Holds the cached machine children info. */
     338        QString  m_strInfoMachines;
     339
    328340        /** Holds whether group is closed. */
    329341        bool  m_fClosed;
     
    334346        int  m_iHeaderDarkness;
    335347
    336         /** Holds the cached name. */
    337         QString m_strName;
    338         /** Holds the cached description. */
    339         QString m_strDescription;
    340         /** Holds the cached visible name. */
    341         QString m_strVisibleName;
     348        /** Holds group children pixmap. */
     349        QPixmap  m_groupsPixmap;
     350        /** Holds machine children pixmap. */
     351        QPixmap  m_machinesPixmap;
    342352
    343353        /** Holds the name font. */
    344354        QFont  m_nameFont;
     355        /** Holds the info font. */
     356        QFont  m_infoFont;
    345357
    346358        /** Holds the group toggle button instance. */
     
    382394        /** Holds the machine children list. */
    383395        QList<UIChooserItem*>  m_machineItems;
    384 
    385         /** Holds group children pixmap. */
    386         QPixmap  m_groupsPixmap;
    387         /** Holds machine children pixmap. */
    388         QPixmap  m_machinesPixmap;
    389 
    390         /** Holds the cached group children info. */
    391         QString  m_strInfoGroups;
    392         /** Holds the cached machine children info. */
    393         QString  m_strInfoMachines;
    394 
    395         /** Holds the children info font. */
    396         QFont  m_infoFont;
    397396    /** @} */
    398397
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemMachine.cpp

    r77567 r77596  
    8787{
    8888    cleanup();
    89 }
    90 
    91 QString UIChooserItemMachine::name() const
    92 {
    93     return UIVirtualMachineItem::name();
    9489}
    9590
     
    224219}
    225220
    226 void UIChooserItemMachine::startEditing()
    227 {
    228     AssertMsgFailed(("Machine graphics item do NOT support editing yet!"));
    229 }
    230 
    231 void UIChooserItemMachine::updateToolTip()
    232 {
    233     setToolTip(toolTipText());
    234 }
    235 
    236 QString UIChooserItemMachine::description() const
    237 {
    238     return m_strDescription;
     221QString UIChooserItemMachine::name() const
     222{
     223    return UIVirtualMachineItem::name();
    239224}
    240225
     
    250235}
    251236
     237QString UIChooserItemMachine::description() const
     238{
     239    return m_strDescription;
     240}
     241
    252242QString UIChooserItemMachine::definition() const
    253243{
     
    255245}
    256246
    257 void UIChooserItemMachine::addItem(UIChooserItem*, bool, int)
     247void UIChooserItemMachine::startEditing()
     248{
     249    AssertMsgFailed(("Machine graphics item do NOT support editing yet!"));
     250}
     251
     252void UIChooserItemMachine::updateToolTip()
     253{
     254    setToolTip(toolTipText());
     255}
     256
     257bool UIChooserItemMachine::hasItems(UIChooserItemType) const
    258258{
    259259    AssertMsgFailed(("Machine graphics item do NOT support children!"));
    260 }
    261 
    262 void UIChooserItemMachine::removeItem(UIChooserItem*)
    263 {
    264     AssertMsgFailed(("Machine graphics item do NOT support children!"));
    265 }
    266 
    267 void UIChooserItemMachine::setItems(const QList<UIChooserItem*>&, UIChooserItemType)
    268 {
    269     AssertMsgFailed(("Machine graphics item do NOT support children!"));
     260    return false;
    270261}
    271262
     
    276267}
    277268
    278 bool UIChooserItemMachine::hasItems(UIChooserItemType) const
     269void UIChooserItemMachine::setItems(const QList<UIChooserItem*>&, UIChooserItemType)
    279270{
    280271    AssertMsgFailed(("Machine graphics item do NOT support children!"));
    281     return false;
    282272}
    283273
    284274void UIChooserItemMachine::clearItems(UIChooserItemType)
     275{
     276    AssertMsgFailed(("Machine graphics item do NOT support children!"));
     277}
     278
     279void UIChooserItemMachine::addItem(UIChooserItem*, bool, int)
     280{
     281    AssertMsgFailed(("Machine graphics item do NOT support children!"));
     282}
     283
     284void UIChooserItemMachine::removeItem(UIChooserItem*)
    285285{
    286286    AssertMsgFailed(("Machine graphics item do NOT support children!"));
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemMachine.h

    r77593 r77596  
    3939public:
    4040
    41     /** RTTI item type. */
     41    /** RTTI required for qgraphicsitem_cast. */
    4242    enum { Type = UIChooserItemType_Machine };
    4343
     
    5151    /** @name Item stuff.
    5252      * @{ */
    53         /** Returns item name. */
    54         virtual QString name() const /* override */;
    55 
    5653        /** Returns whether VM is locked. */
    5754        bool isLockedMachine() const;
     
    9794        virtual int type() const /* override */ { return Type; }
    9895
     96        /** Returns item name. */
     97        virtual QString name() const /* override */;
     98        /** Returns item full-name. */
     99        virtual QString fullName() const /* override */;
     100        /** Returns item description. */
     101        virtual QString description() const /* override */;
     102        /** Returns item definition. */
     103        virtual QString definition() const /* override */;
     104
    99105        /** Starts item editing. */
    100106        virtual void startEditing() /* override */;
     
    103109        virtual void updateToolTip() /* override */;
    104110
    105         /** Returns item description. */
    106         virtual QString description() const /* override */;
    107         /** Returns item full-name. */
    108         virtual QString fullName() const /* override */;
    109         /** Returns item definition. */
    110         virtual QString definition() const /* override */;
    111111    /** @} */
    112112
    113113    /** @name Children stuff.
    114114      * @{ */
     115        /** Returns whether there are children items of certain @a enmType. */
     116        virtual bool hasItems(UIChooserItemType enmType = UIChooserItemType_Any) const /* override */;
     117        /** Returns children items of certain @a enmType. */
     118        virtual QList<UIChooserItem*> items(UIChooserItemType enmType = UIChooserItemType_Any) const /* override */;
     119
     120        /** Replaces children @a items of certain @a enmType. */
     121        virtual void setItems(const QList<UIChooserItem*> &items, UIChooserItemType enmType) /* override */;
     122        /** Clears children items of certain @a enmType. */
     123        virtual void clearItems(UIChooserItemType enmType = UIChooserItemType_Any) /* override */;
     124
    115125        /** Adds possible @a fFavorite child @a pItem to certain @a iPosition. */
    116126        virtual void addItem(UIChooserItem *pItem, bool fFavorite, int iPosition) /* override */;
    117127        /** Removes child @a pItem. */
    118128        virtual void removeItem(UIChooserItem *pItem) /* override */;
    119 
    120         /** Replaces children @a items of certain @a enmType. */
    121         virtual void setItems(const QList<UIChooserItem*> &items, UIChooserItemType enmType) /* override */;
    122         /** Returns children items of certain @a enmType. */
    123         virtual QList<UIChooserItem*> items(UIChooserItemType enmType = UIChooserItemType_Any) const /* override */;
    124         /** Returns whether there are children items of certain @a enmType. */
    125         virtual bool hasItems(UIChooserItemType enmType = UIChooserItemType_Any) const /* override */;
    126         /** Clears children items of certain @a enmType. */
    127         virtual void clearItems(UIChooserItemType enmType = UIChooserItemType_Any) /* override */;
    128129
    129130        /** Updates all children items with specified @a uId. */
     
    346347};
    347348
     349
    348350#endif /* !FEQT_INCLUDED_SRC_manager_chooser_UIChooserItemMachine_h */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.cpp

    r77430 r77596  
    10171017        {
    10181018            /* Machine name: */
    1019             QString strMachineName = pItem->name();
     1019            QString strMachineName = ((UIChooserItem*)pItem)->name();
    10201020            /* We should reload this machine: */
    10211021            sltReloadMachine(pItem->id());
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