src: removed query syntax
This change removes the query syntax from the QtSmartSearchbox and all its classes. Now it only autocompletes to one single Token, but the UI functionality for composing a query of multiple elements is still left for later use. The struct SearchMatch is now used in the whole pipeline for passing search results back and forth.
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
#ifndef MESSAGE_SEARCH_H
|
||||
#define MESSAGE_SEARCH_H
|
||||
|
||||
#include <deque>
|
||||
|
||||
#include "utility/messaging/Message.h"
|
||||
#include "utility/utilityString.h"
|
||||
|
||||
@@ -12,12 +10,7 @@ class MessageSearch
|
||||
: public Message<MessageSearch>
|
||||
{
|
||||
public:
|
||||
MessageSearch(const std::string& query)
|
||||
: m_query(query)
|
||||
{
|
||||
}
|
||||
|
||||
MessageSearch(const std::deque<SearchMatch>& matches)
|
||||
MessageSearch(const std::vector<SearchMatch>& matches)
|
||||
: m_matches(matches)
|
||||
{
|
||||
}
|
||||
@@ -27,24 +20,18 @@ public:
|
||||
return "MessageSearch";
|
||||
}
|
||||
|
||||
std::string getQuery() const
|
||||
std::string getMatchesAsString() const
|
||||
{
|
||||
if (m_query.size())
|
||||
{
|
||||
return m_query;
|
||||
}
|
||||
|
||||
return utility::join(SearchMatch::searchMatchDequeToStringDeque(m_matches), "");
|
||||
return SearchMatch::searchMatchesToString(m_matches);
|
||||
}
|
||||
|
||||
const std::deque<SearchMatch>& getMatches() const
|
||||
const std::vector<SearchMatch>& getMatches() const
|
||||
{
|
||||
return m_matches;
|
||||
}
|
||||
|
||||
private:
|
||||
const std::string m_query;
|
||||
const std::deque<SearchMatch> m_matches;
|
||||
const std::vector<SearchMatch> m_matches;
|
||||
};
|
||||
|
||||
#endif // MESSAGE_SEARCH_H
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#ifndef UTILITY_H
|
||||
#define UTILITY_H
|
||||
|
||||
#include <deque>
|
||||
#include <chrono>
|
||||
#include <set>
|
||||
|
||||
@@ -23,6 +24,9 @@ namespace utility
|
||||
template<typename T>
|
||||
void append(std::set<T>& a, const std::set<T>& b);
|
||||
|
||||
template<typename T>
|
||||
std::vector<T> toVector(const std::deque<T>& d);
|
||||
|
||||
bool intersectionPoint(Vec2f a1, Vec2f b1, Vec2f a2, Vec2f b2, Vec2f* i);
|
||||
|
||||
size_t digits(size_t n);
|
||||
@@ -49,4 +53,12 @@ void utility::append(std::set<T>& a, const std::set<T>& b)
|
||||
a.insert(b.begin(), b.end());
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
std::vector<T> utility::toVector(const std::deque<T>& d)
|
||||
{
|
||||
std::vector<T> v;
|
||||
v.insert(v.begin(), d.begin(), d.end());
|
||||
return v;
|
||||
}
|
||||
|
||||
#endif // UTILITY_H
|
||||
|
||||
Reference in New Issue
Block a user