Changeset 77567 in vbox
- Timestamp:
- Mar 5, 2019 5:18:31 PM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 129174
- 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 1 1 /* $Id$ */ 2 2 /** @file 3 * VBox Qt GUI - UIChooser Itemclass declaration.3 * VBox Qt GUI - UIChooserDefs class declaration. 4 4 */ 5 5 … … 16 16 */ 17 17 18 #ifndef FEQT_INCLUDED_SRC_manager_chooser_UIChooser Item_h19 #define FEQT_INCLUDED_SRC_manager_chooser_UIChooser Item_h18 #ifndef FEQT_INCLUDED_SRC_manager_chooser_UIChooserDefs_h 19 #define FEQT_INCLUDED_SRC_manager_chooser_UIChooserDefs_h 20 20 #ifndef RT_WITHOUT_PRAGMA_ONCE 21 21 # pragma once … … 23 23 24 24 /* 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> 33 26 34 27 /* Other VBox includes: */ 35 28 #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;48 29 49 30 … … 68 49 69 50 70 /** Drag token placementtypes. */71 enum DragToken51 /** UIChooserItem drag token types. */ 52 enum UIChooserItemDragToken 72 53 { 73 DragToken_Off,74 DragToken_Up,75 DragToken_Down54 UIChooserItemDragToken_Off, 55 UIChooserItemDragToken_Up, 56 UIChooserItemDragToken_Down 76 57 }; 77 58 78 59 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 208 208 , m_iAnimatedValue(m_iDefaultValue) 209 209 , m_iPreviousMinimumWidthHint(0) 210 , m_enmDragTokenPlace( DragToken_Off)210 , m_enmDragTokenPlace(UIChooserItemDragToken_Off) 211 211 , m_iDragTokenDarkness(110) 212 212 { … … 405 405 } 406 406 407 void UIChooserItem::setDragTokenPlace( DragToken enmPlace)407 void UIChooserItem::setDragTokenPlace(UIChooserItemDragToken enmPlace) 408 408 { 409 409 /* Something changed? */ … … 415 415 } 416 416 417 DragToken UIChooserItem::dragTokenPlace() const417 UIChooserItemDragToken UIChooserItem::dragTokenPlace() const 418 418 { 419 419 return m_enmDragTokenPlace; … … 484 484 QPoint p = pEvent->pos().toPoint(); 485 485 if (p.y() < 10) 486 setDragTokenPlace( DragToken_Up);486 setDragTokenPlace(UIChooserItemDragToken_Up); 487 487 else if (p.y() > minimumSizeHint().toSize().height() - 10) 488 setDragTokenPlace( DragToken_Down);488 setDragTokenPlace(UIChooserItemDragToken_Down); 489 489 else 490 setDragTokenPlace( DragToken_Off);490 setDragTokenPlace(UIChooserItemDragToken_Off); 491 491 } 492 492 } … … 505 505 switch (dragTokenPlace()) 506 506 { 507 case DragToken_Off:507 case UIChooserItemDragToken_Off: 508 508 { 509 509 /* Its our drop, processing: */ -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItem.h
r77462 r77567 31 31 #include "QIGraphicsWidget.h" 32 32 #include "QIWithRetranslateUI.h" 33 #include "UIChooserDefs.h" 33 34 34 35 /* Other VBox includes: */ … … 48 49 49 50 50 /** UIChooserItem types. */51 enum UIChooserItemType52 {53 UIChooserItemType_Any = QGraphicsItem::UserType,54 UIChooserItemType_Group,55 UIChooserItemType_Global,56 UIChooserItemType_Machine57 };58 59 60 /** UIChooserItem search flags. */61 enum UIChooserItemSearchFlag62 {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 DragToken72 {73 DragToken_Off,74 DragToken_Up,75 DragToken_Down76 };77 78 79 51 /** QIGraphicsWidget extension used as interface 80 52 * for graphics chooser model/view architecture. */ … … 222 194 * @param pEvent Brings information about drop event. 223 195 * @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; 225 197 /** Processes item drop. 226 198 * @param pEvent Brings information about drop event. 227 199 * @param pFromWho Brings the item according to which we choose drop position. 228 200 * @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; 230 202 /** Reset drag token. */ 231 203 virtual void resetDragToken() = 0; 232 204 233 205 /** Defines drag token @a enmPlace. */ 234 void setDragTokenPlace( DragToken enmPlace);206 void setDragTokenPlace(UIChooserItemDragToken enmPlace); 235 207 /** Returns drag token place. */ 236 DragToken dragTokenPlace() const;208 UIChooserItemDragToken dragTokenPlace() const; 237 209 /** @} */ 238 210 … … 363 335 * @{ */ 364 336 /** Holds drag token place. */ 365 DragToken m_enmDragTokenPlace;337 UIChooserItemDragToken m_enmDragTokenPlace; 366 338 367 339 /** Holds drag token darkness. */ -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGlobal.cpp
r77462 r77567 370 370 } 371 371 372 bool UIChooserItemGlobal::isDropAllowed(QGraphicsSceneDragDropEvent *, DragToken) const372 bool UIChooserItemGlobal::isDropAllowed(QGraphicsSceneDragDropEvent *, UIChooserItemDragToken) const 373 373 { 374 374 /* No drops at all: */ … … 376 376 } 377 377 378 void UIChooserItemGlobal::processDrop(QGraphicsSceneDragDropEvent *, UIChooserItem *, DragToken)378 void UIChooserItemGlobal::processDrop(QGraphicsSceneDragDropEvent *, UIChooserItem *, UIChooserItemDragToken) 379 379 { 380 380 /* Nothing to process: */ -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGlobal.h
r77462 r77567 164 164 * @param pEvent Brings information about drop event. 165 165 * @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 */; 167 167 /** Processes item drop. 168 168 * @param pEvent Brings information about drop event. 169 169 * @param pFromWho Brings the item according to which we choose drop position. 170 170 * @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 */; 172 172 /** Reset drag token. */ 173 173 virtual void resetDragToken() /* override */; -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGroup.cpp
r77462 r77567 944 944 } 945 945 946 bool UIChooserItemGroup::isDropAllowed(QGraphicsSceneDragDropEvent *pEvent, DragToken where) const946 bool UIChooserItemGroup::isDropAllowed(QGraphicsSceneDragDropEvent *pEvent, UIChooserItemDragToken where) const 947 947 { 948 948 /* No drops while saving groups: */ … … 952 952 const QMimeData *pMimeData = pEvent->mimeData(); 953 953 /* If drag token is shown, its up to parent to decide: */ 954 if (where != DragToken_Off)954 if (where != UIChooserItemDragToken_Off) 955 955 return parentItem()->isDropAllowed(pEvent); 956 956 /* Else we should check mime format: */ … … 1007 1007 } 1008 1008 1009 void UIChooserItemGroup::processDrop(QGraphicsSceneDragDropEvent *pEvent, UIChooserItem *pFromWho, DragToken where)1009 void UIChooserItemGroup::processDrop(QGraphicsSceneDragDropEvent *pEvent, UIChooserItem *pFromWho, UIChooserItemDragToken where) 1010 1010 { 1011 1011 /* Get mime: */ … … 1029 1029 /* Check if we have position information: */ 1030 1030 int iPosition = m_groupItems.size(); 1031 if (pFromWho && where != DragToken_Off)1031 if (pFromWho && where != UIChooserItemDragToken_Off) 1032 1032 { 1033 1033 /* Make sure sender item if our child: */ … … 1036 1036 { 1037 1037 iPosition = m_groupItems.indexOf(pFromWho); 1038 if (where == DragToken_Down)1038 if (where == UIChooserItemDragToken_Down) 1039 1039 ++iPosition; 1040 1040 } … … 1082 1082 /* Check if we have position information: */ 1083 1083 int iPosition = m_machineItems.size(); 1084 if (pFromWho && where != DragToken_Off)1084 if (pFromWho && where != UIChooserItemDragToken_Off) 1085 1085 { 1086 1086 /* Make sure sender item if our child: */ … … 1089 1089 { 1090 1090 iPosition = m_machineItems.indexOf(pFromWho); 1091 if (where == DragToken_Down)1091 if (where == UIChooserItemDragToken_Down) 1092 1092 ++iPosition; 1093 1093 } … … 1123 1123 { 1124 1124 /* 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); 1128 1128 update(); 1129 1129 } … … 1777 1777 1778 1778 /* Paint drag token UP? */ 1779 if (dragTokenPlace() != DragToken_Off)1779 if (dragTokenPlace() != UIChooserItemDragToken_Off) 1780 1780 { 1781 1781 QLinearGradient dragTokenGradient; 1782 1782 QRect dragTokenRect = rect; 1783 if (dragTokenPlace() == DragToken_Up)1783 if (dragTokenPlace() == UIChooserItemDragToken_Up) 1784 1784 { 1785 1785 dragTokenRect.setHeight(5); … … 1787 1787 dragTokenGradient.setFinalStop(dragTokenRect.topLeft()); 1788 1788 } 1789 else if (dragTokenPlace() == DragToken_Down)1789 else if (dragTokenPlace() == UIChooserItemDragToken_Down) 1790 1790 { 1791 1791 dragTokenRect.setTopLeft(dragTokenRect.bottomLeft() - QPoint(0, 5)); -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGroup.h
r77462 r77567 209 209 * @param pEvent Brings information about drop event. 210 210 * @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 */; 212 212 /** Processes item drop. 213 213 * @param pEvent Brings information about drop event. 214 214 * @param pFromWho Brings the item according to which we choose drop position. 215 215 * @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 */; 217 217 /** Reset drag token. */ 218 218 virtual void resetDragToken() /* override */; -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemMachine.cpp
r77462 r77567 449 449 } 450 450 451 bool UIChooserItemMachine::isDropAllowed(QGraphicsSceneDragDropEvent *pEvent, DragToken where) const451 bool UIChooserItemMachine::isDropAllowed(QGraphicsSceneDragDropEvent *pEvent, UIChooserItemDragToken where) const 452 452 { 453 453 /* No drops while saving groups: */ … … 460 460 const QMimeData *pMimeData = pEvent->mimeData(); 461 461 /* If drag token is shown, its up to parent to decide: */ 462 if (where != DragToken_Off)462 if (where != UIChooserItemDragToken_Off) 463 463 return parentItem()->isDropAllowed(pEvent); 464 464 /* Else we should make sure machine is accessible: */ … … 482 482 } 483 483 484 void UIChooserItemMachine::processDrop(QGraphicsSceneDragDropEvent *pEvent, UIChooserItem *pFromWho, DragToken where)484 void UIChooserItemMachine::processDrop(QGraphicsSceneDragDropEvent *pEvent, UIChooserItem *pFromWho, UIChooserItemDragToken where) 485 485 { 486 486 /* Get mime: */ 487 487 const QMimeData *pMime = pEvent->mimeData(); 488 488 /* 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!")); 490 490 Q_UNUSED(pFromWho); 491 491 Q_UNUSED(where); … … 538 538 { 539 539 /* 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); 543 543 update(); 544 544 } … … 1037 1037 1038 1038 /* Paint drag token UP? */ 1039 if (dragTokenPlace() != DragToken_Off)1039 if (dragTokenPlace() != UIChooserItemDragToken_Off) 1040 1040 { 1041 1041 /* Window color: */ … … 1045 1045 QLinearGradient dragTokenGradient; 1046 1046 QRect dragTokenRect = rectangle; 1047 if (dragTokenPlace() == DragToken_Up)1047 if (dragTokenPlace() == UIChooserItemDragToken_Up) 1048 1048 { 1049 1049 /* Selection background: */ … … 1066 1066 dragTokenGradient.setFinalStop(dragTokenRect.topLeft()); 1067 1067 } 1068 else if (dragTokenPlace() == DragToken_Down)1068 else if (dragTokenPlace() == UIChooserItemDragToken_Down) 1069 1069 { 1070 1070 /* Selection background: */ … … 1121 1121 1122 1122 /* Draw borders: */ 1123 if (dragTokenPlace() != DragToken_Up)1123 if (dragTokenPlace() != UIChooserItemDragToken_Up) 1124 1124 pPainter->drawLine(rectangle.topLeft(), rectangle.topRight() + QPoint(1, 0)); 1125 if (dragTokenPlace() != DragToken_Down)1125 if (dragTokenPlace() != UIChooserItemDragToken_Down) 1126 1126 pPainter->drawLine(rectangle.bottomLeft(), rectangle.bottomRight() + QPoint(1, 0)); 1127 1127 pPainter->drawLine(rectangle.topLeft(), rectangle.bottomLeft()); -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemMachine.h
r77462 r77567 173 173 * @param pEvent Brings information about drop event. 174 174 * @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 */; 176 176 /** Processes item drop. 177 177 * @param pEvent Brings information about drop event. 178 178 * @param pFromWho Brings the item according to which we choose drop position. 179 179 * @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 */; 181 181 /** Reset drag token. */ 182 182 virtual void resetDragToken() /* override */;
Note:
See TracChangeset
for help on using the changeset viewer.