VirtualBox

Ignore:
Timestamp:
Apr 1, 2019 5:31:43 PM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
129745
Message:

FE/Qt: bugref:9378: Few coding-style fixes for UIChooserView code.

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

Legend:

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

    r77948 r77980  
    106106    if (!m_pSearchWidget)
    107107        return false;
     108
     109    /* Return widget visibility state: */
    108110    return m_pSearchWidget->isVisible();
    109111}
     
    114116        return;
    115117
    116     /* Make sure keyboard focus is managed ccorectly: */
     118    /* Make sure keyboard focus is managed correctly: */
    117119    if (fVisible)
    118120        m_pSearchWidget->setFocus();
     
    120122        setFocus();
    121123
     124    /* Make sure visibility state is really changed: */
    122125    if (m_pSearchWidget->isVisible() == fVisible)
    123126        return;
     127
     128    /* Set widget visibility state: */
    124129    m_pSearchWidget->setVisible(fVisible);
     130
     131    /* Update geometry if widget is visible: */
    125132    if (m_pSearchWidget->isVisible())
    126133        updateSearchWidgetGeometry();
    127134
    128     UIChooserModel *pModel =  m_pChooser->model();
     135    /* Reset search each time widget visibility changed: */
     136    UIChooserModel *pModel = m_pChooser->model();
    129137    if (pModel)
    130138        pModel->resetSearch();
     
    135143    if (!m_pSearchWidget)
    136144        return;
     145
    137146    m_pSearchWidget->setMatchCount(iTotalMacthCount);
    138147    m_pSearchWidget->setScroolToIndex(iCurrentlyScrolledItemIndex);
     
    141150void UIChooserView::appendToSearchString(const QString &strSearchText)
    142151{
    143     if (m_pSearchWidget)
    144         m_pSearchWidget->appendToSearchString(strSearchText);
     152    if (!m_pSearchWidget)
     153        return;
     154
     155    m_pSearchWidget->appendToSearchString(strSearchText);
    145156}
    146157
     
    165176    if (!m_pChooser)
    166177        return;
    167 
    168178    UIChooserModel *pModel =  m_pChooser->model();
    169179    if (!pModel)
    170180        return;
     181
    171182    pModel->performSearch(strSearchTerm, iItemSearchFlags);
    172183}
     
    174185void UIChooserView::sltHandleScrollToSearchResult(bool fIsNext)
    175186{
     187    if (!m_pChooser)
     188        return;
    176189    UIChooserModel *pModel =  m_pChooser->model();
    177190    if (!pModel)
    178191        return;
     192
    179193    pModel->selectSearchResult(fIsNext);
    180194}
     
    214228    m_pSearchWidget->hide();
    215229    connect(m_pSearchWidget, &UIChooserSearchWidget::sigRedoSearch,
    216                 this, &UIChooserView::sltRedoSearch);
     230            this, &UIChooserView::sltRedoSearch);
    217231    connect(m_pSearchWidget, &UIChooserSearchWidget::sigScrollToMatch,
    218                 this, &UIChooserView::sltHandleScrollToSearchResult);
     232            this, &UIChooserView::sltHandleScrollToSearchResult);
    219233    connect(m_pSearchWidget, &UIChooserSearchWidget::sigToggleVisibility,
    220                 this, &UIChooserView::sltHandleSearchWidgetVisibilityToggle);
     234            this, &UIChooserView::sltHandleSearchWidgetVisibilityToggle);
    221235
    222236    /* Update scene-rect: */
    223237    updateSceneRect();
    224 
    225238    /* Update the location and size of the search widget: */
    226239    updateSearchWidgetGeometry();
     
    248261    /* Update scene-rect: */
    249262    updateSceneRect();
     263    /* Update the location and size of the search widget: */
    250264    updateSearchWidgetGeometry();
    251265}
     
    260274    if (!m_pSearchWidget || !m_pSearchWidget->isVisible())
    261275        return;
    262     int iHeight = m_pSearchWidget->height();
    263     QRect widgetRect(0, height() - iHeight,
    264                      width(), iHeight);
    265     m_pSearchWidget->setGeometry(widgetRect);
    266 }
     276
     277    const int iHeight = m_pSearchWidget->height();
     278    m_pSearchWidget->setGeometry(QRect(0, height() - iHeight, width(), iHeight));
     279}
  • trunk/src/VBox/Frontends/VirtualBox/src/manager/chooser/UIChooserView.h

    r77812 r77980  
    5252    /** @} */
    5353
    54     /** @name Virtual Machine search stuff.
     54    /** @name Search stuff.
    5555      * @{ */
    5656        /** Returns if the search widget is visible or not. */
     
    107107    /** @} */
    108108
    109     /** @name Virtual Machine search stuff.
     109    /** @name Search stuff.
    110110      * @{ */
    111111        /** Updates search widget's geometry. */
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