VirtualBox

Changeset 70476 in vbox for trunk/src


Ignore:
Timestamp:
Jan 7, 2018 3:28:26 PM (7 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9072 Some debugging in logviewer search functionality

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

Legend:

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

    r70475 r70476  
    6666    /* We start the search from the end of the doc. assuming log's end is more interesting: */
    6767    search(BackwardSearch, true);
     68    emit sigHighlightingUpdated();
    6869}
    6970
     
    109110}
    110111
    111 void UIVMLogViewerSearchPanel::findCurrent(const QString &strSearchString)
     112void UIVMLogViewerSearchPanel::sltSearchTextChanged(const QString &strSearchString)
    112113{
    113114    /* Enable/disable Next-Previous buttons as per search-string validity: */
     
    115116    m_pNextPrevButtons->setEnabled(1, strSearchString.length());
    116117
    117     /* If search-string is valid: */
    118     if (strSearchString.length())
     118    /* If search-string is not empty: */
     119    if (!strSearchString.isEmpty())
    119120    {
    120121        /* Reset the position to force the search restart from the document's end: */
    121122        m_iSearchPosition = 0;
    122123        search(BackwardSearch, true);
    123     }
    124     /* If search-string is not valid, reset cursor position: */
     124        emit sigHighlightingUpdated();
     125    }
     126    /* If search-string is empty, reset cursor position: */
    125127    else
    126128    {
     
    135137            pBrowser->setTextCursor(cursor);
    136138        }
     139        m_iSearchPosition = -1;
     140        clearHighlighting(-1);
    137141    }
    138142}
     
    156160    else
    157161    {
     162        /* we need this check not to remove the 'not found' label
     163           when the user toggles with this checkbox: */
    158164        if (m_iMatchCount != 0)
    159             m_iMatchCount = -1;
    160 
    161         m_matchLocationVector.clear();
    162         pDocument->undo();
     165            clearHighlighting(-1);
     166        else
     167            clearHighlighting(0);
    163168    }
    164169    configureInfoLabels();
     
    340345    /* Prepare connections: */
    341346    connect(m_pCloseButton, &UIMiniCancelButton::clicked, this, &UIVMLogViewerSearchPanel::hide);
    342     connect(m_pSearchEditor, &UISearchField::textChanged, this, &UIVMLogViewerSearchPanel::findCurrent);
     347    connect(m_pSearchEditor, &UISearchField::textChanged, this, &UIVMLogViewerSearchPanel::sltSearchTextChanged);
    343348    connect(m_pNextPrevButtons, &UIRoundRectSegmentedButton::clicked, this, &UIVMLogViewerSearchPanel::find);
    344349    connect(m_pHighlightAllCheckBox, &QCheckBox::stateChanged,
     
    544549   m_iSearchPosition = resultCursor.position();
    545550   configureInfoLabels();
    546    emit sigHighlightingUpdated();
    547551}
    548552
     
    555559{
    556560    search(BackwardSearch, false);
     561}
     562
     563void UIVMLogViewerSearchPanel::clearHighlighting(int count)
     564{
     565    m_iMatchCount = count;
     566    m_matchLocationVector.clear();
     567
     568    QPlainTextEdit *pBrowser = m_pViewer->currentLogPage();
     569    if(pBrowser)
     570    {
     571        QTextDocument* pDocument = pBrowser->document();
     572        if(pDocument)
     573            pDocument->undo();
     574    }
     575    configureInfoLabels();
     576    emit sigHighlightingUpdated();
    557577}
    558578
     
    560580                                            const QString &searchString)
    561581{
    562     m_iMatchCount = 0;
    563     m_matchLocationVector.clear();
     582    clearHighlighting(0);
     583
    564584    if (!pDocument)
    565585        return;
     
    567587        return;
    568588
    569     pDocument->undo();
    570589    QTextCursor highlightCursor(pDocument);
    571590    QTextCharFormat colorFormat(highlightCursor.charFormat());
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerSearchPanel.h

    r70475 r70476  
    6767    /** Handles textchanged signal from search-editor.
    6868      * @param  strSearchString  Specifies search-string. */
    69     void findCurrent(const QString &strSearchString);
     69    void sltSearchTextChanged(const QString &strSearchString);
    7070    void sltHighlightAllCheckBox();
    7171    void sltCaseSentitiveCheckBox();
     
    9090    /** Handles Qt show @a pEvent. */
    9191    void showEvent(QShowEvent *pEvent);
    92 
     92    /** Clear the result of highlight */
     93    void clearHighlight();
     94    void clearHighlighting(int count);
    9395
    9496    /** Search routine.
  • trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerWidget.cpp

    r70473 r70476  
    105105            QPainter painter(this);
    106106            painter.setRenderHint(QPainter::Antialiasing, true);
    107             painter.setPen(QPen(QColor(255, 0, 0, 255), 1.2f));
     107            painter.setPen(QPen(QColor(255, 0, 0, 75), 1.1f));
    108108            painter.drawLine(p1, p2);
    109109        }
     
    115115    QVector<float> m_markingsVector;
    116116};
     117
    117118UIVMLogViewerWidget::UIVMLogViewerWidget(EmbedTo enmEmbedding, QWidget *pParent /* = 0 */, const CMachine &machine /* = CMachine() */)
    118119    : QIWithRetranslateUI<QWidget>(pParent)
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