- Timestamp:
- Feb 10, 2025 5:54:21 PM (3 months ago)
- svn:sync-xref-src-repo-rev:
- 167452
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser
- Files:
-
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserAbstractModel.cpp
r108138 r108147 587 587 switch (enmType) 588 588 { 589 /* Global nodes: */590 case UIChooserNodeDataOptionType_GlobalFavorite: return "f";591 589 /* Group nodes: */ 592 case UIChooserNodeDataOptionType_GroupOpened: 590 case UIChooserNodeDataOptionType_GroupOpened: return "o"; 593 591 } 594 592 return QString(); … … 1471 1469 const QString strDescriptor = mt.captured(1); 1472 1470 if (strDescriptor.contains(strNodeOptionOpened)) 1473 return true;1474 }1475 }1476 1477 /* Return 'false' by default: */1478 return false;1479 }1480 1481 bool UIChooserAbstractModel::shouldGlobalNodeBeFavorite(UIChooserNode *pParentNode) const1482 {1483 /* Read group definitions: */1484 const QStringList definitions = gEDataManager->machineGroupDefinitions(pParentNode->fullName());1485 /* Return 'false' if no definitions found: */1486 if (definitions.isEmpty())1487 return false;1488 1489 /* Prepare required group definition reg-exp: */1490 const QString strNodePrefix = prefixToString(UIChooserNodeDataPrefixType_Global);1491 const QString strNodeOptionFavorite = optionToString(UIChooserNodeDataOptionType_GlobalFavorite);1492 const QString strNodeValueDefault = valueToString(UIChooserNodeDataValueType_GlobalDefault);1493 const QString strDefinitionTemplate = QString("%1(\\S)*=%2").arg(strNodePrefix, strNodeValueDefault);1494 const QRegularExpression re(strDefinitionTemplate);1495 /* For each the group definition: */1496 foreach (const QString &strDefinition, definitions)1497 {1498 /* Check if this is required definition: */1499 const QRegularExpressionMatch mt = re.match(strDefinition);1500 if (mt.capturedStart() == 0)1501 {1502 /* Get group descriptor: */1503 const QString strDescriptor = mt.captured(1);1504 if (strDescriptor.contains(strNodeOptionFavorite))1505 1471 return true; 1506 1472 } -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserAbstractModel.h
r106061 r108147 313 313 UIChooserNodeDataPrefixType enmDataType, 314 314 const QString &strName) const; 315 /** Returns whether global node should be favorite,316 * searching starting from the passed @a pParentNode. */317 bool shouldGlobalNodeBeFavorite(UIChooserNode *pParentNode) const;318 315 319 316 /** Wipes out empty groups starting from @a pParentItem. */ -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserDefs.h
r106061 r108147 73 73 enum UIChooserNodeDataOptionType 74 74 { 75 UIChooserNodeDataOptionType_GlobalFavorite,76 75 UIChooserNodeDataOptionType_GroupOpened 77 76 }; -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserHandlerMouse.cpp
r106061 r108147 90 90 pClickedItem = pGlobalItem; 91 91 } 92 else93 if ( pGlobalItem->isPinButtonArea(itemCursorPos)94 && ( model()->firstSelectedItem() == pGlobalItem95 || pGlobalItem->isHovered()))96 model()->handlePinButtonClick(pGlobalItem);97 92 else 98 93 pClickedItem = pGlobalItem; -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItem.cpp
r106061 r108147 397 397 } 398 398 399 bool UIChooserItem::isFavorite() const400 {401 return node()->isFavorite();402 }403 404 void UIChooserItem::setFavorite(bool fFavorite)405 {406 node()->setFavorite(fFavorite);407 if (m_pParent)408 m_pParent->toGroupItem()->updateFavorites();409 }410 411 399 int UIChooserItem::position() const 412 400 { -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItem.h
r106061 r108147 136 136 QString definition() const; 137 137 138 /** Returns whether item is favorite. */139 bool isFavorite() const;140 /** Defines whether item is @a fFavorite. */141 virtual void setFavorite(bool fFavorite);142 143 138 /** Returns item position. */ 144 139 int position() const; … … 174 169 virtual QList<UIChooserItem*> items(UIChooserNodeType enmType = UIChooserNodeType_Any) const = 0; 175 170 176 /** Adds possible @a fFavoritechild @a pItem to certain @a iPosition. */177 virtual void addItem(UIChooserItem *pItem, bool fFavorite,int iPosition) = 0;171 /** Adds a child @a pItem to certain @a iPosition. */ 172 virtual void addItem(UIChooserItem *pItem, int iPosition) = 0; 178 173 /** Removes child @a pItem. */ 179 174 virtual void removeItem(UIChooserItem *pItem) = 0; -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGlobal.cpp
r106061 r108147 88 88 } 89 89 90 bool UIChooserItemGlobal::isPinButtonArea(const QPoint &position, int iMarginMultiplier /* = 1 */) const91 {92 const int iFullWidth = geometry().width();93 const int iFullHeight = geometry().height();94 const int iMarginHR = data(GlobalItemData_MarginHR).toInt();95 const int iSpacing = data(GlobalItemData_Spacing).toInt();96 const int iButtonMargin = data(GlobalItemData_ButtonMargin).toInt();97 const int iPinPixmapX = iFullWidth - iMarginHR - 198 - m_toolPixmap.width() / m_toolPixmap.devicePixelRatio()99 - iSpacing100 - m_pinPixmap.width() / m_pinPixmap.devicePixelRatio();101 const int iPinPixmapY = (iFullHeight - m_pinPixmap.height() / m_pinPixmap.devicePixelRatio()) / 2;102 QRect rect = QRect(iPinPixmapX,103 iPinPixmapY,104 m_pinPixmap.width() / m_pinPixmap.devicePixelRatio(),105 m_pinPixmap.height() / m_pinPixmap.devicePixelRatio());106 rect.adjust(-iMarginMultiplier * iButtonMargin, -iMarginMultiplier * iButtonMargin,107 iMarginMultiplier * iButtonMargin, iMarginMultiplier * iButtonMargin);108 return rect.contains(position);109 }110 111 90 int UIChooserItemGlobal::heightHint() const 112 91 { … … 174 153 } 175 154 176 void UIChooserItemGlobal::setFavorite(bool fFavorite)177 {178 /* Call to base-class: */179 UIChooserItem::setFavorite(fFavorite);180 181 /* Update pin-pixmap: */182 updatePinPixmap();183 }184 185 155 void UIChooserItemGlobal::startEditing() 186 156 { … … 212 182 } 213 183 214 void UIChooserItemGlobal::addItem(UIChooserItem *, bool,int)184 void UIChooserItemGlobal::addItem(UIChooserItem *, int) 215 185 { 216 186 AssertMsgFailed(("Global graphics item do NOT support children!")); … … 259 229 m_iMinimumNameWidth + 260 230 iSpacing + 261 m_toolPixmapSize.width() + 262 iSpacing + 263 m_pinPixmapSize.width()); 231 m_toolPixmapSize.width()); 264 232 265 233 /* Return result: */ … … 278 246 int iContentHeight = qMax(m_pixmapSize.height(), m_visibleNameSize.height()); 279 247 iContentHeight = qMax(iContentHeight, m_toolPixmapSize.height()); 280 iContentHeight = qMax(iContentHeight, m_pinPixmapSize.height());281 248 282 249 /* If we have height hint: */ … … 371 338 /* Add item to the parent: */ 372 339 AssertPtrReturnVoid(parentItem()); 373 parentItem()->addItem(this, isFavorite(),position());340 parentItem()->addItem(this, position()); 374 341 375 342 /* Configure connections: */ … … 436 403 /* Update tool-pixmap: */ 437 404 updateToolPixmap(); 438 /* Update pin-pixmap: */439 updatePinPixmap();440 405 } 441 406 … … 484 449 { 485 450 m_toolPixmap = toolPixmap; 486 update();487 }488 }489 490 void UIChooserItemGlobal::updatePinPixmap()491 {492 /* Determine icon metric: */493 const int iIconMetric = QApplication::style()->pixelMetric(QStyle::PM_LargeIconSize) * .75;494 /* Create new tool-pixmap and tool-pixmap size: */495 const QIcon pinIcon = UIIconPool::iconSet(isFavorite() ? ":/favorite_pressed_24px.png" : ":/favorite_24px.png");496 AssertReturnVoid(!pinIcon.isNull());497 const QSize pinPixmapSize = QSize(iIconMetric, iIconMetric);498 const qreal fDevicePixelRatio = gpManager->windowHandle() ? gpManager->windowHandle()->devicePixelRatio() : 1;499 const QPixmap pinPixmap = pinIcon.pixmap(pinPixmapSize, fDevicePixelRatio);500 /* Update linked values: */501 if (m_pinPixmapSize != pinPixmapSize)502 {503 m_pinPixmapSize = pinPixmapSize;504 updateGeometry();505 }506 if (m_pinPixmap.toImage() != pinPixmap.toImage())507 {508 m_pinPixmap = pinPixmap;509 451 update(); 510 452 } … … 813 755 m_toolPixmap); 814 756 } 815 816 /* Calculate indents: */ 817 iRightColumnIndent = iRightColumnIndent - m_toolPixmap.width() / m_toolPixmap.devicePixelRatio() - iSpacing; 818 819 /* Paint right column: */ 820 if ( model()->firstSelectedItem() == this 821 || isHovered()) 822 { 823 /* Prepare variables: */ 824 const int iPinPixmapX = iRightColumnIndent; 825 const int iPinPixmapY = (iFullHeight - m_pinPixmap.height() / m_pinPixmap.devicePixelRatio()) / 2; 826 QRect pinButtonRectangle = QRect(iPinPixmapX, 827 iPinPixmapY, 828 m_pinPixmap.width() / m_pinPixmap.devicePixelRatio(), 829 m_pinPixmap.height() / m_pinPixmap.devicePixelRatio()); 830 pinButtonRectangle.adjust(- iButtonMargin, -iButtonMargin, iButtonMargin, iButtonMargin); 831 832 /* Paint pin button: */ 833 if ( isHovered() 834 && isPinButtonArea(itemCursorPosition, 4)) 835 paintFlatButton(/* Painter: */ 836 pPainter, 837 /* Button rectangle: */ 838 pinButtonRectangle, 839 /* Cursor position: */ 840 itemCursorPosition); 841 842 /* Paint pixmap: */ 843 paintPixmap(/* Painter: */ 844 pPainter, 845 /* Point to paint in: */ 846 QPoint(iPinPixmapX, iPinPixmapY), 847 /* Pixmap to paint: */ 848 m_pinPixmap); 849 } 850 } 757 } -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGlobal.h
r106061 r108147 61 61 /** Returns whether passed @a position belongs to tool button area. */ 62 62 bool isToolButtonArea(const QPoint &position, int iMarginMultiplier = 1) const; 63 /** Returns whether passed @a position belongs to pin button area. */64 bool isPinButtonArea(const QPoint &position, int iMarginMultiplier = 1) const;65 63 /** @} */ 66 64 … … 95 93 virtual int type() const RT_OVERRIDE { return Type; } 96 94 97 /** Defines whether item is @a fFavorite. */98 virtual void setFavorite(bool fFavorite) RT_OVERRIDE;99 100 95 /** Starts item editing. */ 101 96 virtual void startEditing() RT_OVERRIDE; … … 112 107 virtual QList<UIChooserItem*> items(UIChooserNodeType enmType = UIChooserNodeType_Any) const RT_OVERRIDE; 113 108 114 /** Adds possible @a fFavoritechild @a pItem to certain @a iPosition. */115 virtual void addItem(UIChooserItem *pItem, bool fFavorite,int iPosition) RT_OVERRIDE;109 /** Adds a child @a pItem to certain @a iPosition. */ 110 virtual void addItem(UIChooserItem *pItem, int iPosition) RT_OVERRIDE; 116 111 /** Removes child @a pItem. */ 117 112 virtual void removeItem(UIChooserItem *pItem) RT_OVERRIDE; … … 210 205 /** Updates tool pixmap. */ 211 206 void updateToolPixmap(); 212 /** Updates pin pixmap. */213 void updatePinPixmap();214 207 /** Updates minimum name width. */ 215 208 void updateMinimumNameWidth(); … … 249 242 /** Holds item tool pixmap. */ 250 243 QPixmap m_toolPixmap; 251 /** Holds item pin pixmap. */252 QPixmap m_pinPixmap;253 244 254 245 /** Holds item visible name. */ … … 265 256 /** Holds tool pixmap size. */ 266 257 QSize m_toolPixmapSize; 267 /** Holds pin pixmap size. */268 QSize m_pinPixmapSize;269 258 /** Holds visible name size. */ 270 259 QSize m_visibleNameSize; -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGroup.cpp
r106061 r108147 70 70 , m_pToggleButton(0) 71 71 , m_pNameEditorWidget(0) 72 , m_pContainerFavorite(0)73 , m_pLayoutFavorite(0)74 72 , m_pScrollArea(0) 75 73 , m_pContainer(0) … … 94 92 , m_pToggleButton(0) 95 93 , m_pNameEditorWidget(0) 96 , m_pContainerFavorite(0)97 , m_pLayoutFavorite(0)98 94 , m_pScrollArea(0) 99 95 , m_pContainer(0) … … 147 143 AssertMsg(!isRoot(), ("Can't open root-item!")); 148 144 m_pToggleButton->setToggled(true, fAnimated); 149 }150 151 void UIChooserItemGroup::updateFavorites()152 {153 /* Global items only for now, move items to corresponding layout: */154 foreach (UIChooserItem *pItem, items(UIChooserNodeType_Global))155 if (pItem->isFavorite())156 {157 for (int iIndex = 0; iIndex < m_pLayoutGlobal->count(); ++iIndex)158 if (m_pLayoutGlobal->itemAt(iIndex) == pItem)159 m_pLayoutFavorite->addItem(pItem);160 }161 else162 {163 for (int iIndex = 0; iIndex < m_pLayoutFavorite->count(); ++iIndex)164 if (m_pLayoutFavorite->itemAt(iIndex) == pItem)165 m_pLayoutGlobal->addItem(pItem);166 }167 168 /* Update/activate children layout: */169 m_pLayout->updateGeometry();170 m_pLayout->activate();171 172 /* Relayout model: */173 model()->updateLayout();174 145 } 175 146 … … 412 383 } 413 384 414 void UIChooserItemGroup::addItem(UIChooserItem *pItem, bool fFavorite,int iPosition)385 void UIChooserItemGroup::addItem(UIChooserItem *pItem, int iPosition) 415 386 { 416 387 /* Check item type: */ … … 422 393 if (iPosition < 0 || iPosition >= m_globalItems.size()) 423 394 { 424 if (fFavorite) 425 m_pLayoutFavorite->addItem(pItem); 426 else 427 m_pLayoutGlobal->addItem(pItem); 395 m_pLayoutGlobal->addItem(pItem); 428 396 m_globalItems.append(pItem); 429 397 } 430 398 else 431 399 { 432 if (fFavorite) 433 m_pLayoutFavorite->insertItem(iPosition, pItem); 434 else 435 m_pLayoutGlobal->insertItem(iPosition, pItem); 400 m_pLayoutGlobal->insertItem(iPosition, pItem); 436 401 m_globalItems.insert(iPosition, pItem); 437 402 } … … 491 456 AssertMsg(m_globalItems.contains(pItem), ("Global-item was not found!")); 492 457 m_globalItems.removeAt(m_globalItems.indexOf(pItem)); 493 if (pItem->isFavorite()) 494 m_pLayoutFavorite->removeItem(pItem); 495 else 496 m_pLayoutGlobal->removeItem(pItem); 458 m_pLayoutGlobal->removeItem(pItem); 497 459 break; 498 460 } … … 501 463 AssertMsg(m_groupItems.contains(pItem), ("Group-item was not found!")); 502 464 m_groupItems.removeAt(m_groupItems.indexOf(pItem)); 503 if (pItem->isFavorite()) 504 m_pLayoutFavorite->removeItem(pItem); 505 else 506 m_pLayoutGroup->removeItem(pItem); 465 m_pLayoutGroup->removeItem(pItem); 507 466 break; 508 467 } … … 511 470 AssertMsg(m_machineItems.contains(pItem), ("Machine-item was not found!")); 512 471 m_machineItems.removeAt(m_machineItems.indexOf(pItem)); 513 if (pItem->isFavorite()) 514 m_pLayoutFavorite->removeItem(pItem); 515 else 516 m_pLayoutMachine->removeItem(pItem); 472 m_pLayoutMachine->removeItem(pItem); 517 473 break; 518 474 } … … 641 597 QSize viewSize = pView->size(); 642 598 viewSize.setHeight(viewSize.height() - iPreviousVerticalIndent); 643 /* Adjust favorite children container: */644 m_pContainerFavorite->resize(viewSize.width(), m_pContainerFavorite->minimumSizeHint().height());645 m_pContainerFavorite->setPos(0, iPreviousVerticalIndent);646 iPreviousVerticalIndent += m_pContainerFavorite->minimumSizeHint().height();647 599 /* Adjust other children scroll-area: */ 648 m_pScrollArea->resize(viewSize.width(), viewSize.height() - m_pContainerFavorite->minimumSizeHint().height());600 m_pScrollArea->resize(viewSize.width(), viewSize.height()); 649 601 m_pScrollArea->setPos(0, iPreviousVerticalIndent); 650 602 } … … 672 624 QSize itemSize = size().toSize(); 673 625 itemSize.setHeight(itemSize.height() - iPreviousVerticalIndent); 674 /* Adjust favorite children container: */675 m_pContainerFavorite->resize(itemSize.width() - iParentIndent, m_pContainerFavorite->minimumSizeHint().height());676 m_pContainerFavorite->setPos(iParentIndent, iPreviousVerticalIndent);677 iPreviousVerticalIndent += m_pContainerFavorite->minimumSizeHint().height();678 626 /* Adjust other children scroll-area: */ 679 m_pScrollArea->resize(itemSize.width() - iParentIndent, itemSize.height() - m_pContainerFavorite->minimumSizeHint().height());627 m_pScrollArea->resize(itemSize.width() - iParentIndent, itemSize.height()); 680 628 m_pScrollArea->setPos(iParentIndent, iPreviousVerticalIndent); 681 629 } … … 684 632 if (isClosed()) 685 633 { 686 m_pContainerFavorite->hide();687 634 m_pScrollArea->hide(); 688 635 } … … 690 637 else 691 638 { 692 m_pContainerFavorite->show();693 639 m_pScrollArea->show(); 694 640 foreach (UIChooserItem *pItem, items()) … … 1107 1053 } 1108 1054 1109 /* Prepare favorite children container: */1110 m_pContainerFavorite = new QIGraphicsWidget(this);1111 if (m_pContainerFavorite)1112 {1113 /* Make it always above other children scroll-area: */1114 m_pContainerFavorite->setZValue(1);1115 1116 /* Prepare favorite children layout: */1117 m_pLayoutFavorite = new QGraphicsLinearLayout(Qt::Vertical, m_pContainerFavorite);1118 if (m_pLayoutFavorite)1119 {1120 m_pLayoutFavorite->setContentsMargins(0, 0, 0, 0);1121 m_pLayoutFavorite->setSpacing(0);1122 }1123 }1124 1125 1055 /* Prepare scroll-area: */ 1126 1056 m_pScrollArea = new UIGraphicsScrollArea(Qt::Vertical, this); … … 1177 1107 * it will be added to the scene indirectly: */ 1178 1108 else if (parentItem()) 1179 parentItem()->addItem(this, isFavorite(),position());1109 parentItem()->addItem(this, position()); 1180 1110 /* Otherwise sombody forgot to pass scene or parent. */ 1181 1111 else … … 1405 1335 { 1406 1336 /* We have to take maximum children width into account: */ 1407 iProposedWidth = qMax(m_pContainerFavorite->minimumSizeHint().width(), 1408 m_pContainer->minimumSizeHint().width()); 1337 iProposedWidth = m_pContainer->minimumSizeHint().width(); 1409 1338 } 1410 1339 } … … 1423 1352 { 1424 1353 /* We have to take maximum children width into account: */ 1425 iProposedWidth = qMax(m_pContainerFavorite->minimumSizeHint().width(), 1426 m_pContainer->minimumSizeHint().width()); 1354 iProposedWidth = m_pContainer->minimumSizeHint().width(); 1427 1355 } 1428 1356 … … 1450 1378 1451 1379 /* We have to take maximum children height into account: */ 1452 iProposedHeight += m_pContainerFavorite->minimumSizeHint().height();1453 1380 iProposedHeight += m_pContainer->minimumSizeHint().height(); 1454 1381 iProposedHeight += iSpacingV; … … 1470 1397 { 1471 1398 /* We have to take maximum children height into account: */ 1472 iProposedHeight += m_pContainerFavorite->minimumSizeHint().height();1473 1399 iProposedHeight += m_pContainer->minimumSizeHint().height(); 1474 1400 } -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGroup.h
r106061 r108147 102 102 /** @} */ 103 103 104 /** @name Children stuff.105 * @{ */106 /** Updates positions of favorite items. */107 void updateFavorites();108 /** @} */109 110 104 /** @name Navigation stuff. 111 105 * @{ */ … … 170 164 virtual QList<UIChooserItem*> items(UIChooserNodeType enmType = UIChooserNodeType_Any) const RT_OVERRIDE; 171 165 172 /** Adds possible @a fFavoritechild @a pItem to certain @a iPosition. */173 virtual void addItem(UIChooserItem *pItem, bool fFavorite,int iPosition) RT_OVERRIDE;166 /** Adds a child @a pItem to certain @a iPosition. */ 167 virtual void addItem(UIChooserItem *pItem, int iPosition) RT_OVERRIDE; 174 168 /** Removes child @a pItem. */ 175 169 virtual void removeItem(UIChooserItem *pItem) RT_OVERRIDE; … … 370 364 /** @name Children stuff. 371 365 * @{ */ 372 /** Holds the favorite children container instance. */373 QIGraphicsWidget *m_pContainerFavorite;374 /** Holds the favorite children layout instance. */375 QGraphicsLinearLayout *m_pLayoutFavorite;376 377 366 /** Holds the children scroll-area instance. */ 378 UIGraphicsScrollArea 367 UIGraphicsScrollArea *m_pScrollArea; 379 368 /** Holds the children container instance. */ 380 QIGraphicsWidget 369 QIGraphicsWidget *m_pContainer; 381 370 382 371 /** Holds the main layout instance. */ -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemMachine.cpp
r106061 r108147 284 284 } 285 285 286 void UIChooserItemMachine::addItem(UIChooserItem*, bool,int)286 void UIChooserItemMachine::addItem(UIChooserItem*, int) 287 287 { 288 288 AssertMsgFailed(("Machine graphics item do NOT support children!")); … … 597 597 /* Add item to the parent: */ 598 598 AssertPtrReturnVoid(parentItem()); 599 parentItem()->addItem(this, isFavorite(),position());599 parentItem()->addItem(this, position()); 600 600 601 601 /* Configure connections: */ -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemMachine.h
r106061 r108147 130 130 virtual QList<UIChooserItem*> items(UIChooserNodeType enmType = UIChooserNodeType_Any) const RT_OVERRIDE; 131 131 132 /** Adds possible @a fFavoritechild @a pItem to certain @a iPosition. */133 virtual void addItem(UIChooserItem *pItem, bool fFavorite,int iPosition) RT_OVERRIDE;132 /** Adds a child @a pItem to certain @a iPosition. */ 133 virtual void addItem(UIChooserItem *pItem, int iPosition) RT_OVERRIDE; 134 134 /** Removes child @a pItem. */ 135 135 virtual void removeItem(UIChooserItem *pItem) RT_OVERRIDE; -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.cpp
r108138 r108147 127 127 emit sigToolMenuRequested(pItem->mapToScene(QPointF(pItem->size().width(), 0)).toPoint(), 128 128 pItem->type() == UIChooserNodeType_Machine ? pItem->toMachineItem()->cache() : 0); 129 }130 131 void UIChooserModel::handlePinButtonClick(UIChooserItem *pItem)132 {133 switch (pItem->type())134 {135 case UIChooserNodeType_Global:136 pItem->setFavorite(!pItem->isFavorite());137 break;138 default:139 break;140 }141 129 } 142 130 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.h
r106061 r108147 121 121 /** Handles tool button click for certain @a pItem. */ 122 122 void handleToolButtonClick(UIChooserItem *pItem); 123 /** Handles pin button click for certain @a pItem. */124 void handlePinButtonClick(UIChooserItem *pItem);125 123 /** @} */ 126 124 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserNode.cpp
r106061 r108147 36 36 37 37 38 UIChooserNode::UIChooserNode(UIChooserNode *pParent /* = 0 */ , bool fFavorite /* = false */)38 UIChooserNode::UIChooserNode(UIChooserNode *pParent /* = 0 */) 39 39 : QObject(pParent) 40 40 , m_pParent(pParent) 41 , m_fFavorite(fFavorite)42 41 , m_pModel(0) 43 42 , m_fDisabled(false) -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserNode.h
r106061 r108147 57 57 public: 58 58 59 /** Constructs chooser node passing @a pParent to the base-class. 60 * @param fFavorite Brings whether the node is favorite. */ 61 UIChooserNode(UIChooserNode *pParent = 0, bool fFavorite = false); 59 /** Constructs chooser node passing @a pParent to the base-class. */ 60 UIChooserNode(UIChooserNode *pParent = 0); 62 61 /** Destructs chooser node. */ 63 62 virtual ~UIChooserNode() RT_OVERRIDE; … … 79 78 /** Returns root node reference. */ 80 79 UIChooserNode *rootNode() const; 81 82 /** Returns whether the node is favorite. */83 bool isFavorite() const { return m_fFavorite; }84 /** Defines whether the node is @a fFavorite. */85 void setFavorite(bool fFavorite) { m_fFavorite = fFavorite; }86 80 87 81 /** Defines the @a pModel reference. */ … … 143 137 144 138 /** Holds the parent node reference. */ 145 UIChooserNode *m_pParent; 146 /** Holds whether the node is favorite. */ 147 bool m_fFavorite; 139 UIChooserNode *m_pParent; 148 140 149 141 /** Holds the model reference. */ … … 157 149 158 150 /** Holds the flag to indicate whether the node is disabled or not. */ 159 bool m_fDisabled; 160 151 bool m_fDisabled; 161 152 }; 162 153 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserNodeGlobal.cpp
r106061 r108147 37 37 UIChooserNodeGlobal::UIChooserNodeGlobal(UIChooserNode *pParent, 38 38 int iPosition, 39 bool fFavorite,40 39 const QString &) 41 : UIChooserNode(pParent , fFavorite)40 : UIChooserNode(pParent) 42 41 { 43 42 /* Add to parent: */ … … 54 53 int iPosition, 55 54 UIChooserNodeGlobal *pCopyFrom) 56 : UIChooserNode(pParent , pCopyFrom->isFavorite())55 : UIChooserNode(pParent) 57 56 { 58 57 /* Add to parent: */ … … 91 90 } 92 91 93 QString UIChooserNodeGlobal::definition(bool fFull /* = false */) const92 QString UIChooserNodeGlobal::definition(bool) const 94 93 { 95 94 const QString strNodePrefix = UIChooserAbstractModel::prefixToString(UIChooserNodeDataPrefixType_Global); 96 const QString strNodeOptionFavorite = UIChooserAbstractModel::optionToString(UIChooserNodeDataOptionType_GlobalFavorite);97 95 const QString strNodeValueDefault = UIChooserAbstractModel::valueToString(UIChooserNodeDataValueType_GlobalDefault); 98 return fFull 99 ? QString("%1%2=%3").arg(strNodePrefix).arg(isFavorite() ? strNodeOptionFavorite : "").arg(strNodeValueDefault) 100 : QString("%1=%2").arg(strNodePrefix).arg(strNodeValueDefault); 96 return QString("%1=%2").arg(strNodePrefix).arg(strNodeValueDefault); 101 97 } 102 98 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserNodeGlobal.h
r106061 r108147 45 45 /** Constructs chooser node passing @a pParent to the base-class. 46 46 * @param iPosition Brings the initial node position. 47 * @param fFavorite Brings whether the node is favorite.48 47 * @param strTip Brings the dummy tip. */ 49 48 UIChooserNodeGlobal(UIChooserNode *pParent, 50 49 int iPosition, 51 bool fFavorite,52 50 const QString &strTip); 53 51 /** Constructs chooser node passing @a pParent to the base-class. -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserNodeGroup.cpp
r108138 r108147 43 43 UIChooserNodeGroupType enmGroupType, 44 44 bool fOpened) 45 : UIChooserNode(pParent , false /* favorite */)45 : UIChooserNode(pParent) 46 46 , m_uId(uId) 47 47 , m_strName(strName) … … 62 62 int iPosition, 63 63 UIChooserNodeGroup *pCopyFrom) 64 : UIChooserNode(pParent , false /* favorite */)64 : UIChooserNode(pParent) 65 65 , m_uId(pCopyFrom->id()) 66 66 , m_strName(pCopyFrom->name()) -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserNodeMachine.cpp
r106061 r108147 40 40 int iPosition, 41 41 const CMachine &comMachine) 42 : UIChooserNode(pParent , false /* favorite */)42 : UIChooserNode(pParent) 43 43 , m_pCache(new UIVirtualMachineItemLocal(comMachine)) 44 44 { … … 56 56 int iPosition, 57 57 const CCloudMachine &comCloudMachine) 58 : UIChooserNode(pParent , false /* favorite */)58 : UIChooserNode(pParent) 59 59 , m_pCache(new UIVirtualMachineItemCloud(comCloudMachine)) 60 60 { … … 80 80 int iPosition, 81 81 UIFakeCloudVirtualMachineItemState enmState) 82 : UIChooserNode(pParent , false /* favorite */)82 : UIChooserNode(pParent) 83 83 , m_pCache(new UIVirtualMachineItemCloud(enmState)) 84 84 { … … 96 96 int iPosition, 97 97 UIChooserNodeMachine *pCopyFrom) 98 : UIChooserNode(pParent , pCopyFrom->isFavorite())98 : UIChooserNode(pParent) 99 99 { 100 100 /* Prepare cache of corresponding type: */
Note:
See TracChangeset
for help on using the changeset viewer.