Changeset 83698 in vbox
- Timestamp:
- Apr 15, 2020 12:06:02 PM (5 years ago)
- svn:sync-xref-src-repo-rev:
- 137204
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserAbstractModel.cpp
r83691 r83698 117 117 118 118 /* Add machine into tree: */ 119 add MachineIntoTheTree(comMachine);119 addLocalMachineIntoTheTree(comMachine); 120 120 } 121 121 } … … 375 375 } 376 376 377 void UIChooserAbstractModel::slt MachineRegistered(const QUuid &uMachineId, const bool fRegistered)377 void UIChooserAbstractModel::sltLocalMachineRegistered(const QUuid &uMachineId, const bool fRegistered) 378 378 { 379 379 /* Existing VM unregistered? */ … … 393 393 /* Add new machine-item: */ 394 394 const CMachine comMachine = uiCommon().virtualBox().FindMachine(uMachineId.toString()); 395 add MachineIntoTheTree(comMachine, true /* make it visible */);395 addLocalMachineIntoTheTree(comMachine, true /* make it visible */); 396 396 } 397 397 } … … 422 422 /* Add new machine-item: */ 423 423 const CMachine comMachine = uiCommon().virtualBox().FindMachine(uMachineId.toString()); 424 add MachineIntoTheTree(comMachine, true /* make it visible */);424 addLocalMachineIntoTheTree(comMachine, true /* make it visible */); 425 425 } 426 426 } … … 525 525 this, &UIChooserAbstractModel::sltMachineDataChanged); 526 526 connect(gVBoxEvents, &UIVirtualBoxEventHandler::sigMachineRegistered, 527 this, &UIChooserAbstractModel::slt MachineRegistered);527 this, &UIChooserAbstractModel::sltLocalMachineRegistered); 528 528 connect(gVBoxEvents, &UIVirtualBoxEventHandler::sigSessionStateChange, 529 529 this, &UIChooserAbstractModel::sltSessionStateChanged); … … 543 543 } 544 544 545 void UIChooserAbstractModel::addMachineIntoTheTree(const CMachine &comMachine, bool fMakeItVisible /* = false */) 545 void UIChooserAbstractModel::addLocalMachineIntoTheTree(const CMachine &comMachine, 546 bool fMakeItVisible /* = false */) 546 547 { 547 548 /* Make sure passed VM is not NULL: */ 548 549 if (comMachine.isNull()) 549 LogRelFlow(("UIChooserModel: ERROR: Passed VM is NULL!\n"));550 LogRelFlow(("UIChooserModel: ERROR: Passed local VM is NULL!\n")); 550 551 AssertReturnVoid(!comMachine.isNull()); 551 552 552 553 /* Which VM we are loading: */ 553 LogRelFlow(("UIChooserModel: Loading VM with ID={%s}...\n", toOldStyleUuid(comMachine.GetId()).toUtf8().constData())); 554 const QUuid uMachineId = comMachine.GetId(); 555 LogRelFlow(("UIChooserModel: Loading local VM with ID={%s}...\n", 556 toOldStyleUuid(uMachineId).toUtf8().constData())); 554 557 /* Is that machine accessible? */ 555 558 if (comMachine.GetAccessible()) 556 559 { 557 /* VM is accessible: */560 /* Acquire VM name: */ 558 561 const QString strName = comMachine.GetName(); 559 LogRelFlow(("UIChooserModel: VM {%s} is accessible.\n", strName.toUtf8().constData()));562 LogRelFlow(("UIChooserModel: Local VM {%s} is accessible.\n", strName.toUtf8().constData())); 560 563 /* Which groups passed machine attached to? */ 561 564 const QVector<QString> groups = comMachine.GetGroups(); 562 565 const QStringList groupList = groups.toList(); 563 566 const QString strGroups = groupList.join(", "); 564 LogRelFlow(("UIChooserModel: VM {%s} has groups: {%s}.\n", strName.toUtf8().constData(),565 567 LogRelFlow(("UIChooserModel: Local VM {%s} has groups: {%s}.\n", 568 strName.toUtf8().constData(), strGroups.toUtf8().constData())); 566 569 foreach (QString strGroup, groups) 567 570 { … … 570 573 strGroup.truncate(strGroup.size() - 1); 571 574 /* Create machine-item with found group-item as parent: */ 572 LogRelFlow(("UIChooserModel: Creating item for VM {%s} in group {%s}.\n", strName.toUtf8().constData(),573 574 create MachineNode(getGroupNode(strGroup, invisibleRoot(), fMakeItVisible), comMachine);575 LogRelFlow(("UIChooserModel: Creating node for local VM {%s} in group {%s}.\n", 576 strName.toUtf8().constData(), strGroup.toUtf8().constData())); 577 createLocalMachineNode(getLocalGroupNode(strGroup, invisibleRoot(), fMakeItVisible), comMachine); 575 578 } 576 579 /* Update group definitions: */ 577 m_groups[toOldStyleUuid( comMachine.GetId())] = groupList;580 m_groups[toOldStyleUuid(uMachineId)] = groupList; 578 581 } 579 582 /* Inaccessible machine: */ … … 581 584 { 582 585 /* VM is accessible: */ 583 LogRelFlow(("UIChooserModel: VM {%s} is inaccessible.\n", toOldStyleUuid(comMachine.GetId()).toUtf8().constData())); 586 LogRelFlow(("UIChooserModel: Local VM {%s} is inaccessible.\n", 587 toOldStyleUuid(uMachineId).toUtf8().constData())); 584 588 /* Create machine-item with main-root group-item as parent: */ 585 create MachineNode(invisibleRoot(), comMachine);586 } 587 } 588 589 UIChooserNode *UIChooserAbstractModel::get GroupNode(const QString &strName, UIChooserNode *pParentNode, bool fAllGroupsOpened)589 createLocalMachineNode(invisibleRoot(), comMachine); 590 } 591 } 592 593 UIChooserNode *UIChooserAbstractModel::getLocalGroupNode(const QString &strName, UIChooserNode *pParentNode, bool fAllGroupsOpened) 590 594 { 591 595 /* Check passed stuff: */ … … 607 611 foreach (UIChooserNode *pGroupNode, pParentNode->nodes(UIChooserNodeType_Group)) 608 612 { 609 if (pGroupNode->name() == strSecondSubName) 613 if ( pGroupNode->toGroupNode()->groupType() == UIChooserNodeGroupType_Local 614 && pGroupNode->name() == strSecondSubName) 610 615 { 611 UIChooserNode *pFoundNode = get GroupNode(strFirstSuffix, pGroupNode, fAllGroupsOpened);616 UIChooserNode *pFoundNode = getLocalGroupNode(strFirstSuffix, pGroupNode, fAllGroupsOpened); 612 617 if (UIChooserNodeGroup *pFoundGroupNode = pFoundNode->toGroupNode()) 613 618 if (fAllGroupsOpened && pFoundGroupNode->isClosed()) … … 626 631 UIChooserNodeGroupType_Local, 627 632 fAllGroupsOpened || shouldGroupNodeBeOpened(pParentNode, strSecondSubName)); 628 return strSecondSuffix.isEmpty() ? pNewGroupNode : get GroupNode(strFirstSuffix, pNewGroupNode, fAllGroupsOpened);633 return strSecondSuffix.isEmpty() ? pNewGroupNode : getLocalGroupNode(strFirstSuffix, pNewGroupNode, fAllGroupsOpened); 629 634 } 630 635 … … 787 792 } 788 793 789 void UIChooserAbstractModel::create MachineNode(UIChooserNode *pParentNode, const CMachine &comMachine)794 void UIChooserAbstractModel::createLocalMachineNode(UIChooserNode *pParentNode, const CMachine &comMachine) 790 795 { 791 796 /* Create machine node: */ -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserAbstractModel.h
r83689 r83698 132 132 /** Handles machine data change for machine with certain @a uMachineId. */ 133 133 virtual void sltMachineDataChanged(const QUuid &uMachineId); 134 /** Handles machine registering/unregistering for machine with certain @a uMachineId. */135 virtual void slt MachineRegistered(const QUuid &uMachineId, const bool fRegistered);134 /** Handles local machine registering/unregistering for machine with certain @a uMachineId. */ 135 virtual void sltLocalMachineRegistered(const QUuid &uMachineId, const bool fRegistered); 136 136 /** Handles session @a enmState change for machine with certain @a uMachineId. */ 137 137 virtual void sltSessionStateChanged(const QUuid &uMachineId, const KSessionState enmState); … … 174 174 /** @name Children stuff. 175 175 * @{ */ 176 /** Adds machine item based on certain @a comMachine and optionally @a fMakeItVisible. */ 177 void addMachineIntoTheTree(const CMachine &comMachine, bool fMakeItVisible = false); 178 /** Acquires group node, creates one if necessary. 176 /** Adds local machine item based on certain @a comMachine and optionally @a fMakeItVisible. */ 177 void addLocalMachineIntoTheTree(const CMachine &comMachine, bool fMakeItVisible = false); 178 179 /** Acquires local group node, creates one if necessary. 179 180 * @param strName Brings the name of group we looking for. 180 181 * @param pParentNode Brings the parent we starting to look for a group from. 181 182 * @param fAllGroupsOpened Brings whether we should open all the groups till the required one. */ 182 UIChooserNode *getGroupNode(const QString &strName, UIChooserNode *pParentNode, bool fAllGroupsOpened); 183 UIChooserNode *getLocalGroupNode(const QString &strName, UIChooserNode *pParentNode, bool fAllGroupsOpened); 184 183 185 /** Returns whether group node with certain @a strName should be opened, searching starting from the passed @a pParentItem. */ 184 186 bool shouldGroupNodeBeOpened(UIChooserNode *pParentNode, const QString &strName); … … 195 197 int getDefinedNodePosition(UIChooserNode *pParentNode, UIChooserNodeType enmType, const QString &strName); 196 198 197 /** Creates machine node based on certain @a comMachine as a child of specified @a pParentNode. */198 void create MachineNode(UIChooserNode *pParentNode, const CMachine &comMachine);199 /** Creates local machine node based on certain @a comMachine as a child of specified @a pParentNode. */ 200 void createLocalMachineNode(UIChooserNode *pParentNode, const CMachine &comMachine); 199 201 /** @} */ 200 202 -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.cpp
r83691 r83698 653 653 } 654 654 655 void UIChooserModel::slt MachineRegistered(const QUuid &uId, const bool fRegistered)655 void UIChooserModel::sltLocalMachineRegistered(const QUuid &uId, const bool fRegistered) 656 656 { 657 657 /* Call to base-class: */ 658 UIChooserAbstractModel::slt MachineRegistered(uId, fRegistered);658 UIChooserAbstractModel::sltLocalMachineRegistered(uId, fRegistered); 659 659 660 660 /* Existing VM unregistered? */ … … 689 689 690 690 /* Select newly added item: */ 691 CMachine comMachine = uiCommon().virtualBox().FindMachine(uId.toString()); 692 setSelectedItem(root()->searchForItem(comMachine.GetName(), 693 UIChooserItemSearchFlag_Machine | 694 UIChooserItemSearchFlag_ExactName)); 691 setSelectedItem(root()->searchForItem(uId.toString(), 692 UIChooserItemSearchFlag_Machine | 693 UIChooserItemSearchFlag_ExactId)); 695 694 } 696 695 } … … 1167 1166 /* If we have something local to unregister: */ 1168 1167 if (!localMachinesToUnregister.isEmpty()) 1169 unregister Machines(localMachinesToUnregister);1168 unregisterLocalMachines(localMachinesToUnregister); 1170 1169 } 1171 1170 … … 1634 1633 } 1635 1634 1636 void UIChooserModel::unregister Machines(const QList<CMachine> &machines)1635 void UIChooserModel::unregisterLocalMachines(const QList<CMachine> &machines) 1637 1636 { 1638 1637 /* Confirm machine removal: */ -
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.h
r83683 r83698 247 247 /** @name Main event handling stuff. 248 248 * @{ */ 249 /** Handles machine registering/unregistering for machine with certain @a uId. */250 virtual void slt MachineRegistered(const QUuid &uId, const bool fRegistered) /* override */;249 /** Handles local machine registering/unregistering for machine with certain @a uId. */ 250 virtual void sltLocalMachineRegistered(const QUuid &uId, const bool fRegistered) /* override */; 251 251 /** @} */ 252 252 … … 363 363 /** Removes machine @a items. */ 364 364 void removeItems(const QList<UIChooserItem*> &items); 365 /** Unregisters a list of virtual @a machines. */366 void unregister Machines(const QList<CMachine> &machines);365 /** Unregisters a list of local virtual @a machines. */ 366 void unregisterLocalMachines(const QList<CMachine> &machines); 367 367 368 368 /** Processes drag move @a pEvent. */
Note:
See TracChangeset
for help on using the changeset viewer.