Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuri Gorshenin <mipt.vi002@gmail.com>2017-03-14 17:22:09 +0300
committerGitHub <noreply@github.com>2017-03-14 17:22:09 +0300
commit86986738f655917d740c20900812ce604511bb6a (patch)
treeeded6b82912e8adb19fd5168d1b24478afc89149
parent9dd44224ff8fc923381a143159fb9edc06f57095 (diff)
parent94112b4fc7169a24811d2a0241c45fd726cc7553 (diff)
Merge pull request #5594 from darina/change-style-debug-command
Added debug commands for changing map style.
-rw-r--r--android/src/com/mapswithme/maps/search/SearchFragment.java25
-rw-r--r--map/framework.cpp26
-rw-r--r--map/framework.hpp2
-rw-r--r--qt/search_panel.cpp28
-rw-r--r--qt/search_panel.hpp1
5 files changed, 28 insertions, 54 deletions
diff --git a/android/src/com/mapswithme/maps/search/SearchFragment.java b/android/src/com/mapswithme/maps/search/SearchFragment.java
index 65d37bfc3e..d3aefd7cce 100644
--- a/android/src/com/mapswithme/maps/search/SearchFragment.java
+++ b/android/src/com/mapswithme/maps/search/SearchFragment.java
@@ -94,10 +94,6 @@ public class SearchFragment extends BaseMwmFragment
return;
}
- // TODO: This code only for demonstration purposes and will be removed soon
- if (tryChangeMapStyle(query))
- return;
-
if (tryRecognizeLoggingCommand(query))
{
mSearchAdapter.clear();
@@ -447,27 +443,6 @@ public class SearchFragment extends BaseMwmFragment
Utils.navigateToParent(getActivity());
}
- // FIXME: This code only for demonstration purposes and will be removed soon
- private boolean tryChangeMapStyle(String str)
- {
- // Hook for shell command on change map style
- final boolean isDark = str.equals("mapstyle:dark") || str.equals("?dark");
- final boolean isLight = isDark ? false : str.equals("mapstyle:light") || str.equals("?light");
- final boolean isOld = isDark || isLight ? false : str.equals("?oldstyle");
-
- if (!isDark && !isLight && !isOld)
- return false;
-
- hideSearch();
-
- // change map style for the Map activity
- final int mapStyle = isDark ? Framework.MAP_STYLE_DARK : Framework.MAP_STYLE_CLEAR;
- Framework.nativeSetMapStyle(mapStyle);
-
- return true;
- }
- // FIXME END
-
private boolean tryRecognizeLoggingCommand(@NonNull String str)
{
if (str.equals("?enableLogging"))
diff --git a/map/framework.cpp b/map/framework.cpp
index 1b4961de69..6094a12a64 100644
--- a/map/framework.cpp
+++ b/map/framework.cpp
@@ -1394,6 +1394,9 @@ string Framework::GetCountryName(m2::PointD const & pt) const
bool Framework::Search(search::SearchParams const & params)
{
+ if (ParseDrapeDebugCommand(params.m_query))
+ return false;
+
auto const mode = params.m_mode;
auto & intent = m_searchIntents[static_cast<size_t>(mode)];
@@ -2868,6 +2871,29 @@ uint32_t GetBestType(FeatureType const & ft)
}
}
+bool Framework::ParseDrapeDebugCommand(std::string const & query)
+{
+ MapStyle desiredStyle = MapStyleCount;
+ if (query == "?dark" || query == "mapstyle:dark")
+ desiredStyle = MapStyleDark;
+ else if (query == "?light" || query == "mapstyle:light")
+ desiredStyle = MapStyleClear;
+ else if (query == "?vdark" || query == "mapstyle:vehicle_dark")
+ desiredStyle = MapStyleVehicleDark;
+ else if (query == "?vlight" || query == "mapstyle:vehicle_light")
+ desiredStyle = MapStyleVehicleClear;
+ else
+ return false;
+
+#if defined(OMIM_OS_ANDROID)
+ MarkMapStyle(desiredStyle);
+#else
+ SetMapStyle(desiredStyle);
+#endif
+
+ return true;
+}
+
bool Framework::ParseEditorDebugCommand(search::SearchParams const & params)
{
if (params.m_query == "?edits")
diff --git a/map/framework.hpp b/map/framework.hpp
index 264c40b69f..3c380674ae 100644
--- a/map/framework.hpp
+++ b/map/framework.hpp
@@ -620,6 +620,8 @@ private:
//void GetLocality(m2::PointD const & pt, search::AddressInfo & info) const;
/// @returns true if command was handled by editor.
bool ParseEditorDebugCommand(search::SearchParams const & params);
+ /// @returns true if command was handled by drape.
+ bool ParseDrapeDebugCommand(std::string const & query);
void FillFeatureInfo(FeatureID const & fid, place_page::Info & info) const;
/// @param customTitle, if not empty, overrides any other calculated name.
diff --git a/qt/search_panel.cpp b/qt/search_panel.cpp
index 4a51b27538..254ef8bf10 100644
--- a/qt/search_panel.cpp
+++ b/qt/search_panel.cpp
@@ -152,32 +152,6 @@ void SearchPanel::OnSearchResult(ResultsT * results)
}
// TODO: This code only for demonstration purposes and will be removed soon
-bool SearchPanel::TryChangeMapStyleCmd(QString const & str)
-{
- // Hook for shell command on change map style
- MapStyle desiredStyle = MapStyleCount;
- if (str == "mapstyle:dark" || str == "?dark")
- desiredStyle = MapStyleDark;
- else if (str == "mapstyle:light" || str == "?light")
- desiredStyle = MapStyleClear;
- else if (str == "mapstyle:vehicle_dark" || str == "?vdark")
- desiredStyle = MapStyleVehicleDark;
- else if (str == "mapstyle:vehicle_light" || str == "?vlight")
- desiredStyle = MapStyleVehicleClear;
- else
- return false;
-
- // close Search panel
- m_pEditor->setText("");
- parentWidget()->hide();
-
- // change color scheme for the Map activity
- m_pDrawWidget->SetMapStyle(desiredStyle);
-
- return true;
-}
-
-// TODO: This code only for demonstration purposes and will be removed soon
bool SearchPanel::TryChangeRouterCmd(QString const & str)
{
routing::RouterType routerType;
@@ -287,8 +261,6 @@ void SearchPanel::OnSearchTextChanged(QString const & str)
QString const normalized = str.normalized(QString::NormalizationForm_KC);
// TODO: This code only for demonstration purposes and will be removed soon
- if (TryChangeMapStyleCmd(normalized))
- return;
if (TryChangeRouterCmd(normalized))
return;
if (Try3dModeCmd(normalized))
diff --git a/qt/search_panel.hpp b/qt/search_panel.hpp
index d5cc2ef4c5..84ef17c3b4 100644
--- a/qt/search_panel.hpp
+++ b/qt/search_panel.hpp
@@ -63,7 +63,6 @@ private slots:
void OnAnimationTimer();
void OnClearButton();
- bool TryChangeMapStyleCmd(QString const & str);
bool TryChangeRouterCmd(QString const & str);
bool Try3dModeCmd(QString const & str);
bool TryMigrate(QString const & str);