- Timestamp:
- Jan 29, 2020 6:28:06 PM (5 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser
- Files:
-
- 6 edited
-
UIChooserAbstractModel.cpp (modified) (3 diffs)
-
UIChooserItemGroup.cpp (modified) (1 diff)
-
UIChooserItemMachine.cpp (modified) (12 diffs)
-
UIChooserModel.cpp (modified) (2 diffs)
-
UIChooserNodeMachine.cpp (modified) (6 diffs)
-
UIChooserNodeMachine.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserAbstractModel.cpp
r80881 r82917 503 503 /* Which position should be current node placed by definitions? */ 504 504 QString strDefinitionName = pNode->type() == UIChooserItemType_Group ? pNode->name() : 505 pNode->type() == UIChooserItemType_Machine ? toOldStyleUuid(pNode->toMachineNode()-> id()) :505 pNode->type() == UIChooserItemType_Machine ? toOldStyleUuid(pNode->toMachineNode()->cache()->id()) : 506 506 QString(); 507 507 AssertMsg(!strDefinitionName.isEmpty(), ("Wrong definition name!")); … … 620 620 foreach (UIChooserNode *pNode, pParentGroup->nodes(UIChooserItemType_Machine)) 621 621 if (UIChooserNodeMachine *pMachineNode = pNode->toMachineNode()) 622 if (pMachineNode-> accessible())623 definitions[toOldStyleUuid(pMachineNode-> id())] << pParentGroup->fullName();622 if (pMachineNode->cache()->accessible()) 623 definitions[toOldStyleUuid(pMachineNode->cache()->id())] << pParentGroup->fullName(); 624 624 /* Iterate over all the group-nodes: */ 625 625 foreach (UIChooserNode *pNode, pParentGroup->nodes(UIChooserItemType_Group)) … … 647 647 /* Iterate over all the machine-nodes: */ 648 648 foreach (UIChooserNode *pNode, pParentItem->nodes(UIChooserItemType_Machine)) 649 orders[strExtraDataKey] << QString("m=%1").arg(toOldStyleUuid(pNode->toMachineNode()-> id()));649 orders[strExtraDataKey] << QString("m=%1").arg(toOldStyleUuid(pNode->toMachineNode()->cache()->id())); 650 650 } 651 651 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGroup.cpp
r79461 r82917 322 322 int iCountOfStartedMachineItems = 0; 323 323 foreach (UIChooserItem *pItem, items(UIChooserItemType_Machine)) 324 if (UIVirtualMachineItem::isItemStarted(pItem->node()->toMachineNode() ))324 if (UIVirtualMachineItem::isItemStarted(pItem->node()->toMachineNode()->cache())) 325 325 ++iCountOfStartedMachineItems; 326 326 /* Template: */ -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemMachine.cpp
r79388 r82917 60 60 QUuid UIChooserItemMachine::id() const 61 61 { 62 return node()->toMachineNode()-> id();62 return node()->toMachineNode()->cache()->id(); 63 63 } 64 64 65 65 bool UIChooserItemMachine::accessible() const 66 66 { 67 return node()->toMachineNode()-> accessible();67 return node()->toMachineNode()->cache()->accessible(); 68 68 } 69 69 70 70 void UIChooserItemMachine::recache() 71 71 { 72 node()->toMachineNode()-> recache();72 node()->toMachineNode()->cache()->recache(); 73 73 } 74 74 75 75 bool UIChooserItemMachine::isLockedMachine() const 76 76 { 77 const KMachineState enmState = node()->toMachineNode()-> machineState();77 const KMachineState enmState = node()->toMachineNode()->cache()->machineState(); 78 78 return enmState != KMachineState_PoweredOff && 79 79 enmState != KMachineState_Saved && … … 153 153 154 154 /* Recache and update pixmaps: */ 155 node()->toMachineNode()-> recachePixmap();155 node()->toMachineNode()->cache()->recachePixmap(); 156 156 updatePixmaps(); 157 157 } … … 219 219 void UIChooserItemMachine::updateToolTip() 220 220 { 221 setToolTip(node()->toMachineNode()-> toolTipText());221 setToolTip(node()->toMachineNode()->cache()->toolTipText()); 222 222 } 223 223 … … 289 289 /* And machine-item content to take into account: */ 290 290 int iTopLineWidth = m_iMinimumNameWidth; 291 if (!node()->toMachineNode()-> snapshotName().isEmpty())291 if (!node()->toMachineNode()->cache()->snapshotName().isEmpty()) 292 292 iTopLineWidth += (iMinorSpacing + 293 293 m_iMinimumSnapshotNameWidth); … … 472 472 { 473 473 /* Recache and update pixmaps: */ 474 node()->toMachineNode()-> recachePixmap();474 node()->toMachineNode()->cache()->recachePixmap(); 475 475 updatePixmaps(); 476 476 } … … 589 589 /* Get new pixmap and pixmap-size: */ 590 590 QSize pixmapSize; 591 QPixmap pixmap = node()->toMachineNode()-> osPixmap(&pixmapSize);591 QPixmap pixmap = node()->toMachineNode()->cache()->osPixmap(&pixmapSize); 592 592 /* Update linked values: */ 593 593 if (m_pixmapSize != pixmapSize) … … 609 609 const int iIconMetric = QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize); 610 610 /* Get new state-pixmap and state-pixmap size: */ 611 const QIcon stateIcon = node()->toMachineNode()-> machineStateIcon();611 const QIcon stateIcon = node()->toMachineNode()->cache()->machineStateIcon(); 612 612 AssertReturnVoid(!stateIcon.isNull()); 613 613 const QSize statePixmapSize = QSize(iIconMetric, iIconMetric); … … 700 700 int iMinimumSnapshotNameWidth = 0; 701 701 /* Is there any snapshot exists? */ 702 if (!node()->toMachineNode()-> snapshotName().isEmpty())702 if (!node()->toMachineNode()->cache()->snapshotName().isEmpty()) 703 703 { 704 704 QFontMetrics fm(m_snapshotNameFont, model()->paintDevice()); 705 705 int iBracketWidth = fm.width("()"); /* bracket width */ 706 int iActualTextWidth = fm.width(node()->toMachineNode()-> snapshotName()); /* snapshot-name width */706 int iActualTextWidth = fm.width(node()->toMachineNode()->cache()->snapshotName()); /* snapshot-name width */ 707 707 int iMinimumTextWidth = fm.width("..."); /* ellipsis width */ 708 708 iMinimumSnapshotNameWidth = iBracketWidth + qMin(iActualTextWidth, iMinimumTextWidth); … … 789 789 /* Calculate new visible snapshot-name: */ 790 790 int iBracketWidth = QFontMetrics(m_snapshotNameFont, pPaintDevice).width("()"); 791 QString strVisibleSnapshotName = compressText(m_snapshotNameFont, pPaintDevice, node()->toMachineNode()-> snapshotName(),791 QString strVisibleSnapshotName = compressText(m_snapshotNameFont, pPaintDevice, node()->toMachineNode()->cache()->snapshotName(), 792 792 m_iMaximumSnapshotNameWidth - iBracketWidth); 793 793 strVisibleSnapshotName = QString("(%1)").arg(strVisibleSnapshotName); … … 810 810 { 811 811 /* Get new state-text and state-text size: */ 812 const QSize stateTextSize = textSize(m_stateTextFont, model()->paintDevice(), node()->toMachineNode()-> machineStateName());812 const QSize stateTextSize = textSize(m_stateTextFont, model()->paintDevice(), node()->toMachineNode()->cache()->machineStateName()); 813 813 814 814 /* Update linked values: */ … … 1087 1087 1088 1088 /* Paint middle element: */ 1089 if (!node()->toMachineNode()-> snapshotName().isEmpty())1089 if (!node()->toMachineNode()->cache()->snapshotName().isEmpty()) 1090 1090 { 1091 1091 /* Prepare variables: */ … … 1145 1145 model()->paintDevice(), 1146 1146 /* Text to paint: */ 1147 node()->toMachineNode()-> machineStateName());1147 node()->toMachineNode()->cache()->machineStateName()); 1148 1148 } 1149 1149 } -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.cpp
r80881 r82917 282 282 { 283 283 /* Return first machine-item of the selected-item: */ 284 return firstSelectedItem() && firstSelectedItem()->firstMachineItem() && firstSelectedItem()->firstMachineItem()->node() 285 ? firstSelectedItem()->firstMachineItem()->node()->toMachineNode() 284 return firstSelectedItem() 285 && firstSelectedItem()->firstMachineItem() 286 && firstSelectedItem()->firstMachineItem()->node() 287 && firstSelectedItem()->firstMachineItem()->node()->toMachineNode() 288 ? firstSelectedItem()->firstMachineItem()->node()->toMachineNode()->cache() 286 289 : 0; 287 290 } … … 297 300 QList<UIVirtualMachineItem*> currentMachineList; 298 301 foreach (UIChooserItemMachine *pItem, currentMachineItemList) 299 currentMachineList << pItem->node()->toMachineNode() ;302 currentMachineList << pItem->node()->toMachineNode()->cache(); 300 303 return currentMachineList; 301 304 } -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserNodeMachine.cpp
r77847 r82917 25 25 const CMachine &comMachine) 26 26 : UIChooserNode(pParent, fFavorite) 27 , UIVirtualMachineItem(comMachine)27 , m_pCache(new UIVirtualMachineItem(comMachine)) 28 28 { 29 29 if (parentNode()) … … 36 36 int iPosition) 37 37 : UIChooserNode(pParent, pCopyFrom->isFavorite()) 38 , UIVirtualMachineItem(pCopyFrom->machine())38 , m_pCache(new UIVirtualMachineItem(pCopyFrom->cache()->machine())) 39 39 { 40 40 if (parentNode()) … … 52 52 QString UIChooserNodeMachine::name() const 53 53 { 54 return UIVirtualMachineItem::name();54 return m_pCache->name(); 55 55 } 56 56 … … 104 104 { 105 105 /* Skip other ids: */ 106 if ( id() != uId)106 if (m_pCache->id() != uId) 107 107 return; 108 108 … … 114 114 { 115 115 /* Skip other ids: */ 116 if ( id() != uId)116 if (m_pCache->id() != uId) 117 117 return; 118 118 119 /* Update machine-node: */120 recache();119 /* Update cache: */ 120 m_pCache->recache(); 121 121 122 122 /* Update machine-item: */ … … 160 160 void UIChooserNodeMachine::retranslateUi() 161 161 { 162 /* Update description: */162 /* Update internal stuff: */ 163 163 m_strDescription = tr("Virtual Machine"); 164 164 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserNodeMachine.h
r77847 r82917 28 28 29 29 /** UIChooserNode subclass used as interface for invisible tree-view machine nodes. */ 30 class UIChooserNodeMachine : public UIChooserNode , public UIVirtualMachineItem30 class UIChooserNodeMachine : public UIChooserNode 31 31 { 32 32 Q_OBJECT; … … 87 87 virtual void sortNodes() /* override */; 88 88 89 /** Returns virtual machine cache instance. */ 90 UIVirtualMachineItem *cache() const { return m_pCache; } 91 89 92 protected: 90 93 91 94 /** Handles translation event. */ 92 95 virtual void retranslateUi() /* override */; 96 97 private: 98 99 /** Holds virtual machine cache instance. */ 100 UIVirtualMachineItem *m_pCache; 93 101 }; 94 102
Note:
See TracChangeset
for help on using the changeset viewer.

