VirtualBox

Changeset 86740 in vbox for trunk/src


Ignore:
Timestamp:
Oct 28, 2020 4:08:53 PM (4 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9653: VirtualBox Manager: Chooser pane: Advanced search logic, allowing to find any kind of cloud entity, like provider, profile and machine.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserAbstractModel.cpp

    r86739 r86740  
    17151715}
    17161716
    1717 UIChooserNode *UIChooserAbstractModel::searchProfileNode(const QString &strProviderShortName, const QString &strProfileName)
    1718 {
    1719     /* Compose profile node ID: */
    1720     const QString strProfileNodeId = QString("/%1/%2").arg(strProviderShortName, strProfileName);
    1721 
    1722     /* Search for a list of nodes matching required ID: */
     1717UIChooserNode *UIChooserAbstractModel::searchProviderNode(const QString &strProviderShortName)
     1718{
     1719    /* Search for a list of nodes matching passed name: */
     1720    QList<UIChooserNode*> providerNodes;
     1721    invisibleRoot()->searchForNodes(strProviderShortName,
     1722                                    UIChooserItemSearchFlag_CloudProvider | UIChooserItemSearchFlag_ExactName,
     1723                                    providerNodes);
     1724
     1725    /* Return 1st node if any: */
     1726    return providerNodes.value(0);
     1727}
     1728
     1729UIChooserNode *UIChooserAbstractModel::searchProfileNode(UIChooserNode *pProviderNode, const QString &strProfileName)
     1730{
     1731    AssertPtrReturn(pProviderNode, 0);
     1732
     1733    /* Search for a list of nodes matching passed name: */
    17231734    QList<UIChooserNode*> profileNodes;
    1724     invisibleRoot()->searchForNodes(strProfileNodeId, UIChooserItemSearchFlag_CloudProfile | UIChooserItemSearchFlag_ExactId, profileNodes);
     1735    pProviderNode->searchForNodes(strProfileName,
     1736                                  UIChooserItemSearchFlag_CloudProfile | UIChooserItemSearchFlag_ExactName,
     1737                                  profileNodes);
    17251738
    17261739    /* Return 1st node if any: */
     
    17281741}
    17291742
     1743UIChooserNode *UIChooserAbstractModel::searchProfileNode(const QString &strProviderShortName, const QString &strProfileName)
     1744{
     1745    /* Wrap method above: */
     1746    return searchProfileNode(searchProviderNode(strProviderShortName), strProfileName);
     1747}
     1748
     1749UIChooserNode *UIChooserAbstractModel::searchMachineNode(UIChooserNode *pProfileNode, const QUuid &uMachineId)
     1750{
     1751    AssertPtrReturn(pProfileNode, 0);
     1752
     1753    /* Search for a list of nodes matching passed ID: */
     1754    QList<UIChooserNode*> machineNodes;
     1755    pProfileNode->searchForNodes(uMachineId.toString(),
     1756                                 UIChooserItemSearchFlag_Machine | UIChooserItemSearchFlag_ExactId,
     1757                                 machineNodes);
     1758
     1759    /* Return 1st node if any: */
     1760    return machineNodes.value(0);
     1761}
     1762
     1763UIChooserNode *UIChooserAbstractModel::searchMachineNode(const QString &strProviderShortName, const QString &strProfileName, const QUuid &uMachineId)
     1764{
     1765    /* Wrap method above: */
     1766    return searchMachineNode(searchProfileNode(strProviderShortName, strProfileName), uMachineId);
     1767}
     1768
    17301769UIChooserNode *UIChooserAbstractModel::searchFakeNode(UIChooserNode *pProfileNode)
    17311770{
    1732     /* Search for a list of nodes matching null ID: */
    1733     QList<UIChooserNode*> fakeNodes;
    1734     pProfileNode->searchForNodes(QUuid().toString(), UIChooserItemSearchFlag_Machine | UIChooserItemSearchFlag_ExactId, fakeNodes);
    1735 
    1736     /* Return 1st node if any: */
    1737     return fakeNodes.value(0);
     1771    /* Wrap method above: */
     1772    return searchMachineNode(pProfileNode, QUuid());
     1773}
     1774
     1775UIChooserNode *UIChooserAbstractModel::searchFakeNode(const QString &strProviderShortName, const QString &strProfileName)
     1776{
     1777    /* Wrap method above: */
     1778    return searchMachineNode(strProviderShortName, strProfileName, QUuid());
    17381779}
    17391780
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserAbstractModel.h

    r86739 r86740  
    345345    /** @name Cloud stuff.
    346346      * @{ */
     347        /** Searches for provider node with passed @a strProviderShortName. */
     348        UIChooserNode *searchProviderNode(const QString &strProviderShortName);
     349
     350        /** Searches for profile node with passed @a strProfileName under passed @a pProviderNode. */
     351        UIChooserNode *searchProfileNode(UIChooserNode *pProviderNode, const QString &strProfileName);
    347352        /** Searches for profile node with passed @a strProviderShortName and @a strProfileName. */
    348353        UIChooserNode *searchProfileNode(const QString &strProviderShortName, const QString &strProfileName);
     354
     355        /** Searches for machine node with passed @a uMachineId under passed @a pProfileNode. */
     356        UIChooserNode *searchMachineNode(UIChooserNode *pProfileNode, const QUuid &uMachineId);
     357        /** Searches for machine with passed @a strProviderShortName, @a strProfileName and @a uMachineId. */
     358        UIChooserNode *searchMachineNode(const QString &strProviderShortName, const QString &strProfileName, const QUuid &uMachineId);
     359
    349360        /** Searches for fake node under passed @a pProfileNode. */
    350361        UIChooserNode *searchFakeNode(UIChooserNode *pProfileNode);
     362        /** Searches for fake with passed @a strProviderShortName and @a strProfileName. */
     363        UIChooserNode *searchFakeNode(const QString &strProviderShortName, const QString &strProfileName);
    351364    /** @} */
    352365
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette