VirtualBox

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


Ignore:
Timestamp:
Apr 27, 2021 12:56:38 PM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
144052
Message:

FE/Qt: bugref:9930. More fixing related to filtering

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

Legend:

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

    r88728 r88734  
    328328    return m_iLogFileId;
    329329}
     330
     331void UIVMLogPage::scrollToEnd()
     332{
     333    if (m_pTextEdit)
     334        m_pTextEdit->scrollToEnd();
     335}
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogPage.h

    r88728 r88734  
    102102    int logFileId() const;
    103103
     104    void scrollToEnd();
     105
    104106private slots:
    105107
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerFilterPanel.cpp

    r88728 r88734  
    266266void UIVMLogViewerFilterPanel::applyFilter()
    267267{
    268     filter();
     268    if (isVisible())
     269        filter();
     270    else
     271        resetFiltering();
    269272    retranslateUi();
    270273}
     
    294297
    295298    if (m_filterTermSet.empty())
    296     {
    297         document->setPlainText(*originalLogString);
    298         emit sigFilterApplied(true /* isOriginalLog */);
    299         m_iFilteredLineCount = document->lineCount();
    300         return;
    301     }
     299        resetFiltering();
    302300
    303301    /* Prepare filter-data: */
     
    325323
    326324    emit sigFilterApplied(false /* isOriginalLog */);
    327 }
    328 
    329 void resetFiltering()
    330 {
     325    logPage->scrollToEnd();
     326}
     327
     328void UIVMLogViewerFilterPanel::resetFiltering()
     329{
     330    UIVMLogPage *logPage = viewer()->currentLogPage();
     331    QTextDocument *document = textDocument();
     332    if (!logPage || !document)
     333        return;
     334
     335    document->setPlainText(logPage->logString());
     336    m_iFilteredLineCount = document->lineCount();
     337    m_iUnfilteredLineCount = document->lineCount();
     338    logPage->scrollToEnd();
    331339}
    332340
     
    390398        return;
    391399    m_filterTermSet.clear();
    392     applyFilter();
     400    resetFiltering();
    393401    if (m_pFilterTermsLineEdit)
    394402        m_pFilterTermsLineEdit->clearAll();
     
    601609    /* Set focus to combo-box: */
    602610    m_pFilterComboBox->setFocus();
     611    applyFilter();
     612}
     613
     614void UIVMLogViewerFilterPanel::hideEvent(QHideEvent *pEvent)
     615{
     616    UIVMLogViewerPanel::hideEvent(pEvent);
     617    applyFilter();
    603618}
    604619
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerFilterPanel.h

    r88728 r88734  
    7373    bool eventFilter(QObject *pObject, QEvent *pEvent) /* override */;
    7474    void showEvent(QShowEvent *pEvent) /* override */;
     75    void hideEvent(QHideEvent *pEvent) /* override */;
    7576
    7677private slots:
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerSearchPanel.cpp

    r88707 r88734  
    415415void UIVMLogViewerSearchPanel::clearHighlighting()
    416416{
    417     // if (!viewer())
    418     //     return;
    419     // QTextDocument* pDocument = textDocument();
    420     // if (pDocument)
    421     //     pDocument->undo();
    422 
    423417    QPlainTextEdit *pTextEdit = textEdit();
    424418    if (pTextEdit)
     
    430424{
    431425    clearHighlighting();
    432     // if (!pDocument)
    433     //     return;
    434     // if (searchString.isEmpty())
    435     //     return;
    436 
    437     // QTextCursor highlightCursor(pDocument);
    438     // QTextCharFormat colorFormat(highlightCursor.charFormat());
    439     // QTextCursor cursor(pDocument);
    440     // cursor.beginEditBlock();
    441     // colorFormat.setBackground(Qt::yellow);
    442     // for (int i = 0; i < m_matchedCursorPosition.size(); ++i)
    443     // {
    444     //     highlightCursor.setPosition(m_matchedCursorPosition[i]);
    445     //     highlightCursor.setPosition(m_matchedCursorPosition[i] + searchString.length(), QTextCursor::KeepAnchor);
    446 
    447     //     if (!highlightCursor.isNull())
    448     //     {
    449     //         highlightCursor.mergeCharFormat(colorFormat);
    450     //     }
    451     // }
    452     // cursor.endEditBlock();
    453426    QPlainTextEdit *pTextEdit = textEdit();
    454427
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerTextEdit.cpp

    r82968 r88734  
    416416}
    417417
     418void UIVMLogViewerTextEdit::scrollToEnd()
     419{
     420    moveCursor(QTextCursor::End);
     421    ensureCursorVisible();
     422}
     423
    418424int UIVMLogViewerTextEdit::visibleLineCount()
    419425{
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerTextEdit.h

    r82968 r88734  
    5454
    5555    void scrollToLine(int lineNumber);
     56    void scrollToEnd();
    5657    void setBookmarkLineSet(const QSet<int>& lineSet);
    5758    void setShownTextIsFiltered(bool warning);
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