ui: Colors in SearchView

Show the right colors in SearchView for the different NodeTypes or QueryNodeTyps

Note: add colors to your Applcationsettings like in the template

fortune cookie message = recognition will come from unexpected sources
This commit is contained in:
Andreas Stallinger
2015-03-04 11:55:25 +01:00
parent 284fb336a6
commit da1a6d69c4
32 changed files with 455 additions and 100 deletions
+20
View File
@@ -686,6 +686,20 @@ std::string Storage::getNameForNodeWithId(Id id) const
}
}
Node::NodeType Storage::getNodeTypeForNodeWithId(Id id) const
{
Token* token = m_graph.getTokenById(id);
if(!token)
{
return Node::NODE_UNDEFINED;
}
if(!token->isEdge())
{
return dynamic_cast<Node*>(token)->getType();
}
return Node::NODE_UNDEFINED;
}
std::vector<SearchMatch> Storage::getAutocompletionMatches(const std::string& query, const std::string& word) const
{
SearchResults tokenResults;
@@ -711,11 +725,17 @@ std::vector<SearchMatch> Storage::getAutocompletionMatches(const std::string& qu
{
if (!match.tokenIds.size())
{
match.queryNodeType = QueryNode::QUERYNODETYPE_COMMAND;
continue;
}
Token* token = m_graph.getTokenById(*match.tokenIds.cbegin());
if(!token->isEdge())
{
match.nodeType = dynamic_cast<Node*>(token)->getType();
}
match.typeName = token->getTypeString();
match.queryNodeType = QueryNode::QUERYNODETYPE_TOKEN;
}
return matches;