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
diff options
context:
space:
mode:
authorvng <viktor.govako@gmail.com>2011-12-29 06:13:42 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 01:31:04 +0300
commitdfa0aa0f59a689d4a2c921e7f066317e7df38a07 (patch)
treeed7e0f4bd85dec3cbc87323880fa5f1b857d0ad8 /storage
parent96c556e962bba2845d0e39c0ec7c98637725daae (diff)
[search] Add final notification when index generation finished.
Diffstat (limited to 'storage')
-rw-r--r--storage/storage.cpp31
-rw-r--r--storage/storage.hpp4
2 files changed, 22 insertions, 13 deletions
diff --git a/storage/storage.cpp b/storage/storage.cpp
index b2074fec79..f460c8a50b 100644
--- a/storage/storage.cpp
+++ b/storage/storage.cpp
@@ -146,6 +146,7 @@ namespace storage
// do nothing
return;
}
+
// remove it from failed list
m_failedCountries.erase(index);
// add it into the queue
@@ -163,8 +164,7 @@ namespace storage
else
{
// notify about "In Queue" status
- if (m_observerChange)
- m_observerChange(index);
+ NotifyStatusChanhed(index);
}
}
@@ -184,6 +184,12 @@ namespace storage
}
};
+ void Storage::NotifyStatusChanhed(TIndex const & index) const
+ {
+ if (m_observerChange)
+ m_observerChange(index);
+ }
+
void Storage::DownloadNextCountryFromQueue()
{
while (!m_queue.empty())
@@ -199,12 +205,13 @@ namespace storage
m_request.reset(HttpRequest::PostJson(URL_SERVERS_LIST,
postBody,
bind(&Storage::OnServerListDownloaded, this, _1)));
- // notify GUI - new status for country, "Downloading"
- if (m_observerChange)
- m_observerChange(index);
+
+ // new status for country, "Downloading"
+ NotifyStatusChanhed(index);
return;
}
}
+
// continue with next country
m_queue.pop_front();
// reset total country's download progress
@@ -213,9 +220,9 @@ namespace storage
m_countryProgress.first = 0;
m_countryProgress.second = CountryByIndex(m_queue.front()).Size().second;
}
- // and notify GUI - new status for country, "OnDisk"
- if (m_observerChange)
- m_observerChange(index);
+
+ // new status for country, "OnDisk"
+ NotifyStatusChanhed(index);
}
}
@@ -289,8 +296,7 @@ namespace storage
}
DeactivateAndDeleteCountry(country, m_removeMap);
- if (m_observerChange)
- m_observerChange(index);
+ NotifyStatusChanhed(index);
if (bounds != m2::RectD::GetEmptyRect())
m_updateRect(bounds);
@@ -340,9 +346,9 @@ namespace storage
// remove failed country from the queue
m_queue.pop_front();
m_failedCountries.insert(index);
+
// notify GUI about failed country
- if (m_observerChange)
- m_observerChange(index);
+ NotifyStatusChanhed(index);
}
else
{
@@ -392,6 +398,7 @@ namespace storage
{
// remove from index set
m_indexGeneration.erase(index);
+ NotifyStatusChanhed(index);
// activate downloaded map piece
m_addMap(fName);
diff --git a/storage/storage.hpp b/storage/storage.hpp
index 1b0e042311..c4abe1f07b 100644
--- a/storage/storage.hpp
+++ b/storage/storage.hpp
@@ -109,7 +109,7 @@ namespace storage
void UpdateAfterSearchIndex(TIndex const & index, string const & fName);
public:
- Storage() {}
+
/// @TODO temporarily made public for Android, refactor
void ReInitCountries(bool forceReload);
@@ -142,5 +142,7 @@ namespace storage
void DeleteCountry(TIndex const & index);
void CheckForUpdate();
+
+ void NotifyStatusChanhed(TIndex const & index) const;
};
}