Changeset 88728 in vbox
- Timestamp:
- Apr 27, 2021 11:51:02 AM (4 years ago)
- svn:sync-xref-src-repo-rev:
- 144046
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/logviewer
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogPage.cpp
r88703 r88728 38 38 , m_iSelectedBookmarkIndex(-1) 39 39 , m_bFiltered(false) 40 , m_iFilteredLineCount(-1)41 , m_iUnfilteredLineCount(-1)42 40 , m_iLogFileId(-1) 43 41 { … … 298 296 } 299 297 300 void UIVMLogPage::setFilterParameters(const QSet<QString> &filterTermSet, int filterOperationType,301 int iFilteredLineCount, int iUnfilteredLineCount)302 {303 m_filterTermSet = filterTermSet;304 m_filterOperationType = filterOperationType;305 m_iFilteredLineCount = iFilteredLineCount;306 m_iUnfilteredLineCount = iUnfilteredLineCount;307 }308 309 int UIVMLogPage::filteredLineCount() const310 {311 return m_iFilteredLineCount;312 }313 314 int UIVMLogPage::unfilteredLineCount() const315 {316 return m_iUnfilteredLineCount;317 }318 319 bool UIVMLogPage::shouldFilterBeApplied(const QSet<QString> &filterTermSet, int filterOperationType) const320 {321 /* If filter terms set is different reapply the filter. */322 if (filterTermSet != m_filterTermSet)323 return true;324 325 /* If filter operation type set is different reapply the filter. */326 if (filterOperationType != m_filterOperationType)327 return true;328 return false;329 }330 331 298 QFont UIVMLogPage::currentFont() const 332 299 { -
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogPage.h
r88707 r88728 93 93 void setWrapLines(bool bWrapLines); 94 94 95 /** setFilterParameters is called at the end of filtering operation to store the parameter etc.96 * these parameters are used to decide whether we have to reapply the filter, and if not to97 * update filter panel with correct line counts etc.*/98 void setFilterParameters(const QSet<QString> &filterTermSet, int filterOperationType,99 int iFilteredLineCount, int iUnfilteredLineCount);100 int filteredLineCount() const;101 int unfilteredLineCount() const;102 /** Compares filter parameters with previous filter operation's parameters to decide if the103 * filter should be applied again. */104 bool shouldFilterBeApplied(const QSet<QString> &filterTermSet, int filterOperationType) const;105 106 95 QFont currentFont() const; 107 96 void setCurrentFont(QFont font); … … 150 139 if m_bFiltered is false than (m_strLog == m_pTextEdit->text()). */ 151 140 bool m_bFiltered; 152 /** The set of filter terms used in the last filtering.153 Used when deciding whether we have to reapply the filter or not. see shouldFilterBeApplied function. */154 QSet<QString> m_filterTermSet;155 /** The type of the boolean last filtering operation. Used in deciding whether we have to reapply the156 filter. see shouldFilterBeApplied function. This is int cast of enum FilterOperatorButton157 of UIVMLogViewerFilterPanel. */158 int m_filterOperationType;159 /** These counts are saveds and restored during filtering operation. If filter is not reapplied these counts160 are shown in the filter panel. */161 int m_iFilteredLineCount;162 int m_iUnfilteredLineCount;163 141 /** @} */ 164 142 /** Id of the machine the log shown in this page belongs to. */ -
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerFilterPanel.cpp
r88707 r88728 264 264 } 265 265 266 void UIVMLogViewerFilterPanel::applyFilter(const int iCurrentIndex /* = 0 */) 267 { 268 Q_UNUSED(iCurrentIndex); 266 void UIVMLogViewerFilterPanel::applyFilter() 267 { 269 268 filter(); 270 269 retranslateUi(); … … 282 281 if (!logPage) 283 282 return; 284 /* Check if we have to reapply the filter. If not285 restore line counts etc. and return */286 // if (!logPage->shouldFilterBeApplied(m_filterTermSet, (int)m_eFilterOperatorButton))287 // {288 // m_iFilteredLineCount = logPage->filteredLineCount();289 // m_iUnfilteredLineCount = logPage->unfilteredLineCount();290 // emit sigFilterApplied(!logPage->isFiltered() /* isOriginalLog */);291 // return;292 // }293 294 283 295 284 const QString* originalLogString = logString(); … … 309 298 emit sigFilterApplied(true /* isOriginalLog */); 310 299 m_iFilteredLineCount = document->lineCount(); 311 logPage->setFilterParameters(m_filterTermSet, (int)m_eFilterOperatorButton,312 m_iFilteredLineCount, m_iUnfilteredLineCount);313 300 return; 314 301 } … … 338 325 339 326 emit sigFilterApplied(false /* isOriginalLog */); 340 logPage->setFilterParameters(m_filterTermSet, (int)m_eFilterOperatorButton, 341 m_iFilteredLineCount, m_iUnfilteredLineCount); 342 } 343 327 } 328 329 void resetFiltering() 330 { 331 } 344 332 345 333 bool UIVMLogViewerFilterPanel::applyFilterTermsToString(const QString& string) -
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerFilterPanel.h
r82968 r88728 61 61 public slots: 62 62 63 /** Applies filter settings and filters the current log-page. 64 * @param iCurrentIndex Specifies index of current log-page, but it is actually not used in the method. */ 65 void applyFilter(const int iCurrentIndex = 0); 63 /** Applies filter settings and filters the current log-page. */ 64 void applyFilter(); 66 65 67 66 protected: … … 97 96 bool applyFilterTermsToString(const QString& string); 98 97 void filter(); 98 /** Revert the document to original. */ 99 void resetFiltering(); 99 100 100 101 QLabel *m_pFilterLabel; -
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerWidget.cpp
r88707 r88728 400 400 } 401 401 402 void UIVMLogViewerWidget::slt TabIndexChange(int tabIndex)402 void UIVMLogViewerWidget::sltCurrentTabChanged(int tabIndex) 403 403 { 404 404 Q_UNUSED(tabIndex); … … 406 406 /* Dont refresh the search here as it is refreshed by the filtering mechanism 407 407 which is updated as tab current index changes: */ 408 if (m_pFilterPanel) 409 m_pFilterPanel->applyFilter(); 408 410 409 411 /* We keep a separate QVector<LogBookmark> for each log page: */ … … 586 588 /* Add into layout: */ 587 589 m_pMainLayout->addWidget(m_pTabWidget); 590 connect(m_pTabWidget, &QITabWidget::currentChanged, this, &UIVMLogViewerWidget::sltCurrentTabChanged); 588 591 #if 0 589 592 m_pCornerButton = new QIToolButton(m_pTabWidget); -
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerWidget.h
r88702 r88728 119 119 void sltHandleSearchUpdated(); 120 120 /** Handles the tab change of the logviewer. */ 121 void slt TabIndexChange(int tabIndex);121 void sltCurrentTabChanged(int tabIndex); 122 122 /* if @a isOriginal true than the result of the filtering is equal to 123 123 the original log file for some reason. */
Note:
See TracChangeset
for help on using the changeset viewer.