diff options
author | ExMix <rahuba.youri@mapswithme.com> | 2014-10-03 17:29:07 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:29:16 +0300 |
commit | 08f3d9b5d213af7af88f19e0f1b8bec00d5ca4c3 (patch) | |
tree | 4034676853915b448611f0a74b6803bc08e44b6e /map/active_maps_layout.hpp | |
parent | 160753d1ba978769bbe063dcff630c229e3a7d22 (diff) |
[core] interfaces for downloader GUI
Diffstat (limited to 'map/active_maps_layout.hpp')
-rw-r--r-- | map/active_maps_layout.hpp | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/map/active_maps_layout.hpp b/map/active_maps_layout.hpp new file mode 100644 index 0000000000..40c89c1703 --- /dev/null +++ b/map/active_maps_layout.hpp @@ -0,0 +1,53 @@ +#pragma once + +#include "../storage/storage_defines.hpp" + +#include "../std/string.hpp" + +class ActiveMapsLayout +{ +public: + enum class TGroup + { + ENewMap, + EOutOfDate, + EUpToDate + }; + + class ActiveMapsListener + { + public: + /// if some country been inserted than oldGroup == newGroup, and oldPosition == -1 + /// if some country been deleted than oldGroup == newGroup, and newPosition == -1 + /// if group of country been changed. than oldGroup != newGroup, oldPosition >= 0 and newPosition >= 0 + virtual void CountryGroupChanged(TGroup const & oldGroup, int oldPosition, + TGroup const & newGroup, int newPosition) = 0; + virtual void CountryStatusChanged(TGroup const & group, int position) = 0; + virtual void CountryOptionsChanged(TGroup const & group, int position) = 0; + virtual void DownloadingProgressUpdate(TGroup const & group, int position, + storage::LocalAndRemoteSizeT const & progress) = 0; + }; + + ActiveMapsLayout(); + + int GetCountInGroup(TGroup const & group) const; + string const & GetCountryName(TGroup const & group, int position) const; + storage::TStatus GetCountryStatus(TGroup const & group, int position) const; + storage::TMapOptions GetCountryOptions(TGroup const & group, int position) const; + + /// set to nullptr when go out from ActiveMaps activity + void SetActiveMapsListener(ActiveMapsListener * listener); + + void ChangeCountryOptions(TGroup const & group, int position, storage::TMapOptions const & options); + void ResumeDownloading(TGroup const & group, int position); + + void IsDownloadingActive() const; + void CancelDownloading(TGroup const & group, int position); + void CancelAllDownloading(); + +private: + /// ENewMap - [0, TRangeSplit.first) + /// EOutOfDate - [TRangeSplit.first, TRangeSplit.second) + /// EUpToDate - [TRangeSplit.second, m_items.size) + typedef pair<int, int> TRangeSplit; +}; |