From d16271378329caaa4321b33ecb1e26988daa4889 Mon Sep 17 00:00:00 2001 From: "r.kuznetsov" Date: Fri, 16 Oct 2015 14:14:31 +0300 Subject: [PATCH] Fixes after rebase --- android/jni/com/mapswithme/maps/Framework.cpp | 5 +++++ android/jni/com/mapswithme/maps/Framework.hpp | 2 ++ .../jni/com/mapswithme/maps/settings/UnitLocale.cpp | 1 + .../BottomMenu/MWMBottomMenuViewController.mm | 10 +++++----- iphone/Maps/Settings/Preferences.mm | 9 ++++++--- iphone/Maps/Settings/SettingsViewController.mm | 2 +- map/framework.cpp | 2 ++ map/framework.hpp | 2 ++ qt/mainwindow.cpp | 1 + 9 files changed, 25 insertions(+), 9 deletions(-) diff --git a/android/jni/com/mapswithme/maps/Framework.cpp b/android/jni/com/mapswithme/maps/Framework.cpp index 3ca9a42cdb..5f55e15191 100644 --- a/android/jni/com/mapswithme/maps/Framework.cpp +++ b/android/jni/com/mapswithme/maps/Framework.cpp @@ -477,6 +477,11 @@ void Framework::ApplyWidgets() m_work.SetWidgetLayout(move(layout)); } +void Framework::SetupMeasurementSystem() +{ + m_work.SetupMeasurementSystem(); +} + ////////////////////////////////////////////////////////////////////////////////////////// void Framework::ItemStatusChanged(int childPosition) { diff --git a/android/jni/com/mapswithme/maps/Framework.hpp b/android/jni/com/mapswithme/maps/Framework.hpp index 4c75e71b62..932ab26856 100644 --- a/android/jni/com/mapswithme/maps/Framework.hpp +++ b/android/jni/com/mapswithme/maps/Framework.hpp @@ -83,6 +83,8 @@ namespace android void SetMapStyle(MapStyle mapStyle); MapStyle GetMapStyle() const; + void SetupMeasurementSystem(); + void SetRouter(routing::RouterType type) { m_work.SetRouter(type); } routing::RouterType GetRouter() const { return m_work.GetRouter(); } routing::RouterType GetLastUsedRouter() const { return m_work.GetLastUsedRouter(); } diff --git a/android/jni/com/mapswithme/maps/settings/UnitLocale.cpp b/android/jni/com/mapswithme/maps/settings/UnitLocale.cpp index de718d8bf5..b44de3438f 100644 --- a/android/jni/com/mapswithme/maps/settings/UnitLocale.cpp +++ b/android/jni/com/mapswithme/maps/settings/UnitLocale.cpp @@ -10,6 +10,7 @@ extern "C" { Settings::Units const u = static_cast(units); Settings::Set("Units", u); + g_framework->SetupMeasurementSystem(); } JNIEXPORT jint JNICALL diff --git a/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuViewController.mm b/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuViewController.mm index 7a4e8156fe..cb1d84e039 100644 --- a/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuViewController.mm +++ b/iphone/Maps/Classes/CustomViews/MapViewControls/BottomMenu/MWMBottomMenuViewController.mm @@ -201,25 +201,25 @@ typedef NS_ENUM(NSUInteger, MWMBottomMenuViewCell) break; } } - [self refreshLocationButtonState]; + [self refreshLocationButtonState: state]; } -- (void)refreshLocationButtonState +- (void)refreshLocationButtonState:(location::EMyPositionMode)state { dispatch_async(dispatch_get_main_queue(), ^ { if (self.locationButton.imageView.isAnimating) { - [self refreshLocationButtonState]; + [self refreshLocationButtonState: state]; } else { UIButton * locBtn = self.locationButton; - switch (self.locationState) + switch (state) { case location::MODE_PENDING_POSITION: break; - case location::State::Mode::UnknownPosition: + case location::MODE_UNKNOWN_POSITION: [locBtn setImage:[UIImage imageNamed:@"ic_menu_location_off_mode_light"] forState:UIControlStateNormal]; break; case location::MODE_NOT_FOLLOW: diff --git a/iphone/Maps/Settings/Preferences.mm b/iphone/Maps/Settings/Preferences.mm index b26fb744b3..402962e9df 100644 --- a/iphone/Maps/Settings/Preferences.mm +++ b/iphone/Maps/Settings/Preferences.mm @@ -22,12 +22,14 @@ + (void)setup:(id)controller { Settings::Units u; - if (!Settings::Get("Units", u)) + if (!Settings::Get("Units", u)) { // get system locale preferences BOOL const isMetric = [[[NSLocale autoupdatingCurrentLocale] objectForKey:NSLocaleUsesMetricSystem] boolValue]; if (isMetric) + { u = Settings::Metric; + } else { u = Settings::Foot; @@ -35,9 +37,10 @@ PrefDelegate * d = [[PrefDelegate alloc] init]; d.m_controller = controller; } - + Settings::Set("Units", u); } + GetFramework().SetupMeasurementSystem(); } -@end +@end \ No newline at end of file diff --git a/iphone/Maps/Settings/SettingsViewController.mm b/iphone/Maps/Settings/SettingsViewController.mm index 1ff5d9e01e..dc6a28be37 100644 --- a/iphone/Maps/Settings/SettingsViewController.mm +++ b/iphone/Maps/Settings/SettingsViewController.mm @@ -223,7 +223,7 @@ Settings::Units unitsForIndex(NSInteger index) withParameters:@{kStatValue : (units == Settings::Units::Metric ? kStatKilometers : kStatMiles)}]; Settings::Set("Units", units); [tableView reloadSections:[NSIndexSet indexSetWithIndex:SectionMetrics] withRowAnimation:UITableViewRowAnimationFade]; - GetPlatform().SetupMeasurementSystem(); + GetFramework().SetupMeasurementSystem(); } else if (section == SectionRouting && indexPath.row == 1) { diff --git a/map/framework.cpp b/map/framework.cpp index f2dd6b1e5a..99a1aa8dad 100644 --- a/map/framework.cpp +++ b/map/framework.cpp @@ -1314,6 +1314,8 @@ MapStyle Framework::GetMapStyle() const void Framework::SetupMeasurementSystem() { + GetPlatform().SetupMeasurementSystem(); + Settings::Units units = Settings::Metric; Settings::Get("Units", units); diff --git a/map/framework.hpp b/map/framework.hpp index 381bdc08d6..c48d1734ad 100644 --- a/map/framework.hpp +++ b/map/framework.hpp @@ -310,6 +310,8 @@ public: void SetMapStyle(MapStyle mapStyle); MapStyle GetMapStyle() const; + void SetupMeasurementSystem(); + void SetWidgetLayout(gui::TWidgetsLayoutInfo && layout); const gui::TWidgetsSizeInfo & GetWidgetSizes(); diff --git a/qt/mainwindow.cpp b/qt/mainwindow.cpp index 446a4195ed..de45ee2cd4 100644 --- a/qt/mainwindow.cpp +++ b/qt/mainwindow.cpp @@ -386,6 +386,7 @@ void MainWindow::OnPreferences() PreferencesDialog dlg(this); dlg.exec(); + m_pDrawWidget->GetFramework().SetupMeasurementSystem(); m_pDrawWidget->GetFramework().EnterForeground(); }