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:
authorArsentiy Milchakov <milcars@mapswithme.com>2017-11-30 13:09:30 +0300
committerVlad Mihaylenko <vxmihaylenko@gmail.com>2017-11-30 13:57:07 +0300
commit8ea130aefe8de220d511dbcf82415d2917dc5a92 (patch)
tree3511a5bc84cc248cfa562a03d3fed46c1247f3e0 /storage
parent564670a25e07b69488149cb41c54f92a1b082ba7 (diff)
[editor] disable editing during download maps
Diffstat (limited to 'storage')
-rw-r--r--storage/storage.cpp13
-rw-r--r--storage/storage.hpp5
2 files changed, 18 insertions, 0 deletions
diff --git a/storage/storage.cpp b/storage/storage.cpp
index 2455e2d38f..54c2300229 100644
--- a/storage/storage.cpp
+++ b/storage/storage.cpp
@@ -497,9 +497,15 @@ void Storage::DownloadCountry(TCountryId const & countryId, MapOptions opt)
m_failedCountries.erase(countryId);
m_queue.push_back(QueuedCountry(countryId, opt));
if (m_queue.size() == 1)
+ {
+ if (m_startDownloadingCallback)
+ m_startDownloadingCallback();
DownloadNextCountryFromQueue();
+ }
else
+ {
NotifyStatusChangedForHierarchy(countryId);
+ }
SaveDownloadQueue();
}
@@ -1440,6 +1446,13 @@ bool Storage::IsPossibleToAutoupdate() const
return m_diffManager.IsPossibleToAutoupdate();
}
+void Storage::SetStartDownloadingCallback(StartDownloadingCallback const & cb)
+{
+ ASSERT_THREAD_CHECKER(m_threadChecker, ());
+
+ m_startDownloadingCallback = cb;
+}
+
void Storage::OnDiffStatusReceived(diffs::Status const status)
{
if (status != diffs::Status::NotAvailable)
diff --git a/storage/storage.hpp b/storage/storage.hpp
index f63056aed4..e79983b650 100644
--- a/storage/storage.hpp
+++ b/storage/storage.hpp
@@ -141,6 +141,7 @@ class Storage : public diffs::Manager::Observer
{
public:
struct StatusCallback;
+ using StartDownloadingCallback = function<void()>;
using TUpdateCallback = function<void(storage::TCountryId const &, TLocalFilePtr const)>;
using TDeleteCallback = function<bool(storage::TCountryId const &, TLocalFilePtr const)>;
using TChangeCountryFunction = function<void(TCountryId const &)>;
@@ -251,6 +252,8 @@ private:
vector<vector<string>> m_deferredDownloads;
+ StartDownloadingCallback m_startDownloadingCallback;
+
void DownloadNextCountryFromQueue();
void LoadCountriesFile(string const & pathToCountriesFile, string const & dataDir,
@@ -557,6 +560,8 @@ public:
/// diffs.
bool IsPossibleToAutoupdate() const;
+ void SetStartDownloadingCallback(StartDownloadingCallback const & cb);
+
private:
friend struct UnitClass_StorageTest_DeleteCountry;
friend struct UnitClass_TwoComponentStorageTest_DeleteCountry;