void FindToolBar::invokeReplaceAll() { m_plugin->updateFindCompletion(getFindText()); m_plugin->updateReplaceCompletion(getReplaceText()); if (m_currentDocumentFind->isEnabled() && m_currentDocumentFind->supportsReplace()) m_currentDocumentFind->replaceAll(getFindText(), getReplaceText(), effectiveFindFlags()); }
void FindToolBar::openFindToolBar(OpenFlags flags) { installEventFilters(); FindToolBarPlaceHolder *holder = findToolBarPlaceHolder(); if (!holder) return; FindToolBarPlaceHolder *previousHolder = FindToolBarPlaceHolder::getCurrent(); if (previousHolder != holder) { if (previousHolder) previousHolder->setWidget(0); holder->setWidget(this); FindToolBarPlaceHolder::setCurrent(holder); } m_currentDocumentFind->acceptCandidate(); holder->setVisible(true); setVisible(true); // We do not want to change the text when we currently have the focus and user presses the // find shortcut // if (!focus || !toolBarHasFocus()) { if (flags & UpdateFindText) { QString text = m_currentDocumentFind->currentFindString(); if (!text.isEmpty()) setFindText(text); } if (flags & UpdateFocusAndSelect) setFocus(); if (flags & UpdateFindScope) m_currentDocumentFind->defineFindScope(); if (flags & UpdateHighlight) m_currentDocumentFind->highlightAll(getFindText(), effectiveFindFlags()); if (flags & UpdateFocusAndSelect) selectFindText(); }
void FindToolBar::findFlagsChanged() { updateIcons(); updateFlagMenus(); invokeClearResults(); if (isVisible()) m_currentDocumentFind->highlightAll(getFindText(), effectiveFindFlags()); }
void FindToolBar::invokeReplaceStep() { if (m_currentDocumentFind->isEnabled() && m_currentDocumentFind->supportsReplace()) { Find::updateFindCompletion(getFindText()); Find::updateReplaceCompletion(getReplaceText()); m_currentDocumentFind->replaceStep(getFindText(), getReplaceText(), effectiveFindFlags()); } }
void FindToolBar::invokeReplace() { setFindFlag(FindBackward, false); if (m_currentDocumentFind->isEnabled() && m_currentDocumentFind->supportsReplace()) { const FindFlags ef = effectiveFindFlags(); Find::updateFindCompletion(getFindText(), ef); Find::updateReplaceCompletion(getReplaceText()); m_currentDocumentFind->replace(getFindText(), getReplaceText(), ef); } }
void FindToolBar::invokeFindStep() { m_findStepTimer.stop(); m_findIncrementalTimer.stop(); if (m_currentDocumentFind->isEnabled()) { m_plugin->updateFindCompletion(getFindText()); IFindSupport::Result result = m_currentDocumentFind->findStep(getFindText(), effectiveFindFlags()); indicateSearchState(result); if (result == IFindSupport::NotYetFound) m_findStepTimer.start(50); } }
void FindToolBar::updateIcons() { FindFlags effectiveFlags = effectiveFindFlags(); bool casesensitive = effectiveFlags & FindCaseSensitively; bool wholewords = effectiveFlags & FindWholeWords; bool regexp = effectiveFlags & FindRegularExpression; bool preserveCase = effectiveFlags & FindPreserveCase; if (!casesensitive && !wholewords && !regexp && !preserveCase) { m_ui.findEdit->setButtonPixmap(Utils::FancyLineEdit::Left, Utils::StyleHelper::dpiSpecificImageFile(QLatin1Literal(Constants::ICON_MAGNIFIER))); } else { m_ui.findEdit->setButtonPixmap(Utils::FancyLineEdit::Left, IFindFilter::pixmapForFindFlags(effectiveFlags)); } }
void FindToolBar::invokeFindIncremental() { m_findIncrementalTimer.stop(); m_findStepTimer.stop(); if (m_currentDocumentFind->isEnabled()) { QString text = getFindText(); IFindSupport::Result result = m_currentDocumentFind->findIncremental(text, effectiveFindFlags()); indicateSearchState(result); if (result == IFindSupport::NotYetFound) m_findIncrementalTimer.start(50); if (text.isEmpty()) m_currentDocumentFind->clearHighlights(); } }
void FindToolBar::updateIcons() { FindFlags effectiveFlags = effectiveFindFlags(); bool casesensitive = effectiveFlags & FindCaseSensitively; bool wholewords = effectiveFlags & FindWholeWords; bool regexp = effectiveFlags & FindRegularExpression; bool preserveCase = effectiveFlags & FindPreserveCase; if (!casesensitive && !wholewords && !regexp && !preserveCase) { const QIcon icon = Utils::Icons::MAGNIFIER.icon(); m_ui.findEdit->setButtonIcon(Utils::FancyLineEdit::Left, icon); } else { m_ui.findEdit->setButtonIcon(Utils::FancyLineEdit::Left, IFindFilter::pixmapForFindFlags(effectiveFlags)); } }