forked from organicmaps/organicmaps
[core] downloader API
This commit is contained in:
parent
4307c13006
commit
67b4b0651e
5 changed files with 22 additions and 0 deletions
|
@ -84,6 +84,19 @@ void ActiveMapsLayout::Clear()
|
|||
m_split = { 0, 0 };
|
||||
}
|
||||
|
||||
size_t ActiveMapsLayout::GetSizeToUpdateAllInBytes() const
|
||||
{
|
||||
size_t result = 0;
|
||||
for (int i = m_split.first; i < m_split.second; ++i)
|
||||
{
|
||||
Item const & item = m_items[i];
|
||||
if (item.m_status != TStatus::EInQueue && item.m_status != TStatus::EDownloading)
|
||||
result += GetStorage().CountryByIndex(item.m_index).GetFile().GetRemoteSize(item.m_options);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void ActiveMapsLayout::UpdateAll()
|
||||
{
|
||||
vector<Item> toDownload;
|
||||
|
|
|
@ -41,6 +41,7 @@ public:
|
|||
ActiveMapsLayout(Framework & framework);
|
||||
~ActiveMapsLayout();
|
||||
|
||||
size_t GetSizeToUpdateAllInBytes() const;
|
||||
void UpdateAll();
|
||||
void CancelAll();
|
||||
|
||||
|
|
|
@ -182,6 +182,12 @@ void CountryTree::DeleteCountry(int childPosition, TMapOptions const & options)
|
|||
GetActiveMapLayout().DeleteMap(GetChild(childPosition), options);
|
||||
}
|
||||
|
||||
void CountryTree::RetryDownloading(int childPosition)
|
||||
{
|
||||
ASSERT(IsLeaf(childPosition), ());
|
||||
GetActiveMapLayout().RetryDownloading(GetChild(childPosition));
|
||||
}
|
||||
|
||||
void CountryTree::CancelDownloading(int childPosition)
|
||||
{
|
||||
GetStorage().DeleteFromDownloader(GetChild(childPosition));
|
||||
|
|
|
@ -60,6 +60,7 @@ public:
|
|||
///@{
|
||||
void DownloadCountry(int childPosition, TMapOptions const & options);
|
||||
void DeleteCountry(int childPosition, TMapOptions const & options);
|
||||
void RetryDownloading(int childPosition);
|
||||
///@}
|
||||
void CancelDownloading(int childPosition);
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@ uint32_t CountryFile::GetRemoteSize(TMapOptions opt) const
|
|||
{
|
||||
case TMapOptions::EMapOnly: return m_mapSize;
|
||||
case TMapOptions::ECarRouting: return m_routingSize;
|
||||
case TMapOptions::EMapWithCarRouting : return m_mapSize + m_routingSize;
|
||||
}
|
||||
|
||||
ASSERT(false, ());
|
||||
|
|
Loading…
Add table
Reference in a new issue