VirtualBox

Changeset 84625 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Jun 1, 2020 4:44:39 PM (5 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
138365
Message:

FE/Qt: bugref:9653: VirtualBox Manager: Chooser pane: A bit of search stuff cleanup.

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

Legend:

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

    r84610 r84625  
    574574}
    575575
    576 void UIChooserAbstractModel::performSearch(const QString &strSearchTerm, int iItemSearchFlags)
     576void UIChooserAbstractModel::performSearch(const QString &strSearchTerm, int iSearchFlags)
    577577{
    578578    /* Make sure invisible root exists: */
     
    591591
    592592    /* Search for all the nodes matching required condition: */
    593     invisibleRoot()->searchForNodes(strSearchTerm, iItemSearchFlags, m_searchResults);
     593    invisibleRoot()->searchForNodes(strSearchTerm, iSearchFlags, m_searchResults);
    594594
    595595    /* Assign/reset the disabled flag for required nodes: */
    596596    foreach (UIChooserNode *pNode, nodes)
    597597    {
    598         if (!pNode)
    599             continue;
     598        AssertPtrReturnVoid(pNode);
    600599        pNode->setDisabled(!m_searchResults.contains(pNode));
    601600    }
     
    610609    AssertPtrReturn(invisibleRoot(), nodes);
    611610
    612     /* Calling UIChooserNode::searchForNodes with an empty search string
     611    /* Calling UIChooserNode::searchForNodes with an empty search term
    613612     * returns a list all nodes (of the whole tree) of the required type: */
    614613    invisibleRoot()->searchForNodes(QString(), UIChooserItemSearchFlag_Machine, nodes);
     
    617616    foreach (UIChooserNode *pNode, nodes)
    618617    {
    619         if (!pNode)
    620             continue;
     618        AssertPtrReturn(pNode, nodes);
    621619        pNode->setDisabled(false);
    622620    }
     
    625623    m_searchResults.clear();
    626624
    627     /* Return  nodes: */
     625    /* Return nodes: */
    628626    return nodes;
    629627}
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserAbstractModel.h

    r84592 r84625  
    9191    /** @name Search stuff.
    9292      * @{ */
    93         /** Performs a search starting from the m_pInvisibleRootNode. */
    94         virtual void performSearch(const QString &strSearchTerm, int iItemSearchFlags);
    95         /** Cleans the search result data members and disables item's visual effects.
     93        /** Performs a search using @a strSearchTerm and @a iSearchFlags specified. */
     94        virtual void performSearch(const QString &strSearchTerm, int iSearchFlags);
     95        /** Resets the search result data members and disables item's visual effects.
    9696          * Also returns a list of all nodes which may be utilized by the calling code. */
    9797        virtual QList<UIChooserNode*> resetSearch();
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItem.h

    r84583 r84625  
    168168        virtual void removeItem(UIChooserItem *pItem) = 0;
    169169
    170         /** Searches for a first child item answering to specified @a strSearchTag and @a iItemSearchFlags. */
    171         virtual UIChooserItem *searchForItem(const QString &strSearchTag, int iItemSearchFlags) = 0;
     170        /** Searches for a first child item answering to specified @a strSearchTag and @a iSearchFlags. */
     171        virtual UIChooserItem *searchForItem(const QString &strSearchTag, int iSearchFlags) = 0;
    172172
    173173        /** Searches for a first machine child item. */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGlobal.cpp

    r83924 r84625  
    210210}
    211211
    212 UIChooserItem *UIChooserItemGlobal::searchForItem(const QString &, int iItemSearchFlags)
     212UIChooserItem *UIChooserItemGlobal::searchForItem(const QString &, int iSearchFlags)
    213213{
    214214    /* Ignore if we are not searching for the global-item: */
    215     if (!(iItemSearchFlags & UIChooserItemSearchFlag_Global))
     215    if (!(iSearchFlags & UIChooserItemSearchFlag_Global))
    216216        return 0;
    217217
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGlobal.h

    r83924 r84625  
    110110        virtual void removeItem(UIChooserItem *pItem) /* override */;
    111111
    112         /** Searches for a first child item answering to specified @a strSearchTag and @a iItemSearchFlags. */
    113         virtual UIChooserItem *searchForItem(const QString &strSearchTag, int iItemSearchFlags) /* override */;
     112        /** Searches for a first child item answering to specified @a strSearchTag and @a iSearchFlags. */
     113        virtual UIChooserItem *searchForItem(const QString &strSearchTag, int iSearchFlags) /* override */;
    114114
    115115        /** Searches for a first machine child item. */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGroup.cpp

    r84610 r84625  
    494494}
    495495
    496 UIChooserItem* UIChooserItemGroup::searchForItem(const QString &strSearchTag, int iItemSearchFlags)
     496UIChooserItem* UIChooserItemGroup::searchForItem(const QString &strSearchTag, int iSearchFlags)
    497497{
    498498    /* Are we searching among group-items? */
    499     if (   (   iItemSearchFlags & UIChooserItemSearchFlag_LocalGroup
     499    if (   (   iSearchFlags & UIChooserItemSearchFlag_LocalGroup
    500500            && groupType() == UIChooserNodeGroupType_Local)
    501         || (   iItemSearchFlags & UIChooserItemSearchFlag_CloudProvider
     501        || (   iSearchFlags & UIChooserItemSearchFlag_CloudProvider
    502502            && groupType() == UIChooserNodeGroupType_Provider)
    503         || (   iItemSearchFlags & UIChooserItemSearchFlag_CloudProfile
     503        || (   iSearchFlags & UIChooserItemSearchFlag_CloudProfile
    504504            && groupType() == UIChooserNodeGroupType_Profile))
    505505    {
    506506        /* Are we searching by the exact ID? */
    507         if (iItemSearchFlags & UIChooserItemSearchFlag_ExactId)
     507        if (iSearchFlags & UIChooserItemSearchFlag_ExactId)
    508508        {
    509509            /* Exact full-name matches? */
     
    512512        }
    513513        /* Are we searching by the exact name? */
    514         else if (iItemSearchFlags & UIChooserItemSearchFlag_ExactName)
     514        else if (iSearchFlags & UIChooserItemSearchFlag_ExactName)
    515515        {
    516516            /* Exact name matches? */
     
    529529    /* Search among all the children, but machines first: */
    530530    foreach (UIChooserItem *pItem, items(UIChooserNodeType_Machine))
    531         if (UIChooserItem *pFoundItem = pItem->searchForItem(strSearchTag, iItemSearchFlags))
     531        if (UIChooserItem *pFoundItem = pItem->searchForItem(strSearchTag, iSearchFlags))
    532532            return pFoundItem;
    533533    foreach (UIChooserItem *pItem, items(UIChooserNodeType_Global))
    534         if (UIChooserItem *pFoundItem = pItem->searchForItem(strSearchTag, iItemSearchFlags))
     534        if (UIChooserItem *pFoundItem = pItem->searchForItem(strSearchTag, iSearchFlags))
    535535            return pFoundItem;
    536536    foreach (UIChooserItem *pItem, items(UIChooserNodeType_Group))
    537         if (UIChooserItem *pFoundItem = pItem->searchForItem(strSearchTag, iItemSearchFlags))
     537        if (UIChooserItem *pFoundItem = pItem->searchForItem(strSearchTag, iSearchFlags))
    538538            return pFoundItem;
    539539
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemGroup.h

    r84400 r84625  
    160160        virtual void removeItem(UIChooserItem *pItem) /* override */;
    161161
    162         /** Searches for a first child item answering to specified @a strSearchTag and @a iItemSearchFlags. */
    163         virtual UIChooserItem *searchForItem(const QString &strSearchTag, int iItemSearchFlags) /* override */;
     162        /** Searches for a first child item answering to specified @a strSearchTag and @a iSearchFlags. */
     163        virtual UIChooserItem *searchForItem(const QString &strSearchTag, int iSearchFlags) /* override */;
    164164
    165165        /** Searches for a first machine child item. */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemMachine.cpp

    r84610 r84625  
    265265}
    266266
    267 UIChooserItem* UIChooserItemMachine::searchForItem(const QString &strSearchTag, int iItemSearchFlags)
     267UIChooserItem* UIChooserItemMachine::searchForItem(const QString &strSearchTag, int iSearchFlags)
    268268{
    269269    /* Ignore if we are not searching for the machine-item: */
    270     if (!(iItemSearchFlags & UIChooserItemSearchFlag_Machine))
     270    if (!(iSearchFlags & UIChooserItemSearchFlag_Machine))
    271271        return 0;
    272272
    273273    /* Are we searching by the exact ID? */
    274     if (iItemSearchFlags & UIChooserItemSearchFlag_ExactId)
     274    if (iSearchFlags & UIChooserItemSearchFlag_ExactId)
    275275    {
    276276        /* Exact ID doesn't match? */
     
    279279    }
    280280    /* Are we searching by the exact name? */
    281     else if (iItemSearchFlags & UIChooserItemSearchFlag_ExactName)
     281    else if (iSearchFlags & UIChooserItemSearchFlag_ExactName)
    282282    {
    283283        /* Exact name doesn't match? */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserItemMachine.h

    r83946 r84625  
    125125        virtual void removeItem(UIChooserItem *pItem) /* override */;
    126126
    127         /** Searches for a first child item answering to specified @a strSearchTag and @a iItemSearchFlags. */
    128         virtual UIChooserItem *searchForItem(const QString &strSearchTag, int iItemSearchFlags) /* override */;
     127        /** Searches for a first child item answering to specified @a strSearchTag and @a iSearchFlags. */
     128        virtual UIChooserItem *searchForItem(const QString &strSearchTag, int iSearchFlags) /* override */;
    129129
    130130        /** Searches for a first machine child item. */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.cpp

    r84624 r84625  
    512512}
    513513
    514 void UIChooserModel::performSearch(const QString &strSearchTerm, int iItemSearchFlags)
     514void UIChooserModel::performSearch(const QString &strSearchTerm, int iSearchFlags)
    515515{
    516516    /* Call to base-class: */
    517     UIChooserAbstractModel::performSearch(strSearchTerm, iItemSearchFlags);
     517    UIChooserAbstractModel::performSearch(strSearchTerm, iSearchFlags);
    518518
    519519    /* Select 1st found item: */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserModel.h

    r84624 r84625  
    198198    /** @name Search stuff.
    199199      * @{ */
    200         /** Performs a search starting from the m_pInvisibleRootNode. */
    201         virtual void performSearch(const QString &strSearchTerm, int iItemSearchFlags) /* override */;
    202         /** Cleans the search result data members and disables item's visual effects.
     200        /** Performs a search using @a strSearchTerm and @a iSearchFlags specified. */
     201        virtual void performSearch(const QString &strSearchTerm, int iSearchFlags) /* override */;
     202        /** Resets the search result data members and disables item's visual effects.
    203203          * Also returns a list of all nodes which may be utilized by the calling code. */
    204204        virtual QList<UIChooserNode*> resetSearch() /* override */;
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserNode.h

    r84373 r84625  
    119119    UIChooserItem *item() const { return m_pItem.data(); }
    120120
    121     /** Performs search wrt. @a strSearchTerm and @a iItemSearchFlags and updates @a matchedItems. For an empty
    122       * @a strSearchTerm all items are added wrt. node type from @a iItemSearchFlags. */
    123     virtual void searchForNodes(const QString &strSearchTerm, int iItemSearchFlags, QList<UIChooserNode*> &matchedItems) = 0;
     121    /** Performs search wrt. @a strSearchTerm and @a iSearchFlags and updates @a matchedItems. For an empty
     122      * @a strSearchTerm all items are added wrt. node type from @a iSearchFlags. */
     123    virtual void searchForNodes(const QString &strSearchTerm, int iSearchFlags, QList<UIChooserNode*> &matchedItems) = 0;
    124124
    125125    /** Performs sorting of children nodes. */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserNodeGlobal.cpp

    r84610 r84625  
    130130}
    131131
    132 void UIChooserNodeGlobal::searchForNodes(const QString &strSearchTerm, int iItemSearchFlags, QList<UIChooserNode*> &matchedItems)
     132void UIChooserNodeGlobal::searchForNodes(const QString &strSearchTerm, int iSearchFlags, QList<UIChooserNode*> &matchedItems)
    133133{
    134134    /* Ignore if we are not searching for the global-node: */
    135     if (!(iItemSearchFlags & UIChooserItemSearchFlag_Global))
     135    if (!(iSearchFlags & UIChooserItemSearchFlag_Global))
    136136        return;
    137137
     
    142142    {
    143143        /* If exact name flag specified => check full node name: */
    144         if (iItemSearchFlags & UIChooserItemSearchFlag_ExactName)
     144        if (iSearchFlags & UIChooserItemSearchFlag_ExactName)
    145145        {
    146146            if (name() == strSearchTerm)
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserNodeGlobal.h

    r84610 r84625  
    8484    virtual int positionOf(UIChooserNode *pNode) /* override */;
    8585
    86     /** Updates the @a matchedItems wrt. @strSearchTerm and @a iItemSearchFlags. */
    87     virtual void searchForNodes(const QString &strSearchTerm, int iItemSearchFlags, QList<UIChooserNode*> &matchedItems) /* override */;
     86    /** Updates the @a matchedItems wrt. @strSearchTerm and @a iSearchFlags. */
     87    virtual void searchForNodes(const QString &strSearchTerm, int iSearchFlags, QList<UIChooserNode*> &matchedItems) /* override */;
    8888
    8989    /** Performs sorting of children nodes. */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserNodeGroup.cpp

    r84611 r84625  
    224224}
    225225
    226 void UIChooserNodeGroup::searchForNodes(const QString &strSearchTerm, int iItemSearchFlags, QList<UIChooserNode*> &matchedItems)
     226void UIChooserNodeGroup::searchForNodes(const QString &strSearchTerm, int iSearchFlags, QList<UIChooserNode*> &matchedItems)
    227227{
    228228    /* If we are searching for the group-node: */
    229     if (   (   iItemSearchFlags & UIChooserItemSearchFlag_LocalGroup
     229    if (   (   iSearchFlags & UIChooserItemSearchFlag_LocalGroup
    230230            && groupType() == UIChooserNodeGroupType_Local)
    231         || (   iItemSearchFlags & UIChooserItemSearchFlag_CloudProvider
     231        || (   iSearchFlags & UIChooserItemSearchFlag_CloudProvider
    232232            && groupType() == UIChooserNodeGroupType_Provider)
    233         || (   iItemSearchFlags & UIChooserItemSearchFlag_CloudProfile
     233        || (   iSearchFlags & UIChooserItemSearchFlag_CloudProfile
    234234            && groupType() == UIChooserNodeGroupType_Profile))
    235235    {
     
    240240        {
    241241            /* If exact ID flag specified => check full node name: */
    242             if (iItemSearchFlags & UIChooserItemSearchFlag_ExactId)
     242            if (iSearchFlags & UIChooserItemSearchFlag_ExactId)
    243243            {
    244244                if (fullName() == strSearchTerm)
     
    246246            }
    247247            /* If exact name flag specified => check node name: */
    248             else if (iItemSearchFlags & UIChooserItemSearchFlag_ExactName)
     248            else if (iSearchFlags & UIChooserItemSearchFlag_ExactName)
    249249            {
    250250                if (name() == strSearchTerm)
     
    262262    /* Search among all the children: */
    263263    foreach (UIChooserNode *pNode, m_nodesGroup)
    264         pNode->searchForNodes(strSearchTerm, iItemSearchFlags, matchedItems);
     264        pNode->searchForNodes(strSearchTerm, iSearchFlags, matchedItems);
    265265    foreach (UIChooserNode *pNode, m_nodesGlobal)
    266         pNode->searchForNodes(strSearchTerm, iItemSearchFlags, matchedItems);
     266        pNode->searchForNodes(strSearchTerm, iSearchFlags, matchedItems);
    267267    foreach (UIChooserNode *pNode, m_nodesMachine)
    268         pNode->searchForNodes(strSearchTerm, iItemSearchFlags, matchedItems);
     268        pNode->searchForNodes(strSearchTerm, iSearchFlags, matchedItems);
    269269}
    270270
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserNodeGroup.h

    r84610 r84625  
    102102    void close() { m_fOpened = false; }
    103103
    104     /** Recursively searches for a children wrt.  @a strSearchTerm and @a iItemSearchFlags and updates the @a matchedItems. */
    105     virtual void searchForNodes(const QString &strSearchTerm, int iItemSearchFlags, QList<UIChooserNode*> &matchedItems) /* override */;
     104    /** Recursively searches for a children wrt.  @a strSearchTerm and @a iSearchFlags and updates the @a matchedItems. */
     105    virtual void searchForNodes(const QString &strSearchTerm, int iSearchFlags, QList<UIChooserNode*> &matchedItems) /* override */;
    106106
    107107    /** Performs sorting of children nodes. */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserNodeMachine.cpp

    r84610 r84625  
    195195}
    196196
    197 void UIChooserNodeMachine::searchForNodes(const QString &strSearchTerm, int iItemSearchFlags, QList<UIChooserNode*> &matchedItems)
     197void UIChooserNodeMachine::searchForNodes(const QString &strSearchTerm, int iSearchFlags, QList<UIChooserNode*> &matchedItems)
    198198{
    199199    /* Ignore if we are not searching for the machine-node: */
    200     if (!(iItemSearchFlags & UIChooserItemSearchFlag_Machine))
     200    if (!(iSearchFlags & UIChooserItemSearchFlag_Machine))
    201201        return;
    202202
     
    207207    {
    208208        /* If exact ID flag specified => check node ID:  */
    209         if (iItemSearchFlags & UIChooserItemSearchFlag_ExactId)
     209        if (iSearchFlags & UIChooserItemSearchFlag_ExactId)
    210210        {
    211211            if (id() == QUuid(strSearchTerm))
     
    213213        }
    214214        /* If exact name flag specified => check full node name: */
    215         else if (iItemSearchFlags & UIChooserItemSearchFlag_ExactName)
     215        else if (iSearchFlags & UIChooserItemSearchFlag_ExactName)
    216216        {
    217217            if (name() == strSearchTerm)
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserNodeMachine.h

    r84610 r84625  
    100100    virtual int positionOf(UIChooserNode *pNode) /* override */;
    101101
    102     /** Checks if this instance matches to search  wrt. @a strSearchTerm and @a iItemSearchFlags and updates @a matchedItems. */
    103     virtual void searchForNodes(const QString &strSearchTerm, int iItemSearchFlags, QList<UIChooserNode*> &matchedItems) /* override */;
     102    /** Checks if this instance matches to search  wrt. @a strSearchTerm and @a iSearchFlags and updates @a matchedItems. */
     103    virtual void searchForNodes(const QString &strSearchTerm, int iSearchFlags, QList<UIChooserNode*> &matchedItems) /* override */;
    104104
    105105    /** Performs sorting of children nodes. */
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserSearchWidget.h

    r84587 r84625  
    4141signals:
    4242
    43     void sigRedoSearch(const QString &strSearchTerm, int iItemSearchFlags);
     43    void sigRedoSearch(const QString &strSearchTerm, int iSearchFlags);
    4444    /** Is being signalled as next/prev tool buttons are pressed. @a fIsNext is true
    4545      * for the next and false for the previous case. */
Note: See TracChangeset for help on using the changeset viewer.

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