diff options
author | vng <viktor.govako@gmail.com> | 2014-10-08 21:00:31 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 02:29:48 +0300 |
commit | a9b2f3eb6593ba83f1db09324b15e4e6a45508ef (patch) | |
tree | dab69735ab4c557bb1b67dc5d93954182b4339af /map/country_status_display.cpp | |
parent | 11047e90634d7587899af2e42326e1d2b085f96f (diff) |
Fixed file size string formatting.
Diffstat (limited to 'map/country_status_display.cpp')
-rw-r--r-- | map/country_status_display.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/map/country_status_display.cpp b/map/country_status_display.cpp index e3dffc35a2..7c36b56e7e 100644 --- a/map/country_status_display.cpp +++ b/map/country_status_display.cpp @@ -11,12 +11,12 @@ #include "../platform/platform.hpp" #include "../base/thread.hpp" - #include "../base/string_format.hpp" #include "../std/bind.hpp" #include "../std/sstream.hpp" + using namespace storage; CountryStatusDisplay::CountryStatusDisplay(Params const & p) @@ -322,18 +322,18 @@ void CountryStatusDisplay::SetContentForState() namespace { - void FormatMapSize(int sizeInBytes, string & units, int & sizeToDownload) + void FormatMapSize(uint64_t sizeInBytes, string & units, uint64_t & sizeToDownload) { int const mbInBytes = 1024 * 1024; int const kbInBytes = 1024; if (sizeInBytes < mbInBytes) { - sizeToDownload = sizeInBytes / kbInBytes; + sizeToDownload = (sizeInBytes + kbInBytes / 2) / kbInBytes; units = "KB"; } else { - sizeToDownload = sizeInBytes / mbInBytes; + sizeToDownload = (sizeInBytes + mbInBytes / 2) / mbInBytes; units = "MB"; } } @@ -349,12 +349,13 @@ void CountryStatusDisplay::SetContentForDownloadPropose() LocalAndRemoteSizeT withRouting = m_activeMaps.GetCountrySize(m_countryIdx, TMapOptions::EMapWithCarRouting); m_label->setText(m_displayMapName); - int sizeToDownload; + uint64_t sizeToDownload; string units; FormatMapSize(mapOnlySize.second, units, sizeToDownload); - m_primaryButton->setText(FormatStatusMessage<int, string>("country_status_download", &sizeToDownload, &units)); + m_primaryButton->setText(FormatStatusMessage("country_status_download", &sizeToDownload, &units)); + FormatMapSize(withRouting.second, units, sizeToDownload); - m_secondaryButton->setText(FormatStatusMessage<int, string>("country_status_download_routing", &sizeToDownload)); + m_secondaryButton->setText(FormatStatusMessage("country_status_download_routing", &sizeToDownload, &units)); } void CountryStatusDisplay::SetContentForProgress() |