VirtualBox

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


Ignore:
Timestamp:
Aug 21, 2023 11:02:01 AM (16 months ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10496, bugref:9072. Fixing search functionality after refactoring.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/logviewer
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerPanel.cpp

    r100917 r100918  
    5353    m_pSearchWidget = new UIVMLogViewerSearchPanel(0, m_pViewer);
    5454    insertTab(0, m_pSearchWidget);
     55
     56    connect(m_pSearchWidget, &UIVMLogViewerSearchPanel::sigHighlightingUpdated,
     57            this, &UIVMLogViewerPanelNew::sigHighlightingUpdated);
     58    connect(m_pSearchWidget, &UIVMLogViewerSearchPanel::sigSearchUpdated,
     59            this, &UIVMLogViewerPanelNew::sigSearchUpdated);
     60
    5561    retranslateUi();
    5662}
     
    6066    if (m_pSearchWidget)
    6167        m_pSearchWidget->refreshSearch();
     68}
     69
     70QVector<float> UIVMLogViewerPanelNew::matchLocationVector() const
     71{
     72    if (!m_pSearchWidget)
     73        return QVector<float>();
     74    return m_pSearchWidget->matchLocationVector();
     75}
     76
     77int UIVMLogViewerPanelNew::matchCount() const
     78{
     79    if (!m_pSearchWidget)
     80        return 0;
     81    return m_pSearchWidget->matchCount();
    6282}
    6383
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerPanel.h

    r100917 r100918  
    4545    Q_OBJECT;
    4646
     47signals:
     48
     49    void sigHighlightingUpdated();
     50    void sigSearchUpdated();
     51
    4752public:
    4853
    4954    UIVMLogViewerPanelNew(QWidget *pParent, UIVMLogViewerWidget *pViewer);
    50     void refreshSearch();
     55
     56    /** @name Search page pass through functions
     57      * @{ */
     58        void refreshSearch();
     59        QVector<float> matchLocationVector() const;
     60        /** Returns the number of the matches to the current search. */
     61        int matchCount() const;
     62    /** @} */
     63
     64
    5165
    5266    enum Page
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerWidget.cpp

    r100915 r100918  
    424424    pCurrentPage->setLogContent(strLogContent, false);
    425425
    426     // if (m_pSearchPanel && m_pSearchPanel->isVisible())
    427     //     m_pSearchPanel->refresh();
     426    if (m_pPanel && m_pPanel->isVisible() &&
     427        m_pPanel->currentIndex() == static_cast<UIVMLogViewerPanelNew::Page>(UIVMLogViewerPanelNew::Page_Search))
     428        m_pPanel->refreshSearch();
    428429
    429430    /* Re-Apply the filter settings: */
     
    527528void UIVMLogViewerWidget::sltPanelActionToggled(bool fChecked)
    528529{
    529     QAction *pSenderAction = qobject_cast<QAction*>(sender());
    530     if (!pSenderAction)
    531         return;
    532     UIDialogPanel* pPanel = 0;
    533     /* Look for the sender() within the m_panelActionMap's values: */
    534     for (QMap<UIDialogPanel*, QAction*>::const_iterator iterator = m_panelActionMap.begin();
    535         iterator != m_panelActionMap.end(); ++iterator)
    536     {
    537         if (iterator.value() == pSenderAction)
    538             pPanel = iterator.key();
    539     }
    540     if (!pPanel)
    541         return;
    542     if (fChecked)
    543         showPanel(pPanel);
    544     else
    545         hidePanel(pPanel);
     530    Q_UNUSED(fChecked);
    546531}
    547532
    548533void UIVMLogViewerWidget::sltSearchResultHighLigting()
    549534{
    550     // if (!m_pSearchPanel || !currentLogPage())
    551     //     return;
    552     // currentLogPage()->setScrollBarMarkingsVector(m_pSearchPanel->matchLocationVector());
     535    if (!m_pPanel || !currentLogPage())
     536        return;
     537    currentLogPage()->setScrollBarMarkingsVector(m_pPanel->matchLocationVector());
    553538}
    554539
    555540void UIVMLogViewerWidget::sltHandleSearchUpdated()
    556541{
    557     // if (!m_pSearchPanel || !currentLogPage())
    558     //     return;
    559542}
    560543
     
    585568{
    586569    /* Reapply the search to get highlighting etc. correctly */
    587     // if (m_pSearchPanel)
    588     //     m_pSearchPanel->refresh();
     570    if (m_pPanel)
     571        m_pPanel->refreshSearch();
    589572}
    590573
     
    595578    if (m_pBookmarksPanel)
    596579        m_pBookmarksPanel->disableEnableBookmarking(!isFiltered);
    597 }
    598 
    599 void UIVMLogViewerWidget::sltHandleHidePanel(UIDialogPanel *pPanel)
    600 {
    601     hidePanel(pPanel);
    602 }
    603 
    604 void UIVMLogViewerWidget::sltHandleShowPanel(UIDialogPanel *pPanel)
    605 {
    606     showPanel(pPanel);
    607580}
    608581
     
    784757    }
    785758
    786     /* Create VM Log-Viewer search-panel: */
    787     // m_pSearchPanel = new UIVMLogViewerSearchPanel(0, this);
    788     // if (m_pSearchPanel)
    789     // {
    790     //     /* Configure panel: */
    791     //     installEventFilter(m_pSearchPanel);
    792     //     m_pSearchPanel->hide();
    793     //     connect(m_pSearchPanel, &UIVMLogViewerSearchPanel::sigHighlightingUpdated,
    794     //             this, &UIVMLogViewerWidget::sltSearchResultHighLigting);
    795     //     connect(m_pSearchPanel, &UIVMLogViewerSearchPanel::sigSearchUpdated,
    796     //             this, &UIVMLogViewerWidget::sltHandleSearchUpdated);
    797     //     // connect(m_pSearchPanel, &UIVMLogViewerSearchPanel::sigHidePanel,
    798     //     //         this, &UIVMLogViewerWidget::sltHandleHidePanel);
    799     //     // connect(m_pSearchPanel, &UIVMLogViewerSearchPanel::sigShowPanel,
    800     //     //         this, &UIVMLogViewerWidget::sltHandleShowPanel);
    801     //     //m_panelActionMap.insert(m_pSearchPanel, m_pActionPool->action(UIActionIndex_M_Log_T_Find));
    802 
    803     //     /* Add into layout: */
    804     //     m_pMainLayout->addWidget(m_pSearchPanel);
    805     // }
    806 
    807759    /* Create VM Log-Viewer filter-panel: */
    808760    m_pFilterPanel = new UIVMLogViewerFilterPanel(0, this);
     
    814766        connect(m_pFilterPanel, &UIVMLogViewerFilterPanel::sigFilterApplied,
    815767                this, &UIVMLogViewerWidget::sltFilterApplied);
    816         // connect(m_pFilterPanel, &UIVMLogViewerFilterPanel::sigHidePanel,
    817         //         this, &UIVMLogViewerWidget::sltHandleHidePanel);
    818         // connect(m_pFilterPanel, &UIVMLogViewerFilterPanel::sigShowPanel,
    819         //         this, &UIVMLogViewerWidget::sltHandleShowPanel);
    820         // m_panelActionMap.insert(m_pFilterPanel, m_pActionPool->action(UIActionIndex_M_Log_T_Filter));
    821768
    822769        /* Add into layout: */
     
    836783        connect(m_pBookmarksPanel, &UIVMLogViewerBookmarksPanel::sigBookmarkSelected,
    837784                this, &UIVMLogViewerWidget::gotoBookmark);
    838         //m_panelActionMap.insert(m_pBookmarksPanel, m_pActionPool->action(UIActionIndex_M_Log_T_Bookmark));
    839         // connect(m_pBookmarksPanel, &UIVMLogViewerBookmarksPanel::sigHidePanel,
    840         //         this, &UIVMLogViewerWidget::sltHandleHidePanel);
    841         // connect(m_pBookmarksPanel, &UIVMLogViewerBookmarksPanel::sigShowPanel,
    842         //         this, &UIVMLogViewerWidget::sltHandleShowPanel);
    843785        /* Add into layout: */
    844786        m_pMainLayout->addWidget(m_pBookmarksPanel);
     
    859801        connect(m_pOptionsPanel, &UIVMLogViewerOptionsPanel::sigChangeFont, this, &UIVMLogViewerWidget::sltChangeFont);
    860802        connect(m_pOptionsPanel, &UIVMLogViewerOptionsPanel::sigResetToDefaults, this, &UIVMLogViewerWidget::sltResetOptionsToDefault);
    861         // connect(m_pOptionsPanel, &UIVMLogViewerOptionsPanel::sigHidePanel, this, &UIVMLogViewerWidget::sltHandleHidePanel);
    862         // connect(m_pOptionsPanel, &UIVMLogViewerOptionsPanel::sigShowPanel, this, &UIVMLogViewerWidget::sltHandleShowPanel);
    863 
    864         //m_panelActionMap.insert(m_pOptionsPanel, m_pActionPool->action(UIActionIndex_M_Log_T_Options));
    865803
    866804        /* Add into layout: */
     
    870808    m_pPanel = new UIVMLogViewerPanelNew(0, this);
    871809    AssertReturnVoid(m_pPanel);
     810    //     installEventFilter(m_pSearchPanel);
     811    connect(m_pPanel, &UIVMLogViewerPanelNew::sigHighlightingUpdated,
     812            this, &UIVMLogViewerWidget::sltSearchResultHighLigting);
     813    connect(m_pPanel, &UIVMLogViewerPanelNew::sigSearchUpdated,
     814            this, &UIVMLogViewerWidget::sltHandleSearchUpdated);
     815
    872816    m_pMainLayout->addWidget(m_pPanel);
    873817
     
    921865void UIVMLogViewerWidget::restorePanelVisibility()
    922866{
    923     /** Reset the action states first: */
    924     foreach(QAction* pAction, m_panelActionMap.values())
    925     {
    926         pAction->blockSignals(true);
    927         pAction->setChecked(false);
    928         pAction->blockSignals(false);
    929     }
    930 
    931     /* Load the visible panel list and show them: */
    932     QStringList strNameList = gEDataManager->logViewerVisiblePanels();
    933     foreach(const QString strName, strNameList)
    934     {
    935         foreach(UIDialogPanel* pPanel, m_panelActionMap.keys())
    936         {
    937             if (strName == pPanel->panelName())
    938             {
    939                 showPanel(pPanel);
    940                 break;
    941             }
    942         }
    943     }
    944867}
    945868
     
    1050973
    1051974        pLogPage->setLogContent(strLogContent, noLogsToShow);
    1052         //pLogPage->setScrollBarMarkingsVector(m_pSearchPanel->matchLocationVector());
     975        pLogPage->setScrollBarMarkingsVector(m_pPanel->matchLocationVector());
    1053976    }
    1054977}
     
    11961119}
    11971120
    1198 void UIVMLogViewerWidget::hidePanel(UIDialogPanel* panel)
    1199 {
    1200     if (!panel || !m_pActionPool)
    1201         return;
    1202     if (panel->isVisible())
    1203         panel->setVisible(false);
    1204     QMap<UIDialogPanel*, QAction*>::iterator iterator = m_panelActionMap.find(panel);
    1205     if (iterator != m_panelActionMap.end())
    1206     {
    1207         if (iterator.value() && iterator.value()->isChecked())
    1208             iterator.value()->setChecked(false);
    1209     }
    1210     m_visiblePanelsList.removeOne(panel);
    1211     manageEscapeShortCut();
    1212     savePanelVisibility();
    1213 }
    1214 
    1215 void UIVMLogViewerWidget::showPanel(UIDialogPanel* panel)
    1216 {
    1217     if (panel && panel->isHidden())
    1218         panel->setVisible(true);
    1219     QMap<UIDialogPanel*, QAction*>::iterator iterator = m_panelActionMap.find(panel);
    1220     if (iterator != m_panelActionMap.end())
    1221     {
    1222         if (!iterator.value()->isChecked())
    1223             iterator.value()->setChecked(true);
    1224     }
    1225     if (!m_visiblePanelsList.contains(panel))
    1226         m_visiblePanelsList.push_back(panel);
    1227     manageEscapeShortCut();
    1228     savePanelVisibility();
    1229 }
    1230 
    12311121void UIVMLogViewerWidget::manageEscapeShortCut()
    12321122{
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerWidget.h

    r100915 r100918  
    133133       of UIVMLogPage is changed. */
    134134    void sltLogPageFilteredChanged(bool isFiltered);
    135     void sltHandleHidePanel(UIDialogPanel *pPanel);
    136     void sltHandleShowPanel(UIDialogPanel *pPanel);
    137135
    138136    /** @name Slots to handle signals from settings panel
     
    201199    /** Resets document (of the current tab) and scrollbar highligthing */
    202200    void resetHighlighthing();
    203     void hidePanel(UIDialogPanel* panel);
    204     void showPanel(UIDialogPanel* panel);
    205201    /** Make sure escape key is assigned to only a single widget. This is done by checking
    206202        several things in the following order:
     
    234230        UIVMLogViewerBookmarksPanel *m_pBookmarksPanel;
    235231        UIVMLogViewerOptionsPanel   *m_pOptionsPanel;
    236         QMap<UIDialogPanel*, QAction*> m_panelActionMap;
    237232        QList<UIDialogPanel*>          m_visiblePanelsList;
    238233    /** @} */
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