diff options
author | rachytski <siarhei.rachytski@gmail.com> | 2012-06-05 12:34:07 +0400 |
---|---|---|
committer | Alex Zolotarev <alex@maps.me> | 2015-09-23 01:39:27 +0300 |
commit | 1bd70241ca3d79de5df024d0dcd14fdca558261a (patch) | |
tree | 871802fb5052ecc1113a8035e84f3e2d5127b94c /map/country_status_display.cpp | |
parent | 71507273ae860c446d2e9db3742b7ebdd3be1c93 (diff) |
inserting line break when the display name of the country is too long.
Diffstat (limited to 'map/country_status_display.cpp')
-rw-r--r-- | map/country_status_display.cpp | 45 |
1 files changed, 27 insertions, 18 deletions
diff --git a/map/country_status_display.cpp b/map/country_status_display.cpp index f6a7e5d4af..67ceb76d7d 100644 --- a/map/country_status_display.cpp +++ b/map/country_status_display.cpp @@ -9,12 +9,23 @@ #include "../yg/overlay_renderer.hpp" +string const CountryStatusDisplay::displayName() const +{ + if (!m_mapGroupName.empty()) + return m_mapName + "(" + m_mapGroupName + ")"; + else + return m_mapName; +} + void CountryStatusDisplay::cache() { m_downloadButton->setIsVisible(false); m_statusMsg->setIsVisible(false); + string const dn = displayName(); + strings::UniString s(strings::MakeUniString(dn)); + if (m_countryIdx != storage::TIndex()) { switch (m_countryStatus) @@ -24,12 +35,11 @@ void CountryStatusDisplay::cache() m_statusMsg->setIsVisible(true); ostringstream out; - out << m_mapName; - if (!m_mapGroupName.empty()) - out << "(" << m_mapGroupName << ")"; - - out << " is added to the\ndownloading queue"; + if (s.size() > 13) + out << dn << "\nis added to the\ndownloading queue"; + else + out << dn << " is added to the\ndownloading queue"; m_statusMsg->setText(out.str()); } @@ -41,10 +51,10 @@ void CountryStatusDisplay::cache() ostringstream out; - out << "Downloading " << m_mapName; - - if (!m_mapGroupName.empty()) - out << "(" << m_mapGroupName << ")"; + if (s.size() > 13) + out << "Downloading\n" << dn; + else + out << "Downloading " << dn; out << "(" << m_countryProgress.first * 100 / m_countryProgress.second << "%)"; @@ -55,11 +65,10 @@ void CountryStatusDisplay::cache() { m_downloadButton->setIsVisible(true); - string buttonText = "Download " + m_mapName; - if (!m_mapGroupName.empty()) - buttonText += "(" + m_mapGroupName + ")"; - - m_downloadButton->setText(buttonText); + if (s.size() > 13) + m_downloadButton->setText("Download\n" + dn); + else + m_downloadButton->setText("Download " + dn); } break; case storage::EDownloadFailed: @@ -69,10 +78,10 @@ void CountryStatusDisplay::cache() ostringstream out; - out << "Downloading " << m_mapName; - - if (!m_mapGroupName.empty()) - out << "(" << m_mapGroupName << ")"; + if (s.size() > 13) + out << "Downloading\n" << dn; + else + out << "Downloading " << dn; out << "\nhas failed."; |