ui: basic search view

- Added a basic SearchView (+ controller and qt implementation)
- SearchView can set the active element of other views by dispatching a message.
- SearchView adjusts its text when the active element is changed by other views.
- Added wrappers for Button and EditBox that allow the usage of simple callback functions.
This commit is contained in:
malte_langkabel
2014-07-04 13:43:27 +02:00
parent 9297ea6d6d
commit b1023ba4ac
22 changed files with 356 additions and 6 deletions
+13 -2
View File
@@ -175,9 +175,20 @@ void Storage::logLocations() const
LOG_INFO(str.str());
}
Token* Storage::getToken(Id tokenId) const
Id Storage::getIdForNodeWithName(const std::string& name) const
{
return m_graph.getTokenById(tokenId); // Todo: copy information.
Node* node = m_graph.findNode([&](Node* node){
return node->getName() == name;
});
return (node ? node->getId() : 0);
}
std::string Storage::getNameForNodeWithId(Id id) const
{
Node* node = m_graph.getNodeById(id);
return (node ? node->getName() : "");
}
TokenLocationCollection Storage::getTokenLocationsForTokenId(Id id) const
+4 -1
View File
@@ -45,8 +45,11 @@ public:
void logGraph() const;
void logLocations() const;
virtual Token* getToken(Id tokenId) const;
// GraphAccess implementation
virtual Id getIdForNodeWithName(const std::string& name) const;
virtual std::string getNameForNodeWithId(Id id) const;
// LocationAccess implementation
virtual TokenLocationCollection getTokenLocationsForTokenId(Id locationId) const;
virtual TokenLocationFile getTokenLocationsForLinesInFile(
const std::string& fileName, unsigned int firstLineNumber, unsigned int lastLineNumber
+4 -1
View File
@@ -1,6 +1,8 @@
#ifndef GRAPH_ACCESS_H
#define GRAPH_ACCESS_H
#include <string>
#include "utility/types.h"
class Token;
@@ -10,7 +12,8 @@ class GraphAccess
public:
virtual ~GraphAccess();
virtual Token* getToken(Id tokenId) const = 0;
virtual Id getIdForNodeWithName(const std::string& name) const = 0;
virtual std::string getNameForNodeWithId(Id id) const = 0;
};