VirtualBox

Changeset 77567 in vbox


Ignore:
Timestamp:
Mar 5, 2019 5:18:31 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
129174
Message:

FE/Qt: bugref:9241: VirtualBox Manager UI: Chooser pane: Moving some common stuff to separate UIChooserDefs.h

Location:
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser
Files:
8 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserDefs.h

    r77566 r77567  
    11/* $Id$ */
    22/** @file
    3  * VBox Qt GUI - UIChooserItem class declaration.
     3 * VBox Qt GUI - UIChooserDefs class declaration.
    44 */
    55
     
    1616 */
    1717
    18 #ifndef FEQT_INCLUDED_SRC_manager_chooser_UIChooserItem_h
    19 #define FEQT_INCLUDED_SRC_manager_chooser_UIChooserItem_h
     18#ifndef FEQT_INCLUDED_SRC_manager_chooser_UIChooserDefs_h
     19#define FEQT_INCLUDED_SRC_manager_chooser_UIChooserDefs_h
    2020#ifndef RT_WITHOUT_PRAGMA_ONCE
    2121# pragma once
     
    2323
    2424/* Qt includes: */
    25 #include <QMimeData>
    26 #include <QRectF>
    27 #include <QString>
    28 #include <QUuid>
    29 
    30 /* GUI includes: */
    31 #include "QIGraphicsWidget.h"
    32 #include "QIWithRetranslateUI.h"
     25#include <QGraphicsItem>
    3326
    3427/* Other VBox includes: */
    3528#include <iprt/cdefs.h>
    36 
    37 /* Forward declaration: */
    38 class QGraphicsSceneHoverEvent;
    39 class QGraphicsSceneMouseEvent;
    40 class QGraphicsSceneDragDropEvent;
    41 class QPropertyAnimation;
    42 class QStateMachine;
    43 class UIActionPool;
    44 class UIChooserItemGroup;
    45 class UIChooserItemGlobal;
    46 class UIChooserItemMachine;
    47 class UIChooserModel;
    4829
    4930
     
    6849
    6950
    70 /** Drag token placement types. */
    71 enum DragToken
     51/** UIChooserItem drag token types. */
     52enum UIChooserItemDragToken
    7253{
    73     DragToken_Off,
    74     DragToken_Up,
    75     DragToken_Down
     54    UIChooserItemDragToken_Off,
     55    UIChooserItemDragToken_Up,
     56    UIChooserItemDragToken_Down
    7657};
    7758
    7859
    79 /** QIGraphicsWidget extension used as interface
    80   * for graphics chooser model/view architecture. */
    81 class UIChooserItem : public QIWithRetranslateUI4<QIGraphicsWidget>
    82 {
    83     Q_OBJECT;
    84     Q_PROPERTY(int animatedValue READ animatedValue WRITE setAnimatedValue);
    85 
    86 signals:
    87 
    88     /** @name Item stuff.
    89       * @{ */
    90         /** Notifies listeners about hover enter. */
    91         void sigHoverEnter();
    92         /** Notifies listeners about hover leave. */
    93         void sigHoverLeave();
    94     /** @} */
    95 
    96     /** @name Layout stuff.
    97       * @{ */
    98         /** Notifies listeners about @a iMinimumWidthHint change. */
    99         void sigMinimumWidthHintChanged(int iMinimumWidthHint);
    100     /** @} */
    101 
    102 public:
    103 
    104     /** Constructs item passing @a pParent to the base-class.
    105       * @param  fFavorite      Brings whether this item created directly in favorite container.
    106       * @param  iDefaultValue  Brings default value for hovering animation.
    107       * @param  iHoveredValue  Brings hovered value for hovering animation. */
    108     UIChooserItem(UIChooserItem *pParent, bool fFavorite,
    109                   int iDefaultValue = 100, int iHoveredValue = 90);
    110 
    111     /** @name Item stuff.
    112       * @{ */
    113         /** Returns parent  reference. */
    114         UIChooserItem *parentItem() const {  return m_pParent; }
    115         /** Returns whether item is favorite. */
    116         bool isFavorite() const { return m_fFavorite; }
    117 
    118         /** Defines whether item is @a fFavorite. */
    119         virtual void setFavorite(bool fFavorite);
    120 
    121         /** Returns whether item is root. */
    122         bool isRoot() const { return !m_pParent; }
    123 
    124         /** Casts item to group one. */
    125         UIChooserItemGroup *toGroupItem();
    126         /** Casts item to global one. */
    127         UIChooserItemGlobal *toGlobalItem();
    128         /** Casts item to machine one. */
    129         UIChooserItemMachine *toMachineItem();
    130 
    131         /** Returns model reference. */
    132         UIChooserModel *model() const;
    133         /** Returns action-pool reference. */
    134         UIActionPool *actionPool() const;
    135 
    136         /** Returns a level of item. */
    137         int level() const;
    138         /** Defines a @a iLevel of item. */
    139         void setLevel(int iLevel);
    140 
    141         /** Starts item editing. */
    142         virtual void startEditing() = 0;
    143 
    144         /** Updates item tool-tip. */
    145         virtual void updateToolTip() = 0;
    146 
    147         /** Returns item name. */
    148         virtual QString name() const = 0;
    149         /** Returns item description. */
    150         virtual QString description() const = 0;
    151         /** Returns item full-name. */
    152         virtual QString fullName() const = 0;
    153         /** Returns item definition. */
    154         virtual QString definition() const = 0;
    155 
    156         /** Defines whether item is @a fHovered. */
    157         void setHovered(bool fHovered);
    158         /** Returns whether item is hovered. */
    159         bool isHovered() const;
    160 
    161         /** Installs event-filter for @a pSource object.
    162           * @note  Base-class implementation does nothing. */
    163         virtual void installEventFilterHelper(QObject *pSource) { Q_UNUSED(pSource); }
    164     /** @} */
    165 
    166     /** @name Children stuff.
    167       * @{ */
    168         /** Adds possible @a fFavorite child @a pItem to certain @a iPosition. */
    169         virtual void addItem(UIChooserItem *pItem, bool fFavorite, int iPosition) = 0;
    170         /** Removes child @a pItem. */
    171         virtual void removeItem(UIChooserItem *pItem) = 0;
    172 
    173         /** Replaces children @a items of certain @a enmType. */
    174         virtual void setItems(const QList<UIChooserItem*> &items, UIChooserItemType enmType) = 0;
    175         /** Returns children items of certain @a enmType. */
    176         virtual QList<UIChooserItem*> items(UIChooserItemType enmType = UIChooserItemType_Any) const = 0;
    177         /** Returns whether there are children items of certain @a enmType. */
    178         virtual bool hasItems(UIChooserItemType enmType = UIChooserItemType_Any) const = 0;
    179         /** Clears children items of certain @a enmType. */
    180         virtual void clearItems(UIChooserItemType enmType = UIChooserItemType_Any) = 0;
    181 
    182         /** Updates all children items with specified @a uId. */
    183         virtual void updateAllItems(const QUuid &uId) = 0;
    184         /** Removes all children items with specified @a uId. */
    185         virtual void removeAllItems(const QUuid &uId) = 0;
    186 
    187         /** Searches for a first child item answering to specified @a strSearchTag and @a iItemSearchFlags. */
    188         virtual UIChooserItem *searchForItem(const QString &strSearchTag, int iItemSearchFlags) = 0;
    189 
    190         /** Searches for a first machine child item. */
    191         virtual UIChooserItem *firstMachineItem() = 0;
    192 
    193         /** Sorts children items. */
    194         virtual void sortItems() = 0;
    195     /** @} */
    196 
    197     /** @name Layout stuff.
    198       * @{ */
    199         /** Updates geometry. */
    200         virtual void updateGeometry() /* override */;
    201 
    202         /** Updates layout. */
    203         virtual void updateLayout() = 0;
    204 
    205         /** Returns minimum width-hint. */
    206         virtual int minimumWidthHint() const = 0;
    207         /** Returns minimum height-hint. */
    208         virtual int minimumHeightHint() const = 0;
    209     /** @} */
    210 
    211     /** @name Navigation stuff.
    212       * @{ */
    213         /** Makes sure item is visible. */
    214         virtual void makeSureItsVisible();
    215         /** Makes sure passed child @a pItem is visible. */
    216         virtual void makeSureItemIsVisible(UIChooserItem *pItem) { Q_UNUSED(pItem); }
    217 
    218         /** Returns pixmap item representation. */
    219         virtual QPixmap toPixmap() = 0;
    220 
    221         /** Returns whether item drop is allowed.
    222           * @param  pEvent    Brings information about drop event.
    223           * @param  enmPlace  Brings the place of drag token to the drop moment. */
    224         virtual bool isDropAllowed(QGraphicsSceneDragDropEvent *pEvent, DragToken enmPlace = DragToken_Off) const = 0;
    225         /** Processes item drop.
    226           * @param  pEvent    Brings information about drop event.
    227           * @param  pFromWho  Brings the item according to which we choose drop position.
    228           * @param  enmPlace  Brings the place of drag token to the drop moment (according to item mentioned above). */
    229         virtual void processDrop(QGraphicsSceneDragDropEvent *pEvent, UIChooserItem *pFromWho = 0, DragToken enmPlace = DragToken_Off) = 0;
    230         /** Reset drag token. */
    231         virtual void resetDragToken() = 0;
    232 
    233         /** Defines drag token @a enmPlace. */
    234         void setDragTokenPlace(DragToken enmPlace);
    235         /** Returns drag token place. */
    236         DragToken dragTokenPlace() const;
    237     /** @} */
    238 
    239 protected:
    240 
    241     /** @name Event-handling stuff.
    242       * @{ */
    243         /** Handles hover enter @a event. */
    244         virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *pEvent) /* override */;
    245         /** Handles hover leave @a event. */
    246         virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *pEvent) /* override */;
    247 
    248         /** Handles mouse press @a event. */
    249         virtual void mousePressEvent(QGraphicsSceneMouseEvent *pEvent) /* override */;
    250         /** Handles mouse move @a event. */
    251         virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *pEvent) /* override */;
    252 
    253         /** Handles drag move @a event. */
    254         virtual void dragMoveEvent(QGraphicsSceneDragDropEvent *pEvent) /* override */;
    255         /** Handles drag leave @a event. */
    256         virtual void dragLeaveEvent(QGraphicsSceneDragDropEvent *pEvent) /* override */;
    257         /** Handles drop @a event. */
    258         virtual void dropEvent(QGraphicsSceneDragDropEvent *pEvent) /* override */;
    259     /** @} */
    260 
    261     /** @name Item stuff.
    262       * @{ */
    263         /** Defines item's default animation @a iValue. */
    264         void setDefaultValue(int iValue) { m_iDefaultValue = iValue; update(); }
    265         /** Returns item's default animation value. */
    266         int defaultValue() const { return m_iDefaultValue; }
    267 
    268         /** Defines item's hovered animation @a iValue. */
    269         void setHoveredValue(int iValue) { m_iHoveredValue = iValue; update(); }
    270         /** Returns item's hovered animation value. */
    271         int hoveredValue() const { return m_iHoveredValue; }
    272 
    273         /** Defines item's animated @a iValue. */
    274         void setAnimatedValue(int iValue) { m_iAnimatedValue = iValue; update(); }
    275         /** Returns item's animated value. */
    276         int animatedValue() const { return m_iAnimatedValue; }
    277     /** @} */
    278 
    279     /** @name Layout stuff.
    280       * @{ */
    281         /** Defines previous @a geometry. */
    282         void setPreviousGeometry(const QRectF &geometry) { m_previousGeometry = geometry; }
    283         /** Returns previous geometry. */
    284         const QRectF &previousGeometry() const { return m_previousGeometry; }
    285 
    286         /** Returns @a strText size calculated on the basis of certain @a font and @a pPaintDevice. */
    287         static QSize textSize(const QFont &font, QPaintDevice *pPaintDevice, const QString &strText);
    288         /** Returns a width of line containing @a iCount of chars calculated on the basis of certain @a font and @a pPaintDevice. */
    289         static int textWidth(const QFont &font, QPaintDevice *pPaintDevice, int iCount);
    290         /** Compresses @a strText to @a iWidth on the basis of certain @a font and @a pPaintDevice. */
    291         static QString compressText(const QFont &font, QPaintDevice *pPaintDevice, QString strText, int iWidth);
    292     /** @} */
    293 
    294     /** @name Navigation stuff.
    295       * @{ */
    296         /** Returns D&D mime data. */
    297         virtual QMimeData *createMimeData() = 0;
    298 
    299         /** Returns drag token darkness. */
    300         int dragTokenDarkness() const { return m_iDragTokenDarkness; }
    301     /** @} */
    302 
    303     /** @name Painting stuff.
    304       * @{ */
    305         /** Paints frame @a rectangle using passed @a pPainter.
    306           * @param  fIsSelected  Brings whether this rectangle should be filled.
    307           * @param  iRadius      Brings the radius of rounded corners. */
    308         static void paintFrameRect(QPainter *pPainter, bool fIsSelected, int iRadius,
    309                                    const QRect &rectangle);
    310         /** Paints @a pixmap using passed @a pPainter putting its upper-left corner to specified @a point. */
    311         static void paintPixmap(QPainter *pPainter, const QPoint &point,
    312                                 const QPixmap &pixmap);
    313         /** Paints @a strText using passed @a pPainter putting its upper-left corner to specified @a point.
    314           * @param  font          Brings the text font.
    315           * @param  pPaintDevice  Brings the paint-device reference to initilize painting from. */
    316         static void paintText(QPainter *pPainter, QPoint point,
    317                               const QFont &font, QPaintDevice *pPaintDevice,
    318                               const QString &strText);
    319         /** Paints flat button @a rectangle using passed @a pPainter moving light focus according to passed @a cursorPosition. */
    320         static void paintFlatButton(QPainter *pPainter, const QRect &rectangle, const QPoint &cursorPosition);
    321     /** @} */
    322 
    323 private:
    324 
    325     /** @name Item stuff.
    326       * @{ */
    327         /** Holds the item's parent item. */
    328         UIChooserItem *m_pParent;
    329         /** Holds whether item is favorite. */
    330         bool           m_fFavorite;
    331 
    332         /** Holds the item level according to root. */
    333         int   m_iLevel;
    334 
    335         /** Holds whether item is hovered. */
    336         bool                m_fHovered;
    337         /** Holds the hovering animation machine instance. */
    338         QStateMachine      *m_pHoveringMachine;
    339         /** Holds the forward hovering animation instance. */
    340         QPropertyAnimation *m_pHoveringAnimationForward;
    341         /** Holds the backward hovering animation instance. */
    342         QPropertyAnimation *m_pHoveringAnimationBackward;
    343         /** Holds the animation duration. */
    344         int                 m_iAnimationDuration;
    345         /** Holds the default animation value. */
    346         int                 m_iDefaultValue;
    347         /** Holds the hovered animation value. */
    348         int                 m_iHoveredValue;
    349         /** Holds the animated value. */
    350         int                 m_iAnimatedValue;
    351     /** @} */
    352 
    353     /** @name Layout stuff.
    354       * @{ */
    355         /** Holds previous geometry. */
    356         QRectF  m_previousGeometry;
    357 
    358         /** Holds previous minimum width hint. */
    359         int  m_iPreviousMinimumWidthHint;
    360     /** @} */
    361 
    362     /** @name Navigation stuff.
    363       * @{ */
    364         /** Holds drag token place. */
    365         DragToken  m_enmDragTokenPlace;
    366 
    367         /** Holds drag token darkness. */
    368         int  m_iDragTokenDarkness;
    369     /** @} */
    370 };
    371 
    372 
    373 /** QMimeData for graphics item interface. */
    374 class UIChooserItemMimeData : public QMimeData
    375 {
    376     Q_OBJECT;
    377 
    378 public:
    379 
    380     /** Constructs mime-data on the basis of passed @a pItem. */
    381     UIChooserItemMimeData(UIChooserItem *pItem);
    382 
    383     /** Returns cached item. */
    384     UIChooserItem *item() const { return m_pItem; }
    385 
    386     /** Constructs mime-data on the basis of passed @a pItem. */
    387     virtual bool hasFormat(const QString &strMimeType) const /* override */;
    388 
    389 private:
    390 
    391     /** Holds the cached item. */
    392     UIChooserItem *m_pItem;
    393 };
    394 
    395 
    396 #endif /* !FEQT_INCLUDED_SRC_manager_chooser_UIChooserItem_h */
     60#endif /* !FEQT_INCLUDED_SRC_manager_chooser_UIChooserDefs_h */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItem.cpp

    r77462 r77567  
    208208    , m_iAnimatedValue(m_iDefaultValue)
    209209    , m_iPreviousMinimumWidthHint(0)
    210     , m_enmDragTokenPlace(DragToken_Off)
     210    , m_enmDragTokenPlace(UIChooserItemDragToken_Off)
    211211    , m_iDragTokenDarkness(110)
    212212{
     
    405405}
    406406
    407 void UIChooserItem::setDragTokenPlace(DragToken enmPlace)
     407void UIChooserItem::setDragTokenPlace(UIChooserItemDragToken enmPlace)
    408408{
    409409    /* Something changed? */
     
    415415}
    416416
    417 DragToken UIChooserItem::dragTokenPlace() const
     417UIChooserItemDragToken UIChooserItem::dragTokenPlace() const
    418418{
    419419    return m_enmDragTokenPlace;
     
    484484            QPoint p = pEvent->pos().toPoint();
    485485            if (p.y() < 10)
    486                 setDragTokenPlace(DragToken_Up);
     486                setDragTokenPlace(UIChooserItemDragToken_Up);
    487487            else if (p.y() > minimumSizeHint().toSize().height() - 10)
    488                 setDragTokenPlace(DragToken_Down);
     488                setDragTokenPlace(UIChooserItemDragToken_Down);
    489489            else
    490                 setDragTokenPlace(DragToken_Off);
     490                setDragTokenPlace(UIChooserItemDragToken_Off);
    491491        }
    492492    }
     
    505505    switch (dragTokenPlace())
    506506    {
    507         case DragToken_Off:
     507        case UIChooserItemDragToken_Off:
    508508        {
    509509            /* Its our drop, processing: */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItem.h

    r77462 r77567  
    3131#include "QIGraphicsWidget.h"
    3232#include "QIWithRetranslateUI.h"
     33#include "UIChooserDefs.h"
    3334
    3435/* Other VBox includes: */
     
    4849
    4950
    50 /** UIChooserItem types. */
    51 enum UIChooserItemType
    52 {
    53     UIChooserItemType_Any     = QGraphicsItem::UserType,
    54     UIChooserItemType_Group,
    55     UIChooserItemType_Global,
    56     UIChooserItemType_Machine
    57 };
    58 
    59 
    60 /** UIChooserItem search flags. */
    61 enum UIChooserItemSearchFlag
    62 {
    63     UIChooserItemSearchFlag_Machine   = RT_BIT(0),
    64     UIChooserItemSearchFlag_Global    = RT_BIT(1),
    65     UIChooserItemSearchFlag_Group     = RT_BIT(2),
    66     UIChooserItemSearchFlag_ExactName = RT_BIT(3)
    67 };
    68 
    69 
    70 /** Drag token placement types. */
    71 enum DragToken
    72 {
    73     DragToken_Off,
    74     DragToken_Up,
    75     DragToken_Down
    76 };
    77 
    78 
    7951/** QIGraphicsWidget extension used as interface
    8052  * for graphics chooser model/view architecture. */
     
    222194          * @param  pEvent    Brings information about drop event.
    223195          * @param  enmPlace  Brings the place of drag token to the drop moment. */
    224         virtual bool isDropAllowed(QGraphicsSceneDragDropEvent *pEvent, DragToken enmPlace = DragToken_Off) const = 0;
     196        virtual bool isDropAllowed(QGraphicsSceneDragDropEvent *pEvent, UIChooserItemDragToken enmPlace = UIChooserItemDragToken_Off) const = 0;
    225197        /** Processes item drop.
    226198          * @param  pEvent    Brings information about drop event.
    227199          * @param  pFromWho  Brings the item according to which we choose drop position.
    228200          * @param  enmPlace  Brings the place of drag token to the drop moment (according to item mentioned above). */
    229         virtual void processDrop(QGraphicsSceneDragDropEvent *pEvent, UIChooserItem *pFromWho = 0, DragToken enmPlace = DragToken_Off) = 0;
     201        virtual void processDrop(QGraphicsSceneDragDropEvent *pEvent, UIChooserItem *pFromWho = 0, UIChooserItemDragToken enmPlace = UIChooserItemDragToken_Off) = 0;
    230202        /** Reset drag token. */
    231203        virtual void resetDragToken() = 0;
    232204
    233205        /** Defines drag token @a enmPlace. */
    234         void setDragTokenPlace(DragToken enmPlace);
     206        void setDragTokenPlace(UIChooserItemDragToken enmPlace);
    235207        /** Returns drag token place. */
    236         DragToken dragTokenPlace() const;
     208        UIChooserItemDragToken dragTokenPlace() const;
    237209    /** @} */
    238210
     
    363335      * @{ */
    364336        /** Holds drag token place. */
    365         DragToken  m_enmDragTokenPlace;
     337        UIChooserItemDragToken  m_enmDragTokenPlace;
    366338
    367339        /** Holds drag token darkness. */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGlobal.cpp

    r77462 r77567  
    370370}
    371371
    372 bool UIChooserItemGlobal::isDropAllowed(QGraphicsSceneDragDropEvent *, DragToken) const
     372bool UIChooserItemGlobal::isDropAllowed(QGraphicsSceneDragDropEvent *, UIChooserItemDragToken) const
    373373{
    374374    /* No drops at all: */
     
    376376}
    377377
    378 void UIChooserItemGlobal::processDrop(QGraphicsSceneDragDropEvent *, UIChooserItem *, DragToken)
     378void UIChooserItemGlobal::processDrop(QGraphicsSceneDragDropEvent *, UIChooserItem *, UIChooserItemDragToken)
    379379{
    380380    /* Nothing to process: */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGlobal.h

    r77462 r77567  
    164164          * @param  pEvent    Brings information about drop event.
    165165          * @param  enmPlace  Brings the place of drag token to the drop moment. */
    166         virtual bool isDropAllowed(QGraphicsSceneDragDropEvent *pEvent, DragToken where) const /* override */;
     166        virtual bool isDropAllowed(QGraphicsSceneDragDropEvent *pEvent, UIChooserItemDragToken where) const /* override */;
    167167        /** Processes item drop.
    168168          * @param  pEvent    Brings information about drop event.
    169169          * @param  pFromWho  Brings the item according to which we choose drop position.
    170170          * @param  enmPlace  Brings the place of drag token to the drop moment (according to item mentioned above). */
    171         virtual void processDrop(QGraphicsSceneDragDropEvent *pEvent, UIChooserItem *pFromWho, DragToken where) /* override */;
     171        virtual void processDrop(QGraphicsSceneDragDropEvent *pEvent, UIChooserItem *pFromWho, UIChooserItemDragToken where) /* override */;
    172172        /** Reset drag token. */
    173173        virtual void resetDragToken() /* override */;
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGroup.cpp

    r77462 r77567  
    944944}
    945945
    946 bool UIChooserItemGroup::isDropAllowed(QGraphicsSceneDragDropEvent *pEvent, DragToken where) const
     946bool UIChooserItemGroup::isDropAllowed(QGraphicsSceneDragDropEvent *pEvent, UIChooserItemDragToken where) const
    947947{
    948948    /* No drops while saving groups: */
     
    952952    const QMimeData *pMimeData = pEvent->mimeData();
    953953    /* If drag token is shown, its up to parent to decide: */
    954     if (where != DragToken_Off)
     954    if (where != UIChooserItemDragToken_Off)
    955955        return parentItem()->isDropAllowed(pEvent);
    956956    /* Else we should check mime format: */
     
    10071007}
    10081008
    1009 void UIChooserItemGroup::processDrop(QGraphicsSceneDragDropEvent *pEvent, UIChooserItem *pFromWho, DragToken where)
     1009void UIChooserItemGroup::processDrop(QGraphicsSceneDragDropEvent *pEvent, UIChooserItem *pFromWho, UIChooserItemDragToken where)
    10101010{
    10111011    /* Get mime: */
     
    10291029                /* Check if we have position information: */
    10301030                int iPosition = m_groupItems.size();
    1031                 if (pFromWho && where != DragToken_Off)
     1031                if (pFromWho && where != UIChooserItemDragToken_Off)
    10321032                {
    10331033                    /* Make sure sender item if our child: */
     
    10361036                    {
    10371037                        iPosition = m_groupItems.indexOf(pFromWho);
    1038                         if (where == DragToken_Down)
     1038                        if (where == UIChooserItemDragToken_Down)
    10391039                            ++iPosition;
    10401040                    }
     
    10821082                /* Check if we have position information: */
    10831083                int iPosition = m_machineItems.size();
    1084                 if (pFromWho && where != DragToken_Off)
     1084                if (pFromWho && where != UIChooserItemDragToken_Off)
    10851085                {
    10861086                    /* Make sure sender item if our child: */
     
    10891089                    {
    10901090                        iPosition = m_machineItems.indexOf(pFromWho);
    1091                         if (where == DragToken_Down)
     1091                        if (where == UIChooserItemDragToken_Down)
    10921092                            ++iPosition;
    10931093                    }
     
    11231123{
    11241124    /* Reset drag token for this item: */
    1125     if (dragTokenPlace() != DragToken_Off)
    1126     {
    1127         setDragTokenPlace(DragToken_Off);
     1125    if (dragTokenPlace() != UIChooserItemDragToken_Off)
     1126    {
     1127        setDragTokenPlace(UIChooserItemDragToken_Off);
    11281128        update();
    11291129    }
     
    17771777
    17781778        /* Paint drag token UP? */
    1779         if (dragTokenPlace() != DragToken_Off)
     1779        if (dragTokenPlace() != UIChooserItemDragToken_Off)
    17801780        {
    17811781            QLinearGradient dragTokenGradient;
    17821782            QRect dragTokenRect = rect;
    1783             if (dragTokenPlace() == DragToken_Up)
     1783            if (dragTokenPlace() == UIChooserItemDragToken_Up)
    17841784            {
    17851785                dragTokenRect.setHeight(5);
     
    17871787                dragTokenGradient.setFinalStop(dragTokenRect.topLeft());
    17881788            }
    1789             else if (dragTokenPlace() == DragToken_Down)
     1789            else if (dragTokenPlace() == UIChooserItemDragToken_Down)
    17901790            {
    17911791                dragTokenRect.setTopLeft(dragTokenRect.bottomLeft() - QPoint(0, 5));
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGroup.h

    r77462 r77567  
    209209          * @param  pEvent    Brings information about drop event.
    210210          * @param  enmPlace  Brings the place of drag token to the drop moment. */
    211         virtual bool isDropAllowed(QGraphicsSceneDragDropEvent *pEvent, DragToken where) const /* override */;
     211        virtual bool isDropAllowed(QGraphicsSceneDragDropEvent *pEvent, UIChooserItemDragToken where) const /* override */;
    212212        /** Processes item drop.
    213213          * @param  pEvent    Brings information about drop event.
    214214          * @param  pFromWho  Brings the item according to which we choose drop position.
    215215          * @param  enmPlace  Brings the place of drag token to the drop moment (according to item mentioned above). */
    216         virtual void processDrop(QGraphicsSceneDragDropEvent *pEvent, UIChooserItem *pFromWho, DragToken where) /* override */;
     216        virtual void processDrop(QGraphicsSceneDragDropEvent *pEvent, UIChooserItem *pFromWho, UIChooserItemDragToken where) /* override */;
    217217        /** Reset drag token. */
    218218        virtual void resetDragToken() /* override */;
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemMachine.cpp

    r77462 r77567  
    449449}
    450450
    451 bool UIChooserItemMachine::isDropAllowed(QGraphicsSceneDragDropEvent *pEvent, DragToken where) const
     451bool UIChooserItemMachine::isDropAllowed(QGraphicsSceneDragDropEvent *pEvent, UIChooserItemDragToken where) const
    452452{
    453453    /* No drops while saving groups: */
     
    460460    const QMimeData *pMimeData = pEvent->mimeData();
    461461    /* If drag token is shown, its up to parent to decide: */
    462     if (where != DragToken_Off)
     462    if (where != UIChooserItemDragToken_Off)
    463463        return parentItem()->isDropAllowed(pEvent);
    464464    /* Else we should make sure machine is accessible: */
     
    482482}
    483483
    484 void UIChooserItemMachine::processDrop(QGraphicsSceneDragDropEvent *pEvent, UIChooserItem *pFromWho, DragToken where)
     484void UIChooserItemMachine::processDrop(QGraphicsSceneDragDropEvent *pEvent, UIChooserItem *pFromWho, UIChooserItemDragToken where)
    485485{
    486486    /* Get mime: */
    487487    const QMimeData *pMime = pEvent->mimeData();
    488488    /* Make sure this handler called by this item (not by children): */
    489     AssertMsg(!pFromWho && where == DragToken_Off, ("Machine graphics item do NOT support children!"));
     489    AssertMsg(!pFromWho && where == UIChooserItemDragToken_Off, ("Machine graphics item do NOT support children!"));
    490490    Q_UNUSED(pFromWho);
    491491    Q_UNUSED(where);
     
    538538{
    539539    /* Reset drag token for this item: */
    540     if (dragTokenPlace() != DragToken_Off)
    541     {
    542         setDragTokenPlace(DragToken_Off);
     540    if (dragTokenPlace() != UIChooserItemDragToken_Off)
     541    {
     542        setDragTokenPlace(UIChooserItemDragToken_Off);
    543543        update();
    544544    }
     
    10371037
    10381038    /* Paint drag token UP? */
    1039     if (dragTokenPlace() != DragToken_Off)
     1039    if (dragTokenPlace() != UIChooserItemDragToken_Off)
    10401040    {
    10411041        /* Window color: */
     
    10451045        QLinearGradient dragTokenGradient;
    10461046        QRect dragTokenRect = rectangle;
    1047         if (dragTokenPlace() == DragToken_Up)
     1047        if (dragTokenPlace() == UIChooserItemDragToken_Up)
    10481048        {
    10491049            /* Selection background: */
     
    10661066            dragTokenGradient.setFinalStop(dragTokenRect.topLeft());
    10671067        }
    1068         else if (dragTokenPlace() == DragToken_Down)
     1068        else if (dragTokenPlace() == UIChooserItemDragToken_Down)
    10691069        {
    10701070            /* Selection background: */
     
    11211121
    11221122    /* Draw borders: */
    1123     if (dragTokenPlace() != DragToken_Up)
     1123    if (dragTokenPlace() != UIChooserItemDragToken_Up)
    11241124        pPainter->drawLine(rectangle.topLeft(),    rectangle.topRight()    + QPoint(1, 0));
    1125     if (dragTokenPlace() != DragToken_Down)
     1125    if (dragTokenPlace() != UIChooserItemDragToken_Down)
    11261126        pPainter->drawLine(rectangle.bottomLeft(), rectangle.bottomRight() + QPoint(1, 0));
    11271127    pPainter->drawLine(rectangle.topLeft(),    rectangle.bottomLeft());
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemMachine.h

    r77462 r77567  
    173173          * @param  pEvent    Brings information about drop event.
    174174          * @param  enmPlace  Brings the place of drag token to the drop moment. */
    175         virtual bool isDropAllowed(QGraphicsSceneDragDropEvent *pEvent, DragToken where) const /* override */;
     175        virtual bool isDropAllowed(QGraphicsSceneDragDropEvent *pEvent, UIChooserItemDragToken where) const /* override */;
    176176        /** Processes item drop.
    177177          * @param  pEvent    Brings information about drop event.
    178178          * @param  pFromWho  Brings the item according to which we choose drop position.
    179179          * @param  enmPlace  Brings the place of drag token to the drop moment (according to item mentioned above). */
    180         virtual void processDrop(QGraphicsSceneDragDropEvent *pEvent, UIChooserItem *pFromWho, DragToken where) /* override */;
     180        virtual void processDrop(QGraphicsSceneDragDropEvent *pEvent, UIChooserItem *pFromWho, UIChooserItemDragToken where) /* override */;
    181181        /** Reset drag token. */
    182182        virtual void resetDragToken() /* override */;
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