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
@@ -0,0 +1,40 @@
#include "component/controller/SearchController.h"
#include "component/view/SearchView.h"
#include "data/access/GraphAccess.h"
#include "utility/messaging/type/MessageActivateToken.h"
SearchController::SearchController(std::shared_ptr<GraphAccess> graphAccess)
: m_graphAccess(graphAccess)
{
}
SearchController::~SearchController()
{
}
void SearchController::search(const std::string& s)
{
LOG_INFO("searching string: \"" + s + "\"");
Id nodeId = m_graphAccess->getIdForNodeWithName(s);
if (nodeId > 0)
{
LOG_INFO("Node with name \"" + s + "\" found.");
MessageActivateToken message(nodeId);
message.dispatch();
}
else
{
LOG_INFO("Node with name \"" + s + "\" not found.");
}
}
void SearchController::handleMessage(MessageActivateToken* message)
{
getView()->setText(m_graphAccess->getNameForNodeWithId(message->tokenId));
}
SearchView* SearchController::getView()
{
return Controller::getView<SearchView>();
}