From bff75f3597186a55b1de78e9b1ad1b44191daff6 Mon Sep 17 00:00:00 2001 From: "r.kuznetsov" Date: Thu, 21 Jan 2016 15:58:34 +0300 Subject: [PATCH] [old-map-downloader] Removed download button without routing --- drape_frontend/color_constants.cpp | 12 ++++-------- drape_frontend/color_constants.hpp | 2 -- drape_frontend/drape_engine.cpp | 1 - drape_frontend/gui/country_status.cpp | 6 ------ drape_frontend/gui/country_status_helper.cpp | 12 +----------- drape_frontend/gui/country_status_helper.hpp | 3 --- drape_frontend/gui/layer_render.cpp | 1 - drape_frontend/map_data_provider.cpp | 7 ------- drape_frontend/map_data_provider.hpp | 3 --- map/framework.cpp | 9 +-------- 10 files changed, 6 insertions(+), 50 deletions(-) diff --git a/drape_frontend/color_constants.cpp b/drape_frontend/color_constants.cpp index c12c803e90..97fd648e0d 100644 --- a/drape_frontend/color_constants.cpp +++ b/drape_frontend/color_constants.cpp @@ -12,10 +12,8 @@ unordered_map> kColorConstants = { { MapStyleClear, { - { DownloadButton, dp::Color(0, 0, 0, 112) }, - { DownloadButtonRouting, dp::Color(32, 152, 82, 255) }, - { DownloadButtonPressed, dp::Color(0, 0, 0, 184) }, - { DownloadButtonRoutingPressed, dp::Color(24, 128, 68, 255) }, + { DownloadButton, dp::Color(32, 152, 82, 255) }, + { DownloadButtonPressed, dp::Color(24, 128, 68, 255) }, { DownloadButtonText, dp::Color(255, 255, 255, 255) }, { CountryStatusText, dp::Color(0, 0, 0, 255) }, { GuiText, dp::Color(77, 77, 77, 221) }, @@ -32,10 +30,8 @@ unordered_map> kColorConstants = }, { MapStyleDark, { - { DownloadButton, dp::Color(255, 255, 255, 178) }, - { DownloadButtonRouting, dp::Color(255, 230, 140, 255) }, - { DownloadButtonPressed, dp::Color(255, 255, 255, 77) }, - { DownloadButtonRoutingPressed, dp::Color(200, 180, 110, 255) }, + { DownloadButton, dp::Color(255, 230, 140, 255) }, + { DownloadButtonPressed, dp::Color(200, 180, 110, 255) }, { DownloadButtonText, dp::Color(0, 0, 0, 222) }, { CountryStatusText, dp::Color(255, 255, 255, 222) }, { GuiText, dp::Color(255, 255, 255, 178) }, diff --git a/drape_frontend/color_constants.hpp b/drape_frontend/color_constants.hpp index 6b8fafc743..4f6e8d45a8 100644 --- a/drape_frontend/color_constants.hpp +++ b/drape_frontend/color_constants.hpp @@ -10,9 +10,7 @@ namespace df enum ColorConstant { DownloadButton, - DownloadButtonRouting, DownloadButtonPressed, - DownloadButtonRoutingPressed, DownloadButtonText, CountryStatusText, GuiText, diff --git a/drape_frontend/drape_engine.cpp b/drape_frontend/drape_engine.cpp index 54a1395b95..f1b7befd93 100644 --- a/drape_frontend/drape_engine.cpp +++ b/drape_frontend/drape_engine.cpp @@ -44,7 +44,6 @@ DrapeEngine::DrapeEngine(Params && params) guiSubsystem.SetSurfaceSize(m2::PointF(m_viewport.GetWidth(), m_viewport.GetHeight())); ConnectDownloadFn(gui::CountryStatusHelper::BUTTON_TYPE_MAP, params.m_model.GetDownloadMapHandler()); - ConnectDownloadFn(gui::CountryStatusHelper::BUTTON_TYPE_MAP_ROUTING, params.m_model.GetDownloadMapRoutingHandler()); ConnectDownloadFn(gui::CountryStatusHelper::BUTTON_TRY_AGAIN, params.m_model.GetDownloadRetryHandler()); m_textureManager = make_unique_dp(); diff --git a/drape_frontend/gui/country_status.cpp b/drape_frontend/gui/country_status.cpp index 18b5155623..cc11b1133b 100644 --- a/drape_frontend/gui/country_status.cpp +++ b/drape_frontend/gui/country_status.cpp @@ -219,12 +219,6 @@ drape_ptr CountryStatus::Draw(ref_ptr tex, MapStyle const style = GetStyleReader().GetCurrentStyle(); auto color = df::GetColorConstant(style, df::DownloadButton); auto pressedColor = df::GetColorConstant(style, df::DownloadButtonPressed); - if (control.m_buttonType == CountryStatusHelper::BUTTON_TYPE_MAP_ROUTING) - { - color = df::GetColorConstant(style, df::DownloadButtonRouting); - pressedColor = df::GetColorConstant(style, df::DownloadButtonRoutingPressed); - } - auto const buttonHandlerIt = buttonHandlers.find(control.m_buttonType); Shape::TTapHandler buttonHandler = (buttonHandlerIt != buttonHandlers.end() ? buttonHandlerIt->second : nullptr); params.m_bodyHandleCreator = bind(&CreateButtonHandle, state, buttonHandler, color, pressedColor, _1, _2); diff --git a/drape_frontend/gui/country_status_helper.cpp b/drape_frontend/gui/country_status_helper.cpp index 74c2b3bf40..f2a20c4b79 100644 --- a/drape_frontend/gui/country_status_helper.cpp +++ b/drape_frontend/gui/country_status_helper.cpp @@ -54,8 +54,7 @@ void FormatMapSize(uint64_t sizeInBytes, string & units, size_t & sizeToDownload } } -char const * DownloadMapButtonID = "country_status_download_without_routing"; -char const * DownloadMapRoutingButtonID = "country_status_download"; +char const * DownloadMapButtonID = "country_status_download"; char const * TryAgainButtonID = "try_again"; char const * DownloadingLabelID = "country_status_downloading"; char const * DownloadingFailedID = "country_status_download_failed"; @@ -175,7 +174,6 @@ void CountryStatusHelper::FillControlsForEmpty() { ASSERT(m_controls.empty(), ()); m_controls.push_back(MakeLabel(m_countryInfo.m_currentCountryName)); - m_controls.push_back(MakeButton(FormatDownloadMapRouting(), BUTTON_TYPE_MAP_ROUTING)); m_controls.push_back(MakeButton(FormatDownloadMap(), BUTTON_TYPE_MAP)); } @@ -227,14 +225,6 @@ string CountryStatusHelper::FormatDownloadMap() return strings::Format(GetLocalizedString(DownloadMapButtonID), size, units); } -string CountryStatusHelper::FormatDownloadMapRouting() -{ - size_t size; - string units; - FormatMapSize(m_countryInfo.m_mapSize + m_countryInfo.m_routingSize, units, size); - return strings::Format(GetLocalizedString(DownloadMapRoutingButtonID), size, units); -} - string CountryStatusHelper::FormatInQueueMap() { return strings::Format(GetLocalizedString(InQueueID), m_countryInfo.m_currentCountryName); diff --git a/drape_frontend/gui/country_status_helper.hpp b/drape_frontend/gui/country_status_helper.hpp index ef56d961fa..cad9ee38e3 100644 --- a/drape_frontend/gui/country_status_helper.hpp +++ b/drape_frontend/gui/country_status_helper.hpp @@ -19,7 +19,6 @@ struct CountryInfo storage::TStatus m_countryStatus = storage::TStatus::EUnknown; string m_currentCountryName; size_t m_mapSize = 0; - size_t m_routingSize = 0; size_t m_downloadProgress = 0; }; @@ -46,7 +45,6 @@ public: { BUTTON_TYPE_NOT_BUTTON, BUTTON_TYPE_MAP, - BUTTON_TYPE_MAP_ROUTING, BUTTON_TRY_AGAIN }; @@ -85,7 +83,6 @@ private: void FillControlsForFailed(); string FormatDownloadMap(); - string FormatDownloadMapRouting(); string FormatInQueueMap(); string FormatFailed(); string FormatTryAgain(); diff --git a/drape_frontend/gui/layer_render.cpp b/drape_frontend/gui/layer_render.cpp index 3f2ce8202e..a8b41ae455 100644 --- a/drape_frontend/gui/layer_render.cpp +++ b/drape_frontend/gui/layer_render.cpp @@ -200,7 +200,6 @@ drape_ptr LayerCacher::RecacheCountryStatus(ref_ptrAddShapeRenderer(WIDGET_COUNTRY_STATUS, countryStatus.Draw(textures, handlers)); diff --git a/drape_frontend/map_data_provider.cpp b/drape_frontend/map_data_provider.cpp index d549e5c4ff..efce03a4ba 100644 --- a/drape_frontend/map_data_provider.cpp +++ b/drape_frontend/map_data_provider.cpp @@ -9,14 +9,12 @@ MapDataProvider::MapDataProvider(TReadIDsFn const & idsReader, TIsCountryLoadedFn const & isCountryLoadedFn, TIsCountryLoadedByNameFn const & isCountryLoadedByNameFn, TDownloadFn const & downloadMapHandler, - TDownloadFn const & downloadMapRoutingHandler, TDownloadFn const & downloadRetryHandler) : m_featureReader(featureReader) , m_idsReader(idsReader) , m_countryIndexUpdater(countryIndexUpdater) , m_isCountryLoadedFn(isCountryLoadedFn) , m_downloadMapHandler(downloadMapHandler) - , m_downloadMapRoutingHandler(downloadMapRoutingHandler) , m_downloadRetryHandler(downloadRetryHandler) , m_isCountryLoadedByNameFn(isCountryLoadedByNameFn) { @@ -47,11 +45,6 @@ MapDataProvider::TDownloadFn const & MapDataProvider::GetDownloadMapHandler() co return m_downloadMapHandler; } -MapDataProvider::TDownloadFn const & MapDataProvider::GetDownloadMapRoutingHandler() const -{ - return m_downloadMapRoutingHandler; -} - MapDataProvider::TDownloadFn const & MapDataProvider::GetDownloadRetryHandler() const { return m_downloadRetryHandler; diff --git a/drape_frontend/map_data_provider.hpp b/drape_frontend/map_data_provider.hpp index e37a070f15..043638f7e1 100644 --- a/drape_frontend/map_data_provider.hpp +++ b/drape_frontend/map_data_provider.hpp @@ -28,7 +28,6 @@ public: TIsCountryLoadedFn const & isCountryLoadedFn, TIsCountryLoadedByNameFn const & isCountryLoadedByNameFn, TDownloadFn const & downloadMapHandler, - TDownloadFn const & downloadMapRoutingHandler, TDownloadFn const & downloadRetryHandler); void ReadFeaturesID(TReadCallback const & fn, m2::RectD const & r, int scale) const; @@ -38,7 +37,6 @@ public: TIsCountryLoadedFn const & GetIsCountryLoadedFn() const; TDownloadFn const & GetDownloadMapHandler() const; - TDownloadFn const & GetDownloadMapRoutingHandler() const; TDownloadFn const & GetDownloadRetryHandler() const; private: @@ -47,7 +45,6 @@ private: TUpdateCountryIndexFn m_countryIndexUpdater; TIsCountryLoadedFn m_isCountryLoadedFn; TDownloadFn m_downloadMapHandler; - TDownloadFn m_downloadMapRoutingHandler; TDownloadFn m_downloadRetryHandler; public: diff --git a/map/framework.cpp b/map/framework.cpp index 35b8c9f2d3..2bcb576d2c 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -940,7 +940,6 @@ void Framework::UpdateCountryInfo(storage::TIndex const & countryIndex, bool isC countryInfo.m_countryIndex = countryIndex; countryInfo.m_currentCountryName = m_activeMaps->GetFormatedCountryName(countryIndex); countryInfo.m_mapSize = m_activeMaps->GetRemoteCountrySizes(countryIndex).first; - countryInfo.m_routingSize = m_activeMaps->GetRemoteCountrySizes(countryIndex).second; countryInfo.m_countryStatus = m_activeMaps->GetCountryStatus(countryIndex); if (countryInfo.m_countryStatus == storage::TStatus::EDownloading) { @@ -1354,11 +1353,6 @@ void Framework::CreateDrapeEngine(ref_ptr contextFactory, GetPlatform().RunOnGuiThread(bind(&Framework::OnDownloadMapCallback, this, countryIndex)); }; - TDownloadFn downloadMapWithoutRoutingFn = [this](storage::TIndex const & countryIndex) - { - GetPlatform().RunOnGuiThread(bind(&Framework::OnDownloadMapRoutingCallback, this, countryIndex)); - }; - TDownloadFn downloadRetryFn = [this](storage::TIndex const & countryIndex) { GetPlatform().RunOnGuiThread(bind(&Framework::OnDownloadRetryCallback, this, countryIndex)); @@ -1373,8 +1367,7 @@ void Framework::CreateDrapeEngine(ref_ptr contextFactory, df::Viewport(0, 0, params.m_surfaceWidth, params.m_surfaceHeight), df::MapDataProvider(idReadFn, featureReadFn, updateCountryIndex, isCountryLoadedFn, isCountryLoadedByNameFn, - downloadMapFn, downloadMapWithoutRoutingFn, - downloadRetryFn), + downloadMapFn, downloadRetryFn), params.m_visualScale, move(params.m_widgetsInitInfo), make_pair(params.m_initialMyPositionState, params.m_hasMyPositionState),