forked from organicmaps/organicmaps
[desktop] Run progress only when needed.
This commit is contained in:
parent
d5340b7982
commit
b6836459f3
3 changed files with 12 additions and 10 deletions
|
@ -480,7 +480,7 @@ namespace qt
|
|||
}
|
||||
}
|
||||
|
||||
void DrawWidget::Search(search::SearchParams params)
|
||||
bool DrawWidget::Search(search::SearchParams params)
|
||||
{
|
||||
if (m_framework->GetCurrentPosition(params.m_lat, params.m_lon))
|
||||
{
|
||||
|
@ -488,7 +488,7 @@ namespace qt
|
|||
params.m_validPos = true;
|
||||
}
|
||||
|
||||
m_framework->Search(params);
|
||||
return m_framework->Search(params);
|
||||
}
|
||||
|
||||
void DrawWidget::ShowSearchResult(search::Result const & res)
|
||||
|
|
|
@ -80,7 +80,7 @@ namespace qt
|
|||
|
||||
void SetScaleControl(QScaleSlider * pScale);
|
||||
|
||||
void Search(search::SearchParams params);
|
||||
bool Search(search::SearchParams params);
|
||||
void ShowSearchResult(search::Result const & res);
|
||||
void CloseSearch();
|
||||
|
||||
|
|
|
@ -155,6 +155,7 @@ void SearchPanel::OnSearchResult(ResultsT * res)
|
|||
}
|
||||
|
||||
delete res;
|
||||
|
||||
// stop search busy indicator
|
||||
m_pAnimationTimer->stop();
|
||||
m_pClearButton->setIcon(QIcon(":/ui/x.png"));
|
||||
|
@ -170,14 +171,15 @@ void SearchPanel::OnSearchTextChanged(QString const & str)
|
|||
m_params.m_query = normalized.toUtf8().constData();
|
||||
m_params.m_callback = bind(&SearchPanel::SearchResultThreadFunc, this, _1);
|
||||
|
||||
m_pDrawWidget->Search(m_params);
|
||||
if (m_pDrawWidget->Search(m_params))
|
||||
{
|
||||
// show busy indicator
|
||||
if (!m_pAnimationTimer->isActive())
|
||||
m_pAnimationTimer->start(200);
|
||||
|
||||
// show busy indicator
|
||||
if (!m_pAnimationTimer->isActive())
|
||||
m_pAnimationTimer->start(200);
|
||||
OnAnimationTimer();
|
||||
m_pClearButton->setFlat(true);
|
||||
m_pClearButton->setVisible(true);
|
||||
m_pClearButton->setFlat(true);
|
||||
m_pClearButton->setVisible(true);
|
||||
}
|
||||
}
|
||||
//else
|
||||
//{
|
||||
|
|
Loading…
Add table
Reference in a new issue