ui: Added on-screen search feature (issue #79)

* Use menu action "Edit -> Find in View" or Ctrl + D
* UI displayed as search bar at bottom of main window
* Hide search bar with ECS or close button
* Entering a query searches in name of graph nodes and code contents of code view
* Use Enter to iterate through matches, well move match into view in graph and code view
* Checkboxes allow for adding/removing results for certain views
* Create Bookmark shortcut is now CTRL + S

bug id = 79
This commit is contained in:
Eberhard Graether
2017-09-19 14:00:40 +02:00
parent 4731f379f4
commit 95ef8c3eec
64 changed files with 1642 additions and 174 deletions
+23 -6
View File
@@ -143,13 +143,12 @@ QtCodeSnippet* QtCodeFile::addCodeSnippet(const CodeSnippetParams& params)
}
}
m_isCollapsed = false;
std::shared_ptr<QtCodeSnippet> snippet(new QtCodeSnippet(params, m_navigator, this));
if (params.reduced)
{
m_title->setProject(params.title);
m_isCollapsed = false;
}
m_snippetLayout->addWidget(snippet.get());
@@ -172,10 +171,6 @@ QtCodeSnippet* QtCodeFile::addCodeSnippet(const CodeSnippetParams& params)
return m_fileSnippet.get();
}
else
{
m_isCollapsed = false;
}
m_snippets.push_back(snippet);
@@ -229,6 +224,11 @@ QtCodeSnippet* QtCodeFile::insertCodeSnippet(const CodeSnippetParams& params)
QtCodeSnippet* QtCodeFile::getSnippetForLocationId(Id locationId) const
{
if (m_fileSnippet && m_fileSnippet->isVisible() && m_fileSnippet->getLineNumberForLocationId(locationId))
{
return m_fileSnippet.get();
}
for (const std::shared_ptr<QtCodeSnippet>& snippet : m_snippets)
{
if (snippet->getLineNumberForLocationId(locationId))
@@ -438,6 +438,23 @@ void QtCodeFile::updateTitleBar()
m_title->updateTexts();
}
void QtCodeFile::findScreenMatches(const std::string& query, std::vector<std::pair<QtCodeArea*, Id>>* screenMatches)
{
if (m_fileSnippet && m_fileSnippet->isVisible())
{
m_fileSnippet->findScreenMatches(query, screenMatches);
return;
}
for (const std::shared_ptr<QtCodeSnippet>& snippet : m_snippets)
{
if (snippet->isVisible())
{
snippet->findScreenMatches(query, screenMatches);
}
}
}
void QtCodeFile::clickedMinimizeButton()
{
// overview stats