Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/qt
diff options
context:
space:
mode:
authorvng <viktor.govako@gmail.com>2012-06-19 11:44:34 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 01:40:00 +0300
commita39dab692b9e23a875a18c33969a89fe8b615234 (patch)
tree428d462ca0bd6cac2a804af54af6985223517c43 /qt
parent327d99e9da5ec9f3dbe8484cd3ae09fdf0fdad92 (diff)
[search] Remove "query" logic from all platforms. Now it's invalid because of search query filtering.
Diffstat (limited to 'qt')
-rw-r--r--qt/search_panel.cpp24
-rw-r--r--qt/search_panel.hpp17
2 files changed, 16 insertions, 25 deletions
diff --git a/qt/search_panel.cpp b/qt/search_panel.cpp
index 4b249f3b23..121bb17060 100644
--- a/qt/search_panel.cpp
+++ b/qt/search_panel.cpp
@@ -20,7 +20,7 @@ namespace qt
{
SearchPanel::SearchPanel(DrawWidget * drawWidget, QWidget * parent)
- : QWidget(parent), m_pDrawWidget(drawWidget), m_busyIcon(":/ui/busy.png"), m_queryId(0)
+ : QWidget(parent), m_pDrawWidget(drawWidget), m_busyIcon(":/ui/busy.png")
{
m_pEditor = new QLineEdit(this);
connect(m_pEditor, SIGNAL(textChanged(QString const &)),
@@ -52,21 +52,16 @@ SearchPanel::SearchPanel(DrawWidget * drawWidget, QWidget * parent)
setLayout(verticalLayout);
// for multithreading support
- CHECK(connect(this, SIGNAL(SearchResultSignal(ResultsT *, int)),
- this, SLOT(OnSearchResult(ResultsT *, int)), Qt::QueuedConnection), ());
+ CHECK(connect(this, SIGNAL(SearchResultSignal(ResultsT *)),
+ this, SLOT(OnSearchResult(ResultsT *)), Qt::QueuedConnection), ());
setFocusPolicy(Qt::StrongFocus);
setFocusProxy(m_pEditor);
}
-SearchPanel::~SearchPanel()
+void SearchPanel::SearchResultThreadFunc(ResultsT const & result)
{
-}
-
-void SearchPanel::SearchResultThreadFunc(ResultsT const & result, int queryId)
-{
- if (queryId == m_queryId)
- emit SearchResultSignal(new ResultsT(result), queryId);
+ emit SearchResultSignal(new ResultsT(result));
}
namespace
@@ -113,11 +108,8 @@ namespace
*/
}
-void SearchPanel::OnSearchResult(ResultsT * res, int queryId)
+void SearchPanel::OnSearchResult(ResultsT * res)
{
- if (queryId != m_queryId)
- return;
-
// clear old results
m_pTable->clear();
m_pTable->setRowCount(0);
@@ -170,15 +162,13 @@ void SearchPanel::OnSearchResult(ResultsT * res, int queryId)
void SearchPanel::OnSearchTextChanged(QString const & str)
{
- ++m_queryId;
-
QString const normalized = str.normalized(QString::NormalizationForm_KC);
// search even with empty query
//if (!normalized.isEmpty())
{
m_params.m_query = normalized.toUtf8().constData();
- m_params.m_callback = bind(&SearchPanel::SearchResultThreadFunc, this, _1, m_queryId);
+ m_params.m_callback = bind(&SearchPanel::SearchResultThreadFunc, this, _1);
m_pDrawWidget->Search(m_params);
diff --git a/qt/search_panel.hpp b/qt/search_panel.hpp
index eff30901a4..1ccc5cc510 100644
--- a/qt/search_panel.hpp
+++ b/qt/search_panel.hpp
@@ -32,29 +32,30 @@ class SearchPanel : public QWidget
typedef search::Results ResultsT;
typedef search::Result ResultT;
vector<ResultT> m_results;
- int volatile m_queryId;
search::SearchParams m_params;
Q_OBJECT
-signals:
- void SearchResultSignal(ResultsT * result, int queryId);
+public:
+ SearchPanel(DrawWidget * drawWidget, QWidget * parent);
private:
- void SearchResultThreadFunc(ResultsT const & result, int queryId);
virtual void showEvent(QShowEvent *);
virtual void hideEvent(QHideEvent *);
-public:
- explicit SearchPanel(DrawWidget * drawWidget, QWidget * parent);
- ~SearchPanel();
+ void SearchResultThreadFunc(ResultsT const & result);
+
+signals:
+ void SearchResultSignal(ResultsT * result);
private slots:
void OnSearchPanelItemClicked(int row, int column);
void OnSearchTextChanged(QString const &);
+
/// Called via signal to support multithreading
- void OnSearchResult(ResultsT * result, int queryId);
+ void OnSearchResult(ResultsT * result);
+
void OnViewportChanged();
void OnAnimationTimer();
void OnClearButton();