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

MWMTTSLanguageViewController.mm « Maps « iphone - github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 8b1e2b269a36e46e2931ae2cab7abcc36cf45ba7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#import "MWMTextToSpeech.h"
#import "MWMTTSLanguageViewController.h"
#import "MWMTTSSettingsViewController.h"
#import "SelectableCell.h"
#import "UIColor+MapsMeColor.h"

static NSString * const kUnwingSegueIdentifier = @"UnwindToTTSSettings";

@implementation MWMTTSLanguageViewController

- (void)viewDidLoad
{
  [super viewDidLoad];
  self.title = L(@"pref_tts_other_section_title");
  self.tableView.separatorColor = [UIColor blackDividers];
}

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(SelectableCell *)sender
{
  if (![segue.identifier isEqualToString:kUnwingSegueIdentifier])
    return;
  MWMTTSSettingsViewController * dest = segue.destinationViewController;
  NSUInteger const row = [self.tableView indexPathForCell:sender].row;
  [dest setAdditionalTTSLanguage:[[MWMTextToSpeech tts] availableLanguages][row]];
}

#pragma mark - UITableViewDataSource && UITableViewDelegate

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
  return [[MWMTextToSpeech tts] availableLanguages].size();
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
  SelectableCell * cell = (SelectableCell *)[tableView dequeueReusableCellWithIdentifier:[SelectableCell className]];
  cell.titleLabel.text = @([[MWMTextToSpeech tts] availableLanguages][indexPath.row].second.c_str());
  return cell;
}

@end