ui: integrated autocompletion and filtering into SearchView

- QtSearchView was split into QtSearchView and QtSearchBox.
- QtSearchBox contains all Qt elements and can use them purely
- QtSearchView forwards calls from the SearchController to QtSearchBox
- Searching is initiated with MessageSearch to the SearchController
- Autocompletion is initiated with MessageSearchAutocomplete to the SearchController
- The search field is able to create filter queries by only giving autocompletions for the last token in the query
- For named tokens the search field adds their token ids to the query in the form of "A,25" for faster lookup

bug id = #21
This commit is contained in:
Eberhard Graether
2014-09-11 14:53:03 +02:00
parent 760e5ffafd
commit fec7abbc9b
48 changed files with 786 additions and 391 deletions
@@ -0,0 +1,23 @@
#ifndef MESSAGE_SEARCH_H
#define MESSAGE_SEARCH_H
#include "utility/messaging/Message.h"
#include "utility/types.h"
class MessageSearch: public Message<MessageSearch>
{
public:
MessageSearch(const std::string& query)
: query(query)
{
}
static const std::string getStaticType()
{
return "MessageSearch";
}
const std::string query;
};
#endif // MESSAGE_SEARCH_H
@@ -0,0 +1,23 @@
#ifndef MESSAGE_SEARCH_AUTOCOMPLETE_H
#define MESSAGE_SEARCH_AUTOCOMPLETE_H
#include "utility/messaging/Message.h"
#include "utility/types.h"
class MessageSearchAutocomplete: public Message<MessageSearchAutocomplete>
{
public:
MessageSearchAutocomplete(const std::string& query)
: query(query)
{
}
static const std::string getStaticType()
{
return "MessageSearchAutocomplete";
}
const std::string query;
};
#endif // MESSAGE_SEARCH_AUTOCOMPLETE_H
+31
View File
@@ -1,6 +1,7 @@
#ifndef UTILITY_STRING_H
#define UTILITY_STRING_H
#include <sstream>
#include <string>
#include <vector>
@@ -12,6 +13,12 @@ namespace utility
template<typename ContainerType>
ContainerType split(const std::string& str, const std::string& delimiter);
template<typename ContainerType>
std::string join(const ContainerType& list, char delimiter);
template<typename ContainerType>
std::string join(const ContainerType& list, const std::string& delimiter);
template<typename ContainerType>
ContainerType tokenize(const std::string& str, char delimiter);
@@ -53,6 +60,30 @@ ContainerType utility::split(const std::string& str, const std::string& delimite
return c;
}
template<typename ContainerType>
std::string utility::join(const ContainerType& list, char delimiter)
{
return join<ContainerType>(list, std::string(1, delimiter));
}
template<typename ContainerType>
std::string utility::join(const ContainerType& list, const std::string& delimiter)
{
std::stringstream ss;
bool first = true;
for (const std::string& str : list)
{
if (!first)
{
ss << delimiter;
}
first = false;
ss << str;
}
return ss.str();
}
template<typename ContainerType>
ContainerType utility::tokenize(const std::string& str, char delimiter)
{