Changeset 100918 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Aug 21, 2023 11:02:01 AM (16 months ago)
- 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 53 53 m_pSearchWidget = new UIVMLogViewerSearchPanel(0, m_pViewer); 54 54 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 55 61 retranslateUi(); 56 62 } … … 60 66 if (m_pSearchWidget) 61 67 m_pSearchWidget->refreshSearch(); 68 } 69 70 QVector<float> UIVMLogViewerPanelNew::matchLocationVector() const 71 { 72 if (!m_pSearchWidget) 73 return QVector<float>(); 74 return m_pSearchWidget->matchLocationVector(); 75 } 76 77 int UIVMLogViewerPanelNew::matchCount() const 78 { 79 if (!m_pSearchWidget) 80 return 0; 81 return m_pSearchWidget->matchCount(); 62 82 } 63 83 -
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerPanel.h
r100917 r100918 45 45 Q_OBJECT; 46 46 47 signals: 48 49 void sigHighlightingUpdated(); 50 void sigSearchUpdated(); 51 47 52 public: 48 53 49 54 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 51 65 52 66 enum Page -
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerWidget.cpp
r100915 r100918 424 424 pCurrentPage->setLogContent(strLogContent, false); 425 425 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(); 428 429 429 430 /* Re-Apply the filter settings: */ … … 527 528 void UIVMLogViewerWidget::sltPanelActionToggled(bool fChecked) 528 529 { 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); 546 531 } 547 532 548 533 void UIVMLogViewerWidget::sltSearchResultHighLigting() 549 534 { 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()); 553 538 } 554 539 555 540 void UIVMLogViewerWidget::sltHandleSearchUpdated() 556 541 { 557 // if (!m_pSearchPanel || !currentLogPage())558 // return;559 542 } 560 543 … … 585 568 { 586 569 /* Reapply the search to get highlighting etc. correctly */ 587 // if (m_pSearchPanel)588 // m_pSearchPanel->refresh();570 if (m_pPanel) 571 m_pPanel->refreshSearch(); 589 572 } 590 573 … … 595 578 if (m_pBookmarksPanel) 596 579 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);607 580 } 608 581 … … 784 757 } 785 758 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 807 759 /* Create VM Log-Viewer filter-panel: */ 808 760 m_pFilterPanel = new UIVMLogViewerFilterPanel(0, this); … … 814 766 connect(m_pFilterPanel, &UIVMLogViewerFilterPanel::sigFilterApplied, 815 767 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));821 768 822 769 /* Add into layout: */ … … 836 783 connect(m_pBookmarksPanel, &UIVMLogViewerBookmarksPanel::sigBookmarkSelected, 837 784 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);843 785 /* Add into layout: */ 844 786 m_pMainLayout->addWidget(m_pBookmarksPanel); … … 859 801 connect(m_pOptionsPanel, &UIVMLogViewerOptionsPanel::sigChangeFont, this, &UIVMLogViewerWidget::sltChangeFont); 860 802 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));865 803 866 804 /* Add into layout: */ … … 870 808 m_pPanel = new UIVMLogViewerPanelNew(0, this); 871 809 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 872 816 m_pMainLayout->addWidget(m_pPanel); 873 817 … … 921 865 void UIVMLogViewerWidget::restorePanelVisibility() 922 866 { 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 }944 867 } 945 868 … … 1050 973 1051 974 pLogPage->setLogContent(strLogContent, noLogsToShow); 1052 //pLogPage->setScrollBarMarkingsVector(m_pSearchPanel->matchLocationVector());975 pLogPage->setScrollBarMarkingsVector(m_pPanel->matchLocationVector()); 1053 976 } 1054 977 } … … 1196 1119 } 1197 1120 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 1231 1121 void UIVMLogViewerWidget::manageEscapeShortCut() 1232 1122 { -
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerWidget.h
r100915 r100918 133 133 of UIVMLogPage is changed. */ 134 134 void sltLogPageFilteredChanged(bool isFiltered); 135 void sltHandleHidePanel(UIDialogPanel *pPanel);136 void sltHandleShowPanel(UIDialogPanel *pPanel);137 135 138 136 /** @name Slots to handle signals from settings panel … … 201 199 /** Resets document (of the current tab) and scrollbar highligthing */ 202 200 void resetHighlighthing(); 203 void hidePanel(UIDialogPanel* panel);204 void showPanel(UIDialogPanel* panel);205 201 /** Make sure escape key is assigned to only a single widget. This is done by checking 206 202 several things in the following order: … … 234 230 UIVMLogViewerBookmarksPanel *m_pBookmarksPanel; 235 231 UIVMLogViewerOptionsPanel *m_pOptionsPanel; 236 QMap<UIDialogPanel*, QAction*> m_panelActionMap;237 232 QList<UIDialogPanel*> m_visiblePanelsList; 238 233 /** @} */
Note:
See TracChangeset
for help on using the changeset viewer.