diff --git a/drape/drape.pro b/drape/drape.pro index 73d775f7b5..618140467e 100644 --- a/drape/drape.pro +++ b/drape/drape.pro @@ -16,8 +16,6 @@ OTHER_FILES += \ shaders/area_vertex_shader.vsh \ shaders/arrow3d_fragment_shader.fsh \ shaders/arrow3d_vertex_shader.vsh \ - shaders/button_fragment_shader.fsh \ - shaders/button_vertex_shader.vsh \ shaders/circle_shader.fsh \ shaders/circle_shader.vsh \ shaders/compass_vertex_shader.vsh \ diff --git a/drape/shaders/button_fragment_shader.fsh b/drape/shaders/button_fragment_shader.fsh deleted file mode 100644 index c2db173581..0000000000 --- a/drape/shaders/button_fragment_shader.fsh +++ /dev/null @@ -1,9 +0,0 @@ -uniform vec4 u_color; - -void main(void) -{ - if (u_color.a < 0.1) - discard; - - gl_FragColor = u_color; -} diff --git a/drape/shaders/button_vertex_shader.vsh b/drape/shaders/button_vertex_shader.vsh deleted file mode 100644 index 8eab063a26..0000000000 --- a/drape/shaders/button_vertex_shader.vsh +++ /dev/null @@ -1,9 +0,0 @@ -attribute vec2 a_normal; - -uniform mat4 modelView; -uniform mat4 projection; - -void main(void) -{ - gl_Position = vec4(modelView[0][3] + a_normal.x, modelView[1][3] + a_normal.y, modelView[2][3], 1) * projection; -} diff --git a/drape/shaders/shader_index.txt b/drape/shaders/shader_index.txt index e61169a770..e517687ab6 100644 --- a/drape/shaders/shader_index.txt +++ b/drape/shaders/shader_index.txt @@ -12,7 +12,6 @@ TEXTURING_GUI_PROGRAM texturing_gui_vertex_shader.vsh texturing_fragment_shader. RULER_PROGRAM ruler_vertex_shader.vsh texturing_fragment_shader.fsh ACCURACY_PROGRAM position_accuracy3d_shader.vsh texturing_fragment_shader.fsh MY_POSITION_PROGRAM my_position_shader.vsh texturing_fragment_shader.fsh -BUTTON_PROGRAM button_vertex_shader.vsh button_fragment_shader.fsh BOOKMARK_PROGRAM user_mark.vsh texturing_fragment_shader.fsh ROUTE_PROGRAM route_vertex_shader.vsh route_fragment_shader.fsh ROUTE_ARROW_PROGRAM route_vertex_shader.vsh route_arrow_fragment_shader.fsh diff --git a/drape_frontend/backend_renderer.cpp b/drape_frontend/backend_renderer.cpp index 09b2225273..31a0860e10 100644 --- a/drape_frontend/backend_renderer.cpp +++ b/drape_frontend/backend_renderer.cpp @@ -28,17 +28,13 @@ BackendRenderer::BackendRenderer(Params const & params) , m_model(params.m_model) , m_readManager(make_unique_dp(params.m_commutator, m_model, params.m_allow3dBuildings)) , m_requestedTiles(params.m_requestedTiles) + , m_updateCurrentCountryFn(params.m_updateCurrentCountryFn) { #ifdef DEBUG m_isTeardowned = false; #endif - gui::DrapeGui::Instance().SetRecacheCountryStatusSlot([this]() - { - m_commutator->PostMessage(ThreadsCommutator::ResourceUploadThread, - make_unique_dp(), - MessagePriority::High); - }); + ASSERT(m_updateCurrentCountryFn != nullptr, ()); m_routeBuilder = make_unique_dp([this](drape_ptr && routeData) { @@ -62,7 +58,6 @@ BackendRenderer::~BackendRenderer() void BackendRenderer::Teardown() { - gui::DrapeGui::Instance().ClearRecacheCountryStatusSlot(); StopThread(); #ifdef DEBUG m_isTeardowned = true; @@ -82,13 +77,6 @@ void BackendRenderer::RecacheGui(gui::TWidgetsInitInfo const & initInfo, gui::TW m_commutator->PostMessage(ThreadsCommutator::RenderThread, move(outputMsg), MessagePriority::Normal); } -void BackendRenderer::RecacheCountryStatus() -{ - drape_ptr layerRenderer = m_guiCacher.RecacheCountryStatus(m_texMng); - drape_ptr outputMsg = make_unique_dp(move(layerRenderer), false); - m_commutator->PostMessage(ThreadsCommutator::RenderThread, move(outputMsg), MessagePriority::Normal); -} - void BackendRenderer::RecacheChoosePositionMark() { drape_ptr layerRenderer = m_guiCacher.RecacheChoosePositionMark(m_texMng); @@ -109,12 +97,7 @@ void BackendRenderer::AcceptMessage(ref_ptr message) ScreenBase const screen = m_requestedTiles->GetScreen(); bool const is3dBuildings = m_requestedTiles->Is3dBuildings(); m_readManager->UpdateCoverage(screen, is3dBuildings, tileRequestGeneration, tiles, m_texMng); - - gui::CountryStatusHelper & helper = gui::DrapeGui::Instance().GetCountryStatusHelper(); - if ((*tiles.begin()).m_zoomLevel > scales::GetUpperWorldScale()) - m_model.UpdateCountryIndex(helper.GetCountryIndex(), screen.ClipRect().Center()); - else - helper.Clear(); + m_updateCurrentCountryFn(screen.ClipRect().Center(), (*tiles.begin()).m_zoomLevel); } break; } @@ -127,11 +110,6 @@ void BackendRenderer::AcceptMessage(ref_ptr message) m_readManager->Invalidate(msg->GetTilesForInvalidate()); break; } - case Message::CountryStatusRecache: - { - RecacheCountryStatus(); - break; - } case Message::ShowChoosePositionMark: { RecacheChoosePositionMark(); @@ -149,7 +127,6 @@ void BackendRenderer::AcceptMessage(ref_ptr message) m_commutator->PostMessage(ThreadsCommutator::RenderThread, make_unique_dp(msg->AcceptLayoutInfo()), MessagePriority::Normal); - RecacheCountryStatus(); break; } case Message::TileReadStarted: @@ -245,26 +222,6 @@ void BackendRenderer::AcceptMessage(ref_ptr message) msg->EndProcess(); break; } - case Message::CountryInfoUpdate: - { - ref_ptr msg = message; - gui::CountryStatusHelper & helper = gui::DrapeGui::Instance().GetCountryStatusHelper(); - if (!msg->NeedShow()) - { - // Country is already loaded, so there is no need to show status GUI - // even if this country is updating. - helper.Clear(); - } - else - { - gui::CountryInfo const & info = msg->GetCountryInfo(); - if (msg->IsCurrentCountry() || helper.GetCountryIndex() == info.m_countryIndex) - { - helper.SetCountryInfo(info); - } - } - break; - } case Message::AddRoute: { ref_ptr msg = message; diff --git a/drape_frontend/backend_renderer.hpp b/drape_frontend/backend_renderer.hpp index 5f4eb3f3a1..116dfd0231 100644 --- a/drape_frontend/backend_renderer.hpp +++ b/drape_frontend/backend_renderer.hpp @@ -29,18 +29,23 @@ class RouteBuilder; class BackendRenderer : public BaseRenderer { public: + using TUpdateCurrentCountryFn = function; + struct Params : BaseRenderer::Params { Params(ref_ptr commutator, ref_ptr factory, ref_ptr texMng, MapDataProvider const & model, + TUpdateCurrentCountryFn const & updateCurrentCountryFn, ref_ptr requestedTiles, bool allow3dBuildings) : BaseRenderer::Params(commutator, factory, texMng) , m_model(model) + , m_updateCurrentCountryFn(updateCurrentCountryFn) , m_requestedTiles(requestedTiles) , m_allow3dBuildings(allow3dBuildings) {} MapDataProvider const & m_model; + TUpdateCurrentCountryFn m_updateCurrentCountryFn; ref_ptr m_requestedTiles; bool m_allow3dBuildings; }; @@ -55,7 +60,6 @@ protected: private: void RecacheGui(gui::TWidgetsInitInfo const & initInfo, gui::TWidgetsSizeInfo & sizeInfo, bool needResetOldGui); - void RecacheCountryStatus(); void RecacheChoosePositionMark(); void RecacheMyPosition(); @@ -87,6 +91,8 @@ private: TOverlaysRenderData m_overlays; + TUpdateCurrentCountryFn m_updateCurrentCountryFn; + #ifdef DEBUG bool m_isTeardowned; #endif diff --git a/drape_frontend/color_constants.cpp b/drape_frontend/color_constants.cpp index 070670cc13..184212fba5 100644 --- a/drape_frontend/color_constants.cpp +++ b/drape_frontend/color_constants.cpp @@ -12,10 +12,6 @@ unordered_map> kColorConstants = { { MapStyleClear, { - { 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) }, { MyPositionAccuracy, dp::Color(30, 150, 240, 20) }, { Selection, dp::Color(30, 150, 240, 164) }, @@ -26,16 +22,10 @@ unordered_map> kColorConstants = { TrackCarSpeed, dp::Color(21, 121, 244, 255) }, { TrackPlaneSpeed, dp::Color(10, 196, 255, 255) }, { TrackUnknownDistance, dp::Color(97, 97, 97, 255) }, - { DownloadCancelButton, dp::Color(0, 0, 0, 112) }, - { DownloadCancelButtonPressed, dp::Color(0, 0, 0, 184) }, } }, { MapStyleDark, { - { 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) }, { MyPositionAccuracy, dp::Color(255, 230, 140, 20) }, { Selection, dp::Color(255, 230, 140, 164) }, @@ -46,8 +36,6 @@ unordered_map> kColorConstants = { TrackCarSpeed, dp::Color(255, 202, 40, 255) }, { TrackPlaneSpeed, dp::Color(255, 245, 160, 255) }, { TrackUnknownDistance, dp::Color(150, 150, 150, 255) }, - { DownloadCancelButton, dp::Color(255, 255, 255, 178) }, - { DownloadCancelButtonPressed, dp::Color(255, 255, 255, 77) }, } }, }; diff --git a/drape_frontend/color_constants.hpp b/drape_frontend/color_constants.hpp index d2bfe7043b..a77692a3f5 100644 --- a/drape_frontend/color_constants.hpp +++ b/drape_frontend/color_constants.hpp @@ -9,10 +9,6 @@ namespace df enum ColorConstant { - DownloadButton, - DownloadButtonPressed, - DownloadButtonText, - CountryStatusText, GuiText, MyPositionAccuracy, Selection, @@ -22,9 +18,7 @@ enum ColorConstant TrackHumanSpeed, TrackCarSpeed, TrackPlaneSpeed, - TrackUnknownDistance, - DownloadCancelButton, - DownloadCancelButtonPressed + TrackUnknownDistance }; dp::Color GetColorConstant(MapStyle style, ColorConstant constant); diff --git a/drape_frontend/drape_engine.cpp b/drape_frontend/drape_engine.cpp index 58a2636d1a..78bb85a8fc 100644 --- a/drape_frontend/drape_engine.cpp +++ b/drape_frontend/drape_engine.cpp @@ -2,7 +2,6 @@ #include "drape_frontend/message_subclasses.hpp" #include "drape_frontend/visual_params.hpp" -#include "drape_frontend/gui/country_status_helper.hpp" #include "drape_frontend/gui/drape_gui.hpp" #include "storage/index.hpp" @@ -20,18 +19,6 @@ namespace df namespace { -void ConnectDownloadFn(gui::CountryStatusHelper::EButtonType buttonType, TDownloadFn downloadFn) -{ - gui::DrapeGui & guiSubsystem = gui::DrapeGui::Instance(); - guiSubsystem.ConnectOnButtonPressedHandler(buttonType, [downloadFn, &guiSubsystem]() - { - storage::TCountryId countryId = guiSubsystem.GetCountryStatusHelper().GetCountryIndex(); - ASSERT(countryId != storage::kInvalidCountryId, ()); - if (downloadFn != nullptr) - downloadFn(countryId); - }); -} - string const LocationStateMode = "LastLocationStateMode"; } @@ -45,10 +32,6 @@ DrapeEngine::DrapeEngine(Params && params) guiSubsystem.SetLocalizator(bind(&StringsBundle::GetString, params.m_stringsBundle.get(), _1)); guiSubsystem.SetSurfaceSize(m2::PointF(m_viewport.GetWidth(), m_viewport.GetHeight())); - ConnectDownloadFn(gui::CountryStatusHelper::BUTTON_TYPE_MAP, params.m_model.GetDownloadMapHandler()); - ConnectDownloadFn(gui::CountryStatusHelper::BUTTON_TRY_AGAIN, params.m_model.GetDownloadRetryHandler()); - ConnectDownloadFn(gui::CountryStatusHelper::BUTTON_CANCEL, params.m_model.GetDownloadCancelHandler()); - m_textureManager = make_unique_dp(); m_threadCommutator = make_unique_dp(); m_requestedTiles = make_unique_dp(); @@ -70,8 +53,9 @@ DrapeEngine::DrapeEngine(Params && params) m_frontend = make_unique_dp(frParams); BackendRenderer::Params brParams(frParams.m_commutator, frParams.m_oglContextFactory, - frParams.m_texMng, params.m_model, make_ref(m_requestedTiles), - params.m_allow3dBuildings); + frParams.m_texMng, params.m_model, + params.m_model.UpdateCurrentCountryFn(), + make_ref(m_requestedTiles), params.m_allow3dBuildings); m_backend = make_unique_dp(brParams); m_widgetsInfo = move(params.m_info); @@ -270,20 +254,6 @@ void DrapeEngine::ResizeImpl(int w, int h) AddUserEvent(ResizeEvent(w, h)); } -void DrapeEngine::SetCountryInfo(gui::CountryInfo const & info, bool isCurrentCountry) -{ - m_threadCommutator->PostMessage(ThreadsCommutator::ResourceUploadThread, - make_unique_dp(info, isCurrentCountry), - MessagePriority::Normal); -} - -void DrapeEngine::SetInvalidCountryInfo() -{ - m_threadCommutator->PostMessage(ThreadsCommutator::ResourceUploadThread, - make_unique_dp(), - MessagePriority::Normal); -} - void DrapeEngine::SetCompassInfo(location::CompassInfo const & info) { m_threadCommutator->PostMessage(ThreadsCommutator::RenderThread, diff --git a/drape_frontend/drape_engine.hpp b/drape_frontend/drape_engine.hpp index 3a8a7c8be9..e19da60538 100644 --- a/drape_frontend/drape_engine.hpp +++ b/drape_frontend/drape_engine.hpp @@ -20,7 +20,6 @@ #include "std/mutex.hpp" namespace dp { class OGLContextFactory; } -namespace gui { struct CountryInfo; } namespace df { @@ -94,8 +93,6 @@ public: void InvalidateRect(m2::RectD const & rect); void UpdateMapStyle(); - void SetCountryInfo(gui::CountryInfo const & info, bool isCurrentCountry); - void SetInvalidCountryInfo(); void SetCompassInfo(location::CompassInfo const & info); void SetGpsInfo(location::GpsInfo const & info, bool isNavigable, location::RouteMatchingInfo const & routeInfo); void MyPositionNextMode(); diff --git a/drape_frontend/drape_frontend.pro b/drape_frontend/drape_frontend.pro index fe458d9d73..77b3b0c58a 100755 --- a/drape_frontend/drape_frontend.pro +++ b/drape_frontend/drape_frontend.pro @@ -19,12 +19,9 @@ SOURCES += \ animation/opacity_animation.cpp \ animation/perspective_animation.cpp \ animation/show_hide_animation.cpp \ - gui/button.cpp \ gui/choose_position_mark.cpp \ gui/compass.cpp \ gui/copyright_label.cpp \ - gui/country_status.cpp \ - gui/country_status_helper.cpp \ gui/drape_gui.cpp \ gui/gui_text.cpp \ gui/layer_render.cpp \ @@ -105,12 +102,9 @@ HEADERS += \ animation/perspective_animation.hpp \ animation/show_hide_animation.hpp \ animation/value_mapping.hpp \ - gui/button.hpp \ gui/choose_position_mark.hpp \ gui/compass.hpp \ gui/copyright_label.hpp \ - gui/country_status.hpp \ - gui/country_status_helper.hpp \ gui/drape_gui.hpp \ gui/gui_text.hpp \ gui/layer_render.hpp \ diff --git a/drape_frontend/gui/button.cpp b/drape_frontend/gui/button.cpp deleted file mode 100644 index 9490dc6747..0000000000 --- a/drape_frontend/gui/button.cpp +++ /dev/null @@ -1,201 +0,0 @@ -#include "button.hpp" -#include "gui_text.hpp" - -#include "drape/batcher.hpp" -#include "drape/shader_def.hpp" -#include "drape/utils/vertex_decl.hpp" - -#include "std/bind.hpp" -#include "std/vector.hpp" - -namespace gui -{ - -namespace -{ - -void ApplyAnchor(dp::Anchor anchor, vector & vertices, float halfWidth, float halfHeight) -{ - glsl::vec2 normalOffset(0.0f, 0.0f); - if (anchor & dp::Left) - normalOffset.x = halfWidth; - else if (anchor & dp::Right) - normalOffset.x = -halfWidth; - - if (anchor & dp::Top) - normalOffset.y = halfHeight; - else if (anchor & dp::Bottom) - normalOffset.y = -halfHeight; - - for (Button::ButtonVertex & v : vertices) - v.m_normal = v.m_normal + normalOffset; -} - -uint32_t BuildRect(vector & vertices, - glsl::vec2 const & v1, glsl::vec2 const & v2, - glsl::vec2 const & v3, glsl::vec2 const & v4) - -{ - vertices.push_back(Button::ButtonVertex(v1)); - vertices.push_back(Button::ButtonVertex(v2)); - vertices.push_back(Button::ButtonVertex(v3)); - - vertices.push_back(Button::ButtonVertex(v3)); - vertices.push_back(Button::ButtonVertex(v2)); - vertices.push_back(Button::ButtonVertex(v4)); - - return dp::Batcher::IndexPerQuad; -} - -uint32_t BuildCorner(vector & vertices, - glsl::vec2 const & pt, double radius, - double angleStart, double angleFinish) -{ - int const kTrianglesCount = 8; - double const sector = (angleFinish - angleStart) / kTrianglesCount; - m2::PointD startNormal(0.0f, radius); - - for (size_t i = 0; i < kTrianglesCount; ++i) - { - m2::PointD normal = m2::Rotate(startNormal, angleStart + i * sector); - m2::PointD nextNormal = m2::Rotate(startNormal, angleStart + (i + 1) * sector); - - vertices.push_back(Button::ButtonVertex(pt)); - vertices.push_back(Button::ButtonVertex(pt - glsl::ToVec2(normal))); - vertices.push_back(Button::ButtonVertex(pt - glsl::ToVec2(nextNormal))); - } - - return kTrianglesCount * dp::Batcher::IndexPerTriangle; -} - -} - -ButtonHandle::ButtonHandle(uint32_t id, dp::Anchor anchor, m2::PointF const & size, - dp::Color const & color, dp::Color const & pressedColor) - : TBase(id, anchor, m2::PointF::Zero(), size) - , m_isInPressedState(false) - , m_color(color) - , m_pressedColor(pressedColor) -{} - -void ButtonHandle::OnTapBegin() -{ - m_isInPressedState = true; -} - -void ButtonHandle::OnTapEnd() -{ - m_isInPressedState = false; -} - -bool ButtonHandle::Update(ScreenBase const & screen) -{ - glsl::vec4 color = glsl::ToVec4(m_isInPressedState ? m_pressedColor : m_color); - m_uniforms.SetFloatValue("u_color", color.r, color.g, color.b, color.a); - return TBase::Update(screen); -} - -StaticLabel::LabelResult Button::PreprocessLabel(Params const & params, ref_ptr texMgr) -{ - StaticLabel::LabelResult result; - StaticLabel::CacheStaticText(params.m_label, StaticLabel::DefaultDelim, params.m_anchor, - params.m_labelFont, texMgr, result); - return result; -} - -void Button::Draw(Params const & params, ShapeControl & control, gui::StaticLabel::LabelResult & label) -{ - float const halfWidth = params.m_width * 0.5f; - float const halfHeight = label.m_boundRect.SizeY() * 0.5f; - float const halfWM = halfWidth + params.m_margin; - float const halfHM = halfHeight + params.m_margin; - - // Cache button - { - dp::GLState state(gpu::BUTTON_PROGRAM, dp::GLState::Gui); - - float w = halfWM - params.m_facet; - float h = halfHM - params.m_facet; - - vector vertexes; - vertexes.reserve(114); - - uint32_t indicesCount = 0; - - indicesCount += BuildRect(vertexes, glsl::vec2(-w, halfHM), glsl::vec2(-w, -halfHM), - glsl::vec2(w, halfHM), glsl::vec2(w, -halfHM)); - - indicesCount += BuildRect(vertexes, glsl::vec2(-halfWM, h), glsl::vec2(-halfWM, -h), - glsl::vec2(-w, h), glsl::vec2(-w, -h)); - - indicesCount += BuildRect(vertexes, glsl::vec2(w, h), glsl::vec2(w, -h), - glsl::vec2(halfWM, h), glsl::vec2(halfWM, -h)); - - indicesCount += BuildCorner(vertexes, glsl::vec2(-w, h), params.m_facet, - math::pi, 1.5 * math::pi); - - indicesCount += BuildCorner(vertexes, glsl::vec2(-w, -h), params.m_facet, - 1.5 * math::pi, 2 * math::pi); - - indicesCount += BuildCorner(vertexes, glsl::vec2(w, h), params.m_facet, - 0.5 * math::pi, math::pi); - - indicesCount += BuildCorner(vertexes, glsl::vec2(w, -h), params.m_facet, - 0.0, 0.5 * math::pi); - - ApplyAnchor(params.m_anchor, vertexes, halfWidth, halfHeight); - - uint32_t const verticesCount = (uint32_t)vertexes.size(); - dp::AttributeProvider provider(1 /* stream count */, verticesCount); - provider.InitStream(0 /*stream index*/, ButtonVertex::GetBindingInfo(), - make_ref(vertexes.data())); - - m2::PointF buttonSize(halfWM + halfWM, halfHM + halfHM); - ASSERT(params.m_bodyHandleCreator, ()); - dp::Batcher batcher(indicesCount, verticesCount); - dp::SessionGuard guard(batcher, bind(&ShapeControl::AddShape, &control, _1, _2)); - batcher.InsertTriangleList(state, make_ref(&provider), - params.m_bodyHandleCreator(params.m_anchor, buttonSize)); - } - - // Cache text - { - size_t vertexCount = label.m_buffer.size(); - ASSERT(vertexCount % dp::Batcher::VertexPerQuad == 0, ()); - size_t indexCount = dp::Batcher::IndexPerQuad * vertexCount / dp::Batcher::VertexPerQuad; - - dp::AttributeProvider provider(1 /*stream count*/, vertexCount); - provider.InitStream(0 /*stream index*/, StaticLabel::Vertex::GetBindingInfo(), - make_ref(label.m_buffer.data())); - - ASSERT(params.m_labelHandleCreator, ()); - m2::PointF textSize(label.m_boundRect.SizeX(), label.m_boundRect.SizeY()); - - dp::Batcher batcher(indexCount, vertexCount); - dp::SessionGuard guard(batcher, bind(&ShapeControl::AddShape, &control, _1, _2)); - batcher.InsertListOfStrip(label.m_state, make_ref(&provider), - params.m_labelHandleCreator(params.m_anchor, textSize, label.m_alphabet), - dp::Batcher::VertexPerQuad); - } -} - -dp::BindingInfo const & Button::ButtonVertex::GetBindingInfo() -{ - static unique_ptr info; - - if (info == nullptr) - { - info.reset(new dp::BindingInfo(1)); - - dp::BindingDecl & normalDecl = info->GetBindingDecl(0); - normalDecl.m_attributeName = "a_normal"; - normalDecl.m_componentCount = 2; - normalDecl.m_componentType = gl_const::GLFloatType; - normalDecl.m_offset = 0; - normalDecl.m_stride = sizeof(ButtonVertex); - } - - return *info.get(); -} - -} diff --git a/drape_frontend/gui/button.hpp b/drape_frontend/gui/button.hpp deleted file mode 100644 index bf9d90e4ef..0000000000 --- a/drape_frontend/gui/button.hpp +++ /dev/null @@ -1,66 +0,0 @@ -#pragma once - -#include "shape.hpp" -#include "gui_text.hpp" - -#include "std/function.hpp" -#include "std/string.hpp" - -namespace gui -{ - -class ButtonHandle : public TappableHandle -{ - typedef TappableHandle TBase; - -public: - ButtonHandle(uint32_t id, dp::Anchor anchor, m2::PointF const & size, - dp::Color const & color, dp::Color const & pressedColor); - - void OnTapBegin() override; - void OnTapEnd() override; - bool Update(ScreenBase const & screen) override; - -private: - bool m_isInPressedState; - dp::Color m_color; - dp::Color m_pressedColor; -}; - -class Button -{ -public: - struct ButtonVertex - { - ButtonVertex() = default; - ButtonVertex(glsl::vec2 const & normal) - : m_normal(normal) - {} - - static dp::BindingInfo const & GetBindingInfo(); - - glsl::vec2 m_normal; - }; - - using TCreatorResult = drape_ptr; - using THandleCreator = function; - using TLabelHandleCreator = function; - - struct Params - { - string m_label; - dp::FontDecl m_labelFont; - dp::Anchor m_anchor; - - float m_width = 0.0f; - float m_margin = 0.0f; - float m_facet = 0.0f; - - THandleCreator m_bodyHandleCreator; - TLabelHandleCreator m_labelHandleCreator; - }; - - static gui::StaticLabel::LabelResult PreprocessLabel(Params const & params, ref_ptr texMgr); - static void Draw(Params const & params, ShapeControl & control, gui::StaticLabel::LabelResult & label); -}; -} diff --git a/drape_frontend/gui/country_status.cpp b/drape_frontend/gui/country_status.cpp deleted file mode 100644 index 06f8aed055..0000000000 --- a/drape_frontend/gui/country_status.cpp +++ /dev/null @@ -1,344 +0,0 @@ -#include "button.hpp" -#include "country_status.hpp" -#include "drape_gui.hpp" -#include "gui_text.hpp" - -#include "drape_frontend/color_constants.hpp" -#include "drape_frontend/visual_params.hpp" - -#include "drape/batcher.hpp" -#include "drape/glsl_func.hpp" - -#include "indexer/map_style_reader.hpp" - -#include "std/algorithm.hpp" -#include "std/bind.hpp" - -namespace gui -{ -namespace -{ - -class CountryStatusButtonHandle : public ButtonHandle -{ - using TBase = ButtonHandle; - -public: - CountryStatusButtonHandle(uint32_t id, CountryStatusHelper::ECountryState const state, - Shape::TTapHandler const & tapHandler, - dp::Anchor anchor, m2::PointF const & size, - dp::Color const & color, dp::Color const & pressedColor) - : TBase(id, anchor, size, color, pressedColor) - , m_state(state) - , m_tapHandler(tapHandler) - {} - - void OnTap() override - { - if (m_tapHandler != nullptr) - m_tapHandler(); - } - - bool Update(ScreenBase const & screen) override - { - SetIsVisible(DrapeGui::GetCountryStatusHelper().IsVisibleForState(m_state)); - return TBase::Update(screen); - } - -private: - CountryStatusHelper::ECountryState m_state; - Shape::TTapHandler m_tapHandler; -}; - -class CountryStatusLabelHandle : public StaticLabelHandle -{ - using TBase = StaticLabelHandle; - -public: - CountryStatusLabelHandle(uint32_t id, CountryStatusHelper::ECountryState const state, - ref_ptr textureManager, - dp::Anchor anchor, m2::PointF const & size, - TAlphabet const & alphabet) - : TBase(id, textureManager, anchor, m2::PointF::Zero(), size, alphabet) - , m_state(state) - {} - - bool Update(ScreenBase const & screen) override - { - SetIsVisible(DrapeGui::GetCountryStatusHelper().IsVisibleForState(m_state)); - return TBase::Update(screen); - } - -private: - CountryStatusHelper::ECountryState m_state; -}; - -class CountryProgressHandle : public MutableLabelHandle -{ - using TBase = MutableLabelHandle; - -public: - CountryProgressHandle(uint32_t id, dp::Anchor anchor, - CountryStatusHelper::ECountryState const state, - ref_ptr textures) - : TBase(id, anchor, m2::PointF::Zero(), textures), m_state(state) - {} - - bool Update(ScreenBase const & screen) override - { - CountryStatusHelper & helper = DrapeGui::GetCountryStatusHelper(); - SetIsVisible(helper.IsVisibleForState(m_state)); - if (IsVisible()) - SetContent(helper.GetProgressValue()); - - return TBase::Update(screen); - } - -private: - CountryStatusHelper::ECountryState m_state; -}; - -struct ButtonData -{ - Button::Params m_params; - StaticLabel::LabelResult m_label; - CountryStatusHelper::EButtonType m_type; -}; - -drape_ptr CreateButtonHandle(uint32_t id, CountryStatusHelper::ECountryState const state, - Shape::TTapHandler const & tapHandler, - dp::Color const & color, dp::Color const & pressedColor, - dp::Anchor anchor, m2::PointF const & size) -{ - return make_unique_dp(id, state, tapHandler, anchor, size, color, pressedColor); -} - -drape_ptr CreateLabelHandle(uint32_t id, CountryStatusHelper::ECountryState const state, - ref_ptr textureManager, - dp::Anchor anchor, m2::PointF const & size, - TAlphabet const & alphabet) -{ - return make_unique_dp(id, state, textureManager, anchor, size, alphabet); -} - -void DrawLabelControl(string const & text, dp::Anchor anchor, dp::Batcher::TFlushFn const & flushFn, - ref_ptr mng, CountryStatusHelper::ECountryState state) -{ - StaticLabel::LabelResult result; - dp::Color const textColor = df::GetColorConstant(GetStyleReader().GetCurrentStyle(), df::CountryStatusText); - StaticLabel::CacheStaticText(text, "\n", anchor, dp::FontDecl(textColor, 18), mng, result); - size_t vertexCount = result.m_buffer.size(); - ASSERT(vertexCount % dp::Batcher::VertexPerQuad == 0, ()); - size_t indexCount = dp::Batcher::IndexPerQuad * vertexCount / dp::Batcher::VertexPerQuad; - - dp::AttributeProvider provider(1 /*stream count*/, vertexCount); - provider.InitStream(0 /*stream index*/, StaticLabel::Vertex::GetBindingInfo(), - make_ref(result.m_buffer.data())); - - dp::Batcher batcher(indexCount, vertexCount); - dp::SessionGuard guard(batcher, flushFn); - m2::PointF size(result.m_boundRect.SizeX(), result.m_boundRect.SizeY()); - drape_ptr handle = make_unique_dp(EGuiHandle::GuiHandleCountryLabel, - state, mng, anchor, size, result.m_alphabet); - batcher.InsertListOfStrip(result.m_state, make_ref(&provider), move(handle), - dp::Batcher::VertexPerQuad); -} - -void DrawProgressControl(dp::Anchor anchor, dp::Batcher::TFlushFn const & flushFn, - ref_ptr mng, CountryStatusHelper::ECountryState state) -{ - MutableLabelDrawer::Params params; - CountryStatusHelper & helper = DrapeGui::GetCountryStatusHelper(); - helper.GetProgressInfo(params.m_alphabet, params.m_maxLength); - dp::Color const textColor = df::GetColorConstant(GetStyleReader().GetCurrentStyle(), df::CountryStatusText); - - params.m_anchor = anchor; - params.m_pivot = m2::PointF::Zero(); - params.m_font = dp::FontDecl(textColor, 18); - params.m_handleCreator = [state, mng](dp::Anchor anchor, m2::PointF const & /*pivot*/) - { - return make_unique_dp(EGuiHandle::GuiHandleCountryProgress, anchor, state, mng); - }; - - MutableLabelDrawer::Draw(params, mng, flushFn); -} - -void ForEachComponent(CountryStatusHelper & helper, CountryStatusHelper::EControlType type, - function const & callback) -{ - for (size_t i = 0; i < helper.GetComponentCount(); ++i) - { - CountryStatusHelper::Control const & control = helper.GetControl(i); - if (callback != nullptr && control.m_type == type) - callback(control); - } -} - -} - -drape_ptr CountryStatus::Draw(ref_ptr tex, - TButtonHandlers const & buttonHandlers) const -{ - CountryStatusHelper & helper = DrapeGui::GetCountryStatusHelper(); - if (helper.GetComponentCount() == 0) - return nullptr; - - CountryStatusHelper::ECountryState const state = helper.GetState(); - ASSERT(state != CountryStatusHelper::COUNTRY_STATE_LOADED, ()); - - drape_ptr renderer = make_unique_dp(); - dp::Batcher::TFlushFn flushFn = bind(&ShapeRenderer::AddShape, renderer.get(), _1, _2); - - // Precache progress symbols. - { - CountryStatusHelper & helper = DrapeGui::GetCountryStatusHelper(); - string alphabet; - size_t maxLength; - helper.GetProgressInfo(alphabet, maxLength); - dp::TextureManager::TGlyphsBuffer buffer; - tex->GetGlyphRegions(strings::MakeUniString(alphabet), buffer); - } - - // Create labels. - ForEachComponent(helper, CountryStatusHelper::CONTROL_TYPE_LABEL, - [this, &tex, &flushFn, &state](CountryStatusHelper::Control const & control) - { - DrawLabelControl(control.m_label, m_position.m_anchor, flushFn, tex, state); - }); - - // Preprocess buttons. - vector buttons; - float const kMinButtonWidth = 400; - float maxButtonWidth = kMinButtonWidth; - buttons.reserve(3); - ForEachComponent(helper, CountryStatusHelper::CONTROL_TYPE_BUTTON, - [this, &buttons, &state, &tex, &buttonHandlers, - &maxButtonWidth](CountryStatusHelper::Control const & control) - { - float const visualScale = df::VisualParams::Instance().GetVisualScale(); - dp::Color const textColor = df::GetColorConstant(GetStyleReader().GetCurrentStyle(), df::DownloadButtonText); - - Button::Params params; - params.m_anchor = m_position.m_anchor; - params.m_label = control.m_label; - params.m_labelFont = dp::FontDecl(textColor, 18); - params.m_margin = 5.0f * visualScale; - params.m_facet = 8.0f * visualScale; - - 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_CANCEL) - { - color = df::GetColorConstant(style, df::DownloadCancelButton); - pressedColor = df::GetColorConstant(style, df::DownloadCancelButtonPressed); - } - - uint32_t buttonHandleId = 0; - uint32_t buttonLabelHandleId = 0; - if (control.m_buttonType == CountryStatusHelper::BUTTON_TYPE_MAP) - { - buttonHandleId = EGuiHandle::GuiHandleDownloadButton; - buttonLabelHandleId = EGuiHandle::GuiHandleDownloadButtonLabel; - } - else if (control.m_buttonType == CountryStatusHelper::BUTTON_TRY_AGAIN) - { - buttonHandleId = EGuiHandle::GuiHandleRetryButton; - buttonLabelHandleId = EGuiHandle::GuiHandleRetryButtonLabel; - } - else if (control.m_buttonType == CountryStatusHelper::BUTTON_CANCEL) - { - buttonHandleId = EGuiHandle::GuiHandleCancelButton; - buttonLabelHandleId = EGuiHandle::GuiHandleCancelButtonLabel; - } - else - { - ASSERT(false, ("Unknown button")); - } - - auto const buttonHandlerIt = buttonHandlers.find(control.m_buttonType); - Shape::TTapHandler buttonHandler = (buttonHandlerIt != buttonHandlers.end() ? buttonHandlerIt->second : nullptr); - params.m_bodyHandleCreator = bind(&CreateButtonHandle, buttonHandleId, state, buttonHandler, color, pressedColor, _1, _2); - params.m_labelHandleCreator = bind(&CreateLabelHandle, buttonLabelHandleId, state, tex, _1, _2, _3); - - auto label = Button::PreprocessLabel(params, tex); - float const buttonWidth = label.m_boundRect.SizeX(); - if (buttonWidth > maxButtonWidth) - maxButtonWidth = buttonWidth; - - ButtonData data; - data.m_params = move(params); - data.m_label = move(label); - data.m_type = control.m_buttonType; - buttons.emplace_back(move(data)); - }); - - // Create buttons. - for (size_t i = 0; i < buttons.size(); i++) - { - if (buttons[i].m_type == CountryStatusHelper::BUTTON_CANCEL) - continue; - - buttons[i].m_params.m_width = maxButtonWidth; - ShapeControl shapeControl; - Button::Draw(buttons[i].m_params, shapeControl, buttons[i].m_label); - renderer->AddShapeControl(move(shapeControl)); - } - - // Create progress bars. - ForEachComponent(helper, CountryStatusHelper::CONTROL_TYPE_PROGRESS, - [this, &tex, &flushFn, &state](CountryStatusHelper::Control const &) - { - DrawProgressControl(m_position.m_anchor, flushFn, tex, state); - }); - - // Create cancel buttons. - for (size_t i = 0; i < buttons.size(); i++) - { - if (buttons[i].m_type == CountryStatusHelper::BUTTON_CANCEL) - { - buttons[i].m_params.m_width = maxButtonWidth; - ShapeControl shapeControl; - Button::Draw(buttons[i].m_params, shapeControl, buttons[i].m_label); - renderer->AddShapeControl(move(shapeControl)); - break; - } - } - - buffer_vector heights; - float totalHeight = 0.0f; - - ArrangeShapes(make_ref(renderer), [&heights, &totalHeight](ShapeControl & shape) - { - float height = 0.0f; - for (ShapeControl::ShapeInfo & info : shape.m_shapesInfo) - height = max(height, info.m_handle->GetSize().y); - - heights.push_back(height); - totalHeight += height; - }); - - ASSERT(!heights.empty(), ()); - - float const controlMargin = helper.GetControlMargin(); - totalHeight += controlMargin * (heights.size() - 1); - float halfHeight = totalHeight * 0.5f; - glsl::vec2 pen(m_position.m_pixelPivot.x, m_position.m_pixelPivot.y - halfHeight); - size_t controlIndex = 0; - - ArrangeShapes(make_ref(renderer), [&](ShapeControl & shape) - { - float const h = heights[controlIndex]; - float const halfH = h * 0.5f; - ++controlIndex; - - for (ShapeControl::ShapeInfo & info : shape.m_shapesInfo) - info.m_handle->SetPivot(pen + glsl::vec2(0.0f, halfH)); - - pen.y += (h + controlMargin); - }); - - return renderer; -} - -} // namespace gui diff --git a/drape_frontend/gui/country_status.hpp b/drape_frontend/gui/country_status.hpp deleted file mode 100644 index 75604540f1..0000000000 --- a/drape_frontend/gui/country_status.hpp +++ /dev/null @@ -1,21 +0,0 @@ -#pragma once - -#include "shape.hpp" -#include "country_status_helper.hpp" - -namespace gui -{ -class CountryStatus : public Shape -{ -public: - CountryStatus(Position const & position) - : Shape(position) - {} - - using TButtonHandlers = map; - - drape_ptr Draw(ref_ptr tex, - TButtonHandlers const & buttonHandlers) const; -}; - -} // namespace gui diff --git a/drape_frontend/gui/country_status_helper.cpp b/drape_frontend/gui/country_status_helper.cpp deleted file mode 100644 index 1a5cabc522..0000000000 --- a/drape_frontend/gui/country_status_helper.cpp +++ /dev/null @@ -1,256 +0,0 @@ -#include "country_status_helper.hpp" -#include "drape_gui.hpp" - -#include "drape_frontend/visual_params.hpp" - -#include "base/stl_add.hpp" -#include "base/string_utils.hpp" -#include "base/string_format.hpp" - -namespace gui -{ - -namespace -{ - -CountryStatusHelper::Control MakeLabel(string const & text) -{ - return { text, CountryStatusHelper::CONTROL_TYPE_LABEL, CountryStatusHelper::BUTTON_TYPE_NOT_BUTTON }; -} - -CountryStatusHelper::Control MakeButton(string const & text, CountryStatusHelper::EButtonType type) -{ - return { text, CountryStatusHelper::CONTROL_TYPE_BUTTON, type }; -} - -CountryStatusHelper::Control MakeProgress() -{ - return { "", CountryStatusHelper::CONTROL_TYPE_PROGRESS, CountryStatusHelper::BUTTON_TYPE_NOT_BUTTON }; -} - -string GetLocalizedString(string const & id) -{ - return DrapeGui::Instance().GetLocalizedString(id); -} - -void FormatMapSize(uint64_t sizeInBytes, string & units, size_t & sizeToDownload) -{ - int const mbInBytes = 1024 * 1024; - int const kbInBytes = 1024; - if (sizeInBytes > mbInBytes) - { - sizeToDownload = (sizeInBytes + mbInBytes - 1) / mbInBytes; - units = "MB"; - } - else if (sizeInBytes > kbInBytes) - { - sizeToDownload = (sizeInBytes + kbInBytes -1) / kbInBytes; - units = "KB"; - } - else - { - sizeToDownload = sizeInBytes; - units = "B"; - } -} - -char const * DownloadMapButtonID = "country_status_download"; -char const * DownloadMapWithoutSizeButtonID = "country_status_download_without_size"; -char const * TryAgainButtonID = "try_again"; -char const * DownloadCancelButtonID = "cancel"; -char const * DownloadingLabelID = "country_status_downloading"; -char const * DownloadingFailedID = "country_status_download_failed"; -char const * InQueueID = "country_status_added_to_queue"; - -} // namespace - -//////////////////////////////////////////////////////////// - -CountryStatusHelper::CountryStatusHelper() - : m_state(COUNTRY_STATE_LOADED) -{ -} - -void CountryStatusHelper::SetCountryInfo(CountryInfo const & countryInfo) -{ - m_countryInfo = countryInfo; - - CountryStatusHelper::ECountryState state = CountryStatusHelper::COUNTRY_STATE_LOADED; - switch(m_countryInfo.m_countryStatus) - { - case storage::Status::ENotDownloaded: - state = CountryStatusHelper::COUNTRY_STATE_EMPTY; - break; - case storage::Status::EDownloading: - state = CountryStatusHelper::COUNTRY_STATE_LOADING; - break; - case storage::Status::EInQueue: - state = CountryStatusHelper::COUNTRY_STATE_IN_QUEUE; - break; - case storage::Status::EDownloadFailed: - case storage::Status::EOutOfMemFailed: - state = CountryStatusHelper::COUNTRY_STATE_FAILED; - break; - default: - break; - } - - SetState(state); -} - -void CountryStatusHelper::Clear() -{ - m_countryInfo = CountryInfo(); - SetState(COUNTRY_STATE_LOADED); -} - -storage::TCountryId CountryStatusHelper::GetCountryIndex() const -{ - return m_countryInfo.m_countryIndex; -} - -void CountryStatusHelper::SetState(ECountryState state) -{ - m_state = state; - FillControlsForState(); - DrapeGui::Instance().EmitRecacheCountryStatusSignal(); -} - -CountryStatusHelper::ECountryState CountryStatusHelper::GetState() const -{ - return m_state; -} - -bool CountryStatusHelper::IsVisibleForState(ECountryState state) const -{ - return m_state != COUNTRY_STATE_LOADED && m_state == state; -} - -size_t CountryStatusHelper::GetComponentCount() const { return m_controls.size(); } - -CountryStatusHelper::Control const & CountryStatusHelper::GetControl(size_t index) const -{ - return m_controls[index]; -} - -float CountryStatusHelper::GetControlMargin() -{ - return 20.0f * df::VisualParams::Instance().GetVisualScale(); -} - -void CountryStatusHelper::GetProgressInfo(string & alphabet, size_t & maxLength) -{ - alphabet = " 0123456789%"; - maxLength = 5; -} - -string CountryStatusHelper::GetProgressValue() const -{ - return strings::to_string(m_countryInfo.m_downloadProgress) + "%"; -} - -void CountryStatusHelper::FillControlsForState() -{ - m_controls.clear(); - ECountryState state = m_state; - switch (state) - { - case COUNTRY_STATE_EMPTY: - FillControlsForEmpty(); - break; - case COUNTRY_STATE_LOADING: - FillControlsForLoading(); - break; - case COUNTRY_STATE_IN_QUEUE: - FillControlsForInQueue(); - break; - case COUNTRY_STATE_FAILED: - FillControlsForFailed(); - break; - default: - break; - } -} - -void CountryStatusHelper::FillControlsForEmpty() -{ - ASSERT(m_controls.empty(), ()); - m_controls.push_back(MakeLabel(m_countryInfo.m_currentCountryName)); - m_controls.push_back(MakeButton(FormatDownloadMap(), BUTTON_TYPE_MAP)); -} - -void CountryStatusHelper::FillControlsForLoading() -{ - ASSERT(m_controls.empty(), ()); - string text = GetLocalizedString(DownloadingLabelID); - size_t firstPos = text.find('^'); - ASSERT(firstPos != string::npos, ()); - size_t secondPos = text.find('^', firstPos + 1); - ASSERT(secondPos != string::npos, ()); - - if (firstPos != 0) - { - string firstLabel = text.substr(0, firstPos); - strings::Trim(firstLabel, "\n "); - m_controls.push_back(MakeLabel(firstLabel)); - } - - m_controls.push_back(MakeLabel(m_countryInfo.m_currentCountryName)); - m_controls.push_back(MakeProgress()); - - if (secondPos + 1 < text.size()) - { - string secondLabel = text.substr(secondPos + 1); - strings::Trim(secondLabel , "\n "); - m_controls.push_back(MakeLabel(secondLabel)); - } - - m_controls.push_back(MakeButton(FormatCancel(), BUTTON_CANCEL)); -} - -void CountryStatusHelper::FillControlsForInQueue() -{ - ASSERT(m_controls.empty(), ()); - m_controls.push_back(MakeLabel(FormatInQueueMap())); -} - -void CountryStatusHelper::FillControlsForFailed() -{ - ASSERT(m_controls.empty(), ()); - m_controls.push_back(MakeLabel(FormatFailed())); - m_controls.push_back(MakeButton(FormatTryAgain(), BUTTON_TRY_AGAIN)); -} - -string CountryStatusHelper::FormatDownloadMap() -{ - if (m_countryInfo.m_showMapSize) - { - size_t size; - string units; - FormatMapSize(m_countryInfo.m_mapSize, units, size); - return strings::Format(GetLocalizedString(DownloadMapButtonID), size, units); - } - return GetLocalizedString(DownloadMapWithoutSizeButtonID); -} - -string CountryStatusHelper::FormatInQueueMap() -{ - return strings::Format(GetLocalizedString(InQueueID), m_countryInfo.m_currentCountryName); -} - -string CountryStatusHelper::FormatFailed() -{ - return strings::Format(GetLocalizedString(DownloadingFailedID), m_countryInfo.m_currentCountryName); -} - -string CountryStatusHelper::FormatTryAgain() -{ - return GetLocalizedString(TryAgainButtonID); -} - -string CountryStatusHelper::FormatCancel() -{ - return GetLocalizedString(DownloadCancelButtonID); -} - -} // namespace gui diff --git a/drape_frontend/gui/country_status_helper.hpp b/drape_frontend/gui/country_status_helper.hpp deleted file mode 100644 index 10d4483d9d..0000000000 --- a/drape_frontend/gui/country_status_helper.hpp +++ /dev/null @@ -1,100 +0,0 @@ -#pragma once - -#include "drape/pointers.hpp" - -#include "storage/index.hpp" -#include "storage/storage_defines.hpp" - -#include "base/buffer_vector.hpp" - -#include "std/atomic.hpp" -#include "std/string.hpp" - -namespace gui -{ - -struct CountryInfo -{ - storage::TCountryId m_countryIndex = storage::kInvalidCountryId; - storage::Status m_countryStatus = storage::Status::EUnknown; - string m_currentCountryName; - size_t m_mapSize = 0; - size_t m_downloadProgress = 0; - bool m_showMapSize = true; -}; - -class CountryStatusHelper -{ -public: - enum ECountryState - { - COUNTRY_STATE_EMPTY, - COUNTRY_STATE_LOADED, - COUNTRY_STATE_LOADING, - COUNTRY_STATE_IN_QUEUE, - COUNTRY_STATE_FAILED - }; - - enum EControlType - { - CONTROL_TYPE_LABEL, - CONTROL_TYPE_BUTTON, - CONTROL_TYPE_PROGRESS - }; - - enum EButtonType - { - BUTTON_TYPE_NOT_BUTTON, - BUTTON_TYPE_MAP, - BUTTON_TRY_AGAIN, - BUTTON_CANCEL - }; - - struct Control - { - string m_label; - EControlType m_type; - EButtonType m_buttonType; - }; - - CountryStatusHelper(); - - void SetCountryInfo(CountryInfo const & countryInfo); - void Clear(); - - storage::TCountryId GetCountryIndex() const; - ECountryState GetState() const; - /// CountryStatusHandle work on FrontendRenderer and call this function to check "is visible" - /// or state has already changed. - /// State changes from BackendRenderer thread, when recache operation started. - /// In that moment no need to show old CountryStatus - bool IsVisibleForState(ECountryState state) const; - - size_t GetComponentCount() const; - Control const & GetControl(size_t index) const; - static float GetControlMargin(); - - static void GetProgressInfo(string & alphabet, size_t & maxLength); - string GetProgressValue() const; - -private: - void FillControlsForState(); - void FillControlsForEmpty(); - void FillControlsForLoading(); - void FillControlsForInQueue(); - void FillControlsForFailed(); - - string FormatDownloadMap(); - string FormatInQueueMap(); - string FormatFailed(); - string FormatTryAgain(); - string FormatCancel(); - - void SetState(ECountryState state); - - ECountryState m_state; - buffer_vector m_controls; - CountryInfo m_countryInfo; -}; - -} // namespace gui diff --git a/drape_frontend/gui/drape_gui.cpp b/drape_frontend/gui/drape_gui.cpp index 55f31a72ae..263f50729a 100644 --- a/drape_frontend/gui/drape_gui.cpp +++ b/drape_frontend/gui/drape_gui.cpp @@ -1,4 +1,3 @@ -#include "country_status_helper.hpp" #include "drape_gui.hpp" #include "ruler_helper.hpp" @@ -15,16 +14,12 @@ namespace gui struct DrapeGui::Impl { DrapeGui::TLocalizeStringFn m_localizeFn; - DrapeGui::TRecacheCountryStatusSlot m_recacheSlot; - RulerHelper m_rulerHelper; - CountryStatusHelper m_countryHelper; }; DrapeGui::DrapeGui() : m_impl(new Impl()) -{ -} +{} DrapeGui & DrapeGui::Instance() { @@ -40,11 +35,6 @@ RulerHelper & DrapeGui::GetRulerHelper() return Instance().GetRulerHelperImpl(); } -CountryStatusHelper & DrapeGui::GetCountryStatusHelper() -{ - return Instance().GetCountryStatusHelperImpl(); -} - dp::FontDecl DrapeGui::GetGuiTextFont() { return dp::FontDecl(df::GetColorConstant(GetStyleReader().GetCurrentStyle(), df::GuiText), 14); @@ -74,24 +64,6 @@ void DrapeGui::SetLocalizator(const DrapeGui::TLocalizeStringFn & fn) m_impl->m_localizeFn = fn; } -void DrapeGui::SetRecacheCountryStatusSlot(TRecacheCountryStatusSlot const & fn) -{ - ASSERT(m_impl != nullptr, ()); - m_impl->m_recacheSlot = fn; -} - -void DrapeGui::EmitRecacheCountryStatusSignal() -{ - ASSERT(m_impl != nullptr, ()); - if (m_impl->m_recacheSlot) - m_impl->m_recacheSlot(); -} - -void DrapeGui::ClearRecacheCountryStatusSlot() -{ - SetRecacheCountryStatusSlot(TRecacheCountryStatusSlot()); -} - string DrapeGui::GetLocalizedString(string const & stringID) const { ASSERT(m_impl != nullptr, ()); @@ -105,34 +77,15 @@ RulerHelper & DrapeGui::GetRulerHelperImpl() return m_impl->m_rulerHelper; } -CountryStatusHelper & DrapeGui::GetCountryStatusHelperImpl() -{ - ASSERT(m_impl != nullptr, ()); - return m_impl->m_countryHelper; -} - void DrapeGui::ConnectOnCompassTappedHandler(Shape::TTapHandler const & handler) { m_onCompassTappedHandler = handler; } -void DrapeGui::ConnectOnButtonPressedHandler(CountryStatusHelper::EButtonType buttonType, - Shape::TTapHandler const & handler) -{ - m_buttonHandlers[buttonType] = handler; -} - void DrapeGui::CallOnCompassTappedHandler() { if(m_onCompassTappedHandler != nullptr) m_onCompassTappedHandler(); } -void DrapeGui::CallOnButtonPressedHandler(CountryStatusHelper::EButtonType buttonType) -{ - auto it = m_buttonHandlers.find(buttonType); - if (it != m_buttonHandlers.end() && it->second != nullptr) - it->second(); -} - -} +} // namespace gui diff --git a/drape_frontend/gui/drape_gui.hpp b/drape_frontend/gui/drape_gui.hpp index 16c789ab04..991d169e27 100644 --- a/drape_frontend/gui/drape_gui.hpp +++ b/drape_frontend/gui/drape_gui.hpp @@ -2,7 +2,6 @@ #include "skin.hpp" #include "compass.hpp" -#include "country_status.hpp" #include "storage/index.hpp" #include "storage/storage_defines.hpp" @@ -19,17 +18,14 @@ namespace gui { class RulerHelper; -class CountryStatusHelper; class DrapeGui { public: - using TRecacheCountryStatusSlot = function; using TLocalizeStringFn = function; static DrapeGui & Instance(); static RulerHelper & GetRulerHelper(); - static CountryStatusHelper & GetCountryStatusHelper(); static dp::FontDecl GetGuiTextFont(); @@ -40,10 +36,6 @@ public: string GetLocalizedString(string const & stringID) const; - void SetRecacheCountryStatusSlot(TRecacheCountryStatusSlot const & fn); - void EmitRecacheCountryStatusSignal(); - void ClearRecacheCountryStatusSlot(); - bool IsInUserAction() const { return m_inUserAction; } void SetInUserAction(bool isInUserAction) { m_inUserAction = isInUserAction; } @@ -51,16 +43,12 @@ public: void DeactivateCopyright() { m_isCopyrightActive = false; } void ConnectOnCompassTappedHandler(Shape::TTapHandler const & handler); - void ConnectOnButtonPressedHandler(CountryStatusHelper::EButtonType buttonType, - Shape::TTapHandler const & handler); void CallOnCompassTappedHandler(); - void CallOnButtonPressedHandler(CountryStatusHelper::EButtonType buttonType); private: DrapeGui(); RulerHelper & GetRulerHelperImpl(); - CountryStatusHelper & GetCountryStatusHelperImpl(); private: struct Impl; @@ -68,10 +56,9 @@ private: bool m_isCopyrightActive = true; Shape::TTapHandler m_onCompassTappedHandler; - CountryStatus::TButtonHandlers m_buttonHandlers; m2::PointF m_surfaceSize; mutable mutex m_surfaceSizeMutex; bool m_inUserAction = false; }; -} +} // namespace gui diff --git a/drape_frontend/gui/layer_render.cpp b/drape_frontend/gui/layer_render.cpp index fa501a7670..3effb837fe 100644 --- a/drape_frontend/gui/layer_render.cpp +++ b/drape_frontend/gui/layer_render.cpp @@ -1,7 +1,6 @@ #include "choose_position_mark.hpp" #include "compass.hpp" #include "copyright_label.hpp" -#include "country_status.hpp" #include "drape_gui.hpp" #include "gui_text.hpp" #include "layer_render.hpp" @@ -164,13 +163,6 @@ private: int m_scale; }; -void RegisterButtonHandler(CountryStatus::TButtonHandlers & handlers, - CountryStatusHelper::EButtonType buttonType) -{ - handlers[buttonType] = bind(&DrapeGui::CallOnButtonPressedHandler, - &DrapeGui::Instance(), buttonType); -} - } // namespace drape_ptr LayerCacher::RecacheWidgets(TWidgetsInitInfo const & initInfo, @@ -200,25 +192,6 @@ drape_ptr LayerCacher::RecacheWidgets(TWidgetsInitInfo const & in return renderer; } -drape_ptr LayerCacher::RecacheCountryStatus(ref_ptr textures) -{ - m2::PointF surfSize = DrapeGui::Instance().GetSurfaceSize(); - drape_ptr renderer = make_unique_dp(); - CountryStatus countryStatus = CountryStatus(Position(surfSize * 0.5f, dp::Center)); - - CountryStatus::TButtonHandlers handlers; - RegisterButtonHandler(handlers, CountryStatusHelper::BUTTON_TYPE_MAP); - RegisterButtonHandler(handlers, CountryStatusHelper::BUTTON_TRY_AGAIN); - RegisterButtonHandler(handlers, CountryStatusHelper::BUTTON_CANCEL); - - renderer->AddShapeRenderer(WIDGET_COUNTRY_STATUS, countryStatus.Draw(textures, handlers)); - - // Flush gui geometry. - GLFunctions::glFlush(); - - return renderer; -} - drape_ptr LayerCacher::RecacheChoosePositionMark(ref_ptr textures) { m2::PointF const surfSize = DrapeGui::Instance().GetSurfaceSize(); @@ -233,7 +206,6 @@ drape_ptr LayerCacher::RecacheChoosePositionMark(ref_ptr renderer, ref_ptr textures) { @@ -286,4 +258,4 @@ m2::PointF LayerCacher::CacheScaleLabel(Position const & position, ref_ptr RecacheWidgets(TWidgetsInitInfo const & initInfo, TWidgetsSizeInfo & sizeInfo, ref_ptr textures); - drape_ptr RecacheCountryStatus(ref_ptr textures); drape_ptr RecacheChoosePositionMark(ref_ptr textures); private: @@ -65,4 +64,4 @@ private: m2::PointF CacheScaleLabel(Position const & position, ref_ptr renderer, ref_ptr textures); }; -} +} // namespace gui diff --git a/drape_frontend/gui/skin.hpp b/drape_frontend/gui/skin.hpp index f4faea7afa..c34965a026 100644 --- a/drape_frontend/gui/skin.hpp +++ b/drape_frontend/gui/skin.hpp @@ -16,8 +16,7 @@ enum EWidget WIDGET_COPYRIGHT = 0x4, WIDGET_SCALE_LABEL = 0x8, /// Following widgets controlled by rendering kernel. Don't use them in platform code - WIDGET_COUNTRY_STATUS = 0x8000, - WIDGET_CHOOSE_POSITION_MARK = 0x8001 + WIDGET_CHOOSE_POSITION_MARK = 0x8000 }; enum EGuiHandle diff --git a/drape_frontend/map_data_provider.cpp b/drape_frontend/map_data_provider.cpp index c7e9d33f21..f35e0e1d1c 100644 --- a/drape_frontend/map_data_provider.cpp +++ b/drape_frontend/map_data_provider.cpp @@ -5,20 +5,14 @@ namespace df MapDataProvider::MapDataProvider(TReadIDsFn const & idsReader, TReadFeaturesFn const & featureReader, - TUpdateCountryIndexFn const & countryIndexUpdater, TIsCountryLoadedFn const & isCountryLoadedFn, TIsCountryLoadedByNameFn const & isCountryLoadedByNameFn, - TDownloadFn const & downloadMapHandler, - TDownloadFn const & downloadRetryHandler, - TDownloadFn const & downloadCancelHandler) + TUpdateCurrentCountryFn const & updateCurrentCountryFn) : m_featureReader(featureReader) , m_idsReader(idsReader) - , m_countryIndexUpdater(countryIndexUpdater) - , m_isCountryLoadedFn(isCountryLoadedFn) - , m_downloadMapHandler(downloadMapHandler) - , m_downloadRetryHandler(downloadRetryHandler) - , m_downloadCancelHandler(downloadCancelHandler) - , m_isCountryLoadedByNameFn(isCountryLoadedByNameFn) + , m_isCountryLoaded(isCountryLoadedFn) + , m_updateCurrentCountry(updateCurrentCountryFn) + , m_isCountryLoadedByName(isCountryLoadedByNameFn) { } @@ -32,29 +26,14 @@ void MapDataProvider::ReadFeatures(TReadCallback const & fn, vector m_featureReader(fn, ids); } -void MapDataProvider::UpdateCountryIndex(storage::TCountryId const & currentId, m2::PointF const & pt) -{ - m_countryIndexUpdater(currentId, pt); -} - MapDataProvider::TIsCountryLoadedFn const & MapDataProvider::GetIsCountryLoadedFn() const { - return m_isCountryLoadedFn; + return m_isCountryLoaded; } -TDownloadFn const & MapDataProvider::GetDownloadMapHandler() const +MapDataProvider::TUpdateCurrentCountryFn const & MapDataProvider::UpdateCurrentCountryFn() const { - return m_downloadMapHandler; + return m_updateCurrentCountry; } -TDownloadFn const & MapDataProvider::GetDownloadRetryHandler() const -{ - return m_downloadRetryHandler; -} - -TDownloadFn const & MapDataProvider::GetDownloadCancelHandler() const -{ - return m_downloadCancelHandler; -} - -} +} // namespace df diff --git a/drape_frontend/map_data_provider.hpp b/drape_frontend/map_data_provider.hpp index 0fdebfab26..69dc9ada8c 100644 --- a/drape_frontend/map_data_provider.hpp +++ b/drape_frontend/map_data_provider.hpp @@ -17,40 +17,30 @@ public: template using TReadCallback = function; using TReadFeaturesFn = function const & , vector const &)>; using TReadIDsFn = function const & , m2::RectD const &, int)>; - using TUpdateCountryIndexFn = function; using TIsCountryLoadedFn = function; using TIsCountryLoadedByNameFn = function; + using TUpdateCurrentCountryFn = function; MapDataProvider(TReadIDsFn const & idsReader, TReadFeaturesFn const & featureReader, - TUpdateCountryIndexFn const & countryIndexUpdater, TIsCountryLoadedFn const & isCountryLoadedFn, TIsCountryLoadedByNameFn const & isCountryLoadedByNameFn, - TDownloadFn const & downloadMapHandler, - TDownloadFn const & downloadRetryHandler, - TDownloadFn const & downloadCancelHandler); + TUpdateCurrentCountryFn const & updateCurrentCountryFn); void ReadFeaturesID(TReadCallback const & fn, m2::RectD const & r, int scale) const; void ReadFeatures(TReadCallback const & fn, vector const & ids) const; - void UpdateCountryIndex(storage::TCountryId const & currentId, m2::PointF const & pt); TIsCountryLoadedFn const & GetIsCountryLoadedFn() const; - - TDownloadFn const & GetDownloadMapHandler() const; - TDownloadFn const & GetDownloadRetryHandler() const; - TDownloadFn const & GetDownloadCancelHandler() const; + TUpdateCurrentCountryFn const & UpdateCurrentCountryFn() const; private: TReadFeaturesFn m_featureReader; TReadIDsFn m_idsReader; - TUpdateCountryIndexFn m_countryIndexUpdater; - TIsCountryLoadedFn m_isCountryLoadedFn; - TDownloadFn m_downloadMapHandler; - TDownloadFn m_downloadRetryHandler; - TDownloadFn m_downloadCancelHandler; + TIsCountryLoadedFn m_isCountryLoaded; + TUpdateCurrentCountryFn m_updateCurrentCountry; public: - TIsCountryLoadedByNameFn m_isCountryLoadedByNameFn; + TIsCountryLoadedByNameFn m_isCountryLoadedByName; }; -} +} // namespace df diff --git a/drape_frontend/message.hpp b/drape_frontend/message.hpp index 8f3e459802..a83af1cfd4 100644 --- a/drape_frontend/message.hpp +++ b/drape_frontend/message.hpp @@ -26,8 +26,6 @@ public: GuiRecache, GuiLayerLayout, MyPositionShape, - CountryInfoUpdate, - CountryStatusRecache, StopRendering, ChangeMyPostitionMode, CompassInfo, diff --git a/drape_frontend/message_subclasses.hpp b/drape_frontend/message_subclasses.hpp index 9ceaaa3a89..163341b389 100644 --- a/drape_frontend/message_subclasses.hpp +++ b/drape_frontend/message_subclasses.hpp @@ -1,6 +1,5 @@ #pragma once -#include "drape_frontend/gui/country_status_helper.hpp" #include "drape_frontend/gui/layer_render.hpp" #include "drape_frontend/gui/skin.hpp" @@ -312,37 +311,6 @@ private: gui::TWidgetsLayoutInfo m_layoutInfo; }; -class CountryInfoUpdateMessage : public Message -{ -public: - CountryInfoUpdateMessage() - : m_needShow(false) - {} - - CountryInfoUpdateMessage(gui::CountryInfo const & info, bool isCurrentCountry) - : m_countryInfo(info) - , m_isCurrentCountry(isCurrentCountry) - , m_needShow(true) - {} - - Type GetType() const override { return Message::CountryInfoUpdate;} - gui::CountryInfo const & GetCountryInfo() const { return m_countryInfo; } - bool IsCurrentCountry() const { return m_isCurrentCountry; } - bool NeedShow() const { return m_needShow; } - -private: - gui::CountryInfo m_countryInfo; - bool m_isCurrentCountry; - bool m_needShow; -}; - -class CountryStatusRecacheMessage : public Message -{ -public: - CountryStatusRecacheMessage() = default; - Type GetType() const override { return Message::CountryStatusRecache; } -}; - class ShowChoosePositionMarkMessage : public Message { public: diff --git a/drape_frontend/tile_info.cpp b/drape_frontend/tile_info.cpp index e2e39fb005..2dafcd2d4b 100644 --- a/drape_frontend/tile_info.cpp +++ b/drape_frontend/tile_info.cpp @@ -100,7 +100,7 @@ void TileInfo::ReadFeatures(MapDataProvider const & model, MemoryFeatureIndex & bind(&TileInfo::IsCancelled, this), bind(&TileInfo::SetFeatureOwner, this, _1, ref(memIndex)), bind(&TileInfo::DiscardFeatureInfo, this, _1, ref(memIndex)), - model.m_isCountryLoadedByNameFn, + model.m_isCountryLoadedByName, make_ref(m_context), m_is3dBuildings); model.ReadFeatures(bind(ref(drawer), _1), featuresToRead); } diff --git a/iphone/Maps/Classes/Widgets/MWMMapWidgets.mm b/iphone/Maps/Classes/Widgets/MWMMapWidgets.mm index 3fa2ddace8..af9e2545d9 100644 --- a/iphone/Maps/Classes/Widgets/MWMMapWidgets.mm +++ b/iphone/Maps/Classes/Widgets/MWMMapWidgets.mm @@ -59,7 +59,6 @@ pivot += m2::PointF(self.leftBound, -self.bottomBound) * self.visualScale; break; case gui::WIDGET_SCALE_LABEL: - case gui::WIDGET_COUNTRY_STATUS: break; } layout[w] = pivot; diff --git a/map/framework.cpp b/map/framework.cpp index 40d1ab0855..c8e6d1463b 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -21,9 +21,7 @@ #include "drape_frontend/color_constants.hpp" #include "drape_frontend/gps_track_point.hpp" -#include "drape_frontend/gui/country_status_helper.hpp" #include "drape_frontend/visual_params.hpp" -#include "drape_frontend/gui/country_status_helper.hpp" #include "drape_frontend/watch/cpu_drawer.hpp" #include "drape_frontend/watch/feature_processor.hpp" @@ -284,16 +282,6 @@ Framework::Framework() // Init strings bundle. // @TODO. There are hardcoded strings below which are defined in strings.txt as well. // It's better to use strings form strings.txt intead of hardcoding them here. - m_stringsBundle.SetDefaultString("country_status_added_to_queue", "^\nis added to the downloading queue"); - m_stringsBundle.SetDefaultString("country_status_downloading", "Downloading\n^\n^"); - m_stringsBundle.SetDefaultString("country_status_download", "Download map\n(^ ^)"); - m_stringsBundle.SetDefaultString("country_status_download_without_size", "Download map"); - m_stringsBundle.SetDefaultString("country_status_download_failed", "Downloading\n^\nhas failed"); - m_stringsBundle.SetDefaultString("country_status_download_without_routing", "Download map\nwithout routing (^ ^)"); - m_stringsBundle.SetDefaultString("cancel", "Cancel"); - m_stringsBundle.SetDefaultString("try_again", "Try Again"); - m_stringsBundle.SetDefaultString("not_enough_free_space_on_sdcard", "Not enough space for downloading"); - m_stringsBundle.SetDefaultString("dropped_pin", "Dropped Pin"); m_stringsBundle.SetDefaultString("my_places", "My Places"); m_stringsBundle.SetDefaultString("routes", "Routes"); @@ -906,72 +894,22 @@ void Framework::ClearAllCaches() m_searchEngine->ClearCaches(); } -void Framework::SetDownloadCountryListener(TDownloadCountryListener const & listener) +void Framework::OnUpdateCurrentCountry(m2::PointF const & pt, int zoomLevel) { - m_downloadCountryListener = listener; -} + storage::TCountryId newCountryId; + if (zoomLevel > scales::GetUpperWorldScale()) + newCountryId = m_storage.FindCountryIdByFile(m_infoGetter->GetRegionCountryId(m2::PointD(pt))); -void Framework::SetDownloadCancelListener(TDownloadCancelListener const & listener) -{ - m_downloadCancelListener = listener; -} - -void Framework::SetAutoDownloadListener(TAutoDownloadListener const & listener) -{ - m_autoDownloadListener = listener; -} - -void Framework::OnDownloadMapCallback(storage::TCountryId const & countryId) -{ -} - -void Framework::OnDownloadRetryCallback(storage::TCountryId const & countryId) -{ -} - -void Framework::OnDownloadCancelCallback(storage::TCountryId const & countryId) -{ - // Any cancel leads to disable auto-downloading. - m_autoDownloadingOn = false; -} - -void Framework::OnUpdateCountryIndex(storage::TCountryId const & currentId, m2::PointF const & pt) -{ - storage::TCountryId newCountryId = GetCountryIndex(m2::PointD(pt)); - if (newCountryId != storage::kInvalidCountryId) + GetPlatform().RunOnGuiThread([this, newCountryId]() { - m_drapeEngine->SetInvalidCountryInfo(); - return; - } - - if (currentId != newCountryId) - { - if (m_autoDownloadingOn && m_autoDownloadListener != nullptr) - m_autoDownloadListener(newCountryId); - - UpdateCountryInfo(newCountryId, true /* isCurrentCountry */); - } + if (m_currentCountryChanged != nullptr) + m_currentCountryChanged(newCountryId); + }); } -void Framework::UpdateCountryInfo(storage::TCountryId const & countryId, bool isCurrentCountry) +void Framework::SetCurrentCountryChangedListener(TCurrentCountryChanged const & listener) { - if (!m_drapeEngine) - return; - - string const & fileName = countryId; - if (m_model.IsLoaded(fileName)) - { - m_drapeEngine->SetInvalidCountryInfo(); - return; - } - - gui::CountryInfo countryInfo; - - countryInfo.m_countryIndex = countryId; - if (countryInfo.m_countryStatus == storage::Status::EDownloading) - countryInfo.m_downloadProgress = 50; - - m_drapeEngine->SetCountryInfo(countryInfo, isCurrentCountry); + m_currentCountryChanged = listener; } void Framework::UpdateUserViewportChanged() @@ -1381,43 +1319,21 @@ bool Framework::GetDistanceAndAzimut(m2::PointD const & point, void Framework::CreateDrapeEngine(ref_ptr contextFactory, DrapeCreationParams && params) { - using TReadIDsFn = df::MapDataProvider::TReadIDsFn; - using TReadFeaturesFn = df::MapDataProvider::TReadFeaturesFn; - using TUpdateCountryIndexFn = df::MapDataProvider::TUpdateCountryIndexFn; - using TIsCountryLoadedFn = df::MapDataProvider::TIsCountryLoadedFn; - - TReadIDsFn idReadFn = [this](df::MapDataProvider::TReadCallback const & fn, m2::RectD const & r, int scale) -> void + auto idReadFn = [this](df::MapDataProvider::TReadCallback const & fn, + m2::RectD const & r, int scale) -> void { m_model.ForEachFeatureID(r, fn, scale); }; - TReadFeaturesFn featureReadFn = [this](df::MapDataProvider::TReadCallback const & fn, vector const & ids) -> void + auto featureReadFn = [this](df::MapDataProvider::TReadCallback const & fn, + vector const & ids) -> void { m_model.ReadFeatures(fn, ids); }; - TUpdateCountryIndexFn updateCountryIndex = [this](storage::TCountryId const & currentId, m2::PointF const & pt) - { - GetPlatform().RunOnGuiThread(bind(&Framework::OnUpdateCountryIndex, this, currentId, pt)); - }; - - TIsCountryLoadedFn isCountryLoadedFn = bind(&Framework::IsCountryLoaded, this, _1); + auto isCountryLoadedFn = bind(&Framework::IsCountryLoaded, this, _1); auto isCountryLoadedByNameFn = bind(&Framework::IsCountryLoadedByName, this, _1); - - TDownloadFn downloadMapFn = [this](storage::TCountryId const & countryId) - { - GetPlatform().RunOnGuiThread(bind(&Framework::OnDownloadMapCallback, this, countryId)); - }; - - TDownloadFn downloadRetryFn = [this](storage::TCountryId const & countryId) - { - GetPlatform().RunOnGuiThread(bind(&Framework::OnDownloadRetryCallback, this, countryId)); - }; - - TDownloadFn downloadCancelFn = [this](storage::TCountryId const & countryId) - { - GetPlatform().RunOnGuiThread(bind(&Framework::OnDownloadCancelCallback, this, countryId)); - }; + auto updateCurrentCountryFn = bind(&Framework::OnUpdateCurrentCountry, this, _1, _2); bool allow3d; bool allow3dBuildings; @@ -1426,11 +1342,9 @@ void Framework::CreateDrapeEngine(ref_ptr contextFactory, df::DrapeEngine::Params p(contextFactory, make_ref(&m_stringsBundle), df::Viewport(0, 0, params.m_surfaceWidth, params.m_surfaceHeight), - df::MapDataProvider(idReadFn, featureReadFn, updateCountryIndex, - isCountryLoadedFn, isCountryLoadedByNameFn, - downloadMapFn, downloadRetryFn, downloadCancelFn), - params.m_visualScale, - move(params.m_widgetsInitInfo), + df::MapDataProvider(idReadFn, featureReadFn, isCountryLoadedFn, + isCountryLoadedByNameFn, updateCurrentCountryFn), + params.m_visualScale, move(params.m_widgetsInitInfo), make_pair(params.m_initialMyPositionState, params.m_hasMyPositionState), allow3dBuildings, params.m_isChoosePositionMode, params.m_isChoosePositionMode); @@ -1440,10 +1354,6 @@ void Framework::CreateDrapeEngine(ref_ptr contextFactory, if (!screen.GlobalRect().EqualDxDy(m_currentModelView.GlobalRect(), 1.0E-4)) UpdateUserViewportChanged(); m_currentModelView = screen; - - // Enable auto-downloading after return from the world map. - if (GetDrawScale() <= scales::GetUpperWorldScale()) - m_autoDownloadingOn = true; }); m_drapeEngine->SetTapEventInfoListener(bind(&Framework::OnTapEvent, this, _1)); m_drapeEngine->SetUserPositionListener(bind(&Framework::OnUserPositionChanged, this, _1)); diff --git a/map/framework.hpp b/map/framework.hpp index 03ec3557be..dec281bf5d 100644 --- a/map/framework.hpp +++ b/map/framework.hpp @@ -95,9 +95,6 @@ class Framework protected: using TDrapeFunction = function; - using TDownloadCountryListener = function; - using TDownloadCancelListener = function; - using TAutoDownloadListener = function; StringsBundle m_stringsBundle; @@ -122,11 +119,6 @@ protected: double m_startForegroundTime; - TDownloadCountryListener m_downloadCountryListener; - TDownloadCancelListener m_downloadCancelListener; - TAutoDownloadListener m_autoDownloadListener; - bool m_autoDownloadingOn = true; - storage::Storage m_storage; location::TMyPositionModeChanged m_myPositionListener; @@ -195,10 +187,6 @@ public: /// options - flags that signal about parts of map that must be downloaded void DownloadCountry(storage::TCountryId const & index, MapOptions opt); - void SetDownloadCountryListener(TDownloadCountryListener const & listener); - void SetDownloadCancelListener(TDownloadCancelListener const & listener); - void SetAutoDownloadListener(TAutoDownloadListener const & listener); - storage::Status GetCountryStatus(storage::TCountryId const & index) const; string GetCountryName(storage::TCountryId const & index) const; @@ -280,6 +268,9 @@ public: void EnableChoosePositionMode(bool enable); void BlockTapEvents(bool block); + using TCurrentCountryChanged = function; + void SetCurrentCountryChangedListener(TCurrentCountryChanged const & listener); + private: /// UI callback is called when tap event is "restored" after Drape engine restart. void SimulateLastTapEventIfNeeded(); @@ -361,12 +352,9 @@ private: void FillSearchResultsMarks(search::Results const & results); - void OnDownloadMapCallback(storage::TCountryId const & countryIndex); - void OnDownloadRetryCallback(storage::TCountryId const & countryIndex); - void OnDownloadCancelCallback(storage::TCountryId const & countryIndex); + void OnUpdateCurrentCountry(m2::PointF const & pt, int zoomLevel); - void OnUpdateCountryIndex(storage::TCountryId const & currentIndex, m2::PointF const & pt); - void UpdateCountryInfo(storage::TCountryId const & countryIndex, bool isCurrentCountry); + TCurrentCountryChanged m_currentCountryChanged; // Search query params and viewport for the latest search // query. These fields are used to check whether a new search query diff --git a/qt/draw_widget.cpp b/qt/draw_widget.cpp index 64e3948ea4..f62c8d5c19 100644 --- a/qt/draw_widget.cpp +++ b/qt/draw_widget.cpp @@ -99,10 +99,21 @@ DrawWidget::DrawWidget(QWidget * parent) { }); + m_framework->SetCurrentCountryChangedListener([this](storage::TCountryId const & countryId) + { + m_countryId = countryId; + UpdateCountryStatus(countryId); + }); + QTimer * timer = new QTimer(this); VERIFY(connect(timer, SIGNAL(timeout()), this, SLOT(update())), ()); timer->setSingleShot(false); timer->start(30); + + QTimer * countryStatusTimer = new QTimer(this); + VERIFY(connect(countryStatusTimer, SIGNAL(timeout()), this, SLOT(OnUpdateCountryStatusByTimer())), ()); + countryStatusTimer->setSingleShot(false); + countryStatusTimer->start(1000); } DrawWidget::~DrawWidget() @@ -111,6 +122,51 @@ DrawWidget::~DrawWidget() m_framework.reset(); } +void DrawWidget::UpdateCountryStatus(storage::TCountryId const & countryId) +{ + if (m_currentCountryChanged != nullptr) + { + // TODO @bykoianko + string countryName = countryId; + uint8_t progress = 50; + + auto status = m_framework->Storage().CountryStatusEx(countryId); + + uint64_t sizeInBytes = 0; + if (!countryId.empty()) + { + storage::NodeAttrs nodeAttrs; + m_framework->Storage().GetNodeAttrs(countryId, nodeAttrs); + sizeInBytes = nodeAttrs.m_mwmSize; + } + + m_currentCountryChanged(countryId, countryName, status, sizeInBytes, progress); + } +} + +void DrawWidget::OnUpdateCountryStatusByTimer() +{ + if (!m_countryId.empty()) + UpdateCountryStatus(m_countryId); +} + +void DrawWidget::SetCurrentCountryChangedListener(DrawWidget::TCurrentCountryChanged const & listener) +{ + m_currentCountryChanged = listener; +} + +void DrawWidget::DownloadCountry(storage::TCountryId const & countryId) +{ + m_framework->Storage().DownloadNode(countryId); + if (!m_countryId.empty()) + UpdateCountryStatus(m_countryId); +} + +void DrawWidget::RetryToDownloadCountry(storage::TCountryId const & countryId) +{ + // TODO @bykoianko +} + void DrawWidget::SetScaleControl(QScaleSlider * pScale) { m_pScale = pScale; diff --git a/qt/draw_widget.hpp b/qt/draw_widget.hpp index 1e250161ed..fdd16b8bc7 100644 --- a/qt/draw_widget.hpp +++ b/qt/draw_widget.hpp @@ -44,6 +44,8 @@ namespace qt void ChoosePositionModeEnable(); void ChoosePositionModeDisable(); + void OnUpdateCountryStatusByTimer(); + public: DrawWidget(QWidget * parent); ~DrawWidget(); @@ -69,6 +71,13 @@ namespace qt void CreateEngine(); + using TCurrentCountryChanged = function; + void SetCurrentCountryChangedListener(TCurrentCountryChanged const & listener); + + void DownloadCountry(storage::TCountryId const & countryId); + void RetryToDownloadCountry(storage::TCountryId const & countryId); + protected: void initializeGL() override; void paintGL() override; @@ -99,6 +108,8 @@ namespace qt inline int L2D(int px) const { return px * m_ratio; } m2::PointD GetDevicePoint(QMouseEvent * e) const; + void UpdateCountryStatus(storage::TCountryId const & countryId); + QScaleSlider * m_pScale; bool m_enableScaleUpdate; @@ -107,5 +118,8 @@ namespace qt void InitRenderPolicy(); unique_ptr m_skin; + + TCurrentCountryChanged m_currentCountryChanged; + storage::TCountryId m_countryId; }; } diff --git a/qt/mainwindow.cpp b/qt/mainwindow.cpp index fef22c2417..37108e6ead 100644 --- a/qt/mainwindow.cpp +++ b/qt/mainwindow.cpp @@ -12,6 +12,7 @@ #include "platform/platform.hpp" #include "std/bind.hpp" +#include "std/sstream.hpp" #include @@ -22,6 +23,9 @@ #include #include #include + #include + #include + #include #else #include #include @@ -29,6 +33,9 @@ #include #include #include + #include + #include + #include #endif @@ -83,6 +90,7 @@ MainWindow::MainWindow() : m_locationService(CreateDesktopLocationService(*this) QObject::connect(m_pDrawWidget, SIGNAL(BeforeEngineCreation()), this, SLOT(OnBeforeEngineCreation())); + CreateCountryStatusControls(); CreateNavigationBar(); CreateSearchBarAndPanel(); @@ -220,6 +228,27 @@ namespace int key; char const * slot; }; + + void FormatMapSize(uint64_t sizeInBytes, string & units, size_t & sizeToDownload) + { + int const mbInBytes = 1024 * 1024; + int const kbInBytes = 1024; + if (sizeInBytes > mbInBytes) + { + sizeToDownload = (sizeInBytes + mbInBytes - 1) / mbInBytes; + units = "MB"; + } + else if (sizeInBytes > kbInBytes) + { + sizeToDownload = (sizeInBytes + kbInBytes -1) / kbInBytes; + units = "KB"; + } + else + { + sizeToDownload = sizeInBytes; + units = "B"; + } + } } void MainWindow::CreateNavigationBar() @@ -311,6 +340,86 @@ void MainWindow::CreateNavigationBar() addToolBar(Qt::RightToolBarArea, pToolBar); } +void MainWindow::CreateCountryStatusControls() +{ + QHBoxLayout * mainLayout = new QHBoxLayout(); + + m_downloadButton = new QPushButton("Download"); + mainLayout->addWidget(m_downloadButton, 0, Qt::AlignHCenter); + m_downloadButton->setVisible(false); + connect(m_downloadButton, SIGNAL(released()), this, SLOT(OnDownloadClicked())); + + m_retryButton = new QPushButton("Retry downloading"); + mainLayout->addWidget(m_retryButton, 0, Qt::AlignHCenter); + m_retryButton->setVisible(false); + connect(m_retryButton, SIGNAL(released()), this, SLOT(OnRetryDownloadClicked())); + + m_downloadingStatusLabel = new QLabel("Downloading"); + mainLayout->addWidget(m_downloadingStatusLabel, 0, Qt::AlignHCenter); + m_downloadingStatusLabel->setVisible(false); + + m_pDrawWidget->setLayout(mainLayout); + + m_pDrawWidget->SetCurrentCountryChangedListener([this](storage::TCountryId const & countryId, + string const & countryName, storage::Status status, + uint64_t sizeInBytes, uint8_t progress) + { + m_lastCountry = countryId; + if (m_lastCountry.empty() || status == storage::Status::EOnDisk || status == storage::Status::EOnDiskOutOfDate) + { + m_downloadButton->setVisible(false); + m_retryButton->setVisible(false); + m_downloadingStatusLabel->setVisible(false); + } + else + { + if (status == storage::Status::ENotDownloaded) + { + m_downloadButton->setVisible(true); + m_retryButton->setVisible(false); + m_downloadingStatusLabel->setVisible(false); + + string units; + size_t sizeToDownload = 0; + FormatMapSize(sizeInBytes, units, sizeToDownload); + stringstream str; + str << "Download (" << countryName << ") " << sizeToDownload << units; + m_downloadButton->setText(str.str().c_str()); + } + else if (status == storage::Status::EDownloading) + { + m_downloadButton->setVisible(false); + m_retryButton->setVisible(false); + m_downloadingStatusLabel->setVisible(true); + + stringstream str; + str << "Downloading (" << countryName << ") " << (int)progress << "%"; + m_downloadingStatusLabel->setText(str.str().c_str()); + } + else if (status == storage::Status::EInQueue) + { + m_downloadButton->setVisible(false); + m_retryButton->setVisible(false); + m_downloadingStatusLabel->setVisible(true); + + stringstream str; + str << countryName << " is waiting for downloading"; + m_downloadingStatusLabel->setText(str.str().c_str()); + } + else + { + m_downloadButton->setVisible(false); + m_retryButton->setVisible(true); + m_downloadingStatusLabel->setVisible(false); + + stringstream str; + str << "Retry to download " << countryName; + m_retryButton->setText(str.str().c_str()); + } + } + }); +} + void MainWindow::OnAbout() { AboutDialog dlg(this); @@ -434,4 +543,14 @@ void MainWindow::closeEvent(QCloseEvent * e) e->accept(); } +void MainWindow::OnDownloadClicked() +{ + m_pDrawWidget->DownloadCountry(m_lastCountry); +} + +void MainWindow::OnRetryDownloadClicked() +{ + m_pDrawWidget->RetryToDownloadCountry(m_lastCountry); +} + } diff --git a/qt/mainwindow.hpp b/qt/mainwindow.hpp index 146ceba0e0..d7ca013ee7 100644 --- a/qt/mainwindow.hpp +++ b/qt/mainwindow.hpp @@ -1,5 +1,7 @@ #pragma once +#include "storage/index.hpp" + #include "platform/location.hpp" #include "platform/location_service.hpp" @@ -13,6 +15,8 @@ #endif class QDockWidget; +class QPushButton; +class QLabel; namespace search { class Result; } @@ -28,6 +32,11 @@ namespace qt QDockWidget * m_Docks[1]; + QPushButton * m_downloadButton; + QPushButton * m_retryButton; + QLabel * m_downloadingStatusLabel; + storage::TCountryId m_lastCountry; + unique_ptr const m_locationService; Q_OBJECT @@ -48,6 +57,7 @@ namespace qt QKeySequence const & hotkey, char const * slot); void CreateNavigationBar(); void CreateSearchBarAndPanel(); + void CreateCountryStatusControls(); #if defined(Q_WS_WIN) /// to handle menu messages @@ -69,5 +79,8 @@ namespace qt void OnUploadEditsMenuItem(); void OnBeforeEngineCreation(); + + void OnDownloadClicked(); + void OnRetryDownloadClicked(); }; } diff --git a/xcode/drape_frontend/drape_frontend.xcodeproj/project.pbxproj b/xcode/drape_frontend/drape_frontend.xcodeproj/project.pbxproj index 08c999d192..7f743b576d 100644 --- a/xcode/drape_frontend/drape_frontend.xcodeproj/project.pbxproj +++ b/xcode/drape_frontend/drape_frontend.xcodeproj/project.pbxproj @@ -109,16 +109,10 @@ 6709481E1BDF9C39005014C0 /* show_hide_animation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 670948111BDF9C39005014C0 /* show_hide_animation.cpp */; }; 6709481F1BDF9C39005014C0 /* show_hide_animation.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 670948121BDF9C39005014C0 /* show_hide_animation.hpp */; }; 670948201BDF9C39005014C0 /* value_mapping.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 670948131BDF9C39005014C0 /* value_mapping.hpp */; }; - 670948391BDF9C48005014C0 /* button.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 670948211BDF9C48005014C0 /* button.cpp */; }; - 6709483A1BDF9C48005014C0 /* button.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 670948221BDF9C48005014C0 /* button.hpp */; }; 6709483B1BDF9C48005014C0 /* compass.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 670948231BDF9C48005014C0 /* compass.cpp */; }; 6709483C1BDF9C48005014C0 /* compass.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 670948241BDF9C48005014C0 /* compass.hpp */; }; 6709483D1BDF9C48005014C0 /* copyright_label.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 670948251BDF9C48005014C0 /* copyright_label.cpp */; }; 6709483E1BDF9C48005014C0 /* copyright_label.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 670948261BDF9C48005014C0 /* copyright_label.hpp */; }; - 6709483F1BDF9C48005014C0 /* country_status_helper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 670948271BDF9C48005014C0 /* country_status_helper.cpp */; }; - 670948401BDF9C48005014C0 /* country_status_helper.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 670948281BDF9C48005014C0 /* country_status_helper.hpp */; }; - 670948411BDF9C48005014C0 /* country_status.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 670948291BDF9C48005014C0 /* country_status.cpp */; }; - 670948421BDF9C48005014C0 /* country_status.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 6709482A1BDF9C48005014C0 /* country_status.hpp */; }; 670948431BDF9C48005014C0 /* drape_gui.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6709482B1BDF9C48005014C0 /* drape_gui.cpp */; }; 670948441BDF9C48005014C0 /* drape_gui.hpp in Headers */ = {isa = PBXBuildFile; fileRef = 6709482C1BDF9C48005014C0 /* drape_gui.hpp */; }; 670948451BDF9C48005014C0 /* gui_text.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6709482D1BDF9C48005014C0 /* gui_text.cpp */; }; @@ -302,16 +296,10 @@ 670948111BDF9C39005014C0 /* show_hide_animation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = show_hide_animation.cpp; sourceTree = ""; }; 670948121BDF9C39005014C0 /* show_hide_animation.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = show_hide_animation.hpp; sourceTree = ""; }; 670948131BDF9C39005014C0 /* value_mapping.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = value_mapping.hpp; sourceTree = ""; }; - 670948211BDF9C48005014C0 /* button.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = button.cpp; sourceTree = ""; }; - 670948221BDF9C48005014C0 /* button.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = button.hpp; sourceTree = ""; }; 670948231BDF9C48005014C0 /* compass.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = compass.cpp; sourceTree = ""; }; 670948241BDF9C48005014C0 /* compass.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = compass.hpp; sourceTree = ""; }; 670948251BDF9C48005014C0 /* copyright_label.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = copyright_label.cpp; sourceTree = ""; }; 670948261BDF9C48005014C0 /* copyright_label.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = copyright_label.hpp; sourceTree = ""; }; - 670948271BDF9C48005014C0 /* country_status_helper.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = country_status_helper.cpp; sourceTree = ""; }; - 670948281BDF9C48005014C0 /* country_status_helper.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = country_status_helper.hpp; sourceTree = ""; }; - 670948291BDF9C48005014C0 /* country_status.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = country_status.cpp; sourceTree = ""; }; - 6709482A1BDF9C48005014C0 /* country_status.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = country_status.hpp; sourceTree = ""; }; 6709482B1BDF9C48005014C0 /* drape_gui.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = drape_gui.cpp; sourceTree = ""; }; 6709482C1BDF9C48005014C0 /* drape_gui.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = drape_gui.hpp; sourceTree = ""; }; 6709482D1BDF9C48005014C0 /* gui_text.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = gui_text.cpp; sourceTree = ""; }; @@ -555,16 +543,10 @@ children = ( 56BF56D81C7608C0006DD7CB /* choose_position_mark.cpp */, 56BF56D91C7608C0006DD7CB /* choose_position_mark.hpp */, - 670948211BDF9C48005014C0 /* button.cpp */, - 670948221BDF9C48005014C0 /* button.hpp */, 670948231BDF9C48005014C0 /* compass.cpp */, 670948241BDF9C48005014C0 /* compass.hpp */, 670948251BDF9C48005014C0 /* copyright_label.cpp */, 670948261BDF9C48005014C0 /* copyright_label.hpp */, - 670948271BDF9C48005014C0 /* country_status_helper.cpp */, - 670948281BDF9C48005014C0 /* country_status_helper.hpp */, - 670948291BDF9C48005014C0 /* country_status.cpp */, - 6709482A1BDF9C48005014C0 /* country_status.hpp */, 6709482B1BDF9C48005014C0 /* drape_gui.cpp */, 6709482C1BDF9C48005014C0 /* drape_gui.hpp */, 6709482D1BDF9C48005014C0 /* gui_text.cpp */, @@ -630,7 +612,6 @@ 56BF56DB1C7608C0006DD7CB /* choose_position_mark.hpp in Headers */, 670948031BDF9BF5005014C0 /* drape_engine.hpp in Headers */, 6709486A1BDF9C7F005014C0 /* brush_info.hpp in Headers */, - 670948401BDF9C48005014C0 /* country_status_helper.hpp in Headers */, 675D218E1BFB871D00717E4F /* rect.h in Headers */, 670948191BDF9C39005014C0 /* interpolations.hpp in Headers */, 670947CB1BDF9BE1005014C0 /* threads_commutator.hpp in Headers */, @@ -665,7 +646,6 @@ 56D545671C74A44900E3719C /* overlay_batcher.hpp in Headers */, 670947B21BDF9BE1005014C0 /* read_mwm_task.hpp in Headers */, 670947C91BDF9BE1005014C0 /* text_shape.hpp in Headers */, - 6709483A1BDF9C48005014C0 /* button.hpp in Headers */, 677A2DE61C0DD55D00635A00 /* requested_tiles.hpp in Headers */, 670947C11BDF9BE1005014C0 /* shape_view_params.hpp in Headers */, 670948461BDF9C48005014C0 /* gui_text.hpp in Headers */, @@ -680,7 +660,6 @@ 670948731BDF9C7F005014C0 /* frame_image.hpp in Headers */, 670947FB1BDF9BF5005014C0 /* backend_renderer.hpp in Headers */, 670947DF1BDF9BE1005014C0 /* visual_params.hpp in Headers */, - 670948421BDF9C48005014C0 /* country_status.hpp in Headers */, 670948171BDF9C39005014C0 /* interpolation_holder.hpp in Headers */, 670947FD1BDF9BF5005014C0 /* base_renderer.hpp in Headers */, 670947D51BDF9BE1005014C0 /* tile_utils.hpp in Headers */, @@ -815,7 +794,6 @@ 670947B11BDF9BE1005014C0 /* read_mwm_task.cpp in Sources */, 670948711BDF9C7F005014C0 /* feature_styler.cpp in Sources */, 670948471BDF9C48005014C0 /* layer_render.cpp in Sources */, - 670948391BDF9C48005014C0 /* button.cpp in Sources */, 6709486C1BDF9C7F005014C0 /* cpu_drawer.cpp in Sources */, 6743D3751C3A9F530095054B /* perspective_animation.cpp in Sources */, 670947C41BDF9BE1005014C0 /* text_handle.cpp in Sources */, @@ -846,7 +824,6 @@ 670947B91BDF9BE1005014C0 /* route_renderer.cpp in Sources */, 670E393C1C46C59000E9C0A6 /* color_constants.cpp in Sources */, 677A2DE51C0DD55D00635A00 /* requested_tiles.cpp in Sources */, - 670948411BDF9C48005014C0 /* country_status.cpp in Sources */, 670947B31BDF9BE1005014C0 /* render_group.cpp in Sources */, 675D21911BFB871D00717E4F /* text_engine.cpp in Sources */, 670947FE1BDF9BF5005014C0 /* batchers_pool.cpp in Sources */, @@ -856,7 +833,6 @@ 6743D36F1C3A9F090095054B /* framebuffer.cpp in Sources */, 670948181BDF9C39005014C0 /* interpolations.cpp in Sources */, 670948021BDF9BF5005014C0 /* drape_engine.cpp in Sources */, - 6709483F1BDF9C48005014C0 /* country_status_helper.cpp in Sources */, 56D545661C74A44900E3719C /* overlay_batcher.cpp in Sources */, 6709481C1BDF9C39005014C0 /* opacity_animation.cpp in Sources */, 6709479B1BDF9BE1005014C0 /* memory_feature_index.cpp in Sources */,