forked from qt-creator/qt-creator
Various improvements for BinEditor.
- Saving to file only takes modified data into account. - Search functionality does not exhaust memory anymore. - Searches can be canceled. This required updating the IFindSupport interface and all classes implementing it. No functional changes were done in those. Reviewed-by: mae
This commit is contained in:
@@ -69,7 +69,8 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen
|
||||
m_replaceNextAction(0),
|
||||
m_casesensitiveIcon(":/find/images/casesensitively.png"),
|
||||
m_regexpIcon(":/find/images/regexp.png"),
|
||||
m_wholewordsIcon(":/find/images/wholewords.png")
|
||||
m_wholewordsIcon(":/find/images/wholewords.png"),
|
||||
m_findIncrementalTimer(this), m_findStepTimer(this)
|
||||
{
|
||||
//setup ui
|
||||
m_ui.setupUi(this);
|
||||
@@ -215,6 +216,12 @@ FindToolBar::FindToolBar(FindPlugin *plugin, CurrentDocumentFind *currentDocumen
|
||||
connect(m_currentDocumentFind, SIGNAL(candidateChanged()), this, SLOT(adaptToCandidate()));
|
||||
connect(m_currentDocumentFind, SIGNAL(changed()), this, SLOT(updateToolBar()));
|
||||
updateToolBar();
|
||||
|
||||
m_findIncrementalTimer.setSingleShot(true);
|
||||
m_findStepTimer.setSingleShot(true);
|
||||
connect(&m_findIncrementalTimer, SIGNAL(timeout()),
|
||||
this, SLOT(invokeFindIncremental()));
|
||||
connect(&m_findStepTimer, SIGNAL(timeout()), this, SLOT(invokeFindStep()));
|
||||
}
|
||||
|
||||
FindToolBar::~FindToolBar()
|
||||
@@ -373,17 +380,27 @@ void FindToolBar::selectFindText()
|
||||
|
||||
void FindToolBar::invokeFindStep()
|
||||
{
|
||||
m_findStepTimer.stop();
|
||||
m_findIncrementalTimer.stop();
|
||||
if (m_currentDocumentFind->isEnabled()) {
|
||||
m_plugin->updateFindCompletion(getFindText());
|
||||
m_currentDocumentFind->findStep(getFindText(), effectiveFindFlags());
|
||||
IFindSupport::Result result =
|
||||
m_currentDocumentFind->findStep(getFindText(), effectiveFindFlags());
|
||||
if (result == IFindSupport::NotYetFound)
|
||||
m_findStepTimer.start(50);
|
||||
}
|
||||
}
|
||||
|
||||
void FindToolBar::invokeFindIncremental()
|
||||
{
|
||||
m_findIncrementalTimer.stop();
|
||||
m_findStepTimer.stop();
|
||||
if (m_currentDocumentFind->isEnabled()) {
|
||||
QString text = getFindText();
|
||||
m_currentDocumentFind->findIncremental(text, effectiveFindFlags());
|
||||
IFindSupport::Result result =
|
||||
m_currentDocumentFind->findIncremental(text, effectiveFindFlags());
|
||||
if (result == IFindSupport::NotYetFound)
|
||||
m_findIncrementalTimer.start(50);
|
||||
if (text.isEmpty())
|
||||
m_currentDocumentFind->clearResults();
|
||||
}
|
||||
@@ -421,6 +438,8 @@ void FindToolBar::invokeReplaceAll()
|
||||
|
||||
void FindToolBar::invokeResetIncrementalSearch()
|
||||
{
|
||||
m_findIncrementalTimer.stop();
|
||||
m_findStepTimer.stop();
|
||||
if (m_currentDocumentFind->isEnabled())
|
||||
m_currentDocumentFind->resetIncrementalSearch();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user