diff options
author | VladiMihaylenko <vxmihaylenko@gmail.com> | 2015-12-30 15:40:12 +0300 |
---|---|---|
committer | VladiMihaylenko <vxmihaylenko@gmail.com> | 2015-12-30 16:36:37 +0300 |
commit | 8241a84e00575582f01fc44e8d3ce09ffa235aad (patch) | |
tree | 522d1c67b0294aef88f79bf6d98f1ef946496ad6 /iphone/Maps/Settings | |
parent | 1115e1d9086dd6cbaf01d88241768086c1dc50ba (diff) |
[ios] Changed 3d view and 3d buildings logic.
Diffstat (limited to 'iphone/Maps/Settings')
-rw-r--r-- | iphone/Maps/Settings/SettingsViewController.mm | 104 |
1 files changed, 62 insertions, 42 deletions
diff --git a/iphone/Maps/Settings/SettingsViewController.mm b/iphone/Maps/Settings/SettingsViewController.mm index 7670d76314..6294233a86 100644 --- a/iphone/Maps/Settings/SettingsViewController.mm +++ b/iphone/Maps/Settings/SettingsViewController.mm @@ -66,10 +66,10 @@ typedef NS_ENUM(NSUInteger, Section) switch (sections[section]) { case SectionMetrics: + case SectionMap: return 2; case SectionRouting: return 3; - case SectionMap: case SectionAd: case SectionStatistics: case SectionCalibration: @@ -117,22 +117,22 @@ typedef NS_ENUM(NSUInteger, Section) } case SectionMap: { -// if (indexPath.row == 0) -// { -// cell = [tableView dequeueReusableCellWithIdentifier:[LinkCell className]]; -// LinkCell * linkCell = static_cast<LinkCell *>(cell); -// linkCell.titleLabel.text = L(@"recent_track"); -// } -// else -// { - cell = [tableView dequeueReusableCellWithIdentifier:[SwitchCell className]]; - SwitchCell * customCell = (SwitchCell *)cell; - bool on = true; + cell = [tableView dequeueReusableCellWithIdentifier:[SwitchCell className]]; + SwitchCell * customCell = (SwitchCell *)cell; + bool on = true; + if (indexPath.row == 0) + { + bool _ = true; + GetFramework().Load3dMode(_, on); + customCell.titleLabel.text = L(@"pref_3d_buildings"); + } + else + { (void)Settings::Get("ZoomButtonsEnabled", on); - customCell.switchButton.on = on; customCell.titleLabel.text = L(@"pref_zoom_title"); - customCell.delegate = self; -// } + } + customCell.switchButton.on = on; + customCell.delegate = self; break; } case SectionRouting: @@ -141,9 +141,13 @@ typedef NS_ENUM(NSUInteger, Section) { case 0: { - cell = [tableView dequeueReusableCellWithIdentifier:[LinkCell className]]; - LinkCell * customCell = (LinkCell *)cell; - customCell.titleLabel.text = L(@"prefs_map_view_title"); + cell = [tableView dequeueReusableCellWithIdentifier:[SwitchCell className]]; + SwitchCell * customCell = (SwitchCell *)cell; + customCell.titleLabel.text = L(@"prefs_3d_mode"); + customCell.delegate = self; + bool _ = true, on = true; + GetFramework().Load3dMode(on, _); + customCell.switchButton.on = on; break; } case 1: @@ -212,10 +216,24 @@ typedef NS_ENUM(NSUInteger, Section) break; case SectionMap: - [stat logEvent:kStatEventName(kStatSettings, kStatToggleZoomButtonsVisibility) - withParameters:@{kStatValue : (value ? kStatVisible : kStatHidden)}]; - Settings::Set("ZoomButtonsEnabled", (bool)value); - [MapsAppDelegate theApp].mapViewController.controlsManager.zoomHidden = !value; + if (indexPath.row == 0) + { + [[Statistics instance] logEvent:kStatEventName(kStatSettings, kStat3DBuildings) + withParameters:@{kStatValue : (value ? kStatOn : kStatOff)}]; + auto & f = GetFramework(); + bool _ = true, is3dBuildings = true; + f.Load3dMode(_, is3dBuildings); + is3dBuildings = static_cast<bool>(value); + f.Save3dMode(_, is3dBuildings); + f.Allow3dMode(_, is3dBuildings); + } + else + { + [stat logEvent:kStatEventName(kStatSettings, kStatToggleZoomButtonsVisibility) + withParameters:@{kStatValue : (value ? kStatVisible : kStatHidden)}]; + Settings::Set("ZoomButtonsEnabled", (bool)value); + [MapsAppDelegate theApp].mapViewController.controlsManager.zoomHidden = !value; + } break; case SectionCalibration: @@ -225,11 +243,25 @@ typedef NS_ENUM(NSUInteger, Section) break; case SectionRouting: - [[Statistics instance] logEvent:kStatEventName(kStatSettings, kStatTTS) - withParameters:@{kStatValue : value ? kStatOn : kStatOff}]; - [[MWMTextToSpeech tts] setNeedToEnable:value]; - [[NSNotificationCenter defaultCenter] postNotificationName:kTTSStatusWasChangedNotification - object:nil userInfo:@{@"on" : @(value)}]; + if (indexPath.row == 0) + { + [[Statistics instance] logEvent:kStatEventName(kStatSettings, kStat3D) + withParameters:@{kStatValue : (value ? kStatOn : kStatOff)}]; + auto & f = GetFramework(); + bool _ = true, is3d = true; + f.Load3dMode(is3d, _); + is3d = static_cast<bool>(value); + f.Save3dMode(is3d, _); + f.Allow3dMode(is3d, _); + } + else + { + [[Statistics instance] logEvent:kStatEventName(kStatSettings, kStatTTS) + withParameters:@{kStatValue : value ? kStatOn : kStatOff}]; + [[MWMTextToSpeech tts] setNeedToEnable:value]; + [[NSNotificationCenter defaultCenter] postNotificationName:kTTSStatusWasChangedNotification + object:nil userInfo:@{@"on" : @(value)}]; + } break; case SectionMetrics: @@ -257,24 +289,12 @@ Settings::Units unitsForIndex(NSInteger index) break; } case SectionRouting: - if (indexPath.row == 0) - { - [[Statistics instance] logEvent:kStatEventName(kStatSettings, kStatMapViewStyle) - withParameters:@{kStatAction : kStatChangeMapViewStyle}]; - [self performSegueWithIdentifier:@"SettingsToMapViewSegue" sender:nil]; - } - else if (indexPath.row == 2) - { - [[Statistics instance] logEvent:kStatEventName(kStatSettings, kStatTTS) - withParameters:@{kStatAction : kStatChangeLanguage}]; - [self performSegueWithIdentifier:@"SettingsToTTSSegue" sender:nil]; - } + [[Statistics instance] logEvent:kStatEventName(kStatSettings, kStatTTS) + withParameters:@{kStatAction : kStatChangeLanguage}]; + [self performSegueWithIdentifier:@"SettingsToTTSSegue" sender:nil]; break; case SectionMap: -// if (indexPath.row == 0) -// [self performSegueWithIdentifier:@"SettingsToRecentTrackSegue" sender:nil]; -// break; case SectionAd: case SectionCalibration: case SectionStatistics: |