ui: search view autocompletion
- Implemented autocompletion for the QtSearchView. - Added: MessageFinishedParsing that will be dispatched by the Project after the parsing step is done. - Moved the initial MessageActivateToken from the Project to the Application. - Added getNamesForNodesWithNamePrefix() to GraphAccess.
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
#include "data/parser/ParseLocation.h"
|
||||
#include "data/parser/ParseVariable.h"
|
||||
#include "utility/logging/logging.h"
|
||||
#include "utility/utilityString.h"
|
||||
|
||||
Storage::Storage()
|
||||
{
|
||||
@@ -191,6 +192,20 @@ std::string Storage::getNameForNodeWithId(Id id) const
|
||||
return (node ? node->getName() : "");
|
||||
}
|
||||
|
||||
std::vector<std::string> Storage::getNamesForNodesWithNamePrefix(const std::string& prefix) const
|
||||
{
|
||||
std::vector<std::string> names;
|
||||
m_graph.forEachNode([&](Node* node){
|
||||
const std::string& nodeName = node->getName();
|
||||
if (utility::isPrefix(prefix, nodeName))
|
||||
{
|
||||
names.push_back(nodeName);
|
||||
}
|
||||
});
|
||||
|
||||
return names;
|
||||
}
|
||||
|
||||
TokenLocationCollection Storage::getTokenLocationsForTokenId(Id id) const
|
||||
{
|
||||
TokenLocationCollection ret;
|
||||
|
||||
@@ -48,6 +48,7 @@ public:
|
||||
// GraphAccess implementation
|
||||
virtual Id getIdForNodeWithName(const std::string& name) const;
|
||||
virtual std::string getNameForNodeWithId(Id id) const;
|
||||
virtual std::vector<std::string> getNamesForNodesWithNamePrefix(const std::string& prefix) const;
|
||||
|
||||
// LocationAccess implementation
|
||||
virtual TokenLocationCollection getTokenLocationsForTokenId(Id locationId) const;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define GRAPH_ACCESS_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "utility/types.h"
|
||||
|
||||
@@ -14,6 +15,7 @@ public:
|
||||
|
||||
virtual Id getIdForNodeWithName(const std::string& name) const = 0;
|
||||
virtual std::string getNameForNodeWithId(Id id) const = 0;
|
||||
virtual std::vector<std::string> getNamesForNodesWithNamePrefix(const std::string& prefix) const = 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user