- Timestamp:
- Jan 7, 2018 3:28:26 PM (7 years ago)
- 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 66 66 /* We start the search from the end of the doc. assuming log's end is more interesting: */ 67 67 search(BackwardSearch, true); 68 emit sigHighlightingUpdated(); 68 69 } 69 70 … … 109 110 } 110 111 111 void UIVMLogViewerSearchPanel:: findCurrent(const QString &strSearchString)112 void UIVMLogViewerSearchPanel::sltSearchTextChanged(const QString &strSearchString) 112 113 { 113 114 /* Enable/disable Next-Previous buttons as per search-string validity: */ … … 115 116 m_pNextPrevButtons->setEnabled(1, strSearchString.length()); 116 117 117 /* If search-string is valid: */118 if ( strSearchString.length())118 /* If search-string is not empty: */ 119 if (!strSearchString.isEmpty()) 119 120 { 120 121 /* Reset the position to force the search restart from the document's end: */ 121 122 m_iSearchPosition = 0; 122 123 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: */ 125 127 else 126 128 { … … 135 137 pBrowser->setTextCursor(cursor); 136 138 } 139 m_iSearchPosition = -1; 140 clearHighlighting(-1); 137 141 } 138 142 } … … 156 160 else 157 161 { 162 /* we need this check not to remove the 'not found' label 163 when the user toggles with this checkbox: */ 158 164 if (m_iMatchCount != 0) 159 m_iMatchCount = -1; 160 161 m_matchLocationVector.clear(); 162 pDocument->undo(); 165 clearHighlighting(-1); 166 else 167 clearHighlighting(0); 163 168 } 164 169 configureInfoLabels(); … … 340 345 /* Prepare connections: */ 341 346 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); 343 348 connect(m_pNextPrevButtons, &UIRoundRectSegmentedButton::clicked, this, &UIVMLogViewerSearchPanel::find); 344 349 connect(m_pHighlightAllCheckBox, &QCheckBox::stateChanged, … … 544 549 m_iSearchPosition = resultCursor.position(); 545 550 configureInfoLabels(); 546 emit sigHighlightingUpdated();547 551 } 548 552 … … 555 559 { 556 560 search(BackwardSearch, false); 561 } 562 563 void 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(); 557 577 } 558 578 … … 560 580 const QString &searchString) 561 581 { 562 m_iMatchCount = 0;563 m_matchLocationVector.clear(); 582 clearHighlighting(0); 583 564 584 if (!pDocument) 565 585 return; … … 567 587 return; 568 588 569 pDocument->undo();570 589 QTextCursor highlightCursor(pDocument); 571 590 QTextCharFormat colorFormat(highlightCursor.charFormat()); -
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerSearchPanel.h
r70475 r70476 67 67 /** Handles textchanged signal from search-editor. 68 68 * @param strSearchString Specifies search-string. */ 69 void findCurrent(const QString &strSearchString);69 void sltSearchTextChanged(const QString &strSearchString); 70 70 void sltHighlightAllCheckBox(); 71 71 void sltCaseSentitiveCheckBox(); … … 90 90 /** Handles Qt show @a pEvent. */ 91 91 void showEvent(QShowEvent *pEvent); 92 92 /** Clear the result of highlight */ 93 void clearHighlight(); 94 void clearHighlighting(int count); 93 95 94 96 /** Search routine. -
trunk/src/VBox/Frontends/VirtualBox/src/logviewer/UIVMLogViewerWidget.cpp
r70473 r70476 105 105 QPainter painter(this); 106 106 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)); 108 108 painter.drawLine(p1, p2); 109 109 } … … 115 115 QVector<float> m_markingsVector; 116 116 }; 117 117 118 UIVMLogViewerWidget::UIVMLogViewerWidget(EmbedTo enmEmbedding, QWidget *pParent /* = 0 */, const CMachine &machine /* = CMachine() */) 118 119 : QIWithRetranslateUI<QWidget>(pParent)
Note:
See TracChangeset
for help on using the changeset viewer.